@budibase/types 2.29.27 → 2.29.28

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.
@@ -15,3 +15,4 @@ export * from "./automation";
15
15
  export * from "./layout";
16
16
  export * from "./query";
17
17
  export * from "./role";
18
+ export * from "./plugins";
@@ -0,0 +1,12 @@
1
+ import { PluginSource } from "../../documents";
2
+ export interface CreatePluginRequest {
3
+ source: PluginSource;
4
+ url: string;
5
+ githubToken?: string;
6
+ headers?: {
7
+ [key: string]: string;
8
+ };
9
+ }
10
+ export interface CreatePluginResponse {
11
+ plugin: any;
12
+ }
@@ -1,9 +1,9 @@
1
- import { Document } from "../document";
1
+ import { Document } from "../../document";
2
2
  import { EventEmitter } from "events";
3
- import { User } from "../global";
3
+ import { User } from "../../global";
4
4
  import { ReadStream } from "fs";
5
- import { Row } from "./row";
6
- import { Table } from "./table";
5
+ import { Row } from "../row";
6
+ import { Table } from "../table";
7
7
  export declare enum AutomationIOType {
8
8
  OBJECT = "object",
9
9
  STRING = "string",
@@ -84,11 +84,12 @@ export interface EmailAttachment {
84
84
  filename: string;
85
85
  }
86
86
  export interface SendEmailOpts {
87
+ to?: string;
87
88
  workspaceId?: string;
88
89
  user: User;
89
90
  from?: string;
90
91
  contents?: string;
91
- subject?: string;
92
+ subject: string;
92
93
  info?: any;
93
94
  cc?: boolean;
94
95
  bcc?: boolean;
@@ -208,13 +209,15 @@ export interface AutomationLogPage {
208
209
  hasNextPage: boolean;
209
210
  nextPage?: string;
210
211
  }
211
- export type AutomationStepInput = {
212
- inputs: Record<string, any>;
212
+ export interface AutomationStepInputBase {
213
213
  context: Record<string, any>;
214
214
  emitter: EventEmitter;
215
215
  appId: string;
216
216
  apiKey?: string;
217
- };
217
+ }
218
+ export type ActionImplementation<TInputs, TOutputs> = (params: {
219
+ inputs: TInputs;
220
+ } & AutomationStepInputBase) => Promise<TOutputs>;
218
221
  export interface AutomationMetadata extends Document {
219
222
  errorCount?: number;
220
223
  automationChainCount?: number;
@@ -246,4 +249,8 @@ export type UpdatedRowEventEmitter = {
246
249
  table: Table;
247
250
  appId: string;
248
251
  };
252
+ export declare enum LoopStepType {
253
+ ARRAY = "Array",
254
+ STRING = "String"
255
+ }
249
256
  export {};
@@ -0,0 +1,2 @@
1
+ export * from "./automation";
2
+ export * from "./schema";
@@ -0,0 +1,211 @@
1
+ import { SortOrder } from "../../../api";
2
+ import { EmptyFilterOption, Hosting, SearchFilters } from "../../../sdk";
3
+ import { HttpMethod } from "../query";
4
+ import { Row } from "../row";
5
+ import { AutomationActionStepId, AutomationResults, EmailAttachment, LoopStepType, ActionImplementation } from "./automation";
6
+ export type ActionImplementations<T extends Hosting> = {
7
+ [AutomationActionStepId.COLLECT]: ActionImplementation<CollectStepInputs, CollectStepOutputs>;
8
+ [AutomationActionStepId.CREATE_ROW]: ActionImplementation<CreateRowStepInputs, CreateRowStepOutputs>;
9
+ [AutomationActionStepId.DELAY]: ActionImplementation<DelayStepInputs, DelayStepOutputs>;
10
+ [AutomationActionStepId.DELETE_ROW]: ActionImplementation<DeleteRowStepInputs, DeleteRowStepOutputs>;
11
+ [AutomationActionStepId.EXECUTE_QUERY]: ActionImplementation<ExecuteQueryStepInputs, ExecuteQueryStepOutputs>;
12
+ [AutomationActionStepId.EXECUTE_SCRIPT]: ActionImplementation<ExecuteScriptStepInputs, ExecuteScriptStepOutputs>;
13
+ [AutomationActionStepId.FILTER]: ActionImplementation<FilterStepInputs, FilterStepOutputs>;
14
+ [AutomationActionStepId.QUERY_ROWS]: ActionImplementation<QueryRowsStepInputs, QueryRowsStepOutputs>;
15
+ [AutomationActionStepId.SEND_EMAIL_SMTP]: ActionImplementation<SmtpEmailStepInputs, BaseAutomationOutputs>;
16
+ [AutomationActionStepId.SERVER_LOG]: ActionImplementation<ServerLogStepInputs, ServerLogStepOutputs>;
17
+ [AutomationActionStepId.TRIGGER_AUTOMATION_RUN]: ActionImplementation<TriggerAutomationStepInputs, TriggerAutomationStepOutputs>;
18
+ [AutomationActionStepId.UPDATE_ROW]: ActionImplementation<UpdateRowStepInputs, UpdateRowStepOutputs>;
19
+ [AutomationActionStepId.OUTGOING_WEBHOOK]: ActionImplementation<OutgoingWebhookStepInputs, ExternalAppStepOutputs>;
20
+ [AutomationActionStepId.discord]: ActionImplementation<DiscordStepInputs, ExternalAppStepOutputs>;
21
+ [AutomationActionStepId.slack]: ActionImplementation<SlackStepInputs, ExternalAppStepOutputs>;
22
+ [AutomationActionStepId.zapier]: ActionImplementation<ZapierStepInputs, ZapierStepOutputs>;
23
+ [AutomationActionStepId.integromat]: ActionImplementation<MakeIntegrationInputs, ExternalAppStepOutputs>;
24
+ [AutomationActionStepId.n8n]: ActionImplementation<n8nStepInputs, ExternalAppStepOutputs>;
25
+ } & (T extends "self" ? {
26
+ [AutomationActionStepId.EXECUTE_BASH]: ActionImplementation<BashStepInputs, BashStepOutputs>;
27
+ [AutomationActionStepId.OPENAI]: ActionImplementation<OpenAIStepInputs, OpenAIStepOutputs>;
28
+ } : {});
29
+ export type BaseAutomationOutputs = {
30
+ success?: boolean;
31
+ response?: {
32
+ [key: string]: any;
33
+ message?: string;
34
+ };
35
+ };
36
+ export type ExternalAppStepOutputs = {
37
+ httpStatus?: number;
38
+ response: string;
39
+ success: boolean;
40
+ };
41
+ export type BashStepInputs = {
42
+ code: string;
43
+ };
44
+ export type BashStepOutputs = BaseAutomationOutputs & {
45
+ stdout?: string;
46
+ };
47
+ export type CollectStepInputs = {
48
+ collection: string;
49
+ };
50
+ export type CollectStepOutputs = BaseAutomationOutputs & {
51
+ value?: any;
52
+ };
53
+ export type CreateRowStepInputs = {
54
+ row: Row;
55
+ };
56
+ export type CreateRowStepOutputs = BaseAutomationOutputs & {
57
+ row?: Row;
58
+ id?: string;
59
+ revision?: string;
60
+ };
61
+ export type DelayStepInputs = {
62
+ time: number;
63
+ };
64
+ export type DelayStepOutputs = BaseAutomationOutputs;
65
+ export type DeleteRowStepInputs = {
66
+ tableId: string;
67
+ id: string;
68
+ revision?: string;
69
+ };
70
+ export type DeleteRowStepOutputs = BaseAutomationOutputs & {
71
+ row?: Row;
72
+ };
73
+ export type DiscordStepInputs = {
74
+ url: string;
75
+ username?: string;
76
+ avatar_url?: string;
77
+ content: string;
78
+ };
79
+ export type ExecuteQueryStepInputs = {
80
+ query: {
81
+ queryId: string;
82
+ };
83
+ };
84
+ export type ExecuteQueryStepOutputs = BaseAutomationOutputs & {
85
+ info?: any;
86
+ };
87
+ export type ExecuteScriptStepInputs = {
88
+ code: string;
89
+ };
90
+ export type ExecuteScriptStepOutputs = BaseAutomationOutputs & {
91
+ value?: string;
92
+ };
93
+ export type FilterStepInputs = {
94
+ field: any;
95
+ condition: string;
96
+ value: any;
97
+ };
98
+ export type FilterStepOutputs = BaseAutomationOutputs & {
99
+ result: boolean;
100
+ refValue?: any;
101
+ comparisonValue?: any;
102
+ };
103
+ export type LoopStepInputs = {
104
+ option: LoopStepType;
105
+ binding: any;
106
+ iterations?: number;
107
+ failure?: string;
108
+ };
109
+ export type LoopStepOutputs = {
110
+ items: string;
111
+ success: boolean;
112
+ iterations: number;
113
+ };
114
+ export type MakeIntegrationInputs = {
115
+ url: string;
116
+ body: any;
117
+ };
118
+ export type n8nStepInputs = {
119
+ url: string;
120
+ method: HttpMethod;
121
+ authorization: string;
122
+ body: any;
123
+ };
124
+ export type OpenAIStepInputs = {
125
+ prompt: string;
126
+ model: Model;
127
+ };
128
+ declare enum Model {
129
+ GPT_35_TURBO = "gpt-3.5-turbo",
130
+ GPT_4 = "gpt-4"
131
+ }
132
+ export type OpenAIStepOutputs = Omit<BaseAutomationOutputs, "response"> & {
133
+ response?: string | null;
134
+ };
135
+ export type QueryRowsStepInputs = {
136
+ tableId: string;
137
+ filters?: SearchFilters;
138
+ "filters-def"?: any;
139
+ sortColumn?: string;
140
+ sortOrder?: SortOrder;
141
+ limit?: number;
142
+ onEmptyFilter?: EmptyFilterOption;
143
+ };
144
+ export type QueryRowsStepOutputs = BaseAutomationOutputs & {
145
+ rows?: Row[];
146
+ };
147
+ export type SmtpEmailStepInputs = {
148
+ to: string;
149
+ from: string;
150
+ subject: string;
151
+ contents: string;
152
+ cc: string;
153
+ bcc: string;
154
+ addInvite?: boolean;
155
+ startTime: Date;
156
+ endTime: Date;
157
+ summary: string;
158
+ location?: string;
159
+ url?: string;
160
+ attachments?: EmailAttachment[];
161
+ };
162
+ export type ServerLogStepInputs = {
163
+ text: string;
164
+ };
165
+ export type ServerLogStepOutputs = BaseAutomationOutputs & {
166
+ message: string;
167
+ };
168
+ export type SlackStepInputs = {
169
+ url: string;
170
+ text: string;
171
+ };
172
+ export type TriggerAutomationStepInputs = {
173
+ automation: {
174
+ automationId: string;
175
+ };
176
+ timeout: number;
177
+ };
178
+ export type TriggerAutomationStepOutputs = BaseAutomationOutputs & {
179
+ value?: AutomationResults["steps"];
180
+ };
181
+ export type UpdateRowStepInputs = {
182
+ meta: Record<string, any>;
183
+ row: Row;
184
+ rowId: string;
185
+ };
186
+ export type UpdateRowStepOutputs = BaseAutomationOutputs & {
187
+ row?: Row;
188
+ id?: string;
189
+ revision?: string;
190
+ };
191
+ export type ZapierStepInputs = {
192
+ url: string;
193
+ body: any;
194
+ };
195
+ export type ZapierStepOutputs = Omit<ExternalAppStepOutputs, "response"> & {
196
+ response: string;
197
+ };
198
+ declare enum RequestType {
199
+ POST = "POST",
200
+ GET = "GET",
201
+ PUT = "PUT",
202
+ DELETE = "DELETE",
203
+ PATCH = "PATCH"
204
+ }
205
+ export type OutgoingWebhookStepInputs = {
206
+ requestMethod: RequestType;
207
+ url: string;
208
+ requestBody: string;
209
+ headers: string;
210
+ };
211
+ export {};
@@ -37,15 +37,15 @@ export interface DynamicVariable {
37
37
  }
38
38
  export interface RestConfig {
39
39
  url: string;
40
- rejectUnauthorized: boolean;
40
+ rejectUnauthorized?: boolean;
41
41
  downloadImages?: boolean;
42
- defaultHeaders: {
42
+ defaultHeaders?: {
43
43
  [key: string]: any;
44
44
  };
45
- legacyHttpParser: boolean;
46
- authConfigs: RestAuthConfig[];
47
- staticVariables: {
45
+ legacyHttpParser?: boolean;
46
+ authConfigs?: RestAuthConfig[];
47
+ staticVariables?: {
48
48
  [key: string]: string;
49
49
  };
50
- dynamicVariables: DynamicVariable[];
50
+ dynamicVariables?: DynamicVariable[];
51
51
  }
@@ -29,33 +29,40 @@ export interface QueryResponse {
29
29
  extra: any;
30
30
  pagination: any;
31
31
  }
32
+ export declare enum BodyType {
33
+ NONE = "none",
34
+ FORM_DATA = "form",
35
+ XML = "xml",
36
+ ENCODED = "encoded",
37
+ JSON = "json",
38
+ TEXT = "text"
39
+ }
32
40
  export interface RestQueryFields {
33
- path: string;
41
+ path?: string;
34
42
  queryString?: string;
35
- headers: {
43
+ headers?: {
36
44
  [key: string]: any;
37
45
  };
38
- disabledHeaders: {
46
+ disabledHeaders?: {
39
47
  [key: string]: any;
40
48
  };
41
- requestBody: any;
42
- bodyType: string;
43
- json: object;
44
- method: string;
45
- authConfigId: string;
46
- pagination: PaginationConfig | null;
47
- paginationValues: PaginationValues | null;
49
+ requestBody?: any;
50
+ bodyType?: BodyType;
51
+ method?: string;
52
+ authConfigId?: string;
53
+ pagination?: PaginationConfig;
54
+ paginationValues?: PaginationValues;
48
55
  }
49
56
  export interface PaginationConfig {
50
57
  type: string;
51
58
  location: string;
52
59
  pageParam: string;
53
- sizeParam: string | null;
54
- responseParam: string | null;
60
+ sizeParam?: string;
61
+ responseParam?: string;
55
62
  }
56
63
  export interface PaginationValues {
57
- page: string | number | null;
58
- limit: number | null;
64
+ page?: string | number;
65
+ limit?: number;
59
66
  }
60
67
  export declare enum HttpMethod {
61
68
  GET = "GET",
package/dist/index.js CHANGED
@@ -51,6 +51,7 @@ __export(src_exports, {
51
51
  BBReferenceFieldSubType: () => BBReferenceFieldSubType,
52
52
  BREAKDOWN_QUOTA_NAMES: () => BREAKDOWN_QUOTA_NAMES,
53
53
  BasicOperator: () => BasicOperator,
54
+ BodyType: () => BodyType,
54
55
  BreakdownQuotaName: () => BreakdownQuotaName,
55
56
  CommandWord: () => CommandWord,
56
57
  ConfigType: () => ConfigType,
@@ -81,6 +82,7 @@ __export(src_exports, {
81
82
  JsonTypes: () => JsonTypes,
82
83
  LockName: () => LockName,
83
84
  LockType: () => LockType,
85
+ LoopStepType: () => LoopStepType,
84
86
  MaintenanceType: () => MaintenanceType,
85
87
  MigrationName: () => MigrationName,
86
88
  MigrationType: () => MigrationType,
@@ -103,6 +105,7 @@ __export(src_exports, {
103
105
  RangeOperator: () => RangeOperator,
104
106
  RelationshipType: () => RelationshipType,
105
107
  RestAuthType: () => RestAuthType,
108
+ RowExportFormat: () => RowExportFormat,
106
109
  RowOperations: () => RowOperations,
107
110
  SEPARATOR: () => SEPARATOR,
108
111
  SQLiteType: () => SQLiteType,
@@ -819,6 +822,14 @@ var PermissionSource = /* @__PURE__ */ ((PermissionSource2) => {
819
822
  return PermissionSource2;
820
823
  })(PermissionSource || {});
821
824
 
825
+ // src/sdk/row.ts
826
+ var RowExportFormat = /* @__PURE__ */ ((RowExportFormat2) => {
827
+ RowExportFormat2["CSV"] = "csv";
828
+ RowExportFormat2["JSON"] = "json";
829
+ RowExportFormat2["JSON_WITH_SCHEMA"] = "jsonWithSchema";
830
+ return RowExportFormat2;
831
+ })(RowExportFormat || {});
832
+
822
833
  // src/documents/account/account.ts
823
834
  var isCreatePasswordAccount = (account) => account.authType === "password" /* PASSWORD */;
824
835
  var isPasswordAccount = (account) => account.authType === "password" /* PASSWORD */ && account.hosting === "self" /* SELF */;
@@ -847,7 +858,7 @@ var AuthType = /* @__PURE__ */ ((AuthType2) => {
847
858
  return AuthType2;
848
859
  })(AuthType || {});
849
860
 
850
- // src/documents/app/automation.ts
861
+ // src/documents/app/automation/automation.ts
851
862
  var AutomationIOType = /* @__PURE__ */ ((AutomationIOType2) => {
852
863
  AutomationIOType2["OBJECT"] = "object";
853
864
  AutomationIOType2["STRING"] = "string";
@@ -954,6 +965,11 @@ var AutomationEventType = /* @__PURE__ */ ((AutomationEventType2) => {
954
965
  AutomationEventType2["ROW_ACTION"] = "row:action";
955
966
  return AutomationEventType2;
956
967
  })(AutomationEventType || {});
968
+ var LoopStepType = /* @__PURE__ */ ((LoopStepType2) => {
969
+ LoopStepType2["ARRAY"] = "Array";
970
+ LoopStepType2["STRING"] = "String";
971
+ return LoopStepType2;
972
+ })(LoopStepType || {});
957
973
 
958
974
  // src/documents/app/datasource.ts
959
975
  var RestAuthType = /* @__PURE__ */ ((RestAuthType2) => {
@@ -963,6 +979,15 @@ var RestAuthType = /* @__PURE__ */ ((RestAuthType2) => {
963
979
  })(RestAuthType || {});
964
980
 
965
981
  // src/documents/app/query.ts
982
+ var BodyType = /* @__PURE__ */ ((BodyType2) => {
983
+ BodyType2["NONE"] = "none";
984
+ BodyType2["FORM_DATA"] = "form";
985
+ BodyType2["XML"] = "xml";
986
+ BodyType2["ENCODED"] = "encoded";
987
+ BodyType2["JSON"] = "json";
988
+ BodyType2["TEXT"] = "text";
989
+ return BodyType2;
990
+ })(BodyType || {});
966
991
  var HttpMethod = /* @__PURE__ */ ((HttpMethod2) => {
967
992
  HttpMethod2["GET"] = "GET";
968
993
  HttpMethod2["POST"] = "POST";
@@ -1335,6 +1360,7 @@ var MaintenanceType = /* @__PURE__ */ ((MaintenanceType2) => {
1335
1360
  BBReferenceFieldSubType,
1336
1361
  BREAKDOWN_QUOTA_NAMES,
1337
1362
  BasicOperator,
1363
+ BodyType,
1338
1364
  BreakdownQuotaName,
1339
1365
  CommandWord,
1340
1366
  ConfigType,
@@ -1365,6 +1391,7 @@ var MaintenanceType = /* @__PURE__ */ ((MaintenanceType2) => {
1365
1391
  JsonTypes,
1366
1392
  LockName,
1367
1393
  LockType,
1394
+ LoopStepType,
1368
1395
  MaintenanceType,
1369
1396
  MigrationName,
1370
1397
  MigrationType,
@@ -1387,6 +1414,7 @@ var MaintenanceType = /* @__PURE__ */ ((MaintenanceType2) => {
1387
1414
  RangeOperator,
1388
1415
  RelationshipType,
1389
1416
  RestAuthType,
1417
+ RowExportFormat,
1390
1418
  RowOperations,
1391
1419
  SEPARATOR,
1392
1420
  SQLiteType,