Add enterprise types and change from @budibase/pro to @budibase/types for licensing types
This commit is contained in:
parent
408fcc725b
commit
f984a16942
|
@ -1,6 +1,7 @@
|
||||||
import { getTenantId } from "@budibase/backend-core/tenancy"
|
import { getTenantId } from "@budibase/backend-core/tenancy"
|
||||||
import { getAllApps } from "@budibase/backend-core/db"
|
import { getAllApps } from "@budibase/backend-core/db"
|
||||||
import { quotas, QuotaUsageType, StaticQuotaName } from "@budibase/pro"
|
import { quotas } from "@budibase/pro"
|
||||||
|
import { QuotaUsageType, StaticQuotaName } from "@budibase/types"
|
||||||
|
|
||||||
export const run = async () => {
|
export const run = async () => {
|
||||||
// get app count
|
// get app count
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
import { getTenantId } from "@budibase/backend-core/tenancy"
|
import { getTenantId } from "@budibase/backend-core/tenancy"
|
||||||
import { getAllApps } from "@budibase/backend-core/db"
|
import { getAllApps } from "@budibase/backend-core/db"
|
||||||
import { getUniqueRows } from "../../../utilities/usageQuota/rows"
|
import { getUniqueRows } from "../../../utilities/usageQuota/rows"
|
||||||
import { quotas, QuotaUsageType, StaticQuotaName } from "@budibase/pro"
|
import { quotas } from "@budibase/pro"
|
||||||
|
import { QuotaUsageType, StaticQuotaName } from "@budibase/types"
|
||||||
|
|
||||||
export const run = async () => {
|
export const run = async () => {
|
||||||
// get all rows in all apps
|
// get all rows in all apps
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import TestConfig from "../../../../tests/utilities/TestConfiguration"
|
import TestConfig from "../../../../tests/utilities/TestConfiguration"
|
||||||
import * as syncApps from "../syncApps"
|
import * as syncApps from "../syncApps"
|
||||||
import { quotas, QuotaUsageType, StaticQuotaName } from "@budibase/pro"
|
import { quotas } from "@budibase/pro"
|
||||||
|
import { QuotaUsageType, StaticQuotaName } from "@budibase/types"
|
||||||
|
|
||||||
describe("syncApps", () => {
|
describe("syncApps", () => {
|
||||||
let config = new TestConfig(false)
|
let config = new TestConfig(false)
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import TestConfig from "../../../../tests/utilities/TestConfiguration"
|
import TestConfig from "../../../../tests/utilities/TestConfiguration"
|
||||||
import * as syncRows from "../syncRows"
|
import * as syncRows from "../syncRows"
|
||||||
import { quotas, QuotaUsageType, StaticQuotaName } from "@budibase/pro"
|
import { quotas } from "@budibase/pro"
|
||||||
|
import { QuotaUsageType, StaticQuotaName } from "@budibase/types"
|
||||||
|
|
||||||
describe("syncRows", () => {
|
describe("syncRows", () => {
|
||||||
let config = new TestConfig(false)
|
let config = new TestConfig(false)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Hosting } from "../../sdk"
|
import { Feature, Hosting, PlanType, Quotas } from "../../sdk"
|
||||||
|
|
||||||
export interface CreateAccount {
|
export interface CreateAccount {
|
||||||
email: string
|
email: string
|
||||||
|
@ -22,6 +22,11 @@ export const isCreatePasswordAccount = (
|
||||||
account: CreateAccount
|
account: CreateAccount
|
||||||
): account is CreatePassswordAccount => account.authType === AuthType.PASSWORD
|
): account is CreatePassswordAccount => account.authType === AuthType.PASSWORD
|
||||||
|
|
||||||
|
export interface LicenseOverrides {
|
||||||
|
features?: Feature[]
|
||||||
|
quotas?: Quotas
|
||||||
|
}
|
||||||
|
|
||||||
export interface Account extends CreateAccount {
|
export interface Account extends CreateAccount {
|
||||||
// generated
|
// generated
|
||||||
accountId: string
|
accountId: string
|
||||||
|
@ -31,9 +36,11 @@ export interface Account extends CreateAccount {
|
||||||
verificationSent: boolean
|
verificationSent: boolean
|
||||||
// licensing
|
// licensing
|
||||||
tier: string // deprecated
|
tier: string // deprecated
|
||||||
|
planType?: PlanType
|
||||||
stripeCustomerId?: string
|
stripeCustomerId?: string
|
||||||
licenseKey?: string
|
licenseKey?: string
|
||||||
licenseKeyActivatedAt?: number
|
licenseKeyActivatedAt?: number
|
||||||
|
licenseOverrides?: LicenseOverrides
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PasswordAccount extends Account {
|
export interface PasswordAccount extends Account {
|
||||||
|
|
|
@ -2,3 +2,4 @@ export * from "./config"
|
||||||
export * from "./user"
|
export * from "./user"
|
||||||
export * from "./userGroup"
|
export * from "./userGroup"
|
||||||
export * from "./plugin"
|
export * from "./plugin"
|
||||||
|
export * from "./quotas"
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
import { MonthlyQuotaName, StaticQuotaName } from "../../sdk"
|
||||||
|
|
||||||
|
export interface QuotaUsage {
|
||||||
|
_id: string
|
||||||
|
_rev?: string
|
||||||
|
quotaReset: string
|
||||||
|
usageQuota: {
|
||||||
|
[key in StaticQuotaName]: number
|
||||||
|
}
|
||||||
|
monthly: {
|
||||||
|
[key: string]: {
|
||||||
|
[key in MonthlyQuotaName]: number
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -12,6 +12,9 @@ export interface Subscription {
|
||||||
cancelAt: number | null | undefined
|
cancelAt: number | null | undefined
|
||||||
currentPeriodStart: number
|
currentPeriodStart: number
|
||||||
currentPeriodEnd: number
|
currentPeriodEnd: number
|
||||||
|
status: string
|
||||||
|
pastDueAt?: number | null
|
||||||
|
downgradeAt?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Billing {
|
export interface Billing {
|
||||||
|
|
|
@ -6,6 +6,7 @@ export interface AccountPlan {
|
||||||
export enum PlanType {
|
export enum PlanType {
|
||||||
FREE = "free",
|
FREE = "free",
|
||||||
PRO = "pro",
|
PRO = "pro",
|
||||||
|
TEAM = "team",
|
||||||
BUSINESS = "business",
|
BUSINESS = "business",
|
||||||
ENTERPRISE = "enterprise",
|
ENTERPRISE = "enterprise",
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ export enum QuotaType {
|
||||||
export enum StaticQuotaName {
|
export enum StaticQuotaName {
|
||||||
ROWS = "rows",
|
ROWS = "rows",
|
||||||
APPS = "apps",
|
APPS = "apps",
|
||||||
|
USER_GROUPS = "userGroups",
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum MonthlyQuotaName {
|
export enum MonthlyQuotaName {
|
||||||
|
@ -22,7 +23,6 @@ export enum MonthlyQuotaName {
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum ConstantQuotaName {
|
export enum ConstantQuotaName {
|
||||||
QUERY_TIMEOUT_SECONDS = "queryTimeoutSeconds",
|
|
||||||
AUTOMATION_LOG_RETENTION_DAYS = "automationLogRetentionDays",
|
AUTOMATION_LOG_RETENTION_DAYS = "automationLogRetentionDays",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,6 +54,7 @@ export const isConstantQuota = (
|
||||||
export type PlanQuotas = {
|
export type PlanQuotas = {
|
||||||
[PlanType.FREE]: Quotas
|
[PlanType.FREE]: Quotas
|
||||||
[PlanType.PRO]: Quotas
|
[PlanType.PRO]: Quotas
|
||||||
|
[PlanType.TEAM]: Quotas
|
||||||
[PlanType.BUSINESS]: Quotas
|
[PlanType.BUSINESS]: Quotas
|
||||||
[PlanType.ENTERPRISE]: Quotas
|
[PlanType.ENTERPRISE]: Quotas
|
||||||
}
|
}
|
||||||
|
@ -68,10 +69,10 @@ export type Quotas = {
|
||||||
[QuotaUsageType.STATIC]: {
|
[QuotaUsageType.STATIC]: {
|
||||||
[StaticQuotaName.ROWS]: Quota
|
[StaticQuotaName.ROWS]: Quota
|
||||||
[StaticQuotaName.APPS]: Quota
|
[StaticQuotaName.APPS]: Quota
|
||||||
|
[StaticQuotaName.USER_GROUPS]: Quota
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[QuotaType.CONSTANT]: {
|
[QuotaType.CONSTANT]: {
|
||||||
[ConstantQuotaName.QUERY_TIMEOUT_SECONDS]: Quota
|
|
||||||
[ConstantQuotaName.AUTOMATION_LOG_RETENTION_DAYS]: Quota
|
[ConstantQuotaName.AUTOMATION_LOG_RETENTION_DAYS]: Quota
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue