@budibase/server 2.6.19-alpha.20 → 2.6.19-alpha.22

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 (41) hide show
  1. package/builder/assets/{index.9a9bace2.js → index.47cc7efc.js} +273 -272
  2. package/builder/assets/{index.46d94ca7.css → index.ffb6a106.css} +1 -1
  3. package/builder/index.html +2 -2
  4. package/dist/automation.js +205 -49
  5. package/dist/automation.js.map +4 -4
  6. package/dist/index.js +338 -137
  7. package/dist/index.js.map +4 -4
  8. package/dist/query.js +26 -8
  9. package/dist/query.js.map +4 -4
  10. package/package.json +8 -8
  11. package/src/api/controllers/automation.ts +37 -9
  12. package/src/api/controllers/webhook.ts +33 -9
  13. package/src/api/routes/automation.ts +0 -1
  14. package/src/api/routes/tests/{automation.spec.js → automation.spec.ts} +106 -31
  15. package/src/api/routes/tests/{webhook.spec.js → webhook.spec.ts} +33 -11
  16. package/src/automations/actions.ts +3 -0
  17. package/src/automations/steps/bash.ts +4 -0
  18. package/src/automations/steps/collect.ts +58 -0
  19. package/src/automations/steps/createRow.ts +4 -0
  20. package/src/automations/steps/delay.ts +1 -0
  21. package/src/automations/steps/deleteRow.ts +4 -0
  22. package/src/automations/steps/discord.ts +4 -0
  23. package/src/automations/steps/executeQuery.ts +4 -0
  24. package/src/automations/steps/executeScript.ts +4 -0
  25. package/src/automations/steps/filter.ts +1 -0
  26. package/src/automations/steps/loop.ts +1 -0
  27. package/src/automations/steps/make.ts +4 -0
  28. package/src/automations/steps/openai.ts +1 -0
  29. package/src/automations/steps/outgoingWebhook.ts +4 -0
  30. package/src/automations/steps/queryRows.ts +4 -0
  31. package/src/automations/steps/sendSmtpEmail.ts +4 -0
  32. package/src/automations/steps/serverLog.ts +4 -0
  33. package/src/automations/steps/slack.ts +4 -0
  34. package/src/automations/steps/updateRow.ts +4 -0
  35. package/src/automations/steps/zapier.ts +4 -0
  36. package/src/automations/triggers.ts +3 -2
  37. package/src/sdk/app/automations/index.ts +2 -0
  38. package/src/sdk/app/automations/utils.ts +7 -0
  39. package/src/tests/utilities/TestConfiguration.ts +4 -2
  40. package/src/tests/utilities/structures.ts +42 -0
  41. package/src/threads/automation.ts +39 -0
@@ -8,8 +8,8 @@
8
8
  <link rel="preconnect" href="https://fonts.gstatic.com" />
9
9
  <link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;600;700&display=swap"
10
10
  rel="stylesheet" />
11
- <script type="module" crossorigin src="/builder/assets/index.9a9bace2.js"></script>
12
- <link rel="stylesheet" href="/builder/assets/index.46d94ca7.css">
11
+ <script type="module" crossorigin src="/builder/assets/index.47cc7efc.js"></script>
12
+ <link rel="stylesheet" href="/builder/assets/index.ffb6a106.css">
13
13
  </head>
14
14
 
15
15
  <body id="app">
