@budibase/server 2.0.30-alpha.7 → 2.0.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (215) hide show
  1. package/__mocks__/mongodb.ts +1 -1
  2. package/builder/assets/{index.b1aa5e8a.js → index.c4b43e7e.js} +283 -287
  3. package/builder/assets/{index.a6a040bb.css → index.dfa4073c.css} +2 -2
  4. package/builder/index.html +2 -2
  5. package/coverage/clover.xml +491 -495
  6. package/coverage/coverage-final.json +26 -26
  7. package/coverage/lcov-report/api/controllers/apikeys.js.html +1 -1
  8. package/coverage/lcov-report/api/controllers/automation.js.html +1 -1
  9. package/coverage/lcov-report/api/controllers/backup.js.html +1 -1
  10. package/coverage/lcov-report/api/controllers/cloud.js.html +1 -1
  11. package/coverage/lcov-report/api/controllers/datasource.js.html +1 -1
  12. package/coverage/lcov-report/api/controllers/dev.js.html +2 -2
  13. package/coverage/lcov-report/api/controllers/index.html +1 -1
  14. package/coverage/lcov-report/api/controllers/integration.js.html +1 -1
  15. package/coverage/lcov-report/api/controllers/layout.js.html +1 -1
  16. package/coverage/lcov-report/api/controllers/metadata.js.html +1 -1
  17. package/coverage/lcov-report/api/controllers/migrations.js.html +1 -1
  18. package/coverage/lcov-report/api/controllers/permission.js.html +1 -1
  19. package/coverage/lcov-report/api/controllers/query/index.html +1 -1
  20. package/coverage/lcov-report/api/controllers/query/validation.js.html +1 -1
  21. package/coverage/lcov-report/api/controllers/role.js.html +1 -1
  22. package/coverage/lcov-report/api/controllers/routing.js.html +1 -1
  23. package/coverage/lcov-report/api/controllers/row/external.js.html +1 -1
  24. package/coverage/lcov-report/api/controllers/row/index.html +1 -1
  25. package/coverage/lcov-report/api/controllers/row/internal.js.html +12 -12
  26. package/coverage/lcov-report/api/controllers/row/internalSearch.js.html +1 -1
  27. package/coverage/lcov-report/api/controllers/row/staticFormula.js.html +15 -15
  28. package/coverage/lcov-report/api/controllers/row/utils.js.html +13 -13
  29. package/coverage/lcov-report/api/controllers/script.js.html +1 -1
  30. package/coverage/lcov-report/api/controllers/table/bulkFormula.js.html +1 -1
  31. package/coverage/lcov-report/api/controllers/table/external.js.html +1 -1
  32. package/coverage/lcov-report/api/controllers/table/index.html +1 -1
  33. package/coverage/lcov-report/api/controllers/table/index.js.html +1 -1
  34. package/coverage/lcov-report/api/controllers/templates.js.html +1 -1
  35. package/coverage/lcov-report/api/controllers/user.js.html +1 -1
  36. package/coverage/lcov-report/api/controllers/view/exporters.js.html +1 -1
  37. package/coverage/lcov-report/api/controllers/view/index.html +1 -1
  38. package/coverage/lcov-report/api/controllers/view/index.js.html +1 -1
  39. package/coverage/lcov-report/api/controllers/view/utils.js.html +1 -1
  40. package/coverage/lcov-report/api/controllers/view/viewBuilder.js.html +1 -1
  41. package/coverage/lcov-report/api/controllers/webhook.js.html +1 -1
  42. package/coverage/lcov-report/api/index.html +1 -1
  43. package/coverage/lcov-report/api/index.js.html +5 -5
  44. package/coverage/lcov-report/api/routes/analytics.js.html +1 -1
  45. package/coverage/lcov-report/api/routes/apikeys.js.html +1 -1
  46. package/coverage/lcov-report/api/routes/automation.js.html +1 -1
  47. package/coverage/lcov-report/api/routes/backup.js.html +1 -1
  48. package/coverage/lcov-report/api/routes/cloud.js.html +1 -1
  49. package/coverage/lcov-report/api/routes/component.js.html +1 -1
  50. package/coverage/lcov-report/api/routes/datasource.js.html +1 -1
  51. package/coverage/lcov-report/api/routes/deploy.js.html +1 -1
  52. package/coverage/lcov-report/api/routes/dev.js.html +1 -1
  53. package/coverage/lcov-report/api/routes/index.html +1 -1
  54. package/coverage/lcov-report/api/routes/integration.js.html +1 -1
  55. package/coverage/lcov-report/api/routes/layout.js.html +1 -1
  56. package/coverage/lcov-report/api/routes/metadata.js.html +1 -1
  57. package/coverage/lcov-report/api/routes/migrations.js.html +1 -1
  58. package/coverage/lcov-report/api/routes/permission.js.html +1 -1
  59. package/coverage/lcov-report/api/routes/query.js.html +1 -1
  60. package/coverage/lcov-report/api/routes/role.js.html +1 -1
  61. package/coverage/lcov-report/api/routes/routing.js.html +1 -1
  62. package/coverage/lcov-report/api/routes/screen.js.html +1 -1
  63. package/coverage/lcov-report/api/routes/script.js.html +1 -1
  64. package/coverage/lcov-report/api/routes/table.js.html +1 -1
  65. package/coverage/lcov-report/api/routes/templates.js.html +1 -1
  66. package/coverage/lcov-report/api/routes/user.js.html +1 -1
  67. package/coverage/lcov-report/api/routes/utils/index.html +1 -1
  68. package/coverage/lcov-report/api/routes/utils/validators.js.html +1 -1
  69. package/coverage/lcov-report/api/routes/view.js.html +1 -1
  70. package/coverage/lcov-report/api/routes/webhook.js.html +1 -1
  71. package/coverage/lcov-report/automations/actions.js.html +1 -1
  72. package/coverage/lcov-report/automations/automationUtils.js.html +1 -1
  73. package/coverage/lcov-report/automations/bullboard.js.html +1 -1
  74. package/coverage/lcov-report/automations/index.html +1 -1
  75. package/coverage/lcov-report/automations/index.js.html +5 -5
  76. package/coverage/lcov-report/automations/steps/bash.js.html +1 -1
  77. package/coverage/lcov-report/automations/steps/delay.js.html +1 -1
  78. package/coverage/lcov-report/automations/steps/discord.js.html +1 -1
  79. package/coverage/lcov-report/automations/steps/executeQuery.js.html +1 -1
  80. package/coverage/lcov-report/automations/steps/executeScript.js.html +1 -1
  81. package/coverage/lcov-report/automations/steps/filter.js.html +1 -1
  82. package/coverage/lcov-report/automations/steps/index.html +1 -1
  83. package/coverage/lcov-report/automations/steps/integromat.js.html +1 -1
  84. package/coverage/lcov-report/automations/steps/loop.js.html +1 -1
  85. package/coverage/lcov-report/automations/steps/outgoingWebhook.js.html +1 -1
  86. package/coverage/lcov-report/automations/steps/queryRows.js.html +1 -1
  87. package/coverage/lcov-report/automations/steps/sendSmtpEmail.js.html +1 -1
  88. package/coverage/lcov-report/automations/steps/serverLog.js.html +1 -1
  89. package/coverage/lcov-report/automations/steps/slack.js.html +1 -1
  90. package/coverage/lcov-report/automations/steps/updateRow.js.html +3 -3
  91. package/coverage/lcov-report/automations/steps/utils.js.html +1 -1
  92. package/coverage/lcov-report/automations/steps/zapier.js.html +1 -1
  93. package/coverage/lcov-report/automations/triggerInfo/app.js.html +1 -1
  94. package/coverage/lcov-report/automations/triggerInfo/cron.js.html +1 -1
  95. package/coverage/lcov-report/automations/triggerInfo/index.html +1 -1
  96. package/coverage/lcov-report/automations/triggerInfo/index.js.html +1 -1
  97. package/coverage/lcov-report/automations/triggerInfo/rowDeleted.js.html +1 -1
  98. package/coverage/lcov-report/automations/triggerInfo/rowSaved.js.html +1 -1
  99. package/coverage/lcov-report/automations/triggerInfo/rowUpdated.js.html +1 -1
  100. package/coverage/lcov-report/automations/triggerInfo/webhook.js.html +1 -1
  101. package/coverage/lcov-report/automations/triggers.js.html +22 -22
  102. package/coverage/lcov-report/constants/index.html +1 -1
  103. package/coverage/lcov-report/constants/index.js.html +2 -8
  104. package/coverage/lcov-report/constants/layouts.js.html +1 -1
  105. package/coverage/lcov-report/constants/screens.js.html +1 -1
  106. package/coverage/lcov-report/db/inMemoryView.js.html +1 -1
  107. package/coverage/lcov-report/db/index.html +1 -1
  108. package/coverage/lcov-report/db/index.js.html +1 -1
  109. package/coverage/lcov-report/db/linkedRows/LinkController.js.html +11 -11
  110. package/coverage/lcov-report/db/linkedRows/index.html +1 -1
  111. package/coverage/lcov-report/db/linkedRows/index.js.html +11 -11
  112. package/coverage/lcov-report/db/linkedRows/linkUtils.js.html +3 -3
  113. package/coverage/lcov-report/db/newid.js.html +2 -2
  114. package/coverage/lcov-report/db/utils.js.html +16 -10
  115. package/coverage/lcov-report/events/AutomationEmitter.js.html +1 -1
  116. package/coverage/lcov-report/events/index.html +1 -1
  117. package/coverage/lcov-report/events/index.js.html +2 -2
  118. package/coverage/lcov-report/events/utils.js.html +9 -9
  119. package/coverage/lcov-report/index.html +24 -24
  120. package/coverage/lcov-report/integrations/tests/TestConfiguration.js.html +1 -1
  121. package/coverage/lcov-report/integrations/tests/index.html +1 -1
  122. package/coverage/lcov-report/middleware/appInfo.js.html +1 -1
  123. package/coverage/lcov-report/middleware/builder.js.html +11 -11
  124. package/coverage/lcov-report/middleware/currentapp.js.html +34 -34
  125. package/coverage/lcov-report/middleware/index.html +1 -1
  126. package/coverage/lcov-report/middleware/joi-validator.js.html +1 -1
  127. package/coverage/lcov-report/middleware/publicApi.js.html +1 -1
  128. package/coverage/lcov-report/middleware/resourceId.js.html +7 -7
  129. package/coverage/lcov-report/middleware/selfhost.js.html +1 -1
  130. package/coverage/lcov-report/middleware/utils.js.html +2 -2
  131. package/coverage/lcov-report/utilities/budibaseDir.js.html +1 -1
  132. package/coverage/lcov-report/utilities/centralPath.js.html +1 -1
  133. package/coverage/lcov-report/utilities/csvParser.js.html +8 -11
  134. package/coverage/lcov-report/utilities/global.js.html +16 -16
  135. package/coverage/lcov-report/utilities/index.html +15 -15
  136. package/coverage/lcov-report/utilities/index.js.html +7 -7
  137. package/coverage/lcov-report/utilities/plugins.js.html +1 -1
  138. package/coverage/lcov-report/utilities/queue/inMemoryQueue.js.html +13 -13
  139. package/coverage/lcov-report/utilities/queue/index.html +1 -1
  140. package/coverage/lcov-report/utilities/routing/index.html +1 -1
  141. package/coverage/lcov-report/utilities/routing/index.js.html +1 -1
  142. package/coverage/lcov-report/utilities/rowProcessor/index.html +1 -1
  143. package/coverage/lcov-report/utilities/rowProcessor/index.js.html +39 -54
  144. package/coverage/lcov-report/utilities/rowProcessor/utils.js.html +10 -10
  145. package/coverage/lcov-report/utilities/scriptRunner.js.html +1 -1
  146. package/coverage/lcov-report/utilities/security.js.html +1 -1
  147. package/coverage/lcov-report/utilities/statusCodes.js.html +1 -1
  148. package/coverage/lcov-report/utilities/usageQuota/index.html +14 -14
  149. package/coverage/lcov-report/utilities/usageQuota/rows.js.html +11 -23
  150. package/coverage/lcov-report/utilities/usageQuota/usageQuoteReset.js.html +1 -1
  151. package/coverage/lcov-report/utilities/users.js.html +1 -1
  152. package/coverage/lcov-report/utilities/workerRequests.js.html +1 -1
  153. package/coverage/lcov.info +892 -900
  154. package/dist/api/controllers/application.js +2 -2
  155. package/dist/api/controllers/dev.js +1 -1
  156. package/dist/api/controllers/query/index.js +2 -7
  157. package/dist/api/controllers/row/index.js +10 -30
  158. package/dist/api/controllers/static/templates/preview.hbs +0 -10
  159. package/dist/api/controllers/table/internal.js +2 -8
  160. package/dist/api/controllers/table/utils.js +1 -3
  161. package/dist/automations/steps/updateRow.js +2 -2
  162. package/dist/automations/utils.js +3 -5
  163. package/dist/constants/index.js +0 -2
  164. package/dist/db/utils.js +1 -1
  165. package/dist/index.js +0 -1
  166. package/dist/integrations/base/sqlTable.js +0 -1
  167. package/dist/integrations/mongodb.js +11 -300
  168. package/dist/integrations/rest.js +5 -38
  169. package/dist/migrations/functions/{usageQuotas/syncPlugins.js → pluginCount.js} +3 -1
  170. package/dist/migrations/functions/{syncQuotas.js → quotas1.js} +7 -3
  171. package/dist/migrations/functions/usageQuotas/syncApps.js +1 -0
  172. package/dist/migrations/functions/usageQuotas/syncRows.js +5 -9
  173. package/dist/migrations/index.js +38 -9
  174. package/dist/package.json +9 -8
  175. package/dist/tsconfig.build.tsbuildinfo +1 -1
  176. package/dist/utilities/csvParser.js +0 -1
  177. package/dist/utilities/rowProcessor/index.js +0 -5
  178. package/dist/utilities/usageQuota/rows.js +4 -6
  179. package/package.json +10 -9
  180. package/specs/openapi.json +0 -3
  181. package/specs/openapi.yaml +0 -3
  182. package/src/api/controllers/application.ts +2 -2
  183. package/src/api/controllers/deploy/index.ts +1 -0
  184. package/src/api/controllers/dev.js +1 -1
  185. package/src/api/controllers/query/index.ts +2 -8
  186. package/src/api/controllers/row/index.ts +13 -36
  187. package/src/api/controllers/static/templates/preview.hbs +0 -10
  188. package/src/api/controllers/table/internal.ts +2 -5
  189. package/src/api/controllers/table/utils.ts +1 -3
  190. package/src/api/routes/tests/row.spec.js +27 -22
  191. package/src/automations/steps/updateRow.js +2 -2
  192. package/src/automations/tests/automation.spec.js +6 -1
  193. package/src/automations/utils.ts +4 -6
  194. package/src/constants/index.js +0 -2
  195. package/src/db/utils.js +2 -0
  196. package/src/definitions/datasource.ts +0 -1
  197. package/src/index.ts +0 -1
  198. package/src/integrations/base/sqlTable.ts +0 -1
  199. package/src/integrations/mongodb.ts +27 -290
  200. package/src/integrations/rest.ts +5 -17
  201. package/src/integrations/tests/mongo.spec.ts +19 -19
  202. package/src/integrations/tests/rest.spec.ts +22 -38
  203. package/src/migrations/functions/backfill/global.ts +1 -1
  204. package/src/migrations/functions/pluginCount.ts +12 -0
  205. package/src/migrations/functions/{syncQuotas.ts → quotas1.ts} +8 -3
  206. package/src/migrations/functions/tests/{syncQuotas.spec.js → quotas1.spec.js} +2 -5
  207. package/src/migrations/functions/usageQuotas/syncApps.ts +1 -0
  208. package/src/migrations/functions/usageQuotas/syncRows.ts +6 -15
  209. package/src/migrations/functions/usageQuotas/tests/syncRows.spec.ts +1 -9
  210. package/src/migrations/index.ts +45 -20
  211. package/src/migrations/tests/index.spec.ts +1 -0
  212. package/src/utilities/csvParser.js +0 -1
  213. package/src/utilities/rowProcessor/index.js +0 -5
  214. package/src/utilities/usageQuota/rows.js +3 -7
  215. package/src/migrations/functions/usageQuotas/syncPlugins.ts +0 -10
