@budibase/server 1.3.18 → 1.3.19-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__mocks__/mongodb.ts +1 -1
- package/builder/assets/{index.a70e216a.css → index.3850883f.css} +2 -2
- package/builder/assets/index.fdade753.js +995 -0
- package/builder/index.html +2 -4
- package/coverage/clover.xml +409 -361
- package/coverage/coverage-final.json +18 -18
- package/coverage/lcov-report/api/controllers/apikeys.js.html +1 -1
- package/coverage/lcov-report/api/controllers/auth.js.html +1 -1
- package/coverage/lcov-report/api/controllers/automation.js.html +1 -1
- package/coverage/lcov-report/api/controllers/backup.js.html +1 -1
- package/coverage/lcov-report/api/controllers/cloud.js.html +1 -1
- package/coverage/lcov-report/api/controllers/component.js.html +68 -11
- package/coverage/lcov-report/api/controllers/datasource.js.html +73 -34
- package/coverage/lcov-report/api/controllers/dev.js.html +1 -1
- package/coverage/lcov-report/api/controllers/index.html +38 -38
- 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 +207 -12
- 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 +12 -12
- 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 +5 -5
- package/coverage/lcov-report/api/routes/utils/validators.js.html +9 -6
- 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 +56 -20
- 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 +30 -30
- 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 +33 -33
- package/coverage/lcov-report/middleware/index.html +1 -1
- package/coverage/lcov-report/middleware/joi-validator.js.html +1 -1
- package/coverage/lcov-report/middleware/publicApi.js.html +1 -1
- package/coverage/lcov-report/middleware/resourceId.js.html +7 -7
- package/coverage/lcov-report/middleware/selfhost.js.html +1 -1
- package/coverage/lcov-report/middleware/utils.js.html +2 -2
- package/coverage/lcov-report/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 +1 -1
- 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 +1 -1
- package/coverage/lcov.info +725 -623
- package/dist/api/controllers/application.js +5 -4
- package/dist/api/controllers/component.js +14 -1
- package/dist/api/controllers/datasource.js +21 -8
- package/dist/api/controllers/integration.js +4 -4
- package/dist/api/controllers/plugin/file.js +24 -0
- package/dist/api/controllers/plugin/github.js +69 -0
- package/dist/api/controllers/plugin/index.js +197 -0
- package/dist/api/controllers/plugin/npm.js +58 -0
- package/dist/api/controllers/plugin/uploaders.js +11 -0
- package/dist/api/controllers/plugin/url.js +24 -0
- package/dist/api/controllers/plugin/utils.js +26 -0
- package/dist/api/controllers/row/external.js +1 -1
- package/dist/api/controllers/screen.js +52 -2
- package/dist/api/controllers/static/index.js +1 -0
- package/dist/api/controllers/static/templates/BudibaseApp.svelte +10 -0
- package/dist/api/controllers/static/templates/preview.hbs +5 -1
- package/dist/api/routes/application.js +3 -2
- package/dist/api/routes/index.js +2 -0
- package/dist/api/routes/plugin.js +39 -0
- 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 -1
- package/dist/app.js +11 -0
- package/dist/db/utils.js +10 -1
- package/dist/environment.js +1 -0
- package/dist/integrations/airtable.js +126 -129
- package/dist/integrations/arangodb.js +86 -89
- package/dist/integrations/base/query.js +2 -2
- package/dist/integrations/base/sqlTable.js +3 -1
- package/dist/integrations/couchdb.js +80 -83
- package/dist/integrations/dynamodb.js +161 -164
- package/dist/integrations/elasticsearch.js +135 -138
- package/dist/integrations/firebase.js +154 -157
- package/dist/integrations/googlesheets.js +323 -327
- package/dist/integrations/index.js +99 -51
- package/dist/integrations/microsoftSqlServer.js +240 -243
- package/dist/integrations/mongodb.js +239 -242
- package/dist/integrations/mysql.js +215 -219
- package/dist/integrations/oracle.js +318 -322
- package/dist/integrations/postgres.js +262 -265
- package/dist/integrations/redis.js +134 -139
- package/dist/integrations/rest.js +289 -292
- package/dist/integrations/s3.js +61 -64
- package/dist/integrations/snowflake.js +83 -86
- package/dist/package.json +9 -6
- 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 +110 -1
- package/dist/watch.js +77 -0
- package/dist/websocket.js +22 -0
- package/package.json +10 -7
- package/scripts/dev/manage.js +1 -0
- package/specs/openapi.json +3 -3
- package/specs/openapi.yaml +3 -3
- package/specs/resources/query.js +1 -1
- package/src/api/controllers/application.ts +1 -1
- package/src/api/controllers/component.js +21 -2
- package/src/api/controllers/datasource.js +21 -8
- package/src/api/controllers/integration.js +4 -4
- package/src/api/controllers/plugin/file.ts +15 -0
- package/src/api/controllers/plugin/github.ts +75 -0
- package/src/api/controllers/plugin/index.ts +212 -0
- package/src/api/controllers/plugin/npm.ts +56 -0
- package/src/api/controllers/plugin/uploaders.ts +4 -0
- package/src/api/controllers/plugin/url.ts +12 -0
- package/src/api/controllers/plugin/utils.ts +19 -0
- package/src/api/controllers/row/external.js +1 -1
- package/src/api/controllers/screen.js +66 -1
- package/src/api/controllers/static/index.ts +1 -0
- package/src/api/controllers/static/templates/BudibaseApp.svelte +10 -0
- package/src/api/controllers/static/templates/preview.hbs +5 -1
- package/src/api/routes/application.ts +13 -2
- package/src/api/routes/index.ts +2 -0
- package/src/api/routes/plugin.ts +14 -0
- 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 +8 -25
- package/src/api/routes/utils/validators.js +2 -1
- package/src/app.ts +14 -0
- package/src/db/utils.js +12 -0
- package/src/definitions/openapi.ts +3 -3
- package/src/environment.js +1 -0
- package/src/integrations/airtable.ts +116 -118
- package/src/integrations/arangodb.ts +87 -89
- package/src/integrations/base/query.ts +2 -2
- package/src/integrations/base/sqlTable.ts +3 -1
- package/src/integrations/couchdb.ts +83 -89
- package/src/integrations/dynamodb.ts +173 -175
- package/src/integrations/elasticsearch.ts +120 -122
- package/src/integrations/firebase.ts +157 -159
- package/src/integrations/googlesheets.ts +328 -338
- package/src/integrations/index.ts +64 -21
- package/src/integrations/microsoftSqlServer.ts +249 -251
- package/src/integrations/mongodb.ts +261 -258
- package/src/integrations/mysql.ts +229 -234
- package/src/integrations/oracle.ts +373 -380
- package/src/integrations/postgres.ts +264 -268
- package/src/integrations/redis.ts +128 -132
- package/src/integrations/rest.ts +324 -329
- package/src/integrations/s3.ts +68 -71
- package/src/integrations/snowflake.ts +80 -82
- package/src/integrations/tests/{airtable.spec.js → airtable.spec.ts} +21 -18
- package/src/integrations/tests/{arangodb.spec.js → arangodb.spec.ts} +12 -9
- package/src/integrations/tests/{couchdb.spec.js → couchdb.spec.ts} +33 -27
- package/src/integrations/tests/{dynamodb.spec.js → dynamodb.spec.ts} +45 -41
- package/src/integrations/tests/{elasticsearch.spec.js → elasticsearch.spec.ts} +22 -21
- package/src/integrations/tests/{firebase.spec.js → firebase.spec.ts} +33 -28
- package/src/integrations/tests/{microsoftSqlServer.spec.js → microsoftSqlServer.spec.ts} +12 -11
- package/src/integrations/tests/{mongo.spec.js → mongo.spec.ts} +46 -35
- package/src/integrations/tests/{mysql.spec.js → mysql.spec.ts} +17 -15
- package/src/integrations/tests/{oracle.spec.js → oracle.spec.ts} +19 -17
- package/src/integrations/tests/{postgres.spec.js → postgres.spec.ts} +19 -17
- package/src/integrations/tests/{redis.spec.js → redis.spec.ts} +27 -18
- package/src/integrations/tests/{rest.spec.js → rest.spec.ts} +22 -14
- package/src/integrations/tests/{s3.spec.js → s3.spec.ts} +10 -8
- package/src/integrations/tests/{sql.spec.js → sql.spec.ts} +228 -177
- package/src/module.d.ts +2 -0
- package/src/tests/utilities/TestConfiguration.js +1 -1
- package/src/threads/query.ts +2 -2
- package/src/utilities/fileSystem/index.js +129 -0
- package/src/watch.ts +38 -0
- package/src/websocket.ts +26 -0
- package/builder/assets/index.a934251d.js +0 -876
- package/builder/assets/vendor.5e1fe644.css +0 -1
- package/builder/assets/vendor.67dbd8fa.js +0 -248
|
@@ -8,10 +8,12 @@ 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 } = require("../../db/utils");
|
|
11
|
+
const { getScreenParams, generateScreenID, getPluginParams, DocumentType, } = 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");
|
|
15
17
|
exports.fetch = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
18
|
const db = getAppDB();
|
|
17
19
|
const screens = (yield db.allDocs(getScreenParams(null, {
|
|
@@ -28,11 +30,45 @@ exports.save = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
28
30
|
eventFn = events.screen.created;
|
|
29
31
|
}
|
|
30
32
|
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
|
+
}
|
|
31
67
|
if (eventFn) {
|
|
32
68
|
yield eventFn(screen);
|
|
33
69
|
}
|
|
34
70
|
ctx.message = `Screen ${screen.name} saved.`;
|
|
35
|
-
ctx.body = Object.assign(Object.assign({}, screen), { _id: response.id, _rev: response.rev });
|
|
71
|
+
ctx.body = Object.assign(Object.assign({}, screen), { _id: response.id, _rev: response.rev, pluginAdded });
|
|
36
72
|
});
|
|
37
73
|
exports.destroy = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
38
74
|
const db = getAppDB();
|
|
@@ -45,3 +81,17 @@ exports.destroy = (ctx) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
45
81
|
};
|
|
46
82
|
ctx.status = 200;
|
|
47
83
|
});
|
|
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,6 +113,7 @@ const serveApp = function (ctx) {
|
|
|
113
113
|
production: env.isProd(),
|
|
114
114
|
appId,
|
|
115
115
|
clientLibPath: clientLibraryPath(appId, appInfo.version, ctx),
|
|
116
|
+
usedPlugins: appInfo.usedPlugins,
|
|
116
117
|
});
|
|
117
118
|
const appHbs = loadHandlebarsFile(`${__dirname}/templates/app.hbs`);
|
|
118
119
|
ctx.body = yield processString(appHbs, {
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
export let favicon = ""
|
|
4
4
|
|
|
5
5
|
export let clientLibPath
|
|
6
|
+
export let usedPlugins
|
|
6
7
|
</script>
|
|
7
8
|
|
|
8
9
|
<svelte:head>
|
|
@@ -83,6 +84,15 @@
|
|
|
83
84
|
</script>
|
|
84
85
|
<script type="application/javascript" src={clientLibPath}>
|
|
85
86
|
</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}
|
|
86
96
|
<script type="application/javascript">
|
|
87
97
|
if (window.loadBudibase) {
|
|
88
98
|
window.loadBudibase()
|
|
@@ -66,7 +66,9 @@
|
|
|
66
66
|
customTheme,
|
|
67
67
|
previewDevice,
|
|
68
68
|
navigation,
|
|
69
|
-
hiddenComponentIds
|
|
69
|
+
hiddenComponentIds,
|
|
70
|
+
usedPlugins,
|
|
71
|
+
location
|
|
70
72
|
} = parsed
|
|
71
73
|
|
|
72
74
|
// Set some flags so the app knows we're in the builder
|
|
@@ -81,6 +83,8 @@
|
|
|
81
83
|
window["##BUDIBASE_PREVIEW_DEVICE##"] = previewDevice
|
|
82
84
|
window["##BUDIBASE_PREVIEW_NAVIGATION##"] = navigation
|
|
83
85
|
window["##BUDIBASE_HIDDEN_COMPONENT_IDS##"] = hiddenComponentIds
|
|
86
|
+
window["##BUDIBASE_USED_PLUGINS##"] = usedPlugins
|
|
87
|
+
window["##BUDIBASE_LOCATION##"] = location
|
|
84
88
|
|
|
85
89
|
// Initialise app
|
|
86
90
|
try {
|
|
@@ -30,14 +30,15 @@ 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");
|
|
33
34
|
const router = new router_1.default();
|
|
34
35
|
router
|
|
35
36
|
.post("/api/applications/:appId/sync", (0, authorized_1.default)(permissions_1.BUILDER), controller.sync)
|
|
36
|
-
.post("/api/applications", (0, authorized_1.default)(permissions_1.BUILDER), controller.create)
|
|
37
|
+
.post("/api/applications", (0, authorized_1.default)(permissions_1.BUILDER), (0, validators_1.applicationValidator)(), controller.create)
|
|
37
38
|
.get("/api/applications/:appId/definition", controller.fetchAppDefinition)
|
|
38
39
|
.get("/api/applications", controller.fetch)
|
|
39
40
|
.get("/api/applications/:appId/appPackage", controller.fetchAppPackage)
|
|
40
|
-
.put("/api/applications/:appId", (0, authorized_1.default)(permissions_1.BUILDER), controller.update)
|
|
41
|
+
.put("/api/applications/:appId", (0, authorized_1.default)(permissions_1.BUILDER), (0, validators_1.applicationValidator)(), controller.update)
|
|
41
42
|
.post("/api/applications/:appId/client/update", (0, authorized_1.default)(permissions_1.BUILDER), controller.updateClient)
|
|
42
43
|
.post("/api/applications/:appId/client/revert", (0, authorized_1.default)(permissions_1.BUILDER), controller.revertClient)
|
|
43
44
|
.delete("/api/applications/:appId", (0, authorized_1.default)(permissions_1.BUILDER), controller.destroy);
|
package/dist/api/routes/index.js
CHANGED
|
@@ -30,6 +30,7 @@ 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"));
|
|
33
34
|
var static_1 = require("./static");
|
|
34
35
|
Object.defineProperty(exports, "staticRoutes", { enumerable: true, get: function () { return __importDefault(static_1).default; } });
|
|
35
36
|
var public_1 = require("./public");
|
|
@@ -63,4 +64,5 @@ exports.mainRoutes = [
|
|
|
63
64
|
table_1.default,
|
|
64
65
|
row_1.default,
|
|
65
66
|
migrations_1.default,
|
|
67
|
+
plugin_1.default,
|
|
66
68
|
];
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const router_1 = __importDefault(require("@koa/router"));
|
|
30
|
+
const controller = __importStar(require("../controllers/plugin"));
|
|
31
|
+
const authorized_1 = __importDefault(require("../../middleware/authorized"));
|
|
32
|
+
const permissions_1 = require("@budibase/backend-core/permissions");
|
|
33
|
+
const router = new router_1.default();
|
|
34
|
+
router
|
|
35
|
+
.post("/api/plugin/upload", (0, authorized_1.default)(permissions_1.BUILDER), controller.upload)
|
|
36
|
+
.post("/api/plugin", (0, authorized_1.default)(permissions_1.BUILDER), controller.create)
|
|
37
|
+
.get("/api/plugin", (0, authorized_1.default)(permissions_1.BUILDER), controller.fetch)
|
|
38
|
+
.delete("/api/plugin/:pluginId", (0, authorized_1.default)(permissions_1.BUILDER), controller.destroy);
|
|
39
|
+
exports.default = router;
|
|
@@ -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 datasources.
|
|
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 datasource 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,6 +7,7 @@ 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]+$/;
|
|
10
11
|
exports.tableValidator = () => {
|
|
11
12
|
// prettier-ignore
|
|
12
13
|
return joiValidator.body(Joi.object({
|
|
@@ -195,7 +196,7 @@ exports.applicationValidator = () => {
|
|
|
195
196
|
return joiValidator.body(Joi.object({
|
|
196
197
|
_id: OPTIONAL_STRING,
|
|
197
198
|
_rev: OPTIONAL_STRING,
|
|
198
|
-
name: Joi.string().required(),
|
|
199
|
+
name: Joi.string().pattern(new RegExp(APP_NAME_REGEX)).required().error(new Error('App name must be letters, numbers and spaces only')),
|
|
199
200
|
url: OPTIONAL_STRING,
|
|
200
201
|
template: Joi.object({
|
|
201
202
|
templateString: OPTIONAL_STRING,
|
package/dist/app.js
CHANGED
|
@@ -60,10 +60,13 @@ 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");
|
|
63
64
|
const redis_1 = __importDefault(require("./utilities/redis"));
|
|
64
65
|
const migrations = __importStar(require("./migrations"));
|
|
65
66
|
const backend_core_1 = require("@budibase/backend-core");
|
|
66
67
|
const workerRequests_1 = require("./utilities/workerRequests");
|
|
68
|
+
const watch_1 = require("./watch");
|
|
69
|
+
const websocket_1 = require("./websocket");
|
|
67
70
|
const app = new Koa();
|
|
68
71
|
// set up top level koa middleware
|
|
69
72
|
app.use(koaBody({
|
|
@@ -97,6 +100,7 @@ if (env.isProd()) {
|
|
|
97
100
|
}
|
|
98
101
|
const server = http.createServer(app.callback());
|
|
99
102
|
destroyable(server);
|
|
103
|
+
(0, websocket_1.initialise)(server);
|
|
100
104
|
let shuttingDown = false, errCode = 0;
|
|
101
105
|
server.on("close", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
102
106
|
// already in process
|
|
@@ -150,6 +154,13 @@ module.exports = server.listen(env.PORT || 0, () => __awaiter(void 0, void 0, vo
|
|
|
150
154
|
}
|
|
151
155
|
}
|
|
152
156
|
}
|
|
157
|
+
// monitor plugin directory if required
|
|
158
|
+
if (env.SELF_HOSTED &&
|
|
159
|
+
!env.MULTI_TENANCY &&
|
|
160
|
+
env.PLUGINS_DIR &&
|
|
161
|
+
fs.existsSync(env.PLUGINS_DIR)) {
|
|
162
|
+
(0, watch_1.watch)();
|
|
163
|
+
}
|
|
153
164
|
// check for version updates
|
|
154
165
|
yield backend_core_1.installation.checkInstallVersion();
|
|
155
166
|
// 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", PLUGIN: "plg" });
|
|
11
11
|
const InternalTables = {
|
|
12
12
|
USER_METADATA: "ta_users",
|
|
13
13
|
};
|
|
@@ -274,6 +274,9 @@ 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
|
+
};
|
|
277
280
|
/**
|
|
278
281
|
* This can be used with the db.allDocs to get a list of IDs
|
|
279
282
|
*/
|
|
@@ -283,3 +286,9 @@ exports.getMultiIDParams = ids => {
|
|
|
283
286
|
include_docs: true,
|
|
284
287
|
};
|
|
285
288
|
};
|
|
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,6 +64,7 @@ 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",
|
|
67
68
|
// flags
|
|
68
69
|
ALLOW_DEV_AUTOMATIONS: process.env.ALLOW_DEV_AUTOMATIONS,
|
|
69
70
|
DISABLE_THREADING: process.env.DISABLE_THREADING,
|
|
@@ -10,141 +10,138 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
const types_1 = require("@budibase/types");
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
default: "enter api key",
|
|
25
|
-
required: true,
|
|
26
|
-
},
|
|
27
|
-
base: {
|
|
28
|
-
type: types_1.DatasourceFieldType.STRING,
|
|
29
|
-
default: "mybase",
|
|
30
|
-
required: true,
|
|
31
|
-
},
|
|
13
|
+
const Airtable = require("airtable");
|
|
14
|
+
const SCHEMA = {
|
|
15
|
+
docs: "https://airtable.com/api",
|
|
16
|
+
description: "Airtable is a spreadsheet-database hybrid, with the features of a database but applied to a spreadsheet.",
|
|
17
|
+
friendlyName: "Airtable",
|
|
18
|
+
type: "Spreadsheet",
|
|
19
|
+
datasource: {
|
|
20
|
+
apiKey: {
|
|
21
|
+
type: types_1.DatasourceFieldType.PASSWORD,
|
|
22
|
+
default: "enter api key",
|
|
23
|
+
required: true,
|
|
32
24
|
},
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
25
|
+
base: {
|
|
26
|
+
type: types_1.DatasourceFieldType.STRING,
|
|
27
|
+
default: "mybase",
|
|
28
|
+
required: true,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
query: {
|
|
32
|
+
create: {
|
|
33
|
+
type: types_1.QueryType.FIELDS,
|
|
34
|
+
customisable: true,
|
|
35
|
+
fields: {
|
|
36
|
+
table: {
|
|
37
|
+
type: types_1.DatasourceFieldType.STRING,
|
|
38
|
+
required: true,
|
|
42
39
|
},
|
|
43
40
|
},
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
view: {
|
|
52
|
-
type: types_1.DatasourceFieldType.STRING,
|
|
53
|
-
required: true,
|
|
54
|
-
},
|
|
55
|
-
numRecords: {
|
|
56
|
-
type: types_1.DatasourceFieldType.NUMBER,
|
|
57
|
-
default: 10,
|
|
58
|
-
},
|
|
41
|
+
},
|
|
42
|
+
read: {
|
|
43
|
+
type: types_1.QueryType.FIELDS,
|
|
44
|
+
fields: {
|
|
45
|
+
table: {
|
|
46
|
+
type: types_1.DatasourceFieldType.STRING,
|
|
47
|
+
required: true,
|
|
59
48
|
},
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
type: types_1.DatasourceFieldType.STRING,
|
|
68
|
-
required: true,
|
|
69
|
-
},
|
|
70
|
-
table: {
|
|
71
|
-
type: types_1.DatasourceFieldType.STRING,
|
|
72
|
-
required: true,
|
|
73
|
-
},
|
|
49
|
+
view: {
|
|
50
|
+
type: types_1.DatasourceFieldType.STRING,
|
|
51
|
+
required: true,
|
|
52
|
+
},
|
|
53
|
+
numRecords: {
|
|
54
|
+
type: types_1.DatasourceFieldType.NUMBER,
|
|
55
|
+
default: 10,
|
|
74
56
|
},
|
|
75
57
|
},
|
|
76
|
-
|
|
77
|
-
|
|
58
|
+
},
|
|
59
|
+
update: {
|
|
60
|
+
type: types_1.QueryType.FIELDS,
|
|
61
|
+
customisable: true,
|
|
62
|
+
fields: {
|
|
63
|
+
id: {
|
|
64
|
+
display: "Record ID",
|
|
65
|
+
type: types_1.DatasourceFieldType.STRING,
|
|
66
|
+
required: true,
|
|
67
|
+
},
|
|
68
|
+
table: {
|
|
69
|
+
type: types_1.DatasourceFieldType.STRING,
|
|
70
|
+
required: true,
|
|
71
|
+
},
|
|
78
72
|
},
|
|
79
73
|
},
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
74
|
+
delete: {
|
|
75
|
+
type: types_1.QueryType.JSON,
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
class AirtableIntegration {
|
|
80
|
+
constructor(config) {
|
|
81
|
+
this.config = config;
|
|
82
|
+
this.client = new Airtable(config).base(config.base);
|
|
83
|
+
}
|
|
84
|
+
create(query) {
|
|
85
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
86
|
+
const { table, json } = query;
|
|
87
|
+
try {
|
|
88
|
+
return yield this.client(table).create([
|
|
89
|
+
{
|
|
90
|
+
fields: json,
|
|
91
|
+
},
|
|
92
|
+
]);
|
|
93
|
+
}
|
|
94
|
+
catch (err) {
|
|
95
|
+
console.error("Error writing to airtable", err);
|
|
96
|
+
throw err;
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
read(query) {
|
|
101
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
102
|
+
try {
|
|
103
|
+
const records = yield this.client(query.table)
|
|
104
|
+
.select({ maxRecords: query.numRecords || 10, view: query.view })
|
|
105
|
+
.firstPage();
|
|
106
|
+
// @ts-ignore
|
|
107
|
+
return records.map(({ fields }) => fields);
|
|
108
|
+
}
|
|
109
|
+
catch (err) {
|
|
110
|
+
console.error("Error writing to airtable", err);
|
|
111
|
+
return [];
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
update(query) {
|
|
116
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
117
|
+
const { table, id, json } = query;
|
|
118
|
+
try {
|
|
119
|
+
return yield this.client(table).update([
|
|
120
|
+
{
|
|
121
|
+
id,
|
|
122
|
+
fields: json,
|
|
123
|
+
},
|
|
124
|
+
]);
|
|
125
|
+
}
|
|
126
|
+
catch (err) {
|
|
127
|
+
console.error("Error writing to airtable", err);
|
|
128
|
+
throw err;
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
delete(query) {
|
|
133
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
134
|
+
try {
|
|
135
|
+
return yield this.client(query.table).destroy(query.ids);
|
|
136
|
+
}
|
|
137
|
+
catch (err) {
|
|
138
|
+
console.error("Error writing to airtable", err);
|
|
139
|
+
throw err;
|
|
140
|
+
}
|
|
141
|
+
});
|
|
145
142
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}
|
|
143
|
+
}
|
|
144
|
+
exports.default = {
|
|
145
|
+
schema: SCHEMA,
|
|
146
|
+
integration: AirtableIntegration,
|
|
147
|
+
};
|