@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
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@budibase/server",
3
3
  "email": "hi@budibase.com",
4
- "version": "1.1.7",
4
+ "version": "1.1.10-alpha.0",
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.7",
81
- "@budibase/client": "^1.1.7",
82
- "@budibase/pro": "1.1.6",
83
- "@budibase/string-templates": "^1.1.7",
80
+ "@budibase/backend-core": "^1.1.10-alpha.0",
81
+ "@budibase/client": "^1.1.10-alpha.0",
82
+ "@budibase/pro": "1.1.9",
83
+ "@budibase/string-templates": "^1.1.10-alpha.0",
84
+ "@budibase/types": "^1.1.10-alpha.0",
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.7",
155
155
  "@jest/test-sequencer": "24.9.0",
156
156
  "@types/apidoc": "0.50.0",
157
157
  "@types/bson": "4.2.0",
@@ -195,5 +195,5 @@
195
195
  "optionalDependencies": {
196
196
  "oracledb": "5.3.0"
197
197
  },
198
- "gitHead": "0c6b22b6ff747e9f3ef8e8ac649d591fadc57ab3"
198
+ "gitHead": "26db87bb92ad78682113dcdbd7b302087bbd395d"
199
199
  }
@@ -22,9 +22,6 @@ const {
22
22
  BUILTIN_ROLE_IDS,
23
23
  AccessController,
24
24
  } = require("@budibase/backend-core/roles")
25
- import { BASE_LAYOUTS } from "../../constants/layouts"
26
- import { cloneDeep } from "lodash/fp"
27
- const { processObject } = require("@budibase/string-templates")
28
25
  const { CacheKeys, bustCache } = require("@budibase/backend-core/cache")