@@ -315,7 +315,7 @@ const appPostCreate = (ctx, app) => __awaiter(void 0, void 0, void 0, function*
315
315
  yield creationEvents(ctx.request, app);
316
316
  // app import & template creation
317
317
  if (ctx.request.body.useTemplate === "true") {
318
- const { rows } = yield (0, rows_1.getUniqueRows)([app.appId]);
318
+ const rows = yield (0, rows_1.getUniqueRows)([app.appId]);
319
319
  const rowCount = rows ? rows.length : 0;
320
320
  if (rowCount) {
321
321
  try {
@@ -440,7 +440,7 @@ const destroyApp = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
440
440
  return result;
441
441
  });
442
442
  const preDestroyApp = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
443
- const { rows } = yield (0, rows_1.getUniqueRows)([ctx.params.appId]);
443
+ const rows = yield (0, rows_1.getUniqueRows)([ctx.params.appId]);
444
444
  ctx.rowCount = rows.length;
445
445
  });
446
446
  const postDestroyApp = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
@@ -99,7 +99,7 @@ exports.revert = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
99
99
  target: appId,
100
100
  });
101
101
  try {
102
- if (env.COUCH_DB_URL) {
102
+ if (!env.isTest()) {
103
103
  // in-memory db stalls on rollback
104
104
  yield replication.rollback();
105
105
  }
@@ -61,7 +61,6 @@ const _import = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
61
61
  config: {
62
62
  url: info.url,
63
63
  defaultHeaders: [],
64
- rejectUnauthorized: true,
65
64
  },
66
65
  name: info.name,
67
66
  };
@@ -150,9 +149,7 @@ function preview(ctx) {
150
149
  auth: Object.assign({}, authConfigCtx),
151
150
  },
152
151
  });
