@budibase/server 1.2.37 → 1.2.39-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__mocks__/mongodb.ts +4 -0
- package/__mocks__/node-fetch.ts +8 -1
- package/builder/assets/index.a1c0a62f.js +977 -0
- package/builder/assets/{index.08dd0c5e.css → index.f1c7e247.css} +1 -1
- package/builder/index.html +2 -2
- package/coverage/clover.xml +385 -380
- package/coverage/coverage-final.json +21 -21
- package/coverage/lcov-report/api/controllers/apikeys.js.html +1 -1
- package/coverage/lcov-report/api/controllers/auth.js.html +1 -1
- package/coverage/lcov-report/api/controllers/automation.js.html +3 -3
- package/coverage/lcov-report/api/controllers/backup.js.html +3 -3
- package/coverage/lcov-report/api/controllers/cloud.js.html +4 -4
- package/coverage/lcov-report/api/controllers/component.js.html +3 -3
- package/coverage/lcov-report/api/controllers/datasource.js.html +3 -3
- package/coverage/lcov-report/api/controllers/dev.js.html +4 -4
- package/coverage/lcov-report/api/controllers/index.html +1 -1
- package/coverage/lcov-report/api/controllers/integration.js.html +3 -3
- package/coverage/lcov-report/api/controllers/layout.js.html +1 -1
- package/coverage/lcov-report/api/controllers/metadata.js.html +1 -1
- package/coverage/lcov-report/api/controllers/migrations.js.html +1 -1
- package/coverage/lcov-report/api/controllers/permission.js.html +1 -1
- package/coverage/lcov-report/api/controllers/query/index.html +1 -1
- package/coverage/lcov-report/api/controllers/query/validation.js.html +1 -1
- package/coverage/lcov-report/api/controllers/role.js.html +1 -1
- package/coverage/lcov-report/api/controllers/routing.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/external.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/index.html +25 -25
- package/coverage/lcov-report/api/controllers/row/internal.js.html +3 -3
- package/coverage/lcov-report/api/controllers/row/internalSearch.js.html +209 -191
- package/coverage/lcov-report/api/controllers/row/staticFormula.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/utils.js.html +27 -18
- package/coverage/lcov-report/api/controllers/screen.js.html +1 -1
- package/coverage/lcov-report/api/controllers/script.js.html +1 -1
- package/coverage/lcov-report/api/controllers/table/bulkFormula.js.html +1 -1
- package/coverage/lcov-report/api/controllers/table/external.js.html +2 -2
- package/coverage/lcov-report/api/controllers/table/index.html +1 -1
- package/coverage/lcov-report/api/controllers/table/index.js.html +1 -1
- package/coverage/lcov-report/api/controllers/templates.js.html +1 -1
- package/coverage/lcov-report/api/controllers/user.js.html +19 -19
- package/coverage/lcov-report/api/controllers/view/exporters.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/index.html +1 -1
- package/coverage/lcov-report/api/controllers/view/index.js.html +3 -3
- package/coverage/lcov-report/api/controllers/view/utils.js.html +5 -5
- package/coverage/lcov-report/api/controllers/view/viewBuilder.js.html +1 -1
- package/coverage/lcov-report/api/controllers/webhook.js.html +1 -1
- package/coverage/lcov-report/api/index.html +1 -1
- package/coverage/lcov-report/api/index.js.html +1 -1
- package/coverage/lcov-report/api/routes/analytics.js.html +1 -1
- package/coverage/lcov-report/api/routes/apikeys.js.html +1 -1
- package/coverage/lcov-report/api/routes/auth.js.html +1 -1
- package/coverage/lcov-report/api/routes/automation.js.html +1 -1
- package/coverage/lcov-report/api/routes/backup.js.html +1 -1
- package/coverage/lcov-report/api/routes/cloud.js.html +1 -1
- package/coverage/lcov-report/api/routes/component.js.html +1 -1
- package/coverage/lcov-report/api/routes/datasource.js.html +1 -1
- package/coverage/lcov-report/api/routes/deploy.js.html +1 -1
- package/coverage/lcov-report/api/routes/dev.js.html +1 -1
- package/coverage/lcov-report/api/routes/index.html +1 -1
- package/coverage/lcov-report/api/routes/integration.js.html +1 -1
- package/coverage/lcov-report/api/routes/layout.js.html +1 -1
- package/coverage/lcov-report/api/routes/metadata.js.html +1 -1
- package/coverage/lcov-report/api/routes/migrations.js.html +1 -1
- package/coverage/lcov-report/api/routes/permission.js.html +1 -1
- package/coverage/lcov-report/api/routes/query.js.html +1 -1
- package/coverage/lcov-report/api/routes/role.js.html +1 -1
- package/coverage/lcov-report/api/routes/routing.js.html +1 -1
- package/coverage/lcov-report/api/routes/screen.js.html +1 -1
- package/coverage/lcov-report/api/routes/script.js.html +1 -1
- package/coverage/lcov-report/api/routes/table.js.html +1 -1
- package/coverage/lcov-report/api/routes/templates.js.html +1 -1
- package/coverage/lcov-report/api/routes/user.js.html +1 -1
- package/coverage/lcov-report/api/routes/utils/index.html +1 -1
- package/coverage/lcov-report/api/routes/utils/validators.js.html +1 -1
- package/coverage/lcov-report/api/routes/view.js.html +1 -1
- package/coverage/lcov-report/api/routes/webhook.js.html +1 -1
- package/coverage/lcov-report/automations/actions.js.html +1 -1
- package/coverage/lcov-report/automations/automationUtils.js.html +1 -1
- package/coverage/lcov-report/automations/bullboard.js.html +1 -1
- package/coverage/lcov-report/automations/index.html +1 -1
- package/coverage/lcov-report/automations/index.js.html +1 -1
- package/coverage/lcov-report/automations/steps/bash.js.html +1 -1
- package/coverage/lcov-report/automations/steps/delay.js.html +1 -1
- package/coverage/lcov-report/automations/steps/discord.js.html +1 -1
- package/coverage/lcov-report/automations/steps/executeQuery.js.html +1 -1
- package/coverage/lcov-report/automations/steps/executeScript.js.html +1 -1
- package/coverage/lcov-report/automations/steps/filter.js.html +1 -1
- package/coverage/lcov-report/automations/steps/index.html +1 -1
- package/coverage/lcov-report/automations/steps/integromat.js.html +1 -1
- package/coverage/lcov-report/automations/steps/loop.js.html +1 -1
- package/coverage/lcov-report/automations/steps/outgoingWebhook.js.html +1 -1
- package/coverage/lcov-report/automations/steps/queryRows.js.html +1 -1
- package/coverage/lcov-report/automations/steps/sendSmtpEmail.js.html +1 -1
- package/coverage/lcov-report/automations/steps/serverLog.js.html +1 -1
- package/coverage/lcov-report/automations/steps/slack.js.html +1 -1
- package/coverage/lcov-report/automations/steps/updateRow.js.html +1 -1
- package/coverage/lcov-report/automations/steps/utils.js.html +1 -1
- package/coverage/lcov-report/automations/steps/zapier.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/app.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/cron.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/index.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/index.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/rowDeleted.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/rowSaved.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/rowUpdated.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/webhook.js.html +1 -1
- package/coverage/lcov-report/automations/triggers.js.html +1 -1
- package/coverage/lcov-report/constants/index.html +1 -1
- package/coverage/lcov-report/constants/index.js.html +30 -30
- package/coverage/lcov-report/constants/layouts.js.html +1 -1
- package/coverage/lcov-report/constants/screens.js.html +1 -1
- package/coverage/lcov-report/db/inMemoryView.js.html +1 -1
- package/coverage/lcov-report/db/index.html +1 -1
- package/coverage/lcov-report/db/index.js.html +1 -1
- package/coverage/lcov-report/db/linkedRows/LinkController.js.html +1 -1
- package/coverage/lcov-report/db/linkedRows/index.html +1 -1
- package/coverage/lcov-report/db/linkedRows/index.js.html +1 -1
- package/coverage/lcov-report/db/linkedRows/linkUtils.js.html +3 -3
- package/coverage/lcov-report/db/newid.js.html +3 -3
- package/coverage/lcov-report/db/utils.js.html +99 -99
- package/coverage/lcov-report/events/AutomationEmitter.js.html +1 -1
- package/coverage/lcov-report/events/index.html +1 -1
- package/coverage/lcov-report/events/index.js.html +1 -1
- package/coverage/lcov-report/events/utils.js.html +1 -1
- package/coverage/lcov-report/index.html +19 -19
- package/coverage/lcov-report/integrations/tests/TestConfiguration.js.html +1 -1
- package/coverage/lcov-report/integrations/tests/index.html +1 -1
- package/coverage/lcov-report/middleware/appInfo.js.html +1 -1
- package/coverage/lcov-report/middleware/builder.js.html +3 -3
- package/coverage/lcov-report/middleware/currentapp.js.html +1 -1
- package/coverage/lcov-report/middleware/index.html +1 -1
- package/coverage/lcov-report/middleware/joi-validator.js.html +1 -1
- package/coverage/lcov-report/middleware/publicApi.js.html +1 -1
- package/coverage/lcov-report/middleware/resourceId.js.html +1 -1
- package/coverage/lcov-report/middleware/selfhost.js.html +1 -1
- package/coverage/lcov-report/middleware/utils.js.html +1 -1
- package/coverage/lcov-report/utilities/budibaseDir.js.html +1 -1
- package/coverage/lcov-report/utilities/centralPath.js.html +1 -1
- package/coverage/lcov-report/utilities/csvParser.js.html +1 -1
- package/coverage/lcov-report/utilities/global.js.html +16 -16
- package/coverage/lcov-report/utilities/index.html +1 -1
- package/coverage/lcov-report/utilities/index.js.html +23 -23
- package/coverage/lcov-report/utilities/queue/inMemoryQueue.js.html +1 -1
- package/coverage/lcov-report/utilities/queue/index.html +1 -1
- package/coverage/lcov-report/utilities/routing/index.html +1 -1
- package/coverage/lcov-report/utilities/routing/index.js.html +3 -3
- package/coverage/lcov-report/utilities/rowProcessor/index.html +1 -1
- package/coverage/lcov-report/utilities/rowProcessor/index.js.html +1 -1
- package/coverage/lcov-report/utilities/rowProcessor/utils.js.html +1 -1
- package/coverage/lcov-report/utilities/scriptRunner.js.html +1 -1
- package/coverage/lcov-report/utilities/security.js.html +9 -9
- package/coverage/lcov-report/utilities/statusCodes.js.html +1 -1
- package/coverage/lcov-report/utilities/usageQuota/index.html +1 -1
- package/coverage/lcov-report/utilities/usageQuota/rows.js.html +1 -1
- package/coverage/lcov-report/utilities/usageQuota/usageQuoteReset.js.html +1 -1
- package/coverage/lcov-report/utilities/users.js.html +7 -7
- package/coverage/lcov-report/utilities/workerRequests.js.html +1 -1
- package/coverage/lcov.info +598 -593
- package/dist/api/controllers/analytics.js +1 -1
- package/dist/api/controllers/application.js +8 -8
- package/dist/api/controllers/automation.js +2 -2
- package/dist/api/controllers/backup.js +2 -2
- package/dist/api/controllers/cloud.js +3 -3
- package/dist/api/controllers/component.js +2 -2
- package/dist/api/controllers/datasource.js +2 -2
- package/dist/api/controllers/deploy/index.js +6 -6
- package/dist/api/controllers/dev.js +3 -3
- package/dist/api/controllers/integration.js +2 -2
- package/dist/api/controllers/public/utils.js +1 -1
- package/dist/api/controllers/row/ExternalRequest.js +3 -3
- package/dist/api/controllers/row/internal.js +2 -2
- package/dist/api/controllers/row/internalSearch.js +5 -0
- package/dist/api/controllers/row/utils.js +3 -1
- package/dist/api/controllers/static/index.js +2 -2
- package/dist/api/controllers/table/external.js +1 -1
- package/dist/api/controllers/view/index.js +2 -2
- package/dist/api/controllers/view/utils.js +3 -3
- package/dist/automations/logging/index.js +3 -0
- package/dist/db/linkedRows/linkUtils.js +2 -2
- package/dist/db/utils.js +37 -37
- package/dist/db/views/staticViews.js +4 -4
- package/dist/definitions/automations.js +6 -6
- package/dist/definitions/datasource.js +6 -70
- package/dist/integrations/airtable.js +13 -13
- package/dist/integrations/arangodb.js +8 -8
- package/dist/integrations/base/query.js +27 -0
- package/dist/integrations/base/sql.js +33 -32
- package/dist/integrations/base/sqlTable.js +4 -4
- package/dist/integrations/base/utils.js +13 -27
- package/dist/integrations/couchdb.js +8 -8
- package/dist/integrations/dynamodb.js +21 -21
- package/dist/integrations/elasticsearch.js +12 -12
- package/dist/integrations/firebase.js +12 -12
- package/dist/integrations/googlesheets.js +14 -14
- package/dist/integrations/index.js +34 -34
- package/dist/integrations/microsoftSqlServer.js +19 -16
- package/dist/integrations/mongodb.js +44 -17
- package/dist/integrations/mysql.js +15 -15
- package/dist/integrations/oracle.js +13 -13
- package/dist/integrations/postgres.js +20 -17
- package/dist/integrations/redis.js +10 -10
- package/dist/integrations/rest.js +15 -14
- package/dist/integrations/s3.js +2 -2
- package/dist/integrations/snowflake.js +5 -5
- package/dist/integrations/utils.js +14 -14
- package/dist/middleware/builder.js +2 -2
- package/dist/migrations/functions/appUrls.js +2 -2
- package/dist/migrations/functions/backfill/app/queries.js +3 -1
- package/dist/migrations/functions/backfill/app.js +1 -1
- package/dist/migrations/functions/backfill/global/users.js +1 -1
- package/dist/package.json +7 -7
- package/dist/tests/utilities/TestConfiguration.js +2 -2
- package/dist/threads/automation.js +2 -2
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utilities/routing/index.js +2 -2
- package/dist/utilities/security.js +8 -8
- package/package.json +8 -8
- package/src/api/controllers/analytics.ts +2 -2
- package/src/api/controllers/application.ts +9 -9
- package/src/api/controllers/automation.js +2 -2
- package/src/api/controllers/backup.js +2 -2
- package/src/api/controllers/cloud.js +3 -3
- package/src/api/controllers/component.js +2 -2
- package/src/api/controllers/datasource.js +2 -2
- package/src/api/controllers/deploy/index.ts +7 -7
- package/src/api/controllers/dev.js +3 -3
- package/src/api/controllers/integration.js +2 -2
- package/src/api/controllers/public/utils.ts +2 -2
- package/src/api/controllers/query/import/sources/openapi2.ts +1 -1
- package/src/api/controllers/query/import/sources/openapi3.ts +1 -1
- package/src/api/controllers/row/ExternalRequest.ts +5 -7
- package/src/api/controllers/row/internal.js +2 -2
- package/src/api/controllers/row/internalSearch.js +6 -0
- package/src/api/controllers/row/utils.js +4 -1
- package/src/api/controllers/static/index.ts +2 -2
- package/src/api/controllers/table/external.js +1 -1
- package/src/api/controllers/view/index.js +2 -2
- package/src/api/controllers/view/utils.js +4 -4
- package/src/api/routes/tests/internalSearch.spec.js +157 -0
- package/src/automations/logging/index.ts +3 -0
- package/src/db/linkedRows/linkUtils.js +2 -2
- package/src/db/utils.js +38 -38
- package/src/db/views/staticViews.js +4 -9
- package/src/definitions/automations.ts +2 -2
- package/src/definitions/common.ts +14 -65
- package/src/definitions/datasource.ts +5 -250
- package/src/integrations/airtable.ts +16 -16
- package/src/integrations/arangodb.ts +11 -11
- package/src/integrations/base/query.ts +16 -0
- package/src/integrations/base/sql.ts +21 -20
- package/src/integrations/base/sqlTable.ts +1 -6
- package/src/integrations/base/utils.ts +9 -19
- package/src/integrations/couchdb.ts +11 -11
- package/src/integrations/dynamodb.ts +24 -24
- package/src/integrations/elasticsearch.ts +15 -15
- package/src/integrations/firebase.ts +15 -15
- package/src/integrations/googlesheets.ts +19 -18
- package/src/integrations/index.ts +34 -34
- package/src/integrations/microsoftSqlServer.ts +22 -20
- package/src/integrations/mongodb.ts +47 -20
- package/src/integrations/mysql.ts +20 -19
- package/src/integrations/oracle.ts +16 -16
- package/src/integrations/postgres.ts +22 -21
- package/src/integrations/queries/sql.ts +1 -2
- package/src/integrations/redis.ts +10 -14
- package/src/integrations/rest.ts +22 -20
- package/src/integrations/s3.ts +2 -3
- package/src/integrations/snowflake.ts +5 -5
- package/src/integrations/tests/mongo.spec.js +218 -0
- package/src/integrations/tests/sql.spec.js +8 -8
- package/src/integrations/utils.ts +8 -9
- package/src/middleware/builder.js +2 -2
- package/src/migrations/functions/appUrls.ts +2 -2
- package/src/migrations/functions/backfill/app/queries.ts +3 -2
- package/src/migrations/functions/backfill/app.ts +1 -1
- package/src/migrations/functions/backfill/global/users.ts +1 -1
- package/src/migrations/functions/tests/appUrls.spec.js +3 -3
- package/src/migrations/tests/index.spec.ts +2 -2
- package/src/tests/utilities/TestConfiguration.js +2 -2
- package/src/threads/automation.ts +3 -3
- package/src/utilities/routing/index.js +2 -2
- package/src/utilities/security.js +8 -8
- package/builder/assets/index.3ce7fa08.js +0 -975
- package/dist/integrations/base/IntegrationBase.js +0 -2
- package/dist/integrations/base/datasourcePlus.js +0 -2
- package/src/integrations/base/IntegrationBase.ts +0 -6
- package/src/integrations/base/datasourcePlus.ts +0 -13
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Integration,
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
DatasourceFieldType,
|
|
4
|
+
QueryType,
|
|
5
|
+
IntegrationBase,
|
|
6
|
+
} from "@budibase/types"
|
|
7
7
|
import {
|
|
8
8
|
MongoClient,
|
|
9
9
|
ObjectID,
|
|
@@ -29,38 +29,38 @@ module MongoDBModule {
|
|
|
29
29
|
"MongoDB is a general purpose, document-based, distributed database built for modern application developers and for the cloud era.",
|
|
30
30
|
datasource: {
|
|
31
31
|
connectionString: {
|
|
32
|
-
type:
|
|
32
|
+
type: DatasourceFieldType.STRING,
|
|
33
33
|
required: true,
|
|
34
34
|
default: "mongodb://localhost:27017",
|
|
35
35
|
},
|
|
36
36
|
db: {
|
|
37
|
-
type:
|
|
37
|
+
type: DatasourceFieldType.STRING,
|
|
38
38
|
required: true,
|
|
39
39
|
},
|
|
40
40
|
},
|
|
41
41
|
query: {
|
|
42
42
|
create: {
|
|
43
|
-
type:
|
|
43
|
+
type: QueryType.JSON,
|
|
44
44
|
},
|
|
45
45
|
read: {
|
|
46
|
-
type:
|
|
46
|
+
type: QueryType.JSON,
|
|
47
47
|
},
|
|
48
48
|
update: {
|
|
49
|
-
type:
|
|
49
|
+
type: QueryType.JSON,
|
|
50
50
|
},
|
|
51
51
|
delete: {
|
|
52
|
-
type:
|
|
52
|
+
type: QueryType.JSON,
|
|
53
53
|
},
|
|
54
54
|
},
|
|
55
55
|
extra: {
|
|
56
56
|
collection: {
|
|
57
57
|
displayName: "Collection",
|
|
58
|
-
type:
|
|
58
|
+
type: DatasourceFieldType.STRING,
|
|
59
59
|
required: true,
|
|
60
60
|
},
|
|
61
61
|
actionTypes: {
|
|
62
62
|
displayName: "Action Types",
|
|
63
|
-
type:
|
|
63
|
+
type: DatasourceFieldType.LIST,
|
|
64
64
|
required: true,
|
|
65
65
|
data: {
|
|
66
66
|
read: ["find", "findOne", "findOneAndUpdate", "count", "distinct"],
|
|
@@ -92,12 +92,15 @@ module MongoDBModule {
|
|
|
92
92
|
if (json[field] instanceof Object) {
|
|
93
93
|
json[field] = self.createObjectIds(json[field])
|
|
94
94
|
}
|
|
95
|
-
if (
|
|
96
|
-
|
|
95
|
+
if (
|
|
96
|
+
(field === "_id" || field?.startsWith("$")) &&
|
|
97
|
+
typeof json[field] === "string"
|
|
98
|
+
) {
|
|
99
|
+
const id = json[field].match(
|
|
97
100
|
/(?<=objectid\(['"]).*(?=['"]\))/gi
|
|
98
101
|
)?.[0]
|
|
99
102
|
if (id) {
|
|
100
|
-
json[
|
|
103
|
+
json[field] = ObjectID.createFromHexString(id)
|
|
101
104
|
}
|
|
102
105
|
}
|
|
103
106
|
}
|
|
@@ -114,10 +117,31 @@ module MongoDBModule {
|
|
|
114
117
|
}
|
|
115
118
|
|
|
116
119
|
parseQueryParams(params: string, mode: string) {
|
|
117
|
-
let queryParams =
|
|
118
|
-
let
|
|
119
|
-
let
|
|
120
|
-
let
|
|
120
|
+
let queryParams = []
|
|
121
|
+
let openCount = 0
|
|
122
|
+
let inQuotes = false
|
|
123
|
+
let i = 0
|
|
124
|
+
let startIndex = 0
|
|
125
|
+
for (let c of params) {
|
|
126
|
+
if (c === '"' && i > 0 && params[i - 1] !== "\\") {
|
|
127
|
+
inQuotes = !inQuotes
|
|
128
|
+
}
|
|
129
|
+
if (c === "{" && !inQuotes) {
|
|
130
|
+
openCount++
|
|
131
|
+
if (openCount === 1) {
|
|
132
|
+
startIndex = i
|
|
133
|
+
}
|
|
134
|
+
} else if (c === "}" && !inQuotes) {
|
|
135
|
+
if (openCount === 1) {
|
|
136
|
+
queryParams.push(JSON.parse(params.substring(startIndex, i + 1)))
|
|
137
|
+
}
|
|
138
|
+
openCount--
|
|
139
|
+
}
|
|
140
|
+
i++
|
|
141
|
+
}
|
|
142
|
+
let group1 = queryParams[0] ?? {}
|
|
143
|
+
let group2 = queryParams[1] ?? {}
|
|
144
|
+
let group3 = queryParams[2] ?? {}
|
|
121
145
|
if (mode === "update") {
|
|
122
146
|
return {
|
|
123
147
|
filter: group1,
|
|
@@ -176,7 +200,10 @@ module MongoDBModule {
|
|
|
176
200
|
return await collection.findOne(json)
|
|
177
201
|
}
|
|
178
202
|
case "findOneAndUpdate": {
|
|
179
|
-
|
|
203
|
+
if (typeof query.json === "string") {
|
|
204
|
+
json = this.parseQueryParams(query.json, "update")
|
|
205
|
+
}
|
|
206
|
+
let findAndUpdateJson = this.createObjectIds(json) as {
|
|
180
207
|
filter: FilterQuery<any>
|
|
181
208
|
update: UpdateQuery<any>
|
|
182
209
|
options: FindOneAndUpdateOption<any>
|
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Integration,
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
DatasourceFieldType,
|
|
4
|
+
QueryType,
|
|
5
5
|
QueryJson,
|
|
6
6
|
SqlQuery,
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
Table,
|
|
8
|
+
TableSchema,
|
|
9
|
+
DatasourcePlus,
|
|
10
|
+
} from "@budibase/types"
|
|
9
11
|
import {
|
|
10
12
|
getSqlQuery,
|
|
11
|
-
|
|
13
|
+
SqlClient,
|
|
12
14
|
buildExternalTableId,
|
|
13
15
|
convertSqlType,
|
|
14
16
|
finaliseExternalTables,
|
|
15
17
|
} from "./utils"
|
|
16
|
-
import { DatasourcePlus } from "./base/datasourcePlus"
|
|
17
18
|
import dayjs from "dayjs"
|
|
18
19
|
const { NUMBER_REGEX } = require("../utilities")
|
|
20
|
+
import Sql from "./base/sql"
|
|
19
21
|
|
|
20
22
|
module MySQLModule {
|
|
21
23
|
const mysql = require("mysql2/promise")
|
|
22
|
-
const Sql = require("./base/sql")
|
|
23
24
|
|
|
24
25
|
interface MySQLConfig {
|
|
25
26
|
host: string
|
|
@@ -41,51 +42,51 @@ module MySQLModule {
|
|
|
41
42
|
"MySQL Database Service is a fully managed database service to deploy cloud-native applications. ",
|
|
42
43
|
datasource: {
|
|
43
44
|
host: {
|
|
44
|
-
type:
|
|
45
|
+
type: DatasourceFieldType.STRING,
|
|
45
46
|
default: "localhost",
|
|
46
47
|
required: true,
|
|
47
48
|
},
|
|
48
49
|
port: {
|
|
49
|
-
type:
|
|
50
|
+
type: DatasourceFieldType.NUMBER,
|
|
50
51
|
default: 3306,
|
|
51
52
|
required: false,
|
|
52
53
|
},
|
|
53
54
|
user: {
|
|
54
|
-
type:
|
|
55
|
+
type: DatasourceFieldType.STRING,
|
|
55
56
|
default: "root",
|
|
56
57
|
required: true,
|
|
57
58
|
},
|
|
58
59
|
password: {
|
|
59
|
-
type:
|
|
60
|
+
type: DatasourceFieldType.PASSWORD,
|
|
60
61
|
default: "root",
|
|
61
62
|
required: true,
|
|
62
63
|
},
|
|
63
64
|
database: {
|
|
64
|
-
type:
|
|
65
|
+
type: DatasourceFieldType.STRING,
|
|
65
66
|
required: true,
|
|
66
67
|
},
|
|
67
68
|
ssl: {
|
|
68
|
-
type:
|
|
69
|
+
type: DatasourceFieldType.OBJECT,
|
|
69
70
|
required: false,
|
|
70
71
|
},
|
|
71
72
|
rejectUnauthorized: {
|
|
72
|
-
type:
|
|
73
|
+
type: DatasourceFieldType.BOOLEAN,
|
|
73
74
|
default: true,
|
|
74
75
|
required: false,
|
|
75
76
|
},
|
|
76
77
|
},
|
|
77
78
|
query: {
|
|
78
79
|
create: {
|
|
79
|
-
type:
|
|
80
|
+
type: QueryType.SQL,
|
|
80
81
|
},
|
|
81
82
|
read: {
|
|
82
|
-
type:
|
|
83
|
+
type: QueryType.SQL,
|
|
83
84
|
},
|
|
84
85
|
update: {
|
|
85
|
-
type:
|
|
86
|
+
type: QueryType.SQL,
|
|
86
87
|
},
|
|
87
88
|
delete: {
|
|
88
|
-
type:
|
|
89
|
+
type: QueryType.SQL,
|
|
89
90
|
},
|
|
90
91
|
},
|
|
91
92
|
}
|
|
@@ -119,7 +120,7 @@ module MySQLModule {
|
|
|
119
120
|
public schemaErrors: Record<string, string> = {}
|
|
120
121
|
|
|
121
122
|
constructor(config: MySQLConfig) {
|
|
122
|
-
super(
|
|
123
|
+
super(SqlClient.MY_SQL)
|
|
123
124
|
this.config = config
|
|
124
125
|
if (config.ssl && Object.keys(config.ssl).length === 0) {
|
|
125
126
|
delete config.ssl
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
DatasourceFieldType,
|
|
3
3
|
Integration,
|
|
4
4
|
Operation,
|
|
5
5
|
QueryJson,
|
|
6
|
-
|
|
6
|
+
QueryType,
|
|
7
7
|
SqlQuery,
|
|
8
|
-
|
|
8
|
+
Table,
|
|
9
|
+
DatasourcePlus,
|
|
10
|
+
} from "@budibase/types"
|
|
9
11
|
import {
|
|
10
12
|
buildExternalTableId,
|
|
11
13
|
convertSqlType,
|
|
12
14
|
finaliseExternalTables,
|
|
13
15
|
getSqlQuery,
|
|
14
|
-
|
|
16
|
+
SqlClient,
|
|
15
17
|
} from "./utils"
|
|
16
18
|
import oracledb, {
|
|
17
19
|
BindParameters,
|
|
@@ -21,8 +23,6 @@ import oracledb, {
|
|
|
21
23
|
Result,
|
|
22
24
|
} from "oracledb"
|
|
23
25
|
import Sql from "./base/sql"
|
|
24
|
-
import { Table } from "../definitions/common"
|
|
25
|
-
import { DatasourcePlus } from "./base/datasourcePlus"
|
|
26
26
|
import { FieldTypes } from "../constants"
|
|
27
27
|
|
|
28
28
|
module OracleModule {
|
|
@@ -45,40 +45,40 @@ module OracleModule {
|
|
|
45
45
|
"Oracle Database is an object-relational database management system developed by Oracle Corporation",
|
|
46
46
|
datasource: {
|
|
47
47
|
host: {
|
|
48
|
-
type:
|
|
48
|
+
type: DatasourceFieldType.STRING,
|
|
49
49
|
default: "localhost",
|
|
50
50
|
required: true,
|
|
51
51
|
},
|
|
52
52
|
port: {
|
|
53
|
-
type:
|
|
53
|
+
type: DatasourceFieldType.NUMBER,
|
|
54
54
|
required: true,
|
|
55
55
|
default: 1521,
|
|
56
56
|
},
|
|
57
57
|
database: {
|
|
58
|
-
type:
|
|
58
|
+
type: DatasourceFieldType.STRING,
|
|
59
59
|
required: true,
|
|
60
60
|
},
|
|
61
61
|
user: {
|
|
62
|
-
type:
|
|
62
|
+
type: DatasourceFieldType.STRING,
|
|
63
63
|
required: true,
|
|
64
64
|
},
|
|
65
65
|
password: {
|
|
66
|
-
type:
|
|
66
|
+
type: DatasourceFieldType.PASSWORD,
|
|
67
67
|
required: true,
|
|
68
68
|
},
|
|
69
69
|
},
|
|
70
70
|
query: {
|
|
71
71
|
create: {
|
|
72
|
-
type:
|
|
72
|
+
type: QueryType.SQL,
|
|
73
73
|
},
|
|
74
74
|
read: {
|
|
75
|
-
type:
|
|
75
|
+
type: QueryType.SQL,
|
|
76
76
|
},
|
|
77
77
|
update: {
|
|
78
|
-
type:
|
|
78
|
+
type: QueryType.SQL,
|
|
79
79
|
},
|
|
80
80
|
delete: {
|
|
81
|
-
type:
|
|
81
|
+
type: QueryType.SQL,
|
|
82
82
|
},
|
|
83
83
|
},
|
|
84
84
|
}
|
|
@@ -172,7 +172,7 @@ module OracleModule {
|
|
|
172
172
|
OR cons.status IS NULL)
|
|
173
173
|
`
|
|
174
174
|
constructor(config: OracleConfig) {
|
|
175
|
-
super(
|
|
175
|
+
super(SqlClient.ORACLE)
|
|
176
176
|
this.config = config
|
|
177
177
|
}
|
|
178
178
|
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Integration,
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
DatasourceFieldType,
|
|
4
|
+
QueryType,
|
|
5
5
|
QueryJson,
|
|
6
6
|
SqlQuery,
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
Table,
|
|
8
|
+
DatasourcePlus,
|
|
9
|
+
} from "@budibase/types"
|
|
9
10
|
import {
|
|
10
11
|
getSqlQuery,
|
|
11
12
|
buildExternalTableId,
|
|
12
13
|
convertSqlType,
|
|
13
14
|
finaliseExternalTables,
|
|
14
|
-
|
|
15
|
+
SqlClient,
|
|
15
16
|
} from "./utils"
|
|
16
|
-
import
|
|
17
|
+
import Sql from "./base/sql"
|
|
17
18
|
|
|
18
19
|
module PostgresModule {
|
|
19
20
|
const { Client, types } = require("pg")
|
|
20
|
-
const Sql = require("./base/sql")
|
|
21
21
|
const { escapeDangerousCharacters } = require("../utilities")
|
|
22
22
|
|
|
23
23
|
// Return "date" and "timestamp" types as plain strings.
|
|
@@ -52,63 +52,63 @@ module PostgresModule {
|
|
|
52
52
|
"PostgreSQL, also known as Postgres, is a free and open-source relational database management system emphasizing extensibility and SQL compliance.",
|
|
53
53
|
datasource: {
|
|
54
54
|
host: {
|
|
55
|
-
type:
|
|
55
|
+
type: DatasourceFieldType.STRING,
|
|
56
56
|
default: "localhost",
|
|
57
57
|
required: true,
|
|
58
58
|
},
|
|
59
59
|
port: {
|
|
60
|
-
type:
|
|
60
|
+
type: DatasourceFieldType.NUMBER,
|
|
61
61
|
required: true,
|
|
62
62
|
default: 5432,
|
|
63
63
|
},
|
|
64
64
|
database: {
|
|
65
|
-
type:
|
|
65
|
+
type: DatasourceFieldType.STRING,
|
|
66
66
|
default: "postgres",
|
|
67
67
|
required: true,
|
|
68
68
|
},
|
|
69
69
|
user: {
|
|
70
|
-
type:
|
|
70
|
+
type: DatasourceFieldType.STRING,
|
|
71
71
|
default: "root",
|
|
72
72
|
required: true,
|
|
73
73
|
},
|
|
74
74
|
password: {
|
|
75
|
-
type:
|
|
75
|
+
type: DatasourceFieldType.PASSWORD,
|
|
76
76
|
default: "root",
|
|
77
77
|
required: true,
|
|
78
78
|
},
|
|
79
79
|
schema: {
|
|
80
|
-
type:
|
|
80
|
+
type: DatasourceFieldType.STRING,
|
|
81
81
|
default: "public",
|
|
82
82
|
required: true,
|
|
83
83
|
},
|
|
84
84
|
ssl: {
|
|
85
|
-
type:
|
|
85
|
+
type: DatasourceFieldType.BOOLEAN,
|
|
86
86
|
default: false,
|
|
87
87
|
required: false,
|
|
88
88
|
},
|
|
89
89
|
rejectUnauthorized: {
|
|
90
|
-
type:
|
|
90
|
+
type: DatasourceFieldType.BOOLEAN,
|
|
91
91
|
default: false,
|
|
92
92
|
required: false,
|
|
93
93
|
},
|
|
94
94
|
ca: {
|
|
95
|
-
type:
|
|
95
|
+
type: DatasourceFieldType.LONGFORM,
|
|
96
96
|
default: false,
|
|
97
97
|
required: false,
|
|
98
98
|
},
|
|
99
99
|
},
|
|
100
100
|
query: {
|
|
101
101
|
create: {
|
|
102
|
-
type:
|
|
102
|
+
type: QueryType.SQL,
|
|
103
103
|
},
|
|
104
104
|
read: {
|
|
105
|
-
type:
|
|
105
|
+
type: QueryType.SQL,
|
|
106
106
|
},
|
|
107
107
|
update: {
|
|
108
|
-
type:
|
|
108
|
+
type: QueryType.SQL,
|
|
109
109
|
},
|
|
110
110
|
delete: {
|
|
111
|
-
type:
|
|
111
|
+
type: QueryType.SQL,
|
|
112
112
|
},
|
|
113
113
|
},
|
|
114
114
|
}
|
|
@@ -117,6 +117,7 @@ module PostgresModule {
|
|
|
117
117
|
private readonly client: any
|
|
118
118
|
private readonly config: PostgresConfig
|
|
119
119
|
private index: number = 1
|
|
120
|
+
private open: boolean
|
|
120
121
|
public tables: Record<string, Table> = {}
|
|
121
122
|
public schemaErrors: Record<string, string> = {}
|
|
122
123
|
|
|
@@ -133,7 +134,7 @@ module PostgresModule {
|
|
|
133
134
|
`
|
|
134
135
|
|
|
135
136
|
constructor(config: PostgresConfig) {
|
|
136
|
-
super(
|
|
137
|
+
super(SqlClient.POSTGRES)
|
|
137
138
|
this.config = config
|
|
138
139
|
|
|
139
140
|
let newConfig = {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { findHBSBlocks, processStringSync } from "@budibase/string-templates"
|
|
2
|
-
import {
|
|
3
|
-
import { DatasourcePlus } from "../base/datasourcePlus"
|
|
2
|
+
import { DatasourcePlus } from "@budibase/types"
|
|
4
3
|
|
|
5
4
|
const CONST_CHAR_REGEX = new RegExp("'[^']*'", "g")
|
|
6
5
|
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DatasourceFieldTypes,
|
|
3
|
-
Integration,
|
|
4
|
-
QueryTypes,
|
|
5
|
-
} from "../definitions/datasource"
|
|
1
|
+
import { DatasourceFieldType, Integration, QueryType } from "@budibase/types"
|
|
6
2
|
import Redis from "ioredis"
|
|
7
3
|
|
|
8
4
|
module RedisModule {
|
|
@@ -40,36 +36,36 @@ module RedisModule {
|
|
|
40
36
|
},
|
|
41
37
|
query: {
|
|
42
38
|
create: {
|
|
43
|
-
type:
|
|
39
|
+
type: QueryType.FIELDS,
|
|
44
40
|
fields: {
|
|
45
41
|
key: {
|
|
46
|
-
type:
|
|
42
|
+
type: DatasourceFieldType.STRING,
|
|
47
43
|
required: true,
|
|
48
44
|
},
|
|
49
45
|
value: {
|
|
50
|
-
type:
|
|
46
|
+
type: DatasourceFieldType.STRING,
|
|
51
47
|
required: true,
|
|
52
48
|
},
|
|
53
49
|
ttl: {
|
|
54
|
-
type:
|
|
50
|
+
type: DatasourceFieldType.NUMBER,
|
|
55
51
|
},
|
|
56
52
|
},
|
|
57
53
|
},
|
|
58
54
|
read: {
|
|
59
55
|
readable: true,
|
|
60
|
-
type:
|
|
56
|
+
type: QueryType.FIELDS,
|
|
61
57
|
fields: {
|
|
62
58
|
key: {
|
|
63
|
-
type:
|
|
59
|
+
type: DatasourceFieldType.STRING,
|
|
64
60
|
required: true,
|
|
65
61
|
},
|
|
66
62
|
},
|
|
67
63
|
},
|
|
68
64
|
delete: {
|
|
69
|
-
type:
|
|
65
|
+
type: QueryType.FIELDS,
|
|
70
66
|
fields: {
|
|
71
67
|
key: {
|
|
72
|
-
type:
|
|
68
|
+
type: DatasourceFieldType.STRING,
|
|
73
69
|
required: true,
|
|
74
70
|
},
|
|
75
71
|
},
|
|
@@ -77,7 +73,7 @@ module RedisModule {
|
|
|
77
73
|
command: {
|
|
78
74
|
readable: true,
|
|
79
75
|
displayName: "Redis Command",
|
|
80
|
-
type:
|
|
76
|
+
type: QueryType.JSON,
|
|
81
77
|
},
|
|
82
78
|
},
|
|
83
79
|
}
|
package/src/integrations/rest.ts
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Integration,
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
RestConfig,
|
|
6
|
-
RestQueryFields as RestQuery,
|
|
3
|
+
DatasourceFieldType,
|
|
4
|
+
QueryType,
|
|
7
5
|
PaginationConfig,
|
|
6
|
+
IntegrationBase,
|
|
7
|
+
PaginationValues,
|
|
8
|
+
RestQueryFields as RestQuery,
|
|
9
|
+
} from "@budibase/types"
|
|
10
|
+
import {
|
|
11
|
+
RestConfig,
|
|
8
12
|
AuthType,
|
|
9
13
|
BasicAuthConfig,
|
|
10
14
|
BearerAuthConfig,
|
|
11
|
-
PaginationValues,
|
|
12
15
|
} from "../definitions/datasource"
|
|
13
|
-
import { IntegrationBase } from "./base/IntegrationBase"
|
|
14
16
|
import { get } from "lodash"
|
|
15
17
|
|
|
16
18
|
const BodyTypes = {
|
|
@@ -24,27 +26,27 @@ const BodyTypes = {
|
|
|
24
26
|
|
|
25
27
|
const coreFields = {
|
|
26
28
|
path: {
|
|
27
|
-
type:
|
|
29
|
+
type: DatasourceFieldType.STRING,
|
|
28
30
|
display: "URL",
|
|
29
31
|
},
|
|
30
32
|
queryString: {
|
|
31
|
-
type:
|
|
33
|
+
type: DatasourceFieldType.STRING,
|
|
32
34
|
},
|
|
33
35
|
headers: {
|
|
34
|
-
type:
|
|
36
|
+
type: DatasourceFieldType.OBJECT,
|
|
35
37
|
},
|
|
36
38
|
enabledHeaders: {
|
|
37
|
-
type:
|
|
39
|
+
type: DatasourceFieldType.OBJECT,
|
|
38
40
|
},
|
|
39
41
|
requestBody: {
|
|
40
|
-
type:
|
|
42
|
+
type: DatasourceFieldType.JSON,
|
|
41
43
|
},
|
|
42
44
|
bodyType: {
|
|
43
|
-
type:
|
|
45
|
+
type: DatasourceFieldType.STRING,
|
|
44
46
|
enum: Object.values(BodyTypes),
|
|
45
47
|
},
|
|
46
48
|
pagination: {
|
|
47
|
-
type:
|
|
49
|
+
type: DatasourceFieldType.OBJECT,
|
|
48
50
|
},
|
|
49
51
|
}
|
|
50
52
|
|
|
@@ -67,13 +69,13 @@ module RestModule {
|
|
|
67
69
|
type: "API",
|
|
68
70
|
datasource: {
|
|
69
71
|
url: {
|
|
70
|
-
type:
|
|
72
|
+
type: DatasourceFieldType.STRING,
|
|
71
73
|
default: "",
|
|
72
74
|
required: false,
|
|
73
75
|
deprecated: true,
|
|
74
76
|
},
|
|
75
77
|
defaultHeaders: {
|
|
76
|
-
type:
|
|
78
|
+
type: DatasourceFieldType.OBJECT,
|
|
77
79
|
required: false,
|
|
78
80
|
default: {},
|
|
79
81
|
},
|
|
@@ -82,30 +84,30 @@ module RestModule {
|
|
|
82
84
|
create: {
|
|
83
85
|
readable: true,
|
|
84
86
|
displayName: "POST",
|
|
85
|
-
type:
|
|
87
|
+
type: QueryType.FIELDS,
|
|
86
88
|
fields: coreFields,
|
|
87
89
|
},
|
|
88
90
|
read: {
|
|
89
91
|
displayName: "GET",
|
|
90
92
|
readable: true,
|
|
91
|
-
type:
|
|
93
|
+
type: QueryType.FIELDS,
|
|
92
94
|
fields: coreFields,
|
|
93
95
|
},
|
|
94
96
|
update: {
|
|
95
97
|
displayName: "PUT",
|
|
96
98
|
readable: true,
|
|
97
|
-
type:
|
|
99
|
+
type: QueryType.FIELDS,
|
|
98
100
|
fields: coreFields,
|
|
99
101
|
},
|
|
100
102
|
patch: {
|
|
101
103
|
displayName: "PATCH",
|
|
102
104
|
readable: true,
|
|
103
|
-
type:
|
|
105
|
+
type: QueryType.FIELDS,
|
|
104
106
|
fields: coreFields,
|
|
105
107
|
},
|
|
106
108
|
delete: {
|
|
107
109
|
displayName: "DELETE",
|
|
108
|
-
type:
|
|
110
|
+
type: QueryType.FIELDS,
|
|
109
111
|
fields: coreFields,
|
|
110
112
|
},
|
|
111
113
|
},
|
package/src/integrations/s3.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Integration,
|
|
2
|
-
import { IntegrationBase } from "./base/IntegrationBase"
|
|
1
|
+
import { Integration, QueryType, IntegrationBase } from "@budibase/types"
|
|
3
2
|
|
|
4
3
|
module S3Module {
|
|
5
4
|
const AWS = require("aws-sdk")
|
|
@@ -44,7 +43,7 @@ module S3Module {
|
|
|
44
43
|
},
|
|
45
44
|
query: {
|
|
46
45
|
read: {
|
|
47
|
-
type:
|
|
46
|
+
type: QueryType.FIELDS,
|
|
48
47
|
fields: {
|
|
49
48
|
bucket: {
|
|
50
49
|
type: "string",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Integration,
|
|
1
|
+
import { Integration, QueryType, SqlQuery } from "@budibase/types"
|
|
2
2
|
import { Snowflake } from "snowflake-promise"
|
|
3
3
|
|
|
4
4
|
module SnowflakeModule {
|
|
@@ -45,16 +45,16 @@ module SnowflakeModule {
|
|
|
45
45
|
},
|
|
46
46
|
query: {
|
|
47
47
|
create: {
|
|
48
|
-
type:
|
|
48
|
+
type: QueryType.SQL,
|
|
49
49
|
},
|
|
50
50
|
read: {
|
|
51
|
-
type:
|
|
51
|
+
type: QueryType.SQL,
|
|
52
52
|
},
|
|
53
53
|
update: {
|
|
54
|
-
type:
|
|
54
|
+
type: QueryType.SQL,
|
|
55
55
|
},
|
|
56
56
|
delete: {
|
|
57
|
-
type:
|
|
57
|
+
type: QueryType.SQL,
|
|
58
58
|
},
|
|
59
59
|
},
|
|
60
60
|
}
|