@budibase/server 1.0.219-alpha.7 → 1.0.219
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__/node-fetch.ts +0 -9
- package/builder/assets/index.1c640a53.js +1316 -0
- package/builder/assets/index.24307ca0.css +6 -0
- package/builder/assets/{vendor.001dcf8c.js → vendor.9bf2fcb4.js} +163 -163
- package/builder/index.html +3 -3
- package/coverage/clover.xml +794 -868
- package/coverage/coverage-final.json +26 -26
- 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 +12 -111
- package/coverage/lcov-report/api/controllers/backup.js.html +6 -9
- package/coverage/lcov-report/api/controllers/cloud.js.html +1 -1
- package/coverage/lcov-report/api/controllers/component.js.html +1 -1
- package/coverage/lcov-report/api/controllers/datasource.js.html +16 -16
- package/coverage/lcov-report/api/controllers/dev.js.html +1 -1
- package/coverage/lcov-report/api/controllers/index.html +21 -21
- package/coverage/lcov-report/api/controllers/integration.js.html +1 -1
- package/coverage/lcov-report/api/controllers/layout.js.html +1 -1
- package/coverage/lcov-report/api/controllers/metadata.js.html +1 -1
- package/coverage/lcov-report/api/controllers/migrations.js.html +1 -1
- package/coverage/lcov-report/api/controllers/permission.js.html +1 -1
- package/coverage/lcov-report/api/controllers/query/index.html +1 -1
- package/coverage/lcov-report/api/controllers/query/validation.js.html +1 -1
- package/coverage/lcov-report/api/controllers/role.js.html +1 -1
- package/coverage/lcov-report/api/controllers/routing.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/external.js.html +17 -47
- package/coverage/lcov-report/api/controllers/row/index.html +34 -34
- package/coverage/lcov-report/api/controllers/row/internal.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/internalSearch.js.html +11 -95
- package/coverage/lcov-report/api/controllers/row/staticFormula.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/utils.js.html +8 -17
- package/coverage/lcov-report/api/controllers/screen.js.html +1 -1
- package/coverage/lcov-report/api/controllers/script.js.html +1 -1
- package/coverage/lcov-report/api/controllers/table/bulkFormula.js.html +1 -1
- package/coverage/lcov-report/api/controllers/table/external.js.html +1 -1
- package/coverage/lcov-report/api/controllers/table/index.html +1 -1
- package/coverage/lcov-report/api/controllers/table/index.js.html +1 -1
- package/coverage/lcov-report/api/controllers/templates.js.html +1 -1
- package/coverage/lcov-report/api/controllers/user.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/exporters.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/index.html +1 -1
- package/coverage/lcov-report/api/controllers/view/index.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/utils.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/viewBuilder.js.html +1 -1
- package/coverage/lcov-report/api/controllers/webhook.js.html +1 -1
- package/coverage/lcov-report/api/index.html +15 -15
- package/coverage/lcov-report/api/index.js.html +13 -22
- 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 +2 -32
- package/coverage/lcov-report/api/routes/backup.js.html +1 -1
- package/coverage/lcov-report/api/routes/cloud.js.html +1 -1
- package/coverage/lcov-report/api/routes/component.js.html +1 -1
- package/coverage/lcov-report/api/routes/datasource.js.html +1 -1
- package/coverage/lcov-report/api/routes/deploy.js.html +1 -1
- package/coverage/lcov-report/api/routes/dev.js.html +1 -1
- package/coverage/lcov-report/api/routes/index.html +1 -1
- package/coverage/lcov-report/api/routes/integration.js.html +1 -1
- package/coverage/lcov-report/api/routes/layout.js.html +1 -1
- package/coverage/lcov-report/api/routes/metadata.js.html +1 -1
- package/coverage/lcov-report/api/routes/migrations.js.html +1 -1
- package/coverage/lcov-report/api/routes/permission.js.html +1 -1
- package/coverage/lcov-report/api/routes/query.js.html +1 -1
- package/coverage/lcov-report/api/routes/role.js.html +1 -1
- package/coverage/lcov-report/api/routes/routing.js.html +1 -1
- package/coverage/lcov-report/api/routes/screen.js.html +1 -1
- package/coverage/lcov-report/api/routes/script.js.html +1 -1
- package/coverage/lcov-report/api/routes/table.js.html +1 -1
- package/coverage/lcov-report/api/routes/templates.js.html +1 -1
- package/coverage/lcov-report/api/routes/user.js.html +1 -1
- package/coverage/lcov-report/api/routes/utils/index.html +1 -1
- package/coverage/lcov-report/api/routes/utils/validators.js.html +1 -1
- package/coverage/lcov-report/api/routes/view.js.html +1 -1
- package/coverage/lcov-report/api/routes/webhook.js.html +1 -1
- package/coverage/lcov-report/automations/actions.js.html +1 -1
- package/coverage/lcov-report/automations/automationUtils.js.html +12 -57
- package/coverage/lcov-report/automations/bullboard.js.html +1 -1
- package/coverage/lcov-report/automations/index.html +17 -17
- 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 +34 -58
- package/coverage/lcov-report/automations/steps/index.html +11 -11
- 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 +4 -4
- 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 +14 -14
- 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 +13 -13
- package/coverage/lcov-report/db/linkedRows/index.js.html +7 -10
- 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 +51 -27
- 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 +74 -74
- 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 +10 -10
- package/coverage/lcov-report/middleware/publicApi.js.html +1 -1
- package/coverage/lcov-report/middleware/resourceId.js.html +7 -7
- package/coverage/lcov-report/middleware/selfhost.js.html +1 -1
- package/coverage/lcov-report/middleware/utils.js.html +2 -2
- package/coverage/lcov-report/threads/automation.js.html +9 -18
- package/coverage/lcov-report/threads/index.html +25 -25
- package/coverage/lcov-report/threads/query.js.html +76 -283
- package/coverage/lcov-report/threads/utils.js.html +4 -4
- package/coverage/lcov-report/utilities/budibaseDir.js.html +1 -1
- package/coverage/lcov-report/utilities/centralPath.js.html +1 -1
- package/coverage/lcov-report/utilities/csvParser.js.html +1 -1
- package/coverage/lcov-report/utilities/global.js.html +14 -14
- package/coverage/lcov-report/utilities/index.html +1 -1
- package/coverage/lcov-report/utilities/index.js.html +9 -9
- 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 +1425 -1553
- package/dist/api/controllers/application.js +15 -18
- package/dist/api/controllers/automation.js +2 -28
- package/dist/api/controllers/backup.js +2 -3
- package/dist/api/controllers/query/index.js +0 -25
- package/dist/api/controllers/row/external.js +7 -19
- package/dist/api/controllers/row/internalSearch.js +1 -22
- package/dist/api/controllers/row/utils.js +0 -3
- package/dist/api/index.js +1 -4
- package/dist/api/routes/automation.js +0 -2
- package/dist/automations/automationUtils.js +4 -16
- package/dist/automations/steps/filter.js +29 -38
- package/dist/automations/triggers.js +1 -1
- package/dist/db/linkedRows/index.js +0 -1
- package/dist/db/utils.js +31 -4
- package/dist/definitions/datasource.js +0 -1
- package/dist/environment.js +0 -1
- package/dist/integrations/airtable.js +0 -1
- package/dist/integrations/arangodb.js +0 -1
- package/dist/integrations/base/sql.js +3 -20
- package/dist/integrations/couchdb.js +0 -1
- package/dist/integrations/dynamodb.js +0 -1
- package/dist/integrations/elasticsearch.js +0 -1
- package/dist/integrations/firebase.js +0 -1
- package/dist/integrations/googlesheets.js +0 -1
- package/dist/integrations/index.js +0 -4
- package/dist/integrations/microsoftSqlServer.js +1 -2
- package/dist/integrations/mongodb.js +0 -1
- package/dist/integrations/mysql.js +1 -2
- package/dist/integrations/oracle.js +0 -1
- package/dist/integrations/postgres.js +1 -2
- package/dist/integrations/queries/sql.js +0 -3
- package/dist/integrations/redis.js +0 -1
- package/dist/integrations/rest.js +1 -2
- package/dist/integrations/s3.js +0 -1
- package/dist/package.json +6 -7
- package/dist/tests/utilities/TestConfiguration.js +6 -19
- package/dist/threads/automation.js +3 -6
- package/dist/threads/index.js +1 -15
- package/dist/threads/query.js +8 -54
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utilities/fileSystem/index.js +6 -16
- package/package.json +7 -8
- package/src/api/controllers/application.ts +14 -18
- package/src/api/controllers/automation.js +2 -35
- package/src/api/controllers/backup.js +2 -3
- package/src/api/controllers/query/index.ts +1 -29
- package/src/api/controllers/row/external.js +9 -19
- package/src/api/controllers/row/internalSearch.js +0 -28
- package/src/api/controllers/row/utils.js +0 -3
- package/src/api/index.js +1 -4
- package/src/api/routes/automation.js +0 -10
- package/src/api/routes/tests/query.spec.js +0 -166
- package/src/automations/automationUtils.js +4 -19
- package/src/automations/steps/filter.js +28 -36
- package/src/automations/tests/filter.spec.js +1 -2
- package/src/automations/triggers.js +1 -1
- package/src/db/linkedRows/index.js +0 -1
- package/src/db/utils.js +13 -5
- package/src/definitions/common.ts +0 -1
- package/src/definitions/datasource.ts +0 -2
- package/src/environment.js +0 -1
- package/src/integrations/airtable.ts +0 -1
- package/src/integrations/arangodb.ts +0 -1
- package/src/integrations/base/sql.ts +11 -25
- package/src/integrations/couchdb.ts +0 -1
- package/src/integrations/dynamodb.ts +0 -1
- package/src/integrations/elasticsearch.ts +0 -1
- package/src/integrations/firebase.ts +0 -1
- package/src/integrations/googlesheets.ts +0 -1
- package/src/integrations/index.ts +0 -4
- package/src/integrations/microsoftSqlServer.ts +0 -2
- package/src/integrations/mongodb.ts +0 -1
- package/src/integrations/mysql.ts +0 -2
- package/src/integrations/oracle.ts +0 -1
- package/src/integrations/postgres.ts +0 -2
- package/src/integrations/queries/sql.ts +1 -3
- package/src/integrations/redis.ts +0 -1
- package/src/integrations/rest.ts +1 -2
- package/src/integrations/s3.ts +0 -1
- package/src/integrations/tests/rest.spec.js +1 -16
- package/src/migrations/tests/index.spec.ts +2 -18
- package/src/module.d.ts +0 -2
- package/src/tests/utilities/TestConfiguration.js +3 -22
- package/src/threads/automation.js +3 -6
- package/src/threads/index.ts +1 -5
- package/src/threads/query.js +10 -79
- package/src/utilities/fileSystem/index.js +8 -22
- package/builder/assets/index.5a233c3d.js +0 -977
- package/builder/assets/index.7786f497.css +0 -6
- package/dist/automations/logging/index.js +0 -70
- package/dist/integrations/snowflake.js +0 -102
- package/scripts/integrations/oracle/instantclient/linux/arm64/basiclite-19.10.zip +0 -0
- package/scripts/integrations/oracle/instantclient/linux/arm64/install.sh +0 -23
- package/scripts/integrations/oracle/instantclient/linux/install.sh +0 -10
- package/src/automations/logging/index.ts +0 -35
- package/src/integrations/snowflake.ts +0 -99
|
@@ -33,7 +33,6 @@ var GoogleSheetsModule;
|
|
|
33
33
|
docs: "https://developers.google.com/sheets/api/quickstart/nodejs",
|
|
34
34
|
description: "Create and collaborate on online spreadsheets in real-time and from any device. ",
|
|
35
35
|
friendlyName: "Google Sheets",
|
|
36
|
-
type: "Spreadsheet",
|
|
37
36
|
datasource: {
|
|
38
37
|
spreadsheetId: {
|
|
39
38
|
display: "Google Sheet URL",
|
|
@@ -13,7 +13,6 @@ const rest = require("./rest");
|
|
|
13
13
|
const googlesheets = require("./googlesheets");
|
|
14
14
|
const firebase = require("./firebase");
|
|
15
15
|
const redis = require("./redis");
|
|
16
|
-
const snowflake = require("./snowflake");
|
|
17
16
|
const { SourceNames } = require("../definitions/datasource");
|
|
18
17
|
const environment = require("../environment");
|
|
19
18
|
const DEFINITIONS = {
|
|
@@ -30,7 +29,6 @@ const DEFINITIONS = {
|
|
|
30
29
|
[SourceNames.REST]: rest.schema,
|
|
31
30
|
[SourceNames.FIRESTORE]: firebase.schema,
|
|
32
31
|
[SourceNames.REDIS]: redis.schema,
|
|
33
|
-
[SourceNames.SNOWFLAKE]: snowflake.schema,
|
|
34
32
|
};
|
|
35
33
|
const INTEGRATIONS = {
|
|
36
34
|
[SourceNames.POSTGRES]: postgres.integration,
|
|
@@ -47,8 +45,6 @@ const INTEGRATIONS = {
|
|
|
47
45
|
[SourceNames.FIRESTORE]: firebase.integration,
|
|
48
46
|
[SourceNames.GOOGLE_SHEETS]: googlesheets.integration,
|
|
49
47
|
[SourceNames.REDIS]: redis.integration,
|
|
50
|
-
[SourceNames.FIREBASE]: firebase.integration,
|
|
51
|
-
[SourceNames.SNOWFLAKE]: snowflake.integration,
|
|
52
48
|
};
|
|
53
49
|
// optionally add oracle integration if the oracle binary can be installed
|
|
54
50
|
if (!(process.arch === "arm64" && process.platform === "darwin")) {
|
|
@@ -21,7 +21,6 @@ var MSSQLModule;
|
|
|
21
21
|
plus: true,
|
|
22
22
|
description: "Microsoft SQL Server is a relational database management system developed by Microsoft. ",
|
|
23
23
|
friendlyName: "MS SQL Server",
|
|
24
|
-
type: "Relational",
|
|
25
24
|
datasource: {
|
|
26
25
|
user: {
|
|
27
26
|
type: datasource_1.DatasourceFieldTypes.STRING,
|
|
@@ -202,7 +201,7 @@ var MSSQLModule;
|
|
|
202
201
|
if (typeof name !== "string") {
|
|
203
202
|
continue;
|
|
204
203
|
}
|
|
205
|
-
schema[name] = Object.assign(
|
|
204
|
+
schema[name] = Object.assign({ autocolumn: !!autoColumns.find((col) => col === name), name: name }, (0, utils_1.convertSqlType)(def.DATA_TYPE));
|
|
206
205
|
}
|
|
207
206
|
tables[tableName] = {
|
|
208
207
|
_id: (0, utils_1.buildExternalTableId)(datasourceId, tableName),
|
|
@@ -16,7 +16,6 @@ var MongoDBModule;
|
|
|
16
16
|
const SCHEMA = {
|
|
17
17
|
docs: "https://github.com/mongodb/node-mongodb-native",
|
|
18
18
|
friendlyName: "MongoDB",
|
|
19
|
-
type: "Non-relational",
|
|
20
19
|
description: "MongoDB is a general purpose, document-based, distributed database built for modern application developers and for the cloud era.",
|
|
21
20
|
datasource: {
|
|
22
21
|
connectionString: {
|
|
@@ -24,7 +24,6 @@ var MySQLModule;
|
|
|
24
24
|
docs: "https://github.com/sidorares/node-mysql2",
|
|
25
25
|
plus: true,
|
|
26
26
|
friendlyName: "MySQL",
|
|
27
|
-
type: "Relational",
|
|
28
27
|
description: "MySQL Database Service is a fully managed database service to deploy cloud-native applications. ",
|
|
29
28
|
datasource: {
|
|
30
29
|
host: {
|
|
@@ -188,7 +187,7 @@ var MySQLModule;
|
|
|
188
187
|
const isAuto = typeof column.Extra === "string" &&
|
|
189
188
|
(column.Extra === "auto_increment" ||
|
|
190
189
|
column.Extra.toLowerCase().includes("generated"));
|
|
191
|
-
schema[columnName] = Object.assign(
|
|
190
|
+
schema[columnName] = Object.assign({ name: columnName, autocolumn: isAuto, constraints }, (0, utils_1.convertSqlType)(column.Type));
|
|
192
191
|
}
|
|
193
192
|
if (!tables[tableName]) {
|
|
194
193
|
tables[tableName] = {
|
|
@@ -24,7 +24,6 @@ var OracleModule;
|
|
|
24
24
|
docs: "https://github.com/oracle/node-oracledb",
|
|
25
25
|
plus: true,
|
|
26
26
|
friendlyName: "Oracle",
|
|
27
|
-
type: "Relational",
|
|
28
27
|
description: "Oracle Database is an object-relational database management system developed by Oracle Corporation",
|
|
29
28
|
datasource: {
|
|
30
29
|
host: {
|
|
@@ -29,7 +29,6 @@ var PostgresModule;
|
|
|
29
29
|
docs: "https://node-postgres.com",
|
|
30
30
|
plus: true,
|
|
31
31
|
friendlyName: "PostgreSQL",
|
|
32
|
-
type: "Relational",
|
|
33
32
|
description: "PostgreSQL, also known as Postgres, is a free and open-source relational database management system emphasizing extensibility and SQL compliance.",
|
|
34
33
|
datasource: {
|
|
35
34
|
host: {
|
|
@@ -230,7 +229,7 @@ var PostgresModule;
|
|
|
230
229
|
column.column_default.startsWith("nextval");
|
|
231
230
|
const isGenerated = column.is_generated && column.is_generated !== "NEVER";
|
|
232
231
|
const isAuto = hasDefault || identity || isGenerated;
|
|
233
|
-
tables[tableName].schema[columnName] = Object.assign(
|
|
232
|
+
tables[tableName].schema[columnName] = Object.assign({ autocolumn: isAuto, name: columnName }, (0, utils_1.convertSqlType)(column.data_type));
|
|
234
233
|
}
|
|
235
234
|
const final = (0, utils_1.finaliseExternalTables)(tables, entities);
|
|
236
235
|
this.tables = final.tables;
|
|
@@ -5,9 +5,6 @@ const string_templates_1 = require("@budibase/string-templates");
|
|
|
5
5
|
const CONST_CHAR_REGEX = new RegExp("'[^']*'", "g");
|
|
6
6
|
function enrichQueryFields(fields, parameters = {}) {
|
|
7
7
|
const enrichedQuery = Array.isArray(fields) ? [] : {};
|
|
8
|
-
if (!fields || !parameters) {
|
|
9
|
-
return enrichedQuery;
|
|
10
|
-
}
|
|
11
8
|
// enrich the fields with dynamic parameters
|
|
12
9
|
for (let key of Object.keys(fields)) {
|
|
13
10
|
if (fields[key] == null) {
|
|
@@ -56,7 +56,6 @@ var RestModule;
|
|
|
56
56
|
docs: "https://github.com/node-fetch/node-fetch",
|
|
57
57
|
description: "With the REST API datasource, you can connect, query and pull data from multiple REST APIs. You can then use the retrieved data to build apps.",
|
|
58
58
|
friendlyName: "REST API",
|
|
59
|
-
type: "API",
|
|
60
59
|
datasource: {
|
|
61
60
|
url: {
|
|
62
61
|
type: datasource_1.DatasourceFieldTypes.STRING,
|
|
@@ -252,7 +251,7 @@ var RestModule;
|
|
|
252
251
|
input.body = form;
|
|
253
252
|
break;
|
|
254
253
|
case BodyTypes.XML:
|
|
255
|
-
if (object != null
|
|
254
|
+
if (object != null) {
|
|
256
255
|
string = new XmlBuilder().buildObject(object);
|
|
257
256
|
}
|
|
258
257
|
input.body = string;
|
package/dist/integrations/s3.js
CHANGED
|
@@ -17,7 +17,6 @@ var S3Module;
|
|
|
17
17
|
docs: "https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html",
|
|
18
18
|
description: "Amazon Simple Storage Service (Amazon S3) is an object storage service that offers industry-leading scalability, data availability, security, and performance.",
|
|
19
19
|
friendlyName: "Amazon S3",
|
|
20
|
-
type: "Object store",
|
|
21
20
|
datasource: {
|
|
22
21
|
region: {
|
|
23
22
|
type: "string",
|
package/dist/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/server",
|
|
3
3
|
"email": "hi@budibase.com",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.218",
|
|
5
5
|
"description": "Budibase Web Server",
|
|
6
6
|
"main": "src/index.ts",
|
|
7
7
|
"repository": {
|
|
@@ -77,11 +77,10 @@
|
|
|
77
77
|
"license": "GPL-3.0",
|
|
78
78
|
"dependencies": {
|
|
79
79
|
"@apidevtools/swagger-parser": "10.0.3",
|
|
80
|
-
"@budibase/backend-core": "^1.0.
|
|
81
|
-
"@budibase/client": "^1.0.
|
|
82
|
-
"@budibase/pro": "1.0.
|
|
83
|
-
"@budibase/string-templates": "^1.0.
|
|
84
|
-
"@budibase/types": "^1.0.219-alpha.6",
|
|
80
|
+
"@budibase/backend-core": "^1.0.218",
|
|
81
|
+
"@budibase/client": "^1.0.218",
|
|
82
|
+
"@budibase/pro": "1.0.218",
|
|
83
|
+
"@budibase/string-templates": "^1.0.218",
|
|
85
84
|
"@bull-board/api": "3.7.0",
|
|
86
85
|
"@bull-board/koa": "3.9.4",
|
|
87
86
|
"@elastic/elasticsearch": "7.10.0",
|
|
@@ -136,7 +135,6 @@
|
|
|
136
135
|
"pouchdb-replication-stream": "1.2.9",
|
|
137
136
|
"redis": "4",
|
|
138
137
|
"server-destroy": "1.0.1",
|
|
139
|
-
"snowflake-promise": "^4.5.0",
|
|
140
138
|
"svelte": "3.44.1",
|
|
141
139
|
"swagger-parser": "10.0.3",
|
|
142
140
|
"to-json-schema": "0.2.5",
|
|
@@ -152,6 +150,7 @@
|
|
|
152
150
|
"@babel/core": "7.17.4",
|
|
153
151
|
"@babel/preset-env": "7.16.11",
|
|
154
152
|
"@budibase/standard-components": "^0.9.139",
|
|
153
|
+
"@budibase/types": "^1.0.218",
|
|
155
154
|
"@jest/test-sequencer": "24.9.0",
|
|
156
155
|
"@types/apidoc": "0.50.0",
|
|
157
156
|
"@types/bson": "4.2.0",
|
|
@@ -26,8 +26,6 @@ const { generateDevInfoID, SEPARATOR } = require("@budibase/backend-core/db");
|
|
|
26
26
|
const { encrypt } = require("@budibase/backend-core/encryption");
|
|
27
27
|
const GLOBAL_USER_ID = "us_uuid1";
|
|
28
28
|
const EMAIL = "babs@babs.com";
|
|
29
|
-
const FIRSTNAME = "Barbara";
|
|
30
|
-
const LASTNAME = "Barbington";
|
|
31
29
|
const CSRF_TOKEN = "e3727778-7af0-4226-b5eb-f43cbe60a306";
|
|
32
30
|
class TestConfiguration {
|
|
33
31
|
constructor(openServer = true) {
|
|
@@ -53,14 +51,6 @@ class TestConfiguration {
|
|
|
53
51
|
getProdAppId() {
|
|
54
52
|
return this.prodAppId;
|
|
55
53
|
}
|
|
56
|
-
getUserDetails() {
|
|
57
|
-
return {
|
|
58
|
-
globalId: GLOBAL_USER_ID,
|
|
59
|
-
email: EMAIL,
|
|
60
|
-
firstName: FIRSTNAME,
|
|
61
|
-
lastName: LASTNAME,
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
54
|
doInContext(appId, task) {
|
|
65
55
|
return __awaiter(this, void 0, void 0, function* () {
|
|
66
56
|
if (!appId) {
|
|
@@ -119,7 +109,7 @@ class TestConfiguration {
|
|
|
119
109
|
});
|
|
120
110
|
}
|
|
121
111
|
// USER / AUTH
|
|
122
|
-
globalUser({ id = GLOBAL_USER_ID,
|
|
112
|
+
globalUser({ id = GLOBAL_USER_ID, builder = true, admin = false, email = EMAIL, roles, } = {}) {
|
|
123
113
|
return __awaiter(this, void 0, void 0, function* () {
|
|
124
114
|
return doWithGlobalDB(TENANT_ID, (db) => __awaiter(this, void 0, void 0, function* () {
|
|
125
115
|
let existing;
|
|
@@ -129,8 +119,7 @@ class TestConfiguration {
|
|
|
129
119
|
catch (err) {
|
|
130
120
|
existing = { email };
|
|
131
121
|
}
|
|
132
|
-
const user = Object.assign(Object.assign({ _id: id }, existing), { roles: roles || {}, tenantId: TENANT_ID
|
|
133
|
-
lastName });
|
|
122
|
+
const user = Object.assign(Object.assign({ _id: id }, existing), { roles: roles || {}, tenantId: TENANT_ID });
|
|
134
123
|
yield createASession(id, {
|
|
135
124
|
sessionId: "sessionid",
|
|
136
125
|
tenantId: TENANT_ID,
|
|
@@ -153,13 +142,11 @@ class TestConfiguration {
|
|
|
153
142
|
}));
|
|
154
143
|
});
|
|
155
144
|
}
|
|
156
|
-
createUser(id = null,
|
|
145
|
+
createUser(id = null, email = EMAIL, builder = true, admin = false, roles = {}) {
|
|
157
146
|
return __awaiter(this, void 0, void 0, function* () {
|
|
158
147
|
const globalId = !id ? `us_${Math.random()}` : `us_${id}`;
|
|
159
148
|
const resp = yield this.globalUser({
|
|
160
149
|
id: globalId,
|
|
161
|
-
firstName,
|
|
162
|
-
lastName,
|
|
163
150
|
email,
|
|
164
151
|
builder,
|
|
165
152
|
admin,
|
|
@@ -479,15 +466,15 @@ class TestConfiguration {
|
|
|
479
466
|
});
|
|
480
467
|
}
|
|
481
468
|
// QUERY
|
|
482
|
-
previewQuery(request, config, datasource, fields
|
|
469
|
+
previewQuery(request, config, datasource, fields) {
|
|
483
470
|
return __awaiter(this, void 0, void 0, function* () {
|
|
484
471
|
return request
|
|
485
472
|
.post(`/api/queries/preview`)
|
|
486
473
|
.send({
|
|
487
474
|
datasourceId: datasource._id,
|
|
488
|
-
parameters:
|
|
475
|
+
parameters: {},
|
|
489
476
|
fields,
|
|
490
|
-
queryVerb:
|
|
477
|
+
queryVerb: "read",
|
|
491
478
|
name: datasource.name,
|
|
492
479
|
})
|
|
493
480
|
.set(config.defaultHeaders())
|
|
@@ -19,11 +19,10 @@ const { doInTenant } = require("@budibase/backend-core/tenancy");
|
|
|
19
19
|
const { definitions: triggerDefs } = require("../automations/triggerInfo");
|
|
20
20
|
const { doInAppContext, getAppDB } = require("@budibase/backend-core/context");
|
|
21
21
|
const { AutomationErrors, LoopStepTypes } = require("../constants");
|
|
22
|
-
const { storeLog } = require("../automations/logging");
|
|
23
22
|
const FILTER_STEP_ID = actions.ACTION_DEFINITIONS.FILTER.stepId;
|
|
24
23
|
const LOOP_STEP_ID = actions.ACTION_DEFINITIONS.LOOP.stepId;
|
|
25
24
|
const CRON_STEP_ID = triggerDefs.CRON.stepId;
|
|
26
|
-
const STOPPED_STATUS = { success:
|
|
25
|
+
const STOPPED_STATUS = { success: false, status: "STOPPED" };
|
|
27
26
|
const { cloneDeep } = require("lodash/fp");
|
|
28
27
|
const env = require("../environment");
|
|
29
28
|
function typecastForLooping(loopStep, input) {
|
|
@@ -196,7 +195,7 @@ class Orchestrator {
|
|
|
196
195
|
}
|
|
197
196
|
}
|
|
198
197
|
}
|
|
199
|
-
if (index === env.
|
|
198
|
+
if (index === parseInt(env.AUTOMATION_MAX_ITERATIONS) ||
|
|
200
199
|
index === parseInt(loopStep.inputs.iterations)) {
|
|
201
200
|
this.updateContextAndOutput(loopStepNumber, step, tempOutput, {
|
|
202
201
|
status: AutomationErrors.MAX_ITERATIONS,
|
|
@@ -249,7 +248,7 @@ class Orchestrator {
|
|
|
249
248
|
this._context.steps[stepCount] = outputs;
|
|
250
249
|
// if filter causes us to stop execution don't break the loop, set a var
|
|
251
250
|
// so that we can finish iterating through the steps and record that it stopped
|
|
252
|
-
if (step.stepId === FILTER_STEP_ID && !outputs.
|
|
251
|
+
if (step.stepId === FILTER_STEP_ID && !outputs.success) {
|
|
253
252
|
stopped = true;
|
|
254
253
|
this.updateExecutionOutput(step.id, step.stepId, step.inputs, Object.assign(Object.assign({}, outputs), STOPPED_STATUS));
|
|
255
254
|
continue;
|
|
@@ -290,8 +289,6 @@ class Orchestrator {
|
|
|
290
289
|
loopSteps = null;
|
|
291
290
|
}
|
|
292
291
|
}
|
|
293
|
-
// store the logs for the automation run
|
|
294
|
-
yield storeLog(this._automation, this.executionOutput);
|
|
295
292
|
return this.executionOutput;
|
|
296
293
|
});
|
|
297
294
|
}
|
package/dist/threads/index.js
CHANGED
|
@@ -22,15 +22,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
25
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
27
|
};
|
|
@@ -101,7 +92,7 @@ class Thread {
|
|
|
101
92
|
});
|
|
102
93
|
});
|
|
103
94
|
}
|
|
104
|
-
static
|
|
95
|
+
static shutdown() {
|
|
105
96
|
return new Promise(resolve => {
|
|
106
97
|
if (Thread.workerRefs.length === 0) {
|
|
107
98
|
resolve();
|
|
@@ -119,11 +110,6 @@ class Thread {
|
|
|
119
110
|
Thread.workerRefs = [];
|
|
120
111
|
});
|
|
121
112
|
}
|
|
122
|
-
static shutdown() {
|
|
123
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
124
|
-
yield Thread.stopThreads();
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
113
|
}
|
|
128
114
|
exports.Thread = Thread;
|
|
129
115
|
Thread.workerRefs = [];
|
package/dist/threads/query.js
CHANGED
|
@@ -14,9 +14,6 @@ const ScriptRunner = require("../utilities/scriptRunner");
|
|
|
14
14
|
const { integrations } = require("../integrations");
|
|
15
15
|
const { processStringSync } = require("@budibase/string-templates");
|
|
16
16
|
const { doInAppContext, getAppDB } = require("@budibase/backend-core/context");
|
|
17
|
-
const { refreshOAuthToken, updateUserOAuth, } = require("@budibase/backend-core/auth");
|
|
18
|
-
const { user: userCache } = require("@budibase/backend-core/cache");
|
|
19
|
-
const { getGlobalIDFromUserMetadataID } = require("../db/utils");
|
|
20
17
|
const { isSQL } = require("../integrations/utils");
|
|
21
18
|
const { enrichQueryFields, interpolateSQL, } = require("../integrations/queries/sql");
|
|
22
19
|
class QueryRunner {
|
|
@@ -30,46 +27,29 @@ class QueryRunner {
|
|
|
30
27
|
this.queryId = input.queryId;
|
|
31
28
|
this.noRecursiveQuery = flags.noRecursiveQuery;
|
|
32
29
|
this.cachedVariables = [];
|
|
33
|
-
// Additional context items for enrichment
|
|
34
|
-
this.ctx = input.ctx;
|
|
35
30
|
// allows the response from a query to be stored throughout this
|
|
36
31
|
// execution so that if it needs to be re-used for another variable
|
|
37
32
|
// it can be
|
|
38
33
|
this.queryResponse = {};
|
|
39
34
|
this.hasRerun = false;
|
|
40
|
-
this.hasRefreshedOAuth = false;
|
|
41
35
|
}
|
|
42
36
|
execute() {
|
|
43
|
-
var _a;
|
|
44
37
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45
38
|
let { datasource, fields, queryVerb, transformer } = this;
|
|
46
39
|
const Integration = integrations[datasource.source];
|
|
47
40
|
if (!Integration) {
|
|
48
41
|
throw "Integration type does not exist.";
|
|
49
42
|
}
|
|
50
|
-
if (datasource.config.authConfigs) {
|
|
51
|
-
datasource.config.authConfigs = datasource.config.authConfigs.map(config => {
|
|
52
|
-
return enrichQueryFields(config, this.ctx);
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
43
|
const integration = new Integration(datasource.config);
|
|
56
44
|
// pre-query, make sure datasource variables are added to parameters
|
|
57
45
|
const parameters = yield this.addDatasourceVariables();
|
|
58
|
-
// Enrich the parameters with the addition context items.
|
|
59
|
-
// 'user' is now a reserved variable key in mapping parameters
|
|
60
|
-
const enrichedParameters = enrichQueryFields(parameters, this.ctx);
|
|
61
|
-
const enrichedContext = Object.assign(Object.assign({}, enrichedParameters), this.ctx);
|
|
62
|
-
// Parse global headers
|
|
63
|
-
if (datasource.config.defaultHeaders) {
|
|
64
|
-
datasource.config.defaultHeaders = enrichQueryFields(datasource.config.defaultHeaders, enrichedContext);
|
|
65
|
-
}
|
|
66
46
|
let query;
|
|
67
47
|
// handle SQL injections by interpolating the variables
|
|
68
48
|
if (isSQL(datasource)) {
|
|
69
|
-
query = interpolateSQL(fields,
|
|
49
|
+
query = interpolateSQL(fields, parameters, integration);
|
|
70
50
|
}
|
|
71
51
|
else {
|
|
72
|
-
query = enrichQueryFields(fields,
|
|
52
|
+
query = enrichQueryFields(fields, parameters);
|
|
73
53
|
}
|
|
74
54
|
// Add pagination values for REST queries
|
|
75
55
|
if (this.pagination) {
|
|
@@ -87,20 +67,17 @@ class QueryRunner {
|
|
|
87
67
|
if (transformer) {
|
|
88
68
|
const runner = new ScriptRunner(transformer, {
|
|
89
69
|
data: rows,
|
|
90
|
-
params:
|
|
70
|
+
params: parameters,
|
|
91
71
|
});
|
|
92
72
|
rows = runner.execute();
|
|
93
73
|
}
|
|
94
74
|
// if the request fails we retry once, invalidating the cached value
|
|
95
|
-
if (info &&
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
yield this.refreshOAuth2(this.ctx);
|
|
100
|
-
// Attempt to refresh the access token from the provider
|
|
101
|
-
this.hasRefreshedOAuth = true;
|
|
102
|
-
}
|
|
75
|
+
if (info &&
|
|
76
|
+
info.code >= 400 &&
|
|
77
|
+
this.cachedVariables.length > 0 &&
|
|
78
|
+
!this.hasRerun) {
|
|
103
79
|
this.hasRerun = true;
|
|
80
|
+
// invalidate the cache value
|
|
104
81
|
yield threadUtils.invalidateDynamicVariables(this.cachedVariables);
|
|
105
82
|
return this.execute();
|
|
106
83
|
}
|
|
@@ -138,29 +115,6 @@ class QueryRunner {
|
|
|
138
115
|
}, { noRecursiveQuery: true }).execute();
|
|
139
116
|
});
|
|
140
117
|
}
|
|
141
|
-
refreshOAuth2(ctx) {
|
|
142
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
143
|
-
const { oauth2, providerType, _id } = ctx.user;
|
|
144
|
-
const { configId } = ctx.auth;
|
|
145
|
-
if (!providerType || !(oauth2 === null || oauth2 === void 0 ? void 0 : oauth2.refreshToken)) {
|
|
146
|
-
throw new Error("No refresh token found for authenticated user");
|
|
147
|
-
}
|
|
148
|
-
const resp = yield refreshOAuthToken(oauth2.refreshToken, providerType, configId);
|
|
149
|
-
// Refresh session flow. Should be in same location as refreshOAuthToken
|
|
150
|
-
// There are several other properties available in 'resp'
|
|
151
|
-
if (!resp.err) {
|
|
152
|
-
const globalUserId = getGlobalIDFromUserMetadataID(_id);
|
|
153
|
-
yield updateUserOAuth(globalUserId, resp);
|
|
154
|
-
this.ctx.user = yield userCache.getUser(globalUserId);
|
|
155
|
-
}
|
|
156
|
-
else {
|
|
157
|
-
// In this event the user may have oAuth issues that
|
|
158
|
-
// could require re-authenticating with their provider.
|
|
159
|
-
throw new Error("OAuth2 access token could not be refreshed: " + resp.err.toString());
|
|
160
|
-
}
|
|
161
|
-
return resp;
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
118
|
getDynamicVariable(variable) {
|
|
165
119
|
return __awaiter(this, void 0, void 0, function* () {
|
|
166
120
|
let { parameters } = this;
|