@@ -979,6 +979,7 @@ var init_automation2 = __esm({
979
979
  AutomationActionStepId2["FILTER"] = "FILTER";
980
980
  AutomationActionStepId2["QUERY_ROWS"] = "QUERY_ROWS";
981
981
  AutomationActionStepId2["LOOP"] = "LOOP";
982
+ AutomationActionStepId2["COLLECT"] = "COLLECT";
982
983
  AutomationActionStepId2["OPENAI"] = "OPENAI";
983
984
  AutomationActionStepId2["discord"] = "discord";
984
985
  AutomationActionStepId2["slack"] = "slack";
@@ -13213,6 +13214,9 @@ async function isBrandingEnabled() {
13213
13214
  async function isEnforceableSSO() {
13214
13215
  return isFeatureEnabled("enforceableSSO" /* ENFORCEABLE_SSO */);
13215
13216
  }
13217
+ async function isSyncAutomationsEnabled() {
13218
+ return isFeatureEnabled("syncAutomations" /* SYNC_AUTOMATIONS */);
13219
+ }
13216
13220
  async function isSSOEnforced(opts) {
13217
13221
  if (environment_default2.ENABLE_SSO_MAINTENANCE_MODE) {
13218
13222
  return false;
@@ -13259,7 +13263,8 @@ __export(features_exports, {
13259
13263
  isBackupsEnabled: () => isBackupsEnabled,
13260
13264
  isBrandingEnabled: () => isBrandingEnabled,
13261
13265
  isEnforceableSSO: () => isEnforceableSSO,
13262
- isSSOEnforced: () => isSSOEnforced
13266
+ isSSOEnforced: () => isSSOEnforced,
13267
+ isSyncAutomationsEnabled: () => isSyncAutomationsEnabled
13263
13268
  });
13264
13269
  var init_features2 = __esm({
13265
13270
  "../pro/packages/pro/src/sdk/features/index.ts"() {
@@ -22541,7 +22546,7 @@ var init_microsoftSqlServer = __esm({
22541
22546
  const tableNames = tableInfo.filter((record) => record.TABLE_SCHEMA === schema).map((record) => record.TABLE_NAME).filter((name) => this.MASTER_TABLES.indexOf(name) === -1);
22542
22547
  const tables = {};
22543
22548
  for (let tableName of tableNames) {
22544
- const definition25 = await this.runSQL(this.getDefinitionSQL(tableName));
22549
+ const definition26 = await this.runSQL(this.getDefinitionSQL(tableName));
22545
22550
  const constraints = await this.runSQL(this.getConstraintsSQL(tableName));
22546
22551
  const columns = await this.runSQL(
22547
22552
  this.getAutoColumnsSQL(tableName)
@@ -22552,7 +22557,7 @@ var init_microsoftSqlServer = __esm({
22552
22557
  const autoColumns = columns.filter((col) => col.IS_COMPUTED || col.IS_IDENTITY).map((col) => col.COLUMN_NAME);
22553
22558
  const requiredColumns = columns.filter((col) => col.IS_NULLABLE === "NO").map((col) => col.COLUMN_NAME);
22554
22559
  let schema2 = {};
22555
- for (let def of definition25) {
22560
+ for (let def of definition26) {
22556
22561
  const name = def.COLUMN_NAME;
22557
22562
  if (typeof name !== "string") {
22558
22563
  continue;
@@ -24966,9 +24971,9 @@ var init_oracle = __esm({
24966
24971
 
24967
24972
  // src/integrations/index.ts
24968
24973
  async function getDefinition(source) {
24969
- const definition25 = DEFINITIONS2[source];
24970
- if (definition25) {
24971
- return definition25;
24974
+ const definition26 = DEFINITIONS2[source];
24975
+ if (definition26) {
24976
+ return definition26;
24972
24977
  }
24973
24978
  const allDefinitions = await getDefinitions();
24974
24979
  return allDefinitions[source];
@@ -25111,8 +25116,8 @@ async function enrichDatasourceWithValues(datasource2) {
25111
25116
  { env },
25112
25117
  { onlyFound: true }
25113
25118
  );
25114
- const definition25 = await getDefinition(processed.source);
25115
- processed.config = checkDatasourceTypes(definition25, processed.config);
25119
+ const definition26 = await getDefinition(processed.source);
25120
+ processed.config = checkDatasourceTypes(definition26, processed.config);
25116
25121
  return {
25117
25122
  datasource: processed,
25118
25123
  envVars: env
@@ -25342,13 +25347,31 @@ var init_webhook2 = __esm({
25342
25347
  }
25343
25348
  });
25344
25349
 
25350
+ // src/sdk/app/automations/utils.ts
25351
+ var utils_exports6 = {};
25352
+ __export(utils_exports6, {
25353
+ checkForCollectStep: () => checkForCollectStep
25354
+ });
25355
+ function checkForCollectStep(automation) {
25356
+ return automation.definition.steps.some(
25357
+ (step) => step.stepId === "COLLECT" /* COLLECT */
25358
+ );
25359
+ }
25360
+ var init_utils16 = __esm({
25361
+ "src/sdk/app/automations/utils.ts"() {
25362
+ init_src();
25363
+ }
25364
+ });
25365
+
25345
25366
  // src/sdk/app/automations/index.ts
25346
25367
  var automations_default;
25347
25368
  var init_automations5 = __esm({
25348
25369
  "src/sdk/app/automations/index.ts"() {
25349
25370
  init_webhook2();
25371
+ init_utils16();
25350
25372
  automations_default = {
25351
- webhook: webhook_exports2
25373
+ webhook: webhook_exports2,
25374
+ utils: utils_exports6
25352
25375
  };
25353
25376
  }
25354
25377
  });
@@ -25604,8 +25627,8 @@ var init_sync = __esm({
25604
25627
  });
25605
25628
 
25606
25629
  // src/sdk/app/applications/utils.ts
25607
- var utils_exports6 = {};
25608
- __export(utils_exports6, {
25630
+ var utils_exports7 = {};
25631
+ __export(utils_exports7, {
25609
25632
  getAppUrl: () => getAppUrl
25610
25633
  });
25611
25634
  function getAppUrl(opts) {
@@ -25621,7 +25644,7 @@ function getAppUrl(opts) {
25621
25644
  return url;
25622
25645
  }
25623
25646
  var URL_REGEX_SLASH;
25624
- var init_utils16 = __esm({
25647
+ var init_utils17 = __esm({
25625
25648
  "src/sdk/app/applications/utils.ts"() {
25626
25649
  URL_REGEX_SLASH = /\/|\\/g;
25627
25650
  }
@@ -25632,10 +25655,10 @@ var applications_default;
25632
25655
  var init_applications = __esm({
25633
25656
  "src/sdk/app/applications/index.ts"() {
25634
25657
  init_sync();
25635
- init_utils16();
25658
+ init_utils17();
25636
25659
  applications_default = {
25637
25660
  ...sync_exports,
25638
- ...utils_exports6
25661
+ ...utils_exports7
25639
25662
  };
25640
25663
  }
25641
25664
  });
@@ -25795,8 +25818,8 @@ var init_rows5 = __esm({
25795
25818
  });
25796
25819
 
25797
25820
  // src/sdk/users/utils.ts
25798
- var utils_exports7 = {};
25799
- __export(utils_exports7, {
25821
+ var utils_exports8 = {};
25822
+ __export(utils_exports8, {
25800
25823
  combineMetadataAndUser: () => combineMetadataAndUser,
25801
25824
  rawUserMetadata: () => rawUserMetadata,
25802
25825
  syncGlobalUsers: () => syncGlobalUsers
@@ -25867,7 +25890,7 @@ async function syncGlobalUsers() {
25867
25890
  await db2.bulkDocs(toWrite);
25868
25891
  }
25869
25892
  var import_lodash6;
25870
- var init_utils17 = __esm({
25893
+ var init_utils18 = __esm({
25871
25894
  "src/sdk/users/utils.ts"() {
25872
25895
  init_global5();
25873
25896
  init_src2();
@@ -25880,9 +25903,9 @@ var init_utils17 = __esm({
25880
25903
  var users_default;
25881
25904
  var init_users11 = __esm({
25882
25905
  "src/sdk/users/index.ts"() {
25883
- init_utils17();
25906
+ init_utils18();
25884
25907
  users_default = {
25885
- ...utils_exports7
25908
+ ...utils_exports8
25886
25909
  };
25887
25910
  }
25888
25911
  });
@@ -25921,7 +25944,7 @@ var init_builder = __esm({
25921
25944
 
25922
25945
  // src/middleware/utils.ts
25923
25946
  var WEBHOOK_ENDPOINTS;
25924
- var init_utils18 = __esm({
25947
+ var init_utils19 = __esm({
25925
25948
  "src/middleware/utils.ts"() {
25926
25949
  WEBHOOK_ENDPOINTS = new RegExp(
25927
25950
  ["webhooks/trigger", "webhooks/schema"].join("|")
@@ -25935,7 +25958,7 @@ var init_authorized = __esm({
25935
25958
  "src/middleware/authorized.ts"() {
25936
25959
  init_src2();
25937
25960
  init_builder();
25938
- init_utils18();
25961
+ init_utils19();
25939
25962
  csrf = auth_exports.buildCsrfMiddleware();
25940
25963
  }
25941
25964
  });
@@ -25947,7 +25970,7 @@ var init_currentapp = __esm({
25947
25970
  init_utils13();
25948
25971
  init_global5();
25949
25972
  init_environment();
25950
- init_utils18();
25973
+ init_utils19();
25951
25974
  }
25952
25975
  });
25953
25976
 
@@ -26351,8 +26374,8 @@ var init_exporters = __esm({
26351
26374
  });
26352
26375
 
26353
26376
  // src/api/controllers/row/utils.ts
26354
- var utils_exports8 = {};
26355
- __export(utils_exports8, {
26377
+ var utils_exports9 = {};
26378
+ __export(utils_exports9, {
26356
26379
  cleanExportRows: () => cleanExportRows,
26357
26380
  findRow: () => findRow,
26358
26381
  getDatasourceAndQuery: () => getDatasourceAndQuery,
@@ -26462,7 +26485,7 @@ function cleanExportRows(rows2, schema, format, columns) {
26462
26485
  return cleanRows;
26463
26486
  }
26464
26487
  var validateJs, cloneDeep7;
26465
- var init_utils19 = __esm({
26488
+ var init_utils20 = __esm({
26466
26489
  "src/api/controllers/row/utils.ts"() {
26467
26490
  init_utils13();
26468
26491
  init_user10();
@@ -26488,10 +26511,10 @@ var init_utils19 = __esm({
26488
26511
  // src/automations/steps/bash.ts
26489
26512
  var bash_exports = {};
26490
26513
  __export(bash_exports, {
26491
- definition: () => definition23,
26492
- run: () => run18
26514
+ definition: () => definition24,
26515
+ run: () => run19
26493
26516
  });
26494
- async function run18({ inputs, context }) {
26517
+ async function run19({ inputs, context }) {
26495
26518
  if (inputs.code == null) {
26496
26519
  return {
26497
26520
  stdout: "Budibase bash automation failed: Invalid inputs"
@@ -26519,7 +26542,7 @@ async function run18({ inputs, context }) {
26519
26542
  };
26520
26543
  }
26521
26544
  }
26522
- var import_child_process, import_string_templates7, definition23;
26545
+ var import_child_process, import_string_templates7, definition24;
26523
26546
  var init_bash = __esm({
26524
26547
  "src/automations/steps/bash.ts"() {
26525
26548
  import_child_process = require("child_process");
@@ -26527,13 +26550,16 @@ var init_bash = __esm({
26527
26550
  init_automationUtils();
26528
26551
  init_environment();
26529
26552
  init_src();
26530
- definition23 = {
26553
+ definition24 = {
26531
26554
  name: "Bash Scripting",
26532
26555
  tagline: "Execute a bash command",
26533
26556
  icon: "JourneyEvent",
26534
26557
  description: "Run a bash script",
26535
26558
  type: "ACTION" /* ACTION */,
26536
26559
  internal: true,
26560
+ features: {
26561
+ ["LOOPING" /* LOOPING */]: true
26562
+ },
26537
26563
  stepId: "EXECUTE_BASH" /* EXECUTE_BASH */,
26538
26564
  inputs: {},
26539
26565
  schema: {
@@ -26568,10 +26594,10 @@ var init_bash = __esm({
26568
26594
  // src/automations/steps/openai.ts
26569
26595
  var openai_exports = {};
26570
26596
  __export(openai_exports, {
26571
- definition: () => definition24,
26572
- run: () => run19
26597
+ definition: () => definition25,
26598
+ run: () => run20
26573
26599
  });
26574
- async function run19({ inputs, context }) {
26600
+ async function run20({ inputs, context }) {
26575
26601
  var _a, _b, _c;
26576
26602
  if (!environment_default.OPENAI_API_KEY) {
26577
26603
  return {
@@ -26611,7 +26637,7 @@ async function run19({ inputs, context }) {
26611
26637
  };
26612
26638
  }
26613
26639
  }
26614
- var import_openai, Model, definition24;
26640
+ var import_openai, Model, definition25;
26615
26641
  var init_openai = __esm({
26616
26642
  "src/automations/steps/openai.ts"() {
26617
26643
  import_openai = require("openai");
@@ -26623,13 +26649,14 @@ var init_openai = __esm({
26623
26649
  Model2["GPT_4"] = "gpt-4";
26624
26650
  return Model2;
26625
26651
  })(Model || {});
26626
- definition24 = {
26652
+ definition25 = {
26627
26653
  name: "OpenAI",
26628
26654
  tagline: "Send prompts to ChatGPT",
26629
26655
  icon: "Algorithm",
26630
26656
  description: "Interact with the OpenAI ChatGPT API.",
26631
26657
  type: "ACTION" /* ACTION */,
26632
26658
  internal: true,
26659
+ features: {},
26633
26660
  stepId: "OPENAI" /* OPENAI */,
26634
26661
  inputs: {
26635
26662
  prompt: ""
@@ -26671,6 +26698,7 @@ var init_openai = __esm({
26671
26698
  var automation_exports = {};
26672
26699
  __export(automation_exports, {
26673
26700
  execute: () => execute3,
26701
+ executeSynchronously: () => executeSynchronously,
26674
26702
  removeStalled: () => removeStalled
26675
26703
  });
26676
26704
  module.exports = __toCommonJS(automation_exports);
@@ -27225,6 +27253,9 @@ var definition7 = {
27225
27253
  name: "Send Email (SMTP)",
27226
27254
  type: "ACTION" /* ACTION */,
27227
27255
  internal: true,
27256
+ features: {
27257
+ ["LOOPING" /* LOOPING */]: true
27258
+ },
27228
27259
  stepId: "SEND_EMAIL_SMTP" /* SEND_EMAIL_SMTP */,
27229
27260
  inputs: {},
27230
27261
  schema: {
@@ -28296,7 +28327,7 @@ async function squashLinksToPrimaryDisplay(table, enriched) {
28296
28327
  init_utils13();
28297
28328
  init_user10();
28298
28329
  init_constants6();
28299
- init_utils19();
28330
+ init_utils20();
28300
28331
 
28301
28332
  // src/api/controllers/row/internalSearch.ts
28302
28333
  init_src2();
@@ -28635,7 +28666,7 @@ async function finaliseRow(table, row, { oldTable, updateFormula } = {
28635
28666
  // src/api/controllers/row/internal.ts
28636
28667
  init_exporters();
28637
28668
  init_fileSystem2();
28638
- init_utils19();
28669
+ init_utils20();
28639
28670
  var CALCULATION_TYPES = {
28640
28671
  SUM: "sum",
28641
28672
  COUNT: "count",
@@ -29037,7 +29068,7 @@ init_utils14();
29037
29068
  // src/api/controllers/row/ExternalRequest.ts
29038
29069
  init_src();
29039
29070
  init_utils14();
29040
- init_utils19();
29071
+ init_utils20();
29041
29072
  init_constants6();
29042
29073
  var import_string_templates5 = __toESM(require_src2());
29043
29074
  var import_fp4 = require("lodash/fp");
@@ -29398,7 +29429,7 @@ var ExternalRequest = class {
29398
29429
  if (!table.primary || !linkTable.primary) {
29399
29430
  continue;
29400
29431
  }
29401
- const definition25 = {
29432
+ const definition26 = {
29402
29433
  // if no foreign key specified then use the name of the field in other table
29403
29434
  from: field.foreignKey || table.primary[0],
29404
29435
  to: field.fieldName,
@@ -29410,13 +29441,13 @@ var ExternalRequest = class {
29410
29441
  const { tableName: throughTableName } = breakExternalTableId(
29411
29442
  field.through
29412
29443
  );
29413
- definition25.through = throughTableName;
29414
- definition25.from = field.throughTo || table.primary[0];
29415
- definition25.to = field.throughFrom || linkTable.primary[0];
29416
- definition25.fromPrimary = table.primary[0];
29417
- definition25.toPrimary = linkTable.primary[0];
29444
+ definition26.through = throughTableName;
29445
+ definition26.from = field.throughTo || table.primary[0];
29446
+ definition26.to = field.throughFrom || linkTable.primary[0];
29447
+ definition26.fromPrimary = table.primary[0];
29448
+ definition26.toPrimary = linkTable.primary[0];
29418
29449
  }
29419
- relationships.push(definition25);
29450
+ relationships.push(definition26);
29420
29451
  }
29421
29452
  return relationships;
29422
29453
  }
@@ -29650,8 +29681,8 @@ init_exporters();
29650
29681
  init_fileSystem2();
29651
29682
  init_src();
29652
29683
  init_sdk3();
29653
- init_utils19();
29654
- var { cleanExportRows: cleanExportRows2 } = (init_utils19(), __toCommonJS(utils_exports8));
29684
+ init_utils20();
29685
+ var { cleanExportRows: cleanExportRows2 } = (init_utils20(), __toCommonJS(utils_exports9));
29655
29686
  async function handleRequest(operation, tableId, opts) {
29656
29687
  if (opts && opts.filters) {
29657
29688
  for (let filterField of NoEmptyFilterStrings2) {
@@ -29890,7 +29921,7 @@ async function fetchEnrichedRow2(ctx) {
29890
29921
 
29891
29922
  // src/api/controllers/row/index.ts
29892
29923
  init_utils14();
29893
- init_utils19();
29924
+ init_utils20();
29894
29925
  function pickApi(tableId) {
29895
29926
  if (isExternalTable(tableId)) {
29896
29927
  return external_exports;
@@ -30036,6 +30067,9 @@ var definition8 = {
30036
30067
  description: "Add a row to your database",
30037
30068
  type: "ACTION" /* ACTION */,
30038
30069
  internal: true,
30070
+ features: {
30071
+ ["LOOPING" /* LOOPING */]: true
30072
+ },
30039
30073
  stepId: "CREATE_ROW" /* CREATE_ROW */,
30040
30074
  inputs: {},
30041
30075
  schema: {
@@ -30127,6 +30161,9 @@ var definition9 = {
30127
30161
  description: "Update a row in your database",
30128
30162
  type: "ACTION" /* ACTION */,
30129
30163
  internal: true,
30164
+ features: {
30165
+ ["LOOPING" /* LOOPING */]: true
30166
+ },
30130
30167
  stepId: "UPDATE_ROW" /* UPDATE_ROW */,
30131
30168
  inputs: {},
30132
30169
  schema: {
@@ -30233,6 +30270,9 @@ var definition10 = {
30233
30270
  type: "ACTION" /* ACTION */,
30234
30271
  stepId: "DELETE_ROW" /* DELETE_ROW */,
30235
30272
  internal: true,
30273
+ features: {
30274
+ ["LOOPING" /* LOOPING */]: true
30275
+ },
30236
30276
  inputs: {},
30237
30277
  schema: {
30238
30278
  inputs: {
@@ -30346,6 +30386,9 @@ var definition11 = {
30346
30386
  internal: true,
30347
30387
  stepId: "EXECUTE_SCRIPT" /* EXECUTE_SCRIPT */,
30348
30388
  inputs: {},
30389
+ features: {
30390
+ ["LOOPING" /* LOOPING */]: true
30391
+ },
30349
30392
  schema: {
30350
30393
  inputs: {
30351
30394
  properties: {
@@ -30465,7 +30508,7 @@ init_sdk3();
30465
30508
  // src/api/controllers/datasource.ts
30466
30509
  init_constants6();
30467
30510
  init_integrations2();
30468
- init_utils19();
30511
+ init_utils20();
30469
30512
  init_src2();
30470
30513
  init_sdk3();
30471
30514
 
@@ -30583,6 +30626,9 @@ var definition12 = {
30583
30626
  type: "ACTION" /* ACTION */,
30584
30627
  stepId: "EXECUTE_QUERY" /* EXECUTE_QUERY */,
30585
30628
  internal: true,
30629
+ features: {
30630
+ ["LOOPING" /* LOOPING */]: true
30631
+ },
30586
30632
  inputs: {},
30587
30633
  schema: {
30588
30634
  inputs: {
@@ -30677,6 +30723,9 @@ var definition13 = {
30677
30723
  description: "Send a request of specified method to a URL",
30678
30724
  type: "ACTION" /* ACTION */,
30679
30725
  internal: true,
30726
+ features: {
30727
+ ["LOOPING" /* LOOPING */]: true
30728
+ },
30680
30729
  stepId: "OUTGOING_WEBHOOK" /* OUTGOING_WEBHOOK */,
30681
30730
  inputs: {
30682
30731
  requestMethod: "POST",
@@ -30782,6 +30831,9 @@ var definition14 = {
30782
30831
  description: "Logs the given text to the server (using console.log)",
30783
30832
  type: "ACTION" /* ACTION */,
30784
30833
  internal: true,
30834
+ features: {
30835
+ ["LOOPING" /* LOOPING */]: true
30836
+ },
30785
30837
  stepId: "SERVER_LOG" /* SERVER_LOG */,
30786
30838
  inputs: {
30787
30839
  text: ""
@@ -30833,6 +30885,9 @@ var definition15 = {
30833
30885
  stepId: "discord" /* discord */,
30834
30886
  type: "ACTION" /* ACTION */,
30835
30887
  internal: false,
30888
+ features: {
30889
+ ["LOOPING" /* LOOPING */]: true
30890
+ },
30836
30891
  inputs: {},
30837
30892
  schema: {
30838
30893
  inputs: {
@@ -30929,6 +30984,9 @@ var definition16 = {
30929
30984
  stepId: "slack" /* slack */,
30930
30985
  type: "ACTION" /* ACTION */,
30931
30986
  internal: false,
30987
+ features: {
30988
+ ["LOOPING" /* LOOPING */]: true
30989
+ },
30932
30990
  inputs: {},
30933
30991
  schema: {
30934
30992
  inputs: {
@@ -31006,6 +31064,9 @@ var definition17 = {
31006
31064
  stepId: "zapier" /* zapier */,
31007
31065
  type: "ACTION" /* ACTION */,
31008
31066
  internal: false,
31067
+ features: {
31068
+ ["LOOPING" /* LOOPING */]: true
31069
+ },
31009
31070
  description: "Trigger a Zapier Zap via webhooks",
31010
31071
  tagline: "Trigger a Zapier Zap",
31011
31072
  icon: "ri-flashlight-line",
@@ -31122,6 +31183,9 @@ var definition18 = {
31122
31183
  stepId: "integromat" /* integromat */,
31123
31184
  type: "ACTION" /* ACTION */,
31124
31185
  internal: false,
31186
+ features: {
31187
+ ["LOOPING" /* LOOPING */]: true
31188
+ },
31125
31189
  inputs: {},
31126
31190
  schema: {
31127
31191
  inputs: {
@@ -31248,6 +31312,7 @@ var definition19 = {
31248
31312
  description: "Conditionally halt automations which do not meet certain conditions",
31249
31313
  type: "LOGIC" /* LOGIC */,
31250
31314
  internal: true,
31315
+ features: {},
31251
31316
  stepId: "FILTER" /* FILTER */,
31252
31317
  inputs: {
31253
31318
  condition: FilterConditions.EQUAL
@@ -31332,6 +31397,7 @@ var definition20 = {
31332
31397
  description: "Delay the automation until an amount of time has passed",
31333
31398
  stepId: "DELAY" /* DELAY */,
31334
31399
  internal: true,
31400
+ features: {},
31335
31401
  inputs: {},
31336
31402
  schema: {
31337
31403
  inputs: {
@@ -31416,6 +31482,9 @@ var definition21 = {
31416
31482
  type: "ACTION" /* ACTION */,
31417
31483
  stepId: "QUERY_ROWS" /* QUERY_ROWS */,
31418
31484
  internal: true,
31485
+ features: {
31486
+ ["LOOPING" /* LOOPING */]: true
31487
+ },
31419
31488
  inputs: {},
31420
31489
  schema: {
31421
31490
  inputs: {
@@ -31562,6 +31631,7 @@ var definition22 = {
31562
31631
  description: "Loop",
31563
31632
  stepId: "LOOP" /* LOOP */,
31564
31633
  internal: true,
31634
+ features: {},
31565
31635
  inputs: {},
31566
31636
  schema: {
31567
31637
  inputs: {
@@ -31606,6 +31676,56 @@ var definition22 = {
31606
31676
  type: "LOGIC" /* LOGIC */
31607
31677
  };
31608
31678
 
31679
+ // src/automations/steps/collect.ts
31680
+ init_src();
31681
+ var definition23 = {
31682
+ name: "Collect Data",
31683
+ tagline: "Collect data to be sent to design",
31684
+ icon: "Collection",
31685
+ description: "Collects specified data so it can be provided to the design section",
31686
+ type: "ACTION" /* ACTION */,
31687
+ internal: true,
31688
+ features: {},
31689
+ stepId: "COLLECT" /* COLLECT */,
31690
+ inputs: {},
31691
+ schema: {
31692
+ inputs: {
31693
+ properties: {
31694
+ collection: {
31695
+ type: "string" /* STRING */,
31696
+ title: "What to Collect"
31697
+ }
31698
+ },
31699
+ required: ["collection"]
31700
+ },
31701
+ outputs: {
31702
+ properties: {
31703
+ success: {
31704
+ type: "boolean" /* BOOLEAN */,
31705
+ description: "Whether the action was successful"
31706
+ },
31707
+ value: {
31708
+ type: "string" /* STRING */,
31709
+ description: "Collected data"
31710
+ }
31711
+ },
31712
+ required: ["success", "value"]
31713
+ }
31714
+ }
31715
+ };
31716
+ async function run18({ inputs }) {
31717
+ if (!inputs.collection) {
31718
+ return {
31719
+ success: false
31720
+ };
31721
+ } else {
31722
+ return {
31723
+ success: true,
31724
+ value: inputs.collection
31725
+ };
31726
+ }
31727
+ }
31728
+
31609
31729
  // src/automations/actions.ts
31610
31730
  init_environment();
31611
31731
  init_src();
@@ -31623,6 +31743,7 @@ var ACTION_IMPLS = {
31623
31743
  DELAY: run16,
31624
31744
  FILTER: run15,
31625
31745
  QUERY_ROWS: run17,
31746
+ COLLECT: run18,
31626
31747
  // these used to be lowercase step IDs, maintain for backwards compat
31627
31748
  discord: run11,
31628
31749
  slack: run12,
@@ -31642,6 +31763,7 @@ var BUILTIN_ACTION_DEFINITIONS = {
31642
31763
  FILTER: definition19,
31643
31764
  QUERY_ROWS: definition21,
31644
31765
  LOOP: definition22,
31766
+ COLLECT: definition23,
31645
31767
  // these used to be lowercase step IDs, maintain for backwards compat
31646
31768
  discord: definition15,
31647
31769
  slack: definition16,
@@ -31836,6 +31958,7 @@ var Orchestrator = class {
31836
31958
  constructor(job) {
31837
31959
  let automation = job.data.automation;
31838
31960
  let triggerOutput = job.data.event;
31961
+ let timeout2 = job.data.event.timeout;
31839
31962
  const metadata = triggerOutput.metadata;
31840
31963
  this._chainCount = metadata ? metadata.automationChainCount : 0;
31841
31964
  this._appId = triggerOutput.appId;
@@ -31978,7 +32101,9 @@ var Orchestrator = class {
31978
32101
  let loopStepNumber = void 0;
31979
32102
  let loopSteps = [];
31980
32103
  let metadata;
32104
+ let timeoutFlag = false;
31981
32105
  let wasLoopStep = false;
32106
+ let timeout2 = this._job.data.event.timeout;
31982
32107
  if (isProdAppID2(this._appId) && isRecurring(automation)) {
31983
32108
  metadata = await this.getMetadata();
31984
32109
  const shouldStop = await this.checkIfShouldStop(metadata);
@@ -31987,6 +32112,14 @@ var Orchestrator = class {
31987
32112
  }
31988
32113
  }
31989
32114
  for (let step of automation.definition.steps) {
32115
+ if (timeoutFlag) {
32116
+ break;
32117
+ }
32118
+ if (timeout2) {
32119
+ setTimeout(() => {
32120
+ timeoutFlag = true;
32121
+ }, timeout2 || 12e3);
32122
+ }
31990
32123
  stepCount++;
31991
32124
  let input, iterations = 1, iterationCount = 0;
31992
32125
  if (step.stepId === LOOP_STEP_ID) {
@@ -32190,6 +32323,28 @@ function execute3(job, callback) {
32190
32323
  });
32191
32324
  });
32192
32325
  }
32326
+ function executeSynchronously(job) {
32327
+ const appId = job.data.event.appId;
32328
+ if (!appId) {
32329
+ throw new Error("Unable to execute, event doesn't contain app ID.");
32330
+ }
32331
+ const timeoutPromise = new Promise((resolve2, reject) => {
32332
+ setTimeout(() => {
32333
+ reject(new Error("Timeout exceeded"));
32334
+ }, job.data.event.timeout || 12e3);
32335
+ });
32336
+ return context_exports.doInAppContext(appId, async () => {
32337
+ const envVars = await getEnvironmentVariables2();
32338
+ return context_exports.doInEnvironmentContext(envVars, async () => {
32339
+ const automationOrchestrator = new Orchestrator(job);
32340
+ const response2 = await Promise.race([
32341
+ automationOrchestrator.execute(),
32342
+ timeoutPromise
32343
+ ]);
32344
+ return response2;
32345
+ });
32346
+ });
32347
+ }
32193
32348
  var removeStalled = async (job) => {
32194
32349
  const appId = job.data.event.appId;
32195
32350
  if (!appId) {
@@ -32203,6 +32358,7 @@ var removeStalled = async (job) => {
32203
32358
  // Annotate the CommonJS export names for ESM import in node:
32204
32359
  0 && (module.exports = {
32205
32360
  execute,
32361
+ executeSynchronously,
32206
32362
  removeStalled
32207
32363
  });
32208
32364
  //# sourceMappingURL=automation.js.map