@budibase/types 2.5.6-alpha.16 → 2.5.6-alpha.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/dist/cjs/api/account/license.d.ts +9 -1
  2. package/dist/cjs/api/web/user.d.ts +17 -15
  3. package/dist/cjs/documents/account/account.d.ts +3 -0
  4. package/dist/cjs/documents/account/account.js.map +1 -1
  5. package/dist/cjs/documents/global/quotas.d.ts +1 -0
  6. package/dist/cjs/sdk/licensing/billing.d.ts +1 -0
  7. package/dist/cjs/sdk/licensing/feature.d.ts +4 -0
  8. package/dist/cjs/sdk/licensing/feature.js.map +1 -1
  9. package/dist/cjs/sdk/licensing/license.d.ts +3 -2
  10. package/dist/cjs/sdk/licensing/plan.d.ts +25 -6
  11. package/dist/cjs/sdk/licensing/plan.js +9 -1
  12. package/dist/cjs/sdk/licensing/plan.js.map +1 -1
  13. package/dist/cjs/sdk/licensing/quota.d.ts +10 -5
  14. package/dist/cjs/sdk/licensing/quota.js +1 -1
  15. package/dist/cjs/sdk/licensing/quota.js.map +1 -1
  16. package/dist/cjs/sdk/locks.d.ts +10 -2
  17. package/dist/cjs/sdk/locks.js +2 -0
  18. package/dist/cjs/sdk/locks.js.map +1 -1
  19. package/dist/cjs/tsconfig-cjs.build.tsbuildinfo +1 -1
  20. package/dist/mjs/api/account/license.d.ts +9 -1
  21. package/dist/mjs/api/web/user.d.ts +17 -15
  22. package/dist/mjs/documents/account/account.d.ts +3 -0
  23. package/dist/mjs/documents/account/account.js +1 -1
  24. package/dist/mjs/documents/account/account.js.map +1 -1
  25. package/dist/mjs/documents/global/quotas.d.ts +1 -0
  26. package/dist/mjs/sdk/licensing/billing.d.ts +1 -0
  27. package/dist/mjs/sdk/licensing/feature.d.ts +4 -0
  28. package/dist/mjs/sdk/licensing/feature.js.map +1 -1
  29. package/dist/mjs/sdk/licensing/license.d.ts +3 -2
  30. package/dist/mjs/sdk/licensing/plan.d.ts +25 -6
  31. package/dist/mjs/sdk/licensing/plan.js +8 -0
  32. package/dist/mjs/sdk/licensing/plan.js.map +1 -1
  33. package/dist/mjs/sdk/licensing/quota.d.ts +10 -5
  34. package/dist/mjs/sdk/licensing/quota.js +1 -1
  35. package/dist/mjs/sdk/licensing/quota.js.map +1 -1
  36. package/dist/mjs/sdk/locks.d.ts +10 -2
  37. package/dist/mjs/sdk/locks.js +2 -0
  38. package/dist/mjs/sdk/locks.js.map +1 -1
  39. package/dist/mjs/tsconfig.build.tsbuildinfo +1 -1
  40. package/package.json +3 -2
  41. package/src/api/account/license.ts +12 -1
  42. package/src/api/web/user.ts +12 -8
  43. package/src/documents/account/account.ts +5 -11
  44. package/src/documents/global/quotas.ts +1 -0
  45. package/src/sdk/licensing/billing.ts +1 -0
  46. package/src/sdk/licensing/feature.ts +4 -0
  47. package/src/sdk/licensing/license.ts +3 -2
  48. package/src/sdk/licensing/plan.ts +29 -7
  49. package/src/sdk/licensing/quota.ts +9 -6
  50. package/src/sdk/locks.ts +9 -0
@@ -1,12 +1,10 @@
1
- export interface AccountPlan {
2
- type: PlanType
3
- price?: Price
4
- }
5
-
6
1
  export enum PlanType {
7
2
  FREE = "free",
3
+ /** @deprecated */
8
4
  PRO = "pro",
5
+ /** @deprecated */
9
6
  TEAM = "team",
7
+ PREMIUM = "premium",
10
8
  BUSINESS = "business",
11
9
  ENTERPRISE = "enterprise",
12
10
  }
@@ -16,12 +14,36 @@ export enum PriceDuration {
16
14
  YEARLY = "yearly",
17
15
  }
18
16
 
