@budibase/server 0.9.188 → 0.9.190-alpha.2
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/Dockerfile +7 -1
- package/__mocks__/mssql.ts +1 -1
- package/__mocks__/oracledb.ts +31 -0
- package/__mocks__/pg.ts +3 -0
- package/builder/assets/bb-space-man.5be51a45.svg +290 -0
- package/builder/assets/index.7d405e74.css +1 -0
- package/builder/assets/index.edea4fa5.js +1316 -0
- package/builder/assets/oracle.66592424.png +0 -0
- package/builder/assets/vendor.470042a4.js +152 -0
- package/builder/assets/vendor.5e1fe644.css +1 -0
- package/builder/index.html +4 -4
- package/coverage/clover.xml +1507 -1081
- package/coverage/coverage-final.json +93 -89
- package/coverage/lcov-report/api/controllers/analytics.js.html +2 -2
- package/coverage/lcov-report/api/controllers/apikeys.js.html +2 -2
- package/coverage/lcov-report/api/controllers/application.js.html +64 -13
- package/coverage/lcov-report/api/controllers/auth.js.html +19 -10
- package/coverage/lcov-report/api/controllers/automation.js.html +3 -3
- package/coverage/lcov-report/api/controllers/backup.js.html +1 -1
- package/coverage/lcov-report/api/controllers/cloud.js.html +1 -1
- package/coverage/lcov-report/api/controllers/component.js.html +4 -4
- package/coverage/lcov-report/api/controllers/datasource.js.html +232 -28
- package/coverage/lcov-report/api/controllers/dev.js.html +16 -7
- package/coverage/lcov-report/api/controllers/hosting.js.html +10 -10
- package/coverage/lcov-report/api/controllers/index.html +91 -91
- package/coverage/lcov-report/api/controllers/integration.js.html +1 -1
- package/coverage/lcov-report/api/controllers/layout.js.html +3 -3
- package/coverage/lcov-report/api/controllers/metadata.js.html +3 -3
- package/coverage/lcov-report/api/controllers/permission.js.html +3 -3
- package/coverage/lcov-report/api/controllers/query.js.html +53 -209
- package/coverage/lcov-report/api/controllers/role.js.html +9 -9
- package/coverage/lcov-report/api/controllers/routing.js.html +3 -3
- package/coverage/lcov-report/api/controllers/row/external.js.html +17 -8
- package/coverage/lcov-report/api/controllers/row/index.html +26 -26
- package/coverage/lcov-report/api/controllers/row/index.js.html +2 -2
- package/coverage/lcov-report/api/controllers/row/internal.js.html +9 -9
- package/coverage/lcov-report/api/controllers/row/internalSearch.js.html +2 -2
- package/coverage/lcov-report/api/controllers/row/utils.js.html +21 -30
- package/coverage/lcov-report/api/controllers/screen.js.html +2 -2
- package/coverage/lcov-report/api/controllers/script.js.html +3 -3
- package/coverage/lcov-report/api/controllers/table/external.js.html +1001 -0
- package/coverage/lcov-report/api/controllers/table/index.html +56 -26
- package/coverage/lcov-report/api/controllers/table/index.js.html +80 -350
- package/coverage/lcov-report/api/controllers/table/internal.js.html +545 -0
- package/coverage/lcov-report/api/controllers/table/utils.js.html +175 -52
- package/coverage/lcov-report/api/controllers/templates.js.html +4 -4
- package/coverage/lcov-report/api/controllers/user.js.html +390 -33
- package/coverage/lcov-report/api/controllers/view/exporters.js.html +19 -4
- package/coverage/lcov-report/api/controllers/view/index.html +22 -22
- package/coverage/lcov-report/api/controllers/view/index.js.html +52 -13
- package/coverage/lcov-report/api/controllers/view/utils.js.html +11 -11
- package/coverage/lcov-report/api/controllers/view/viewBuilder.js.html +3 -3
- package/coverage/lcov-report/api/controllers/webhook.js.html +4 -4
- 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/application.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 +2 -2
- package/coverage/lcov-report/api/routes/hosting.js.html +1 -1
- package/coverage/lcov-report/api/routes/index.html +4 -4
- package/coverage/lcov-report/api/routes/index.js.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/permission.js.html +1 -1
- package/coverage/lcov-report/api/routes/query.js.html +5 -2
- 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/row.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/static.js.html +2 -2
- package/coverage/lcov-report/api/routes/table.js.html +35 -2
- package/coverage/lcov-report/api/routes/templates.js.html +1 -1
- package/coverage/lcov-report/api/routes/user.js.html +17 -2
- 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 +2 -2
- package/coverage/lcov-report/automations/automationUtils.js.html +4 -4
- package/coverage/lcov-report/automations/bullboard.js.html +71 -20
- package/coverage/lcov-report/automations/index.html +35 -50
- package/coverage/lcov-report/automations/index.js.html +2 -2
- package/coverage/lcov-report/automations/steps/bash.js.html +1 -1
- package/coverage/lcov-report/automations/steps/createRow.js.html +1 -1
- package/coverage/lcov-report/automations/steps/delay.js.html +1 -1
- package/coverage/lcov-report/automations/steps/deleteRow.js.html +1 -1
- package/coverage/lcov-report/automations/steps/discord.js.html +3 -3
- package/coverage/lcov-report/automations/steps/executeQuery.js.html +1 -1
- package/coverage/lcov-report/automations/steps/executeScript.js.html +3 -3
- package/coverage/lcov-report/automations/steps/filter.js.html +1 -1
- package/coverage/lcov-report/automations/steps/index.html +14 -14
- package/coverage/lcov-report/automations/steps/integromat.js.html +1 -1
- package/coverage/lcov-report/automations/steps/outgoingWebhook.js.html +3 -3
- package/coverage/lcov-report/automations/steps/queryRows.js.html +3 -3
- 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 +7 -7
- package/coverage/lcov-report/automations/steps/zapier.js.html +1 -1
- 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 +22 -10
- package/coverage/lcov-report/automations/utils.js.html +42 -12
- package/coverage/lcov-report/constants/index.html +5 -5
- package/coverage/lcov-report/constants/index.js.html +87 -21
- 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/client.js.html +2 -2
- package/coverage/lcov-report/db/inMemoryView.js.html +2 -2
- package/coverage/lcov-report/db/index.html +2 -2
- package/coverage/lcov-report/db/index.js.html +1 -1
- package/coverage/lcov-report/db/linkedRows/LinkController.js.html +6 -6
- package/coverage/lcov-report/db/linkedRows/index.html +10 -10
- package/coverage/lcov-report/db/linkedRows/index.js.html +5 -5
- package/coverage/lcov-report/db/linkedRows/linkUtils.js.html +6 -6
- package/coverage/lcov-report/db/newid.js.html +3 -3
- package/coverage/lcov-report/db/utils.js.html +57 -57
- package/coverage/lcov-report/events/AutomationEmitter.js.html +6 -6
- package/coverage/lcov-report/events/index.html +6 -6
- package/coverage/lcov-report/events/index.js.html +1 -1
- package/coverage/lcov-report/events/utils.js.html +5 -5
- package/coverage/lcov-report/index.html +106 -91
- 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 +2 -2
- package/coverage/lcov-report/middleware/authorized.js.html +11 -8
- package/coverage/lcov-report/middleware/builder.js.html +16 -7
- package/coverage/lcov-report/middleware/currentapp.js.html +6 -6
- package/coverage/lcov-report/middleware/index.html +23 -23
- package/coverage/lcov-report/middleware/joi-validator.js.html +2 -2
- package/coverage/lcov-report/middleware/resourceId.js.html +18 -18
- package/coverage/lcov-report/middleware/selfhost.js.html +2 -2
- package/coverage/lcov-report/middleware/usageQuota.js.html +4 -4
- package/coverage/lcov-report/middleware/utils.js.html +1 -1
- package/coverage/lcov-report/{automations/thread.js.html → threads/automation.js.html} +90 -33
- package/coverage/lcov-report/threads/index.html +141 -0
- package/coverage/lcov-report/threads/index.js.html +278 -0
- package/coverage/lcov-report/threads/query.js.html +278 -0
- package/coverage/lcov-report/utilities/bcrypt.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 +144 -15
- package/coverage/lcov-report/utilities/global.js.html +26 -11
- package/coverage/lcov-report/utilities/index.html +48 -48
- package/coverage/lcov-report/utilities/index.js.html +47 -14
- package/coverage/lcov-report/utilities/queue/inMemoryQueue.js.html +30 -9
- package/coverage/lcov-report/utilities/queue/index.html +14 -14
- package/coverage/lcov-report/utilities/routing/index.html +1 -1
- package/coverage/lcov-report/utilities/routing/index.js.html +1 -1
- package/coverage/lcov-report/utilities/rowProcessor/index.html +4 -4
- package/coverage/lcov-report/utilities/rowProcessor/index.js.html +2 -2
- package/coverage/lcov-report/utilities/rowProcessor/utils.js.html +3 -3
- package/coverage/lcov-report/utilities/scriptRunner.js.html +16 -7
- package/coverage/lcov-report/utilities/security.js.html +3 -3
- package/coverage/lcov-report/utilities/statusCodes.js.html +1 -1
- package/coverage/lcov-report/utilities/users.js.html +1 -1
- package/coverage/lcov-report/utilities/workerRequests.js.html +5 -5
- package/coverage/lcov.info +2495 -1737
- package/dist/api/controllers/application.js +15 -1
- package/dist/api/controllers/auth.js +3 -3
- package/dist/api/controllers/datasource.js +67 -16
- package/dist/api/controllers/deploy/index.js +2 -0
- package/dist/api/controllers/dev.js +4 -1
- package/dist/api/controllers/query.js +30 -58
- package/dist/api/controllers/row/ExternalRequest.js +78 -34
- package/dist/api/controllers/row/external.js +3 -1
- package/dist/api/controllers/row/utils.js +6 -12
- package/dist/api/controllers/table/external.js +249 -0
- package/dist/api/controllers/table/index.js +49 -123
- package/dist/api/controllers/table/internal.js +150 -0
- package/dist/api/controllers/table/utils.js +62 -28
- package/dist/api/controllers/user.js +123 -11
- package/dist/api/controllers/view/exporters.js +4 -0
- package/dist/api/controllers/view/index.js +14 -2
- package/dist/api/routes/query.js +1 -1
- package/dist/api/routes/table.js +7 -1
- package/dist/api/routes/user.js +2 -1
- package/dist/app.js +2 -11
- package/dist/automations/bullboard.js +37 -10
- package/dist/automations/triggers.js +7 -3
- package/dist/automations/utils.js +11 -2
- package/dist/constants/index.js +19 -0
- package/dist/definitions/datasource.js +5 -0
- package/dist/environment.js +13 -0
- package/dist/integrations/base/IntegrationBase.js +2 -0
- package/dist/integrations/base/datasourcePlus.js +2 -0
- package/dist/integrations/base/sql.js +353 -177
- package/dist/integrations/base/sqlTable.js +143 -0
- package/dist/integrations/base/utils.js +30 -0
- package/dist/integrations/index.js +6 -0
- package/dist/integrations/microsoftSqlServer.js +117 -9
- package/dist/integrations/mysql.js +16 -85
- package/dist/integrations/oracle.js +347 -0
- package/dist/integrations/postgres.js +35 -28
- package/dist/integrations/utils.js +71 -9
- package/dist/middleware/authorized.js +2 -1
- package/dist/middleware/builder.js +4 -1
- package/dist/package.json +12 -7
- package/dist/tests/utilities/TestConfiguration.js +2 -1
- package/dist/{automations/thread.js → threads/automation.js} +26 -8
- package/dist/threads/index.js +64 -0
- package/dist/threads/query.js +64 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utilities/csvParser.js +46 -5
- package/dist/utilities/global.js +6 -2
- package/dist/utilities/index.js +11 -0
- package/dist/utilities/queue/inMemoryQueue.js +8 -0
- package/dist/utilities/scriptRunner.js +4 -1
- package/package.json +13 -8
- package/scripts/dev/manage.js +1 -0
- package/scripts/integrations/mssql/data/Dockerfile +9 -0
- package/scripts/integrations/mssql/data/entrypoint.sh +24 -0
- package/scripts/integrations/mssql/data/setup.sql +54 -0
- package/scripts/integrations/mssql/docker-compose.yaml +12 -0
- package/scripts/integrations/mssql/reset.sh +3 -0
- package/scripts/integrations/oracle/docker-compose.yml +19 -0
- package/scripts/integrations/oracle/instantclient/linux/x86-64/basiclite-21.4.zip +0 -0
- package/scripts/integrations/oracle/instantclient/linux/x86-64/install.sh +23 -0
- package/scripts/integrations/oracle/oracle.md +90 -0
- package/scripts/integrations/postgres/docker-compose.yml +3 -3
- package/scripts/likeCypress.ts +33 -0
- package/src/api/controllers/application.js +18 -1
- package/src/api/controllers/auth.js +3 -0
- package/src/api/controllers/datasource.js +84 -16
- package/src/api/controllers/deploy/index.js +2 -0
- package/src/api/controllers/dev.js +4 -1
- package/src/api/controllers/query.js +29 -81
- package/src/api/controllers/row/ExternalRequest.ts +91 -36
- package/src/api/controllers/row/external.js +4 -1
- package/src/api/controllers/row/utils.js +8 -11
- package/src/api/controllers/table/external.js +307 -0
- package/src/api/controllers/table/index.js +47 -137
- package/src/api/controllers/table/internal.js +155 -0
- package/src/api/controllers/table/utils.js +74 -33
- package/src/api/controllers/user.js +132 -13
- package/src/api/controllers/view/exporters.js +5 -0
- package/src/api/controllers/view/index.js +15 -2
- package/src/api/routes/query.js +1 -0
- package/src/api/routes/table.js +11 -0
- package/src/api/routes/tests/datasource.spec.js +2 -2
- package/src/api/routes/tests/misc.spec.js +5 -1
- package/src/api/routes/tests/query.spec.js +0 -1
- package/src/api/routes/user.js +5 -0
- package/src/app.ts +2 -10
- package/src/automations/bullboard.js +28 -11
- package/src/automations/tests/automation.spec.js +3 -4
- package/src/automations/triggers.js +7 -3
- package/src/automations/utils.js +12 -2
- package/src/constants/index.js +22 -0
- package/src/definitions/common.ts +7 -1
- package/src/definitions/datasource.ts +10 -3
- package/src/environment.js +15 -0
- package/src/integrations/airtable.ts +2 -1
- package/src/integrations/arangodb.ts +2 -1
- package/src/integrations/base/IntegrationBase.ts +6 -0
- package/src/integrations/base/datasourcePlus.ts +9 -0
- package/src/integrations/base/sql.ts +377 -218
- package/src/integrations/base/sqlTable.ts +180 -0
- package/src/integrations/base/utils.ts +22 -0
- package/src/integrations/couchdb.ts +2 -1
- package/src/integrations/dynamodb.ts +2 -1
- package/src/integrations/elasticsearch.ts +2 -1
- package/src/integrations/index.ts +7 -0
- package/src/integrations/microsoftSqlServer.ts +145 -13
- package/src/integrations/mongodb.ts +2 -1
- package/src/integrations/mysql.ts +23 -95
- package/src/integrations/oracle.ts +458 -0
- package/src/integrations/postgres.ts +45 -35
- package/src/integrations/rest.ts +2 -1
- package/src/integrations/s3.ts +2 -1
- package/src/integrations/tests/microsoftSqlServer.spec.js +22 -15
- package/src/integrations/tests/oracle.spec.js +94 -0
- package/src/integrations/tests/postgres.spec.js +4 -0
- package/src/integrations/utils.ts +78 -8
- package/src/middleware/authorized.js +2 -1
- package/src/middleware/builder.js +4 -1
- package/src/tests/utilities/TestConfiguration.js +2 -1
- package/src/{automations/thread.js → threads/automation.js} +27 -8
- package/src/threads/index.js +66 -0
- package/src/threads/query.js +66 -0
- package/src/utilities/csvParser.js +48 -5
- package/src/utilities/global.js +7 -2
- package/src/utilities/index.js +11 -0
- package/src/utilities/queue/inMemoryQueue.js +7 -0
- package/src/utilities/scriptRunner.js +4 -1
- package/src/utilities/tests/__snapshots__/csvParser.spec.js.snap +0 -6
- package/src/utilities/tests/csvParser.spec.js +3 -0
- package/tsconfig.json +1 -1
- package/builder/assets/index.550fdba7.js +0 -201
- package/builder/assets/index.7469e1e4.css +0 -29
- package/builder/assets/vendor.278a305c.js +0 -9
- package/builder/assets/vendor.d75d5eb7.css +0 -1
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const knex_1 = require("knex");
|
|
4
|
+
const datasource_1 = require("../../definitions/datasource");
|
|
5
|
+
const utils_1 = require("../utils");
|
|
6
|
+
const { FieldTypes, RelationshipTypes } = require("../../constants");
|
|
7
|
+
function generateSchema(schema, table, tables, oldTable = null) {
|
|
8
|
+
let primaryKey = table && table.primary ? table.primary[0] : null;
|
|
9
|
+
const columns = Object.values(table.schema);
|
|
10
|
+
// all columns in a junction table will be meta
|
|
11
|
+
let metaCols = columns.filter(col => col.meta);
|
|
12
|
+
let isJunction = metaCols.length === columns.length;
|
|
13
|
+
// can't change primary once its set for now
|
|
14
|
+
if (primaryKey && !oldTable && !isJunction) {
|
|
15
|
+
schema.increments(primaryKey).primary();
|
|
16
|
+
}
|
|
17
|
+
else if (!oldTable && isJunction) {
|
|
18
|
+
schema.primary(metaCols.map(col => col.name));
|
|
19
|
+
}
|
|
20
|
+
// check if any columns need added
|
|
21
|
+
const foreignKeys = Object.values(table.schema).map(col => col.foreignKey);
|
|
22
|
+
for (let [key, column] of Object.entries(table.schema)) {
|
|
23
|
+
// skip things that are already correct
|
|
24
|
+
const oldColumn = oldTable ? oldTable.schema[key] : null;
|
|
25
|
+
if ((oldColumn && oldColumn.type) || (primaryKey === key && !isJunction)) {
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
switch (column.type) {
|
|
29
|
+
case FieldTypes.STRING:
|
|
30
|
+
case FieldTypes.OPTIONS:
|
|
31
|
+
case FieldTypes.LONGFORM:
|
|
32
|
+
schema.string(key);
|
|
33
|
+
break;
|
|
34
|
+
case FieldTypes.NUMBER:
|
|
35
|
+
// if meta is specified then this is a junction table entry
|
|
36
|
+
if (column.meta && column.meta.toKey && column.meta.toTable) {
|
|
37
|
+
const { toKey, toTable } = column.meta;
|
|
38
|
+
schema.integer(key).unsigned();
|
|
39
|
+
schema.foreign(key).references(`${toTable}.${toKey}`);
|
|
40
|
+
}
|
|
41
|
+
else if (foreignKeys.indexOf(key) === -1) {
|
|
42
|
+
schema.float(key);
|
|
43
|
+
}
|
|
44
|
+
break;
|
|
45
|
+
case FieldTypes.BOOLEAN:
|
|
46
|
+
schema.boolean(key);
|
|
47
|
+
break;
|
|
48
|
+
case FieldTypes.DATETIME:
|
|
49
|
+
schema.datetime(key);
|
|
50
|
+
break;
|
|
51
|
+
case FieldTypes.ARRAY:
|
|
52
|
+
schema.json(key);
|
|
53
|
+
break;
|
|
54
|
+
case FieldTypes.LINK:
|
|
55
|
+
// this side of the relationship doesn't need any SQL work
|
|
56
|
+
if (column.relationshipType !== RelationshipTypes.MANY_TO_ONE &&
|
|
57
|
+
column.relationshipType !== RelationshipTypes.MANY_TO_MANY) {
|
|
58
|
+
if (!column.foreignKey || !column.tableId) {
|
|
59
|
+
throw "Invalid relationship schema";
|
|
60
|
+
}
|
|
61
|
+
const { tableName } = utils_1.breakExternalTableId(column.tableId);
|
|
62
|
+
// @ts-ignore
|
|
63
|
+
const relatedTable = tables[tableName];
|
|
64
|
+
if (!relatedTable) {
|
|
65
|
+
throw "Referenced table doesn't exist";
|
|
66
|
+
}
|
|
67
|
+
schema.integer(column.foreignKey).unsigned();
|
|
68
|
+
schema
|
|
69
|
+
.foreign(column.foreignKey)
|
|
70
|
+
.references(`${tableName}.${relatedTable.primary[0]}`);
|
|
71
|
+
}
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
// need to check if any columns have been deleted
|
|
76
|
+
if (oldTable) {
|
|
77
|
+
const deletedColumns = Object.entries(oldTable.schema)
|
|
78
|
+
.filter(([key, schema]) => schema.type !== FieldTypes.LINK && table.schema[key] == null)
|
|
79
|
+
.map(([key]) => key);
|
|
80
|
+
deletedColumns.forEach(key => {
|
|
81
|
+
if (oldTable.constrained && oldTable.constrained.indexOf(key) !== -1) {
|
|
82
|
+
schema.dropForeign(key);
|
|
83
|
+
}
|
|
84
|
+
schema.dropColumn(key);
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
return schema;
|
|
88
|
+
}
|
|
89
|
+
function buildCreateTable(knex, table, tables) {
|
|
90
|
+
return knex.schema.createTable(table.name, schema => {
|
|
91
|
+
generateSchema(schema, table, tables);
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
function buildUpdateTable(knex, table, tables, oldTable) {
|
|
95
|
+
return knex.schema.alterTable(table.name, schema => {
|
|
96
|
+
generateSchema(schema, table, tables, oldTable);
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
function buildDeleteTable(knex, table) {
|
|
100
|
+
return knex.schema.dropTable(table.name);
|
|
101
|
+
}
|
|
102
|
+
class SqlTableQueryBuilder {
|
|
103
|
+
// pass through client to get flavour of SQL
|
|
104
|
+
constructor(client) {
|
|
105
|
+
this.sqlClient = client;
|
|
106
|
+
}
|
|
107
|
+
getSqlClient() {
|
|
108
|
+
return this.sqlClient;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* @param json the input JSON structure from which an SQL query will be built.
|
|
112
|
+
* @return {string} the operation that was found in the JSON.
|
|
113
|
+
*/
|
|
114
|
+
_operation(json) {
|
|
115
|
+
return json.endpoint.operation;
|
|
116
|
+
}
|
|
117
|
+
_tableQuery(json) {
|
|
118
|
+
const client = knex_1.knex({ client: this.sqlClient });
|
|
119
|
+
let query;
|
|
120
|
+
if (!json.table || !json.meta || !json.meta.tables) {
|
|
121
|
+
throw "Cannot execute without table being specified";
|
|
122
|
+
}
|
|
123
|
+
switch (this._operation(json)) {
|
|
124
|
+
case datasource_1.Operation.CREATE_TABLE:
|
|
125
|
+
query = buildCreateTable(client, json.table, json.meta.tables);
|
|
126
|
+
break;
|
|
127
|
+
case datasource_1.Operation.UPDATE_TABLE:
|
|
128
|
+
if (!json.meta || !json.meta.table) {
|
|
129
|
+
throw "Must specify old table for update";
|
|
130
|
+
}
|
|
131
|
+
query = buildUpdateTable(client, json.table, json.meta.tables, json.meta.table);
|
|
132
|
+
break;
|
|
133
|
+
case datasource_1.Operation.DELETE_TABLE:
|
|
134
|
+
query = buildDeleteTable(client, json.table);
|
|
135
|
+
break;
|
|
136
|
+
default:
|
|
137
|
+
throw "Table operation is of unknown type";
|
|
138
|
+
}
|
|
139
|
+
return query.toSQL();
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
exports.default = SqlTableQueryBuilder;
|
|
143
|
+
module.exports = SqlTableQueryBuilder;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
var DatasourceUtils;
|
|
13
|
+
(function (DatasourceUtils) {
|
|
14
|
+
const { integrations } = require("../index");
|
|
15
|
+
function makeExternalQuery(datasource, json) {
|
|
16
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
const Integration = integrations[datasource.source];
|
|
18
|
+
// query is the opinionated function
|
|
19
|
+
if (Integration.prototype.query) {
|
|
20
|
+
const integration = new Integration(datasource.config);
|
|
21
|
+
return integration.query(json);
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
throw "Datasource does not support query.";
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
DatasourceUtils.makeExternalQuery = makeExternalQuery;
|
|
29
|
+
module.exports.makeExternalQuery = makeExternalQuery;
|
|
30
|
+
})(DatasourceUtils || (DatasourceUtils = {}));
|
|
@@ -37,6 +37,12 @@ const INTEGRATIONS = {
|
|
|
37
37
|
[SourceNames.ARANGODB]: arangodb.integration,
|
|
38
38
|
[SourceNames.REST]: rest.integration,
|
|
39
39
|
};
|
|
40
|
+
// optionally add oracle integration if the oracle binary can be installed
|
|
41
|
+
if (!(process.arch === "arm64" && process.platform === "darwin")) {
|
|
42
|
+
const oracle = require("./oracle");
|
|
43
|
+
DEFINITIONS[SourceNames.ORACLE] = oracle.schema;
|
|
44
|
+
INTEGRATIONS[SourceNames.ORACLE] = oracle.integration;
|
|
45
|
+
}
|
|
40
46
|
module.exports = {
|
|
41
47
|
definitions: DEFINITIONS,
|
|
42
48
|
integrations: INTEGRATIONS,
|
|
@@ -17,6 +17,7 @@ var MSSQLModule;
|
|
|
17
17
|
const Sql = require("./base/sql");
|
|
18
18
|
const SCHEMA = {
|
|
19
19
|
docs: "https://github.com/tediousjs/node-mssql",
|
|
20
|
+
plus: true,
|
|
20
21
|
description: "Microsoft SQL Server is a relational database management system developed by Microsoft. ",
|
|
21
22
|
friendlyName: "MS SQL Server",
|
|
22
23
|
datasource: {
|
|
@@ -62,10 +63,22 @@ var MSSQLModule;
|
|
|
62
63
|
},
|
|
63
64
|
},
|
|
64
65
|
};
|
|
65
|
-
function internalQuery(client, query) {
|
|
66
|
+
function internalQuery(client, query, operation = undefined) {
|
|
66
67
|
return __awaiter(this, void 0, void 0, function* () {
|
|
68
|
+
const request = client.request();
|
|
67
69
|
try {
|
|
68
|
-
|
|
70
|
+
if (Array.isArray(query.bindings)) {
|
|
71
|
+
let count = 0;
|
|
72
|
+
for (let binding of query.bindings) {
|
|
73
|
+
request.input(`p${count++}`, binding);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
// this is a hack to get the inserted ID back,
|
|
77
|
+
// no way to do this with Knex nicely
|
|
78
|
+
const sql = operation === datasource_1.Operation.CREATE
|
|
79
|
+
? `${query.sql}; SELECT SCOPE_IDENTITY() AS id;`
|
|
80
|
+
: query.sql;
|
|
81
|
+
return yield request.query(sql);
|
|
69
82
|
}
|
|
70
83
|
catch (err) {
|
|
71
84
|
// @ts-ignore
|
|
@@ -75,21 +88,56 @@ var MSSQLModule;
|
|
|
75
88
|
}
|
|
76
89
|
class SqlServerIntegration extends Sql {
|
|
77
90
|
constructor(config) {
|
|
78
|
-
super(
|
|
91
|
+
super(utils_1.SqlClients.MS_SQL);
|
|
92
|
+
this.tables = {};
|
|
93
|
+
this.schemaErrors = {};
|
|
94
|
+
this.MASTER_TABLES = [
|
|
95
|
+
"spt_fallback_db",
|
|
96
|
+
"spt_fallback_dev",
|
|
97
|
+
"spt_fallback_usg",
|
|
98
|
+
"spt_monitor",
|
|
99
|
+
"MSreplication_options",
|
|
100
|
+
];
|
|
101
|
+
this.TABLES_SQL = "SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='BASE TABLE'";
|
|
79
102
|
this.config = config;
|
|
80
103
|
const clientCfg = Object.assign(Object.assign({}, this.config), { options: {
|
|
81
104
|
encrypt: this.config.encrypt,
|
|
105
|
+
enableArithAbort: true,
|
|
82
106
|
} });
|
|
83
107
|
delete clientCfg.encrypt;
|
|
84
108
|
if (!this.pool) {
|
|
85
109
|
this.pool = new sqlServer.ConnectionPool(clientCfg);
|
|
86
110
|
}
|
|
87
111
|
}
|
|
112
|
+
getDefinitionSQL(tableName) {
|
|
113
|
+
return `select *
|
|
114
|
+
from INFORMATION_SCHEMA.COLUMNS
|
|
115
|
+
where TABLE_NAME='${tableName}'`;
|
|
116
|
+
}
|
|
117
|
+
getConstraintsSQL(tableName) {
|
|
118
|
+
return `SELECT * FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS AS TC
|
|
119
|
+
INNER JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE AS KU
|
|
120
|
+
ON TC.CONSTRAINT_TYPE = 'PRIMARY KEY'
|
|
121
|
+
AND TC.CONSTRAINT_NAME = KU.CONSTRAINT_NAME
|
|
122
|
+
AND KU.table_name='${tableName}'
|
|
123
|
+
ORDER BY
|
|
124
|
+
KU.TABLE_NAME,
|
|
125
|
+
KU.ORDINAL_POSITION;`;
|
|
126
|
+
}
|
|
127
|
+
getAutoColumnsSQL(tableName) {
|
|
128
|
+
return `SELECT
|
|
129
|
+
COLUMNPROPERTY(OBJECT_ID(TABLE_SCHEMA+'.'+TABLE_NAME),COLUMN_NAME,'IsComputed')
|
|
130
|
+
AS IS_COMPUTED,
|
|
131
|
+
COLUMNPROPERTY(object_id(TABLE_SCHEMA+'.'+TABLE_NAME), COLUMN_NAME, 'IsIdentity')
|
|
132
|
+
AS IS_IDENTITY,
|
|
133
|
+
*
|
|
134
|
+
FROM INFORMATION_SCHEMA.COLUMNS
|
|
135
|
+
WHERE TABLE_NAME='${tableName}'`;
|
|
136
|
+
}
|
|
88
137
|
connect() {
|
|
89
138
|
return __awaiter(this, void 0, void 0, function* () {
|
|
90
139
|
try {
|
|
91
|
-
|
|
92
|
-
this.client = client.request();
|
|
140
|
+
this.client = yield this.pool.connect();
|
|
93
141
|
}
|
|
94
142
|
catch (err) {
|
|
95
143
|
// @ts-ignore
|
|
@@ -97,6 +145,65 @@ var MSSQLModule;
|
|
|
97
145
|
}
|
|
98
146
|
});
|
|
99
147
|
}
|
|
148
|
+
runSQL(sql) {
|
|
149
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
150
|
+
return (yield internalQuery(this.client, utils_1.getSqlQuery(sql))).recordset;
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Fetches the tables from the sql server database and assigns them to the datasource.
|
|
155
|
+
* @param {*} datasourceId - datasourceId to fetch
|
|
156
|
+
* @param entities - the tables that are to be built
|
|
157
|
+
*/
|
|
158
|
+
buildSchema(datasourceId, entities) {
|
|
159
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
160
|
+
yield this.connect();
|
|
161
|
+
let tableNames = yield this.runSQL(this.TABLES_SQL);
|
|
162
|
+
if (tableNames == null || !Array.isArray(tableNames)) {
|
|
163
|
+
throw "Unable to get list of tables in database";
|
|
164
|
+
}
|
|
165
|
+
tableNames = tableNames
|
|
166
|
+
.map((record) => record.TABLE_NAME)
|
|
167
|
+
.filter((name) => this.MASTER_TABLES.indexOf(name) === -1);
|
|
168
|
+
const tables = {};
|
|
169
|
+
for (let tableName of tableNames) {
|
|
170
|
+
// get the column definition (type)
|
|
171
|
+
const definition = yield this.runSQL(this.getDefinitionSQL(tableName));
|
|
172
|
+
// find primary key constraints
|
|
173
|
+
const constraints = yield this.runSQL(this.getConstraintsSQL(tableName));
|
|
174
|
+
// find the computed and identity columns (auto columns)
|
|
175
|
+
const columns = yield this.runSQL(this.getAutoColumnsSQL(tableName));
|
|
176
|
+
const primaryKeys = constraints
|
|
177
|
+
.filter((constraint) => constraint.CONSTRAINT_TYPE === "PRIMARY KEY")
|
|
178
|
+
.map((constraint) => constraint.COLUMN_NAME);
|
|
179
|
+
const autoColumns = columns
|
|
180
|
+
.filter((col) => col.IS_COMPUTED || col.IS_IDENTITY)
|
|
181
|
+
.map((col) => col.COLUMN_NAME);
|
|
182
|
+
let schema = {};
|
|
183
|
+
for (let def of definition) {
|
|
184
|
+
const name = def.COLUMN_NAME;
|
|
185
|
+
if (typeof name !== "string") {
|
|
186
|
+
continue;
|
|
187
|
+
}
|
|
188
|
+
const type = utils_1.convertSqlType(def.DATA_TYPE);
|
|
189
|
+
schema[name] = {
|
|
190
|
+
autocolumn: !!autoColumns.find((col) => col === name),
|
|
191
|
+
name: name,
|
|
192
|
+
type,
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
tables[tableName] = {
|
|
196
|
+
_id: utils_1.buildExternalTableId(datasourceId, tableName),
|
|
197
|
+
primary: primaryKeys,
|
|
198
|
+
name: tableName,
|
|
199
|
+
schema,
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
const final = utils_1.finaliseExternalTables(tables, entities);
|
|
203
|
+
this.tables = final.tables;
|
|
204
|
+
this.schemaErrors = final.errors;
|
|
205
|
+
});
|
|
206
|
+
}
|
|
100
207
|
read(query) {
|
|
101
208
|
return __awaiter(this, void 0, void 0, function* () {
|
|
102
209
|
yield this.connect();
|
|
@@ -127,10 +234,11 @@ var MSSQLModule;
|
|
|
127
234
|
}
|
|
128
235
|
query(json) {
|
|
129
236
|
return __awaiter(this, void 0, void 0, function* () {
|
|
130
|
-
|
|
131
|
-
const
|
|
132
|
-
const
|
|
133
|
-
|
|
237
|
+
yield this.connect();
|
|
238
|
+
const operation = this._operation(json);
|
|
239
|
+
const queryFn = (query, op) => internalQuery(this.client, query, op);
|
|
240
|
+
const processFn = (result) => result.recordset ? result.recordset : [{ [operation]: true }];
|
|
241
|
+
return this.queryWithReturning(json, queryFn, processFn);
|
|
134
242
|
});
|
|
135
243
|
}
|
|
136
244
|
}
|
|
@@ -15,31 +15,6 @@ var MySQLModule;
|
|
|
15
15
|
(function (MySQLModule) {
|
|
16
16
|
const mysql = require("mysql2");
|
|
17
17
|
const Sql = require("./base/sql");
|
|
18
|
-
const { buildExternalTableId, convertType, copyExistingPropsOver, } = require("./utils");
|
|
19
|
-
const { FieldTypes } = require("../constants");
|
|
20
|
-
const TYPE_MAP = {
|
|
21
|
-
text: FieldTypes.LONGFORM,
|
|
22
|
-
blob: FieldTypes.LONGFORM,
|
|
23
|
-
enum: FieldTypes.STRING,
|
|
24
|
-
varchar: FieldTypes.STRING,
|
|
25
|
-
float: FieldTypes.NUMBER,
|
|
26
|
-
int: FieldTypes.NUMBER,
|
|
27
|
-
numeric: FieldTypes.NUMBER,
|
|
28
|
-
bigint: FieldTypes.NUMBER,
|
|
29
|
-
mediumint: FieldTypes.NUMBER,
|
|
30
|
-
decimal: FieldTypes.NUMBER,
|
|
31
|
-
dec: FieldTypes.NUMBER,
|
|
32
|
-
double: FieldTypes.NUMBER,
|
|
33
|
-
real: FieldTypes.NUMBER,
|
|
34
|
-
fixed: FieldTypes.NUMBER,
|
|
35
|
-
smallint: FieldTypes.NUMBER,
|
|
36
|
-
timestamp: FieldTypes.DATETIME,
|
|
37
|
-
date: FieldTypes.DATETIME,
|
|
38
|
-
datetime: FieldTypes.DATETIME,
|
|
39
|
-
time: FieldTypes.DATETIME,
|
|
40
|
-
tinyint: FieldTypes.BOOLEAN,
|
|
41
|
-
json: datasource_1.DatasourceFieldTypes.JSON,
|
|
42
|
-
};
|
|
43
18
|
const SCHEMA = {
|
|
44
19
|
docs: "https://github.com/mysqljs/mysql",
|
|
45
20
|
plus: true,
|
|
@@ -111,7 +86,9 @@ var MySQLModule;
|
|
|
111
86
|
}
|
|
112
87
|
class MySQLIntegration extends Sql {
|
|
113
88
|
constructor(config) {
|
|
114
|
-
super(
|
|
89
|
+
super(utils_1.SqlClients.MY_SQL);
|
|
90
|
+
this.tables = {};
|
|
91
|
+
this.schemaErrors = {};
|
|
115
92
|
this.config = config;
|
|
116
93
|
if (config.ssl && Object.keys(config.ssl).length === 0) {
|
|
117
94
|
delete config.ssl;
|
|
@@ -125,7 +102,8 @@ var MySQLModule;
|
|
|
125
102
|
this.client.connect();
|
|
126
103
|
// get the tables first
|
|
127
104
|
const tablesResp = yield internalQuery(this.client, { sql: "SHOW TABLES;" }, false);
|
|
128
|
-
const tableNames = tablesResp.map((obj) => obj[`Tables_in_${database
|
|
105
|
+
const tableNames = tablesResp.map((obj) => obj[`Tables_in_${database}`] ||
|
|
106
|
+
obj[`Tables_in_${database.toLowerCase()}`]);
|
|
129
107
|
for (let tableName of tableNames) {
|
|
130
108
|
const primaryKeys = [];
|
|
131
109
|
const schema = {};
|
|
@@ -144,26 +122,23 @@ var MySQLModule;
|
|
|
144
122
|
schema[columnName] = {
|
|
145
123
|
name: columnName,
|
|
146
124
|
autocolumn: isAuto,
|
|
147
|
-
type:
|
|
125
|
+
type: utils_1.convertSqlType(column.Type),
|
|
148
126
|
constraints,
|
|
149
127
|
};
|
|
150
128
|
}
|
|
151
|
-
// for now just default to first column
|
|
152
|
-
if (primaryKeys.length === 0) {
|
|
153
|
-
primaryKeys.push(descResp[0].Field);
|
|
154
|
-
}
|
|
155
129
|
if (!tables[tableName]) {
|
|
156
130
|
tables[tableName] = {
|
|
157
|
-
_id: buildExternalTableId(datasourceId, tableName),
|
|
131
|
+
_id: utils_1.buildExternalTableId(datasourceId, tableName),
|
|
158
132
|
primary: primaryKeys,
|
|
159
133
|
name: tableName,
|
|
160
134
|
schema,
|
|
161
135
|
};
|
|
162
136
|
}
|
|
163
|
-
copyExistingPropsOver(tableName, tables, entities);
|
|
164
137
|
}
|
|
165
138
|
this.client.end();
|
|
166
|
-
|
|
139
|
+
const final = utils_1.finaliseExternalTables(tables, entities);
|
|
140
|
+
this.tables = final.tables;
|
|
141
|
+
this.schemaErrors = final.errors;
|
|
167
142
|
});
|
|
168
143
|
}
|
|
169
144
|
create(query) {
|
|
@@ -173,7 +148,9 @@ var MySQLModule;
|
|
|
173
148
|
});
|
|
174
149
|
}
|
|
175
150
|
read(query) {
|
|
176
|
-
return
|
|
151
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
152
|
+
return internalQuery(this.client, utils_1.getSqlQuery(query));
|
|
153
|
+
});
|
|
177
154
|
}
|
|
178
155
|
update(query) {
|
|
179
156
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -187,59 +164,13 @@ var MySQLModule;
|
|
|
187
164
|
return results.length ? results : [{ deleted: true }];
|
|
188
165
|
});
|
|
189
166
|
}
|
|
190
|
-
getReturningRow(json) {
|
|
191
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
192
|
-
if (!json.extra || !json.extra.idFilter) {
|
|
193
|
-
return {};
|
|
194
|
-
}
|
|
195
|
-
const input = this._query({
|
|
196
|
-
endpoint: Object.assign(Object.assign({}, json.endpoint), { operation: datasource_1.Operation.READ }),
|
|
197
|
-
fields: [],
|
|
198
|
-
filters: json.extra.idFilter,
|
|
199
|
-
paginate: {
|
|
200
|
-
limit: 1,
|
|
201
|
-
},
|
|
202
|
-
});
|
|
203
|
-
return internalQuery(this.client, input, false);
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
// when creating if an ID has been inserted need to make sure
|
|
207
|
-
// the id filter is enriched with it before trying to retrieve the row
|
|
208
|
-
checkLookupKeys(results, json) {
|
|
209
|
-
var _a, _b;
|
|
210
|
-
if (!(results === null || results === void 0 ? void 0 : results.insertId) || !((_a = json.meta) === null || _a === void 0 ? void 0 : _a.table) || !json.meta.table.primary) {
|
|
211
|
-
return json;
|
|
212
|
-
}
|
|
213
|
-
const primaryKey = (_b = json.meta.table.primary) === null || _b === void 0 ? void 0 : _b[0];
|
|
214
|
-
json.extra = {
|
|
215
|
-
idFilter: {
|
|
216
|
-
equal: {
|
|
217
|
-
[primaryKey]: results.insertId,
|
|
218
|
-
},
|
|
219
|
-
},
|
|
220
|
-
};
|
|
221
|
-
return json;
|
|
222
|
-
}
|
|
223
167
|
query(json) {
|
|
224
168
|
return __awaiter(this, void 0, void 0, function* () {
|
|
225
|
-
const operation = this._operation(json);
|
|
226
169
|
this.client.connect();
|
|
227
|
-
const
|
|
228
|
-
|
|
229
|
-
// need to manage returning, a feature mySQL can't do
|
|
230
|
-
if (operation === operation.DELETE) {
|
|
231
|
-
row = this.getReturningRow(json);
|
|
232
|
-
}
|
|
233
|
-
const results = yield internalQuery(this.client, input, false);
|
|
234
|
-
// same as delete, manage returning
|
|
235
|
-
if (operation === datasource_1.Operation.CREATE || operation === datasource_1.Operation.UPDATE) {
|
|
236
|
-
row = this.getReturningRow(this.checkLookupKeys(results, json));
|
|
237
|
-
}
|
|
170
|
+
const queryFn = (query) => internalQuery(this.client, query, false);
|
|
171
|
+
const output = yield this.queryWithReturning(json, queryFn);
|
|
238
172
|
this.client.end();
|
|
239
|
-
|
|
240
|
-
return row;
|
|
241
|
-
}
|
|
242
|
-
return results.length ? results : [{ [operation.toLowerCase()]: true }];
|
|
173
|
+
return output;
|
|
243
174
|
});
|
|
244
175
|
}
|
|
245
176
|
}
|