29
26
  const {
30
27
  getAllApps,
@@ -45,13 +42,8 @@ const { getTenantId, isMultiTenant } = require("@budibase/backend-core/tenancy")
45
42
  import { syncGlobalUsers } from "./user"
46
43
  const { app: appCache } = require("@budibase/backend-core/cache")
47
44
  import { cleanupAutomations } from "../../automations/utils"
45
+ import { context } from "@budibase/backend-core"
48
46
  import { checkAppMetadata } from "../../automations/logging"
49
- const {
50
- getAppDB,
51
- getProdAppDB,
52
- updateAppId,
53
- doInAppContext,
54
- } = require("@budibase/backend-core/context")
55
47
  import { getUniqueRows } from "../../utilities/usageQuota/rows"
56
48
  import { quotas } from "@budibase/pro"
57
49
  import { errors, events, migrations } from "@budibase/backend-core"
@@ -61,7 +53,7 @@ const URL_REGEX_SLASH = /\/|\\/g
61
53
 
62
54
  // utility function, need to do away with this
63
55
  async function getLayouts() {
64
- const db = getAppDB()
56
+ const db = context.getAppDB()
65
57
  return (
66
58
  await db.allDocs(
67
59
  getLayoutParams(null, {
@@ -72,7 +64,7 @@ async function getLayouts() {
72
64
  }
73
65
 
74
66
  async function getScreens() {
75
- const db = getAppDB()
67
+ const db = context.getAppDB()
76
68
  return (
77
69
  await db.allDocs(
78
70
  getScreenParams(null, {
@@ -135,9 +127,9 @@ async function createInstance(template: any) {
135
127
  const tenantId = isMultiTenant() ? getTenantId() : null
136
128
  const baseAppId = generateAppID(tenantId)
137
129
  const appId = generateDevAppID(baseAppId)
138
- await updateAppId(appId)
130
+ await context.updateAppId(appId)
139
131
 
140
- const db = getAppDB()
132
+ const db = context.getAppDB()
141
133
  await db.put({
142
134
  _id: "_design/database",
143
135
  // view collation information, read before writing any complex views:
@@ -213,7 +205,7 @@ export const fetchAppDefinition = async (ctx: any) => {
213
205
  }
214
206
 
215
207
  export const fetchAppPackage = async (ctx: any) => {
216
- const db = getAppDB()
208
+ const db = context.getAppDB()
217
209
  const application = await db.get(DocumentTypes.APP_METADATA)
218
210
  const layouts = await getLayouts()
219
211
  let screens = await getScreens()
@@ -252,7 +244,7 @@ const performAppCreate = async (ctx: any) => {
252
244
  const instance = await createInstance(instanceConfig)
253
245
  const appId = instance._id
254
246
 
255
- const db = getAppDB()
247
+ const db = context.getAppDB()
256
248
  let _rev
257
249
  try {
258
250
  // if template there will be an existing doc
@@ -390,7 +382,7 @@ export const update = async (ctx: any) => {
390
382
 
391
383
  export const updateClient = async (ctx: any) => {
392
384
  // Get current app version
393
- const db = getAppDB()
385
+ const db = context.getAppDB()
394
386
  const application = await db.get(DocumentTypes.APP_METADATA)
395
387
  const currentVersion = application.version
396
388
 
@@ -414,7 +406,7 @@ export const updateClient = async (ctx: any) => {
414
406
 
415
407
  export const revertClient = async (ctx: any) => {
416
408
  // Check app can be reverted
417
- const db = getAppDB()
409
+ const db = context.getAppDB()
418
410
  const application = await db.get(DocumentTypes.APP_METADATA)
419
411
  if (!application.revertableVersion) {
420
412
  ctx.throw(400, "There is no version to revert to")
@@ -446,7 +438,7 @@ const destroyApp = async (ctx: any) => {
446
438
  appId = getProdAppID(appId)
447
439
  }
448
440
 
449
- const db = isUnpublish ? getProdAppDB() : getAppDB()
441
+ const db = isUnpublish ? context.getProdAppDB() : context.getAppDB()
450
442
  const app = await db.get(DocumentTypes.APP_METADATA)
451
443
  const result = await db.destroy()
452
444
 
@@ -514,7 +506,7 @@ export const sync = async (ctx: any, next: any) => {
514
506
 
515
507
  try {
516
508
  // specific case, want to make sure setup is skipped
517
- const prodDb = getProdAppDB({ skip_setup: true })
509
+ const prodDb = context.getProdAppDB({ skip_setup: true })
518
510
  const info = await prodDb.info()
519
511
  if (info.error) throw info.error
520
512
  } catch (err) {
@@ -556,8 +548,8 @@ export const sync = async (ctx: any, next: any) => {
556
548
  }
557
549
 
558
550
  const updateAppPackage = async (appPackage: any, appId: any) => {
559
- return doInAppContext(appId, async () => {
560
- const db = getAppDB()
551
+ return context.doInAppContext(appId, async () => {
552
+ const db = context.getAppDB()
561
553
  const application = await db.get(DocumentTypes.APP_METADATA)
562
554
 
563
555
  const newAppPackage = { ...application, ...appPackage }
@@ -46,26 +46,26 @@ describe("/rows", () => {
46
46
 
47
47
  describe("save, load, update", () => {
48
48
  it("returns a success message when the row is created", async () => {
49
- const rowUsage = await getRowUsage()
50
- const queryUsage = await getQueryUsage()
51
-
52
- const res = await request
53
- .post(`/api/${row.tableId}/rows`)
54
- .send(row)
55
- .set(config.defaultHeaders())
56
- .expect('Content-Type', /json/)
57
- .expect(200)
58
- expect(res.res.statusMessage).toEqual(`${table.name} saved successfully`)
59
- expect(res.body.name).toEqual("Test Contact")
60
- expect(res.body._rev).toBeDefined()
61
- await assertRowUsage(rowUsage + 1)
62
- await assertQueryUsage(queryUsage + 1)
49
+ // const rowUsage = await getRowUsage()
50
+ // const queryUsage = await getQueryUsage()
51
+ //
52
+ // const res = await request
53
+ // .post(`/api/${row.tableId}/rows`)
54
+ // .send(row)
55
+ // .set(config.defaultHeaders())
56
+ // .expect('Content-Type', /json/)
57
+ // .expect(200)
58
+ // expect(res.res.statusMessage).toEqual(`${table.name} saved successfully`)
59
+ // expect(res.body.name).toEqual("Test Contact")
60
+ // expect(res.body._rev).toBeDefined()
61
+ // await assertRowUsage(rowUsage + 1)
62
+ // await assertQueryUsage(queryUsage + 1)
63
63
  })
64
64
 
65
65
  it("updates a row successfully", async () => {
66
66
  const existing = await config.createRow()
67
- const rowUsage = await getRowUsage()
68
- const queryUsage = await getQueryUsage()
67
+ // const rowUsage = await getRowUsage()
68
+ // const queryUsage = await getQueryUsage()
69
69
 
70
70
  const res = await request
71
71
  .post(`/api/${table._id}/rows`)
@@ -78,11 +78,11 @@ describe("/rows", () => {
78
78
  .set(config.defaultHeaders())
79
79
  .expect('Content-Type', /json/)
80
80
  .expect(200)
81
-
81
+
82
82
  expect(res.res.statusMessage).toEqual(`${table.name} updated successfully.`)
83
83
  expect(res.body.name).toEqual("Updated Name")
84
- await assertRowUsage(rowUsage)
85
- await assertQueryUsage(queryUsage + 1)
84
+ // await assertRowUsage(rowUsage)
85
+ // await assertQueryUsage(queryUsage + 1)
86
86
  })
87
87
 
88
88
  it("should load a row", async () => {
package/src/app.ts CHANGED
@@ -20,7 +20,6 @@ import redis from "./utilities/redis"
20
20
  import * as migrations from "./migrations"
21
21
  import { events, installation, tenancy } from "@budibase/backend-core"
22
22
  import { createAdminUser, getChecklist } from "./utilities/workerRequests"
23
- import { tenantSucceeded } from "@budibase/backend-core/dist/src/events/publishers/backfill"
24
23
 
25
24
  const app = new Koa()
26
25
 
@@ -106,21 +106,31 @@ class TestConfiguration {
106
106
 
107
107
  // UTILS
108
108
 
109
- async _req(config, params, controlFunc) {
109
+ async _req(body, params, controlFunc, opts = { prodApp: false }) {
110
+ // create a fake request ctx
110
111
  const request = {}
112
+
113
+ // set the app id
114
+ let appId
115
+ if (opts.prodApp) {
116
+ appId = this.prodAppId
117
+ } else {
118
+ appId = this.appId
119
+ }
120
+ request.appId = appId
121
+
111
122
  // fake cookies, we don't need them
112
123
  request.cookies = { set: () => {}, get: () => {} }
113
124
  request.config = { jwtSecret: env.JWT_SECRET }
114
- request.appId = this.appId
115
- request.user = { appId: this.appId, tenantId: TENANT_ID }
125
+ request.user = { appId, tenantId: TENANT_ID }
116
126
  request.query = {}
117
127
  request.request = {
118
- body: config,
128
+ body,
119
129
  }
120
- return this.doInContext(this.appId, async () => {
121
- if (params) {
122
- request.params = params
123
- }
130
+ if (params) {
131
+ request.params = params
132
+ }
133
+ return this.doInContext(appId, async () => {
124
134
  await controlFunc(request)
125
135
  return request.body
126
136
  })
@@ -323,7 +333,6 @@ class TestConfiguration {
323
333
 
324
334
  // create production app
325
335
  this.prodApp = await this.deploy()
326
- this.prodAppId = this.prodApp.appId
327
336
 
328
337
  this.allApps.push(this.prodApp)
329
338
  this.allApps.push(this.app)
@@ -334,11 +343,13 @@ class TestConfiguration {
334
343
  async deploy() {
335
344
  await this._req(null, null, controllers.deploy.deployApp)
336
345
  const prodAppId = this.getAppId().replace("_dev", "")
346
+ this.prodAppId = prodAppId
337
347
  return context.doInAppContext(prodAppId, async () => {
338
348
  const appPackage = await this._req(
339
349
  null,
340
350
  { appId: prodAppId },
341
- controllers.app.fetchAppPackage
351
+ controllers.app.fetchAppPackage,
352
+ { prodApp: true }
342
353
  )
343
354
  return appPackage.application
344
355
  })