153
- const { rows, keys, info, extra } = yield pro_1.quotas.addQuery(runFn, {
154
- datasourceId: datasource._id,
155
- });
152
+ const { rows, keys, info, extra } = yield pro_1.quotas.addQuery(runFn);
156
153
  const schemaFields = {};
157
154
  if ((rows === null || rows === void 0 ? void 0 : rows.length) > 0) {
158
155
  for (let key of [...new Set(keys)]) {
@@ -229,9 +226,7 @@ function execute(ctx, opts = { rowsOnly: false, isAutomation: false }) {
229
226
  auth: Object.assign({}, authConfigCtx),
230
227
  },
231
228
  });
232
- const { rows, pagination, extra } = yield pro_1.quotas.addQuery(runFn, {
233
- datasourceId: datasource._id,
234
- });
229
+ const { rows, pagination, extra } = yield pro_1.quotas.addQuery(runFn);
235
230
  // remove the raw from execution incase transformer being used to hide data
236
231
  if (extra === null || extra === void 0 ? void 0 : extra.raw) {
237
232
  delete extra.raw;
@@ -44,9 +44,7 @@ function patch(ctx) {
44
44
  return (0, exports.save)(ctx);
45
45
  }
46
46
  try {
47
- const { row, table } = yield pro_1.quotas.addQuery(() => pickApi(tableId).patch(ctx), {
48
- datasourceId: tableId,
49
- });
47
+ const { row, table } = yield pro_1.quotas.addQuery(() => pickApi(tableId).patch(ctx));
50
48
  ctx.status = 200;
51
49
  ctx.eventEmitter &&
52
50
  ctx.eventEmitter.emitRow(`row:update`, appId, row, table);
@@ -68,9 +66,7 @@ const save = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
68
66
  return patch(ctx);
69
67
  }
70
68
  try {
71
- const { row, table } = yield pro_1.quotas.addRow(() => pro_1.quotas.addQuery(() => pickApi(tableId).save(ctx), {
72
- datasourceId: tableId,
73
- }));
69
+ const { row, table } = yield pro_1.quotas.addRow(() => pro_1.quotas.addQuery(() => pickApi(tableId).save(ctx)));
74
70
  ctx.status = 200;
75
71
  ctx.eventEmitter && ctx.eventEmitter.emitRow(`row:save`, appId, row, table);
76
72
  ctx.message = `${table.name} saved successfully`;
@@ -85,9 +81,7 @@ function fetchView(ctx) {
85
81
  return __awaiter(this, void 0, void 0, function* () {
86
82
  const tableId = getTableId(ctx);
87
83
  try {
88
- ctx.body = yield pro_1.quotas.addQuery(() => pickApi(tableId).fetchView(ctx), {
89
- datasourceId: tableId,
90
- });
84
+ ctx.body = yield pro_1.quotas.addQuery(() => pickApi(tableId).fetchView(ctx));
91
85
  }
92
86
  catch (err) {
93
87
  ctx.throw(400, err);
@@ -99,9 +93,7 @@ function fetch(ctx) {
99
93
  return __awaiter(this, void 0, void 0, function* () {
100
94
  const tableId = getTableId(ctx);
101
95
  try {
102
- ctx.body = yield pro_1.quotas.addQuery(() => pickApi(tableId).fetch(ctx), {
103
- datasourceId: tableId,
104
- });
96
+ ctx.body = yield pro_1.quotas.addQuery(() => pickApi(tableId).fetch(ctx));
105
97
  }
106
98
  catch (err) {
107
99
  ctx.throw(400, err);
@@ -113,9 +105,7 @@ function find(ctx) {
113
105
  return __awaiter(this, void 0, void 0, function* () {
114
106
  const tableId = getTableId(ctx);
115
107
  try {
116
- ctx.body = yield pro_1.quotas.addQuery(() => pickApi(tableId).find(ctx), {
117
- datasourceId: tableId,
118
- });
108
+ ctx.body = yield pro_1.quotas.addQuery(() => pickApi(tableId).find(ctx));
119
109
  }
120
110
  catch (err) {
121
111
  ctx.throw(400, err);
@@ -130,9 +120,7 @@ function destroy(ctx) {
130
120
  const tableId = getTableId(ctx);
131
121
  let response, row;
132
122
  if (inputs.rows) {
133
- let { rows } = yield pro_1.quotas.addQuery(() => pickApi(tableId).bulkDestroy(ctx), {
134
- datasourceId: tableId,
135
- });
123
+ let { rows } = yield pro_1.quotas.addQuery(() => pickApi(tableId).bulkDestroy(ctx));
136
124
  yield pro_1.quotas.removeRows(rows.length);
137
125
  response = rows;
138
126
  for (let row of rows) {
@@ -140,9 +128,7 @@ function destroy(ctx) {
140
128
  }
141
129
  }
142
130
  else {
143
- let resp = yield pro_1.quotas.addQuery(() => pickApi(tableId).destroy(ctx), {
144
- datasourceId: tableId,
145
- });
131
+ let resp = yield pro_1.quotas.addQuery(() => pickApi(tableId).destroy(ctx));
146
132
  yield pro_1.quotas.removeRow();
147
133
  response = resp.response;
148
134
  row = resp.row;
@@ -160,9 +146,7 @@ function search(ctx) {
160
146
  const tableId = getTableId(ctx);
161
147
  try {
162
148
  ctx.status = 200;
163
- ctx.body = yield pro_1.quotas.addQuery(() => pickApi(tableId).search(ctx), {
164
- datasourceId: tableId,
165
- });
149
+ ctx.body = yield pro_1.quotas.addQuery(() => pickApi(tableId).search(ctx));
166
150
  }
167
151
  catch (err) {
168
152
  ctx.throw(400, err);
@@ -186,9 +170,7 @@ function fetchEnrichedRow(ctx) {
186
170
  return __awaiter(this, void 0, void 0, function* () {
187
171
  const tableId = getTableId(ctx);
188
172
  try {
189
- ctx.body = yield pro_1.quotas.addQuery(() => pickApi(tableId).fetchEnrichedRow(ctx), {
190
- datasourceId: tableId,
191
- });
173
+ ctx.body = yield pro_1.quotas.addQuery(() => pickApi(tableId).fetchEnrichedRow(ctx));
192
174
  }
193
175
  catch (err) {
194
176
  ctx.throw(400, err);
@@ -199,9 +181,7 @@ exports.fetchEnrichedRow = fetchEnrichedRow;
199
181
  const exportRows = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
200
182
  const tableId = getTableId(ctx);
201
183
  try {
202
- ctx.body = yield pro_1.quotas.addQuery(() => pickApi(tableId).exportRows(ctx), {
203
- datasourceId: tableId,
204
- });
184
+ ctx.body = yield pro_1.quotas.addQuery(() => pickApi(tableId).exportRows(ctx));
205
185
  }
206
186
  catch (err) {
207
187
  ctx.throw(400, err);
@@ -56,16 +56,6 @@
56
56
  return
57
57
  }
58
58
 
59
- // If this is a custom event, try and handle it
60
- if (parsed.runtimeEvent) {
61
- const { name, payload } = parsed
62
- if (window.handleBuilderRuntimeEvent) {
63
- window.handleBuilderRuntimeEvent(name, payload)
64
- }
65
- return
66
- }
67
-
68
- // Otherwise this is a full reload message
69
59
  // Extract data from message
70
60
  const {
71
61
  selectedComponentId,
@@ -19,9 +19,6 @@ var __rest = (this && this.__rest) || function (s, e) {
19
19
  }
20
20
  return t;
21
21
  };
22
- var __importDefault = (this && this.__importDefault) || function (mod) {
23
- return (mod && mod.__esModule) ? mod : { "default": mod };
24
- };
25
22
  Object.defineProperty(exports, "__esModule", { value: true });
26
23
  exports.bulkImport = exports.destroy = exports.save = void 0;
27
24
  const linkedRows_1 = require("../../../db/linkedRows");
@@ -35,7 +32,6 @@ const bulkFormula_1 = require("./bulkFormula");
35
32
  const pro_1 = require("@budibase/pro");
36
33
  const lodash_1 = require("lodash");
37
34
  const fp_1 = require("lodash/fp");
38
- const environment_2 = __importDefault(require("../../../environment"));
39
35
  function checkAutoColumns(table, oldTable) {
40
36
  if (!table.schema) {
41
37
  return table;
@@ -154,9 +150,7 @@ function destroy(ctx) {
154
150
  include_docs: true,
155
151
  }));
156
152
  yield db.bulkDocs(rows.rows.map((row) => (Object.assign(Object.assign({}, row.doc), { _deleted: true }))));
157
- yield pro_1.quotas.removeRows(rows.rows.length, {
158
- tableId: ctx.params.tableId,
159
- });
153
+ yield pro_1.quotas.removeRows(rows.rows.length);
160
154
  // update linked rows
161
155
  yield (0, linkedRows_1.updateLinks)({
162
156
  eventType: linkedRows_1.EventType.TABLE_DELETE,
@@ -165,7 +159,7 @@ function destroy(ctx) {
165
159
  // don't remove the table itself until very end
166
160
  yield db.remove(tableToDelete);
167
161
  // remove table search index
168
- if (!(0, environment_1.isTest)() || environment_2.default.COUCH_DB_URL) {
162
+ if (!(0, environment_1.isTest)()) {
169
163
  const currentIndexes = yield db.getIndexes();
170
164
  const existingIndex = currentIndexes.indexes.find((existing) => existing.name === `search:${ctx.params.tableId}`);
171
165
  if (existingIndex) {
@@ -130,9 +130,7 @@ function handleDataImport(user, table, dataImport) {
130
130
  }
131
131
  finalData.push(row);
132
132
  }
133
- yield pro_1.quotas.addRows(finalData.length, () => db.bulkDocs(finalData), {
134
- tableId: table._id,
135
- });
133
+ yield pro_1.quotas.addRows(finalData.length, () => db.bulkDocs(finalData));
136
134
  yield backend_core_1.events.rows.imported(table, "csv", finalData.length);
137
135
  return table;
138
136
  });
@@ -74,9 +74,9 @@ exports.run = function ({ inputs, appId, emitter }) {
74
74
  };
75
75
  }
76
76
  const tableId = inputs.row.tableId;
77
- // clear any undefined, null or empty string properties so that they aren't updated
77
+ // clear any falsy properties so that they aren't updated
78
78
  for (let propKey of Object.keys(inputs.row)) {
79
- if (inputs.row[propKey] == null || inputs.row[propKey] === "") {
79
+ if (!inputs.row[propKey] || inputs.row[propKey] === "") {
80
80
  delete inputs.row[propKey];
81
81
  }
82
82
  }
@@ -59,14 +59,12 @@ const jobMessage = (job, message) => {
59
59
  function processEvent(job) {
60
60
  return __awaiter(this, void 0, void 0, function* () {
61
61
  try {
62
- const automationId = job.data.automation._id;
63
62
  console.log(jobMessage(job, "running"));
64
63
  // need to actually await these so that an error can be captured properly
65
- return yield backend_core_1.context.doInContext(job.data.event.appId, () => __awaiter(this, void 0, void 0, function* () {
64
+ const tenantId = backend_core_1.tenancy.getTenantIDFromAppID(job.data.event.appId);
65
+ return yield backend_core_1.tenancy.doInTenant(tenantId, () => __awaiter(this, void 0, void 0, function* () {
66
66
  const runFn = () => Runner.run(job);
67
- return pro_1.quotas.addAutomation(runFn, {
68
- automationId,
69
- });
67
+ return pro_1.quotas.addAutomation(runFn);
70
68
  }));
71
69
  }
72
70
  catch (err) {
@@ -28,7 +28,6 @@ exports.NoEmptyFilterStrings = [
28
28
  ];
29
29
  exports.FieldTypes = {
30
30
  STRING: "string",
31
- BARCODEQR: "barcodeqr",
32
31
  LONGFORM: "longform",
33
32
  OPTIONS: "options",
34
33
  NUMBER: "number",
@@ -48,7 +47,6 @@ exports.CanSwitchTypes = [
48
47
  exports.FieldTypes.STRING,
49
48
  exports.FieldTypes.OPTIONS,
50
49
  exports.FieldTypes.LONGFORM,
51
- exports.FieldTypes.BARCODEQR,
52
50
  ],
53
51
  [exports.FieldTypes.BOOLEAN, exports.FieldTypes.NUMBER],
54
52
  ];
package/dist/db/utils.js CHANGED
@@ -7,7 +7,7 @@ const AppStatus = {
7
7
  ALL: "all",
8
8
  DEPLOYED: "published",
9
9
  };
10
- const DocumentType = Object.assign(Object.assign({}, CoreDocTypes), { TABLE: "ta", ROW: "ro", USER: "us", AUTOMATION: "au", LINK: "li", WEBHOOK: "wh", INSTANCE: "inst", LAYOUT: "layout", SCREEN: "screen", QUERY: "query", DEPLOYMENTS: "deployments", METADATA: "metadata", MEM_VIEW: "view", USER_FLAG: "flag", AUTOMATION_METADATA: "meta_au" });
10
+ const DocumentType = Object.assign(Object.assign({}, CoreDocTypes), { TABLE: "ta", ROW: "ro", USER: "us", AUTOMATION: "au", LINK: "li", WEBHOOK: "wh", INSTANCE: "inst", LAYOUT: "layout", SCREEN: "screen", DATASOURCE: "datasource", DATASOURCE_PLUS: "datasource_plus", QUERY: "query", DEPLOYMENTS: "deployments", METADATA: "metadata", MEM_VIEW: "view", USER_FLAG: "flag", AUTOMATION_METADATA: "meta_au" });
11
11
  const InternalTables = {
12
12
  USER_METADATA: "ta_users",
13
13
  };
package/dist/index.js CHANGED
@@ -9,7 +9,6 @@ function runServer() {
9
9
  checkDevelopmentEnvironment();
10
10
  fixPath();
11
11
  // this will setup http and https proxies form env variables
12
- process.env.GLOBAL_AGENT_FORCE_GLOBAL_AGENT = "false";
13
12
  (0, global_agent_1.bootstrap)();
14
13
  require("./app");
15
14
  }
@@ -31,7 +31,6 @@ function generateSchema(schema, table, tables, oldTable = null, renamed) {
31
31
  case FieldTypes.STRING:
32
32
  case FieldTypes.OPTIONS:
33
33
  case FieldTypes.LONGFORM:
34
- case FieldTypes.BARCODEQR:
35
34
  schema.text(key);
36
35
  break;
37
36
  case FieldTypes.NUMBER: