@budibase/server 1.2.37 → 1.2.39-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/__mocks__/mongodb.ts +4 -0
- package/__mocks__/node-fetch.ts +8 -1
- package/builder/assets/index.a1c0a62f.js +977 -0
- package/builder/assets/{index.08dd0c5e.css → index.f1c7e247.css} +1 -1
- package/builder/index.html +2 -2
- package/coverage/clover.xml +385 -380
- package/coverage/coverage-final.json +21 -21
- 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 +3 -3
- package/coverage/lcov-report/api/controllers/backup.js.html +3 -3
- package/coverage/lcov-report/api/controllers/cloud.js.html +4 -4
- package/coverage/lcov-report/api/controllers/component.js.html +3 -3
- package/coverage/lcov-report/api/controllers/datasource.js.html +3 -3
- package/coverage/lcov-report/api/controllers/dev.js.html +4 -4
- package/coverage/lcov-report/api/controllers/index.html +1 -1
- package/coverage/lcov-report/api/controllers/integration.js.html +3 -3
- 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 +25 -25
- package/coverage/lcov-report/api/controllers/row/internal.js.html +3 -3
- package/coverage/lcov-report/api/controllers/row/internalSearch.js.html +209 -191
- package/coverage/lcov-report/api/controllers/row/staticFormula.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/utils.js.html +27 -18
- 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 +2 -2
- 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 +19 -19
- 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 +3 -3
- package/coverage/lcov-report/api/controllers/view/utils.js.html +5 -5
- 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 +1 -1
- 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 +1 -1
- package/coverage/lcov-report/constants/index.html +1 -1
- package/coverage/lcov-report/constants/index.js.html +30 -30
- 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 +1 -1
- package/coverage/lcov-report/db/linkedRows/index.html +1 -1
- package/coverage/lcov-report/db/linkedRows/index.js.html +1 -1
- package/coverage/lcov-report/db/linkedRows/linkUtils.js.html +3 -3
- package/coverage/lcov-report/db/newid.js.html +3 -3
- package/coverage/lcov-report/db/utils.js.html +99 -99
- 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 +1 -1
- package/coverage/lcov-report/events/utils.js.html +1 -1
- package/coverage/lcov-report/index.html +19 -19
- 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 +3 -3
- package/coverage/lcov-report/middleware/currentapp.js.html +1 -1
- 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 +1 -1
- package/coverage/lcov-report/middleware/selfhost.js.html +1 -1
- package/coverage/lcov-report/middleware/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 +16 -16
- package/coverage/lcov-report/utilities/index.html +1 -1
- package/coverage/lcov-report/utilities/index.js.html +23 -23
- 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 +3 -3
- package/coverage/lcov-report/utilities/rowProcessor/index.html +1 -1
- package/coverage/lcov-report/utilities/rowProcessor/index.js.html +1 -1
- package/coverage/lcov-report/utilities/rowProcessor/utils.js.html +1 -1
- package/coverage/lcov-report/utilities/scriptRunner.js.html +1 -1
- package/coverage/lcov-report/utilities/security.js.html +9 -9
- 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 +7 -7
- package/coverage/lcov-report/utilities/workerRequests.js.html +1 -1
- package/coverage/lcov.info +598 -593
- package/dist/api/controllers/analytics.js +1 -1
- package/dist/api/controllers/application.js +8 -8
- package/dist/api/controllers/automation.js +2 -2
- package/dist/api/controllers/backup.js +2 -2
- package/dist/api/controllers/cloud.js +3 -3
- package/dist/api/controllers/component.js +2 -2
- package/dist/api/controllers/datasource.js +2 -2
- package/dist/api/controllers/deploy/index.js +6 -6
- package/dist/api/controllers/dev.js +3 -3
- package/dist/api/controllers/integration.js +2 -2
- package/dist/api/controllers/public/utils.js +1 -1
- package/dist/api/controllers/row/ExternalRequest.js +3 -3
- package/dist/api/controllers/row/internal.js +2 -2
- package/dist/api/controllers/row/internalSearch.js +5 -0
- package/dist/api/controllers/row/utils.js +3 -1
- package/dist/api/controllers/static/index.js +2 -2
- package/dist/api/controllers/table/external.js +1 -1
- package/dist/api/controllers/view/index.js +2 -2
- package/dist/api/controllers/view/utils.js +3 -3
- package/dist/automations/logging/index.js +3 -0
- package/dist/db/linkedRows/linkUtils.js +2 -2
- package/dist/db/utils.js +37 -37
- package/dist/db/views/staticViews.js +4 -4
- package/dist/definitions/automations.js +6 -6
- package/dist/definitions/datasource.js +6 -70
- package/dist/integrations/airtable.js +13 -13
- package/dist/integrations/arangodb.js +8 -8
- package/dist/integrations/base/query.js +27 -0
- package/dist/integrations/base/sql.js +33 -32
- package/dist/integrations/base/sqlTable.js +4 -4
- package/dist/integrations/base/utils.js +13 -27
- package/dist/integrations/couchdb.js +8 -8
- package/dist/integrations/dynamodb.js +21 -21
- package/dist/integrations/elasticsearch.js +12 -12
- package/dist/integrations/firebase.js +12 -12
- package/dist/integrations/googlesheets.js +14 -14
- package/dist/integrations/index.js +34 -34
- package/dist/integrations/microsoftSqlServer.js +19 -16
- package/dist/integrations/mongodb.js +44 -17
- package/dist/integrations/mysql.js +15 -15
- package/dist/integrations/oracle.js +13 -13
- package/dist/integrations/postgres.js +20 -17
- package/dist/integrations/redis.js +10 -10
- package/dist/integrations/rest.js +15 -14
- package/dist/integrations/s3.js +2 -2
- package/dist/integrations/snowflake.js +5 -5
- package/dist/integrations/utils.js +14 -14
- package/dist/middleware/builder.js +2 -2
- package/dist/migrations/functions/appUrls.js +2 -2
- package/dist/migrations/functions/backfill/app/queries.js +3 -1
- package/dist/migrations/functions/backfill/app.js +1 -1
- package/dist/migrations/functions/backfill/global/users.js +1 -1
- package/dist/package.json +7 -7
- package/dist/tests/utilities/TestConfiguration.js +2 -2
- package/dist/threads/automation.js +2 -2
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utilities/routing/index.js +2 -2
- package/dist/utilities/security.js +8 -8
- package/package.json +8 -8
- package/src/api/controllers/analytics.ts +2 -2
- package/src/api/controllers/application.ts +9 -9
- package/src/api/controllers/automation.js +2 -2
- package/src/api/controllers/backup.js +2 -2
- package/src/api/controllers/cloud.js +3 -3
- package/src/api/controllers/component.js +2 -2
- package/src/api/controllers/datasource.js +2 -2
- package/src/api/controllers/deploy/index.ts +7 -7
- package/src/api/controllers/dev.js +3 -3
- package/src/api/controllers/integration.js +2 -2
- package/src/api/controllers/public/utils.ts +2 -2
- package/src/api/controllers/query/import/sources/openapi2.ts +1 -1
- package/src/api/controllers/query/import/sources/openapi3.ts +1 -1
- package/src/api/controllers/row/ExternalRequest.ts +5 -7
- package/src/api/controllers/row/internal.js +2 -2
- package/src/api/controllers/row/internalSearch.js +6 -0
- package/src/api/controllers/row/utils.js +4 -1
- package/src/api/controllers/static/index.ts +2 -2
- package/src/api/controllers/table/external.js +1 -1
- package/src/api/controllers/view/index.js +2 -2
- package/src/api/controllers/view/utils.js +4 -4
- package/src/api/routes/tests/internalSearch.spec.js +157 -0
- package/src/automations/logging/index.ts +3 -0
- package/src/db/linkedRows/linkUtils.js +2 -2
- package/src/db/utils.js +38 -38
- package/src/db/views/staticViews.js +4 -9
- package/src/definitions/automations.ts +2 -2
- package/src/definitions/common.ts +14 -65
- package/src/definitions/datasource.ts +5 -250
- package/src/integrations/airtable.ts +16 -16
- package/src/integrations/arangodb.ts +11 -11
- package/src/integrations/base/query.ts +16 -0
- package/src/integrations/base/sql.ts +21 -20
- package/src/integrations/base/sqlTable.ts +1 -6
- package/src/integrations/base/utils.ts +9 -19
- package/src/integrations/couchdb.ts +11 -11
- package/src/integrations/dynamodb.ts +24 -24
- package/src/integrations/elasticsearch.ts +15 -15
- package/src/integrations/firebase.ts +15 -15
- package/src/integrations/googlesheets.ts +19 -18
- package/src/integrations/index.ts +34 -34
- package/src/integrations/microsoftSqlServer.ts +22 -20
- package/src/integrations/mongodb.ts +47 -20
- package/src/integrations/mysql.ts +20 -19
- package/src/integrations/oracle.ts +16 -16
- package/src/integrations/postgres.ts +22 -21
- package/src/integrations/queries/sql.ts +1 -2
- package/src/integrations/redis.ts +10 -14
- package/src/integrations/rest.ts +22 -20
- package/src/integrations/s3.ts +2 -3
- package/src/integrations/snowflake.ts +5 -5
- package/src/integrations/tests/mongo.spec.js +218 -0
- package/src/integrations/tests/sql.spec.js +8 -8
- package/src/integrations/utils.ts +8 -9
- package/src/middleware/builder.js +2 -2
- package/src/migrations/functions/appUrls.ts +2 -2
- package/src/migrations/functions/backfill/app/queries.ts +3 -2
- package/src/migrations/functions/backfill/app.ts +1 -1
- package/src/migrations/functions/backfill/global/users.ts +1 -1
- package/src/migrations/functions/tests/appUrls.spec.js +3 -3
- package/src/migrations/tests/index.spec.ts +2 -2
- package/src/tests/utilities/TestConfiguration.js +2 -2
- package/src/threads/automation.ts +3 -3
- package/src/utilities/routing/index.js +2 -2
- package/src/utilities/security.js +8 -8
- package/builder/assets/index.3ce7fa08.js +0 -975
- package/dist/integrations/base/IntegrationBase.js +0 -2
- package/dist/integrations/base/datasourcePlus.js +0 -2
- package/src/integrations/base/IntegrationBase.ts +0 -6
- package/src/integrations/base/datasourcePlus.ts +0 -13
|
@@ -26,7 +26,7 @@ const ping = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
26
26
|
switch (body.source) {
|
|
27
27
|
case types_1.PingSource.APP: {
|
|
28
28
|
const db = backend_core_2.context.getAppDB({ skip_setup: true });
|
|
29
|
-
const appInfo = yield db.get(utils_1.
|
|
29
|
+
const appInfo = yield db.get(utils_1.DocumentType.APP_METADATA);
|
|
30
30
|
let appId = backend_core_2.context.getAppId();
|
|
31
31
|
if ((0, utils_1.isDevAppID)(appId)) {
|
|
32
32
|
yield backend_core_1.events.serve.servedAppPreview(appInfo, body.timezone);
|
|
@@ -174,7 +174,7 @@ const fetchAppDefinition = (ctx) => __awaiter(void 0, void 0, void 0, function*
|
|
|
174
174
|
exports.fetchAppDefinition = fetchAppDefinition;
|
|
175
175
|
const fetchAppPackage = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
176
176
|
const db = backend_core_1.context.getAppDB();
|
|
177
|
-
const application = yield db.get(utils_1.
|
|
177
|
+
const application = yield db.get(utils_1.DocumentType.APP_METADATA);
|
|
178
178
|
const layouts = yield getLayouts();
|
|
179
179
|
let screens = yield getScreens();
|
|
180
180
|
// Only filter screens if the user is not a builder
|
|
@@ -212,14 +212,14 @@ const performAppCreate = (ctx) => __awaiter(void 0, void 0, void 0, function* ()
|
|
|
212
212
|
let _rev;
|
|
213
213
|
try {
|
|
214
214
|
// if template there will be an existing doc
|
|
215
|
-
const existing = yield db.get(utils_1.
|
|
215
|
+
const existing = yield db.get(utils_1.DocumentType.APP_METADATA);
|
|
216
216
|
_rev = existing._rev;
|
|
217
217
|
}
|
|
218
218
|
catch (err) {
|
|
219
219
|
// nothing to do
|
|
220
220
|
}
|
|
221
221
|
const newApplication = {
|
|
222
|
-
_id: utils_1.
|
|
222
|
+
_id: utils_1.DocumentType.APP_METADATA,
|
|
223
223
|
_rev,
|
|
224
224
|
appId: instance._id,
|
|
225
225
|
type: "app",
|
|
@@ -342,7 +342,7 @@ exports.update = update;
|
|
|
342
342
|
const updateClient = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
343
343
|
// Get current app version
|
|
344
344
|
const db = backend_core_1.context.getAppDB();
|
|
345
|
-
const application = yield db.get(utils_1.
|
|
345
|
+
const application = yield db.get(utils_1.DocumentType.APP_METADATA);
|
|
346
346
|
const currentVersion = application.version;
|
|
347
347
|
// Update client library and manifest
|
|
348
348
|
if (!environment_1.default.isTest()) {
|
|
@@ -364,7 +364,7 @@ exports.updateClient = updateClient;
|
|
|
364
364
|
const revertClient = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
365
365
|
// Check app can be reverted
|
|
366
366
|
const db = backend_core_1.context.getAppDB();
|
|
367
|
-
const application = yield db.get(utils_1.
|
|
367
|
+
const application = yield db.get(utils_1.DocumentType.APP_METADATA);
|
|
368
368
|
if (!application.revertableVersion) {
|
|
369
369
|
ctx.throw(400, "There is no version to revert to");
|
|
370
370
|
}
|
|
@@ -392,7 +392,7 @@ const destroyApp = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
392
392
|
appId = getProdAppID(appId);
|
|
393
393
|
}
|
|
394
394
|
const db = isUnpublish ? backend_core_1.context.getProdAppDB() : backend_core_1.context.getAppDB();
|
|
395
|
-
const app = yield db.get(utils_1.
|
|
395
|
+
const app = yield db.get(utils_1.DocumentType.APP_METADATA);
|
|
396
396
|
const result = yield db.destroy();
|
|
397
397
|
if (isUnpublish) {
|
|
398
398
|
yield pro_1.quotas.removePublishedApp();
|
|
@@ -472,7 +472,7 @@ const sync = (ctx, next) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
472
472
|
try {
|
|
473
473
|
yield replication.replicate({
|
|
474
474
|
filter: function (doc) {
|
|
475
|
-
return doc._id !== utils_1.
|
|
475
|
+
return doc._id !== utils_1.DocumentType.APP_METADATA;
|
|
476
476
|
},
|
|
477
477
|
});
|
|
478
478
|
}
|
|
@@ -497,7 +497,7 @@ exports.sync = sync;
|
|
|
497
497
|
const updateAppPackage = (appPackage, appId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
498
498
|
return backend_core_1.context.doInAppContext(appId, () => __awaiter(void 0, void 0, void 0, function* () {
|
|
499
499
|
const db = backend_core_1.context.getAppDB();
|
|
500
|
-
const application = yield db.get(utils_1.
|
|
500
|
+
const application = yield db.get(utils_1.DocumentType.APP_METADATA);
|
|
501
501
|
const newAppPackage = Object.assign(Object.assign({}, application), appPackage);
|
|
502
502
|
if (appPackage._rev !== application._rev) {
|
|
503
503
|
newAppPackage._rev = application._rev;
|
|
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
const actions = require("../../automations/actions");
|
|
12
12
|
const triggers = require("../../automations/triggers");
|
|
13
|
-
const { getAutomationParams, generateAutomationID,
|
|
13
|
+
const { getAutomationParams, generateAutomationID, DocumentType, } = require("../../db/utils");
|
|
14
14
|
const { checkForWebhooks, updateTestHistory, removeDeprecated, } = require("../../automations/utils");
|
|
15
15
|
const { deleteEntityMetadata } = require("../../utilities");
|
|
16
16
|
const { MetadataTypes } = require("../../constants");
|
|
@@ -174,7 +174,7 @@ exports.clearLogError = function (ctx) {
|
|
|
174
174
|
const { automationId, appId } = ctx.request.body;
|
|
175
175
|
yield doInAppContext(appId, () => __awaiter(this, void 0, void 0, function* () {
|
|
176
176
|
const db = getProdAppDB();
|
|
177
|
-
const metadata = yield db.get(
|
|
177
|
+
const metadata = yield db.get(DocumentType.APP_METADATA);
|
|
178
178
|
if (!automationId) {
|
|
179
179
|
delete metadata.automationErrors;
|
|
180
180
|
}
|
|
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
const { streamBackup } = require("../../utilities/fileSystem");
|
|
12
12
|
const { events, context } = require("@budibase/backend-core");
|
|
13
|
-
const {
|
|
13
|
+
const { DocumentType } = require("../../db/utils");
|
|
14
14
|
exports.exportAppDump = function (ctx) {
|
|
15
15
|
return __awaiter(this, void 0, void 0, function* () {
|
|
16
16
|
let { appId, excludeRows } = ctx.query;
|
|
@@ -21,7 +21,7 @@ exports.exportAppDump = function (ctx) {
|
|
|
21
21
|
ctx.body = yield streamBackup(appId, excludeRows);
|
|
22
22
|
yield context.doInAppContext(appId, () => __awaiter(this, void 0, void 0, function* () {
|
|
23
23
|
const appDb = context.getAppDB();
|
|
24
|
-
const app = yield appDb.get(
|
|
24
|
+
const app = yield appDb.get(DocumentType.APP_METADATA);
|
|
25
25
|
yield events.app.exported(app);
|
|
26
26
|
}));
|
|
27
27
|
});
|
|
@@ -14,7 +14,7 @@ const { exportDB, sendTempFile, readFileSync, } = require("../../utilities/fileS
|
|
|
14
14
|
const { stringToReadStream } = require("../../utilities");
|
|
15
15
|
const { getGlobalDBName, getGlobalDB, } = require("@budibase/backend-core/tenancy");
|
|
16
16
|
const { create } = require("./application");
|
|
17
|
-
const { getDocParams,
|
|
17
|
+
const { getDocParams, DocumentType, isDevAppID } = require("../../db/utils");
|
|
18
18
|
function createApp(appName, appImport) {
|
|
19
19
|
return __awaiter(this, void 0, void 0, function* () {
|
|
20
20
|
const ctx = {
|
|
@@ -34,7 +34,7 @@ exports.exportApps = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
34
34
|
}
|
|
35
35
|
const apps = yield getAllApps({ all: true });
|
|
36
36
|
const globalDBString = yield exportDB(getGlobalDBName(), {
|
|
37
|
-
filter: doc => !doc._id.startsWith(
|
|
37
|
+
filter: doc => !doc._id.startsWith(DocumentType.USER),
|
|
38
38
|
});
|
|
39
39
|
let allDBs = {
|
|
40
40
|
global: globalDBString,
|
|
@@ -94,7 +94,7 @@ exports.importApps = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
94
94
|
yield createApp(appName, appImport);
|
|
95
95
|
}
|
|
96
96
|
// if there are any users make sure to remove them
|
|
97
|
-
let users = yield getAllDocType(globalDb,
|
|
97
|
+
let users = yield getAllDocType(globalDb, DocumentType.USER);
|
|
98
98
|
let userDeletionPromises = [];
|
|
99
99
|
for (let user of users) {
|
|
100
100
|
userDeletionPromises.push(globalDb.remove(user._id, user._rev));
|
|
@@ -8,13 +8,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
const {
|
|
11
|
+
const { DocumentType } = require("../../db/utils");
|
|
12
12
|
const { getComponentLibraryManifest } = require("../../utilities/fileSystem");
|
|
13
13
|
const { getAppDB } = require("@budibase/backend-core/context");
|
|
14
14
|
exports.fetchAppComponentDefinitions = function (ctx) {
|
|
15
15
|
return __awaiter(this, void 0, void 0, function* () {
|
|
16
16
|
const db = getAppDB();
|
|
17
|
-
const app = yield db.get(
|
|
17
|
+
const app = yield db.get(DocumentType.APP_METADATA);
|
|
18
18
|
let componentManifests = yield Promise.all(app.componentLibraries.map((library) => __awaiter(this, void 0, void 0, function* () {
|
|
19
19
|
let manifest = yield getComponentLibraryManifest(library);
|
|
20
20
|
return {
|
|
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
const { generateDatasourceID, getDatasourceParams, getQueryParams,
|
|
11
|
+
const { generateDatasourceID, getDatasourceParams, getQueryParams, DocumentType, BudibaseInternalDB, getTableParams, } = require("../../db/utils");
|
|
12
12
|
const { BuildSchemaErrors, InvalidColumns } = require("../../constants");
|
|
13
13
|
const { integrations } = require("../../integrations");
|
|
14
14
|
const { getDatasourceAndQuery } = require("./row/utils");
|
|
@@ -111,7 +111,7 @@ exports.save = function (ctx) {
|
|
|
111
111
|
const db = getAppDB();
|
|
112
112
|
const plus = ctx.request.body.datasource.plus;
|
|
113
113
|
const fetchSchema = ctx.request.body.fetchSchema;
|
|
114
|
-
const datasource = Object.assign({ _id: generateDatasourceID({ plus }), type: plus ?
|
|
114
|
+
const datasource = Object.assign({ _id: generateDatasourceID({ plus }), type: plus ? DocumentType.DATASOURCE_PLUS : DocumentType.DATASOURCE }, ctx.request.body.datasource);
|
|
115
115
|
let schemaError = null;
|
|
116
116
|
if (fetchSchema) {
|
|
117
117
|
const { tables, error } = yield buildSchemaHelper(datasource);
|
|
@@ -52,10 +52,10 @@ function storeDeploymentHistory(deployment) {
|
|
|
52
52
|
let deploymentDoc;
|
|
53
53
|
try {
|
|
54
54
|
// theres only one deployment doc per app database
|
|
55
|
-
deploymentDoc = yield db.get(utils_1.
|
|
55
|
+
deploymentDoc = yield db.get(utils_1.DocumentType.DEPLOYMENTS);
|
|
56
56
|
}
|
|
57
57
|
catch (err) {
|
|
58
|
-
deploymentDoc = { _id: utils_1.
|
|
58
|
+
deploymentDoc = { _id: utils_1.DocumentType.DEPLOYMENTS, history: {} };
|
|
59
59
|
}
|
|
60
60
|
const deploymentId = deploymentJSON._id;
|
|
61
61
|
// first time deployment
|
|
@@ -104,7 +104,7 @@ function deployApp(deployment) {
|
|
|
104
104
|
yield replication.replicate();
|
|
105
105
|
console.log("replication complete.. replacing app meta doc");
|
|
106
106
|
const db = (0, context_1.getProdAppDB)();
|
|
107
|
-
const appDoc = yield db.get(utils_1.
|
|
107
|
+
const appDoc = yield db.get(utils_1.DocumentType.APP_METADATA);
|
|
108
108
|
deployment.appUrl = appDoc.url;
|
|
109
109
|
appDoc.appId = productionAppId;
|
|
110
110
|
appDoc.instance._id = productionAppId;
|
|
@@ -133,7 +133,7 @@ function fetchDeployments(ctx) {
|
|
|
133
133
|
return __awaiter(this, void 0, void 0, function* () {
|
|
134
134
|
try {
|
|
135
135
|
const db = (0, context_1.getAppDB)();
|
|
136
|
-
const deploymentDoc = yield db.get(utils_1.
|
|
136
|
+
const deploymentDoc = yield db.get(utils_1.DocumentType.DEPLOYMENTS);
|
|
137
137
|
const { updated, deployments } = yield checkAllDeployments(deploymentDoc);
|
|
138
138
|
if (updated) {
|
|
139
139
|
yield db.put(deployments);
|
|
@@ -150,7 +150,7 @@ function deploymentProgress(ctx) {
|
|
|
150
150
|
return __awaiter(this, void 0, void 0, function* () {
|
|
151
151
|
try {
|
|
152
152
|
const db = (0, context_1.getAppDB)();
|
|
153
|
-
const deploymentDoc = yield db.get(utils_1.
|
|
153
|
+
const deploymentDoc = yield db.get(utils_1.DocumentType.DEPLOYMENTS);
|
|
154
154
|
ctx.body = deploymentDoc[ctx.params.deploymentId];
|
|
155
155
|
}
|
|
156
156
|
catch (err) {
|
|
@@ -162,7 +162,7 @@ exports.deploymentProgress = deploymentProgress;
|
|
|
162
162
|
const isFirstDeploy = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
163
163
|
try {
|
|
164
164
|
const db = (0, context_1.getProdAppDB)();
|
|
165
|
-
yield db.get(utils_1.
|
|
165
|
+
yield db.get(utils_1.DocumentType.APP_METADATA);
|
|
166
166
|
}
|
|
167
167
|
catch (e) {
|
|
168
168
|
if (e.status === 404) {
|
|
@@ -14,7 +14,7 @@ const { checkSlashesInUrl } = require("../../utilities");
|
|
|
14
14
|
const { request } = require("../../utilities/workerRequests");
|
|
15
15
|
const { clearLock } = require("../../utilities/redis");
|
|
16
16
|
const { Replication, getProdAppID } = require("@budibase/backend-core/db");
|
|
17
|
-
const {
|
|
17
|
+
const { DocumentType } = require("../../db/utils");
|
|
18
18
|
const { app: appCache } = require("@budibase/backend-core/cache");
|
|
19
19
|
const { getProdAppDB, getAppDB } = require("@budibase/backend-core/context");
|
|
20
20
|
const { events } = require("@budibase/backend-core");
|
|
@@ -85,7 +85,7 @@ exports.revert = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
85
85
|
if (info.error) {
|
|
86
86
|
throw info.error;
|
|
87
87
|
}
|
|
88
|
-
const deploymentDoc = yield db.get(
|
|
88
|
+
const deploymentDoc = yield db.get(DocumentType.DEPLOYMENTS);
|
|
89
89
|
if (!deploymentDoc.history ||
|
|
90
90
|
Object.keys(deploymentDoc.history).length === 0) {
|
|
91
91
|
throw new Error("No deployments for app");
|
|
@@ -105,7 +105,7 @@ exports.revert = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
105
105
|
}
|
|
106
106
|
// update appID in reverted app to be dev version again
|
|
107
107
|
const db = getAppDB();
|
|
108
|
-
const appDoc = yield db.get(
|
|
108
|
+
const appDoc = yield db.get(DocumentType.APP_METADATA);
|
|
109
109
|
appDoc.appId = appId;
|
|
110
110
|
appDoc.instance._id = appId;
|
|
111
111
|
yield db.put(appDoc);
|
|
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
const { cloneDeep } = require("lodash");
|
|
12
12
|
const { definitions } = require("../../integrations");
|
|
13
|
-
const {
|
|
13
|
+
const { SourceName } = require("@budibase/types");
|
|
14
14
|
const googlesheets = require("../../integrations/googlesheets");
|
|
15
15
|
const { featureFlags } = require("@budibase/backend-core");
|
|
16
16
|
exports.fetch = function (ctx) {
|
|
@@ -19,7 +19,7 @@ exports.fetch = function (ctx) {
|
|
|
19
19
|
const defs = cloneDeep(definitions);
|
|
20
20
|
// for google sheets integration google verification
|
|
21
21
|
if (featureFlags.isEnabled(featureFlags.FeatureFlag.GOOGLE_SHEETS)) {
|
|
22
|
-
defs[
|
|
22
|
+
defs[SourceName.GOOGLE_SHEETS] = googlesheets.schema;
|
|
23
23
|
}
|
|
24
24
|
ctx.body = defs;
|
|
25
25
|
});
|
|
@@ -20,7 +20,7 @@ function addRev(body, tableId) {
|
|
|
20
20
|
}
|
|
21
21
|
let id = body._id;
|
|
22
22
|
if (body._id.startsWith(utils_2.APP_PREFIX)) {
|
|
23
|
-
id = utils_2.
|
|
23
|
+
id = utils_2.DocumentType.APP_METADATA;
|
|
24
24
|
}
|
|
25
25
|
const db = getAppDB();
|
|
26
26
|
const dbDoc = yield db.get(id);
|
|
@@ -20,7 +20,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
20
20
|
return t;
|
|
21
21
|
};
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
const
|
|
23
|
+
const types_1 = require("@budibase/types");
|
|
24
24
|
const utils_1 = require("../../../integrations/utils");
|
|
25
25
|
const utils_2 = require("./utils");
|
|
26
26
|
const constants_1 = require("../../../constants");
|
|
@@ -101,7 +101,7 @@ var External;
|
|
|
101
101
|
// oneOf is an array, don't iterate it
|
|
102
102
|
if (typeof filter !== "object" ||
|
|
103
103
|
Object.keys(filter).length === 0 ||
|
|
104
|
-
key ===
|
|
104
|
+
key === types_1.FilterType.ONE_OF) {
|
|
105
105
|
continue;
|
|
106
106
|
}
|
|
107
107
|
iterateObject(filter);
|
|
@@ -530,7 +530,7 @@ var External;
|
|
|
530
530
|
* Creating the specific list of fields that we desire, and excluding the ones that are no use to us
|
|
531
531
|
* is more performant and has the added benefit of protecting against this scenario.
|
|
532
532
|
*/
|
|
533
|
-
buildFields(table, includeRelations =
|
|
533
|
+
buildFields(table, includeRelations = types_1.IncludeRelationship.INCLUDE) {
|
|
534
534
|
function extractRealFields(table, existing = []) {
|
|
535
535
|
return Object.entries(table.schema)
|
|
536
536
|
.filter(column => column[1].type !== constants_1.FieldTypes.LINK &&
|
|
@@ -20,7 +20,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
20
20
|
return t;
|
|
21
21
|
};
|
|
22
22
|
const linkRows = require("../../../db/linkedRows");
|
|
23
|
-
const { generateRowID, getRowParams, getTableIDFromRowID,
|
|
23
|
+
const { generateRowID, getRowParams, getTableIDFromRowID, DocumentType, InternalTables, } = require("../../../db/utils");
|
|
24
24
|
const { dangerousGetDB } = require("@budibase/backend-core/db");
|
|
25
25
|
const userController = require("../user");
|
|
26
26
|
const { inputProcessing, outputProcessing, cleanupAttachments, } = require("../../../utilities/rowProcessor");
|
|
@@ -178,7 +178,7 @@ exports.save = function (ctx) {
|
|
|
178
178
|
exports.fetchView = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
179
179
|
const viewName = ctx.params.viewName;
|
|
180
180
|
// if this is a table view being looked for just transfer to that
|
|
181
|
-
if (viewName.startsWith(
|
|
181
|
+
if (viewName.startsWith(DocumentType.TABLE)) {
|
|
182
182
|
ctx.params.tableId = viewName;
|
|
183
183
|
return exports.fetch(ctx);
|
|
184
184
|
}
|
|
@@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
const { SearchIndexes } = require("../../../db/utils");
|
|
12
|
+
const { removeKeyNumbering } = require("./utils");
|
|
12
13
|
const fetch = require("node-fetch");
|
|
13
14
|
const { getCouchInfo } = require("@budibase/backend-core/db");
|
|
14
15
|
const { getAppId } = require("@budibase/backend-core/context");
|
|
@@ -169,6 +170,8 @@ class QueryBuilder {
|
|
|
169
170
|
};
|
|
170
171
|
function build(structure, queryFn) {
|
|
171
172
|
for (let [key, value] of Object.entries(structure)) {
|
|
173
|
+
// check for new format - remove numbering if needed
|
|
174
|
+
key = removeKeyNumbering(key);
|
|
172
175
|
key = builder.preprocess(key.replace(/ /g, "_"), {
|
|
173
176
|
escape: true,
|
|
174
177
|
});
|
|
@@ -280,6 +283,8 @@ class QueryBuilder {
|
|
|
280
283
|
});
|
|
281
284
|
}
|
|
282
285
|
}
|
|
286
|
+
// exported for unit testing
|
|
287
|
+
exports.QueryBuilder = QueryBuilder;
|
|
283
288
|
/**
|
|
284
289
|
* Executes a lucene search query.
|
|
285
290
|
* @param url The query URL
|
|
@@ -13,8 +13,9 @@ const { cloneDeep } = require("lodash/fp");
|
|
|
13
13
|
const { InternalTables } = require("../../../db/utils");
|
|
14
14
|
const userController = require("../user");
|
|
15
15
|
const { FieldTypes } = require("../../../constants");
|
|
16
|
-
const { makeExternalQuery } = require("../../../integrations/base/utils");
|
|
17
16
|
const { getAppDB } = require("@budibase/backend-core/context");
|
|
17
|
+
const { makeExternalQuery } = require("../../../integrations/base/query");
|
|
18
|
+
const { removeKeyNumbering } = require("../../../integrations/base/utils");
|
|
18
19
|
validateJs.extend(validateJs.validators.datetime, {
|
|
19
20
|
parse: function (value) {
|
|
20
21
|
return new Date(value).getTime();
|
|
@@ -24,6 +25,7 @@ validateJs.extend(validateJs.validators.datetime, {
|
|
|
24
25
|
return new Date(value).toISOString();
|
|
25
26
|
},
|
|
26
27
|
});
|
|
28
|
+
exports.removeKeyNumbering = removeKeyNumbering;
|
|
27
29
|
exports.getDatasourceAndQuery = (json) => __awaiter(void 0, void 0, void 0, function* () {
|
|
28
30
|
const datasourceId = json.endpoint.datasourceId;
|
|
29
31
|
const db = getAppDB();
|
|
@@ -21,7 +21,7 @@ const env = require("../../../environment");
|
|
|
21
21
|
const { clientLibraryPath } = require("../../../utilities");
|
|
22
22
|
const { upload } = require("../../../utilities/fileSystem");
|
|
23
23
|
const { attachmentsRelativeURL } = require("../../../utilities");
|
|
24
|
-
const {
|
|
24
|
+
const { DocumentType } = require("../../../db/utils");
|
|
25
25
|
const { getAppDB, getAppId } = require("@budibase/backend-core/context");
|
|
26
26
|
const { setCookie, clearCookie } = require("@budibase/backend-core/utils");
|
|
27
27
|
const AWS = require("aws-sdk");
|
|
@@ -98,7 +98,7 @@ exports.uploadFile = uploadFile;
|
|
|
98
98
|
const serveApp = function (ctx) {
|
|
99
99
|
return __awaiter(this, void 0, void 0, function* () {
|
|
100
100
|
const db = getAppDB({ skip_setup: true });
|
|
101
|
-
const appInfo = yield db.get(
|
|
101
|
+
const appInfo = yield db.get(DocumentType.APP_METADATA);
|
|
102
102
|
let appId = getAppId();
|
|
103
103
|
if (!env.isJest()) {
|
|
104
104
|
const App = require("./templates/BudibaseApp.svelte").default;
|
|
@@ -11,7 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
const { buildExternalTableId, breakExternalTableId, } = require("../../../integrations/utils");
|
|
12
12
|
const { getTable, generateForeignKey, generateJunctionTableName, foreignKeyStructure, hasTypeChanged, } = require("./utils");
|
|
13
13
|
const { DataSourceOperation, FieldTypes, RelationshipTypes, } = require("../../../constants");
|
|
14
|
-
const { makeExternalQuery } = require("../../../integrations/base/
|
|
14
|
+
const { makeExternalQuery } = require("../../../integrations/base/query");
|
|
15
15
|
const { cloneDeep } = require("lodash/fp");
|
|
16
16
|
const csvParser = require("../../../utilities/csvParser");
|
|
17
17
|
const { handleRequest } = require("../row/external");
|
|
@@ -28,7 +28,7 @@ const { getTable } = require("../table/utils");
|
|
|
28
28
|
const { FieldTypes } = require("../../../constants");
|
|
29
29
|
const { getAppDB } = require("@budibase/backend-core/context");
|
|
30
30
|
const { events } = require("@budibase/backend-core");
|
|
31
|
-
const {
|
|
31
|
+
const { DocumentType } = require("../../../db/utils");
|
|
32
32
|
const { cloneDeep, isEqual } = require("lodash");
|
|
33
33
|
exports.fetch = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
34
34
|
ctx.body = yield getViews();
|
|
@@ -170,7 +170,7 @@ exports.exportView = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
170
170
|
// send down the file
|
|
171
171
|
ctx.attachment(filename);
|
|
172
172
|
ctx.body = apiFileReturn(exporter(headers, rows));
|
|
173
|
-
if (viewName.startsWith(
|
|
173
|
+
if (viewName.startsWith(DocumentType.TABLE)) {
|
|
174
174
|
yield events.table.exported(table, format);
|
|
175
175
|
}
|
|
176
176
|
else {
|
|
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
const {
|
|
11
|
+
const { ViewName, generateMemoryViewID, getMemoryViewParams, DocumentType, SEPARATOR, } = require("../../../db/utils");
|
|
12
12
|
const env = require("../../../environment");
|
|
13
13
|
const { getAppDB } = require("@budibase/backend-core/context");
|
|
14
14
|
const viewBuilder = require("./viewBuilder");
|
|
@@ -20,7 +20,7 @@ exports.getView = (viewName) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
20
20
|
}
|
|
21
21
|
else {
|
|
22
22
|
// This is a table view, don't read the view from the DB
|
|
23
|
-
if (viewName.startsWith(
|
|
23
|
+
if (viewName.startsWith(DocumentType.TABLE + SEPARATOR)) {
|
|
24
24
|
return null;
|
|
25
25
|
}
|
|
26
26
|
const viewDoc = yield db.get(generateMemoryViewID(viewName));
|
|
@@ -34,7 +34,7 @@ exports.getViews = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
34
34
|
const designDoc = yield db.get("_design/database");
|
|
35
35
|
for (let name of Object.keys(designDoc.views)) {
|
|
36
36
|
// Only return custom views, not built ins
|
|
37
|
-
if (Object.values(
|
|
37
|
+
if (Object.values(ViewName).indexOf(name) !== -1) {
|
|
38
38
|
continue;
|
|
39
39
|
}
|
|
40
40
|
response.push(Object.assign({ name }, designDoc.views[name]));
|
|
@@ -56,6 +56,9 @@ function checkAppMetadata(apps) {
|
|
|
56
56
|
for (let [key, errors] of Object.entries(metadata.automationErrors)) {
|
|
57
57
|
const updated = [];
|
|
58
58
|
for (let error of errors) {
|
|
59
|
+
if (!error) {
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
59
62
|
const startDate = error.split(backend_core_1.db.SEPARATOR)[2];
|
|
60
63
|
if (startDate > maxStartDate) {
|
|
61
64
|
updated.push(error);
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
const Sentry = require("@sentry/node");
|
|
12
|
-
const {
|
|
12
|
+
const { ViewName, getQueryIndex } = require("../utils");
|
|
13
13
|
const { FieldTypes } = require("../../constants");
|
|
14
14
|
const { createLinkView } = require("../views/staticViews");
|
|
15
15
|
const { getAppDB } = require("@budibase/backend-core/context");
|
|
@@ -49,7 +49,7 @@ exports.getLinkDocuments = function (args) {
|
|
|
49
49
|
}
|
|
50
50
|
params.include_docs = !!includeDocs;
|
|
51
51
|
try {
|
|
52
|
-
let linkRows = (yield db.query(getQueryIndex(
|
|
52
|
+
let linkRows = (yield db.query(getQueryIndex(ViewName.LINK), params)).rows;
|
|
53
53
|
// filter to get unique entries
|
|
54
54
|
const foundIds = [];
|
|
55
55
|
linkRows = linkRows.filter(link => {
|