@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
package/dist/index.js CHANGED
@@ -872,6 +872,7 @@ var init_automation2 = __esm({
872
872
  AutomationActionStepId2["FILTER"] = "FILTER";
873
873
  AutomationActionStepId2["QUERY_ROWS"] = "QUERY_ROWS";
874
874
  AutomationActionStepId2["LOOP"] = "LOOP";
875
+ AutomationActionStepId2["COLLECT"] = "COLLECT";
875
876
  AutomationActionStepId2["OPENAI"] = "OPENAI";
876
877
  AutomationActionStepId2["discord"] = "discord";
877
878
  AutomationActionStepId2["slack"] = "slack";
@@ -14300,6 +14301,9 @@ async function isBrandingEnabled() {
14300
14301
  async function isEnforceableSSO() {
14301
14302
  return isFeatureEnabled("enforceableSSO" /* ENFORCEABLE_SSO */);
14302
14303
  }
14304
+ async function isSyncAutomationsEnabled() {
14305
+ return isFeatureEnabled("syncAutomations" /* SYNC_AUTOMATIONS */);
14306
+ }
14303
14307
  async function isSSOEnforced(opts) {
14304
14308
  if (environment_default.ENABLE_SSO_MAINTENANCE_MODE) {
14305
14309
  return false;
@@ -14346,7 +14350,8 @@ __export(features_exports, {
14346
14350
  isBackupsEnabled: () => isBackupsEnabled,
14347
14351
  isBrandingEnabled: () => isBrandingEnabled,
14348
14352
  isEnforceableSSO: () => isEnforceableSSO,
14349
- isSSOEnforced: () => isSSOEnforced
14353
+ isSSOEnforced: () => isSSOEnforced,
14354
+ isSyncAutomationsEnabled: () => isSyncAutomationsEnabled
14350
14355
  });
14351
14356
  var init_features2 = __esm({
14352
14357
  "../pro/packages/pro/src/sdk/features/index.ts"() {
@@ -27725,7 +27730,7 @@ var init_microsoftSqlServer = __esm({
27725
27730
  const tableNames = tableInfo.filter((record) => record.TABLE_SCHEMA === schema).map((record) => record.TABLE_NAME).filter((name) => this.MASTER_TABLES.indexOf(name) === -1);
27726
27731
  const tables = {};
27727
27732
  for (let tableName of tableNames) {
27728
- const definition25 = await this.runSQL(this.getDefinitionSQL(tableName));
27733
+ const definition26 = await this.runSQL(this.getDefinitionSQL(tableName));
27729
27734
  const constraints = await this.runSQL(this.getConstraintsSQL(tableName));
27730
27735
  const columns = await this.runSQL(
27731
27736
  this.getAutoColumnsSQL(tableName)
@@ -27736,7 +27741,7 @@ var init_microsoftSqlServer = __esm({
27736
27741
  const autoColumns = columns.filter((col) => col.IS_COMPUTED || col.IS_IDENTITY).map((col) => col.COLUMN_NAME);
27737
27742
  const requiredColumns = columns.filter((col) => col.IS_NULLABLE === "NO").map((col) => col.COLUMN_NAME);
27738
27743
  let schema2 = {};
27739
- for (let def of definition25) {
27744
+ for (let def of definition26) {
27740
27745
  const name = def.COLUMN_NAME;
27741
27746
  if (typeof name !== "string") {
27742
27747
  continue;
@@ -30150,9 +30155,9 @@ var init_oracle = __esm({
30150
30155
 
30151
30156
  // src/integrations/index.ts
30152
30157
  async function getDefinition(source) {
30153
- const definition25 = DEFINITIONS2[source];
30154
- if (definition25) {
30155
- return definition25;
30158
+ const definition26 = DEFINITIONS2[source];
30159
+ if (definition26) {
30160
+ return definition26;
30156
30161
  }
30157
30162
  const allDefinitions = await getDefinitions();
30158
30163
  return allDefinitions[source];
@@ -30295,8 +30300,8 @@ async function enrichDatasourceWithValues(datasource2) {
30295
30300
  { env },
30296
30301
  { onlyFound: true }
30297
30302
  );
30298
- const definition25 = await getDefinition(processed.source);
30299
- processed.config = checkDatasourceTypes(definition25, processed.config);
30303
+ const definition26 = await getDefinition(processed.source);
30304
+ processed.config = checkDatasourceTypes(definition26, processed.config);
30300
30305
  return {
30301
30306
  datasource: processed,
30302
30307
  envVars: env
@@ -30526,13 +30531,31 @@ var init_webhook3 = __esm({
30526
30531
  }
30527
30532
  });
30528
30533
 
30534
+ // src/sdk/app/automations/utils.ts
30535
+ var utils_exports6 = {};
30536
+ __export(utils_exports6, {
30537
+ checkForCollectStep: () => checkForCollectStep
30538
+ });
30539
+ function checkForCollectStep(automation) {
30540
+ return automation.definition.steps.some(
30541
+ (step) => step.stepId === "COLLECT" /* COLLECT */
30542
+ );
30543
+ }
30544
+ var init_utils21 = __esm({
30545
+ "src/sdk/app/automations/utils.ts"() {
30546
+ init_src();
30547
+ }
30548
+ });
30549
+
30529
30550
  // src/sdk/app/automations/index.ts
30530
30551
  var automations_default;
30531
30552
  var init_automations5 = __esm({
30532
30553
  "src/sdk/app/automations/index.ts"() {
30533
30554
  init_webhook3();
30555
+ init_utils21();
30534
30556
  automations_default = {
30535
- webhook: webhook_exports2
30557
+ webhook: webhook_exports2,
30558
+ utils: utils_exports6
30536
30559
  };
30537
30560
  }
30538
30561
  });
@@ -30672,8 +30695,8 @@ var init_sync = __esm({
30672
30695
  });
30673
30696
 
30674
30697
  // src/sdk/app/applications/utils.ts
30675
- var utils_exports6 = {};
30676
- __export(utils_exports6, {
30698
+ var utils_exports7 = {};
30699
+ __export(utils_exports7, {
30677
30700
  getAppUrl: () => getAppUrl
30678
30701
  });
30679
30702
  function getAppUrl(opts) {
@@ -30689,7 +30712,7 @@ function getAppUrl(opts) {
30689
30712
  return url;
30690
30713
  }
30691
30714
  var URL_REGEX_SLASH;
30692
- var init_utils21 = __esm({
30715
+ var init_utils22 = __esm({
30693
30716
  "src/sdk/app/applications/utils.ts"() {
30694
30717
  URL_REGEX_SLASH = /\/|\\/g;
30695
30718
  }
@@ -30700,10 +30723,10 @@ var applications_default;
30700
30723
  var init_applications = __esm({
30701
30724
  "src/sdk/app/applications/index.ts"() {
30702
30725
  init_sync();
30703
- init_utils21();
30726
+ init_utils22();
30704
30727
  applications_default = {
30705
30728
  ...sync_exports,
30706
- ...utils_exports6
30729
+ ...utils_exports7
30707
30730
  };
30708
30731
  }
30709
30732
  });
@@ -30863,8 +30886,8 @@ var init_rows5 = __esm({
30863
30886
  });
30864
30887
 
30865
30888
  // src/sdk/users/utils.ts
30866
- var utils_exports7 = {};
30867
- __export(utils_exports7, {
30889
+ var utils_exports8 = {};
30890
+ __export(utils_exports8, {
30868
30891
  combineMetadataAndUser: () => combineMetadataAndUser,
30869
30892
  rawUserMetadata: () => rawUserMetadata,
30870
30893
  syncGlobalUsers: () => syncGlobalUsers
@@ -30935,7 +30958,7 @@ async function syncGlobalUsers() {
30935
30958
  await db2.bulkDocs(toWrite);
30936
30959
  }
30937
30960
  var import_lodash9;
30938
- var init_utils22 = __esm({
30961
+ var init_utils23 = __esm({
30939
30962
  "src/sdk/users/utils.ts"() {
30940
30963
  init_global5();
30941
30964
  init_src2();
@@ -30948,9 +30971,9 @@ var init_utils22 = __esm({
30948
30971
  var users_default;
30949
30972
  var init_users12 = __esm({
30950
30973
  "src/sdk/users/index.ts"() {
30951
- init_utils22();
30974
+ init_utils23();
30952
30975
  users_default = {
30953
- ...utils_exports7
30976
+ ...utils_exports8
30954
30977
  };
30955
30978
  }
30956
30979
  });
@@ -31364,6 +31387,9 @@ var init_sendSmtpEmail = __esm({
31364
31387
  name: "Send Email (SMTP)",
31365
31388
  type: "ACTION" /* ACTION */,
31366
31389
  internal: true,
31390
+ features: {
31391
+ ["LOOPING" /* LOOPING */]: true
31392
+ },
31367
31393
  stepId: "SEND_EMAIL_SMTP" /* SEND_EMAIL_SMTP */,
31368
31394
  inputs: {},
31369
31395
  schema: {
@@ -31572,8 +31598,8 @@ var init_exporters = __esm({
31572
31598
  });
31573
31599
 
31574
31600
  // src/api/controllers/row/utils.ts
31575
- var utils_exports8 = {};
31576
- __export(utils_exports8, {
31601
+ var utils_exports9 = {};
31602
+ __export(utils_exports9, {
31577
31603
  cleanExportRows: () => cleanExportRows,
31578
31604
  findRow: () => findRow,
31579
31605
  getDatasourceAndQuery: () => getDatasourceAndQuery,
@@ -31683,7 +31709,7 @@ function cleanExportRows(rows2, schema, format, columns) {
31683
31709
  return cleanRows;
31684
31710
  }
31685
31711
  var validateJs, cloneDeep8;
31686
- var init_utils23 = __esm({
31712
+ var init_utils24 = __esm({
31687
31713
  "src/api/controllers/row/utils.ts"() {
31688
31714
  init_utils9();
31689
31715
  init_user10();
@@ -32289,7 +32315,7 @@ var init_internal = __esm({
32289
32315
  init_user10();
32290
32316
  init_rowProcessor();
32291
32317
  init_constants4();
32292
- init_utils23();
32318
+ init_utils24();
32293
32319
  init_internalSearch();
32294
32320
  init_global5();
32295
32321
  init_inMemoryView();
@@ -32300,7 +32326,7 @@ var init_internal = __esm({
32300
32326
  init_staticFormula();
32301
32327
  init_exporters();
32302
32328
  init_fileSystem();
32303
- init_utils23();
32329
+ init_utils24();
32304
32330
  CALCULATION_TYPES = {
32305
32331
  SUM: "sum",
32306
32332
  COUNT: "count",
@@ -32462,7 +32488,7 @@ var init_ExternalRequest = __esm({
32462
32488
  "src/api/controllers/row/ExternalRequest.ts"() {
32463
32489
  init_src();
32464
32490
  init_utils19();
32465
- init_utils23();
32491
+ init_utils24();
32466
32492
  init_constants4();
32467
32493
  import_string_templates5 = __toESM(require_src2());
32468
32494
  import_fp5 = require("lodash/fp");
@@ -32677,7 +32703,7 @@ var init_ExternalRequest = __esm({
32677
32703
  if (!table2.primary || !linkTable.primary) {
32678
32704
  continue;
32679
32705
  }
32680
- const definition25 = {
32706
+ const definition26 = {
32681
32707
  // if no foreign key specified then use the name of the field in other table
32682
32708
  from: field.foreignKey || table2.primary[0],
32683
32709
  to: field.fieldName,
@@ -32689,13 +32715,13 @@ var init_ExternalRequest = __esm({
32689
32715
  const { tableName: throughTableName } = breakExternalTableId(
32690
32716
  field.through
32691
32717
  );
32692
- definition25.through = throughTableName;
32693
- definition25.from = field.throughTo || table2.primary[0];
32694
- definition25.to = field.throughFrom || linkTable.primary[0];
32695
- definition25.fromPrimary = table2.primary[0];
32696
- definition25.toPrimary = linkTable.primary[0];
32718
+ definition26.through = throughTableName;
32719
+ definition26.from = field.throughTo || table2.primary[0];
32720
+ definition26.to = field.throughFrom || linkTable.primary[0];
32721
+ definition26.fromPrimary = table2.primary[0];
32722
+ definition26.toPrimary = linkTable.primary[0];
32697
32723
  }
32698
- relationships.push(definition25);
32724
+ relationships.push(definition26);
32699
32725
  }
32700
32726
  return relationships;
32701
32727
  }
@@ -33186,8 +33212,8 @@ var init_external = __esm({
33186
33212
  init_fileSystem();
33187
33213
  init_src();
33188
33214
  init_sdk3();
33189
- init_utils23();
33190
- ({ cleanExportRows: cleanExportRows2 } = (init_utils23(), __toCommonJS(utils_exports8)));
33215
+ init_utils24();
33216
+ ({ cleanExportRows: cleanExportRows2 } = (init_utils24(), __toCommonJS(utils_exports9)));
33191
33217
  }
33192
33218
  });
33193
33219
 
@@ -33316,7 +33342,7 @@ var init_row2 = __esm({
33316
33342
  init_internal();
33317
33343
  init_external();
33318
33344
  init_utils19();
33319
- init_utils23();
33345
+ init_utils24();
33320
33346
  save11 = async (ctx) => {
33321
33347
  const appId = ctx.appId;
33322
33348
  const tableId = getTableId(ctx);
@@ -33378,7 +33404,7 @@ function buildCtx(appId, emitter2, opts = {}) {
33378
33404
  }
33379
33405
  return ctx;
33380
33406
  }
33381
- var init_utils24 = __esm({
33407
+ var init_utils25 = __esm({
33382
33408
  "src/automations/steps/utils.ts"() {
33383
33409
  }
33384
33410
  });
@@ -33421,7 +33447,7 @@ var init_createRow = __esm({
33421
33447
  "src/automations/steps/createRow.ts"() {
33422
33448
  init_row2();
33423
33449
  init_automationUtils();
33424
- init_utils24();
33450
+ init_utils25();
33425
33451
  init_src();
33426
33452
  definition8 = {
33427
33453
  name: "Create Row",
@@ -33430,6 +33456,9 @@ var init_createRow = __esm({
33430
33456
  description: "Add a row to your database",
33431
33457
  type: "ACTION" /* ACTION */,
33432
33458
  internal: true,
33459
+ features: {
33460
+ ["LOOPING" /* LOOPING */]: true
33461
+ },
33433
33462
  stepId: "CREATE_ROW" /* CREATE_ROW */,
33434
33463
  inputs: {},
33435
33464
  schema: {
@@ -33532,7 +33561,7 @@ var init_updateRow = __esm({
33532
33561
  "src/automations/steps/updateRow.ts"() {
33533
33562
  init_row2();
33534
33563
  init_automationUtils();
33535
- init_utils24();
33564
+ init_utils25();
33536
33565
  init_src();
33537
33566
  definition9 = {
33538
33567
  name: "Update Row",
@@ -33541,6 +33570,9 @@ var init_updateRow = __esm({
33541
33570
  description: "Update a row in your database",
33542
33571
  type: "ACTION" /* ACTION */,
33543
33572
  internal: true,
33573
+ features: {
33574
+ ["LOOPING" /* LOOPING */]: true
33575
+ },
33544
33576
  stepId: "UPDATE_ROW" /* UPDATE_ROW */,
33545
33577
  inputs: {},
33546
33578
  schema: {
@@ -33630,7 +33662,7 @@ var definition10;
33630
33662
  var init_deleteRow = __esm({
33631
33663
  "src/automations/steps/deleteRow.ts"() {
33632
33664
  init_row2();
33633
- init_utils24();
33665
+ init_utils25();
33634
33666
  init_automationUtils();
33635
33667
  init_src();
33636
33668
  definition10 = {
@@ -33641,6 +33673,9 @@ var init_deleteRow = __esm({
33641
33673
  type: "ACTION" /* ACTION */,
33642
33674
  stepId: "DELETE_ROW" /* DELETE_ROW */,
33643
33675
  internal: true,
33676
+ features: {
33677
+ ["LOOPING" /* LOOPING */]: true
33678
+ },
33644
33679
  inputs: {},
33645
33680
  schema: {
33646
33681
  inputs: {
@@ -33760,7 +33795,7 @@ var definition11;
33760
33795
  var init_executeScript = __esm({
33761
33796
  "src/automations/steps/executeScript.ts"() {
33762
33797
  init_script();
33763
- init_utils24();
33798
+ init_utils25();
33764
33799
  init_automationUtils();
33765
33800
  init_src();
33766
33801
  definition11 = {
@@ -33772,6 +33807,9 @@ var init_executeScript = __esm({
33772
33807
  internal: true,
33773
33808
  stepId: "EXECUTE_SCRIPT" /* EXECUTE_SCRIPT */,
33774
33809
  inputs: {},
33810
+ features: {
33811
+ ["LOOPING" /* LOOPING */]: true
33812
+ },
33775
33813
  schema: {
33776
33814
  inputs: {
33777
33815
  properties: {
@@ -34399,7 +34437,7 @@ var init_datasource5 = __esm({
34399
34437
  init_internal2();
34400
34438
  init_constants4();
34401
34439
  init_integrations2();
34402
- init_utils23();
34440
+ init_utils24();
34403
34441
  init_utils18();
34404
34442
  init_src2();
34405
34443
  init_sdk3();
@@ -35314,7 +35352,7 @@ var definition12;
35314
35352
  var init_executeQuery = __esm({
35315
35353
  "src/automations/steps/executeQuery.ts"() {
35316
35354
  init_query5();
35317
- init_utils24();
35355
+ init_utils25();
35318
35356
  init_automationUtils();
35319
35357
  init_src();
35320
35358
  definition12 = {
@@ -35325,6 +35363,9 @@ var init_executeQuery = __esm({
35325
35363
  type: "ACTION" /* ACTION */,
35326
35364
  stepId: "EXECUTE_QUERY" /* EXECUTE_QUERY */,
35327
35365
  internal: true,
35366
+ features: {
35367
+ ["LOOPING" /* LOOPING */]: true
35368
+ },
35328
35369
  inputs: {},
35329
35370
  schema: {
35330
35371
  inputs: {
@@ -35415,7 +35456,7 @@ var import_node_fetch12, RequestType, BODY_REQUESTS, definition13;
35415
35456
  var init_outgoingWebhook = __esm({
35416
35457
  "src/automations/steps/outgoingWebhook.ts"() {
35417
35458
  import_node_fetch12 = __toESM(require("node-fetch"));
35418
- init_utils24();
35459
+ init_utils25();
35419
35460
  init_automationUtils();
35420
35461
  init_src();
35421
35462
  RequestType = /* @__PURE__ */ ((RequestType2) => {
@@ -35435,6 +35476,9 @@ var init_outgoingWebhook = __esm({
35435
35476
  description: "Send a request of specified method to a URL",
35436
35477
  type: "ACTION" /* ACTION */,
35437
35478
  internal: true,
35479
+ features: {
35480
+ ["LOOPING" /* LOOPING */]: true
35481
+ },
35438
35482
  stepId: "OUTGOING_WEBHOOK" /* OUTGOING_WEBHOOK */,
35439
35483
  inputs: {
35440
35484
  requestMethod: "POST",
@@ -35509,6 +35553,9 @@ var init_serverLog = __esm({
35509
35553
  description: "Logs the given text to the server (using console.log)",
35510
35554
  type: "ACTION" /* ACTION */,
35511
35555
  internal: true,
35556
+ features: {
35557
+ ["LOOPING" /* LOOPING */]: true
35558
+ },
35512
35559
  stepId: "SERVER_LOG" /* SERVER_LOG */,
35513
35560
  inputs: {
35514
35561
  text: ""
@@ -35589,7 +35636,7 @@ var import_node_fetch13, DEFAULT_USERNAME, DEFAULT_AVATAR_URL, definition15;
35589
35636
  var init_discord = __esm({
35590
35637
  "src/automations/steps/discord.ts"() {
35591
35638
  import_node_fetch13 = __toESM(require("node-fetch"));
35592
- init_utils24();
35639
+ init_utils25();
35593
35640
  init_src();
35594
35641
  DEFAULT_USERNAME = "Budibase Automate";
35595
35642
  DEFAULT_AVATAR_URL = "https://i.imgur.com/a1cmTKM.png";
@@ -35601,6 +35648,9 @@ var init_discord = __esm({
35601
35648
  stepId: "discord" /* discord */,
35602
35649
  type: "ACTION" /* ACTION */,
35603
35650
  internal: false,
35651
+ features: {
35652
+ ["LOOPING" /* LOOPING */]: true
35653
+ },
35604
35654
  inputs: {},
35605
35655
  schema: {
35606
35656
  inputs: {
@@ -35685,7 +35735,7 @@ var import_node_fetch14, definition16;
35685
35735
  var init_slack = __esm({
35686
35736
  "src/automations/steps/slack.ts"() {
35687
35737
  import_node_fetch14 = __toESM(require("node-fetch"));
35688
- init_utils24();
35738
+ init_utils25();
35689
35739
  init_src();
35690
35740
  definition16 = {
35691
35741
  name: "Slack Message",
@@ -35695,6 +35745,9 @@ var init_slack = __esm({
35695
35745
  stepId: "slack" /* slack */,
35696
35746
  type: "ACTION" /* ACTION */,
35697
35747
  internal: false,
35748
+ features: {
35749
+ ["LOOPING" /* LOOPING */]: true
35750
+ },
35698
35751
  inputs: {},
35699
35752
  schema: {
35700
35753
  inputs: {
@@ -35787,13 +35840,16 @@ var import_node_fetch15, definition17;
35787
35840
  var init_zapier = __esm({
35788
35841
  "src/automations/steps/zapier.ts"() {
35789
35842
  import_node_fetch15 = __toESM(require("node-fetch"));
35790
- init_utils24();
35843
+ init_utils25();
35791
35844
  init_src();
35792
35845
  definition17 = {
35793
35846
  name: "Zapier Webhook",
35794
35847
  stepId: "zapier" /* zapier */,
35795
35848
  type: "ACTION" /* ACTION */,
35796
35849
  internal: false,
35850
+ features: {
35851
+ ["LOOPING" /* LOOPING */]: true
35852
+ },
35797
35853
  description: "Trigger a Zapier Zap via webhooks",
35798
35854
  tagline: "Trigger a Zapier Zap",
35799
35855
  icon: "ri-flashlight-line",
@@ -35904,7 +35960,7 @@ var import_node_fetch16, definition18;
35904
35960
  var init_make = __esm({
35905
35961
  "src/automations/steps/make.ts"() {
35906
35962
  import_node_fetch16 = __toESM(require("node-fetch"));
35907
- init_utils24();
35963
+ init_utils25();
35908
35964
  init_src();
35909
35965
  definition18 = {
35910
35966
  name: "Make Integration",
@@ -35915,6 +35971,9 @@ var init_make = __esm({
35915
35971
  stepId: "integromat" /* integromat */,
35916
35972
  type: "ACTION" /* ACTION */,
35917
35973
  internal: false,
35974
+ features: {
35975
+ ["LOOPING" /* LOOPING */]: true
35976
+ },
35918
35977
  inputs: {},
35919
35978
  schema: {
35920
35979
  inputs: {
@@ -36030,6 +36089,7 @@ var init_filter = __esm({
36030
36089
  description: "Conditionally halt automations which do not meet certain conditions",
36031
36090
  type: "LOGIC" /* LOGIC */,
36032
36091
  internal: true,
36092
+ features: {},
36033
36093
  stepId: "FILTER" /* FILTER */,
36034
36094
  inputs: {
36035
36095
  condition: FilterConditions.EQUAL
@@ -36091,6 +36151,7 @@ var init_delay2 = __esm({
36091
36151
  description: "Delay the automation until an amount of time has passed",
36092
36152
  stepId: "DELAY" /* DELAY */,
36093
36153
  internal: true,
36154
+ features: {},
36094
36155
  inputs: {},
36095
36156
  schema: {
36096
36157
  inputs: {
@@ -36622,7 +36683,7 @@ var init_queryRows = __esm({
36622
36683
  init_row2();
36623
36684
  init_table4();
36624
36685
  init_constants4();
36625
- init_utils24();
36686
+ init_utils25();
36626
36687
  init_automationUtils();
36627
36688
  init_src();
36628
36689
  SortOrder2 = /* @__PURE__ */ ((SortOrder3) => {
@@ -36651,6 +36712,9 @@ var init_queryRows = __esm({
36651
36712
  type: "ACTION" /* ACTION */,
36652
36713
  stepId: "QUERY_ROWS" /* QUERY_ROWS */,
36653
36714
  internal: true,
36715
+ features: {
36716
+ ["LOOPING" /* LOOPING */]: true
36717
+ },
36654
36718
  inputs: {},
36655
36719
  schema: {
36656
36720
  inputs: {
@@ -36721,6 +36785,7 @@ var init_loop = __esm({
36721
36785
  description: "Loop",
36722
36786
  stepId: "LOOP" /* LOOP */,
36723
36787
  internal: true,
36788
+ features: {},
36724
36789
  inputs: {},
36725
36790
  schema: {
36726
36791
  inputs: {
@@ -36767,13 +36832,68 @@ var init_loop = __esm({
36767
36832
  }
36768
36833
  });
36769
36834
 
36835
+ // src/automations/steps/collect.ts
36836
+ async function run18({ inputs }) {
36837
+ if (!inputs.collection) {
36838
+ return {
36839
+ success: false
36840
+ };
36841
+ } else {
36842
+ return {
36843
+ success: true,
36844
+ value: inputs.collection
36845
+ };
36846
+ }
36847
+ }
36848
+ var definition23;
36849
+ var init_collect = __esm({
36850
+ "src/automations/steps/collect.ts"() {
36851
+ init_src();
36852
+ definition23 = {
36853
+ name: "Collect Data",
36854
+ tagline: "Collect data to be sent to design",
36855
+ icon: "Collection",
36856
+ description: "Collects specified data so it can be provided to the design section",
36857
+ type: "ACTION" /* ACTION */,
36858
+ internal: true,
36859
+ features: {},
36860
+ stepId: "COLLECT" /* COLLECT */,
36861
+ inputs: {},
36862
+ schema: {
36863
+ inputs: {
36864
+ properties: {
36865
+ collection: {
36866
+ type: "string" /* STRING */,
36867
+ title: "What to Collect"
36868
+ }
36869
+ },
36870
+ required: ["collection"]
36871
+ },
36872
+ outputs: {
36873
+ properties: {
36874
+ success: {
36875
+ type: "boolean" /* BOOLEAN */,
36876
+ description: "Whether the action was successful"
36877
+ },
36878
+ value: {
36879
+ type: "string" /* STRING */,
36880
+ description: "Collected data"
36881
+ }
36882
+ },
36883
+ required: ["success", "value"]
36884
+ }
36885
+ }
36886
+ };
36887
+ }
36888
+ });
36889
+
36770
36890
  // src/automations/steps/bash.ts
36771
36891
  var bash_exports = {};
36772
36892
  __export(bash_exports, {
36773
- definition: () => definition23,
36774
- run: () => run18
36893
+ definition: () => definition24,
36894
+ run: () => run19
36775
36895
  });
36776
- async function run18({ inputs, context }) {
36896
+ async function run19({ inputs, context }) {
36777
36897
  if (inputs.code == null) {
36778
36898
  return {
36779
36899
  stdout: "Budibase bash automation failed: Invalid inputs"
@@ -36801,7 +36921,7 @@ async function run18({ inputs, context }) {
36801
36921
  };
36802
36922
  }
36803
36923
  }
36804
- var import_child_process, import_string_templates7, definition23;
36924
+ var import_child_process, import_string_templates7, definition24;
36805
36925
  var init_bash = __esm({
36806
36926
  "src/automations/steps/bash.ts"() {
36807
36927
  import_child_process = require("child_process");
@@ -36809,13 +36929,16 @@ var init_bash = __esm({
36809
36929
  init_automationUtils();
36810
36930
  init_environment3();
36811
36931
  init_src();
36812
- definition23 = {
36932
+ definition24 = {
36813
36933
  name: "Bash Scripting",
36814
36934
  tagline: "Execute a bash command",
36815
36935
  icon: "JourneyEvent",
36816
36936
  description: "Run a bash script",
36817
36937
  type: "ACTION" /* ACTION */,
36818
36938
  internal: true,
36939
+ features: {
36940
+ ["LOOPING" /* LOOPING */]: true
36941
+ },
36819
36942
  stepId: "EXECUTE_BASH" /* EXECUTE_BASH */,
36820
36943
  inputs: {},
36821
36944
  schema: {
@@ -36850,10 +36973,10 @@ var init_bash = __esm({
36850
36973
  // src/automations/steps/openai.ts
36851
36974
  var openai_exports = {};
36852
36975
  __export(openai_exports, {
36853
- definition: () => definition24,
36854
- run: () => run19
36976
+ definition: () => definition25,
36977
+ run: () => run20
36855
36978
  });
36856
- async function run19({ inputs, context }) {
36979
+ async function run20({ inputs, context }) {
36857
36980
  var _a2, _b2, _c;
36858
36981
  if (!environment_default2.OPENAI_API_KEY) {
36859
36982
  return {
@@ -36893,7 +37016,7 @@ async function run19({ inputs, context }) {
36893
37016
  };
36894
37017
  }
36895
37018
  }
36896
- var import_openai, Model, definition24;
37019
+ var import_openai, Model, definition25;
36897
37020
  var init_openai = __esm({
36898
37021
  "src/automations/steps/openai.ts"() {
36899
37022
  import_openai = require("openai");
@@ -36905,13 +37028,14 @@ var init_openai = __esm({
36905
37028
  Model2["GPT_4"] = "gpt-4";
36906
37029
  return Model2;
36907
37030
  })(Model || {});
36908
- definition24 = {
37031
+ definition25 = {
36909
37032
  name: "OpenAI",
36910
37033
  tagline: "Send prompts to ChatGPT",
36911
37034
  icon: "Algorithm",
36912
37035
  description: "Interact with the OpenAI ChatGPT API.",
36913
37036
  type: "ACTION" /* ACTION */,
36914
37037
  internal: true,
37038
+ features: {},
36915
37039
  stepId: "OPENAI" /* OPENAI */,
36916
37040
  inputs: {
36917
37041
  prompt: ""
@@ -36996,6 +37120,7 @@ var init_actions = __esm({
36996
37120
  init_delay2();
36997
37121
  init_queryRows();
36998
37122
  init_loop();
37123
+ init_collect();
36999
37124
  init_environment3();
37000
37125
  init_src();
37001
37126
  init_sdk3();
@@ -37012,6 +37137,7 @@ var init_actions = __esm({
37012
37137
  DELAY: run16,
37013
37138
  FILTER: run15,
37014
37139
  QUERY_ROWS: run17,
37140
+ COLLECT: run18,
37015
37141
  // these used to be lowercase step IDs, maintain for backwards compat
37016
37142
  discord: run11,
37017
37143
  slack: run12,
@@ -37031,6 +37157,7 @@ var init_actions = __esm({
37031
37157
  FILTER: definition19,
37032
37158
  QUERY_ROWS: definition21,
37033
37159
  LOOP: definition22,
37160
+ COLLECT: definition23,
37034
37161
  // these used to be lowercase step IDs, maintain for backwards compat
37035
37162
  discord: definition15,
37036
37163
  slack: definition16,
@@ -37100,7 +37227,7 @@ function tableEmission({
37100
37227
  }
37101
37228
  emitter2.emit(eventName, event);
37102
37229
  }
37103
- var init_utils25 = __esm({
37230
+ var init_utils26 = __esm({
37104
37231
  "src/events/utils.ts"() {
37105
37232
  }
37106
37233
  });
@@ -37110,7 +37237,7 @@ var import_events27, BudibaseEmitter, BudibaseEmitter_default;
37110
37237
  var init_BudibaseEmitter = __esm({
37111
37238
  "src/events/BudibaseEmitter.ts"() {
37112
37239
  import_events27 = require("events");
37113
- init_utils25();
37240
+ init_utils26();
37114
37241
  BudibaseEmitter = class extends import_events27.EventEmitter {
37115
37242
  emitRow(eventName, appId, row2, table2) {
37116
37243
  rowEmission({ emitter: this, eventName, appId, row: row2, table: table2 });
@@ -37205,7 +37332,7 @@ var init_events5 = __esm({
37205
37332
  var MAX_AUTOMATION_CHAIN, AutomationEmitter, AutomationEmitter_default;
37206
37333
  var init_AutomationEmitter = __esm({
37207
37334
  "src/events/AutomationEmitter.ts"() {
37208
- init_utils25();
37335
+ init_utils26();
37209
37336
  init_events5();
37210
37337
  init_environment3();
37211
37338
  MAX_AUTOMATION_CHAIN = environment_default2.SELF_HOSTED ? 5 : 0;
@@ -37297,11 +37424,33 @@ function getLoopIterations(loopStep, input) {
37297
37424
  }
37298
37425
  return 0;
37299
37426
  }
37427
+ function executeSynchronously(job) {
37428
+ const appId = job.data.event.appId;
37429
+ if (!appId) {
37430
+ throw new Error("Unable to execute, event doesn't contain app ID.");
37431
+ }
37432
+ const timeoutPromise = new Promise((resolve2, reject) => {
37433
+ setTimeout(() => {
37434
+ reject(new Error("Timeout exceeded"));
37435
+ }, job.data.event.timeout || 12e3);
37436
+ });
37437
+ return context_exports.doInAppContext(appId, async () => {
37438
+ const envVars = await getEnvironmentVariables2();
37439
+ return context_exports.doInEnvironmentContext(envVars, async () => {
37440
+ const automationOrchestrator = new Orchestrator(job);
37441
+ const response2 = await Promise.race([
37442
+ automationOrchestrator.execute(),
37443
+ timeoutPromise
37444
+ ]);
37445
+ return response2;
37446
+ });
37447
+ });
37448
+ }
37300
37449
  var import_string_templates8, import_fp8, FILTER_STEP_ID, LOOP_STEP_ID, CRON_STEP_ID, STOPPED_STATUS, Orchestrator, removeStalled;
37301
37450
  var init_automation4 = __esm({
37302
37451
  "src/threads/automation.ts"() {
37303
37452
  init_utils18();
37304
- init_utils26();
37453
+ init_utils27();
37305
37454
  init_actions();
37306
37455
  init_automationUtils();
37307
37456
  init_AutomationEmitter();
@@ -37324,6 +37473,7 @@ var init_automation4 = __esm({
37324
37473
  constructor(job) {
37325
37474
  let automation = job.data.automation;
37326
37475
  let triggerOutput = job.data.event;
37476
+ let timeout2 = job.data.event.timeout;
37327
37477
  const metadata = triggerOutput.metadata;
37328
37478
  this._chainCount = metadata ? metadata.automationChainCount : 0;
37329
37479
  this._appId = triggerOutput.appId;
@@ -37466,7 +37616,9 @@ var init_automation4 = __esm({
37466
37616
  let loopStepNumber = void 0;
37467
37617
  let loopSteps = [];
37468
37618
  let metadata;
37619
+ let timeoutFlag = false;
37469
37620
  let wasLoopStep = false;
37621
+ let timeout2 = this._job.data.event.timeout;
37470
37622
  if (isProdAppID2(this._appId) && isRecurring(automation)) {
37471
37623
  metadata = await this.getMetadata();
37472
37624
  const shouldStop = await this.checkIfShouldStop(metadata);
@@ -37475,6 +37627,14 @@ var init_automation4 = __esm({
37475
37627
  }
37476
37628
  }
37477
37629
  for (let step of automation.definition.steps) {
37630
+ if (timeoutFlag) {
37631
+ break;
37632
+ }
37633
+ if (timeout2) {
37634
+ setTimeout(() => {
37635
+ timeoutFlag = true;
37636
+ }, timeout2 || 12e3);
37637
+ }
37478
37638
  stepCount++;
37479
37639
  let input, iterations = 1, iterationCount = 0;
37480
37640
  if (step.stepId === LOOP_STEP_ID) {
@@ -37892,7 +38052,7 @@ function isErrorInOutput(output) {
37892
38052
  return error2;
37893
38053
  }
37894
38054
  var import_fp9, REBOOT_CRON, WH_STEP_ID, CRON_STEP_ID2, Runner2;
37895
- var init_utils26 = __esm({
38055
+ var init_utils27 = __esm({
37896
38056
  "src/automations/utils.ts"() {
37897
38057
  init_threads();
37898
38058
  init_triggerInfo();
@@ -38434,7 +38594,7 @@ var init_application = __esm({
38434
38594
  init_utilities2();
38435
38595
  init_redis4();
38436
38596
  init_fileSystem();
38437
- init_utils26();
38597
+ init_utils27();
38438
38598
  init_logging3();
38439
38599
  init_rows6();
38440
38600
  init_src4();
@@ -38979,7 +39139,7 @@ var init_deploy = __esm({
38979
39139
  init_Deployment();
38980
39140
  init_src2();
38981
39141
  init_utils9();
38982
- init_utils26();
39142
+ init_utils27();
38983
39143
  init_src4();
38984
39144
  init_src();
38985
39145
  init_sdk3();
@@ -39422,7 +39582,7 @@ var init_view4 = __esm({
39422
39582
  init_utils9();
39423
39583
  init_sdk3();
39424
39584
  init_constants4();
39425
- init_utils23();
39585
+ init_utils24();
39426
39586
  ({ cloneDeep: cloneDeep17, isEqual: isEqual6 } = require("lodash"));
39427
39587
  }
39428
39588
  });
@@ -39579,7 +39739,7 @@ async function externalTrigger(automation, params2, { getResponses } = {}) {
39579
39739
  automation
39580
39740
  };
39581
39741
  const job = { data: data2 };
39582
- return processEvent(job);
39742
+ return executeSynchronously(job);
39583
39743
  } else {
39584
39744
  return automationQueue.add(data2, JOB_OPTS);
39585
39745
  }
@@ -39622,9 +39782,10 @@ var init_triggers = __esm({
39622
39782
  init_utils9();
39623
39783
  init_bullboard();
39624
39784
  init_redis4();
39625
- init_utils26();
39785
+ init_utils27();
39626
39786
  init_environment3();
39627
39787
  init_src2();
39788
+ init_automation4();
39628
39789
  TRIGGER_DEFINITIONS = definitions3;
39629
39790
  JOB_OPTS = {
39630
39791
  removeOnComplete: true,
@@ -39829,14 +39990,33 @@ async function getDefinitionList(ctx) {
39829
39990
  async function trigger(ctx) {
39830
39991
  const db2 = context_exports.getAppDB();
39831
39992
  let automation = await db2.get(ctx.params.id);
39832
- await externalTrigger(automation, {
39833
- ...ctx.request.body,
39834
- appId: ctx.appId
39835
- });
39836
- ctx.body = {
39837
- message: `Automation ${automation._id} has been triggered.`,
39838
- automation
39839
- };
39993
+ let hasCollectStep = sdk_default.automations.utils.checkForCollectStep(automation);
39994
+ if (hasCollectStep && await features_exports.isSyncAutomationsEnabled()) {
39995
+ const response2 = await externalTrigger(
39996
+ automation,
39997
+ {
39998
+ fields: ctx.request.body.fields,
39999
+ timeout: ctx.request.body.timeout * 1e3 || 12e4
40000
+ },
40001
+ { getResponses: true }
40002
+ );
40003
+ let collectedValue = response2.steps.find(
40004
+ (step) => step.stepId === "COLLECT" /* COLLECT */
40005
+ );
40006
+ ctx.body = collectedValue == null ? void 0 : collectedValue.outputs;
40007
+ } else {
40008
+ if (ctx.appId && !db_exports.isProdAppID(ctx.appId)) {
40009
+ ctx.throw(400, "Only apps in production support this endpoint");
40010
+ }
40011
+ await externalTrigger(automation, {
40012
+ ...ctx.request.body,
40013
+ appId: ctx.appId
40014
+ });
40015
+ ctx.body = {
40016
+ message: `Automation ${automation._id} has been triggered.`,
40017
+ automation
40018
+ };
40019
+ }
39840
40020
  }
39841
40021
  function prepareTestInput(input) {
39842
40022
  if (input.id && input.row) {
@@ -39872,13 +40052,16 @@ var init_automation5 = __esm({
39872
40052
  "src/api/controllers/automation.ts"() {
39873
40053
  init_triggers();
39874
40054
  init_utils9();
39875
- init_utils26();
40055
+ init_utils27();
39876
40056
  init_utilities2();
39877
40057
  init_constants4();
39878
40058
  init_redis4();
39879
40059
  init_src2();
39880
40060
  init_src4();
40061
+ init_src();
39881
40062
  init_actions();
40063
+ init_sdk3();
40064
+ init_src2();
39882
40065
  }
39883
40066
  });
39884
40067
 
@@ -39956,7 +40139,6 @@ var init_automation6 = __esm({
39956
40139
  destroy19
39957
40140
  ).post(
39958
40141
  "/api/automations/:id/trigger",
39959
- middleware({ appType: "prod" /* PROD */ }),
39960
40142
  paramResource("id"),
39961
40143
  authorized_default(
39962
40144
  permissions_exports.PermissionType.AUTOMATION,
@@ -40034,16 +40216,34 @@ async function trigger2(ctx) {
40034
40216
  }
40035
40217
  const target = await db2.get(webhook.action.target);
40036
40218
  if (webhook.action.type === "automation" /* AUTOMATION */) {
40037
- await externalTrigger(target, {
40038
- body: ctx.request.body,
40039
- ...ctx.request.body,
40040
- appId: prodAppId
40041
- });
40219
+ let hasCollectStep = sdk_default.automations.utils.checkForCollectStep(target);
40220
+ if (hasCollectStep && await features_exports.isSyncAutomationsEnabled()) {
40221
+ const response2 = await externalTrigger(
40222
+ target,
40223
+ {
40224
+ body: ctx.request.body,
40225
+ ...ctx.request.body,
40226
+ appId: prodAppId
40227
+ },
40228
+ { getResponses: true }
40229
+ );
40230
+ let collectedValue = response2.steps.find(
40231
+ (step) => step.stepId === "COLLECT" /* COLLECT */
40232
+ );
40233
+ ctx.status = 200;
40234
+ ctx.body = collectedValue.outputs;
40235
+ } else {
40236
+ await externalTrigger(target, {
40237
+ body: ctx.request.body,
40238
+ ...ctx.request.body,
40239
+ appId: prodAppId
40240
+ });
40241
+ ctx.status = 200;
40242
+ ctx.body = {
40243
+ message: "Webhook trigger fired successfully"
40244
+ };
40245
+ }
40042
40246
  }
40043
- ctx.status = 200;
40044
- ctx.body = {
40045
- message: "Webhook trigger fired successfully"
40046
- };
40047
40247
  } catch (err) {
40048
40248
  if (err.status === 404) {
40049
40249
  ctx.status = 200;
@@ -40062,6 +40262,7 @@ var init_webhook4 = __esm({
40062
40262
  init_src2();
40063
40263
  init_src();
40064
40264
  init_sdk3();
40265
+ init_src4();
40065
40266
  toJsonSchema = require("to-json-schema");
40066
40267
  validate6 = require("jsonschema").validate;
40067
40268
  AUTOMATION_DESCRIPTION = "Generated from Webhook Schema";
@@ -41183,11 +41384,11 @@ var init_dev2 = __esm({
41183
41384
  });
41184
41385
 
41185
41386
  // src/migrations/functions/userEmailViewCasing.ts
41186
- var run20;
41387
+ var run21;
41187
41388
  var init_userEmailViewCasing = __esm({
41188
41389
  "src/migrations/functions/userEmailViewCasing.ts"() {
41189
41390
  init_src2();
41190
- run20 = async () => {
41391
+ run21 = async () => {
41191
41392
  await db_exports.createNewUserEmailView();
41192
41393
  };
41193
41394
  }
@@ -41204,13 +41405,13 @@ var init_usageQuotas = __esm({
41204
41405
  });
41205
41406
 
41206
41407
  // src/migrations/functions/usageQuotas/syncApps.ts
41207
- var run21;
41408
+ var run22;
41208
41409
  var init_syncApps = __esm({
41209
41410
  "src/migrations/functions/usageQuotas/syncApps.ts"() {
41210
41411
  init_src2();
41211
41412
  init_src4();
41212
41413
  init_src();
41213
- run21 = async () => {
41414
+ run22 = async () => {
41214
41415
  const devApps = await db_exports.getAllApps({ dev: true });
41215
41416
  const appCount = devApps ? devApps.length : 0;
41216
41417
  console.log(`Syncing app count: ${appCount}`);
@@ -41220,14 +41421,14 @@ var init_syncApps = __esm({
41220
41421
  });
41221
41422
 
41222
41423
  // src/migrations/functions/usageQuotas/syncRows.ts
41223
- var run22;
41424
+ var run23;
41224
41425
  var init_syncRows = __esm({
41225
41426
  "src/migrations/functions/usageQuotas/syncRows.ts"() {
41226
41427
  init_src2();
41227
41428
  init_rows6();
41228
41429
  init_src4();
41229
41430
  init_src();
41230
- run22 = async () => {
41431
+ run23 = async () => {
41231
41432
  const allApps = await db_exports.getAllApps({ all: true });
41232
41433
  const appIds = allApps ? allApps.map((app2) => app2.appId) : [];
41233
41434
  const { appRows } = await getUniqueRows(appIds);
@@ -41248,12 +41449,12 @@ var init_syncRows = __esm({
41248
41449
  });
41249
41450
 
41250
41451
  // src/migrations/functions/usageQuotas/syncPlugins.ts
41251
- var run23;
41452
+ var run24;
41252
41453
  var init_syncPlugins = __esm({
41253
41454
  "src/migrations/functions/usageQuotas/syncPlugins.ts"() {
41254
41455
  init_src2();
41255
41456
  init_src4();
41256
- run23 = async () => {
41457
+ run24 = async () => {
41257
41458
  try {
41258
41459
  await plugins_exports.checkPluginQuotas();
41259
41460
  } catch (err) {
@@ -41264,13 +41465,13 @@ var init_syncPlugins = __esm({
41264
41465
  });
41265
41466
 
41266
41467
  // src/migrations/functions/usageQuotas/syncUsers.ts
41267
- var run24;
41468
+ var run25;
41268
41469
  var init_syncUsers2 = __esm({
41269
41470
  "src/migrations/functions/usageQuotas/syncUsers.ts"() {
41270
41471
  init_src2();
41271
41472
  init_src4();
41272
41473
  init_src();
41273
- run24 = async () => {
41474
+ run25 = async () => {
41274
41475
  const userCount = await users_exports2.getUserCount();
41275
41476
  console.log(`Syncing user count: ${userCount}`);
41276
41477
  await quotas_exports4.setUsage(userCount, "users" /* USERS */, "static" /* STATIC */);
@@ -41279,7 +41480,7 @@ var init_syncUsers2 = __esm({
41279
41480
  });
41280
41481
 
41281
41482
  // src/migrations/functions/syncQuotas.ts
41282
- var run25;
41483
+ var run26;
41283
41484
  var init_syncQuotas = __esm({
41284
41485
  "src/migrations/functions/syncQuotas.ts"() {
41285
41486
  init_usageQuotas();
@@ -41287,24 +41488,24 @@ var init_syncQuotas = __esm({
41287
41488
  init_syncRows();
41288
41489
  init_syncPlugins();
41289
41490
  init_syncUsers2();
41290
- run25 = async () => {
41491
+ run26 = async () => {
41291
41492
  await runQuotaMigration(async () => {
41292
- await run21();
41293
41493
  await run22();
41294
41494
  await run23();
41295
41495
  await run24();
41496
+ await run25();
41296
41497
  });
41297
41498
  };
41298
41499
  }
41299
41500
  });
41300
41501
 
41301
41502
  // src/migrations/functions/appUrls.ts
41302
- var run26;
41503
+ var run27;
41303
41504
  var init_appUrls = __esm({
41304
41505
  "src/migrations/functions/appUrls.ts"() {
41305
41506
  init_src2();
41306
41507
  init_sdk3();
41307
- run26 = async (appDb) => {
41508
+ run27 = async (appDb) => {
41308
41509
  let metadata;
41309
41510
  try {
41310
41511
  metadata = await appDb.get(db_exports.DocumentType.APP_METADATA);
@@ -41322,12 +41523,12 @@ var init_appUrls = __esm({
41322
41523
  });
41323
41524
 
41324
41525
  // src/migrations/functions/tableSettings.ts
41325
- var import_string_templates9, run27, migrateTableSettings, convertLinkSettingToAction;
41526
+ var import_string_templates9, run28, migrateTableSettings, convertLinkSettingToAction;
41326
41527
  var init_tableSettings = __esm({
41327
41528
  "src/migrations/functions/tableSettings.ts"() {
41328
41529
  init_utils9();
41329
41530
  import_string_templates9 = __toESM(require_src2());
41330
- run27 = async (appDb) => {
41531
+ run28 = async (appDb) => {
41331
41532
  var _a2;
41332
41533
  let screens;
41333
41534
  try {
@@ -41767,9 +41968,9 @@ var global_exports = {};
41767
41968
  __export(global_exports, {
41768
41969
  getInstallTimestamp: () => getInstallTimestamp,
41769
41970
  isComplete: () => isComplete,
41770
- run: () => run28
41971
+ run: () => run29
41771
41972
  });
41772
- var failGraceful, handleError, formatUsage, EVENTS, run28, isComplete, getInstallTimestamp;
41973
+ var failGraceful, handleError, formatUsage, EVENTS, run29, isComplete, getInstallTimestamp;
41773
41974
  var init_global6 = __esm({
41774
41975
  "src/migrations/functions/backfill/global.ts"() {
41775
41976
  init_users13();
@@ -41829,7 +42030,7 @@ var init_global6 = __esm({
41829
42030
  "queries:run" /* QUERIES_RUN */,
41830
42031
  "automations:run" /* AUTOMATIONS_RUN */
41831
42032
  ];
41832
- run28 = async (db2) => {
42033
+ run29 = async (db2) => {
41833
42034
  try {
41834
42035
  const tenantId = tenancy.getTenantId();
41835
42036
  let timestamp = DEFAULT_TIMESTAMP;
@@ -41931,9 +42132,9 @@ var init_global6 = __esm({
41931
42132
  // src/migrations/functions/backfill/app.ts
41932
42133
  var app_exports2 = {};
41933
42134
  __export(app_exports2, {
41934
- run: () => run29
42135
+ run: () => run30
41935
42136
  });
41936
- var failGraceful2, handleError2, EVENTS2, run29;
42137
+ var failGraceful2, handleError2, EVENTS2, run30;
41937
42138
  var init_app9 = __esm({
41938
42139
  "src/migrations/functions/backfill/app.ts"() {
41939
42140
  init_automations7();
@@ -41974,7 +42175,7 @@ var init_app9 = __esm({
41974
42175
  "app:published" /* APP_PUBLISHED */,
41975
42176
  "app:created" /* APP_CREATED */
41976
42177
  ];
41977
- run29 = async (appDb) => {
42178
+ run30 = async (appDb) => {
41978
42179
  try {
41979
42180
  if (await isComplete()) {
41980
42181
  return;
@@ -42059,9 +42260,9 @@ var init_app9 = __esm({
42059
42260
  // src/migrations/functions/backfill/installation.ts
42060
42261
  var installation_exports2 = {};
42061
42262
  __export(installation_exports2, {
42062
- run: () => run30
42263
+ run: () => run31
42063
42264
  });
42064
- var failGraceful3, handleError3, run30;
42265
+ var failGraceful3, handleError3, run31;
42065
42266
  var init_installation3 = __esm({
42066
42267
  "src/migrations/functions/backfill/installation.ts"() {
42067
42268
  init_backfill4();
@@ -42078,7 +42279,7 @@ var init_installation3 = __esm({
42078
42279
  }
42079
42280
  throw e;
42080
42281
  };
42081
- run30 = async () => {
42282
+ run31 = async () => {
42082
42283
  try {
42083
42284
  await tenancy.doInTenant(tenancy.DEFAULT_TENANT_ID, async () => {
42084
42285
  const db2 = tenancy.getGlobalDB();
@@ -42128,33 +42329,33 @@ var init_migrations4 = __esm({
42128
42329
  buildMigrations = () => {
42129
42330
  const definitions4 = migrations_exports.DEFINITIONS;
42130
42331
  const serverMigrations = [];
42131
- for (const definition25 of definitions4) {
42132
- switch (definition25.name) {
42332
+ for (const definition26 of definitions4) {
42333
+ switch (definition26.name) {
42133
42334
  case "user_email_view_casing" /* USER_EMAIL_VIEW_CASING */: {
42134
42335
  serverMigrations.push({
42135
- ...definition25,
42136
- fn: run20
42336
+ ...definition26,
42337
+ fn: run21
42137
42338
  });
42138
42339
  break;
42139
42340
  }
42140
42341
  case "sync_quotas_1" /* SYNC_QUOTAS */: {
42141
42342
  serverMigrations.push({
42142
- ...definition25,
42143
- fn: run25
42343
+ ...definition26,
42344
+ fn: run26
42144
42345
  });
42145
42346
  break;
42146
42347
  }
42147
42348
  case "app_urls" /* APP_URLS */: {
42148
42349
  serverMigrations.push({
42149
- ...definition25,
42350
+ ...definition26,
42150
42351
  appOpts: { all: true },
42151
- fn: run26
42352
+ fn: run27
42152
42353
  });
42153
42354
  break;
42154
42355
  }
42155
42356
  case "event_app_backfill" /* EVENT_APP_BACKFILL */: {
42156
42357
  serverMigrations.push({
42157
- ...definition25,
42358
+ ...definition26,
42158
42359
  appOpts: { all: true },
42159
42360
  fn: app_exports2.run,
42160
42361
  silent: !!environment_default2.SELF_HOSTED,
@@ -42166,7 +42367,7 @@ var init_migrations4 = __esm({
42166
42367
  }
42167
42368
  case "event_global_backfill" /* EVENT_GLOBAL_BACKFILL */: {
42168
42369
  serverMigrations.push({
42169
- ...definition25,
42370
+ ...definition26,
42170
42371
  fn: global_exports.run,
42171
42372
  silent: !!environment_default2.SELF_HOSTED,
42172
42373
  // reduce noisy logging
@@ -42177,7 +42378,7 @@ var init_migrations4 = __esm({
42177
42378
  }
42178
42379
  case "event_installation_backfill" /* EVENT_INSTALLATION_BACKFILL */: {
42179
42380
  serverMigrations.push({
42180
- ...definition25,
42381
+ ...definition26,
42181
42382
  fn: installation_exports2.run,
42182
42383
  silent: !!environment_default2.SELF_HOSTED,
42183
42384
  // reduce noisy logging
@@ -42188,9 +42389,9 @@ var init_migrations4 = __esm({
42188
42389
  }
42189
42390
  case "table_settings_links_to_actions" /* TABLE_SETTINGS_LINKS_TO_ACTIONS */: {
42190
42391
  serverMigrations.push({
42191
- ...definition25,
42392
+ ...definition26,
42192
42393
  appOpts: { dev: true },
42193
- fn: run27
42394
+ fn: run28
42194
42395
  });
42195
42396
  break;
42196
42397
  }
@@ -42266,7 +42467,7 @@ async function downloadUnzipTarball(url, name, headers = {}) {
42266
42467
  throw new Error(e.message);
42267
42468
  }
42268
42469
  }
42269
- var init_utils27 = __esm({
42470
+ var init_utils28 = __esm({
42270
42471
  "src/api/controllers/plugin/utils.ts"() {
42271
42472
  init_fileSystem();
42272
42473
  init_src2();
@@ -42338,7 +42539,7 @@ var init_github = __esm({
42338
42539
  "src/api/controllers/plugin/github.ts"() {
42339
42540
  init_fileSystem();
42340
42541
  import_node_fetch19 = __toESM(require("node-fetch"));
42341
- init_utils27();
42542
+ init_utils28();
42342
42543
  }
42343
42544
  });
42344
42545
 
@@ -42386,7 +42587,7 @@ var init_npm = __esm({
42386
42587
  init_fileSystem();
42387
42588
  import_node_fetch20 = __toESM(require("node-fetch"));
42388
42589
  import_path14 = require("path");
42389
- init_utils27();
42590
+ init_utils28();
42390
42591
  }
42391
42592
  });
42392
42593
 
@@ -42400,7 +42601,7 @@ async function urlUpload(url, name = "", headers = {}) {
42400
42601
  }
42401
42602
  var init_url = __esm({
42402
42603
  "src/api/controllers/plugin/url.ts"() {
42403
- init_utils27();
42604
+ init_utils28();
42404
42605
  init_fileSystem();
42405
42606
  }
42406
42607
  });
@@ -42854,7 +43055,7 @@ function search6(docs, value, key = "name") {
42854
43055
  }
42855
43056
  return filtered2;
42856
43057
  }
42857
- var init_utils28 = __esm({
43058
+ var init_utils29 = __esm({
42858
43059
  "src/api/controllers/public/utils.ts"() {
42859
43060
  init_src2();
42860
43061
  init_utils19();
@@ -42942,7 +43143,7 @@ var applications_default2;
42942
43143
  var init_applications2 = __esm({
42943
43144
  "src/api/controllers/public/applications.ts"() {
42944
43145
  init_src2();
42945
- init_utils28();
43146
+ init_utils29();
42946
43147
  init_application();
42947
43148
  init_deploy();
42948
43149
  applications_default2 = {
@@ -43249,7 +43450,7 @@ async function execute3(ctx, next) {
43249
43450
  var queries_default2;
43250
43451
  var init_queries5 = __esm({
43251
43452
  "src/api/controllers/public/queries.ts"() {
43252
- init_utils28();
43453
+ init_utils29();
43253
43454
  init_query5();
43254
43455
  queries_default2 = {
43255
43456
  search: search8,
@@ -43320,7 +43521,7 @@ async function destroy24(ctx, next) {
43320
43521
  var tables_default2;
43321
43522
  var init_tables3 = __esm({
43322
43523
  "src/api/controllers/public/tables.ts"() {
43323
- init_utils28();
43524
+ init_utils29();
43324
43525
  init_table4();
43325
43526
  tables_default2 = {
43326
43527
  create: create10,
@@ -43424,7 +43625,7 @@ var rows_default3;
43424
43625
  var init_rows7 = __esm({
43425
43626
  "src/api/controllers/public/rows.ts"() {
43426
43627
  init_row2();
43427
- init_utils28();
43628
+ init_utils29();
43428
43629
  init_utilities2();
43429
43630
  rows_default3 = {
43430
43631
  create: create11,
@@ -43525,7 +43726,7 @@ var init_users14 = __esm({
43525
43726
  init_workerRequests();
43526
43727
  init_users11();
43527
43728
  init_src2();
43528
- init_utils28();
43729
+ init_utils29();
43529
43730
  users_default2 = {
43530
43731
  create: create12,
43531
43732
  read: read9,
@@ -44098,7 +44299,7 @@ async function init21() {
44098
44299
  }
44099
44300
  var init_automations8 = __esm({
44100
44301
  "src/automations/index.ts"() {
44101
- init_utils26();
44302
+ init_utils27();
44102
44303
  init_bullboard();
44103
44304
  init_triggers();
44104
44305
  init_bullboard();