@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,214 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
UPDATE = "UPDATE",
|
|
7
|
-
DELETE = "DELETE",
|
|
8
|
-
BULK_CREATE = "BULK_CREATE",
|
|
9
|
-
CREATE_TABLE = "CREATE_TABLE",
|
|
10
|
-
UPDATE_TABLE = "UPDATE_TABLE",
|
|
11
|
-
DELETE_TABLE = "DELETE_TABLE",
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export enum SortDirection {
|
|
15
|
-
ASCENDING = "ASCENDING",
|
|
16
|
-
DESCENDING = "DESCENDING",
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export enum QueryTypes {
|
|
20
|
-
SQL = "sql",
|
|
21
|
-
JSON = "json",
|
|
22
|
-
FIELDS = "fields",
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export enum DatasourceFieldTypes {
|
|
26
|
-
STRING = "string",
|
|
27
|
-
LONGFORM = "longForm",
|
|
28
|
-
BOOLEAN = "boolean",
|
|
29
|
-
NUMBER = "number",
|
|
30
|
-
PASSWORD = "password",
|
|
31
|
-
LIST = "list",
|
|
32
|
-
OBJECT = "object",
|
|
33
|
-
JSON = "json",
|
|
34
|
-
FILE = "file",
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export enum SourceNames {
|
|
38
|
-
POSTGRES = "POSTGRES",
|
|
39
|
-
DYNAMODB = "DYNAMODB",
|
|
40
|
-
MONGODB = "MONGODB",
|
|
41
|
-
ELASTICSEARCH = "ELASTICSEARCH",
|
|
42
|
-
COUCHDB = "COUCHDB",
|
|
43
|
-
SQL_SERVER = "SQL_SERVER",
|
|
44
|
-
S3 = "S3",
|
|
45
|
-
AIRTABLE = "AIRTABLE",
|
|
46
|
-
MYSQL = "MYSQL",
|
|
47
|
-
ARANGODB = "ARANGODB",
|
|
48
|
-
REST = "REST",
|
|
49
|
-
ORACLE = "ORACLE",
|
|
50
|
-
GOOGLE_SHEETS = "GOOGLE_SHEETS",
|
|
51
|
-
FIRESTORE = "FIRESTORE",
|
|
52
|
-
REDIS = "REDIS",
|
|
53
|
-
SNOWFLAKE = "SNOWFLAKE",
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export enum IncludeRelationships {
|
|
57
|
-
INCLUDE = 1,
|
|
58
|
-
EXCLUDE = 0,
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export enum FilterTypes {
|
|
62
|
-
STRING = "string",
|
|
63
|
-
FUZZY = "fuzzy",
|
|
64
|
-
RANGE = "range",
|
|
65
|
-
EQUAL = "equal",
|
|
66
|
-
NOT_EQUAL = "notEqual",
|
|
67
|
-
EMPTY = "empty",
|
|
68
|
-
NOT_EMPTY = "notEmpty",
|
|
69
|
-
ONE_OF = "oneOf",
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export interface QueryDefinition {
|
|
73
|
-
type: QueryTypes
|
|
74
|
-
displayName?: string
|
|
75
|
-
readable?: boolean
|
|
76
|
-
customisable?: boolean
|
|
77
|
-
fields?: object
|
|
78
|
-
urlDisplay?: boolean
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export interface ExtraQueryConfig {
|
|
82
|
-
[key: string]: {
|
|
83
|
-
displayName: string
|
|
84
|
-
type: string
|
|
85
|
-
required: boolean
|
|
86
|
-
data?: object
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export interface Integration {
|
|
91
|
-
docs: string
|
|
92
|
-
plus?: boolean
|
|
93
|
-
auth?: { type: string }
|
|
94
|
-
relationships?: boolean
|
|
95
|
-
description: string
|
|
96
|
-
friendlyName: string
|
|
97
|
-
type?: string
|
|
98
|
-
datasource: {}
|
|
99
|
-
query: {
|
|
100
|
-
[key: string]: QueryDefinition
|
|
101
|
-
}
|
|
102
|
-
extra?: ExtraQueryConfig
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
export interface SearchFilters {
|
|
106
|
-
allOr?: boolean
|
|
107
|
-
string?: {
|
|
108
|
-
[key: string]: string
|
|
109
|
-
}
|
|
110
|
-
fuzzy?: {
|
|
111
|
-
[key: string]: string
|
|
112
|
-
}
|
|
113
|
-
range?: {
|
|
114
|
-
[key: string]: {
|
|
115
|
-
high: number | string
|
|
116
|
-
low: number | string
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
equal?: {
|
|
120
|
-
[key: string]: any
|
|
121
|
-
}
|
|
122
|
-
notEqual?: {
|
|
123
|
-
[key: string]: any
|
|
124
|
-
}
|
|
125
|
-
empty?: {
|
|
126
|
-
[key: string]: any
|
|
127
|
-
}
|
|
128
|
-
notEmpty?: {
|
|
129
|
-
[key: string]: any
|
|
130
|
-
}
|
|
131
|
-
oneOf?: {
|
|
132
|
-
[key: string]: any[]
|
|
133
|
-
}
|
|
134
|
-
contains?: {
|
|
135
|
-
[key: string]: any
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
export interface SortJson {
|
|
140
|
-
[key: string]: SortDirection
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
export interface PaginationJson {
|
|
144
|
-
limit: number
|
|
145
|
-
page?: string | number
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
export interface RenameColumn {
|
|
149
|
-
old: string
|
|
150
|
-
updated: string
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
export interface RelationshipsJson {
|
|
154
|
-
through?: string
|
|
155
|
-
from?: string
|
|
156
|
-
to?: string
|
|
157
|
-
fromPrimary?: string
|
|
158
|
-
toPrimary?: string
|
|
159
|
-
tableName: string
|
|
160
|
-
column: string
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
export interface QueryJson {
|
|
164
|
-
endpoint: {
|
|
165
|
-
datasourceId: string
|
|
166
|
-
entityId: string
|
|
167
|
-
operation: Operation
|
|
168
|
-
schema?: string
|
|
169
|
-
}
|
|
170
|
-
resource: {
|
|
171
|
-
fields: string[]
|
|
172
|
-
}
|
|
173
|
-
filters?: SearchFilters
|
|
174
|
-
sort?: SortJson
|
|
175
|
-
paginate?: PaginationJson
|
|
176
|
-
body?: Row | Row[]
|
|
177
|
-
table?: Table
|
|
178
|
-
meta?: {
|
|
179
|
-
table?: Table
|
|
180
|
-
tables?: Record<string, Table>
|
|
181
|
-
renamed: RenameColumn
|
|
182
|
-
}
|
|
183
|
-
extra?: {
|
|
184
|
-
idFilter?: SearchFilters
|
|
185
|
-
}
|
|
186
|
-
relationships?: RelationshipsJson[]
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
export interface SqlQuery {
|
|
190
|
-
sql: string
|
|
191
|
-
bindings?: string[]
|
|
192
|
-
}
|
|
1
|
+
/********************************************
|
|
2
|
+
* This file contains structures which are *
|
|
3
|
+
* internal to the server and don't need to *
|
|
4
|
+
* be exposed for use by other services. *
|
|
5
|
+
********************************************/
|
|
193
6
|
|
|
194
7
|
export interface QueryOptions {
|
|
195
8
|
disableReturning?: boolean
|
|
196
9
|
}
|
|
197
10
|
|
|
198
|
-
export interface Datasource extends Base {
|
|
199
|
-
type: string
|
|
200
|
-
name: string
|
|
201
|
-
source: SourceNames
|
|
202
|
-
// the config is defined by the schema
|
|
203
|
-
config: {
|
|
204
|
-
[key: string]: string | number | boolean
|
|
205
|
-
}
|
|
206
|
-
plus: boolean
|
|
207
|
-
entities?: {
|
|
208
|
-
[key: string]: Table
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
|
|
212
11
|
export enum AuthType {
|
|
213
12
|
BASIC = "basic",
|
|
214
13
|
BEARER = "bearer",
|
|
@@ -230,25 +29,6 @@ export interface BearerAuthConfig {
|
|
|
230
29
|
token: string
|
|
231
30
|
}
|
|
232
31
|
|
|
233
|
-
export interface QueryParameter {
|
|
234
|
-
name: string
|
|
235
|
-
default: string
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
export interface RestQueryFields {
|
|
239
|
-
path: string
|
|
240
|
-
queryString?: string
|
|
241
|
-
headers: { [key: string]: any }
|
|
242
|
-
disabledHeaders: { [key: string]: any }
|
|
243
|
-
requestBody: any
|
|
244
|
-
bodyType: string
|
|
245
|
-
json: object
|
|
246
|
-
method: string
|
|
247
|
-
authConfigId: string
|
|
248
|
-
pagination: PaginationConfig | null
|
|
249
|
-
paginationValues: PaginationValues | null
|
|
250
|
-
}
|
|
251
|
-
|
|
252
32
|
export interface RestConfig {
|
|
253
33
|
url: string
|
|
254
34
|
defaultHeaders: {
|
|
@@ -266,28 +46,3 @@ export interface RestConfig {
|
|
|
266
46
|
}
|
|
267
47
|
]
|
|
268
48
|
}
|
|
269
|
-
|
|
270
|
-
export interface PaginationConfig {
|
|
271
|
-
type: string
|
|
272
|
-
location: string
|
|
273
|
-
pageParam: string
|
|
274
|
-
sizeParam: string | null
|
|
275
|
-
responseParam: string | null
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
export interface PaginationValues {
|
|
279
|
-
page: string | number | null
|
|
280
|
-
limit: number | null
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
export interface Query {
|
|
284
|
-
_id?: string
|
|
285
|
-
datasourceId: string
|
|
286
|
-
name: string
|
|
287
|
-
parameters: QueryParameter[]
|
|
288
|
-
fields: RestQueryFields | any
|
|
289
|
-
transformer: string | null
|
|
290
|
-
schema: any
|
|
291
|
-
readable: boolean
|
|
292
|
-
queryVerb: string
|
|
293
|
-
}
|
|
@@ -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
|
|
|
8
8
|
module AirtableModule {
|
|
9
9
|
const Airtable = require("airtable")
|
|
@@ -21,61 +21,61 @@ module AirtableModule {
|
|
|
21
21
|
type: "Spreadsheet",
|
|
22
22
|
datasource: {
|
|
23
23
|
apiKey: {
|
|
24
|
-
type:
|
|
24
|
+
type: DatasourceFieldType.PASSWORD,
|
|
25
25
|
default: "enter api key",
|
|
26
26
|
required: true,
|
|
27
27
|
},
|
|
28
28
|
base: {
|
|
29
|
-
type:
|
|
29
|
+
type: DatasourceFieldType.STRING,
|
|
30
30
|
default: "mybase",
|
|
31
31
|
required: true,
|
|
32
32
|
},
|
|
33
33
|
},
|
|
34
34
|
query: {
|
|
35
35
|
create: {
|
|
36
|
-
type:
|
|
36
|
+
type: QueryType.FIELDS,
|
|
37
37
|
customisable: true,
|
|
38
38
|
fields: {
|
|
39
39
|
table: {
|
|
40
|
-
type:
|
|
40
|
+
type: DatasourceFieldType.STRING,
|
|
41
41
|
required: true,
|
|
42
42
|
},
|
|
43
43
|
},
|
|
44
44
|
},
|
|
45
45
|
read: {
|
|
46
|
-
type:
|
|
46
|
+
type: QueryType.FIELDS,
|
|
47
47
|
fields: {
|
|
48
48
|
table: {
|
|
49
|
-
type:
|
|
49
|
+
type: DatasourceFieldType.STRING,
|
|
50
50
|
required: true,
|
|
51
51
|
},
|
|
52
52
|
view: {
|
|
53
|
-
type:
|
|
53
|
+
type: DatasourceFieldType.STRING,
|
|
54
54
|
required: true,
|
|
55
55
|
},
|
|
56
56
|
numRecords: {
|
|
57
|
-
type:
|
|
57
|
+
type: DatasourceFieldType.NUMBER,
|
|
58
58
|
default: 10,
|
|
59
59
|
},
|
|
60
60
|
},
|
|
61
61
|
},
|
|
62
62
|
update: {
|
|
63
|
-
type:
|
|
63
|
+
type: QueryType.FIELDS,
|
|
64
64
|
customisable: true,
|
|
65
65
|
fields: {
|
|
66
66
|
id: {
|
|
67
67
|
display: "Record ID",
|
|
68
|
-
type:
|
|
68
|
+
type: DatasourceFieldType.STRING,
|
|
69
69
|
required: true,
|
|
70
70
|
},
|
|
71
71
|
table: {
|
|
72
|
-
type:
|
|
72
|
+
type: DatasourceFieldType.STRING,
|
|
73
73
|
required: true,
|
|
74
74
|
},
|
|
75
75
|
},
|
|
76
76
|
},
|
|
77
77
|
delete: {
|
|
78
|
-
type:
|
|
78
|
+
type: QueryType.JSON,
|
|
79
79
|
},
|
|
80
80
|
},
|
|
81
81
|
}
|
|
@@ -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
|
|
|
8
8
|
module ArangoModule {
|
|
9
9
|
const { Database, aql } = require("arangojs")
|
|
@@ -24,35 +24,35 @@ module ArangoModule {
|
|
|
24
24
|
"ArangoDB is a scalable open-source multi-model database natively supporting graph, document and search. All supported data models & access patterns can be combined in queries allowing for maximal flexibility. ",
|
|
25
25
|
datasource: {
|
|
26
26
|
url: {
|
|
27
|
-
type:
|
|
27
|
+
type: DatasourceFieldType.STRING,
|
|
28
28
|
default: "http://localhost:8529",
|
|
29
29
|
required: true,
|
|
30
30
|
},
|
|
31
31
|
username: {
|
|
32
|
-
type:
|
|
32
|
+
type: DatasourceFieldType.STRING,
|
|
33
33
|
default: "root",
|
|
34
34
|
required: true,
|
|
35
35
|
},
|
|
36
36
|
password: {
|
|
37
|
-
type:
|
|
37
|
+
type: DatasourceFieldType.PASSWORD,
|
|
38
38
|
required: true,
|
|
39
39
|
},
|
|
40
40
|
databaseName: {
|
|
41
|
-
type:
|
|
41
|
+
type: DatasourceFieldType.STRING,
|
|
42
42
|
default: "_system",
|
|
43
43
|
required: true,
|
|
44
44
|
},
|
|
45
45
|
collection: {
|
|
46
|
-
type:
|
|
46
|
+
type: DatasourceFieldType.STRING,
|
|
47
47
|
required: true,
|
|
48
48
|
},
|
|
49
49
|
},
|
|
50
50
|
query: {
|
|
51
51
|
read: {
|
|
52
|
-
type:
|
|
52
|
+
type: QueryType.SQL,
|
|
53
53
|
},
|
|
54
54
|
create: {
|
|
55
|
-
type:
|
|
55
|
+
type: QueryType.JSON,
|
|
56
56
|
},
|
|
57
57
|
},
|
|
58
58
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { QueryJson, Datasource } from "@budibase/types"
|
|
2
|
+
const { integrations } = require("../index")
|
|
3
|
+
|
|
4
|
+
export async function makeExternalQuery(
|
|
5
|
+
datasource: Datasource,
|
|
6
|
+
json: QueryJson
|
|
7
|
+
) {
|
|
8
|
+
const Integration = integrations[datasource.source]
|
|
9
|
+
// query is the opinionated function
|
|
10
|
+
if (Integration.prototype.query) {
|
|
11
|
+
const integration = new Integration(datasource.config)
|
|
12
|
+
return integration.query(json)
|
|
13
|
+
} else {
|
|
14
|
+
throw "Datasource does not support query."
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -2,14 +2,15 @@ import { Knex, knex } from "knex"
|
|
|
2
2
|
import {
|
|
3
3
|
Operation,
|
|
4
4
|
QueryJson,
|
|
5
|
-
QueryOptions,
|
|
6
5
|
RelationshipsJson,
|
|
7
6
|
SearchFilters,
|
|
8
7
|
SortDirection,
|
|
9
|
-
} from "
|
|
10
|
-
import {
|
|
8
|
+
} from "@budibase/types"
|
|
9
|
+
import { QueryOptions } from "../../definitions/datasource"
|
|
10
|
+
import { isIsoDateString, SqlClient } from "../utils"
|
|
11
11
|
import SqlTableQueryBuilder from "./sqlTable"
|
|
12
12
|
import environment from "../../environment"
|
|
13
|
+
import { removeKeyNumbering } from "./utils"
|
|
13
14
|
|
|
14
15
|
const envLimit = environment.SQL_MAX_ROWS
|
|
15
16
|
? parseInt(environment.SQL_MAX_ROWS)
|
|
@@ -27,14 +28,14 @@ function likeKey(client: string, key: string): string {
|
|
|
27
28
|
}
|
|
28
29
|
let start: string, end: string
|
|
29
30
|
switch (client) {
|
|
30
|
-
case
|
|
31
|
+
case SqlClient.MY_SQL:
|
|
31
32
|
start = end = "`"
|
|
32
33
|
break
|
|
33
|
-
case
|
|
34
|
-
case
|
|
34
|
+
case SqlClient.ORACLE:
|
|
35
|
+
case SqlClient.POSTGRES:
|
|
35
36
|
start = end = '"'
|
|
36
37
|
break
|
|
37
|
-
case
|
|
38
|
+
case SqlClient.MS_SQL:
|
|
38
39
|
start = "["
|
|
39
40
|
end = "]"
|
|
40
41
|
break
|
|
@@ -102,7 +103,7 @@ function generateSelectStatement(
|
|
|
102
103
|
if (
|
|
103
104
|
columnName &&
|
|
104
105
|
schema?.[columnName] &&
|
|
105
|
-
knex.client.config.client ===
|
|
106
|
+
knex.client.config.client === SqlClient.POSTGRES
|
|
106
107
|
) {
|
|
107
108
|
const externalType = schema[columnName].externalType
|
|
108
109
|
if (externalType?.includes("money")) {
|
|
@@ -133,12 +134,13 @@ class InternalBuilder {
|
|
|
133
134
|
fn: (key: string, value: any) => void
|
|
134
135
|
) {
|
|
135
136
|
for (let [key, value] of Object.entries(structure)) {
|
|
136
|
-
const
|
|
137
|
+
const updatedKey = removeKeyNumbering(key)
|
|
138
|
+
const isRelationshipField = updatedKey.includes(".")
|
|
137
139
|
if (!opts.relationship && !isRelationshipField) {
|
|
138
|
-
fn(`${opts.tableName}.${
|
|
140
|
+
fn(`${opts.tableName}.${updatedKey}`, value)
|
|
139
141
|
}
|
|
140
142
|
if (opts.relationship && isRelationshipField) {
|
|
141
|
-
fn(
|
|
143
|
+
fn(updatedKey, value)
|
|
142
144
|
}
|
|
143
145
|
}
|
|
144
146
|
}
|
|
@@ -146,7 +148,7 @@ class InternalBuilder {
|
|
|
146
148
|
const like = (key: string, value: any) => {
|
|
147
149
|
const fnc = allOr ? "orWhere" : "where"
|
|
148
150
|
// postgres supports ilike, nothing else does
|
|
149
|
-
if (this.client ===
|
|
151
|
+
if (this.client === SqlClient.POSTGRES) {
|
|
150
152
|
query = query[fnc](key, "ilike", `%${value}%`)
|
|
151
153
|
} else {
|
|
152
154
|
const rawFnc = `${fnc}Raw`
|
|
@@ -173,7 +175,7 @@ class InternalBuilder {
|
|
|
173
175
|
iterate(filters.string, (key, value) => {
|
|
174
176
|
const fnc = allOr ? "orWhere" : "where"
|
|
175
177
|
// postgres supports ilike, nothing else does
|
|
176
|
-
if (this.client ===
|
|
178
|
+
if (this.client === SqlClient.POSTGRES) {
|
|
177
179
|
query = query[fnc](key, "ilike", `${value}%`)
|
|
178
180
|
} else {
|
|
179
181
|
const rawFnc = `${fnc}Raw`
|
|
@@ -229,7 +231,7 @@ class InternalBuilder {
|
|
|
229
231
|
if (filters.contains) {
|
|
230
232
|
const fnc = allOr ? "orWhere" : "where"
|
|
231
233
|
const rawFnc = `${fnc}Raw`
|
|
232
|
-
if (this.client ===
|
|
234
|
+
if (this.client === SqlClient.POSTGRES) {
|
|
233
235
|
iterate(filters.contains, (key: string, value: any) => {
|
|
234
236
|
const fieldNames = key.split(/\./g)
|
|
235
237
|
const tableName = fieldNames[0]
|
|
@@ -242,7 +244,7 @@ class InternalBuilder {
|
|
|
242
244
|
`"${tableName}"."${columnName}"::jsonb @> '[${value}]'`
|
|
243
245
|
)
|
|
244
246
|
})
|
|
245
|
-
} else if (this.client ===
|
|
247
|
+
} else if (this.client === SqlClient.MY_SQL) {
|
|
246
248
|
iterate(filters.contains, (key: string, value: any) => {
|
|
247
249
|
if (typeof value === "string") {
|
|
248
250
|
value = `"${value}"`
|
|
@@ -265,7 +267,7 @@ class InternalBuilder {
|
|
|
265
267
|
const direction = value === SortDirection.ASCENDING ? "asc" : "desc"
|
|
266
268
|
query = query.orderBy(`${table?.name}.${key}`, direction)
|
|
267
269
|
}
|
|
268
|
-
} else if (this.client ===
|
|
270
|
+
} else if (this.client === SqlClient.MS_SQL && paginate?.limit) {
|
|
269
271
|
// @ts-ignore
|
|
270
272
|
query = query.orderBy(`${table?.name}.${table?.primary[0]}`)
|
|
271
273
|
}
|
|
@@ -414,7 +416,7 @@ class InternalBuilder {
|
|
|
414
416
|
[tableName]: query,
|
|
415
417
|
}).select(selectStatement)
|
|
416
418
|
// have to add after as well (this breaks MS-SQL)
|
|
417
|
-
if (this.client !==
|
|
419
|
+
if (this.client !== SqlClient.MS_SQL) {
|
|
418
420
|
preQuery = this.addSorting(preQuery, json)
|
|
419
421
|
}
|
|
420
422
|
// handle joins
|
|
@@ -565,9 +567,9 @@ class SqlQueryBuilder extends SqlTableQueryBuilder {
|
|
|
565
567
|
// same as delete, manage returning
|
|
566
568
|
if (operation === Operation.CREATE || operation === Operation.UPDATE) {
|
|
567
569
|
let id
|
|
568
|
-
if (sqlClient ===
|
|
570
|
+
if (sqlClient === SqlClient.MS_SQL) {
|
|
569
571
|
id = results?.[0].id
|
|
570
|
-
} else if (sqlClient ===
|
|
572
|
+
} else if (sqlClient === SqlClient.MY_SQL) {
|
|
571
573
|
id = results?.insertId
|
|
572
574
|
}
|
|
573
575
|
row = processFn(
|
|
@@ -582,4 +584,3 @@ class SqlQueryBuilder extends SqlTableQueryBuilder {
|
|
|
582
584
|
}
|
|
583
585
|
|
|
584
586
|
export default SqlQueryBuilder
|
|
585
|
-
module.exports = SqlQueryBuilder
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import { Knex, knex } from "knex"
|
|
2
|
-
import { Table } from "
|
|
3
|
-
import {
|
|
4
|
-
Operation,
|
|
5
|
-
QueryJson,
|
|
6
|
-
RenameColumn,
|
|
7
|
-
} from "../../definitions/datasource"
|
|
2
|
+
import { Operation, QueryJson, RenameColumn, Table } from "@budibase/types"
|
|
8
3
|
import { breakExternalTableId } from "../utils"
|
|
9
4
|
import SchemaBuilder = Knex.SchemaBuilder
|
|
10
5
|
import CreateTableBuilder = Knex.CreateTableBuilder
|
|
@@ -1,22 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
import { Datasource } from "../../definitions/common"
|
|
1
|
+
const QUERY_START_REGEX = /\d[0-9]*:/g
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
// query is the opinionated function
|
|
13
|
-
if (Integration.prototype.query) {
|
|
14
|
-
const integration = new Integration(datasource.config)
|
|
15
|
-
return integration.query(json)
|
|
16
|
-
} else {
|
|
17
|
-
throw "Datasource does not support query."
|
|
18
|
-
}
|
|
3
|
+
export function removeKeyNumbering(key: any): string {
|
|
4
|
+
if (typeof key === "string" && key.match(QUERY_START_REGEX) != null) {
|
|
5
|
+
const parts = key.split(":")
|
|
6
|
+
// remove the number
|
|
7
|
+
parts.shift()
|
|
8
|
+
return parts.join(":")
|
|
9
|
+
} else {
|
|
10
|
+
return key
|
|
19
11
|
}
|
|
20
|
-
|
|
21
|
-
module.exports.makeExternalQuery = makeExternalQuery
|
|
22
12
|
}
|
|
@@ -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
|
|
|
8
8
|
module CouchDBModule {
|
|
9
9
|
const PouchDB = require("pouchdb")
|
|
@@ -21,30 +21,30 @@ module CouchDBModule {
|
|
|
21
21
|
"Apache CouchDB is an open-source document-oriented NoSQL database, implemented in Erlang.",
|
|
22
22
|
datasource: {
|
|
23
23
|
url: {
|
|
24
|
-
type:
|
|
24
|
+
type: DatasourceFieldType.STRING,
|
|
25
25
|
required: true,
|
|
26
26
|
default: "http://localhost:5984",
|
|
27
27
|
},
|
|
28
28
|
database: {
|
|
29
|
-
type:
|
|
29
|
+
type: DatasourceFieldType.STRING,
|
|
30
30
|
required: true,
|
|
31
31
|
},
|
|
32
32
|
},
|
|
33
33
|
query: {
|
|
34
34
|
create: {
|
|
35
|
-
type:
|
|
35
|
+
type: QueryType.JSON,
|
|
36
36
|
},
|
|
37
37
|
read: {
|
|
38
|
-
type:
|
|
38
|
+
type: QueryType.JSON,
|
|
39
39
|
},
|
|
40
40
|
update: {
|
|
41
|
-
type:
|
|
41
|
+
type: QueryType.JSON,
|
|
42
42
|
},
|
|
43
43
|
delete: {
|
|
44
|
-
type:
|
|
44
|
+
type: QueryType.FIELDS,
|
|
45
45
|
fields: {
|
|
46
46
|
id: {
|
|
47
|
-
type:
|
|
47
|
+
type: DatasourceFieldType.STRING,
|
|
48
48
|
required: true,
|
|
49
49
|
},
|
|
50
50
|
},
|