@budibase/types 2.5.6-alpha.1 → 2.5.6-alpha.11

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 (33) hide show
  1. package/dist/cjs/documents/app/automation.d.ts +57 -8
  2. package/dist/cjs/documents/app/automation.js +37 -1
  3. package/dist/cjs/documents/app/automation.js.map +1 -1
  4. package/dist/cjs/documents/app/table.d.ts +3 -0
  5. package/dist/cjs/documents/app/user.d.ts +1 -0
  6. package/dist/cjs/documents/global/plugin.d.ts +2 -1
  7. package/dist/cjs/documents/global/plugin.js +1 -0
  8. package/dist/cjs/documents/global/plugin.js.map +1 -1
  9. package/dist/cjs/sdk/events/event.d.ts +14 -0
  10. package/dist/cjs/sdk/events/event.js +17 -1
  11. package/dist/cjs/sdk/events/event.js.map +1 -1
  12. package/dist/cjs/sdk/events/identification.d.ts +1 -0
  13. package/dist/cjs/tsconfig-cjs.build.tsbuildinfo +1 -1
  14. package/dist/mjs/documents/app/automation.d.ts +57 -8
  15. package/dist/mjs/documents/app/automation.js +36 -0
  16. package/dist/mjs/documents/app/automation.js.map +1 -1
  17. package/dist/mjs/documents/app/table.d.ts +3 -0
  18. package/dist/mjs/documents/app/user.d.ts +1 -0
  19. package/dist/mjs/documents/global/plugin.d.ts +2 -1
  20. package/dist/mjs/documents/global/plugin.js +1 -0
  21. package/dist/mjs/documents/global/plugin.js.map +1 -1
  22. package/dist/mjs/sdk/events/event.d.ts +14 -0
  23. package/dist/mjs/sdk/events/event.js +16 -0
  24. package/dist/mjs/sdk/events/event.js.map +1 -1
  25. package/dist/mjs/sdk/events/identification.d.ts +1 -0
  26. package/dist/mjs/tsconfig.build.tsbuildinfo +1 -1
  27. package/package.json +2 -2
  28. package/src/documents/app/automation.ts +65 -8
  29. package/src/documents/app/table.ts +3 -0
  30. package/src/documents/app/user.ts +1 -0
  31. package/src/documents/global/plugin.ts +1 -0
  32. package/src/sdk/events/event.ts +37 -0
  33. package/src/sdk/events/identification.ts +2 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@budibase/types",
3
- "version": "2.5.6-alpha.1",
3
+ "version": "2.5.6-alpha.11",
4
4
  "description": "Budibase types",
5
5
  "main": "dist/cjs/index.js",
6
6
  "types": "dist/mjs/index.d.ts",
@@ -33,5 +33,5 @@
33
33
  "dependencies": {
34
34
  "scim-patch": "^0.7.0"
35
35
  },
36
- "gitHead": "fdc38d656252b7b81508245e20ca65ef2739a363"
36
+ "gitHead": "ac1f09736bef61b07541ba06bd65bdf05eef570e"
37
37
  }
@@ -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 {
@@ -2,4 +2,5 @@ import { Document } from "../document"
2
2
 
3
3
  export interface UserMetadata extends Document {
4
4
  roleId: string
5
+ email?: string
5
6
  }
@@ -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 {
@@ -1,4 +1,5 @@
1
1
  import { Hosting } from "../hosting"
2
+ import { Group, Identity } from "./identification"
2
3
 
3
4
  export enum Event {
4
5
  // USER
@@ -186,6 +187,24 @@ export enum Event {
186
187
  AUDIT_LOGS_DOWNLOADED = "audit_log:downloaded",
187
188
  }
188
189
 
190
+ export const UserGroupSyncEvents: Event[] = [
191
+ Event.USER_CREATED,
192
+ Event.USER_UPDATED,
193
+ Event.USER_DELETED,
194
+ Event.USER_PERMISSION_ADMIN_ASSIGNED,
195
+ Event.USER_PERMISSION_ADMIN_REMOVED,
196
+ Event.USER_PERMISSION_BUILDER_ASSIGNED,
197
+ Event.USER_PERMISSION_BUILDER_REMOVED,
198
+ Event.USER_GROUP_CREATED,
199
+ Event.USER_GROUP_UPDATED,
200
+ Event.USER_GROUP_DELETED,
201
+ Event.USER_GROUP_USERS_ADDED,
202
+ Event.USER_GROUP_USERS_REMOVED,
203
+ Event.USER_GROUP_PERMISSIONS_EDITED,
204
+ ]
205
+
206
+ export const AsyncEvents: Event[] = [...UserGroupSyncEvents]
207
+
189
208
  // all events that are not audited have been added to this record as undefined, this means
190
209
  // that Typescript can protect us against new events being added and auditing of those
191
210
  // events not being considered. This might be a little ugly, but provides a level of
@@ -383,3 +402,21 @@ export interface BaseEvent {
383
402
  }
384
403
 
385
404
  export type TableExportFormat = "json" | "csv"
405
+
406
+ export type DocUpdateEvent = {
407
+ id: string
408
+ tenantId: string
409
+ appId?: string
410
+ }
411
+
412
+ export interface EventProcessor {
413
+ processEvent(
414
+ event: Event,
415
+ identity: Identity,
416
+ properties: any,
417
+ timestamp?: string | number
418
+ ): Promise<void>
419
+ identify?(identity: Identity, timestamp?: string | number): Promise<void>
420
+ identifyGroup?(group: Group, timestamp?: string | number): Promise<void>
421
+ shutdown?(): void
422
+ }
@@ -46,6 +46,8 @@ export interface Identity {
46
46
  environment: string
47
47
  installationId?: string
48
48
  tenantId?: string
49
+ // usable - no unique format
50
+ realTenantId?: string
49
51
  hostInfo?: HostInfo
50
52
  }
51
53