@budibase/server 1.0.80-alpha.1 → 1.0.80
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__mocks__/node-fetch.ts +0 -1
- package/builder/assets/index.22a39cc9.js +1352 -0
- package/builder/assets/{index.c57242d4.css → index.c8d1e8f0.css} +2 -2
- package/builder/assets/{vendor.a7c6ad0a.js → vendor.20f80cec.js} +216 -190
- package/builder/index.html +3 -3
- package/coverage/clover.xml +2327 -2390
- package/coverage/coverage-final.json +137 -138
- package/coverage/lcov-report/api/controllers/analytics.js.html +6 -6
- package/coverage/lcov-report/api/controllers/apikeys.js.html +6 -6
- package/coverage/lcov-report/api/controllers/application.js.html +149 -152
- package/coverage/lcov-report/api/controllers/auth.js.html +7 -7
- package/coverage/lcov-report/api/controllers/automation.js.html +21 -21
- package/coverage/lcov-report/api/controllers/backup.js.html +3 -3
- package/coverage/lcov-report/api/controllers/cloud.js.html +11 -11
- package/coverage/lcov-report/api/controllers/component.js.html +5 -5
- package/coverage/lcov-report/api/controllers/datasource.js.html +16 -16
- package/coverage/lcov-report/api/controllers/dev.js.html +19 -19
- package/coverage/lcov-report/api/controllers/index.html +16 -16
- package/coverage/lcov-report/api/controllers/integration.js.html +4 -4
- package/coverage/lcov-report/api/controllers/layout.js.html +6 -6
- package/coverage/lcov-report/api/controllers/metadata.js.html +9 -9
- package/coverage/lcov-report/api/controllers/migrations.js.html +4 -4
- package/coverage/lcov-report/api/controllers/permission.js.html +15 -15
- package/coverage/lcov-report/api/controllers/query/index.html +1 -1
- package/coverage/lcov-report/api/controllers/query/index.js.html +26 -26
- package/coverage/lcov-report/api/controllers/query/validation.js.html +10 -10
- package/coverage/lcov-report/api/controllers/role.js.html +9 -9
- package/coverage/lcov-report/api/controllers/routing.js.html +9 -9
- package/coverage/lcov-report/api/controllers/row/external.js.html +16 -16
- package/coverage/lcov-report/api/controllers/row/index.html +27 -27
- package/coverage/lcov-report/api/controllers/row/index.js.html +46 -46
- package/coverage/lcov-report/api/controllers/row/internal.js.html +82 -94
- package/coverage/lcov-report/api/controllers/row/internalSearch.js.html +204 -204
- package/coverage/lcov-report/api/controllers/row/staticFormula.js.html +24 -24
- package/coverage/lcov-report/api/controllers/row/utils.js.html +29 -29
- package/coverage/lcov-report/api/controllers/screen.js.html +7 -7
- package/coverage/lcov-report/api/controllers/script.js.html +4 -4
- package/coverage/lcov-report/api/controllers/table/bulkFormula.js.html +49 -49
- package/coverage/lcov-report/api/controllers/table/external.js.html +12 -12
- package/coverage/lcov-report/api/controllers/table/index.html +11 -11
- package/coverage/lcov-report/api/controllers/table/index.js.html +44 -47
- package/coverage/lcov-report/api/controllers/table/internal.js.html +50 -50
- package/coverage/lcov-report/api/controllers/table/utils.js.html +80 -80
- package/coverage/lcov-report/api/controllers/templates.js.html +5 -5
- package/coverage/lcov-report/api/controllers/user.js.html +19 -19
- package/coverage/lcov-report/api/controllers/view/exporters.js.html +4 -4
- package/coverage/lcov-report/api/controllers/view/index.html +1 -1
- package/coverage/lcov-report/api/controllers/view/index.js.html +14 -14
- package/coverage/lcov-report/api/controllers/view/utils.js.html +12 -12
- package/coverage/lcov-report/api/controllers/view/viewBuilder.js.html +7 -7
- package/coverage/lcov-report/api/controllers/webhook.js.html +27 -18
- package/coverage/lcov-report/api/index.html +10 -10
- package/coverage/lcov-report/api/index.js.html +28 -37
- package/coverage/lcov-report/api/routes/analytics.js.html +6 -6
- package/coverage/lcov-report/api/routes/apikeys.js.html +8 -8
- package/coverage/lcov-report/api/routes/application.js.html +9 -9
- package/coverage/lcov-report/api/routes/auth.js.html +6 -6
- package/coverage/lcov-report/api/routes/automation.js.html +109 -19
- package/coverage/lcov-report/api/routes/backup.js.html +8 -8
- package/coverage/lcov-report/api/routes/cloud.js.html +8 -8
- package/coverage/lcov-report/api/routes/component.js.html +8 -8
- package/coverage/lcov-report/api/routes/datasource.js.html +156 -18
- package/coverage/lcov-report/api/routes/deploy.js.html +8 -8
- package/coverage/lcov-report/api/routes/dev.js.html +13 -13
- package/coverage/lcov-report/api/routes/index.html +35 -35
- package/coverage/lcov-report/api/routes/index.js.html +32 -38
- package/coverage/lcov-report/api/routes/integration.js.html +8 -8
- package/coverage/lcov-report/api/routes/layout.js.html +8 -8
- package/coverage/lcov-report/api/routes/metadata.js.html +9 -9
- package/coverage/lcov-report/api/routes/migrations.js.html +7 -7
- package/coverage/lcov-report/api/routes/permission.js.html +58 -16
- package/coverage/lcov-report/api/routes/query.js.html +10 -10
- package/coverage/lcov-report/api/routes/role.js.html +78 -15
- package/coverage/lcov-report/api/routes/routing.js.html +8 -8
- package/coverage/lcov-report/api/routes/row.js.html +14 -17
- package/coverage/lcov-report/api/routes/screen.js.html +95 -14
- package/coverage/lcov-report/api/routes/script.js.html +1 -1
- package/coverage/lcov-report/api/routes/static.js.html +13 -13
- package/coverage/lcov-report/api/routes/table.js.html +62 -17
- package/coverage/lcov-report/api/routes/templates.js.html +8 -8
- package/coverage/lcov-report/api/routes/user.js.html +8 -8
- package/coverage/lcov-report/api/routes/view.js.html +10 -10
- package/coverage/lcov-report/api/routes/webhook.js.html +62 -14
- package/coverage/lcov-report/automations/actions.js.html +24 -24
- package/coverage/lcov-report/automations/automationUtils.js.html +5 -5
- package/coverage/lcov-report/automations/bullboard.js.html +16 -16
- package/coverage/lcov-report/automations/index.html +1 -1
- package/coverage/lcov-report/automations/index.js.html +7 -7
- package/coverage/lcov-report/automations/steps/bash.js.html +6 -6
- package/coverage/lcov-report/automations/steps/createRow.js.html +7 -7
- package/coverage/lcov-report/automations/steps/delay.js.html +4 -4
- package/coverage/lcov-report/automations/steps/deleteRow.js.html +7 -7
- package/coverage/lcov-report/automations/steps/discord.js.html +7 -7
- package/coverage/lcov-report/automations/steps/executeQuery.js.html +6 -6
- package/coverage/lcov-report/automations/steps/executeScript.js.html +6 -6
- package/coverage/lcov-report/automations/steps/filter.js.html +9 -12
- package/coverage/lcov-report/automations/steps/index.html +1 -1
- package/coverage/lcov-report/automations/steps/integromat.js.html +5 -5
- package/coverage/lcov-report/automations/steps/outgoingWebhook.js.html +8 -8
- package/coverage/lcov-report/automations/steps/queryRows.js.html +11 -11
- package/coverage/lcov-report/automations/steps/sendSmtpEmail.js.html +5 -5
- package/coverage/lcov-report/automations/steps/serverLog.js.html +3 -3
- package/coverage/lcov-report/automations/steps/slack.js.html +5 -5
- package/coverage/lcov-report/automations/steps/updateRow.js.html +6 -6
- package/coverage/lcov-report/automations/steps/utils.js.html +3 -3
- package/coverage/lcov-report/automations/steps/zapier.js.html +5 -5
- package/coverage/lcov-report/automations/triggerInfo/app.js.html +2 -2
- package/coverage/lcov-report/automations/triggerInfo/cron.js.html +2 -2
- package/coverage/lcov-report/automations/triggerInfo/index.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/index.js.html +8 -8
- package/coverage/lcov-report/automations/triggerInfo/rowDeleted.js.html +2 -2
- package/coverage/lcov-report/automations/triggerInfo/rowSaved.js.html +2 -2
- package/coverage/lcov-report/automations/triggerInfo/rowUpdated.js.html +2 -2
- package/coverage/lcov-report/automations/triggerInfo/webhook.js.html +2 -2
- package/coverage/lcov-report/automations/triggers.js.html +26 -26
- package/coverage/lcov-report/automations/utils.js.html +35 -35
- package/coverage/lcov-report/constants/index.html +5 -5
- package/coverage/lcov-report/constants/index.js.html +28 -40
- package/coverage/lcov-report/constants/layouts.js.html +5 -5
- package/coverage/lcov-report/constants/screens.js.html +4 -4
- package/coverage/lcov-report/db/client.js.html +18 -18
- package/coverage/lcov-report/db/inMemoryView.js.html +7 -7
- package/coverage/lcov-report/db/index.html +15 -15
- package/coverage/lcov-report/db/index.js.html +3 -3
- package/coverage/lcov-report/db/linkedRows/LinkController.js.html +21 -21
- package/coverage/lcov-report/db/linkedRows/index.html +1 -1
- package/coverage/lcov-report/db/linkedRows/index.js.html +36 -36
- package/coverage/lcov-report/db/linkedRows/linkUtils.js.html +30 -30
- package/coverage/lcov-report/db/newid.js.html +4 -4
- package/coverage/lcov-report/db/utils.js.html +87 -123
- 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 +8 -8
- package/coverage/lcov-report/events/utils.js.html +18 -18
- package/coverage/lcov-report/index.html +74 -89
- 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 +5 -5
- package/coverage/lcov-report/middleware/authorized.js.html +29 -29
- package/coverage/lcov-report/middleware/builder.js.html +16 -16
- package/coverage/lcov-report/middleware/currentapp.js.html +44 -44
- package/coverage/lcov-report/middleware/index.html +1 -1
- package/coverage/lcov-report/middleware/joi-validator.js.html +14 -14
- package/coverage/lcov-report/middleware/resourceId.js.html +29 -29
- package/coverage/lcov-report/middleware/selfhost.js.html +1 -1
- package/coverage/lcov-report/middleware/usageQuota.js.html +17 -17
- package/coverage/lcov-report/middleware/utils.js.html +4 -4
- package/coverage/lcov-report/threads/automation.js.html +1 -1
- package/coverage/lcov-report/threads/index.html +19 -19
- package/coverage/lcov-report/threads/index.js.html +10 -10
- package/coverage/lcov-report/threads/query.js.html +39 -123
- package/coverage/lcov-report/threads/utils.js.html +14 -14
- package/coverage/lcov-report/utilities/bcrypt.js.html +1 -1
- package/coverage/lcov-report/utilities/budibaseDir.js.html +7 -7
- package/coverage/lcov-report/utilities/centralPath.js.html +4 -4
- package/coverage/lcov-report/utilities/csvParser.js.html +6 -6
- package/coverage/lcov-report/utilities/global.js.html +28 -28
- package/coverage/lcov-report/utilities/index.html +18 -18
- package/coverage/lcov-report/utilities/index.js.html +24 -24
- package/coverage/lcov-report/utilities/queue/inMemoryQueue.js.html +9 -9
- 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 +6 -6
- package/coverage/lcov-report/utilities/rowProcessor/index.html +1 -1
- package/coverage/lcov-report/utilities/rowProcessor/index.js.html +60 -60
- package/coverage/lcov-report/utilities/rowProcessor/utils.js.html +13 -13
- package/coverage/lcov-report/utilities/scriptRunner.js.html +5 -5
- package/coverage/lcov-report/utilities/security.js.html +8 -8
- 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/index.js.html +12 -12
- package/coverage/lcov-report/utilities/usageQuota/rows.js.html +8 -8
- package/coverage/lcov-report/utilities/usageQuota/usageQuoteReset.js.html +1 -1
- package/coverage/lcov-report/utilities/users.js.html +5 -5
- package/coverage/lcov-report/utilities/workerRequests.js.html +53 -200
- package/coverage/lcov.info +3233 -3332
- package/dist/api/controllers/application.js +0 -1
- package/dist/api/controllers/row/internal.js +1 -4
- package/dist/api/controllers/table/index.js +1 -2
- package/dist/api/controllers/webhook.js +5 -3
- package/dist/api/index.js +1 -3
- package/dist/api/routes/automation.js +31 -3
- package/dist/api/routes/datasource.js +50 -3
- package/dist/api/routes/index.js +0 -2
- package/dist/api/routes/permission.js +14 -4
- package/dist/api/routes/role.js +19 -3
- package/dist/api/routes/row.js +4 -3
- package/dist/api/routes/screen.js +23 -2
- package/dist/api/routes/table.js +17 -3
- package/dist/api/routes/tests/utilities/index.js +0 -23
- package/dist/api/routes/webhook.js +17 -2
- package/dist/automations/steps/filter.js +2 -2
- package/dist/automations/steps/queryRows.js +1 -1
- package/dist/automations/utils.js +2 -2
- package/dist/constants/index.js +0 -3
- package/dist/db/utils.js +0 -11
- package/dist/environment.js +0 -1
- package/dist/integrations/googlesheets.js +0 -3
- package/dist/integrations/microsoftSqlServer.js +29 -35
- package/dist/integrations/mysql.js +0 -3
- package/dist/integrations/oracle.js +19 -14
- package/dist/integrations/postgres.js +28 -34
- package/dist/package.json +7 -11
- package/dist/tests/utilities/TestConfiguration.js +8 -25
- package/dist/threads/query.js +8 -33
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utilities/workerRequests.js +15 -50
- package/package.json +8 -12
- package/scripts/integrations/oracle/oracle.md +2 -2
- package/scripts/integrations/postgres/init.sql +3 -5
- package/scripts/likeCypress.ts +6 -9
- package/scripts/proxy/generateProxyConfig.js +70 -0
- package/src/api/controllers/application.js +0 -1
- package/src/api/controllers/row/ExternalRequest.ts +1 -1
- package/src/api/controllers/row/internal.js +0 -4
- package/src/api/controllers/table/index.js +1 -2
- package/src/api/controllers/webhook.js +6 -3
- package/src/api/index.js +1 -4
- package/src/api/routes/automation.js +33 -3
- package/src/api/routes/datasource.js +52 -6
- package/src/api/routes/index.js +0 -2
- package/src/api/routes/permission.js +18 -4
- package/src/api/routes/role.js +24 -3
- package/src/api/routes/row.js +2 -3
- package/src/api/routes/screen.js +29 -2
- package/src/api/routes/table.js +19 -4
- package/src/api/routes/tests/utilities/index.js +0 -24
- package/src/api/routes/webhook.js +18 -2
- package/src/automations/steps/filter.js +2 -3
- package/src/automations/steps/queryRows.js +1 -1
- package/src/automations/utils.js +2 -2
- package/src/constants/index.js +0 -4
- package/src/db/utils.js +0 -12
- package/src/definitions/common.ts +0 -4
- package/src/environment.js +0 -1
- package/src/integrations/base/datasourcePlus.ts +0 -3
- package/src/integrations/googlesheets.ts +2 -5
- package/src/integrations/microsoftSqlServer.ts +33 -38
- package/src/integrations/mysql.ts +0 -4
- package/src/integrations/oracle.ts +35 -27
- package/src/integrations/postgres.ts +26 -33
- package/src/tests/utilities/TestConfiguration.js +2 -23
- package/src/threads/query.js +9 -37
- package/src/utilities/workerRequests.js +16 -65
- package/builder/assets/index.c0b657be.js +0 -1288
- package/coverage/lcov-report/api/routes/utils/index.html +0 -111
- package/coverage/lcov-report/api/routes/utils/validators.js.html +0 -737
- package/dist/api/controllers/public/applications.js +0 -94
- package/dist/api/controllers/public/mapping/applications.js +0 -29
- package/dist/api/controllers/public/mapping/index.js +0 -11
- package/dist/api/controllers/public/mapping/queries.js +0 -36
- package/dist/api/controllers/public/mapping/rows.js +0 -24
- package/dist/api/controllers/public/mapping/tables.js +0 -23
- package/dist/api/controllers/public/mapping/types.js +0 -2
- package/dist/api/controllers/public/mapping/users.js +0 -29
- package/dist/api/controllers/public/queries.js +0 -38
- package/dist/api/controllers/public/rows.js +0 -97
- package/dist/api/controllers/public/tables.js +0 -75
- package/dist/api/controllers/public/users.js +0 -95
- package/dist/api/controllers/public/utils.js +0 -49
- package/dist/api/routes/public/applications.js +0 -141
- package/dist/api/routes/public/index.js +0 -101
- package/dist/api/routes/public/middleware/mapper.js +0 -94
- package/dist/api/routes/public/queries.js +0 -77
- package/dist/api/routes/public/rows.js +0 -229
- package/dist/api/routes/public/tables.js +0 -154
- package/dist/api/routes/public/users.js +0 -137
- package/dist/api/routes/public/utils/Endpoint.js +0 -36
- package/dist/api/routes/utils/validators.js +0 -200
- package/dist/definitions/openapi.js +0 -6
- package/specs/generate.js +0 -83
- package/specs/openapi.json +0 -2222
- package/specs/openapi.yaml +0 -1530
- package/specs/parameters.js +0 -59
- package/specs/resources/application.js +0 -101
- package/specs/resources/index.js +0 -24
- package/specs/resources/misc.js +0 -12
- package/specs/resources/query.js +0 -189
- package/specs/resources/row.js +0 -125
- package/specs/resources/table.js +0 -191
- package/specs/resources/user.js +0 -126
- package/specs/resources/utils/Resource.js +0 -26
- package/specs/resources/utils/index.js +0 -11
- package/specs/security.js +0 -7
- package/src/api/controllers/public/applications.ts +0 -74
- package/src/api/controllers/public/mapping/applications.ts +0 -32
- package/src/api/controllers/public/mapping/index.ts +0 -13
- package/src/api/controllers/public/mapping/queries.ts +0 -39
- package/src/api/controllers/public/mapping/rows.ts +0 -31
- package/src/api/controllers/public/mapping/tables.ts +0 -26
- package/src/api/controllers/public/mapping/types.ts +0 -13
- package/src/api/controllers/public/mapping/users.ts +0 -32
- package/src/api/controllers/public/queries.ts +0 -20
- package/src/api/controllers/public/rows.ts +0 -77
- package/src/api/controllers/public/tables.ts +0 -56
- package/src/api/controllers/public/users.ts +0 -82
- package/src/api/controllers/public/utils.ts +0 -38
- package/src/api/routes/public/applications.ts +0 -156
- package/src/api/routes/public/index.ts +0 -118
- package/src/api/routes/public/middleware/mapper.ts +0 -81
- package/src/api/routes/public/queries.ts +0 -81
- package/src/api/routes/public/rows.ts +0 -242
- package/src/api/routes/public/tables.ts +0 -169
- package/src/api/routes/public/tests/compare.spec.js +0 -184
- package/src/api/routes/public/users.ts +0 -144
- package/src/api/routes/public/utils/Endpoint.ts +0 -51
- package/src/api/routes/utils/validators.js +0 -219
- package/src/definitions/openapi.ts +0 -943
package/src/api/routes/role.js
CHANGED
|
@@ -1,13 +1,34 @@
|
|
|
1
1
|
const Router = require("@koa/router")
|
|
2
2
|
const controller = require("../controllers/role")
|
|
3
3
|
const authorized = require("../../middleware/authorized")
|
|
4
|
-
const
|
|
5
|
-
const
|
|
4
|
+
const Joi = require("joi")
|
|
5
|
+
const joiValidator = require("../../middleware/joi-validator")
|
|
6
|
+
const {
|
|
7
|
+
BUILTIN_PERMISSION_IDS,
|
|
8
|
+
BUILDER,
|
|
9
|
+
PermissionLevels,
|
|
10
|
+
} = require("@budibase/backend-core/permissions")
|
|
6
11
|
|
|
7
12
|
const router = Router()
|
|
8
13
|
|
|
14
|
+
function generateValidator() {
|
|
15
|
+
const permLevelArray = Object.values(PermissionLevels)
|
|
16
|
+
// prettier-ignore
|
|
17
|
+
return joiValidator.body(Joi.object({
|
|
18
|
+
_id: Joi.string().optional(),
|
|
19
|
+
_rev: Joi.string().optional(),
|
|
20
|
+
name: Joi.string().required(),
|
|
21
|
+
// this is the base permission ID (for now a built in)
|
|
22
|
+
permissionId: Joi.string().valid(...Object.values(BUILTIN_PERMISSION_IDS)).required(),
|
|
23
|
+
permissions: Joi.object()
|
|
24
|
+
.pattern(/.*/, [Joi.string().valid(...permLevelArray)])
|
|
25
|
+
.optional(),
|
|
26
|
+
inherits: Joi.string().optional(),
|
|
27
|
+
}).unknown(true))
|
|
28
|
+
}
|
|
29
|
+
|
|
9
30
|
router
|
|
10
|
-
.post("/api/roles", authorized(BUILDER),
|
|
31
|
+
.post("/api/roles", authorized(BUILDER), generateValidator(), controller.save)
|
|
11
32
|
.get("/api/roles", authorized(BUILDER), controller.fetch)
|
|
12
33
|
.get("/api/roles/:roleId", authorized(BUILDER), controller.find)
|
|
13
34
|
.delete("/api/roles/:roleId/:rev", authorized(BUILDER), controller.destroy)
|
package/src/api/routes/row.js
CHANGED
|
@@ -10,7 +10,6 @@ const {
|
|
|
10
10
|
PermissionLevels,
|
|
11
11
|
PermissionTypes,
|
|
12
12
|
} = require("@budibase/backend-core/permissions")
|
|
13
|
-
const { internalSearchValidator } = require("./utils/validators")
|
|
14
13
|
|
|
15
14
|
const router = Router()
|
|
16
15
|
|
|
@@ -120,6 +119,8 @@ router
|
|
|
120
119
|
* "notEqual": {},
|
|
121
120
|
* "empty": {},
|
|
122
121
|
* "notEmpty": {},
|
|
122
|
+
* "contains": {},
|
|
123
|
+
* "notContains": {}
|
|
123
124
|
* "oneOf": {
|
|
124
125
|
* "columnName": ["value"]
|
|
125
126
|
* }
|
|
@@ -139,7 +140,6 @@ router
|
|
|
139
140
|
*/
|
|
140
141
|
.post(
|
|
141
142
|
"/api/:tableId/search",
|
|
142
|
-
internalSearchValidator(),
|
|
143
143
|
paramResource("tableId"),
|
|
144
144
|
authorized(PermissionTypes.TABLE, PermissionLevels.READ),
|
|
145
145
|
rowController.search
|
|
@@ -195,7 +195,6 @@ router
|
|
|
195
195
|
"/api/:tableId/rows",
|
|
196
196
|
paramResource("tableId"),
|
|
197
197
|
authorized(PermissionTypes.TABLE, PermissionLevels.WRITE),
|
|
198
|
-
usage,
|
|
199
198
|
rowController.patch
|
|
200
199
|
)
|
|
201
200
|
/**
|
package/src/api/routes/screen.js
CHANGED
|
@@ -2,13 +2,40 @@ const Router = require("@koa/router")
|
|
|
2
2
|
const controller = require("../controllers/screen")
|
|
3
3
|
const authorized = require("../../middleware/authorized")
|
|
4
4
|
const { BUILDER } = require("@budibase/backend-core/permissions")
|
|
5
|
-
const
|
|
5
|
+
const joiValidator = require("../../middleware/joi-validator")
|
|
6
|
+
const Joi = require("joi")
|
|
6
7
|
|
|
7
8
|
const router = Router()
|
|
8
9
|
|
|
10
|
+
function generateSaveValidation() {
|
|
11
|
+
// prettier-ignore
|
|
12
|
+
return joiValidator.body(Joi.object({
|
|
13
|
+
name: Joi.string().required(),
|
|
14
|
+
routing: Joi.object({
|
|
15
|
+
route: Joi.string().required(),
|
|
16
|
+
roleId: Joi.string().required().allow(""),
|
|
17
|
+
}).required().unknown(true),
|
|
18
|
+
props: Joi.object({
|
|
19
|
+
_id: Joi.string().required(),
|
|
20
|
+
_component: Joi.string().required(),
|
|
21
|
+
_children: Joi.array().required(),
|
|
22
|
+
_instanceName: Joi.string().required(),
|
|
23
|
+
_styles: Joi.object().required(),
|
|
24
|
+
type: Joi.string().optional(),
|
|
25
|
+
table: Joi.string().optional(),
|
|
26
|
+
layoutId: Joi.string().optional(),
|
|
27
|
+
}).required().unknown(true),
|
|
28
|
+
}).unknown(true))
|
|
29
|
+
}
|
|
30
|
+
|
|
9
31
|
router
|
|
10
32
|
.get("/api/screens", authorized(BUILDER), controller.fetch)
|
|
11
|
-
.post(
|
|
33
|
+
.post(
|
|
34
|
+
"/api/screens",
|
|
35
|
+
authorized(BUILDER),
|
|
36
|
+
generateSaveValidation(),
|
|
37
|
+
controller.save
|
|
38
|
+
)
|
|
12
39
|
.delete(
|
|
13
40
|
"/api/screens/:screenId/:screenRev",
|
|
14
41
|
authorized(BUILDER),
|
package/src/api/routes/table.js
CHANGED
|
@@ -7,10 +7,25 @@ const {
|
|
|
7
7
|
PermissionLevels,
|
|
8
8
|
PermissionTypes,
|
|
9
9
|
} = require("@budibase/backend-core/permissions")
|
|
10
|
-
const
|
|
10
|
+
const joiValidator = require("../../middleware/joi-validator")
|
|
11
|
+
const Joi = require("joi")
|
|
11
12
|
|
|
12
13
|
const router = Router()
|
|
13
14
|
|
|
15
|
+
function generateSaveValidator() {
|
|
16
|
+
// prettier-ignore
|
|
17
|
+
return joiValidator.body(Joi.object({
|
|
18
|
+
_id: Joi.string(),
|
|
19
|
+
_rev: Joi.string(),
|
|
20
|
+
type: Joi.string().valid("table", "internal", "external"),
|
|
21
|
+
primaryDisplay: Joi.string(),
|
|
22
|
+
schema: Joi.object().required(),
|
|
23
|
+
name: Joi.string().required(),
|
|
24
|
+
views: Joi.object(),
|
|
25
|
+
dataImport: Joi.object(),
|
|
26
|
+
}).unknown(true))
|
|
27
|
+
}
|
|
28
|
+
|
|
14
29
|
router
|
|
15
30
|
/**
|
|
16
31
|
* @api {get} /api/tables Fetch all tables
|
|
@@ -38,8 +53,8 @@ router
|
|
|
38
53
|
* @apiSuccess {object[]} body The response body will be the table that was found.
|
|
39
54
|
*/
|
|
40
55
|
.get(
|
|
41
|
-
"/api/tables/:
|
|
42
|
-
paramResource("
|
|
56
|
+
"/api/tables/:id",
|
|
57
|
+
paramResource("id"),
|
|
43
58
|
authorized(PermissionTypes.TABLE, PermissionLevels.READ),
|
|
44
59
|
tableController.find
|
|
45
60
|
)
|
|
@@ -121,7 +136,7 @@ router
|
|
|
121
136
|
// allows control over updating a table
|
|
122
137
|
bodyResource("_id"),
|
|
123
138
|
authorized(BUILDER),
|
|
124
|
-
|
|
139
|
+
generateSaveValidator(),
|
|
125
140
|
tableController.save
|
|
126
141
|
)
|
|
127
142
|
/**
|
|
@@ -2,18 +2,6 @@ const TestConfig = require("../../../../tests/utilities/TestConfiguration")
|
|
|
2
2
|
const structures = require("../../../../tests/utilities/structures")
|
|
3
3
|
const env = require("../../../../environment")
|
|
4
4
|
|
|
5
|
-
function user() {
|
|
6
|
-
return {
|
|
7
|
-
_id: "user",
|
|
8
|
-
_rev: "rev",
|
|
9
|
-
createdAt: Date.now(),
|
|
10
|
-
email: "test@test.com",
|
|
11
|
-
roles: {},
|
|
12
|
-
tenantId: "default",
|
|
13
|
-
status: "active",
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
5
|
jest.mock("../../../../utilities/workerRequests", () => ({
|
|
18
6
|
getGlobalUsers: jest.fn(() => {
|
|
19
7
|
return {
|
|
@@ -25,18 +13,6 @@ jest.mock("../../../../utilities/workerRequests", () => ({
|
|
|
25
13
|
_id: "us_uuid1",
|
|
26
14
|
}
|
|
27
15
|
}),
|
|
28
|
-
allGlobalUsers: jest.fn(() => {
|
|
29
|
-
return [user()]
|
|
30
|
-
}),
|
|
31
|
-
readGlobalUser: jest.fn(() => {
|
|
32
|
-
return user()
|
|
33
|
-
}),
|
|
34
|
-
saveGlobalUser: jest.fn(() => {
|
|
35
|
-
return { _id: "user", _rev: "rev" }
|
|
36
|
-
}),
|
|
37
|
-
deleteGlobalUser: jest.fn(() => {
|
|
38
|
-
return { message: "deleted user" }
|
|
39
|
-
}),
|
|
40
16
|
removeAppFromUserRoles: jest.fn(),
|
|
41
17
|
}))
|
|
42
18
|
|
|
@@ -1,17 +1,33 @@
|
|
|
1
1
|
const Router = require("@koa/router")
|
|
2
2
|
const controller = require("../controllers/webhook")
|
|
3
3
|
const authorized = require("../../middleware/authorized")
|
|
4
|
+
const joiValidator = require("../../middleware/joi-validator")
|
|
4
5
|
const { BUILDER } = require("@budibase/backend-core/permissions")
|
|
5
|
-
const
|
|
6
|
+
const Joi = require("joi")
|
|
6
7
|
|
|
7
8
|
const router = Router()
|
|
8
9
|
|
|
10
|
+
function generateSaveValidator() {
|
|
11
|
+
// prettier-ignore
|
|
12
|
+
return joiValidator.body(Joi.object({
|
|
13
|
+
live: Joi.bool(),
|
|
14
|
+
_id: Joi.string().optional(),
|
|
15
|
+
_rev: Joi.string().optional(),
|
|
16
|
+
name: Joi.string().required(),
|
|
17
|
+
bodySchema: Joi.object().optional(),
|
|
18
|
+
action: Joi.object({
|
|
19
|
+
type: Joi.string().required().valid(controller.WebhookType.AUTOMATION),
|
|
20
|
+
target: Joi.string().required(),
|
|
21
|
+
}).required(),
|
|
22
|
+
}).unknown(true))
|
|
23
|
+
}
|
|
24
|
+
|
|
9
25
|
router
|
|
10
26
|
.get("/api/webhooks", authorized(BUILDER), controller.fetch)
|
|
11
27
|
.put(
|
|
12
28
|
"/api/webhooks",
|
|
13
29
|
authorized(BUILDER),
|
|
14
|
-
|
|
30
|
+
generateSaveValidator(),
|
|
15
31
|
controller.save
|
|
16
32
|
)
|
|
17
33
|
.delete("/api/webhooks/:id/:rev", authorized(BUILDER), controller.destroy)
|
|
@@ -16,11 +16,10 @@ exports.FilterConditions = FilterConditions
|
|
|
16
16
|
exports.PrettyFilterConditions = PrettyFilterConditions
|
|
17
17
|
|
|
18
18
|
exports.definition = {
|
|
19
|
-
name: "
|
|
19
|
+
name: "Filter",
|
|
20
20
|
tagline: "{{inputs.field}} {{inputs.condition}} {{inputs.value}}",
|
|
21
21
|
icon: "Branch2",
|
|
22
|
-
description:
|
|
23
|
-
"Conditionally halt automations which do not meet certain conditions",
|
|
22
|
+
description: "Filter any automations which do not meet certain conditions",
|
|
24
23
|
type: "LOGIC",
|
|
25
24
|
internal: true,
|
|
26
25
|
stepId: "FILTER",
|
package/src/automations/utils.js
CHANGED
|
@@ -5,7 +5,7 @@ const CouchDB = require("../db")
|
|
|
5
5
|
const { queue } = require("./bullboard")
|
|
6
6
|
const newid = require("../db/newid")
|
|
7
7
|
const { updateEntityMetadata } = require("../utilities")
|
|
8
|
-
const { MetadataTypes
|
|
8
|
+
const { MetadataTypes } = require("../constants")
|
|
9
9
|
const { getProdAppID } = require("@budibase/backend-core/db")
|
|
10
10
|
const { cloneDeep } = require("lodash/fp")
|
|
11
11
|
const { getAppDB, getAppId } = require("@budibase/backend-core/context")
|
|
@@ -159,7 +159,7 @@ exports.checkForWebhooks = async ({ oldAuto, newAuto }) => {
|
|
|
159
159
|
request: {
|
|
160
160
|
body: new webhooks.Webhook(
|
|
161
161
|
"Automation webhook",
|
|
162
|
-
WebhookType.AUTOMATION,
|
|
162
|
+
webhooks.WebhookType.AUTOMATION,
|
|
163
163
|
newAuto._id
|
|
164
164
|
),
|
|
165
165
|
},
|
package/src/constants/index.js
CHANGED
package/src/db/utils.js
CHANGED
|
@@ -146,18 +146,6 @@ exports.getRowParams = (tableId = null, rowId = null, otherProps = {}) => {
|
|
|
146
146
|
return getDocParams(DocumentTypes.ROW, endOfKey, otherProps)
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
-
/**
|
|
150
|
-
* Given a row ID this will find the table ID within it (only works for internal tables).
|
|
151
|
-
* @param {string} rowId The ID of the row.
|
|
152
|
-
* @returns {string} The table ID.
|
|
153
|
-
*/
|
|
154
|
-
exports.getTableIDFromRowID = rowId => {
|
|
155
|
-
const components = rowId
|
|
156
|
-
.split(DocumentTypes.TABLE + SEPARATOR)[1]
|
|
157
|
-
.split(SEPARATOR)
|
|
158
|
-
return `${DocumentTypes.TABLE}${SEPARATOR}${components[0]}`
|
|
159
|
-
}
|
|
160
|
-
|
|
161
149
|
/**
|
|
162
150
|
* Gets a new row ID for the specified table.
|
|
163
151
|
* @param {string} tableId The table which the row is being created for.
|
package/src/environment.js
CHANGED
|
@@ -45,7 +45,6 @@ module.exports = {
|
|
|
45
45
|
INTERNAL_API_KEY: process.env.INTERNAL_API_KEY,
|
|
46
46
|
MULTI_TENANCY: process.env.MULTI_TENANCY,
|
|
47
47
|
HTTP_MIGRATIONS: process.env.HTTP_MIGRATIONS,
|
|
48
|
-
API_REQ_LIMIT_PER_SEC: process.env.API_REQ_LIMIT_PER_SEC,
|
|
49
48
|
// environment
|
|
50
49
|
NODE_ENV: process.env.NODE_ENV,
|
|
51
50
|
JEST_WORKER_ID: process.env.JEST_WORKER_ID,
|
|
@@ -5,8 +5,5 @@ export interface DatasourcePlus extends IntegrationBase {
|
|
|
5
5
|
tables: Record<string, Table>
|
|
6
6
|
schemaErrors: Record<string, string>
|
|
7
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
8
|
buildSchema(datasourceId: string, entities: Record<string, Table>): any
|
|
12
9
|
}
|
|
@@ -6,10 +6,11 @@ import {
|
|
|
6
6
|
} from "../definitions/datasource"
|
|
7
7
|
import { OAuth2Client } from "google-auth-library"
|
|
8
8
|
import { DatasourcePlus } from "./base/datasourcePlus"
|
|
9
|
-
import { Table, TableSchema } from "../definitions/common"
|
|
9
|
+
import { Row, Table, TableSchema } from "../definitions/common"
|
|
10
10
|
import { buildExternalTableId } from "./utils"
|
|
11
11
|
import { DataSourceOperation, FieldTypes } from "../constants"
|
|
12
12
|
import { GoogleSpreadsheet } from "google-spreadsheet"
|
|
13
|
+
import { table } from "console"
|
|
13
14
|
|
|
14
15
|
module GoogleSheetsModule {
|
|
15
16
|
const { getGlobalDB } = require("@budibase/backend-core/tenancy")
|
|
@@ -111,10 +112,6 @@ module GoogleSheetsModule {
|
|
|
111
112
|
this.client = new GoogleSpreadsheet(spreadsheetId)
|
|
112
113
|
}
|
|
113
114
|
|
|
114
|
-
getBindingIdentifier() {
|
|
115
|
-
return ""
|
|
116
|
-
}
|
|
117
|
-
|
|
118
115
|
/**
|
|
119
116
|
* Pull the spreadsheet ID out from a valid google sheets URL
|
|
120
117
|
* @param spreadsheetId - the URL or standard spreadsheetId of the google sheet
|
|
@@ -79,9 +79,34 @@ module MSSQLModule {
|
|
|
79
79
|
},
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
+
async function internalQuery(
|
|
83
|
+
client: any,
|
|
84
|
+
query: SqlQuery,
|
|
85
|
+
operation: string | undefined = undefined
|
|
86
|
+
) {
|
|
87
|
+
const request = client.request()
|
|
88
|
+
try {
|
|
89
|
+
if (Array.isArray(query.bindings)) {
|
|
90
|
+
let count = 0
|
|
91
|
+
for (let binding of query.bindings) {
|
|
92
|
+
request.input(`p${count++}`, binding)
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
// this is a hack to get the inserted ID back,
|
|
96
|
+
// no way to do this with Knex nicely
|
|
97
|
+
const sql =
|
|
98
|
+
operation === Operation.CREATE
|
|
99
|
+
? `${query.sql}; SELECT SCOPE_IDENTITY() AS id;`
|
|
100
|
+
: query.sql
|
|
101
|
+
return await request.query(sql)
|
|
102
|
+
} catch (err) {
|
|
103
|
+
// @ts-ignore
|
|
104
|
+
throw new Error(err)
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
82
108
|
class SqlServerIntegration extends Sql implements DatasourcePlus {
|
|
83
109
|
private readonly config: MSSQLConfig
|
|
84
|
-
private index: number = 0
|
|
85
110
|
static pool: any
|
|
86
111
|
public tables: Record<string, Table> = {}
|
|
87
112
|
public schemaErrors: Record<string, string> = {}
|
|
@@ -96,33 +121,6 @@ module MSSQLModule {
|
|
|
96
121
|
TABLES_SQL =
|
|
97
122
|
"SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='BASE TABLE'"
|
|
98
123
|
|
|
99
|
-
async internalQuery(
|
|
100
|
-
query: SqlQuery,
|
|
101
|
-
operation: string | undefined = undefined
|
|
102
|
-
) {
|
|
103
|
-
const client = this.client
|
|
104
|
-
const request = client.request()
|
|
105
|
-
this.index = 0
|
|
106
|
-
try {
|
|
107
|
-
if (Array.isArray(query.bindings)) {
|
|
108
|
-
let count = 0
|
|
109
|
-
for (let binding of query.bindings) {
|
|
110
|
-
request.input(`p${count++}`, binding)
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
// this is a hack to get the inserted ID back,
|
|
114
|
-
// no way to do this with Knex nicely
|
|
115
|
-
const sql =
|
|
116
|
-
operation === Operation.CREATE
|
|
117
|
-
? `${query.sql}; SELECT SCOPE_IDENTITY() AS id;`
|
|
118
|
-
: query.sql
|
|
119
|
-
return await request.query(sql)
|
|
120
|
-
} catch (err) {
|
|
121
|
-
// @ts-ignore
|
|
122
|
-
throw new Error(err)
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
124
|
getDefinitionSQL(tableName: string) {
|
|
127
125
|
return `select *
|
|
128
126
|
from INFORMATION_SCHEMA.COLUMNS
|
|
@@ -167,10 +165,6 @@ module MSSQLModule {
|
|
|
167
165
|
}
|
|
168
166
|
}
|
|
169
167
|
|
|
170
|
-
getBindingIdentifier(): string {
|
|
171
|
-
return `(@p${this.index++})`
|
|
172
|
-
}
|
|
173
|
-
|
|
174
168
|
async connect() {
|
|
175
169
|
try {
|
|
176
170
|
this.client = await this.pool.connect()
|
|
@@ -181,7 +175,7 @@ module MSSQLModule {
|
|
|
181
175
|
}
|
|
182
176
|
|
|
183
177
|
async runSQL(sql: string) {
|
|
184
|
-
return (await this.
|
|
178
|
+
return (await internalQuery(this.client, getSqlQuery(sql))).recordset
|
|
185
179
|
}
|
|
186
180
|
|
|
187
181
|
/**
|
|
@@ -244,32 +238,33 @@ module MSSQLModule {
|
|
|
244
238
|
|
|
245
239
|
async read(query: SqlQuery | string) {
|
|
246
240
|
await this.connect()
|
|
247
|
-
const response = await this.
|
|
241
|
+
const response = await internalQuery(this.client, getSqlQuery(query))
|
|
248
242
|
return response.recordset
|
|
249
243
|
}
|
|
250
244
|
|
|
251
245
|
async create(query: SqlQuery | string) {
|
|
252
246
|
await this.connect()
|
|
253
|
-
const response = await this.
|
|
247
|
+
const response = await internalQuery(this.client, getSqlQuery(query))
|
|
254
248
|
return response.recordset || [{ created: true }]
|
|
255
249
|
}
|
|
256
250
|
|
|
257
251
|
async update(query: SqlQuery | string) {
|
|
258
252
|
await this.connect()
|
|
259
|
-
const response = await this.
|
|
253
|
+
const response = await internalQuery(this.client, getSqlQuery(query))
|
|
260
254
|
return response.recordset || [{ updated: true }]
|
|
261
255
|
}
|
|
262
256
|
|
|
263
257
|
async delete(query: SqlQuery | string) {
|
|
264
258
|
await this.connect()
|
|
265
|
-
const response = await this.
|
|
259
|
+
const response = await internalQuery(this.client, getSqlQuery(query))
|
|
266
260
|
return response.recordset || [{ deleted: true }]
|
|
267
261
|
}
|
|
268
262
|
|
|
269
263
|
async query(json: QueryJson) {
|
|
270
264
|
await this.connect()
|
|
271
265
|
const operation = this._operation(json)
|
|
272
|
-
const queryFn = (query: any, op: string) =>
|
|
266
|
+
const queryFn = (query: any, op: string) =>
|
|
267
|
+
internalQuery(this.client, query, op)
|
|
273
268
|
const processFn = (result: any) =>
|
|
274
269
|
result.recordset ? result.recordset : [{ [operation]: true }]
|
|
275
270
|
return this.queryWithReturning(json, queryFn, processFn)
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import {
|
|
2
|
-
DatasourceFieldTypes,
|
|
3
2
|
Integration,
|
|
4
|
-
|
|
5
|
-
QueryJson,
|
|
3
|
+
DatasourceFieldTypes,
|
|
6
4
|
QueryTypes,
|
|
7
5
|
SqlQuery,
|
|
6
|
+
QueryJson,
|
|
7
|
+
Operation,
|
|
8
8
|
} from "../definitions/datasource"
|
|
9
9
|
import {
|
|
10
|
-
buildExternalTableId,
|
|
11
|
-
convertSqlType,
|
|
12
10
|
finaliseExternalTables,
|
|
13
11
|
getSqlQuery,
|
|
12
|
+
buildExternalTableId,
|
|
13
|
+
convertSqlType,
|
|
14
14
|
SqlClients,
|
|
15
15
|
} from "./utils"
|
|
16
16
|
import oracledb, {
|
|
17
|
-
BindParameters,
|
|
18
|
-
Connection,
|
|
19
|
-
ConnectionAttributes,
|
|
20
17
|
ExecuteOptions,
|
|
21
18
|
Result,
|
|
19
|
+
Connection,
|
|
20
|
+
ConnectionAttributes,
|
|
21
|
+
BindParameters,
|
|
22
22
|
} from "oracledb"
|
|
23
23
|
import Sql from "./base/sql"
|
|
24
24
|
import { Table } from "../definitions/common"
|
|
@@ -137,7 +137,6 @@ module OracleModule {
|
|
|
137
137
|
|
|
138
138
|
class OracleIntegration extends Sql implements DatasourcePlus {
|
|
139
139
|
private readonly config: OracleConfig
|
|
140
|
-
private index: number = 1
|
|
141
140
|
|
|
142
141
|
public tables: Record<string, Table> = {}
|
|
143
142
|
public schemaErrors: Record<string, string> = {}
|
|
@@ -175,10 +174,6 @@ module OracleModule {
|
|
|
175
174
|
this.config = config
|
|
176
175
|
}
|
|
177
176
|
|
|
178
|
-
getBindingIdentifier(): string {
|
|
179
|
-
return `:${this.index++}`
|
|
180
|
-
}
|
|
181
|
-
|
|
182
177
|
/**
|
|
183
178
|
* Map the flat tabular columns and constraints data into a nested object
|
|
184
179
|
*/
|
|
@@ -238,14 +233,20 @@ module OracleModule {
|
|
|
238
233
|
return oracleTables
|
|
239
234
|
}
|
|
240
235
|
|
|
241
|
-
private
|
|
242
|
-
|
|
236
|
+
private isSupportedColumn(column: OracleColumn) {
|
|
237
|
+
if (UNSUPPORTED_TYPES.includes(column.type)) {
|
|
238
|
+
return false
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
return true
|
|
243
242
|
}
|
|
244
243
|
|
|
245
|
-
private
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
244
|
+
private isAutoColumn(column: OracleColumn) {
|
|
245
|
+
if (column.default && column.default.toLowerCase().includes("nextval")) {
|
|
246
|
+
return true
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
return false
|
|
249
250
|
}
|
|
250
251
|
|
|
251
252
|
/**
|
|
@@ -253,7 +254,7 @@ module OracleModule {
|
|
|
253
254
|
* This matches the default behaviour for generating DDL used in knex.
|
|
254
255
|
*/
|
|
255
256
|
private isBooleanType(column: OracleColumn): boolean {
|
|
256
|
-
|
|
257
|
+
if (
|
|
257
258
|
column.type.toLowerCase() === "number" &&
|
|
258
259
|
Object.values(column.constraints).filter(c => {
|
|
259
260
|
if (
|
|
@@ -272,7 +273,11 @@ module OracleModule {
|
|
|
272
273
|
}
|
|
273
274
|
return false
|
|
274
275
|
}).length > 0
|
|
275
|
-
)
|
|
276
|
+
) {
|
|
277
|
+
return true
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
return false
|
|
276
281
|
}
|
|
277
282
|
|
|
278
283
|
private internalConvertType(column: OracleColumn): string {
|
|
@@ -312,9 +317,7 @@ module OracleModule {
|
|
|
312
317
|
// iterate each column on the table
|
|
313
318
|
Object.values(oracleTable.columns)
|
|
314
319
|
// remove columns that we can't read / save
|
|
315
|
-
.filter(oracleColumn =>
|
|
316
|
-
OracleIntegration.isSupportedColumn(oracleColumn)
|
|
317
|
-
)
|
|
320
|
+
.filter(oracleColumn => this.isSupportedColumn(oracleColumn))
|
|
318
321
|
// match the order of the columns in the db
|
|
319
322
|
.sort((c1, c2) => c1.id - c2.id)
|
|
320
323
|
.forEach(oracleColumn => {
|
|
@@ -322,7 +325,7 @@ module OracleModule {
|
|
|
322
325
|
let fieldSchema = table.schema[columnName]
|
|
323
326
|
if (!fieldSchema) {
|
|
324
327
|
fieldSchema = {
|
|
325
|
-
autocolumn:
|
|
328
|
+
autocolumn: this.isAutoColumn(oracleColumn),
|
|
326
329
|
name: columnName,
|
|
327
330
|
type: this.internalConvertType(oracleColumn),
|
|
328
331
|
}
|
|
@@ -348,13 +351,18 @@ module OracleModule {
|
|
|
348
351
|
private async internalQuery<T>(query: SqlQuery): Promise<Result<T>> {
|
|
349
352
|
let connection
|
|
350
353
|
try {
|
|
351
|
-
this.index = 1
|
|
352
354
|
connection = await this.getConnection()
|
|
353
355
|
|
|
354
356
|
const options: ExecuteOptions = { autoCommit: true }
|
|
355
357
|
const bindings: BindParameters = query.bindings || []
|
|
356
358
|
|
|
357
|
-
|
|
359
|
+
const result: Result<T> = await connection.execute<T>(
|
|
360
|
+
query.sql,
|
|
361
|
+
bindings,
|
|
362
|
+
options
|
|
363
|
+
)
|
|
364
|
+
|
|
365
|
+
return result
|
|
358
366
|
} finally {
|
|
359
367
|
if (connection) {
|
|
360
368
|
try {
|