1
0
Fork 0
mirror of synced 2024-06-30 20:10:54 +12:00

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
}
}