@budibase/server 2.5.6-alpha.9 → 2.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/builder/assets/index.56bca6f6.js +1817 -0
- package/builder/assets/index.7f9a008b.css +6 -0
- package/builder/index.html +2 -2
- package/dist/api/controllers/automation.js +7 -13
- package/dist/api/controllers/plugin/index.js +37 -6
- package/dist/api/controllers/table/utils.js +1 -2
- package/dist/api/controllers/user.js +83 -1
- package/dist/api/routes/index.js +0 -2
- package/dist/api/routes/user.js +1 -0
- package/dist/app.js +13 -4
- package/dist/automations/actions.js +6 -32
- package/dist/automations/index.js +2 -3
- package/dist/automations/steps/bash.js +6 -6
- package/dist/automations/steps/createRow.js +11 -11
- package/dist/automations/steps/delay.js +3 -3
- package/dist/automations/steps/deleteRow.js +8 -8
- package/dist/automations/steps/discord.js +8 -8
- package/dist/automations/steps/executeQuery.js +9 -9
- package/dist/automations/steps/executeScript.js +6 -6
- package/dist/automations/steps/filter.js +6 -6
- package/dist/automations/steps/integromat.js +10 -10
- package/dist/automations/steps/loop.js +9 -9
- package/dist/automations/steps/outgoingWebhook.js +10 -10
- package/dist/automations/steps/queryRows.js +14 -14
- package/dist/automations/steps/sendSmtpEmail.js +9 -9
- package/dist/automations/steps/serverLog.js +4 -4
- package/dist/automations/steps/slack.js +6 -6
- package/dist/automations/steps/updateRow.js +11 -11
- package/dist/automations/steps/zapier.js +9 -9
- package/dist/automations/triggerInfo/app.js +5 -5
- package/dist/automations/triggerInfo/cron.js +4 -4
- package/dist/automations/triggerInfo/rowDeleted.js +5 -5
- package/dist/automations/triggerInfo/rowSaved.js +7 -7
- package/dist/automations/triggerInfo/rowUpdated.js +7 -7
- package/dist/automations/triggerInfo/webhook.js +6 -6
- package/dist/elasticApm.js +14 -0
- package/dist/environment.js +1 -0
- package/dist/events/index.js +0 -3
- package/dist/integrations/index.js +3 -3
- package/dist/integrations/microsoftSqlServer.js +2 -5
- package/dist/integrations/mysql.js +3 -5
- package/dist/integrations/postgres.js +5 -7
- package/dist/integrations/redis.js +0 -7
- package/dist/integrations/rest.js +0 -4
- package/dist/migrations/functions/usageQuotas/syncApps.js +1 -1
- package/dist/migrations/functions/usageQuotas/syncRows.js +2 -1
- package/dist/package.json +15 -15
- package/dist/sdk/app/applications/sync.js +23 -117
- package/dist/sdk/index.js +0 -2
- package/dist/sdk/users/utils.js +4 -21
- package/dist/startup.js +28 -31
- package/dist/threads/automation.js +5 -16
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utilities/fileSystem/plugin.js +23 -33
- package/dist/utilities/global.js +12 -17
- package/dist/watch.js +2 -2
- package/dist/websocket.js +22 -0
- package/jest.config.ts +3 -3
- package/nodemon.json +3 -7
- package/package.json +16 -16
- package/scripts/dev/manage.js +0 -2
- package/scripts/integrations/mssql/data/entrypoint.sh +0 -1
- package/scripts/integrations/mssql/data/setup.sql +17 -17
- package/scripts/integrations/mysql/init.sql +1 -1
- package/scripts/integrations/postgres/init.sql +0 -1
- package/scripts/likeCypress.ts +35 -0
- package/src/api/controllers/automation.ts +6 -12
- package/src/api/controllers/plugin/index.ts +45 -8
- package/src/api/controllers/row/internal.ts +10 -9
- package/src/api/controllers/row/utils.ts +2 -2
- package/src/api/controllers/table/utils.ts +1 -2
- package/src/api/controllers/user.ts +96 -10
- package/src/api/routes/index.ts +0 -2
- package/src/api/routes/tests/automation.spec.js +4 -7
- package/src/api/routes/tests/user.spec.js +37 -48
- package/src/api/routes/user.ts +5 -0
- package/src/app.ts +15 -4
- package/src/automations/actions.ts +24 -56
- package/src/automations/index.ts +1 -1
- package/src/automations/steps/bash.ts +7 -10
- package/src/automations/steps/createRow.ts +12 -15
- package/src/automations/steps/delay.ts +4 -6
- package/src/automations/steps/deleteRow.ts +9 -12
- package/src/automations/steps/discord.ts +8 -10
- package/src/automations/steps/executeQuery.ts +10 -13
- package/src/automations/steps/executeScript.ts +7 -10
- package/src/automations/steps/filter.ts +6 -8
- package/src/automations/steps/integromat.ts +10 -12
- package/src/automations/steps/loop.ts +10 -16
- package/src/automations/steps/outgoingWebhook.ts +11 -14
- package/src/automations/steps/queryRows.ts +15 -18
- package/src/automations/steps/sendSmtpEmail.ts +9 -11
- package/src/automations/steps/serverLog.ts +4 -6
- package/src/automations/steps/slack.ts +6 -8
- package/src/automations/steps/updateRow.ts +12 -15
- package/src/automations/steps/zapier.ts +9 -11
- package/src/automations/tests/utilities/index.ts +2 -2
- package/src/automations/triggerInfo/app.ts +5 -8
- package/src/automations/triggerInfo/cron.ts +4 -7
- package/src/automations/triggerInfo/rowDeleted.ts +5 -8
- package/src/automations/triggerInfo/rowSaved.ts +7 -10
- package/src/automations/triggerInfo/rowUpdated.ts +7 -10
- package/src/automations/triggerInfo/webhook.ts +6 -9
- package/src/elasticApm.ts +10 -0
- package/src/environment.ts +1 -0
- package/src/events/index.ts +0 -1
- package/src/integrations/index.ts +3 -3
- package/src/integrations/microsoftSqlServer.ts +2 -5
- package/src/integrations/mysql.ts +3 -5
- package/src/integrations/postgres.ts +5 -7
- package/src/integrations/redis.ts +0 -8
- package/src/integrations/rest.ts +0 -3
- package/src/migrations/functions/usageQuotas/syncApps.ts +1 -1
- package/src/migrations/functions/usageQuotas/syncRows.ts +3 -2
- package/src/migrations/functions/usageQuotas/tests/syncRows.spec.ts +2 -2
- package/src/sdk/app/applications/sync.ts +22 -129
- package/src/sdk/index.ts +0 -2
- package/src/sdk/users/tests/utils.spec.ts +32 -1
- package/src/sdk/users/utils.ts +5 -23
- package/src/startup.ts +34 -36
- package/src/tests/jestEnv.ts +1 -0
- package/src/tests/jestSetup.ts +1 -0
- package/src/tests/logging.ts +34 -0
- package/src/tests/utilities/TestConfiguration.ts +0 -28
- package/src/tests/utilities/structures.ts +17 -25
- package/src/threads/automation.ts +6 -18
- package/src/utilities/fileSystem/plugin.ts +4 -13
- package/src/utilities/global.ts +16 -21
- package/src/watch.ts +2 -2
- package/src/websocket.ts +26 -0
- package/tsconfig.json +7 -1
- package/builder/assets/index.5c1a6913.js +0 -1776
- package/builder/assets/index.c0265b74.css +0 -6
- package/dist/api/controllers/ops.js +0 -40
- package/dist/api/routes/ops.js +0 -52
- package/dist/events/docUpdates/index.js +0 -17
- package/dist/events/docUpdates/processors.js +0 -18
- package/dist/events/docUpdates/syncUsers.js +0 -49
- package/dist/sdk/plugins/index.js +0 -27
- package/dist/sdk/plugins/plugins.js +0 -53
- package/dist/websockets/client.js +0 -14
- package/dist/websockets/grid.js +0 -60
- package/dist/websockets/index.js +0 -17
- package/dist/websockets/websocket.js +0 -78
- package/src/api/controllers/ops.ts +0 -32
- package/src/api/routes/ops.ts +0 -30
- package/src/events/docUpdates/index.ts +0 -1
- package/src/events/docUpdates/processors.ts +0 -14
- package/src/events/docUpdates/syncUsers.ts +0 -35
- package/src/sdk/app/applications/tests/sync.spec.ts +0 -137
- package/src/sdk/plugins/index.ts +0 -5
- package/src/sdk/plugins/plugins.ts +0 -41
- package/src/websockets/client.ts +0 -11
- package/src/websockets/grid.ts +0 -55
- package/src/websockets/index.ts +0 -14
- package/src/websockets/websocket.ts +0 -83
package/dist/sdk/users/utils.js
CHANGED
|
@@ -34,10 +34,6 @@ function combineMetadataAndUser(user, metadata) {
|
|
|
34
34
|
if (found) {
|
|
35
35
|
newDoc._rev = found._rev;
|
|
36
36
|
}
|
|
37
|
-
// clear fields that shouldn't be in metadata
|
|
38
|
-
delete newDoc.password;
|
|
39
|
-
delete newDoc.forceResetPassword;
|
|
40
|
-
delete newDoc.roles;
|
|
41
37
|
if (found == null || !(0, lodash_1.isEqual)(newDoc, found)) {
|
|
42
38
|
return Object.assign(Object.assign({}, found), newDoc);
|
|
43
39
|
}
|
|
@@ -57,9 +53,10 @@ function syncGlobalUsers() {
|
|
|
57
53
|
return __awaiter(this, void 0, void 0, function* () {
|
|
58
54
|
// sync user metadata
|
|
59
55
|
const db = backend_core_1.context.getAppDB();
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
56
|
+
const [users, metadata] = yield Promise.all([
|
|
57
|
+
(0, global_1.getGlobalUsers)(),
|
|
58
|
+
rawUserMetadata(),
|
|
59
|
+
]);
|
|
63
60
|
const toWrite = [];
|
|
64
61
|
for (let user of users) {
|
|
65
62
|
const combined = combineMetadataAndUser(user, metadata);
|
|
@@ -67,20 +64,6 @@ function syncGlobalUsers() {
|
|
|
67
64
|
toWrite.push(combined);
|
|
68
65
|
}
|
|
69
66
|
}
|
|
70
|
-
let foundEmails = [];
|
|
71
|
-
for (let data of metadata) {
|
|
72
|
-
if (!data._id) {
|
|
73
|
-
continue;
|
|
74
|
-
}
|
|
75
|
-
const alreadyExisting = data.email && foundEmails.indexOf(data.email) !== -1;
|
|
76
|
-
const globalId = (0, utils_1.getGlobalIDFromUserMetadataID)(data._id);
|
|
77
|
-
if (!users.find(user => user._id === globalId) || alreadyExisting) {
|
|
78
|
-
toWrite.push(Object.assign(Object.assign({}, data), { _deleted: true }));
|
|
79
|
-
}
|
|
80
|
-
if (data.email) {
|
|
81
|
-
foundEmails.push(data.email);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
67
|
yield db.bulkDocs(toWrite);
|
|
85
68
|
});
|
|
86
69
|
}
|
package/dist/startup.js
CHANGED
|
@@ -44,15 +44,17 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
44
44
|
const watch_1 = require("./watch");
|
|
45
45
|
const automations = __importStar(require("./automations"));
|
|
46
46
|
const fileSystem = __importStar(require("./utilities/fileSystem"));
|
|
47
|
-
const events_1 =
|
|
47
|
+
const events_1 = __importDefault(require("./events"));
|
|
48
48
|
const migrations = __importStar(require("./migrations"));
|
|
49
49
|
const bullboard = __importStar(require("./automations/bullboard"));
|
|
50
50
|
const pro = __importStar(require("@budibase/pro"));
|
|
51
51
|
const api = __importStar(require("./api"));
|
|
52
52
|
const sdk_1 = __importDefault(require("./sdk"));
|
|
53
|
+
const pino = require("koa-pino-logger");
|
|
53
54
|
let STARTUP_RAN = false;
|
|
54
55
|
function initRoutes(app) {
|
|
55
56
|
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
+
app.use(pino(backend_core_1.logging.pinoSettings()));
|
|
56
58
|
if (!environment_1.default.isTest()) {
|
|
57
59
|
const plugin = yield bullboard.init();
|
|
58
60
|
app.use(plugin);
|
|
@@ -77,10 +79,8 @@ function initPro() {
|
|
|
77
79
|
});
|
|
78
80
|
}
|
|
79
81
|
function shutdown(server) {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
server.destroy();
|
|
83
|
-
}
|
|
82
|
+
server.close();
|
|
83
|
+
server.destroy();
|
|
84
84
|
}
|
|
85
85
|
function startup(app, server) {
|
|
86
86
|
var _a;
|
|
@@ -96,7 +96,6 @@ function startup(app, server) {
|
|
|
96
96
|
events_1.default.emitPort(environment_1.default.PORT);
|
|
97
97
|
fileSystem.init();
|
|
98
98
|
yield redis.init();
|
|
99
|
-
(0, events_1.init)();
|
|
100
99
|
// run migrations on startup if not done via http
|
|
101
100
|
// not recommended in a clustered environment
|
|
102
101
|
if (!environment_1.default.HTTP_MIGRATIONS && !environment_1.default.isTest()) {
|
|
@@ -105,33 +104,10 @@ function startup(app, server) {
|
|
|
105
104
|
}
|
|
106
105
|
catch (e) {
|
|
107
106
|
backend_core_1.logging.logAlert("Error performing migrations. Exiting.", e);
|
|
108
|
-
shutdown(
|
|
107
|
+
shutdown();
|
|
109
108
|
}
|
|
110
109
|
}
|
|
111
|
-
// monitor plugin directory if required
|
|
112
|
-
if (environment_1.default.SELF_HOSTED &&
|
|
113
|
-
!environment_1.default.MULTI_TENANCY &&
|
|
114
|
-
environment_1.default.PLUGINS_DIR &&
|
|
115
|
-
fs_1.default.existsSync(environment_1.default.PLUGINS_DIR)) {
|
|
116
|
-
(0, watch_1.watch)();
|
|
117
|
-
}
|
|
118
|
-
// check for version updates
|
|
119
|
-
yield backend_core_1.installation.checkInstallVersion();
|
|
120
|
-
// get the references to the queue promises, don't await as
|
|
121
|
-
// they will never end, unless the processing stops
|
|
122
|
-
let queuePromises = [];
|
|
123
|
-
// configure events to use the pro audit log write
|
|
124
|
-
// can't integrate directly into backend-core due to cyclic issues
|
|
125
|
-
queuePromises.push(backend_core_1.events.processors.init(pro.sdk.auditLogs.write));
|
|
126
|
-
queuePromises.push(automations.init());
|
|
127
|
-
queuePromises.push(initPro());
|
|
128
|
-
if (app) {
|
|
129
|
-
// bring routes online as final step once everything ready
|
|
130
|
-
yield initRoutes(app);
|
|
131
|
-
}
|
|
132
110
|
// check and create admin user if required
|
|
133
|
-
// this must be run after the api has been initialised due to
|
|
134
|
-
// the app user sync
|
|
135
111
|
if (environment_1.default.SELF_HOSTED &&
|
|
136
112
|
!environment_1.default.MULTI_TENANCY &&
|
|
137
113
|
environment_1.default.BB_ADMIN_USER_EMAIL &&
|
|
@@ -149,10 +125,31 @@ function startup(app, server) {
|
|
|
149
125
|
}
|
|
150
126
|
catch (e) {
|
|
151
127
|
backend_core_1.logging.logAlert("Error creating initial admin user. Exiting.", e);
|
|
152
|
-
shutdown(
|
|
128
|
+
shutdown();
|
|
153
129
|
}
|
|
154
130
|
}
|
|
155
131
|
}
|
|
132
|
+
// monitor plugin directory if required
|
|
133
|
+
if (environment_1.default.SELF_HOSTED &&
|
|
134
|
+
!environment_1.default.MULTI_TENANCY &&
|
|
135
|
+
environment_1.default.PLUGINS_DIR &&
|
|
136
|
+
fs_1.default.existsSync(environment_1.default.PLUGINS_DIR)) {
|
|
137
|
+
(0, watch_1.watch)();
|
|
138
|
+
}
|
|
139
|
+
// check for version updates
|
|
140
|
+
yield backend_core_1.installation.checkInstallVersion();
|
|
141
|
+
// get the references to the queue promises, don't await as
|
|
142
|
+
// they will never end, unless the processing stops
|
|
143
|
+
let queuePromises = [];
|
|
144
|
+
// configure events to use the pro audit log write
|
|
145
|
+
// can't integrate directly into backend-core due to cyclic issues
|
|
146
|
+
queuePromises.push(backend_core_1.events.processors.init(pro.sdk.auditLogs.write));
|
|
147
|
+
queuePromises.push(automations.init());
|
|
148
|
+
queuePromises.push(initPro());
|
|
149
|
+
if (app) {
|
|
150
|
+
// bring routes online as final step once everything ready
|
|
151
|
+
yield initRoutes(app);
|
|
152
|
+
}
|
|
156
153
|
});
|
|
157
154
|
}
|
|
158
155
|
exports.startup = startup;
|
|
@@ -52,14 +52,14 @@ const string_templates_1 = require("@budibase/string-templates");
|
|
|
52
52
|
const fp_1 = require("lodash/fp");
|
|
53
53
|
const sdkUtils = __importStar(require("../sdk/utils"));
|
|
54
54
|
const environment_1 = __importDefault(require("../environment"));
|
|
55
|
-
const FILTER_STEP_ID = actions.
|
|
56
|
-
const LOOP_STEP_ID = actions.
|
|
55
|
+
const FILTER_STEP_ID = actions.ACTION_DEFINITIONS.FILTER.stepId;
|
|
56
|
+
const LOOP_STEP_ID = actions.ACTION_DEFINITIONS.LOOP.stepId;
|
|
57
57
|
const CRON_STEP_ID = triggerInfo_1.definitions.CRON.stepId;
|
|
58
58
|
const STOPPED_STATUS = { success: true, status: types_1.AutomationStatus.STOPPED };
|
|
59
59
|
function getLoopIterations(loopStep, input) {
|
|
60
60
|
const binding = automationUtils.typecastForLooping(loopStep, input);
|
|
61
|
-
if (!binding) {
|
|
62
|
-
return
|
|
61
|
+
if (!loopStep || !binding) {
|
|
62
|
+
return 1;
|
|
63
63
|
}
|
|
64
64
|
if (Array.isArray(binding)) {
|
|
65
65
|
return binding.length;
|
|
@@ -67,7 +67,7 @@ function getLoopIterations(loopStep, input) {
|
|
|
67
67
|
if (typeof binding === "string") {
|
|
68
68
|
return automationUtils.stringSplit(binding).length;
|
|
69
69
|
}
|
|
70
|
-
return
|
|
70
|
+
return 1;
|
|
71
71
|
}
|
|
72
72
|
/**
|
|
73
73
|
* The automation orchestrator is a class responsible for executing automations.
|
|
@@ -372,17 +372,6 @@ class Orchestrator {
|
|
|
372
372
|
}
|
|
373
373
|
}
|
|
374
374
|
}
|
|
375
|
-
if (loopStep && iterations === 0) {
|
|
376
|
-
loopStep = undefined;
|
|
377
|
-
this.executionOutput.steps.splice(loopStepNumber + 1, 0, {
|
|
378
|
-
id: step.id,
|
|
379
|
-
stepId: step.stepId,
|
|
380
|
-
outputs: { status: types_1.AutomationStatus.NO_ITERATIONS, success: true },
|
|
381
|
-
inputs: {},
|
|
382
|
-
});
|
|
383
|
-
this._context.steps.splice(loopStepNumber, 1);
|
|
384
|
-
iterations = 1;
|
|
385
|
-
}
|
|
386
375
|
// Delete the step after the loop step as it's irrelevant, since information is included
|
|
387
376
|
// in the loop step
|
|
388
377
|
if (wasLoopStep && !loopStep) {
|