19
- export interface Price {
17
+ export interface AvailablePlan {
18
+ type: PlanType
19
+ maxUsers: number
20
+ minUsers: number
21
+ prices: AvailablePrice[]
22
+ }
23
+
24
+ export interface AvailablePrice {
20
25
  amount: number
21
26
  amountMonthly: number
22
27
  currency: string
23
28
  duration: PriceDuration
24
29
  priceId: string
25
- dayPasses: number
30
+ }
31
+
32
+ export enum PlanModel {
33
+ PER_USER = "perUser",
34
+ DAY_PASS = "dayPass",
35
+ }
36
+
37
+ export interface PurchasedPlan {
38
+ type: PlanType
39
+ model: PlanModel
40
+ usesInvoicing: boolean
41
+ minUsers: number
42
+ price?: PurchasedPrice
43
+ }
44
+
45
+ export interface PurchasedPrice extends AvailablePrice {
46
+ dayPasses: number | undefined
47
+ /** @deprecated - now at the plan level via model */
26
48
  isPerUser: boolean
27
49
  }
@@ -13,6 +13,7 @@ export enum QuotaType {
13
13
  export enum StaticQuotaName {
14
14
  ROWS = "rows",
15
15
  APPS = "apps",
16
+ USERS = "users",
16
17
  USER_GROUPS = "userGroups",
17
18
  PLUGINS = "plugins",
18
19
  }
@@ -54,14 +55,14 @@ export const isConstantQuota = (
54
55
  return quotaType === QuotaType.CONSTANT
55
56
  }
56
57
 
57
- export type PlanQuotas = {
58
- [PlanType.FREE]: Quotas
59
- [PlanType.PRO]: Quotas
60
- [PlanType.TEAM]: Quotas
61
- [PlanType.BUSINESS]: Quotas
62
- [PlanType.ENTERPRISE]: Quotas
58
+ export interface Minimums {
59
+ users: number
63
60
  }
64
61
 
62
+ export type PlanMinimums = { [key in PlanType]: Minimums }
63
+
64
+ export type PlanQuotas = { [key in PlanType]: Quotas | undefined }
65
+
65
66
  export type MonthlyQuotas = {
66
67
  [MonthlyQuotaName.QUERIES]: Quota
67
68
  [MonthlyQuotaName.AUTOMATIONS]: Quota
@@ -71,6 +72,7 @@ export type MonthlyQuotas = {
71
72
  export type StaticQuotas = {
72
73
  [StaticQuotaName.ROWS]: Quota
73
74
  [StaticQuotaName.APPS]: Quota
75
+ [StaticQuotaName.USERS]: Quota
74
76
  [StaticQuotaName.USER_GROUPS]: Quota
75
77
  [StaticQuotaName.PLUGINS]: Quota
76
78
  }
@@ -99,4 +101,5 @@ export interface Quota {
99
101
  * which can have subsequent effects such as sending emails to users.
100
102
  */
101
103
  triggers: number[]
104
+ startDate?: number
102
105
  }
package/src/sdk/locks.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import Redlock from "redlock"
2
+
1
3
  export enum LockType {
2
4
  /**
3
5
  * If this lock is already held the attempted operation will not be performed.
@@ -6,6 +8,7 @@ export enum LockType {
6
8
  TRY_ONCE = "try_once",
7
9
  DEFAULT = "default",
8
10
  DELAY_500 = "delay_500",
11
+ CUSTOM = "custom",
9
12
  }
10
13
 
11
14
  export enum LockName {
@@ -14,6 +17,7 @@ export enum LockName {
14
17
  SYNC_ACCOUNT_LICENSE = "sync_account_license",
15
18
  UPDATE_TENANTS_DOC = "update_tenants_doc",
16
19
  PERSIST_WRITETHROUGH = "persist_writethrough",
20
+ QUOTA_USAGE_EVENT = "quota_usage_event",
17
21
  }
18
22
 
19
23
  export interface LockOptions {
@@ -21,6 +25,11 @@ export interface LockOptions {
21
25
  * The lock type determines which client to use
22
26
  */
23
27
  type: LockType
28
+ /**
29
+ * The custom options to use when creating the redlock instance
30
+ * type must be set to custom for the options to be applied
31
+ */
32
+ customOptions?: Redlock.Options
24
33
  /**
25
34
  * The name for the lock
26
35
  */