core structure updates

This commit is contained in:
Rory Powell 2023-07-14 11:44:05 +01:00
parent 41dc86436c
commit 3326d061f1
6 changed files with 22 additions and 9 deletions

View File

@ -1,4 +1,4 @@
import { structures } from ".."
import { generator } from "./generator"
import { newid } from "../../../../src/docIds/newid"
export function id() {
@ -6,7 +6,7 @@ export function id() {
}
export function rev() {
return `${structures.generator.character({
return `${generator.character({
numeric: true,
})}-${structures.uuid().replace(/-/, "")}`
})}-${generator.guid().replace(/-/, "")}`
}

View File

@ -0,0 +1 @@
export * from "./platform"

View File

@ -0,0 +1 @@
export * as installation from "./installation"

View File

@ -1,9 +1,11 @@
import { generator } from "@budibase/backend-core/tests"
import { Installation } from "@budibase/types"
import * as db from "../../db"
export function install(): Installation {
return {
_id: "install",
_rev: db.rev(),
installId: generator.guid(),
version: generator.string()
}

View File

@ -2,7 +2,7 @@ export * from "./common"
export * as accounts from "./accounts"
export * as apps from "./apps"
export * as db from "./db"
export * as installation from "./installation"
export * as docs from "./documents"
export * as koa from "./koa"
export * as licenses from "./licenses"
export * as plugins from "./plugins"

View File

@ -2,7 +2,9 @@ import {
Billing,
Customer,
Feature,
License, OfflineLicense,
License,
OfflineIdentifier,
OfflineLicense,
PlanModel,
PlanType,
PriceDuration,
@ -154,9 +156,16 @@ export function offlineLicense (
return {
...base,
expireAt: new Date().toISOString(),
identifier: {
installId: generator.guid(),
tenantId: generator.guid()
}
identifier: offlineIdentifier()
}
}
export function offlineIdentifier(
installId: string = generator.guid(),
tenantId: string = generator.guid(),
): OfflineIdentifier {
return {
installId,
tenantId
}
}