@budibase/server 1.1.7 → 1.1.10-alpha.0

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 (167) hide show
  1. package/builder/assets/{index.b61e24a3.js → index.bab30077.js} +74 -74
  2. package/builder/index.html +1 -1
  3. package/coverage/clover.xml +198 -198
  4. package/coverage/coverage-final.json +19 -19
  5. package/coverage/lcov-report/api/controllers/apikeys.js.html +1 -1
  6. package/coverage/lcov-report/api/controllers/auth.js.html +1 -1
  7. package/coverage/lcov-report/api/controllers/automation.js.html +1 -1
  8. package/coverage/lcov-report/api/controllers/backup.js.html +1 -1
  9. package/coverage/lcov-report/api/controllers/cloud.js.html +1 -1
  10. package/coverage/lcov-report/api/controllers/component.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 +1 -1
  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/screen.js.html +1 -1
  30. package/coverage/lcov-report/api/controllers/script.js.html +1 -1
  31. package/coverage/lcov-report/api/controllers/table/bulkFormula.js.html +1 -1
  32. package/coverage/lcov-report/api/controllers/table/external.js.html +1 -1
  33. package/coverage/lcov-report/api/controllers/table/index.html +1 -1
  34. package/coverage/lcov-report/api/controllers/table/index.js.html +1 -1
  35. package/coverage/lcov-report/api/controllers/templates.js.html +1 -1
  36. package/coverage/lcov-report/api/controllers/user.js.html +1 -1
  37. package/coverage/lcov-report/api/controllers/view/exporters.js.html +1 -1
  38. package/coverage/lcov-report/api/controllers/view/index.html +1 -1
  39. package/coverage/lcov-report/api/controllers/view/index.js.html +1 -1
  40. package/coverage/lcov-report/api/controllers/view/utils.js.html +1 -1
  41. package/coverage/lcov-report/api/controllers/view/viewBuilder.js.html +1 -1
  42. package/coverage/lcov-report/api/controllers/webhook.js.html +1 -1
  43. package/coverage/lcov-report/api/index.html +1 -1
  44. package/coverage/lcov-report/api/index.js.html +5 -5
  45. package/coverage/lcov-report/api/routes/analytics.js.html +1 -1
  46. package/coverage/lcov-report/api/routes/apikeys.js.html +1 -1
  47. package/coverage/lcov-report/api/routes/auth.js.html +1 -1
  48. package/coverage/lcov-report/api/routes/automation.js.html +1 -1
  49. package/coverage/lcov-report/api/routes/backup.js.html +1 -1
  50. package/coverage/lcov-report/api/routes/cloud.js.html +1 -1
  51. package/coverage/lcov-report/api/routes/component.js.html +1 -1
  52. package/coverage/lcov-report/api/routes/datasource.js.html +1 -1
  53. package/coverage/lcov-report/api/routes/deploy.js.html +1 -1
  54. package/coverage/lcov-report/api/routes/dev.js.html +1 -1
  55. package/coverage/lcov-report/api/routes/index.html +1 -1
  56. package/coverage/lcov-report/api/routes/integration.js.html +1 -1
  57. package/coverage/lcov-report/api/routes/layout.js.html +1 -1
  58. package/coverage/lcov-report/api/routes/metadata.js.html +1 -1
  59. package/coverage/lcov-report/api/routes/migrations.js.html +1 -1
  60. package/coverage/lcov-report/api/routes/permission.js.html +1 -1
  61. package/coverage/lcov-report/api/routes/query.js.html +1 -1
  62. package/coverage/lcov-report/api/routes/role.js.html +1 -1
  63. package/coverage/lcov-report/api/routes/routing.js.html +1 -1
  64. package/coverage/lcov-report/api/routes/screen.js.html +1 -1
  65. package/coverage/lcov-report/api/routes/script.js.html +1 -1
  66. package/coverage/lcov-report/api/routes/table.js.html +1 -1
  67. package/coverage/lcov-report/api/routes/templates.js.html +1 -1
  68. package/coverage/lcov-report/api/routes/user.js.html +1 -1
  69. package/coverage/lcov-report/api/routes/utils/index.html +1 -1
  70. package/coverage/lcov-report/api/routes/utils/validators.js.html +1 -1
  71. package/coverage/lcov-report/api/routes/view.js.html +1 -1
  72. package/coverage/lcov-report/api/routes/webhook.js.html +1 -1
  73. package/coverage/lcov-report/automations/actions.js.html +1 -1
  74. package/coverage/lcov-report/automations/automationUtils.js.html +1 -1
  75. package/coverage/lcov-report/automations/bullboard.js.html +1 -1
  76. package/coverage/lcov-report/automations/index.html +1 -1
  77. package/coverage/lcov-report/automations/index.js.html +1 -1
  78. package/coverage/lcov-report/automations/steps/bash.js.html +1 -1
  79. package/coverage/lcov-report/automations/steps/delay.js.html +1 -1
  80. package/coverage/lcov-report/automations/steps/discord.js.html +1 -1
  81. package/coverage/lcov-report/automations/steps/executeQuery.js.html +1 -1
  82. package/coverage/lcov-report/automations/steps/executeScript.js.html +1 -1
  83. package/coverage/lcov-report/automations/steps/filter.js.html +1 -1
  84. package/coverage/lcov-report/automations/steps/index.html +1 -1
  85. package/coverage/lcov-report/automations/steps/integromat.js.html +1 -1
  86. package/coverage/lcov-report/automations/steps/loop.js.html +1 -1
  87. package/coverage/lcov-report/automations/steps/outgoingWebhook.js.html +1 -1
  88. package/coverage/lcov-report/automations/steps/queryRows.js.html +1 -1
  89. package/coverage/lcov-report/automations/steps/sendSmtpEmail.js.html +1 -1
  90. package/coverage/lcov-report/automations/steps/serverLog.js.html +1 -1
  91. package/coverage/lcov-report/automations/steps/slack.js.html +1 -1
  92. package/coverage/lcov-report/automations/steps/updateRow.js.html +1 -1
  93. package/coverage/lcov-report/automations/steps/utils.js.html +1 -1
  94. package/coverage/lcov-report/automations/steps/zapier.js.html +1 -1
  95. package/coverage/lcov-report/automations/triggerInfo/app.js.html +1 -1
  96. package/coverage/lcov-report/automations/triggerInfo/cron.js.html +1 -1
  97. package/coverage/lcov-report/automations/triggerInfo/index.html +1 -1
  98. package/coverage/lcov-report/automations/triggerInfo/index.js.html +1 -1
  99. package/coverage/lcov-report/automations/triggerInfo/rowDeleted.js.html +1 -1
  100. package/coverage/lcov-report/automations/triggerInfo/rowSaved.js.html +1 -1
  101. package/coverage/lcov-report/automations/triggerInfo/rowUpdated.js.html +1 -1
  102. package/coverage/lcov-report/automations/triggerInfo/webhook.js.html +1 -1
  103. package/coverage/lcov-report/automations/triggers.js.html +8 -8
  104. package/coverage/lcov-report/constants/index.html +1 -1
  105. package/coverage/lcov-report/constants/index.js.html +1 -1
  106. package/coverage/lcov-report/constants/layouts.js.html +1 -1
  107. package/coverage/lcov-report/constants/screens.js.html +1 -1
  108. package/coverage/lcov-report/db/inMemoryView.js.html +1 -1
  109. package/coverage/lcov-report/db/index.html +1 -1
  110. package/coverage/lcov-report/db/index.js.html +1 -1
  111. package/coverage/lcov-report/db/linkedRows/LinkController.js.html +11 -11
  112. package/coverage/lcov-report/db/linkedRows/index.html +1 -1
  113. package/coverage/lcov-report/db/linkedRows/index.js.html +11 -11
  114. package/coverage/lcov-report/db/linkedRows/linkUtils.js.html +3 -3
  115. package/coverage/lcov-report/db/newid.js.html +2 -2
  116. package/coverage/lcov-report/db/utils.js.html +8 -8
  117. package/coverage/lcov-report/events/AutomationEmitter.js.html +1 -1
  118. package/coverage/lcov-report/events/index.html +1 -1
  119. package/coverage/lcov-report/events/index.js.html +2 -2
  120. package/coverage/lcov-report/events/utils.js.html +9 -9
  121. package/coverage/lcov-report/index.html +1 -1
  122. package/coverage/lcov-report/integrations/tests/TestConfiguration.js.html +1 -1
  123. package/coverage/lcov-report/integrations/tests/index.html +1 -1
  124. package/coverage/lcov-report/middleware/appInfo.js.html +1 -1
  125. package/coverage/lcov-report/middleware/builder.js.html +11 -11
  126. package/coverage/lcov-report/middleware/currentapp.js.html +33 -33
  127. package/coverage/lcov-report/middleware/index.html +1 -1
  128. package/coverage/lcov-report/middleware/joi-validator.js.html +1 -1
  129. package/coverage/lcov-report/middleware/publicApi.js.html +1 -1
  130. package/coverage/lcov-report/middleware/resourceId.js.html +7 -7
  131. package/coverage/lcov-report/middleware/selfhost.js.html +1 -1
  132. package/coverage/lcov-report/middleware/utils.js.html +2 -2
  133. package/coverage/lcov-report/threads/automation.js.html +1 -1
  134. package/coverage/lcov-report/threads/index.html +1 -1
  135. package/coverage/lcov-report/threads/query.js.html +1 -1
  136. package/coverage/lcov-report/threads/utils.js.html +1 -1
  137. package/coverage/lcov-report/utilities/budibaseDir.js.html +1 -1
  138. package/coverage/lcov-report/utilities/centralPath.js.html +1 -1
  139. package/coverage/lcov-report/utilities/csvParser.js.html +1 -1
  140. package/coverage/lcov-report/utilities/global.js.html +14 -14
  141. package/coverage/lcov-report/utilities/index.html +1 -1
  142. package/coverage/lcov-report/utilities/index.js.html +1 -1
  143. package/coverage/lcov-report/utilities/queue/inMemoryQueue.js.html +1 -1
  144. package/coverage/lcov-report/utilities/queue/index.html +1 -1
  145. package/coverage/lcov-report/utilities/routing/index.html +1 -1
  146. package/coverage/lcov-report/utilities/routing/index.js.html +1 -1
  147. package/coverage/lcov-report/utilities/rowProcessor/index.html +1 -1
  148. package/coverage/lcov-report/utilities/rowProcessor/index.js.html +38 -38
  149. package/coverage/lcov-report/utilities/rowProcessor/utils.js.html +10 -10
  150. package/coverage/lcov-report/utilities/scriptRunner.js.html +1 -1
  151. package/coverage/lcov-report/utilities/security.js.html +1 -1
  152. package/coverage/lcov-report/utilities/statusCodes.js.html +1 -1
  153. package/coverage/lcov-report/utilities/usageQuota/index.html +1 -1
  154. package/coverage/lcov-report/utilities/usageQuota/rows.js.html +1 -1
  155. package/coverage/lcov-report/utilities/usageQuota/usageQuoteReset.js.html +1 -1
  156. package/coverage/lcov-report/utilities/users.js.html +1 -1
  157. package/coverage/lcov-report/utilities/workerRequests.js.html +1 -1
  158. package/coverage/lcov.info +351 -351
  159. package/dist/api/controllers/application.js +24 -25
  160. package/dist/package.json +7 -7
  161. package/dist/tests/utilities/TestConfiguration.js +19 -10
  162. package/dist/tsconfig.build.tsbuildinfo +1 -1
  163. package/package.json +8 -8
  164. package/src/api/controllers/application.ts +13 -21
  165. package/src/api/routes/tests/row.spec.js +19 -19
  166. package/src/app.ts +0 -1
  167. package/src/tests/utilities/TestConfiguration.js +21 -10
