@budibase/server 1.2.37 → 1.2.38
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.3ce7fa08.js → index.47bfb9a6.js} +1 -1
- package/builder/index.html +1 -1
- package/coverage/clover.xml +2 -2
- package/coverage/coverage-final.json +13 -13
- 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 +1 -1
- package/coverage/lcov-report/api/controllers/row/internal.js.html +3 -3
- 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 +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 +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 +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 +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 +1 -1
- package/coverage/lcov-report/db/utils.js.html +39 -39
- 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 +1 -1
- 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 +1 -1
- package/coverage/lcov-report/utilities/index.html +1 -1
- package/coverage/lcov-report/utilities/index.js.html +1 -1
- 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 +1 -1
- package/coverage/lcov-report/utilities/workerRequests.js.html +1 -1
- 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/static/index.js +2 -2
- package/dist/api/controllers/view/index.js +2 -2
- package/dist/api/controllers/view/utils.js +3 -3
- 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/sql.js +28 -28
- package/dist/integrations/base/sqlTable.js +4 -4
- 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 +14 -14
- package/dist/integrations/mongodb.js +9 -9
- package/dist/integrations/mysql.js +13 -13
- package/dist/integrations/oracle.js +13 -13
- package/dist/integrations/postgres.js +15 -15
- 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 +6 -6
- 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 +7 -7
- 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/static/index.ts +2 -2
- package/src/api/controllers/view/index.js +2 -2
- package/src/api/controllers/view/utils.js +4 -4
- 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/sql.ts +16 -16
- package/src/integrations/base/sqlTable.ts +1 -6
- package/src/integrations/base/utils.ts +1 -2
- 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 +19 -18
- package/src/integrations/mongodb.ts +12 -12
- package/src/integrations/mysql.ts +19 -18
- package/src/integrations/oracle.ts +16 -16
- package/src/integrations/postgres.ts +20 -20
- 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/sql.spec.js +7 -7
- 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/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,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
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const Sql = require("../base/sql")
|
|
2
|
-
const {
|
|
2
|
+
const { SqlClient } = require("../utils")
|
|
3
3
|
|
|
4
4
|
const TABLE_NAME = "test"
|
|
5
5
|
|
|
@@ -47,7 +47,7 @@ function generateDeleteJson(table = TABLE_NAME, filters = {}) {
|
|
|
47
47
|
|
|
48
48
|
describe("SQL query builder", () => {
|
|
49
49
|
const limit = 500
|
|
50
|
-
const client =
|
|
50
|
+
const client = SqlClient.POSTGRES
|
|
51
51
|
let sql
|
|
52
52
|
|
|
53
53
|
beforeEach(() => {
|
|
@@ -174,7 +174,7 @@ describe("SQL query builder", () => {
|
|
|
174
174
|
})
|
|
175
175
|
|
|
176
176
|
it("should work with MS-SQL", () => {
|
|
177
|
-
const query = new Sql(
|
|
177
|
+
const query = new Sql(SqlClient.MS_SQL, 10)._query(generateReadJson())
|
|
178
178
|
expect(query).toEqual({
|
|
179
179
|
bindings: [10],
|
|
180
180
|
sql: `select * from (select top (@p0) * from [${TABLE_NAME}]) as [${TABLE_NAME}]`
|
|
@@ -182,7 +182,7 @@ describe("SQL query builder", () => {
|
|
|
182
182
|
})
|
|
183
183
|
|
|
184
184
|
it("should work with MySQL", () => {
|
|
185
|
-
const query = new Sql(
|
|
185
|
+
const query = new Sql(SqlClient.MY_SQL, 10)._query(generateReadJson())
|
|
186
186
|
expect(query).toEqual({
|
|
187
187
|
bindings: [10],
|
|
188
188
|
sql: `select * from (select * from \`${TABLE_NAME}\` limit ?) as \`${TABLE_NAME}\``
|
|
@@ -241,7 +241,7 @@ describe("SQL query builder", () => {
|
|
|
241
241
|
})
|
|
242
242
|
|
|
243
243
|
it("should use like expression for MS-SQL when filter is contains", () => {
|
|
244
|
-
const query = new Sql(
|
|
244
|
+
const query = new Sql(SqlClient.MS_SQL, 10)._query(generateReadJson({
|
|
245
245
|
filters: {
|
|
246
246
|
contains: {
|
|
247
247
|
age: 20,
|
|
@@ -256,7 +256,7 @@ describe("SQL query builder", () => {
|
|
|
256
256
|
})
|
|
257
257
|
|
|
258
258
|
it("should use JSON_CONTAINS expression for MySQL when filter is contains", () => {
|
|
259
|
-
const query = new Sql(
|
|
259
|
+
const query = new Sql(SqlClient.MY_SQL, 10)._query(generateReadJson({
|
|
260
260
|
filters: {
|
|
261
261
|
contains: {
|
|
262
262
|
age: 20,
|
|
@@ -271,7 +271,7 @@ describe("SQL query builder", () => {
|
|
|
271
271
|
})
|
|
272
272
|
|
|
273
273
|
it("should use jsonb operator expression for PostgreSQL when filter is contains", () => {
|
|
274
|
-
const query = new Sql(
|
|
274
|
+
const query = new Sql(SqlClient.POSTGRES, 10)._query(generateReadJson({
|
|
275
275
|
filters: {
|
|
276
276
|
contains: {
|
|
277
277
|
age: 20,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { DocumentTypes, SEPARATOR } from "../db/utils"
|
|
1
|
+
import { SourceName, SqlQuery, Datasource, Table } from "@budibase/types"
|
|
2
|
+
import { DocumentType, SEPARATOR } from "../db/utils"
|
|
4
3
|
import { FieldTypes, BuildSchemaErrors, InvalidColumns } from "../constants"
|
|
5
4
|
|
|
6
5
|
const DOUBLE_SEPARATOR = `${SEPARATOR}${SEPARATOR}`
|
|
@@ -68,7 +67,7 @@ const SQL_TYPE_MAP = {
|
|
|
68
67
|
...SQL_MISC_TYPE_MAP,
|
|
69
68
|
}
|
|
70
69
|
|
|
71
|
-
export enum
|
|
70
|
+
export enum SqlClient {
|
|
72
71
|
MS_SQL = "mssql",
|
|
73
72
|
POSTGRES = "pg",
|
|
74
73
|
MY_SQL = "mysql2",
|
|
@@ -76,7 +75,7 @@ export enum SqlClients {
|
|
|
76
75
|
}
|
|
77
76
|
|
|
78
77
|
export function isExternalTable(tableId: string) {
|
|
79
|
-
return tableId.includes(
|
|
78
|
+
return tableId.includes(DocumentType.DATASOURCE)
|
|
80
79
|
}
|
|
81
80
|
|
|
82
81
|
export function buildExternalTableId(datasourceId: string, tableName: string) {
|
|
@@ -169,10 +168,10 @@ export function isSQL(datasource: Datasource): boolean {
|
|
|
169
168
|
return false
|
|
170
169
|
}
|
|
171
170
|
const SQL = [
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
171
|
+
SourceName.POSTGRES,
|
|
172
|
+
SourceName.SQL_SERVER,
|
|
173
|
+
SourceName.MYSQL,
|
|
174
|
+
SourceName.ORACLE,
|
|
176
175
|
]
|
|
177
176
|
return SQL.indexOf(datasource.source) !== -1
|
|
178
177
|
}
|
|
@@ -6,7 +6,7 @@ const {
|
|
|
6
6
|
setDebounce,
|
|
7
7
|
} = require("../utilities/redis")
|
|
8
8
|
const { doWithDB } = require("@budibase/backend-core/db")
|
|
9
|
-
const {
|
|
9
|
+
const { DocumentType, getGlobalIDFromUserMetadataID } = require("../db/utils")
|
|
10
10
|
const { PermissionTypes } = require("@budibase/backend-core/permissions")
|
|
11
11
|
const { app: appCache } = require("@budibase/backend-core/cache")
|
|
12
12
|
|
|
@@ -49,7 +49,7 @@ async function updateAppUpdatedAt(ctx) {
|
|
|
49
49
|
return
|
|
50
50
|
}
|
|
51
51
|
await doWithDB(appId, async db => {
|
|
52
|
-
const metadata = await db.get(
|
|
52
|
+
const metadata = await db.get(DocumentType.APP_METADATA)
|
|
53
53
|
metadata.updatedAt = new Date().toISOString()
|
|
54
54
|
|
|
55
55
|
metadata.updatedBy = getGlobalIDFromUserMetadataID(ctx.user.userId)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const { DocumentType } = require("@budibase/backend-core/db")
|
|
2
2
|
import { getAppUrl } from "../../api/controllers/application"
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -11,7 +11,7 @@ import { getAppUrl } from "../../api/controllers/application"
|
|
|
11
11
|
export const run = async (appDb: any) => {
|
|
12
12
|
let metadata
|
|
13
13
|
try {
|
|
14
|
-
metadata = await appDb.get(
|
|
14
|
+
metadata = await appDb.get(DocumentType.APP_METADATA)
|
|
15
15
|
} catch (e) {
|
|
16
16
|
// sometimes the metadata document doesn't exist
|
|
17
17
|
// exit early instead of failing the migration
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { events } from "@budibase/backend-core"
|
|
2
2
|
import { getQueryParams } from "../../../../db/utils"
|
|
3
|
-
import { Query, Datasource } from "@budibase/types"
|
|
3
|
+
import { Query, Datasource, SourceName } from "@budibase/types"
|
|
4
4
|
|
|
5
5
|
const getQueries = async (appDb: any): Promise<Query[]> => {
|
|
6
6
|
const response = await appDb.allDocs(
|
|
@@ -31,8 +31,9 @@ export const backfill = async (appDb: any, timestamp: string | number) => {
|
|
|
31
31
|
// and the query has not
|
|
32
32
|
if (e.status === 404) {
|
|
33
33
|
datasource = {
|
|
34
|
+
type: "unknown",
|
|
34
35
|
_id: query.datasourceId,
|
|
35
|
-
source:
|
|
36
|
+
source: SourceName.UNKNOWN,
|
|
36
37
|
}
|
|
37
38
|
} else {
|
|
38
39
|
throw e
|
|
@@ -62,7 +62,7 @@ export const run = async (appDb: any) => {
|
|
|
62
62
|
await events.backfillCache.start(EVENTS)
|
|
63
63
|
|
|
64
64
|
let timestamp: string | number = DEFAULT_TIMESTAMP
|
|
65
|
-
const app: App = await appDb.get(dbUtils.
|
|
65
|
+
const app: App = await appDb.get(dbUtils.DocumentType.APP_METADATA)
|
|
66
66
|
if (app.createdAt) {
|
|
67
67
|
timestamp = app.createdAt as string
|
|
68
68
|
}
|
|
@@ -4,7 +4,7 @@ import { DEFAULT_TIMESTAMP } from ".."
|
|
|
4
4
|
|
|
5
5
|
// manually define user doc params - normally server doesn't read users from the db
|
|
6
6
|
const getUserParams = (props: any) => {
|
|
7
|
-
return dbUtils.getDocParams(dbUtils.
|
|
7
|
+
return dbUtils.getDocParams(dbUtils.DocumentType.USER, null, props)
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export const getUsers = async (globalDb: any): Promise<User[]> => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const { DocumentType, doWithDB } = require("@budibase/backend-core/db")
|
|
2
2
|
const TestConfig = require("../../../tests/utilities/TestConfiguration")
|
|
3
3
|
|
|
4
4
|
const migration = require("../appUrls")
|
|
@@ -15,11 +15,11 @@ describe("run", () => {
|
|
|
15
15
|
it("runs successfully", async () => {
|
|
16
16
|
const app = await config.createApp("testApp")
|
|
17
17
|
const metadata = await doWithDB(app.appId, async db => {
|
|
18
|
-
const metadataDoc = await db.get(
|
|
18
|
+
const metadataDoc = await db.get( DocumentType.APP_METADATA)
|
|
19
19
|
delete metadataDoc.url
|
|
20
20
|
await db.put(metadataDoc)
|
|
21
21
|
await migration.run(db)
|
|
22
|
-
return await db.get(
|
|
22
|
+
return await db.get( DocumentType.APP_METADATA)
|
|
23
23
|
})
|
|
24
24
|
expect(metadata.url).toEqual("/testapp")
|
|
25
25
|
})
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
events,
|
|
3
3
|
migrations,
|
|
4
4
|
tenancy,
|
|
5
|
-
|
|
5
|
+
DocumentType,
|
|
6
6
|
context,
|
|
7
7
|
db,
|
|
8
8
|
} from "@budibase/backend-core"
|
|
@@ -17,7 +17,7 @@ const timestamp = mocks.date.MOCK_DATE.toISOString()
|
|
|
17
17
|
const clearMigrations = async () => {
|
|
18
18
|
const dbs = [context.getDevAppDB(), context.getProdAppDB()]
|
|
19
19
|
for (const db of dbs) {
|
|
20
|
-
const doc = await db.get(
|
|
20
|
+
const doc = await db.get(DocumentType.MIGRATIONS)
|
|
21
21
|
const newDoc = { _id: doc._id, _rev: doc._rev }
|
|
22
22
|
await db.put(newDoc)
|
|
23
23
|
}
|
|
@@ -25,7 +25,7 @@ const newid = require("../../db/newid")
|
|
|
25
25
|
const context = require("@budibase/backend-core/context")
|
|
26
26
|
const { generateDevInfoID, SEPARATOR } = require("@budibase/backend-core/db")
|
|
27
27
|
const { encrypt } = require("@budibase/backend-core/encryption")
|
|
28
|
-
const {
|
|
28
|
+
const { DocumentType } = require("../../db/utils")
|
|
29
29
|
|
|
30
30
|
const GLOBAL_USER_ID = "us_uuid1"
|
|
31
31
|
const EMAIL = "babs@babs.com"
|
|
@@ -344,7 +344,7 @@ class TestConfiguration {
|
|
|
344
344
|
|
|
345
345
|
return context.doInAppContext(prodAppId, async () => {
|
|
346
346
|
const db = context.getProdAppDB()
|
|
347
|
-
return await db.get(
|
|
347
|
+
return await db.get(DocumentType.APP_METADATA)
|
|
348
348
|
})
|
|
349
349
|
}
|
|
350
350
|
|
|
@@ -11,7 +11,7 @@ import { storeLog } from "../automations/logging"
|
|
|
11
11
|
import { Automation, AutomationStep, AutomationStatus } from "@budibase/types"
|
|
12
12
|
import {
|
|
13
13
|
LoopStep,
|
|
14
|
-
|
|
14
|
+
LoopStepType,
|
|
15
15
|
LoopInput,
|
|
16
16
|
AutomationEvent,
|
|
17
17
|
TriggerOutput,
|
|
@@ -35,12 +35,12 @@ function typecastForLooping(loopStep: LoopStep, input: LoopInput) {
|
|
|
35
35
|
}
|
|
36
36
|
try {
|
|
37
37
|
switch (loopStep.inputs.option) {
|
|
38
|
-
case
|
|
38
|
+
case LoopStepType.ARRAY:
|
|
39
39
|
if (typeof input.binding === "string") {
|
|
40
40
|
return JSON.parse(input.binding)
|
|
41
41
|
}
|
|
42
42
|
break
|
|
43
|
-
case
|
|
43
|
+
case LoopStepType.STRING:
|
|
44
44
|
if (Array.isArray(input.binding)) {
|
|
45
45
|
return input.binding.join(",")
|
|
46
46
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
const { createRoutingView } = require("../../db/views/staticViews")
|
|
2
|
-
const {
|
|
2
|
+
const { ViewName, getQueryIndex, UNICODE_MAX } = require("../../db/utils")
|
|
3
3
|
const { getAppDB } = require("@budibase/backend-core/context")
|
|
4
4
|
|
|
5
5
|
exports.getRoutingInfo = async () => {
|
|
6
6
|
const db = getAppDB()
|
|
7
7
|
try {
|
|
8
|
-
const allRouting = await db.query(getQueryIndex(
|
|
8
|
+
const allRouting = await db.query(getQueryIndex(ViewName.ROUTING), {
|
|
9
9
|
startKey: "",
|
|
10
10
|
endKey: UNICODE_MAX,
|
|
11
11
|
})
|
|
@@ -8,7 +8,7 @@ const {
|
|
|
8
8
|
lowerBuiltinRoleID,
|
|
9
9
|
getBuiltinRoles,
|
|
10
10
|
} = require("@budibase/backend-core/roles")
|
|
11
|
-
const {
|
|
11
|
+
const { DocumentType } = require("../db/utils")
|
|
12
12
|
|
|
13
13
|
const CURRENTLY_SUPPORTED_LEVELS = [
|
|
14
14
|
PermissionLevels.WRITE,
|
|
@@ -17,19 +17,19 @@ const CURRENTLY_SUPPORTED_LEVELS = [
|
|
|
17
17
|
]
|
|
18
18
|
|
|
19
19
|
exports.getPermissionType = resourceId => {
|
|
20
|
-
const docType = Object.values(
|
|
20
|
+
const docType = Object.values(DocumentType).filter(docType =>
|
|
21
21
|
resourceId.startsWith(docType)
|
|
22
22
|
)[0]
|
|
23
23
|
switch (docType) {
|
|
24
|
-
case
|
|
25
|
-
case
|
|
24
|
+
case DocumentType.TABLE:
|
|
25
|
+
case DocumentType.ROW:
|
|
26
26
|
return PermissionTypes.TABLE
|
|
27
|
-
case
|
|
27
|
+
case DocumentType.AUTOMATION:
|
|
28
28
|
return PermissionTypes.AUTOMATION
|
|
29
|
-
case
|
|
29
|
+
case DocumentType.WEBHOOK:
|
|
30
30
|
return PermissionTypes.WEBHOOK
|
|
31
|
-
case
|
|
32
|
-
case
|
|
31
|
+
case DocumentType.QUERY:
|
|
32
|
+
case DocumentType.DATASOURCE:
|
|
33
33
|
return PermissionTypes.QUERY
|
|
34
34
|
default:
|
|
35
35
|
// views don't have an ID, will end up here
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Table } from "../../definitions/common"
|
|
2
|
-
import { IntegrationBase } from "./IntegrationBase"
|
|
3
|
-
|
|
4
|
-
export interface DatasourcePlus extends IntegrationBase {
|
|
5
|
-
tables: Record<string, Table>
|
|
6
|
-
schemaErrors: Record<string, string>
|
|
7
|
-
|
|
8
|
-
// if the datasource supports the use of bindings directly (to protect against SQL injection)
|
|
9
|
-
// this returns the format of the identifier
|
|
10
|
-
getBindingIdentifier(): string
|
|
11
|
-
getStringConcat(parts: string[]): string
|
|
12
|
-
buildSchema(datasourceId: string, entities: Record<string, Table>): any
|
|
13
|
-
}
|