@budibase/types 2.5.6-alpha.3 → 2.5.6-alpha.31

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 (81) hide show
  1. package/dist/cjs/api/account/license.d.ts +15 -2
  2. package/dist/cjs/api/web/user.d.ts +17 -15
  3. package/dist/cjs/documents/account/account.d.ts +5 -1
  4. package/dist/cjs/documents/account/account.js.map +1 -1
  5. package/dist/cjs/documents/app/automation.d.ts +57 -8
  6. package/dist/cjs/documents/app/automation.js +37 -1
  7. package/dist/cjs/documents/app/automation.js.map +1 -1
  8. package/dist/cjs/documents/app/table.d.ts +3 -0
  9. package/dist/cjs/documents/global/plugin.d.ts +2 -1
  10. package/dist/cjs/documents/global/plugin.js +1 -0
  11. package/dist/cjs/documents/global/plugin.js.map +1 -1
  12. package/dist/cjs/documents/global/quotas.d.ts +1 -0
  13. package/dist/cjs/sdk/licensing/billing.d.ts +1 -0
  14. package/dist/cjs/sdk/licensing/feature.d.ts +4 -0
  15. package/dist/cjs/sdk/licensing/feature.js.map +1 -1
  16. package/dist/cjs/sdk/licensing/license.d.ts +3 -2
  17. package/dist/cjs/sdk/licensing/plan.d.ts +25 -6
  18. package/dist/cjs/sdk/licensing/plan.js +9 -1
  19. package/dist/cjs/sdk/licensing/plan.js.map +1 -1
  20. package/dist/cjs/sdk/licensing/quota.d.ts +10 -5
  21. package/dist/cjs/sdk/licensing/quota.js +1 -1
  22. package/dist/cjs/sdk/licensing/quota.js.map +1 -1
  23. package/dist/cjs/sdk/locks.d.ts +10 -2
  24. package/dist/cjs/sdk/locks.js +2 -0
  25. package/dist/cjs/sdk/locks.js.map +1 -1
  26. package/dist/cjs/shared/index.d.ts +1 -0
  27. package/dist/cjs/shared/index.js +18 -0
  28. package/dist/cjs/shared/index.js.map +1 -0
  29. package/dist/cjs/shared/typeUtils.d.ts +3 -0
  30. package/dist/cjs/shared/typeUtils.js +3 -0
  31. package/dist/cjs/shared/typeUtils.js.map +1 -0
  32. package/dist/cjs/tsconfig-cjs.build.tsbuildinfo +1 -1
  33. package/dist/mjs/api/account/license.d.ts +15 -2
  34. package/dist/mjs/api/web/user.d.ts +17 -15
  35. package/dist/mjs/documents/account/account.d.ts +5 -1
  36. package/dist/mjs/documents/account/account.js +1 -1
  37. package/dist/mjs/documents/account/account.js.map +1 -1
  38. package/dist/mjs/documents/app/automation.d.ts +57 -8
  39. package/dist/mjs/documents/app/automation.js +36 -0
  40. package/dist/mjs/documents/app/automation.js.map +1 -1
  41. package/dist/mjs/documents/app/table.d.ts +3 -0
  42. package/dist/mjs/documents/global/plugin.d.ts +2 -1
  43. package/dist/mjs/documents/global/plugin.js +1 -0
  44. package/dist/mjs/documents/global/plugin.js.map +1 -1
  45. package/dist/mjs/documents/global/quotas.d.ts +1 -0
  46. package/dist/mjs/sdk/licensing/billing.d.ts +1 -0
  47. package/dist/mjs/sdk/licensing/feature.d.ts +4 -0
  48. package/dist/mjs/sdk/licensing/feature.js.map +1 -1
  49. package/dist/mjs/sdk/licensing/license.d.ts +3 -2
  50. package/dist/mjs/sdk/licensing/plan.d.ts +25 -6
  51. package/dist/mjs/sdk/licensing/plan.js +8 -0
  52. package/dist/mjs/sdk/licensing/plan.js.map +1 -1
  53. package/dist/mjs/sdk/licensing/quota.d.ts +10 -5
  54. package/dist/mjs/sdk/licensing/quota.js +1 -1
  55. package/dist/mjs/sdk/licensing/quota.js.map +1 -1
  56. package/dist/mjs/sdk/locks.d.ts +10 -2
  57. package/dist/mjs/sdk/locks.js +2 -0
  58. package/dist/mjs/sdk/locks.js.map +1 -1
  59. package/dist/mjs/shared/index.d.ts +1 -0
  60. package/dist/mjs/shared/index.js +2 -0
  61. package/dist/mjs/shared/index.js.map +1 -0
  62. package/dist/mjs/shared/typeUtils.d.ts +3 -0
  63. package/dist/mjs/shared/typeUtils.js +2 -0
  64. package/dist/mjs/shared/typeUtils.js.map +1 -0
  65. package/dist/mjs/tsconfig.build.tsbuildinfo +1 -1
  66. package/package.json +3 -2
  67. package/src/api/account/license.ts +19 -2
  68. package/src/api/web/user.ts +12 -8
  69. package/src/documents/account/account.ts +7 -12
  70. package/src/documents/app/automation.ts +65 -8
  71. package/src/documents/app/table.ts +3 -0
  72. package/src/documents/global/plugin.ts +1 -0
  73. package/src/documents/global/quotas.ts +1 -0
  74. package/src/sdk/licensing/billing.ts +1 -0
  75. package/src/sdk/licensing/feature.ts +4 -0
  76. package/src/sdk/licensing/license.ts +3 -2
  77. package/src/sdk/licensing/plan.ts +29 -7
  78. package/src/sdk/licensing/quota.ts +9 -6
  79. package/src/sdk/locks.ts +9 -0
  80. package/src/shared/index.ts +1 -0
  81. package/src/shared/typeUtils.ts +3 -0