@@ -19,7 +19,6 @@ const staticViews_1 = require("../../db/views/staticViews");
19
19
  const fileSystem_1 = require("../../utilities/fileSystem");
20
20
  const utils_1 = require("../../db/utils");
21
21
  const { BUILTIN_ROLE_IDS, AccessController, } = require("@budibase/backend-core/roles");
22
- const { processObject } = require("@budibase/string-templates");
23
22
  const { CacheKeys, bustCache } = require("@budibase/backend-core/cache");
24
23
  const { getAllApps, isDevAppID, getProdAppID, Replication, } = require("@budibase/backend-core/db");
25
24
  const constants_1 = require("../../constants");
@@ -31,17 +30,17 @@ const { getTenantId, isMultiTenant } = require("@budibase/backend-core/tenancy")
31
30
  const user_1 = require("./user");
32
31
  const { app: appCache } = require("@budibase/backend-core/cache");
33
32
  const utils_2 = require("../../automations/utils");
33
+ const backend_core_1 = require("@budibase/backend-core");
34
34
  const logging_1 = require("../../automations/logging");
35
- const { getAppDB, getProdAppDB, updateAppId, doInAppContext, } = require("@budibase/backend-core/context");
36
35
  const rows_1 = require("../../utilities/usageQuota/rows");
