@budibase/server 1.3.21-alpha.1 → 1.3.21
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 +1 -1
- package/builder/assets/index.8d12d461.css +6 -0
- package/builder/assets/index.d354271c.js +879 -0
- package/builder/assets/vendor.5e1fe644.css +1 -0
- package/builder/assets/vendor.67dbd8fa.js +248 -0
- package/builder/index.html +4 -2
- package/coverage/clover.xml +390 -451
- 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 +8 -41
- 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 +11 -68
- package/coverage/lcov-report/api/controllers/datasource.js.html +34 -73
- package/coverage/lcov-report/api/controllers/dev.js.html +1 -1
- package/coverage/lcov-report/api/controllers/index.html +46 -46
- package/coverage/lcov-report/api/controllers/integration.js.html +6 -6
- 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 +2 -2
- package/coverage/lcov-report/api/controllers/row/index.html +1 -1
- package/coverage/lcov-report/api/controllers/row/internal.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/internalSearch.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/staticFormula.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/utils.js.html +1 -1
- package/coverage/lcov-report/api/controllers/screen.js.html +12 -207
- 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 +13 -13
- 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 +2 -2
- 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 +9 -9
- package/coverage/lcov-report/api/routes/utils/validators.js.html +12 -75
- 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 +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 +18 -18
- 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 +1 -1
- package/coverage/lcov-report/db/newid.js.html +2 -2
- package/coverage/lcov-report/db/utils.js.html +20 -56
- package/coverage/lcov-report/events/AutomationEmitter.js.html +3 -3
- 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 +46 -46
- 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 +12 -12
- package/coverage/lcov-report/middleware/currentapp.js.html +40 -46
- package/coverage/lcov-report/middleware/index.html +15 -15
- 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/utilities/budibaseDir.js.html +3 -3
- package/coverage/lcov-report/utilities/centralPath.js.html +4 -4
- 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 +15 -15
- package/coverage/lcov-report/utilities/index.js.html +24 -24
- package/coverage/lcov-report/utilities/queue/inMemoryQueue.js.html +2 -2
- 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 +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 +2 -2
- 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 +8 -32
- package/coverage/lcov.info +672 -798
- package/dist/api/controllers/application.js +5 -5
- package/dist/api/controllers/auth.js +0 -9
- package/dist/api/controllers/component.js +1 -14
- package/dist/api/controllers/datasource.js +8 -21
- package/dist/api/controllers/deploy/index.js +8 -1
- package/dist/api/controllers/integration.js +4 -4
- package/dist/api/controllers/row/external.js +1 -1
- package/dist/api/controllers/screen.js +2 -52
- package/dist/api/controllers/static/index.js +0 -1
- package/dist/api/controllers/static/templates/BudibaseApp.svelte +0 -10
- package/dist/api/controllers/static/templates/preview.hbs +1 -5
- package/dist/api/index.js +1 -1
- package/dist/api/routes/application.js +2 -3
- package/dist/api/routes/index.js +0 -2
- package/dist/api/routes/public/rows.js +82 -1
- package/dist/api/routes/public/tables.js +1 -1
- package/dist/api/routes/table.js +1 -1
- package/dist/api/routes/utils/validators.js +2 -20
- package/dist/app.js +1 -16
- package/dist/db/utils.js +1 -10
- package/dist/environment.js +0 -1
- package/dist/integrations/airtable.js +129 -126
- package/dist/integrations/arangodb.js +89 -86
- package/dist/integrations/base/query.js +2 -2
- package/dist/integrations/base/sqlTable.js +1 -3
- package/dist/integrations/couchdb.js +83 -80
- package/dist/integrations/dynamodb.js +164 -161
- package/dist/integrations/elasticsearch.js +138 -135
- package/dist/integrations/firebase.js +157 -154
- package/dist/integrations/googlesheets.js +327 -323
- package/dist/integrations/index.js +51 -99
- package/dist/integrations/microsoftSqlServer.js +243 -240
- package/dist/integrations/mongodb.js +242 -239
- package/dist/integrations/mysql.js +219 -215
- package/dist/integrations/oracle.js +322 -318
- package/dist/integrations/postgres.js +265 -262
- package/dist/integrations/redis.js +139 -134
- package/dist/integrations/rest.js +292 -289
- package/dist/integrations/s3.js +64 -61
- package/dist/integrations/snowflake.js +86 -83
- package/dist/middleware/currentapp.js +0 -2
- package/dist/migrations/functions/backfill/global.js +3 -0
- package/dist/migrations/functions/developerQuota.js +49 -0
- package/dist/{api/routes/plugin.js → migrations/functions/publishedAppsQuota.js} +21 -13
- package/dist/{api/controllers/plugin/url.js → migrations/functions/usageQuotas/syncDevelopers.js} +13 -13
- package/dist/{api/controllers/plugin/file.js → migrations/functions/usageQuotas/syncPublishedApps.js} +15 -13
- package/dist/migrations/index.js +10 -0
- package/dist/package.json +6 -9
- package/dist/tests/utilities/TestConfiguration.js +1 -1
- package/dist/threads/query.js +2 -2
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utilities/fileSystem/index.js +1 -111
- package/dist/utilities/workerRequests.js +0 -4
- package/package.json +7 -10
- package/scripts/dev/manage.js +0 -4
- package/scripts/localdomain.js +1 -3
- package/specs/openapi.json +112 -115
- package/specs/openapi.yaml +94 -96
- package/specs/resources/misc.js +0 -116
- package/specs/resources/query.js +1 -1
- package/src/api/controllers/application.ts +2 -1
- package/src/api/controllers/auth.js +0 -11
- package/src/api/controllers/component.js +2 -21
- package/src/api/controllers/datasource.js +8 -21
- package/src/api/controllers/deploy/index.ts +6 -1
- package/src/api/controllers/integration.js +4 -4
- package/src/api/controllers/public/mapping/types.ts +0 -8
- package/src/api/controllers/row/external.js +1 -1
- package/src/api/controllers/screen.js +1 -66
- package/src/api/controllers/static/index.ts +1 -1
- package/src/api/controllers/static/templates/BudibaseApp.svelte +0 -10
- package/src/api/controllers/static/templates/preview.hbs +1 -5
- package/src/api/index.js +1 -1
- package/src/api/routes/application.ts +2 -13
- package/src/api/routes/index.ts +0 -2
- package/src/api/routes/public/rows.ts +82 -1
- package/src/api/routes/public/tables.ts +1 -1
- package/src/api/routes/table.js +1 -1
- package/src/api/routes/tests/query.spec.js +25 -8
- package/src/api/routes/tests/user.spec.js +2 -0
- package/src/api/routes/utils/validators.js +5 -26
- package/src/app.ts +2 -25
- package/src/db/utils.js +0 -12
- package/src/definitions/openapi.ts +55 -56
- package/src/environment.js +0 -1
- package/src/integrations/airtable.ts +118 -116
- package/src/integrations/arangodb.ts +89 -87
- package/src/integrations/base/query.ts +2 -2
- package/src/integrations/base/sqlTable.ts +1 -3
- package/src/integrations/couchdb.ts +89 -83
- package/src/integrations/dynamodb.ts +175 -173
- package/src/integrations/elasticsearch.ts +122 -120
- package/src/integrations/firebase.ts +159 -157
- package/src/integrations/googlesheets.ts +338 -328
- package/src/integrations/index.ts +21 -64
- package/src/integrations/microsoftSqlServer.ts +251 -249
- package/src/integrations/mongodb.ts +258 -261
- package/src/integrations/mysql.ts +234 -229
- package/src/integrations/oracle.ts +380 -373
- package/src/integrations/postgres.ts +268 -264
- package/src/integrations/redis.ts +132 -128
- package/src/integrations/rest.ts +329 -324
- package/src/integrations/s3.ts +71 -68
- package/src/integrations/snowflake.ts +82 -80
- package/src/integrations/tests/{airtable.spec.ts → airtable.spec.js} +18 -21
- package/src/integrations/tests/{arangodb.spec.ts → arangodb.spec.js} +9 -12
- package/src/integrations/tests/{couchdb.spec.ts → couchdb.spec.js} +27 -33
- package/src/integrations/tests/{dynamodb.spec.ts → dynamodb.spec.js} +41 -45
- package/src/integrations/tests/{elasticsearch.spec.ts → elasticsearch.spec.js} +21 -22
- package/src/integrations/tests/{firebase.spec.ts → firebase.spec.js} +28 -33
- package/src/integrations/tests/{microsoftSqlServer.spec.ts → microsoftSqlServer.spec.js} +11 -12
- package/src/integrations/tests/{mongo.spec.ts → mongo.spec.js} +35 -46
- package/src/integrations/tests/{mysql.spec.ts → mysql.spec.js} +15 -17
- package/src/integrations/tests/{oracle.spec.ts → oracle.spec.js} +17 -19
- package/src/integrations/tests/{postgres.spec.ts → postgres.spec.js} +17 -19
- package/src/integrations/tests/{redis.spec.ts → redis.spec.js} +18 -27
- package/src/integrations/tests/{rest.spec.ts → rest.spec.js} +14 -22
- package/src/integrations/tests/{s3.spec.ts → s3.spec.js} +8 -10
- package/src/integrations/tests/{sql.spec.ts → sql.spec.js} +177 -228
- package/src/middleware/currentapp.js +0 -2
- package/src/migrations/functions/backfill/global.ts +3 -0
- package/src/migrations/functions/developerQuota.ts +15 -0
- package/src/migrations/functions/publishedAppsQuota.ts +13 -0
- package/src/migrations/functions/usageQuotas/syncDevelopers.ts +19 -0
- package/src/migrations/functions/usageQuotas/syncPublishedApps.ts +21 -0
- package/src/migrations/index.ts +16 -0
- package/src/module.d.ts +0 -2
- package/src/tests/utilities/TestConfiguration.js +1 -1
- package/src/threads/query.ts +2 -2
- package/src/utilities/fileSystem/index.js +0 -130
- package/src/utilities/workerRequests.js +0 -8
- package/builder/assets/index.c9d3f9e8.js +0 -1005
- package/builder/assets/index.f1b70f52.css +0 -6
- package/dist/api/controllers/plugin/github.js +0 -69
- package/dist/api/controllers/plugin/index.js +0 -200
- package/dist/api/controllers/plugin/npm.js +0 -58
- package/dist/api/controllers/plugin/uploaders.js +0 -11
- package/dist/api/controllers/plugin/utils.js +0 -26
- package/dist/watch.js +0 -77
- package/dist/websocket.js +0 -22
- package/src/api/controllers/plugin/file.ts +0 -15
- package/src/api/controllers/plugin/github.ts +0 -75
- package/src/api/controllers/plugin/index.ts +0 -215
- package/src/api/controllers/plugin/npm.ts +0 -56
- package/src/api/controllers/plugin/uploaders.ts +0 -4
- package/src/api/controllers/plugin/url.ts +0 -12
- package/src/api/controllers/plugin/utils.ts +0 -19
- package/src/api/routes/plugin.ts +0 -14
- package/src/watch.ts +0 -38
- package/src/websocket.ts +0 -26
|
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.
|
|
15
|
+
exports.sync = exports.destroy = exports.revertClient = exports.updateClient = exports.update = exports.create = exports.fetchAppPackage = exports.fetchAppDefinition = exports.fetch = exports.getAppUrl = void 0;
|
|
16
16
|
const environment_1 = __importDefault(require("../../environment"));
|
|
17
17
|
const package_json_1 = __importDefault(require("../../../package.json"));
|
|
18
18
|
const staticViews_1 = require("../../db/views/staticViews");
|
|
@@ -353,7 +353,7 @@ const update = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
353
353
|
checkAppUrl(ctx, apps, url, ctx.params.appId);
|
|
354
354
|
ctx.request.body.url = url;
|
|
355
355
|
}
|
|
356
|
-
const app = yield
|
|
356
|
+
const app = yield updateAppPackage(ctx.request.body, ctx.params.appId);
|
|
357
357
|
yield backend_core_2.events.app.updated(app);
|
|
358
358
|
ctx.status = 200;
|
|
359
359
|
ctx.body = app;
|
|
@@ -375,7 +375,7 @@ const updateClient = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
375
375
|
version: updatedToVersion,
|
|
376
376
|
revertableVersion: currentVersion,
|
|
377
377
|
};
|
|
378
|
-
const app = yield
|
|
378
|
+
const app = yield updateAppPackage(appPackageUpdates, ctx.params.appId);
|
|
379
379
|
yield backend_core_2.events.app.versionUpdated(app, currentVersion, updatedToVersion);
|
|
380
380
|
ctx.status = 200;
|
|
381
381
|
ctx.body = app;
|
|
@@ -399,7 +399,7 @@ const revertClient = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
399
399
|
version: revertedToVersion,
|
|
400
400
|
revertableVersion: null,
|
|
401
401
|
};
|
|
402
|
-
const app = yield
|
|
402
|
+
const app = yield updateAppPackage(appPackageUpdates, ctx.params.appId);
|
|
403
403
|
yield backend_core_2.events.app.versionReverted(app, currentVersion, revertedToVersion);
|
|
404
404
|
ctx.status = 200;
|
|
405
405
|
ctx.body = app;
|
|
@@ -415,6 +415,7 @@ const destroyApp = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
415
415
|
const app = yield db.get(utils_1.DocumentType.APP_METADATA);
|
|
416
416
|
const result = yield db.destroy();
|
|
417
417
|
if (isUnpublish) {
|
|
418
|
+
yield pro_1.quotas.removePublishedApp();
|
|
418
419
|
yield backend_core_2.events.app.unpublished(app);
|
|
419
420
|
}
|
|
420
421
|
else {
|
|
@@ -526,7 +527,6 @@ const updateAppPackage = (appPackage, appId) => __awaiter(void 0, void 0, void 0
|
|
|
526
527
|
return newAppPackage;
|
|
527
528
|
}));
|
|
528
529
|
});
|
|
529
|
-
exports.updateAppPackage = updateAppPackage;
|
|
530
530
|
const migrateAppNavigation = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
531
531
|
const db = backend_core_1.context.getAppDB();
|
|
532
532
|
const existing = yield db.get(utils_1.DocumentType.APP_METADATA);
|
|
@@ -13,14 +13,6 @@ const { InternalTables } = require("../../db/utils");
|
|
|
13
13
|
const { getFullUser } = require("../../utilities/users");
|
|
14
14
|
const { BUILTIN_ROLE_IDS } = require("@budibase/backend-core/roles");
|
|
15
15
|
const { getAppDB, getAppId } = require("@budibase/backend-core/context");
|
|
16
|
-
/**
|
|
17
|
-
* Add the attributes that are session based to the current user.
|
|
18
|
-
*/
|
|
19
|
-
const addSessionAttributesToUser = ctx => {
|
|
20
|
-
if (ctx.user) {
|
|
21
|
-
ctx.body.license = ctx.user.license;
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
16
|
exports.fetchSelf = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
25
17
|
let userId = ctx.user.userId || ctx.user._id;
|
|
26
18
|
/* istanbul ignore next */
|
|
@@ -67,5 +59,4 @@ exports.fetchSelf = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
67
59
|
else {
|
|
68
60
|
ctx.body = user;
|
|
69
61
|
}
|
|
70
|
-
addSessionAttributesToUser(ctx);
|
|
71
62
|
});
|
|
@@ -8,10 +8,9 @@ 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 { DocumentType
|
|
11
|
+
const { DocumentType } = require("../../db/utils");
|
|
12
12
|
const { getComponentLibraryManifest } = require("../../utilities/fileSystem");
|
|
13
13
|
const { getAppDB } = require("@budibase/backend-core/context");
|
|
14
|
-
const { getGlobalDB } = require("@budibase/backend-core/tenancy");
|
|
15
14
|
exports.fetchAppComponentDefinitions = function (ctx) {
|
|
16
15
|
return __awaiter(this, void 0, void 0, function* () {
|
|
17
16
|
try {
|
|
@@ -36,18 +35,6 @@ exports.fetchAppComponentDefinitions = function (ctx) {
|
|
|
36
35
|
}
|
|
37
36
|
}
|
|
38
37
|
}
|
|
39
|
-
// Add custom components
|
|
40
|
-
const globalDB = getGlobalDB();
|
|
41
|
-
const response = yield globalDB.allDocs(getPluginParams(null, {
|
|
42
|
-
include_docs: true,
|
|
43
|
-
}));
|
|
44
|
-
response.rows
|
|
45
|
-
.map(row => row.doc)
|
|
46
|
-
.filter(plugin => plugin.schema.type === "component")
|
|
47
|
-
.forEach(plugin => {
|
|
48
|
-
const fullComponentName = `plugin/${plugin.name}`;
|
|
49
|
-
definitions[fullComponentName] = Object.assign({ component: fullComponentName }, plugin.schema.schema);
|
|
50
|
-
});
|
|
51
38
|
ctx.body = definitions;
|
|
52
39
|
}
|
|
53
40
|
catch (err) {
|
|
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
const { generateDatasourceID, getDatasourceParams, getQueryParams, DocumentType, BudibaseInternalDB, getTableParams, } = require("../../db/utils");
|
|
12
12
|
const { BuildSchemaErrors, InvalidColumns } = require("../../constants");
|
|
13
|
-
const {
|
|
13
|
+
const { integrations } = require("../../integrations");
|
|
14
14
|
const { getDatasourceAndQuery } = require("./row/utils");
|
|
15
15
|
const { invalidateDynamicVariables } = require("../../threads/utils");
|
|
16
16
|
const { getAppDB } = require("@budibase/backend-core/context");
|
|
@@ -41,21 +41,8 @@ exports.buildSchemaFromDb = function (ctx) {
|
|
|
41
41
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42
42
|
const db = getAppDB();
|
|
43
43
|
const datasource = yield db.get(ctx.params.datasourceId);
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
if (tablesFilter) {
|
|
47
|
-
if (!datasource.entities) {
|
|
48
|
-
datasource.entities = {};
|
|
49
|
-
}
|
|
50
|
-
for (let key in tables) {
|
|
51
|
-
if (tablesFilter.some(filter => filter.toLowerCase() === key.toLowerCase())) {
|
|
52
|
-
datasource.entities[key] = tables[key];
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
datasource.entities = tables;
|
|
58
|
-
}
|
|
44
|
+
const { tables, error } = yield buildSchemaHelper(datasource);
|
|
45
|
+
datasource.entities = tables;
|
|
59
46
|
const dbResp = yield db.put(datasource);
|
|
60
47
|
datasource._rev = dbResp.rev;
|
|
61
48
|
const response = { datasource };
|
|
@@ -109,7 +96,7 @@ exports.update = function (ctx) {
|
|
|
109
96
|
datasource._rev = response.rev;
|
|
110
97
|
// Drain connection pools when configuration is changed
|
|
111
98
|
if (datasource.source) {
|
|
112
|
-
const source =
|
|
99
|
+
const source = integrations[datasource.source];
|
|
113
100
|
if (source && source.pool) {
|
|
114
101
|
yield source.pool.end();
|
|
115
102
|
}
|
|
@@ -136,7 +123,7 @@ exports.save = function (ctx) {
|
|
|
136
123
|
datasource._rev = dbResp.rev;
|
|
137
124
|
// Drain connection pools when configuration is changed
|
|
138
125
|
if (datasource.source) {
|
|
139
|
-
const source =
|
|
126
|
+
const source = integrations[datasource.source];
|
|
140
127
|
if (source && source.pool) {
|
|
141
128
|
yield source.pool.end();
|
|
142
129
|
}
|
|
@@ -201,13 +188,13 @@ function updateError(error, newError, tables) {
|
|
|
201
188
|
return error;
|
|
202
189
|
}
|
|
203
190
|
const buildSchemaHelper = (datasource) => __awaiter(void 0, void 0, void 0, function* () {
|
|
204
|
-
|
|
205
|
-
const Connector = yield getIntegration(datasource.source);
|
|
191
|
+
const Connector = integrations[datasource.source];
|
|
206
192
|
// Connect to the DB and build the schema
|
|
207
193
|
const connector = new Connector(datasource.config);
|
|
208
194
|
yield connector.buildSchema(datasource._id, datasource.entities);
|
|
195
|
+
datasource.entities = connector.tables;
|
|
209
196
|
// make sure they all have a display name selected
|
|
210
|
-
for (let entity of Object.values(
|
|
197
|
+
for (let entity of Object.values(datasource.entities)) {
|
|
211
198
|
if (entity.primaryDisplay) {
|
|
212
199
|
continue;
|
|
213
200
|
}
|
|
@@ -19,6 +19,7 @@ const utils_1 = require("../../../db/utils");
|
|
|
19
19
|
const utils_2 = require("../../../automations/utils");
|
|
20
20
|
const cache_1 = require("@budibase/backend-core/cache");
|
|
21
21
|
const context_1 = require("@budibase/backend-core/context");
|
|
22
|
+
const pro_1 = require("@budibase/pro");
|
|
22
23
|
const backend_core_1 = require("@budibase/backend-core");
|
|
23
24
|
// the max time we can wait for an invalidation to complete before considering it failed
|
|
24
25
|
const MAX_PENDING_TIME_MS = 30 * 60000;
|
|
@@ -195,7 +196,13 @@ const _deployApp = function (ctx) {
|
|
|
195
196
|
deployment = yield storeDeploymentHistory(deployment);
|
|
196
197
|
console.log("Stored deployment history");
|
|
197
198
|
console.log("Deploying app...");
|
|
198
|
-
let app
|
|
199
|
+
let app;
|
|
200
|
+
if (yield isFirstDeploy()) {
|
|
201
|
+
app = yield pro_1.quotas.addPublishedApp(() => deployApp(deployment));
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
app = yield deployApp(deployment);
|
|
205
|
+
}
|
|
199
206
|
yield backend_core_1.events.app.published(app);
|
|
200
207
|
ctx.body = deployment;
|
|
201
208
|
});
|
|
@@ -8,14 +8,15 @@ 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 { cloneDeep } = require("lodash");
|
|
12
|
+
const { definitions } = require("../../integrations");
|
|
12
13
|
const { SourceName } = require("@budibase/types");
|
|
13
14
|
const googlesheets = require("../../integrations/googlesheets");
|
|
14
15
|
const { featureFlags } = require("@budibase/backend-core");
|
|
15
16
|
exports.fetch = function (ctx) {
|
|
16
17
|
return __awaiter(this, void 0, void 0, function* () {
|
|
17
18
|
ctx.status = 200;
|
|
18
|
-
const defs =
|
|
19
|
+
const defs = cloneDeep(definitions);
|
|
19
20
|
// for google sheets integration google verification
|
|
20
21
|
if (featureFlags.isEnabled(featureFlags.FeatureFlag.GOOGLE_SHEETS)) {
|
|
21
22
|
defs[SourceName.GOOGLE_SHEETS] = googlesheets.schema;
|
|
@@ -25,8 +26,7 @@ exports.fetch = function (ctx) {
|
|
|
25
26
|
};
|
|
26
27
|
exports.find = function (ctx) {
|
|
27
28
|
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
-
const defs = yield getDefinitions();
|
|
29
29
|
ctx.status = 200;
|
|
30
|
-
ctx.body =
|
|
30
|
+
ctx.body = definitions[ctx.params.type];
|
|
31
31
|
});
|
|
32
32
|
};
|
|
@@ -63,7 +63,7 @@ exports.save = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
63
63
|
});
|
|
64
64
|
});
|
|
65
65
|
exports.fetchView = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
66
|
-
// there are no views in external
|
|
66
|
+
// there are no views in external data sources, shouldn't ever be called
|
|
67
67
|
// for now just fetch
|
|
68
68
|
const split = ctx.params.viewName.split("all_");
|
|
69
69
|
ctx.params.tableId = split[1] ? split[1] : split[0];
|
|
@@ -8,12 +8,10 @@ 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 { getScreenParams, generateScreenID
|
|
11
|
+
const { getScreenParams, generateScreenID } = require("../../db/utils");
|
|
12
12
|
const { AccessController } = require("@budibase/backend-core/roles");
|
|
13
13
|
const { getAppDB } = require("@budibase/backend-core/context");
|
|
14
14
|
const { events } = require("@budibase/backend-core");
|
|
15
|
-
const { getGlobalDB } = require("@budibase/backend-core/tenancy");
|
|
16
|
-
const { updateAppPackage } = require("./application");
|
|
17
15
|
exports.fetch = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
18
16
|
const db = getAppDB();
|
|
19
17
|
const screens = (yield db.allDocs(getScreenParams(null, {
|
|
@@ -30,45 +28,11 @@ exports.save = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
30
28
|
eventFn = events.screen.created;
|
|
31
29
|
}
|
|
32
30
|
const response = yield db.put(screen);
|
|
33
|
-
// Find any custom components being used
|
|
34
|
-
let pluginNames = [];
|
|
35
|
-
let pluginAdded = false;
|
|
36
|
-
findPlugins(screen.props, pluginNames);
|
|
37
|
-
if (pluginNames.length) {
|
|
38
|
-
const globalDB = getGlobalDB();
|
|
39
|
-
const pluginsResponse = yield globalDB.allDocs(getPluginParams(null, {
|
|
40
|
-
include_docs: true,
|
|
41
|
-
}));
|
|
42
|
-
const requiredPlugins = pluginsResponse.rows
|
|
43
|
-
.map(row => row.doc)
|
|
44
|
-
.filter(plugin => {
|
|
45
|
-
return (plugin.schema.type === "component" &&
|
|
46
|
-
pluginNames.includes(`plugin/${plugin.name}`));
|
|
47
|
-
});
|
|
48
|
-
// Update the app metadata
|
|
49
|
-
const application = yield db.get(DocumentType.APP_METADATA);
|
|
50
|
-
let usedPlugins = application.usedPlugins || [];
|
|
51
|
-
requiredPlugins.forEach(plugin => {
|
|
52
|
-
if (!usedPlugins.find(x => x._id === plugin._id)) {
|
|
53
|
-
pluginAdded = true;
|
|
54
|
-
usedPlugins.push({
|
|
55
|
-
_id: plugin._id,
|
|
56
|
-
name: plugin.name,
|
|
57
|
-
version: plugin.version,
|
|
58
|
-
jsUrl: plugin.jsUrl,
|
|
59
|
-
hash: plugin.hash,
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
if (pluginAdded) {
|
|
64
|
-
yield updateAppPackage({ usedPlugins }, ctx.appId);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
31
|
if (eventFn) {
|
|
68
32
|
yield eventFn(screen);
|
|
69
33
|
}
|
|
70
34
|
ctx.message = `Screen ${screen.name} saved.`;
|
|
71
|
-
ctx.body = Object.assign(Object.assign({}, screen), { _id: response.id, _rev: response.rev
|
|
35
|
+
ctx.body = Object.assign(Object.assign({}, screen), { _id: response.id, _rev: response.rev });
|
|
72
36
|
});
|
|
73
37
|
exports.destroy = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
74
38
|
const db = getAppDB();
|
|
@@ -81,17 +45,3 @@ exports.destroy = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
81
45
|
};
|
|
82
46
|
ctx.status = 200;
|
|
83
47
|
});
|
|
84
|
-
const findPlugins = (component, foundPlugins) => {
|
|
85
|
-
if (!component) {
|
|
86
|
-
return;
|
|
87
|
-
}
|
|
88
|
-
if (component._component.startsWith("plugin")) {
|
|
89
|
-
if (!foundPlugins.includes(component._component)) {
|
|
90
|
-
foundPlugins.push(component._component);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
if (!component._children || !component._children.length) {
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
component._children.forEach(child => findPlugins(child, foundPlugins));
|
|
97
|
-
};
|
|
@@ -113,7 +113,6 @@ const serveApp = function (ctx) {
|
|
|
113
113
|
production: env.isProd(),
|
|
114
114
|
appId,
|
|
115
115
|
clientLibPath: clientLibraryPath(appId, appInfo.version, ctx),
|
|
116
|
-
usedPlugins: appInfo.usedPlugins,
|
|
117
116
|
});
|
|
118
117
|
const appHbs = loadHandlebarsFile(`${__dirname}/templates/app.hbs`);
|
|
119
118
|
ctx.body = yield processString(appHbs, {
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
export let favicon = ""
|
|
4
4
|
|
|
5
5
|
export let clientLibPath
|
|
6
|
-
export let usedPlugins
|
|
7
6
|
</script>
|
|
8
7
|
|
|
9
8
|
<svelte:head>
|
|
@@ -84,15 +83,6 @@
|
|
|
84
83
|
</script>
|
|
85
84
|
<script type="application/javascript" src={clientLibPath}>
|
|
86
85
|
</script>
|
|
87
|
-
<!-- Custom components need inserted after the core client library -->
|
|
88
|
-
<!-- But before loadBudibase is called -->
|
|
89
|
-
{#if usedPlugins?.length}
|
|
90
|
-
{#each usedPlugins as plugin}
|
|
91
|
-
<script
|
|
92
|
-
type="application/javascript"
|
|
93
|
-
src={`/plugins/${plugin.jsUrl}`}></script>
|
|
94
|
-
{/each}
|
|
95
|
-
{/if}
|
|
96
86
|
<script type="application/javascript">
|
|
97
87
|
if (window.loadBudibase) {
|
|
98
88
|
window.loadBudibase()
|
|
@@ -66,9 +66,7 @@
|
|
|
66
66
|
customTheme,
|
|
67
67
|
previewDevice,
|
|
68
68
|
navigation,
|
|
69
|
-
hiddenComponentIds
|
|
70
|
-
usedPlugins,
|
|
71
|
-
location
|
|
69
|
+
hiddenComponentIds
|
|
72
70
|
} = parsed
|
|
73
71
|
|
|
74
72
|
// Set some flags so the app knows we're in the builder
|
|
@@ -83,8 +81,6 @@
|
|
|
83
81
|
window["##BUDIBASE_PREVIEW_DEVICE##"] = previewDevice
|
|
84
82
|
window["##BUDIBASE_PREVIEW_NAVIGATION##"] = navigation
|
|
85
83
|
window["##BUDIBASE_HIDDEN_COMPONENT_IDS##"] = hiddenComponentIds
|
|
86
|
-
window["##BUDIBASE_USED_PLUGINS##"] = usedPlugins
|
|
87
|
-
window["##BUDIBASE_LOCATION##"] = location
|
|
88
84
|
|
|
89
85
|
// Initialise app
|
|
90
86
|
try {
|
package/dist/api/index.js
CHANGED
|
@@ -51,8 +51,8 @@ router
|
|
|
51
51
|
.use(buildTenancyMiddleware(null, null, {
|
|
52
52
|
noTenancyRequired: true,
|
|
53
53
|
}))
|
|
54
|
-
.use(pro.licensing())
|
|
55
54
|
.use(currentApp)
|
|
55
|
+
.use(pro.licensing())
|
|
56
56
|
.use(auditLog);
|
|
57
57
|
// error handling middleware
|
|
58
58
|
router.use((ctx, next) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -30,15 +30,14 @@ const router_1 = __importDefault(require("@koa/router"));
|
|
|
30
30
|
const controller = __importStar(require("../controllers/application"));
|
|
31
31
|
const authorized_1 = __importDefault(require("../../middleware/authorized"));
|
|
32
32
|
const permissions_1 = require("@budibase/backend-core/permissions");
|
|
33
|
-
const validators_1 = require("./utils/validators");
|
|
34
33
|
const router = new router_1.default();
|
|
35
34
|
router
|
|
36
35
|
.post("/api/applications/:appId/sync", (0, authorized_1.default)(permissions_1.BUILDER), controller.sync)
|
|
37
|
-
.post("/api/applications", (0, authorized_1.default)(permissions_1.BUILDER),
|
|
36
|
+
.post("/api/applications", (0, authorized_1.default)(permissions_1.BUILDER), controller.create)
|
|
38
37
|
.get("/api/applications/:appId/definition", controller.fetchAppDefinition)
|
|
39
38
|
.get("/api/applications", controller.fetch)
|
|
40
39
|
.get("/api/applications/:appId/appPackage", controller.fetchAppPackage)
|
|
41
|
-
.put("/api/applications/:appId", (0, authorized_1.default)(permissions_1.BUILDER),
|
|
40
|
+
.put("/api/applications/:appId", (0, authorized_1.default)(permissions_1.BUILDER), controller.update)
|
|
42
41
|
.post("/api/applications/:appId/client/update", (0, authorized_1.default)(permissions_1.BUILDER), controller.updateClient)
|
|
43
42
|
.post("/api/applications/:appId/client/revert", (0, authorized_1.default)(permissions_1.BUILDER), controller.revertClient)
|
|
44
43
|
.delete("/api/applications/:appId", (0, authorized_1.default)(permissions_1.BUILDER), controller.destroy);
|
package/dist/api/routes/index.js
CHANGED
|
@@ -30,7 +30,6 @@ const metadata_1 = __importDefault(require("./metadata"));
|
|
|
30
30
|
const dev_1 = __importDefault(require("./dev"));
|
|
31
31
|
const cloud_1 = __importDefault(require("./cloud"));
|
|
32
32
|
const migrations_1 = __importDefault(require("./migrations"));
|
|
33
|
-
const plugin_1 = __importDefault(require("./plugin"));
|
|
34
33
|
var static_1 = require("./static");
|
|
35
34
|
Object.defineProperty(exports, "staticRoutes", { enumerable: true, get: function () { return __importDefault(static_1).default; } });
|
|
36
35
|
var public_1 = require("./public");
|
|
@@ -64,5 +63,4 @@ exports.mainRoutes = [
|
|
|
64
63
|
table_1.default,
|
|
65
64
|
row_1.default,
|
|
66
65
|
migrations_1.default,
|
|
67
|
-
plugin_1.default,
|
|
68
66
|
];
|
|
@@ -137,7 +137,88 @@ read.push(new Endpoint_1.default("get", "/tables/:tableId/rows/:rowId", rows_1.d
|
|
|
137
137
|
* content:
|
|
138
138
|
* application/json:
|
|
139
139
|
* schema:
|
|
140
|
-
*
|
|
140
|
+
* type: object
|
|
141
|
+
* required:
|
|
142
|
+
* - query
|
|
143
|
+
* properties:
|
|
144
|
+
* query:
|
|
145
|
+
* type: object
|
|
146
|
+
* properties:
|
|
147
|
+
* allOr:
|
|
148
|
+
* type: boolean
|
|
149
|
+
* description: Specifies that a row should be returned if it satisfies
|
|
150
|
+
* any of the specified options, rather than requiring it to fulfill all
|
|
151
|
+
* the search parameters. This defaults to false, meaning AND logic will be used.
|
|
152
|
+
* string:
|
|
153
|
+
* type: object
|
|
154
|
+
* example:
|
|
155
|
+
* columnName1: value
|
|
156
|
+
* columnName2: value
|
|
157
|
+
* description: A map of field name to the string to search for,
|
|
158
|
+
* this will look for rows that have a value starting with the
|
|
159
|
+
* string value.
|
|
160
|
+
* additionalProperties:
|
|
161
|
+
* type: string
|
|
162
|
+
* description: The value to search for in the column.
|
|
163
|
+
* fuzzy:
|
|
164
|
+
* type: object
|
|
165
|
+
* description: A fuzzy search, only supported by internal tables.
|
|
166
|
+
* range:
|
|
167
|
+
* type: object
|
|
168
|
+
* description: Searches within a range, the format of this must be
|
|
169
|
+
* in the format of an object with a "low" and "high" property.
|
|
170
|
+
* example:
|
|
171
|
+
* columnName1: { low: 10, high: 20 }
|
|
172
|
+
* equal:
|
|
173
|
+
* type: object
|
|
174
|
+
* description: Searches for rows that have a column value that is
|
|
175
|
+
* exactly the value set.
|
|
176
|
+
* notEqual:
|
|
177
|
+
* type: object
|
|
178
|
+
* description: Searches for any row which does not contain the specified
|
|
179
|
+
* column value.
|
|
180
|
+
* empty:
|
|
181
|
+
* type: object
|
|
182
|
+
* description: Searches for rows which do not contain the specified column.
|
|
183
|
+
* The object should simply contain keys of the column names, these
|
|
184
|
+
* can map to any value.
|
|
185
|
+
* example:
|
|
186
|
+
* columnName1: ""
|
|
187
|
+
* notEmpty:
|
|
188
|
+
* type: object
|
|
189
|
+
* description: Searches for rows which have the specified column.
|
|
190
|
+
* oneOf:
|
|
191
|
+
* type: object
|
|
192
|
+
* description: Searches for rows which have a column value that is any
|
|
193
|
+
* of the specified values. The format of this must be columnName -> [value1, value2].
|
|
194
|
+
* paginate:
|
|
195
|
+
* type: boolean
|
|
196
|
+
* description: Enables pagination, by default this is disabled.
|
|
197
|
+
* bookmark:
|
|
198
|
+
* oneOf:
|
|
199
|
+
* - type: string
|
|
200
|
+
* - type: integer
|
|
201
|
+
* description: If retrieving another page, the bookmark from the previous request must be supplied.
|
|
202
|
+
* limit:
|
|
203
|
+
* type: integer
|
|
204
|
+
* description: The maximum number of rows to return, useful when paginating, for internal tables this
|
|
205
|
+
* will be limited to 1000, for SQL tables it will be 5000.
|
|
206
|
+
* sort:
|
|
207
|
+
* type: object
|
|
208
|
+
* description: A set of parameters describing the sort behaviour of the search.
|
|
209
|
+
* properties:
|
|
210
|
+
* order:
|
|
211
|
+
* type: string
|
|
212
|
+
* enum: [ascending, descending]
|
|
213
|
+
* description: The order of the sort, by default this is ascending.
|
|
214
|
+
* column:
|
|
215
|
+
* type: string
|
|
216
|
+
* description: The name of the column by which the rows will be sorted.
|
|
217
|
+
* type:
|
|
218
|
+
* type: string
|
|
219
|
+
* enum: [string, number]
|
|
220
|
+
* description: Defines whether the column should be treated as a string
|
|
221
|
+
* or as numbers when sorting.
|
|
141
222
|
* responses:
|
|
142
223
|
* 200:
|
|
143
224
|
* description: The response will contain an array of rows that match the search parameters.
|
|
@@ -28,7 +28,7 @@ const read = [], write = [];
|
|
|
28
28
|
* responses:
|
|
29
29
|
* 200:
|
|
30
30
|
* description: Returns the created table, including the ID which has been generated for it. This can be
|
|
31
|
-
* internal or external
|
|
31
|
+
* internal or external data sources.
|
|
32
32
|
* content:
|
|
33
33
|
* application/json:
|
|
34
34
|
* schema:
|
package/dist/api/routes/table.js
CHANGED
|
@@ -45,7 +45,7 @@ router
|
|
|
45
45
|
* @apiParam (Body) {string} [_rev] If updating an existing internal table then the revision must also be specified.
|
|
46
46
|
* @apiParam (Body) {string} type] This should either be "internal" or "external" depending on the table type -
|
|
47
47
|
* this will default to internal.
|
|
48
|
-
* @apiParam (Body) {string} [sourceId] If creating an external table then this should be set to the
|
|
48
|
+
* @apiParam (Body) {string} [sourceId] If creating an external table then this should be set to the data source ID. If
|
|
49
49
|
* building an internal table this does not need to be set, although it will be returned as "bb_internal".
|
|
50
50
|
* @apiParam (Body) {string} name The name of the table, this will be used in the UI. To rename the table simply
|
|
51
51
|
* supply the table structure to this endpoint with the name changed.
|
|
@@ -7,7 +7,6 @@ const Joi = require("joi");
|
|
|
7
7
|
const OPTIONAL_STRING = Joi.string().optional().allow(null).allow("");
|
|
8
8
|
const OPTIONAL_NUMBER = Joi.number().optional().allow(null);
|
|
9
9
|
const OPTIONAL_BOOLEAN = Joi.boolean().optional().allow(null);
|
|
10
|
-
const APP_NAME_REGEX = /^[\w\s]+$/;
|
|
11
10
|
exports.tableValidator = () => {
|
|
12
11
|
// prettier-ignore
|
|
13
12
|
return joiValidator.body(Joi.object({
|
|
@@ -191,29 +190,12 @@ exports.automationValidator = (existing = false) => {
|
|
|
191
190
|
}).required().unknown(true),
|
|
192
191
|
}).unknown(true));
|
|
193
192
|
};
|
|
194
|
-
exports.applicationValidator = (
|
|
193
|
+
exports.applicationValidator = () => {
|
|
195
194
|
// prettier-ignore
|
|
196
|
-
const base = {
|
|
197
|
-
_id: OPTIONAL_STRING,
|
|
198
|
-
_rev: OPTIONAL_STRING,
|
|
199
|
-
url: OPTIONAL_STRING,
|
|
200
|
-
template: Joi.object({
|
|
201
|
-
templateString: OPTIONAL_STRING,
|
|
202
|
-
})
|
|
203
|
-
};
|
|
204
|
-
const appNameValidator = Joi.string()
|
|
205
|
-
.pattern(new RegExp(APP_NAME_REGEX))
|
|
206
|
-
.error(new Error("App name must be letters, numbers and spaces only"));
|
|
207
|
-
if (opts.isCreate) {
|
|
208
|
-
base.name = appNameValidator.required();
|
|
209
|
-
}
|
|
210
|
-
else {
|
|
211
|
-
base.name = appNameValidator.optional();
|
|
212
|
-
}
|
|
213
195
|
return joiValidator.body(Joi.object({
|
|
214
196
|
_id: OPTIONAL_STRING,
|
|
215
197
|
_rev: OPTIONAL_STRING,
|
|
216
|
-
name:
|
|
198
|
+
name: Joi.string().required(),
|
|
217
199
|
url: OPTIONAL_STRING,
|
|
218
200
|
template: Joi.object({
|
|
219
201
|
templateString: OPTIONAL_STRING,
|
package/dist/app.js
CHANGED
|
@@ -60,13 +60,10 @@ const bullboard = require("./automations/bullboard");
|
|
|
60
60
|
const { logAlert } = require("@budibase/backend-core/logging");
|
|
61
61
|
const { pinoSettings } = require("@budibase/backend-core");
|
|
62
62
|
const { Thread } = require("./threads");
|
|
63
|
-
const fs = require("fs");
|
|
64
63
|
const redis_1 = __importDefault(require("./utilities/redis"));
|
|
65
64
|
const migrations = __importStar(require("./migrations"));
|
|
66
65
|
const backend_core_1 = require("@budibase/backend-core");
|
|
67
66
|
const workerRequests_1 = require("./utilities/workerRequests");
|
|
68
|
-
const watch_1 = require("./watch");
|
|
69
|
-
const websocket_1 = require("./websocket");
|
|
70
67
|
const app = new Koa();
|
|
71
68
|
// set up top level koa middleware
|
|
72
69
|
app.use(koaBody({
|
|
@@ -100,7 +97,6 @@ if (env.isProd()) {
|
|
|
100
97
|
}
|
|
101
98
|
const server = http.createServer(app.callback());
|
|
102
99
|
destroyable(server);
|
|
103
|
-
(0, websocket_1.initialise)(server);
|
|
104
100
|
let shuttingDown = false, errCode = 0;
|
|
105
101
|
server.on("close", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
106
102
|
// already in process
|
|
@@ -145,11 +141,7 @@ module.exports = server.listen(env.PORT || 0, () => __awaiter(void 0, void 0, vo
|
|
|
145
141
|
if (!((_a = checklist === null || checklist === void 0 ? void 0 : checklist.adminUser) === null || _a === void 0 ? void 0 : _a.checked)) {
|
|
146
142
|
try {
|
|
147
143
|
const tenantId = backend_core_1.tenancy.getTenantId();
|
|
148
|
-
|
|
149
|
-
// Need to set up an API key for automated integration tests
|
|
150
|
-
if (env.isTest()) {
|
|
151
|
-
yield (0, workerRequests_1.generateApiKey)(user._id);
|
|
152
|
-
}
|
|
144
|
+
yield (0, workerRequests_1.createAdminUser)(env.BB_ADMIN_USER_EMAIL, env.BB_ADMIN_USER_PASSWORD, tenantId);
|
|
153
145
|
console.log("Admin account automatically created for", env.BB_ADMIN_USER_EMAIL);
|
|
154
146
|
}
|
|
155
147
|
catch (e) {
|
|
@@ -158,13 +150,6 @@ module.exports = server.listen(env.PORT || 0, () => __awaiter(void 0, void 0, vo
|
|
|
158
150
|
}
|
|
159
151
|
}
|
|
160
152
|
}
|
|
161
|
-
// monitor plugin directory if required
|
|
162
|
-
if (env.SELF_HOSTED &&
|
|
163
|
-
!env.MULTI_TENANCY &&
|
|
164
|
-
env.PLUGINS_DIR &&
|
|
165
|
-
fs.existsSync(env.PLUGINS_DIR)) {
|
|
166
|
-
(0, watch_1.watch)();
|
|
167
|
-
}
|
|
168
153
|
// check for version updates
|
|
169
154
|
yield backend_core_1.installation.checkInstallVersion();
|
|
170
155
|
// done last - this will never complete
|
package/dist/db/utils.js
CHANGED
|
@@ -7,7 +7,7 @@ const AppStatus = {
|
|
|
7
7
|
ALL: "all",
|
|
8
8
|
DEPLOYED: "published",
|
|
9
9
|
};
|
|
10
|
-
const DocumentType = Object.assign(Object.assign({}, CoreDocTypes), { TABLE: "ta", ROW: "ro", USER: "us", AUTOMATION: "au", LINK: "li", WEBHOOK: "wh", INSTANCE: "inst", LAYOUT: "layout", SCREEN: "screen", DATASOURCE: "datasource", DATASOURCE_PLUS: "datasource_plus", QUERY: "query", DEPLOYMENTS: "deployments", METADATA: "metadata", MEM_VIEW: "view", USER_FLAG: "flag", AUTOMATION_METADATA: "meta_au"
|
|
10
|
+
const DocumentType = Object.assign(Object.assign({}, CoreDocTypes), { TABLE: "ta", ROW: "ro", USER: "us", AUTOMATION: "au", LINK: "li", WEBHOOK: "wh", INSTANCE: "inst", LAYOUT: "layout", SCREEN: "screen", DATASOURCE: "datasource", DATASOURCE_PLUS: "datasource_plus", QUERY: "query", DEPLOYMENTS: "deployments", METADATA: "metadata", MEM_VIEW: "view", USER_FLAG: "flag", AUTOMATION_METADATA: "meta_au" });
|
|
11
11
|
const InternalTables = {
|
|
12
12
|
USER_METADATA: "ta_users",
|
|
13
13
|
};
|
|
@@ -274,9 +274,6 @@ exports.generateMemoryViewID = viewName => {
|
|
|
274
274
|
exports.getMemoryViewParams = (otherProps = {}) => {
|
|
275
275
|
return getDocParams(DocumentType.MEM_VIEW, null, otherProps);
|
|
276
276
|
};
|
|
277
|
-
exports.generatePluginID = name => {
|
|
278
|
-
return `${DocumentType.PLUGIN}${SEPARATOR}${name}`;
|
|
279
|
-
};
|
|
280
277
|
/**
|
|
281
278
|
* This can be used with the db.allDocs to get a list of IDs
|
|
282
279
|
*/
|
|
@@ -286,9 +283,3 @@ exports.getMultiIDParams = ids => {
|
|
|
286
283
|
include_docs: true,
|
|
287
284
|
};
|
|
288
285
|
};
|
|
289
|
-
/**
|
|
290
|
-
* Gets parameters for retrieving automations, this is a utility function for the getDocParams function.
|
|
291
|
-
*/
|
|
292
|
-
exports.getPluginParams = (pluginId = null, otherProps = {}) => {
|
|
293
|
-
return getDocParams(DocumentType.PLUGIN, pluginId, otherProps);
|
|
294
|
-
};
|
package/dist/environment.js
CHANGED
|
@@ -64,7 +64,6 @@ module.exports = {
|
|
|
64
64
|
SQL_MAX_ROWS: process.env.SQL_MAX_ROWS,
|
|
65
65
|
BB_ADMIN_USER_EMAIL: process.env.BB_ADMIN_USER_EMAIL,
|
|
66
66
|
BB_ADMIN_USER_PASSWORD: process.env.BB_ADMIN_USER_PASSWORD,
|
|
67
|
-
PLUGINS_DIR: process.env.PLUGINS_DIR || "/plugins",
|
|
68
67
|
// flags
|
|
69
68
|
ALLOW_DEV_AUTOMATIONS: process.env.ALLOW_DEV_AUTOMATIONS,
|
|
70
69
|
DISABLE_THREADING: process.env.DISABLE_THREADING,
|