@budibase/server 1.1.8 → 1.1.10-alpha.1
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.
- package/builder/assets/{index.df5b8162.js → index.fa1df184.js} +107 -107
- package/builder/index.html +1 -1
- package/coverage/clover.xml +198 -198
- package/coverage/coverage-final.json +19 -19
- package/coverage/lcov-report/api/controllers/apikeys.js.html +1 -1
- package/coverage/lcov-report/api/controllers/auth.js.html +1 -1
- package/coverage/lcov-report/api/controllers/automation.js.html +1 -1
- package/coverage/lcov-report/api/controllers/backup.js.html +1 -1
- package/coverage/lcov-report/api/controllers/cloud.js.html +1 -1
- package/coverage/lcov-report/api/controllers/component.js.html +1 -1
- package/coverage/lcov-report/api/controllers/datasource.js.html +1 -1
- package/coverage/lcov-report/api/controllers/dev.js.html +1 -1
- package/coverage/lcov-report/api/controllers/index.html +1 -1
- package/coverage/lcov-report/api/controllers/integration.js.html +1 -1
- package/coverage/lcov-report/api/controllers/layout.js.html +1 -1
- package/coverage/lcov-report/api/controllers/metadata.js.html +1 -1
- package/coverage/lcov-report/api/controllers/migrations.js.html +1 -1
- package/coverage/lcov-report/api/controllers/permission.js.html +1 -1
- package/coverage/lcov-report/api/controllers/query/index.html +1 -1
- package/coverage/lcov-report/api/controllers/query/validation.js.html +1 -1
- package/coverage/lcov-report/api/controllers/role.js.html +1 -1
- package/coverage/lcov-report/api/controllers/routing.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/external.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/index.html +1 -1
- package/coverage/lcov-report/api/controllers/row/internal.js.html +12 -12
- package/coverage/lcov-report/api/controllers/row/internalSearch.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/staticFormula.js.html +15 -15
- package/coverage/lcov-report/api/controllers/row/utils.js.html +13 -13
- package/coverage/lcov-report/api/controllers/screen.js.html +1 -1
- package/coverage/lcov-report/api/controllers/script.js.html +1 -1
- package/coverage/lcov-report/api/controllers/table/bulkFormula.js.html +1 -1
- package/coverage/lcov-report/api/controllers/table/external.js.html +1 -1
- package/coverage/lcov-report/api/controllers/table/index.html +1 -1
- package/coverage/lcov-report/api/controllers/table/index.js.html +1 -1
- package/coverage/lcov-report/api/controllers/templates.js.html +1 -1
- package/coverage/lcov-report/api/controllers/user.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/exporters.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/index.html +1 -1
- package/coverage/lcov-report/api/controllers/view/index.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/utils.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/viewBuilder.js.html +1 -1
- package/coverage/lcov-report/api/controllers/webhook.js.html +1 -1
- package/coverage/lcov-report/api/index.html +1 -1
- package/coverage/lcov-report/api/index.js.html +5 -5
- package/coverage/lcov-report/api/routes/analytics.js.html +1 -1
- package/coverage/lcov-report/api/routes/apikeys.js.html +1 -1
- package/coverage/lcov-report/api/routes/auth.js.html +1 -1
- package/coverage/lcov-report/api/routes/automation.js.html +1 -1
- package/coverage/lcov-report/api/routes/backup.js.html +1 -1
- package/coverage/lcov-report/api/routes/cloud.js.html +1 -1
- package/coverage/lcov-report/api/routes/component.js.html +1 -1
- package/coverage/lcov-report/api/routes/datasource.js.html +1 -1
- package/coverage/lcov-report/api/routes/deploy.js.html +1 -1
- package/coverage/lcov-report/api/routes/dev.js.html +1 -1
- package/coverage/lcov-report/api/routes/index.html +1 -1
- package/coverage/lcov-report/api/routes/integration.js.html +1 -1
- package/coverage/lcov-report/api/routes/layout.js.html +1 -1
- package/coverage/lcov-report/api/routes/metadata.js.html +1 -1
- package/coverage/lcov-report/api/routes/migrations.js.html +1 -1
- package/coverage/lcov-report/api/routes/permission.js.html +1 -1
- package/coverage/lcov-report/api/routes/query.js.html +1 -1
- package/coverage/lcov-report/api/routes/role.js.html +1 -1
- package/coverage/lcov-report/api/routes/routing.js.html +1 -1
- package/coverage/lcov-report/api/routes/screen.js.html +1 -1
- package/coverage/lcov-report/api/routes/script.js.html +1 -1
- package/coverage/lcov-report/api/routes/table.js.html +1 -1
- package/coverage/lcov-report/api/routes/templates.js.html +1 -1
- package/coverage/lcov-report/api/routes/user.js.html +1 -1
- package/coverage/lcov-report/api/routes/utils/index.html +1 -1
- package/coverage/lcov-report/api/routes/utils/validators.js.html +1 -1
- package/coverage/lcov-report/api/routes/view.js.html +1 -1
- package/coverage/lcov-report/api/routes/webhook.js.html +1 -1
- package/coverage/lcov-report/automations/actions.js.html +1 -1
- package/coverage/lcov-report/automations/automationUtils.js.html +1 -1
- package/coverage/lcov-report/automations/bullboard.js.html +1 -1
- package/coverage/lcov-report/automations/index.html +1 -1
- package/coverage/lcov-report/automations/index.js.html +1 -1
- package/coverage/lcov-report/automations/steps/bash.js.html +1 -1
- package/coverage/lcov-report/automations/steps/delay.js.html +1 -1
- package/coverage/lcov-report/automations/steps/discord.js.html +1 -1
- package/coverage/lcov-report/automations/steps/executeQuery.js.html +1 -1
- package/coverage/lcov-report/automations/steps/executeScript.js.html +1 -1
- package/coverage/lcov-report/automations/steps/filter.js.html +1 -1
- package/coverage/lcov-report/automations/steps/index.html +1 -1
- package/coverage/lcov-report/automations/steps/integromat.js.html +1 -1
- package/coverage/lcov-report/automations/steps/loop.js.html +1 -1
- package/coverage/lcov-report/automations/steps/outgoingWebhook.js.html +1 -1
- package/coverage/lcov-report/automations/steps/queryRows.js.html +1 -1
- package/coverage/lcov-report/automations/steps/sendSmtpEmail.js.html +1 -1
- package/coverage/lcov-report/automations/steps/serverLog.js.html +1 -1
- package/coverage/lcov-report/automations/steps/slack.js.html +1 -1
- package/coverage/lcov-report/automations/steps/updateRow.js.html +1 -1
- package/coverage/lcov-report/automations/steps/utils.js.html +1 -1
- package/coverage/lcov-report/automations/steps/zapier.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/app.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/cron.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/index.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/index.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/rowDeleted.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/rowSaved.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/rowUpdated.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/webhook.js.html +1 -1
- package/coverage/lcov-report/automations/triggers.js.html +8 -8
- package/coverage/lcov-report/constants/index.html +1 -1
- package/coverage/lcov-report/constants/index.js.html +1 -1
- package/coverage/lcov-report/constants/layouts.js.html +1 -1
- package/coverage/lcov-report/constants/screens.js.html +1 -1
- package/coverage/lcov-report/db/inMemoryView.js.html +1 -1
- package/coverage/lcov-report/db/index.html +1 -1
- package/coverage/lcov-report/db/index.js.html +1 -1
- package/coverage/lcov-report/db/linkedRows/LinkController.js.html +11 -11
- package/coverage/lcov-report/db/linkedRows/index.html +1 -1
- package/coverage/lcov-report/db/linkedRows/index.js.html +11 -11
- package/coverage/lcov-report/db/linkedRows/linkUtils.js.html +3 -3
- package/coverage/lcov-report/db/newid.js.html +2 -2
- package/coverage/lcov-report/db/utils.js.html +8 -8
- package/coverage/lcov-report/events/AutomationEmitter.js.html +1 -1
- package/coverage/lcov-report/events/index.html +1 -1
- package/coverage/lcov-report/events/index.js.html +2 -2
- package/coverage/lcov-report/events/utils.js.html +9 -9
- package/coverage/lcov-report/index.html +1 -1
- package/coverage/lcov-report/integrations/tests/TestConfiguration.js.html +1 -1
- package/coverage/lcov-report/integrations/tests/index.html +1 -1
- package/coverage/lcov-report/middleware/appInfo.js.html +1 -1
- package/coverage/lcov-report/middleware/builder.js.html +11 -11
- package/coverage/lcov-report/middleware/currentapp.js.html +33 -33
- package/coverage/lcov-report/middleware/index.html +1 -1
- package/coverage/lcov-report/middleware/joi-validator.js.html +1 -1
- package/coverage/lcov-report/middleware/publicApi.js.html +1 -1
- package/coverage/lcov-report/middleware/resourceId.js.html +7 -7
- package/coverage/lcov-report/middleware/selfhost.js.html +1 -1
- package/coverage/lcov-report/middleware/utils.js.html +2 -2
- package/coverage/lcov-report/threads/automation.js.html +1 -1
- package/coverage/lcov-report/threads/index.html +1 -1
- package/coverage/lcov-report/threads/query.js.html +1 -1
- package/coverage/lcov-report/threads/utils.js.html +1 -1
- package/coverage/lcov-report/utilities/budibaseDir.js.html +1 -1
- package/coverage/lcov-report/utilities/centralPath.js.html +1 -1
- package/coverage/lcov-report/utilities/csvParser.js.html +1 -1
- package/coverage/lcov-report/utilities/global.js.html +14 -14
- package/coverage/lcov-report/utilities/index.html +1 -1
- package/coverage/lcov-report/utilities/index.js.html +1 -1
- package/coverage/lcov-report/utilities/queue/inMemoryQueue.js.html +1 -1
- package/coverage/lcov-report/utilities/queue/index.html +1 -1
- package/coverage/lcov-report/utilities/routing/index.html +1 -1
- package/coverage/lcov-report/utilities/routing/index.js.html +1 -1
- package/coverage/lcov-report/utilities/rowProcessor/index.html +1 -1
- package/coverage/lcov-report/utilities/rowProcessor/index.js.html +38 -38
- package/coverage/lcov-report/utilities/rowProcessor/utils.js.html +10 -10
- package/coverage/lcov-report/utilities/scriptRunner.js.html +1 -1
- package/coverage/lcov-report/utilities/security.js.html +1 -1
- package/coverage/lcov-report/utilities/statusCodes.js.html +1 -1
- package/coverage/lcov-report/utilities/usageQuota/index.html +1 -1
- package/coverage/lcov-report/utilities/usageQuota/rows.js.html +1 -1
- package/coverage/lcov-report/utilities/usageQuota/usageQuoteReset.js.html +1 -1
- package/coverage/lcov-report/utilities/users.js.html +1 -1
- package/coverage/lcov-report/utilities/workerRequests.js.html +1 -1
- package/coverage/lcov.info +351 -351
- package/dist/api/controllers/application.js +24 -25
- package/dist/package.json +7 -7
- package/dist/tests/utilities/TestConfiguration.js +19 -10
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +8 -8
- package/src/api/controllers/application.ts +13 -21
- package/src/api/routes/tests/row.spec.js +19 -19
- package/src/app.ts +0 -1
- 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.
|
|
4
|
+
"version": "1.1.10-alpha.1",
|
|
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.
|
|
81
|
-
"@budibase/client": "^1.1.
|
|
82
|
-
"@budibase/pro": "1.1.
|
|
83
|
-
"@budibase/string-templates": "^1.1.
|
|
80
|
+
"@budibase/backend-core": "^1.1.10-alpha.1",
|
|
81
|
+
"@budibase/client": "^1.1.10-alpha.1",
|
|
82
|
+
"@budibase/pro": "1.1.10-alpha.0",
|
|
83
|
+
"@budibase/string-templates": "^1.1.10-alpha.1",
|
|
84
|
+
"@budibase/types": "^1.1.10-alpha.1",
|
|
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.
|
|
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.8",
|
|
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": "
|
|
198
|
+
"gitHead": "ffc2be72cb2523366f082cb5e38d555b8aeb249f"
|
|
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
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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(
|
|
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.
|
|
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
|
|
128
|
+
body,
|
|
119
129
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
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
|
})
|