37
36
  const pro_1 = require("@budibase/pro");
38
- const backend_core_1 = require("@budibase/backend-core");
37
+ const backend_core_2 = require("@budibase/backend-core");
39
38
  const types_1 = require("@budibase/types");
40
39
  const URL_REGEX_SLASH = /\/|\\/g;
41
40
  // utility function, need to do away with this
42
41
  function getLayouts() {
43
42
  return __awaiter(this, void 0, void 0, function* () {
44
- const db = getAppDB();
43
+ const db = backend_core_1.context.getAppDB();
45
44
  return (yield db.allDocs((0, utils_1.getLayoutParams)(null, {
46
45
  include_docs: true,
47
46
  }))).rows.map((row) => row.doc);
@@ -49,7 +48,7 @@ function getLayouts() {
49
48
  }
50
49
  function getScreens() {
51
50
  return __awaiter(this, void 0, void 0, function* () {
52
- const db = getAppDB();
51
+ const db = backend_core_1.context.getAppDB();
53
52
  return (yield db.allDocs((0, utils_1.getScreenParams)(null, {
54
53
  include_docs: true,
55
54
  }))).rows.map((row) => row.doc);
@@ -102,8 +101,8 @@ function createInstance(template) {
102
101
  const tenantId = isMultiTenant() ? getTenantId() : null;
103
102
  const baseAppId = (0, utils_1.generateAppID)(tenantId);
104
103
  const appId = (0, utils_1.generateDevAppID)(baseAppId);
105
- yield updateAppId(appId);
106
- const db = getAppDB();
104
+ yield backend_core_1.context.updateAppId(appId);
105
+ const db = backend_core_1.context.getAppDB();
107
106
  yield db.put({
108
107
  _id: "_design/database",
109
108
  // view collation information, read before writing any complex views:
@@ -174,7 +173,7 @@ const fetchAppDefinition = (ctx) => __awaiter(void 0, void 0, void 0, function*
174
173
  });
175
174
  exports.fetchAppDefinition = fetchAppDefinition;
176
175
  const fetchAppPackage = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
177
- const db = getAppDB();
176
+ const db = backend_core_1.context.getAppDB();
178
177
  const application = yield db.get(utils_1.DocumentTypes.APP_METADATA);
179
178
  const layouts = yield getLayouts();
180
179
  let screens = yield getScreens();
@@ -209,7 +208,7 @@ const performAppCreate = (ctx) => __awaiter(void 0, void 0, void 0, function* ()
209
208
  }
210
209
  const instance = yield createInstance(instanceConfig);
211
210
  const appId = instance._id;
212
- const db = getAppDB();
211
+ const db = backend_core_1.context.getAppDB();
213
212
  let _rev;
214
213
  try {
215
214
  // if template there will be an existing doc
@@ -267,25 +266,25 @@ const creationEvents = (request, app) => __awaiter(void 0, void 0, void 0, funct
267
266
  if (body.useTemplate === "true") {
268
267
  // from template
269
268
  if (body.templateKey && body.templateKey !== "undefined") {
270
- creationFns.push(a => backend_core_1.events.app.templateImported(a, body.templateKey));
269
+ creationFns.push(a => backend_core_2.events.app.templateImported(a, body.templateKey));
271
270
  }
272
271
  // from file
273
272
  else if ((_a = request.files) === null || _a === void 0 ? void 0 : _a.templateFile) {
274
- creationFns.push(a => backend_core_1.events.app.fileImported(a));
273
+ creationFns.push(a => backend_core_2.events.app.fileImported(a));
275
274
  }
276
275
  // unknown
277
276
  else {
278
277
  console.error("Could not determine template creation event");
279
278
  }
280
279
  }
281
- creationFns.push(a => backend_core_1.events.app.created(a));
280
+ creationFns.push(a => backend_core_2.events.app.created(a));
282
281
  for (let fn of creationFns) {
283
282
  yield fn(app);
284
283
  }
285
284
  });
286
285
  const appPostCreate = (ctx, app) => __awaiter(void 0, void 0, void 0, function* () {
287
286
  const tenantId = getTenantId();
288
- yield backend_core_1.migrations.backPopulateMigrations({
287
+ yield backend_core_2.migrations.backPopulateMigrations({
289
288
  type: types_1.MigrationType.APP,
290
289
  tenantId,
291
290
  appId: app.appId,
@@ -300,7 +299,7 @@ const appPostCreate = (ctx, app) => __awaiter(void 0, void 0, void 0, function*
300
299
  yield pro_1.quotas.addRows(rowCount);
301
300
  }
302
301
  catch (err) {
303
- if (err.code && err.code === backend_core_1.errors.codes.USAGE_LIMIT_EXCEEDED) {
302
+ if (err.code && err.code === backend_core_2.errors.codes.USAGE_LIMIT_EXCEEDED) {
304
303
  // this import resulted in row usage exceeding the quota
305
304
  // delete the app
306
305
  // skip pre and post steps as no rows have been added to quotas yet
@@ -335,14 +334,14 @@ const update = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
335
334
  ctx.request.body.url = url;
336
335
  }
337
336
  const app = yield updateAppPackage(ctx.request.body, ctx.params.appId);
338
- yield backend_core_1.events.app.updated(app);
337
+ yield backend_core_2.events.app.updated(app);
339
338
  ctx.status = 200;
340
339
  ctx.body = app;
341
340
  });
342
341
  exports.update = update;
343
342
  const updateClient = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
344
343
  // Get current app version
345
- const db = getAppDB();
344
+ const db = backend_core_1.context.getAppDB();
346
345
  const application = yield db.get(utils_1.DocumentTypes.APP_METADATA);
347
346
  const currentVersion = application.version;
348
347
  // Update client library and manifest
@@ -357,14 +356,14 @@ const updateClient = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
357
356
  revertableVersion: currentVersion,
358
357
  };
359
358
  const app = yield updateAppPackage(appPackageUpdates, ctx.params.appId);
360
- yield backend_core_1.events.app.versionUpdated(app, currentVersion, updatedToVersion);
359
+ yield backend_core_2.events.app.versionUpdated(app, currentVersion, updatedToVersion);
361
360
  ctx.status = 200;
362
361
  ctx.body = app;
363
362
  });
364
363
  exports.updateClient = updateClient;
365
364
  const revertClient = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
366
365
  // Check app can be reverted
367
- const db = getAppDB();
366
+ const db = backend_core_1.context.getAppDB();
368
367
  const application = yield db.get(utils_1.DocumentTypes.APP_METADATA);
369
368
  if (!application.revertableVersion) {
370
369
  ctx.throw(400, "There is no version to revert to");
@@ -381,7 +380,7 @@ const revertClient = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
381
380
  revertableVersion: null,
382
381
  };
383
382
  const app = yield updateAppPackage(appPackageUpdates, ctx.params.appId);
384
- yield backend_core_1.events.app.versionReverted(app, currentVersion, revertedToVersion);
383
+ yield backend_core_2.events.app.versionReverted(app, currentVersion, revertedToVersion);
385
384
  ctx.status = 200;
386
385
  ctx.body = app;
387
386
  });
@@ -392,16 +391,16 @@ const destroyApp = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
392
391
  if (isUnpublish) {
393
392
  appId = getProdAppID(appId);
394
393
  }
395
- const db = isUnpublish ? getProdAppDB() : getAppDB();
394
+ const db = isUnpublish ? backend_core_1.context.getProdAppDB() : backend_core_1.context.getAppDB();
396
395
  const app = yield db.get(utils_1.DocumentTypes.APP_METADATA);
397
396
  const result = yield db.destroy();
398
397
  if (isUnpublish) {
399
398
  yield pro_1.quotas.removePublishedApp();
400
- yield backend_core_1.events.app.unpublished(app);
399
+ yield backend_core_2.events.app.unpublished(app);
401
400
  }
402
401
  else {
403
402
  yield pro_1.quotas.removeApp();
404
- yield backend_core_1.events.app.deleted(app);
403
+ yield backend_core_2.events.app.deleted(app);
405
404
  }
406
405
  /* istanbul ignore next */
407
406
  if (!environment_1.default.isTest() && !isUnpublish) {
@@ -452,7 +451,7 @@ const sync = (ctx, next) => __awaiter(void 0, void 0, void 0, function* () {
452
451
  const prodAppId = getProdAppID(appId);
453
452
  try {
454
453
  // specific case, want to make sure setup is skipped
455
- const prodDb = getProdAppDB({ skip_setup: true });
454
+ const prodDb = backend_core_1.context.getProdAppDB({ skip_setup: true });
456
455
  const info = yield prodDb.info();
457
456
  if (info.error)
458
457
  throw info.error;
@@ -496,8 +495,8 @@ const sync = (ctx, next) => __awaiter(void 0, void 0, void 0, function* () {
496
495
  });
497
496
  exports.sync = sync;
498
497
  const updateAppPackage = (appPackage, appId) => __awaiter(void 0, void 0, void 0, function* () {
499
- return doInAppContext(appId, () => __awaiter(void 0, void 0, void 0, function* () {
500
- const db = getAppDB();
498
+ return backend_core_1.context.doInAppContext(appId, () => __awaiter(void 0, void 0, void 0, function* () {
499
+ const db = backend_core_1.context.getAppDB();
501
500
  const application = yield db.get(utils_1.DocumentTypes.APP_METADATA);
502
501
  const newAppPackage = Object.assign(Object.assign({}, application), appPackage);
503
502
  if (appPackage._rev !== application._rev) {
package/dist/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@budibase/server",
3
3
  "email": "hi@budibase.com",
4
- "version": "1.1.6",
4
+ "version": "1.1.9",
5
5
  "description": "Budibase Web Server",
6
6
  "main": "src/index.ts",
7
7
  "repository": {
@@ -77,10 +77,11 @@
77
77
  "license": "GPL-3.0",
78
78
  "dependencies": {
79
79
  "@apidevtools/swagger-parser": "10.0.3",
80
- "@budibase/backend-core": "^1.1.6",
81
- "@budibase/client": "^1.1.6",
82
- "@budibase/pro": "1.1.6",
83
- "@budibase/string-templates": "^1.1.6",
80
+ "@budibase/backend-core": "^1.1.9",
81
+ "@budibase/client": "^1.1.9",
82
+ "@budibase/pro": "1.1.9",
83
+ "@budibase/string-templates": "^1.1.9",
84
+ "@budibase/types": "^1.1.9",
84
85
  "@bull-board/api": "3.7.0",
85
86
  "@bull-board/koa": "3.9.4",
86
87
  "@elastic/elasticsearch": "7.10.0",
@@ -117,7 +118,7 @@
117
118
  "koa-send": "5.0.0",
118
119
  "koa-session": "5.12.0",
119
120
  "koa-static": "5.0.0",
120
- "koa2-ratelimit": "1.1.0",
121
+ "koa2-ratelimit": "1.1.1",
121
122
  "lodash": "4.17.21",
122
123
  "memorystream": "0.3.1",
123
124
  "mongodb": "3.6.3",
@@ -151,7 +152,6 @@
151
152
  "@babel/core": "7.17.4",
152
153
  "@babel/preset-env": "7.16.11",
153
154
  "@budibase/standard-components": "^0.9.139",
154
- "@budibase/types": "^1.1.6",
155
155
  "@jest/test-sequencer": "24.9.0",
156
156
  "@types/apidoc": "0.50.0",
157
157
  "@types/bson": "4.2.0",
@@ -97,22 +97,31 @@ class TestConfiguration {
97
97
  cleanup(this.allApps.map(app => app.appId));
98
98
  }
99
99
  // UTILS
100
- _req(config, params, controlFunc) {
100
+ _req(body, params, controlFunc, opts = { prodApp: false }) {
101
101
  return __awaiter(this, void 0, void 0, function* () {
102
+ // create a fake request ctx
102
103
  const request = {};
104
+ // set the app id
105
+ let appId;
106
+ if (opts.prodApp) {
107
+ appId = this.prodAppId;
108
+ }
109
+ else {
110
+ appId = this.appId;
111
+ }
112
+ request.appId = appId;
103
113
  // fake cookies, we don't need them
104
114
  request.cookies = { set: () => { }, get: () => { } };
105
115
  request.config = { jwtSecret: env.JWT_SECRET };
106
- request.appId = this.appId;
107
- request.user = { appId: this.appId, tenantId: TENANT_ID };
116
+ request.user = { appId, tenantId: TENANT_ID };
108
117
  request.query = {};
109
118
  request.request = {
110
- body: config,
119
+ body,
111
120
  };
112
- return this.doInContext(this.appId, () => __awaiter(this, void 0, void 0, function* () {
113
- if (params) {
114
- request.params = params;
115
- }
121
+ if (params) {
122
+ request.params = params;
123
+ }
124
+ return this.doInContext(appId, () => __awaiter(this, void 0, void 0, function* () {
116
125
  yield controlFunc(request);
117
126
  return request.body;
118
127
  }));
@@ -280,7 +289,6 @@ class TestConfiguration {
280
289
  yield context.updateAppId(this.appId);
281
290
  // create production app
282
291
  this.prodApp = yield this.deploy();
283
- this.prodAppId = this.prodApp.appId;
284
292
  this.allApps.push(this.prodApp);
285
293
  this.allApps.push(this.app);
286
294
  return this.app;
@@ -290,8 +298,9 @@ class TestConfiguration {
290
298
  return __awaiter(this, void 0, void 0, function* () {
291
299
  yield this._req(null, null, controllers.deploy.deployApp);
292
300
  const prodAppId = this.getAppId().replace("_dev", "");
301
+ this.prodAppId = prodAppId;
293
302
  return context.doInAppContext(prodAppId, () => __awaiter(this, void 0, void 0, function* () {
294
- const appPackage = yield this._req(null, { appId: prodAppId }, controllers.app.fetchAppPackage);
303
+ const appPackage = yield this._req(null, { appId: prodAppId }, controllers.app.fetchAppPackage, { prodApp: true });
295
304
  return appPackage.application;
296
305
  }));
297
306
  });