@@ -1,6 +1,32 @@
1
1
  import { Document } from "../document"
2
2
  import { EventEmitter } from "events"
3
3
 
4
+ export enum AutomationIOType {
5
+ OBJECT = "object",
6
+ STRING = "string",
7
+ BOOLEAN = "boolean",
8
+ NUMBER = "number",
9
+ ARRAY = "array",
10
+ }
11
+
12
+ export enum AutomationCustomIOType {
13
+ TABLE = "table",
14
+ ROW = "row",
15
+ ROWS = "rows",
16
+ WIDE = "wide",
17
+ QUERY = "query",
18
+ QUERY_PARAMS = "queryParams",
19
+ QUERY_LIMIT = "queryLimit",
20
+ LOOP_OPTION = "loopOption",
21
+ ITEM = "item",
22
+ CODE = "code",
23
+ FILTERS = "filters",
24
+ COLUMN = "column",
25
+ TRIGGER_SCHEMA = "triggerSchema",
26
+ CRON = "cron",
27
+ WEBHOOK_URL = "webhookUrl",
28
+ }
29
+
4
30
  export enum AutomationTriggerStepId {
5
31
  ROW_SAVED = "ROW_SAVED",
6
32
  ROW_UPDATED = "ROW_UPDATED",
@@ -10,6 +36,12 @@ export enum AutomationTriggerStepId {
10
36
  CRON = "CRON",
11
37
  }
12
38
 
39
+ export enum AutomationStepType {
40
+ LOGIC = "LOGIC",
41
+ ACTION = "ACTION",
42
+ TRIGGER = "TRIGGER",
43
+ }
44
+
13
45
  export enum AutomationActionStepId {
14
46
  SEND_EMAIL_SMTP = "SEND_EMAIL_SMTP",
15
47
  CREATE_ROW = "CREATE_ROW",
@@ -31,14 +63,43 @@ export enum AutomationActionStepId {
31
63
  integromat = "integromat",
32
64
  }
33
65
 
66
+ export const AutomationStepIdArray = [
67
+ ...Object.values(AutomationActionStepId),
68
+ ...Object.values(AutomationTriggerStepId),
69
+ ]
70
+
34
71
  export interface Automation extends Document {
35
72
  definition: {
36
73
  steps: AutomationStep[]
37
74
  trigger: AutomationTrigger
38
75
  }
76
+ screenId?: string
77
+ uiTree?: any
39
78
  appId: string
40
79
  live?: boolean
41
80
  name: string
81
+ internal?: boolean
82
+ type?: string
83
+ }
84
+
85
+ interface BaseIOStructure {
86
+ type?: AutomationIOType
87
+ customType?: AutomationCustomIOType
88
+ title?: string
89
+ description?: string
90
+ enum?: string[]
91
+ pretty?: string[]
92
+ properties?: {
93
+ [key: string]: BaseIOStructure
94
+ }
95
+ required?: string[]
96
+ }
97
+
98
+ interface InputOutputBlock {
99
+ properties: {
100
+ [key: string]: BaseIOStructure
101
+ }
102
+ required?: string[]
42
103
  }
43
104
 
44
105
  export interface AutomationStepSchema {
@@ -46,7 +107,7 @@ export interface AutomationStepSchema {
46
107
  tagline: string
47
108
  icon: string
48
109
  description: string
49
- type: string
110
+ type: AutomationStepType
50
111
  internal?: boolean
51
112
  deprecated?: boolean
52
113
  stepId: AutomationTriggerStepId | AutomationActionStepId
@@ -55,14 +116,10 @@ export interface AutomationStepSchema {
55
116
  [key: string]: any
56
117
  }
57
118
  schema: {
58
- inputs: {
59
- [key: string]: any
60
- }
61
- outputs: {
62
- [key: string]: any
63
- }
64
- required?: string[]
119
+ inputs: InputOutputBlock
120
+ outputs: InputOutputBlock
65
121
  }
122
+ custom?: boolean
66
123
  }
67
124
 
68
125
  export interface AutomationStep extends AutomationStepSchema {
@@ -31,6 +31,8 @@ export interface FieldSchema {
31
31
  timeOnly?: boolean
32
32
  lastID?: number
33
33
  useRichText?: boolean | null
34
+ order?: number
35
+ width?: number
34
36
  meta?: {
35
37
  toTable: string
36
38
  toKey: string
@@ -77,6 +79,7 @@ export interface Table extends Document {
77
79
  indexes?: { [key: string]: any }
78
80
  rows?: { [key: string]: any }
79
81
  created?: boolean
82
+ rowHeight?: number
80
83
  }
81
84
 
82
85
  export interface TableRequest extends Table {
@@ -3,6 +3,7 @@ import { Document } from "../document"
3
3
  export enum PluginType {
4
4
  DATASOURCE = "datasource",
5
5
  COMPONENT = "component",
6
+ AUTOMATION = "automation",
6
7
  }
7
8
 
8
9
  export enum PluginSource {
@@ -31,6 +31,7 @@ export type QuotaTriggers = {
31
31
  export interface StaticUsage {
32
32
  [StaticQuotaName.APPS]: number
33
33
  [StaticQuotaName.PLUGINS]: number
34
+ [StaticQuotaName.USERS]: number
34
35
  [StaticQuotaName.USER_GROUPS]: number
35
36
  [StaticQuotaName.ROWS]: number
36
37
  triggers: {
@@ -7,6 +7,7 @@ export interface Customer {
7
7
 
8
8
  export interface Subscription {
9
9
  amount: number
10
+ currency: string
10
11
  quantity: number
11
12
  duration: PriceDuration
12
13
  cancelAt: number | null | undefined
@@ -1,3 +1,5 @@
1
+ import { PlanType } from "./plan"
2
+
1
3
  export enum Feature {
2
4
  USER_GROUPS = "userGroups",
3
5
  APP_BACKUPS = "appBackups",
@@ -7,3 +9,5 @@ export enum Feature {
7
9
  BRANDING = "branding",
8
10
  SCIM = "scim",
9
11
  }
12
+
13
+ export type PlanFeatures = { [key in PlanType]: Feature[] | undefined }
@@ -1,8 +1,9 @@
1
- import { AccountPlan, Quotas, Feature, Billing } from "."
1
+ import { PurchasedPlan, Quotas, Feature, Billing } from "."
2
2
 
3
3
  export interface License {
4
4
  features: Feature[]
5
5
  quotas: Quotas
6
- plan: AccountPlan
6
+ plan: PurchasedPlan
7
7
  billing?: Billing
8
+ testClockId?: string
8
9
  }
@@ -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
  */
@@ -0,0 +1 @@
1
+ export * from "./typeUtils"
@@ -0,0 +1,3 @@
1
+ export type DeepPartial<T> = {
2
+ [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P]
3
+ }