@budibase/server 2.6.19-alpha.0 → 2.6.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/builder/assets/{index.b9eeb2a8.js → index.69c5c1ea.js} +318 -310
- package/builder/assets/{index.07382a47.css → index.86c992bf.css} +2 -2
- package/builder/index.html +2 -2
- package/dist/api/controllers/datasource.js +39 -70
- package/dist/api/controllers/integration.js +2 -2
- package/dist/api/routes/datasource.js +0 -1
- package/dist/automations/steps/make.js +5 -19
- package/dist/automations/steps/zapier.js +6 -19
- package/dist/db/dynamoClient.js +1 -1
- package/dist/integrations/airtable.js +2 -28
- package/dist/integrations/arangodb.js +3 -19
- package/dist/integrations/couchdb.js +1 -16
- package/dist/integrations/dynamodb.js +0 -16
- package/dist/integrations/elasticsearch.js +0 -15
- package/dist/integrations/firebase.js +0 -15
- package/dist/integrations/googlesheets.js +1 -30
- package/dist/integrations/index.js +2 -5
- package/dist/integrations/microsoftSqlServer.js +0 -16
- package/dist/integrations/mongodb.js +0 -16
- package/dist/integrations/mysql.js +5 -21
- package/dist/integrations/oracle.js +0 -29
- package/dist/integrations/postgres.js +7 -26
- package/dist/integrations/redis.js +1 -20
- package/dist/integrations/s3.js +4 -23
- package/dist/integrations/snowflake.js +0 -15
- package/dist/migrations/functions/backfill/app/queries.js +2 -1
- package/dist/sdk/app/datasources/datasources.js +3 -10
- package/dist/sdk/users/utils.js +30 -23
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utilities/global.js +1 -4
- package/jest.config.ts +3 -3
- package/nodemon.json +3 -7
- package/package.json +9 -10
- package/src/api/controllers/datasource.ts +49 -88
- package/src/api/controllers/integration.ts +3 -3
- package/src/api/routes/datasource.ts +0 -5
- package/src/automations/steps/make.ts +1 -18
- package/src/automations/steps/zapier.ts +1 -18
- package/src/automations/tests/zapier.spec.js +27 -0
- package/src/db/dynamoClient.ts +1 -1
- package/src/integration-test/postgres.spec.ts +1 -0
- package/src/integrations/airtable.ts +4 -31
- package/src/integrations/arangodb.ts +2 -18
- package/src/integrations/couchdb.ts +4 -18
- package/src/integrations/dynamodb.ts +5 -34
- package/src/integrations/elasticsearch.ts +1 -16
- package/src/integrations/firebase.ts +0 -15
- package/src/integrations/googlesheets.ts +2 -31
- package/src/integrations/index.ts +7 -12
- package/src/integrations/microsoftSqlServer.ts +0 -16
- package/src/integrations/mongodb.ts +0 -16
- package/src/integrations/mysql.ts +16 -27
- package/src/integrations/oracle.ts +6 -28
- package/src/integrations/postgres.ts +3 -21
- package/src/integrations/redis.ts +3 -26
- package/src/integrations/s3.ts +3 -19
- package/src/integrations/snowflake.ts +1 -20
- package/src/migrations/functions/backfill/app/queries.ts +1 -1
- package/src/sdk/app/datasources/datasources.ts +1 -7
- package/src/sdk/users/utils.ts +32 -24
- package/src/utilities/global.ts +1 -4
- package/tsconfig.json +1 -1
- package/src/automations/tests/make.spec.ts +0 -54
- package/src/automations/tests/zapier.spec.ts +0 -56
package/builder/index.html
CHANGED
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
<link rel="preconnect" href="https://fonts.gstatic.com" />
|
|
9
9
|
<link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;600;700&display=swap"
|
|
10
10
|
rel="stylesheet" />
|
|
11
|
-
<script type="module" crossorigin src="/builder/assets/index.
|
|
12
|
-
<link rel="stylesheet" href="/builder/assets/index.
|
|
11
|
+
<script type="module" crossorigin src="/builder/assets/index.69c5c1ea.js"></script>
|
|
12
|
+
<link rel="stylesheet" href="/builder/assets/index.86c992bf.css">
|
|
13
13
|
</head>
|
|
14
14
|
|
|
15
15
|
<body id="app">
|
|
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.query = exports.find = exports.destroy = exports.save = exports.update = exports.buildSchemaFromDb = exports.
|
|
15
|
+
exports.query = exports.find = exports.destroy = exports.save = exports.update = exports.buildSchemaFromDb = exports.fetch = void 0;
|
|
16
16
|
const utils_1 = require("../../db/utils");
|
|
17
17
|
const internal_1 = require("./table/internal");
|
|
18
18
|
const constants_1 = require("../../constants");
|
|
@@ -21,52 +21,6 @@ const utils_2 = require("./row/utils");
|
|
|
21
21
|
const utils_3 = require("../../threads/utils");
|
|
22
22
|
const backend_core_1 = require("@budibase/backend-core");
|
|
23
23
|
const sdk_1 = __importDefault(require("../../sdk"));
|
|
24
|
-
function getErrorTables(errors, errorType) {
|
|
25
|
-
return Object.entries(errors)
|
|
26
|
-
.filter(entry => entry[1] === errorType)
|
|
27
|
-
.map(([name]) => name);
|
|
28
|
-
}
|
|
29
|
-
function updateError(error, newError, tables) {
|
|
30
|
-
if (!error) {
|
|
31
|
-
error = "";
|
|
32
|
-
}
|
|
33
|
-
if (error.length > 0) {
|
|
34
|
-
error += "\n";
|
|
35
|
-
}
|
|
36
|
-
error += `${newError} ${tables.join(", ")}`;
|
|
37
|
-
return error;
|
|
38
|
-
}
|
|
39
|
-
function getConnector(datasource) {
|
|
40
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
-
const Connector = yield (0, integrations_1.getIntegration)(datasource.source);
|
|
42
|
-
// can't enrich if it doesn't have an ID yet
|
|
43
|
-
if (datasource._id) {
|
|
44
|
-
datasource = yield sdk_1.default.datasources.enrich(datasource);
|
|
45
|
-
}
|
|
46
|
-
// Connect to the DB and build the schema
|
|
47
|
-
return new Connector(datasource.config);
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
function buildSchemaHelper(datasource) {
|
|
51
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
-
const connector = (yield getConnector(datasource));
|
|
53
|
-
yield connector.buildSchema(datasource._id, datasource.entities);
|
|
54
|
-
const errors = connector.schemaErrors;
|
|
55
|
-
let error = null;
|
|
56
|
-
if (errors && Object.keys(errors).length > 0) {
|
|
57
|
-
const noKey = getErrorTables(errors, constants_1.BuildSchemaErrors.NO_KEY);
|
|
58
|
-
const invalidCol = getErrorTables(errors, constants_1.BuildSchemaErrors.INVALID_COLUMN);
|
|
59
|
-
if (noKey.length) {
|
|
60
|
-
error = updateError(error, "No primary key constraint found for the following:", noKey);
|
|
61
|
-
}
|
|
62
|
-
if (invalidCol.length) {
|
|
63
|
-
const invalidCols = Object.values(constants_1.InvalidColumns).join(", ");
|
|
64
|
-
error = updateError(error, `Cannot use columns ${invalidCols} found in following:`, invalidCol);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return { tables: connector.tables, error };
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
24
|
function fetch(ctx) {
|
|
71
25
|
return __awaiter(this, void 0, void 0, function* () {
|
|
72
26
|
// Get internal tables
|
|
@@ -98,29 +52,6 @@ function fetch(ctx) {
|
|
|
98
52
|
});
|
|
99
53
|
}
|
|
100
54
|
exports.fetch = fetch;
|
|
101
|
-
function verify(ctx) {
|
|
102
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
103
|
-
const { datasource } = ctx.request.body;
|
|
104
|
-
let existingDatasource;
|
|
105
|
-
if (datasource._id) {
|
|
106
|
-
existingDatasource = yield sdk_1.default.datasources.get(datasource._id);
|
|
107
|
-
}
|
|
108
|
-
let enrichedDatasource = datasource;
|
|
109
|
-
if (existingDatasource) {
|
|
110
|
-
enrichedDatasource = sdk_1.default.datasources.mergeConfigs(datasource, existingDatasource);
|
|
111
|
-
}
|
|
112
|
-
const connector = yield getConnector(enrichedDatasource);
|
|
113
|
-
if (!connector.testConnection) {
|
|
114
|
-
ctx.throw(400, "Connection information verification not supported");
|
|
115
|
-
}
|
|
116
|
-
const response = yield connector.testConnection();
|
|
117
|
-
ctx.body = {
|
|
118
|
-
connected: response.connected,
|
|
119
|
-
error: response.error,
|
|
120
|
-
};
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
exports.verify = verify;
|
|
124
55
|
function buildSchemaFromDb(ctx) {
|
|
125
56
|
return __awaiter(this, void 0, void 0, function* () {
|
|
126
57
|
const db = backend_core_1.context.getAppDB();
|
|
@@ -335,3 +266,41 @@ function query(ctx) {
|
|
|
335
266
|
});
|
|
336
267
|
}
|
|
337
268
|
exports.query = query;
|
|
269
|
+
function getErrorTables(errors, errorType) {
|
|
270
|
+
return Object.entries(errors)
|
|
271
|
+
.filter(entry => entry[1] === errorType)
|
|
272
|
+
.map(([name]) => name);
|
|
273
|
+
}
|
|
274
|
+
function updateError(error, newError, tables) {
|
|
275
|
+
if (!error) {
|
|
276
|
+
error = "";
|
|
277
|
+
}
|
|
278
|
+
if (error.length > 0) {
|
|
279
|
+
error += "\n";
|
|
280
|
+
}
|
|
281
|
+
error += `${newError} ${tables.join(", ")}`;
|
|
282
|
+
return error;
|
|
283
|
+
}
|
|
284
|
+
function buildSchemaHelper(datasource) {
|
|
285
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
286
|
+
const Connector = yield (0, integrations_1.getIntegration)(datasource.source);
|
|
287
|
+
datasource = yield sdk_1.default.datasources.enrich(datasource);
|
|
288
|
+
// Connect to the DB and build the schema
|
|
289
|
+
const connector = new Connector(datasource.config);
|
|
290
|
+
yield connector.buildSchema(datasource._id, datasource.entities);
|
|
291
|
+
const errors = connector.schemaErrors;
|
|
292
|
+
let error = null;
|
|
293
|
+
if (errors && Object.keys(errors).length > 0) {
|
|
294
|
+
const noKey = getErrorTables(errors, constants_1.BuildSchemaErrors.NO_KEY);
|
|
295
|
+
const invalidCol = getErrorTables(errors, constants_1.BuildSchemaErrors.INVALID_COLUMN);
|
|
296
|
+
if (noKey.length) {
|
|
297
|
+
error = updateError(error, "No primary key constraint found for the following:", noKey);
|
|
298
|
+
}
|
|
299
|
+
if (invalidCol.length) {
|
|
300
|
+
const invalidCols = Object.values(constants_1.InvalidColumns).join(", ");
|
|
301
|
+
error = updateError(error, `Cannot use columns ${invalidCols} found in following:`, invalidCol);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
return { tables: connector.tables, error };
|
|
305
|
+
});
|
|
306
|
+
}
|
|
@@ -20,9 +20,9 @@ function fetch(ctx) {
|
|
|
20
20
|
exports.fetch = fetch;
|
|
21
21
|
function find(ctx) {
|
|
22
22
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
const
|
|
24
|
-
ctx.body = def;
|
|
23
|
+
const defs = yield (0, integrations_1.getDefinitions)();
|
|
25
24
|
ctx.status = 200;
|
|
25
|
+
ctx.body = defs[ctx.params.type];
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
exports.find = find;
|
|
@@ -34,7 +34,6 @@ const validators_1 = require("./utils/validators");
|
|
|
34
34
|
const router = new router_1.default();
|
|
35
35
|
router
|
|
36
36
|
.get("/api/datasources", (0, authorized_1.default)(backend_core_1.permissions.BUILDER), datasourceController.fetch)
|
|
37
|
-
.post("/api/datasources/verify", (0, authorized_1.default)(backend_core_1.permissions.BUILDER), datasourceController.verify)
|
|
38
37
|
.get("/api/datasources/:datasourceId", (0, authorized_1.default)(backend_core_1.permissions.PermissionType.TABLE, backend_core_1.permissions.PermissionLevel.READ), datasourceController.find)
|
|
39
38
|
.put("/api/datasources/:datasourceId", (0, authorized_1.default)(backend_core_1.permissions.PermissionType.TABLE, backend_core_1.permissions.PermissionLevel.READ), datasourceController.update)
|
|
40
39
|
.post("/api/datasources/query", (0, authorized_1.default)(backend_core_1.permissions.PermissionType.TABLE, backend_core_1.permissions.PermissionLevel.READ), (0, validators_1.datasourceQueryValidator)(), datasourceController.query)
|
|
@@ -33,10 +33,6 @@ exports.definition = {
|
|
|
33
33
|
type: types_1.AutomationIOType.STRING,
|
|
34
34
|
title: "Webhook URL",
|
|
35
35
|
},
|
|
36
|
-
body: {
|
|
37
|
-
type: types_1.AutomationIOType.JSON,
|
|
38
|
-
title: "Payload",
|
|
39
|
-
},
|
|
40
36
|
value1: {
|
|
41
37
|
type: types_1.AutomationIOType.STRING,
|
|
42
38
|
title: "Input Value 1",
|
|
@@ -82,19 +78,7 @@ exports.definition = {
|
|
|
82
78
|
function run({ inputs }) {
|
|
83
79
|
var _a;
|
|
84
80
|
return __awaiter(this, void 0, void 0, function* () {
|
|
85
|
-
|
|
86
|
-
const { url, value1, value2, value3, value4, value5, body } = inputs;
|
|
87
|
-
let payload = {};
|
|
88
|
-
try {
|
|
89
|
-
payload = (body === null || body === void 0 ? void 0 : body.value) ? JSON.parse(body === null || body === void 0 ? void 0 : body.value) : {};
|
|
90
|
-
}
|
|
91
|
-
catch (err) {
|
|
92
|
-
return {
|
|
93
|
-
httpStatus: 400,
|
|
94
|
-
response: "Invalid payload JSON",
|
|
95
|
-
success: false,
|
|
96
|
-
};
|
|
97
|
-
}
|
|
81
|
+
const { url, value1, value2, value3, value4, value5 } = inputs;
|
|
98
82
|
if (!((_a = url === null || url === void 0 ? void 0 : url.trim()) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
99
83
|
return {
|
|
100
84
|
httpStatus: 400,
|
|
@@ -106,11 +90,13 @@ function run({ inputs }) {
|
|
|
106
90
|
try {
|
|
107
91
|
response = yield (0, node_fetch_1.default)(url, {
|
|
108
92
|
method: "post",
|
|
109
|
-
body: JSON.stringify(
|
|
93
|
+
body: JSON.stringify({
|
|
94
|
+
value1,
|
|
110
95
|
value2,
|
|
111
96
|
value3,
|
|
112
97
|
value4,
|
|
113
|
-
value5
|
|
98
|
+
value5,
|
|
99
|
+
}),
|
|
114
100
|
headers: {
|
|
115
101
|
"Content-Type": "application/json",
|
|
116
102
|
},
|
|
@@ -32,10 +32,6 @@ exports.definition = {
|
|
|
32
32
|
type: types_1.AutomationIOType.STRING,
|
|
33
33
|
title: "Webhook URL",
|
|
34
34
|
},
|
|
35
|
-
body: {
|
|
36
|
-
type: types_1.AutomationIOType.JSON,
|
|
37
|
-
title: "Payload",
|
|
38
|
-
},
|
|
39
35
|
value1: {
|
|
40
36
|
type: types_1.AutomationIOType.STRING,
|
|
41
37
|
title: "Payload Value 1",
|
|
@@ -76,19 +72,7 @@ exports.definition = {
|
|
|
76
72
|
function run({ inputs }) {
|
|
77
73
|
var _a;
|
|
78
74
|
return __awaiter(this, void 0, void 0, function* () {
|
|
79
|
-
|
|
80
|
-
const { url, value1, value2, value3, value4, value5, body } = inputs;
|
|
81
|
-
let payload = {};
|
|
82
|
-
try {
|
|
83
|
-
payload = (body === null || body === void 0 ? void 0 : body.value) ? JSON.parse(body === null || body === void 0 ? void 0 : body.value) : {};
|
|
84
|
-
}
|
|
85
|
-
catch (err) {
|
|
86
|
-
return {
|
|
87
|
-
httpStatus: 400,
|
|
88
|
-
response: "Invalid payload JSON",
|
|
89
|
-
success: false,
|
|
90
|
-
};
|
|
91
|
-
}
|
|
75
|
+
const { url, value1, value2, value3, value4, value5 } = inputs;
|
|
92
76
|
if (!((_a = url === null || url === void 0 ? void 0 : url.trim()) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
93
77
|
return {
|
|
94
78
|
httpStatus: 400,
|
|
@@ -102,11 +86,14 @@ function run({ inputs }) {
|
|
|
102
86
|
try {
|
|
103
87
|
response = yield (0, node_fetch_1.default)(url, {
|
|
104
88
|
method: "post",
|
|
105
|
-
body: JSON.stringify(
|
|
89
|
+
body: JSON.stringify({
|
|
90
|
+
platform: "budibase",
|
|
91
|
+
value1,
|
|
106
92
|
value2,
|
|
107
93
|
value3,
|
|
108
94
|
value4,
|
|
109
|
-
value5
|
|
95
|
+
value5,
|
|
96
|
+
}),
|
|
110
97
|
headers: {
|
|
111
98
|
"Content-Type": "application/json",
|
|
112
99
|
},
|
package/dist/db/dynamoClient.js
CHANGED
|
@@ -117,7 +117,7 @@ function init(endpoint) {
|
|
|
117
117
|
docClient = new AWS.DynamoDB.DocumentClient(docClientParams);
|
|
118
118
|
}
|
|
119
119
|
exports.init = init;
|
|
120
|
-
if (!environment_1.default.isProd()
|
|
120
|
+
if (!environment_1.default.isProd()) {
|
|
121
121
|
environment_1.default._set("AWS_ACCESS_KEY_ID", "KEY_ID");
|
|
122
122
|
environment_1.default._set("AWS_SECRET_ACCESS_KEY", "SECRET_KEY");
|
|
123
123
|
init("http://localhost:8333");
|
|
@@ -8,18 +8,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
12
|
const types_1 = require("@budibase/types");
|
|
16
|
-
const
|
|
13
|
+
const Airtable = require("airtable");
|
|
17
14
|
const SCHEMA = {
|
|
18
15
|
docs: "https://airtable.com/api",
|
|
19
16
|
description: "Airtable is a spreadsheet-database hybrid, with the features of a database but applied to a spreadsheet.",
|
|
20
17
|
friendlyName: "Airtable",
|
|
21
18
|
type: "Spreadsheet",
|
|
22
|
-
features: [types_1.DatasourceFeature.CONNECTION_CHECKING],
|
|
23
19
|
datasource: {
|
|
24
20
|
apiKey: {
|
|
25
21
|
type: types_1.DatasourceFieldType.PASSWORD,
|
|
@@ -83,29 +79,7 @@ const SCHEMA = {
|
|
|
83
79
|
class AirtableIntegration {
|
|
84
80
|
constructor(config) {
|
|
85
81
|
this.config = config;
|
|
86
|
-
this.client = new
|
|
87
|
-
}
|
|
88
|
-
testConnection() {
|
|
89
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
90
|
-
const mockTable = Date.now().toString();
|
|
91
|
-
try {
|
|
92
|
-
yield this.client.makeRequest({
|
|
93
|
-
path: `/${mockTable}`,
|
|
94
|
-
});
|
|
95
|
-
return { connected: true };
|
|
96
|
-
}
|
|
97
|
-
catch (e) {
|
|
98
|
-
if (e.message ===
|
|
99
|
-
`Could not find table ${mockTable} in application ${this.config.base}`) {
|
|
100
|
-
// The request managed to check the application, so the credentials are valid
|
|
101
|
-
return { connected: true };
|
|
102
|
-
}
|
|
103
|
-
return {
|
|
104
|
-
connected: false,
|
|
105
|
-
error: e.message,
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
});
|
|
82
|
+
this.client = new Airtable(config).base(config.base);
|
|
109
83
|
}
|
|
110
84
|
create(query) {
|
|
111
85
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -10,13 +10,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
const types_1 = require("@budibase/types");
|
|
13
|
-
const
|
|
13
|
+
const { Database, aql } = require("arangojs");
|
|
14
14
|
const SCHEMA = {
|
|
15
15
|
docs: "https://github.com/arangodb/arangojs",
|
|
16
16
|
friendlyName: "ArangoDB",
|
|
17
17
|
type: "Non-relational",
|
|
18
18
|
description: "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. ",
|
|
19
|
-
features: [types_1.DatasourceFeature.CONNECTION_CHECKING],
|
|
20
19
|
datasource: {
|
|
21
20
|
url: {
|
|
22
21
|
type: types_1.DatasourceFieldType.STRING,
|
|
@@ -62,22 +61,7 @@ class ArangoDBIntegration {
|
|
|
62
61
|
},
|
|
63
62
|
};
|
|
64
63
|
this.config = config;
|
|
65
|
-
this.client = new
|
|
66
|
-
}
|
|
67
|
-
testConnection() {
|
|
68
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
-
const response = {
|
|
70
|
-
connected: false,
|
|
71
|
-
};
|
|
72
|
-
try {
|
|
73
|
-
yield this.client.get();
|
|
74
|
-
response.connected = true;
|
|
75
|
-
}
|
|
76
|
-
catch (e) {
|
|
77
|
-
response.error = e.message;
|
|
78
|
-
}
|
|
79
|
-
return response;
|
|
80
|
-
});
|
|
64
|
+
this.client = new Database(newConfig);
|
|
81
65
|
}
|
|
82
66
|
read(query) {
|
|
83
67
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -99,7 +83,7 @@ class ArangoDBIntegration {
|
|
|
99
83
|
return __awaiter(this, void 0, void 0, function* () {
|
|
100
84
|
const clc = this.client.collection(this.config.collection);
|
|
101
85
|
try {
|
|
102
|
-
const result = yield this.client.query(
|
|
86
|
+
const result = yield this.client.query(aql `INSERT ${query.json} INTO ${clc} RETURN NEW`);
|
|
103
87
|
return result.all();
|
|
104
88
|
}
|
|
105
89
|
catch (err) {
|
|
@@ -16,7 +16,6 @@ const SCHEMA = {
|
|
|
16
16
|
friendlyName: "CouchDB",
|
|
17
17
|
type: "Non-relational",
|
|
18
18
|
description: "Apache CouchDB is an open-source document-oriented NoSQL database, implemented in Erlang.",
|
|
19
|
-
features: [types_1.DatasourceFeature.CONNECTION_CHECKING],
|
|
20
19
|
datasource: {
|
|
21
20
|
url: {
|
|
22
21
|
type: types_1.DatasourceFieldType.STRING,
|
|
@@ -60,23 +59,9 @@ const SCHEMA = {
|
|
|
60
59
|
};
|
|
61
60
|
class CouchDBIntegration {
|
|
62
61
|
constructor(config) {
|
|
62
|
+
this.config = config;
|
|
63
63
|
this.client = backend_core_1.db.DatabaseWithConnection(config.database, config.url);
|
|
64
64
|
}
|
|
65
|
-
testConnection() {
|
|
66
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
67
|
-
const response = {
|
|
68
|
-
connected: false,
|
|
69
|
-
};
|
|
70
|
-
try {
|
|
71
|
-
const result = yield this.query("exists", "validation error", {});
|
|
72
|
-
response.connected = result === true;
|
|
73
|
-
}
|
|
74
|
-
catch (e) {
|
|
75
|
-
response.error = e.message;
|
|
76
|
-
}
|
|
77
|
-
return response;
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
65
|
query(command, errorMsg, query) {
|
|
81
66
|
return __awaiter(this, void 0, void 0, function* () {
|
|
82
67
|
try {
|
|
@@ -20,7 +20,6 @@ const SCHEMA = {
|
|
|
20
20
|
description: "Amazon DynamoDB is a key-value and document database that delivers single-digit millisecond performance at any scale.",
|
|
21
21
|
friendlyName: "DynamoDB",
|
|
22
22
|
type: "Non-relational",
|
|
23
|
-
features: [types_1.DatasourceFeature.CONNECTION_CHECKING],
|
|
24
23
|
datasource: {
|
|
25
24
|
region: {
|
|
26
25
|
type: types_1.DatasourceFieldType.STRING,
|
|
@@ -136,21 +135,6 @@ class DynamoDBIntegration {
|
|
|
136
135
|
this.config = Object.assign(Object.assign({}, this.config), { currentClockSkew: true, region: config.region || dynamoClient_1.AWS_REGION, endpoint: config.endpoint || undefined });
|
|
137
136
|
this.client = new aws_sdk_1.default.DynamoDB.DocumentClient(this.config);
|
|
138
137
|
}
|
|
139
|
-
testConnection() {
|
|
140
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
141
|
-
const response = {
|
|
142
|
-
connected: false,
|
|
143
|
-
};
|
|
144
|
-
try {
|
|
145
|
-
const scanRes = yield new aws_sdk_1.default.DynamoDB(this.config).listTables().promise();
|
|
146
|
-
response.connected = !!scanRes.$response;
|
|
147
|
-
}
|
|
148
|
-
catch (e) {
|
|
149
|
-
response.error = e.message;
|
|
150
|
-
}
|
|
151
|
-
return response;
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
138
|
create(query) {
|
|
155
139
|
return __awaiter(this, void 0, void 0, function* () {
|
|
156
140
|
const params = Object.assign({ TableName: query.table }, query.json);
|
|
@@ -16,7 +16,6 @@ const SCHEMA = {
|
|
|
16
16
|
description: "Elasticsearch is a search engine based on the Lucene library. It provides a distributed, multitenant-capable full-text search engine with an HTTP web interface and schema-free JSON documents.",
|
|
17
17
|
friendlyName: "ElasticSearch",
|
|
18
18
|
type: "Non-relational",
|
|
19
|
-
features: [types_1.DatasourceFeature.CONNECTION_CHECKING],
|
|
20
19
|
datasource: {
|
|
21
20
|
url: {
|
|
22
21
|
type: types_1.DatasourceFieldType.STRING,
|
|
@@ -103,20 +102,6 @@ class ElasticSearchIntegration {
|
|
|
103
102
|
}
|
|
104
103
|
this.client = new elasticsearch_1.Client(clientConfig);
|
|
105
104
|
}
|
|
106
|
-
testConnection() {
|
|
107
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
108
|
-
try {
|
|
109
|
-
yield this.client.info();
|
|
110
|
-
return { connected: true };
|
|
111
|
-
}
|
|
112
|
-
catch (e) {
|
|
113
|
-
return {
|
|
114
|
-
connected: false,
|
|
115
|
-
error: e.message,
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
105
|
create(query) {
|
|
121
106
|
return __awaiter(this, void 0, void 0, function* () {
|
|
122
107
|
const { index, json } = query;
|
|
@@ -16,7 +16,6 @@ const SCHEMA = {
|
|
|
16
16
|
friendlyName: "Firestore",
|
|
17
17
|
type: "Non-relational",
|
|
18
18
|
description: "Cloud Firestore is a flexible, scalable database for mobile, web, and server development from Firebase and Google Cloud.",
|
|
19
|
-
features: [types_1.DatasourceFeature.CONNECTION_CHECKING],
|
|
20
19
|
datasource: {
|
|
21
20
|
email: {
|
|
22
21
|
type: types_1.DatasourceFieldType.STRING,
|
|
@@ -94,20 +93,6 @@ class FirebaseIntegration {
|
|
|
94
93
|
},
|
|
95
94
|
});
|
|
96
95
|
}
|
|
97
|
-
testConnection() {
|
|
98
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
99
|
-
try {
|
|
100
|
-
yield this.client.listCollections();
|
|
101
|
-
return { connected: true };
|
|
102
|
-
}
|
|
103
|
-
catch (e) {
|
|
104
|
-
return {
|
|
105
|
-
connected: false,
|
|
106
|
-
error: e.message,
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
96
|
create(query) {
|
|
112
97
|
return __awaiter(this, void 0, void 0, function* () {
|
|
113
98
|
try {
|
|
@@ -40,7 +40,6 @@ const SCHEMA = {
|
|
|
40
40
|
description: "Create and collaborate on online spreadsheets in real-time and from any device. ",
|
|
41
41
|
friendlyName: "Google Sheets",
|
|
42
42
|
type: "Spreadsheet",
|
|
43
|
-
features: [types_1.DatasourceFeature.CONNECTION_CHECKING],
|
|
44
43
|
datasource: {
|
|
45
44
|
spreadsheetId: {
|
|
46
45
|
display: "Google Sheet URL",
|
|
@@ -111,21 +110,6 @@ class GoogleSheetsIntegration {
|
|
|
111
110
|
const spreadsheetId = this.cleanSpreadsheetUrl(this.config.spreadsheetId);
|
|
112
111
|
this.client = new google_spreadsheet_1.GoogleSpreadsheet(spreadsheetId);
|
|
113
112
|
}
|
|
114
|
-
testConnection() {
|
|
115
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
116
|
-
try {
|
|
117
|
-
yield this.connect();
|
|
118
|
-
yield this.client.loadInfo();
|
|
119
|
-
return { connected: true };
|
|
120
|
-
}
|
|
121
|
-
catch (e) {
|
|
122
|
-
return {
|
|
123
|
-
connected: false,
|
|
124
|
-
error: e.message,
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
113
|
getBindingIdentifier() {
|
|
130
114
|
return "";
|
|
131
115
|
}
|
|
@@ -398,20 +382,7 @@ class GoogleSheetsIntegration {
|
|
|
398
382
|
try {
|
|
399
383
|
yield this.connect();
|
|
400
384
|
const sheet = this.client.sheetsByTitle[query.sheet];
|
|
401
|
-
|
|
402
|
-
if (query.paginate) {
|
|
403
|
-
const limit = query.paginate.limit || 100;
|
|
404
|
-
let page = typeof query.paginate.page === "number"
|
|
405
|
-
? query.paginate.page
|
|
406
|
-
: parseInt(query.paginate.page || "1");
|
|
407
|
-
rows = yield sheet.getRows({
|
|
408
|
-
limit,
|
|
409
|
-
offset: (page - 1) * limit,
|
|
410
|
-
});
|
|
411
|
-
}
|
|
412
|
-
else {
|
|
413
|
-
rows = yield sheet.getRows();
|
|
414
|
-
}
|
|
385
|
+
const rows = yield sheet.getRows();
|
|
415
386
|
const filtered = shared_core_1.dataFilters.runLuceneQuery(rows, query.filters);
|
|
416
387
|
const headerValues = sheet.headerValues;
|
|
417
388
|
let response = [];
|
|
@@ -50,7 +50,6 @@ const DEFINITIONS = {
|
|
|
50
50
|
[types_1.SourceName.GOOGLE_SHEETS]: googlesheets_1.default.schema,
|
|
51
51
|
[types_1.SourceName.REDIS]: redis_1.default.schema,
|
|
52
52
|
[types_1.SourceName.SNOWFLAKE]: snowflake_1.default.schema,
|
|
53
|
-
[types_1.SourceName.ORACLE]: undefined,
|
|
54
53
|
};
|
|
55
54
|
const INTEGRATIONS = {
|
|
56
55
|
[types_1.SourceName.POSTGRES]: postgres_1.default.integration,
|
|
@@ -69,7 +68,6 @@ const INTEGRATIONS = {
|
|
|
69
68
|
[types_1.SourceName.REDIS]: redis_1.default.integration,
|
|
70
69
|
[types_1.SourceName.FIRESTORE]: firebase_1.default.integration,
|
|
71
70
|
[types_1.SourceName.SNOWFLAKE]: snowflake_1.default.integration,
|
|
72
|
-
[types_1.SourceName.ORACLE]: undefined,
|
|
73
71
|
};
|
|
74
72
|
// optionally add oracle integration if the oracle binary can be installed
|
|
75
73
|
if (process.arch &&
|
|
@@ -81,9 +79,8 @@ if (process.arch &&
|
|
|
81
79
|
function getDefinition(source) {
|
|
82
80
|
return __awaiter(this, void 0, void 0, function* () {
|
|
83
81
|
// check if its integrated, faster
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
return definition;
|
|
82
|
+
if (DEFINITIONS[source]) {
|
|
83
|
+
return DEFINITIONS[source];
|
|
87
84
|
}
|
|
88
85
|
const allDefinitions = yield getDefinitions();
|
|
89
86
|
return allDefinitions[source];
|
|
@@ -23,7 +23,6 @@ const SCHEMA = {
|
|
|
23
23
|
description: "Microsoft SQL Server is a relational database management system developed by Microsoft. ",
|
|
24
24
|
friendlyName: "MS SQL Server",
|
|
25
25
|
type: "Relational",
|
|
26
|
-
features: [types_1.DatasourceFeature.CONNECTION_CHECKING],
|
|
27
26
|
datasource: {
|
|
28
27
|
user: {
|
|
29
28
|
type: types_1.DatasourceFieldType.STRING,
|
|
@@ -95,21 +94,6 @@ class SqlServerIntegration extends sql_1.default {
|
|
|
95
94
|
this.pool = new sqlServer.ConnectionPool(clientCfg);
|
|
96
95
|
}
|
|
97
96
|
}
|
|
98
|
-
testConnection() {
|
|
99
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
100
|
-
const response = {
|
|
101
|
-
connected: false,
|
|
102
|
-
};
|
|
103
|
-
try {
|
|
104
|
-
yield this.connect();
|
|
105
|
-
response.connected = true;
|
|
106
|
-
}
|
|
107
|
-
catch (e) {
|
|
108
|
-
response.error = e.message;
|
|
109
|
-
}
|
|
110
|
-
return response;
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
97
|
getBindingIdentifier() {
|
|
114
98
|
return `@p${this.index++}`;
|
|
115
99
|
}
|
|
@@ -28,7 +28,6 @@ const getSchema = () => {
|
|
|
28
28
|
friendlyName: "MongoDB",
|
|
29
29
|
type: "Non-relational",
|
|
30
30
|
description: "MongoDB is a general purpose, document-based, distributed database built for modern application developers and for the cloud era.",
|
|
31
|
-
features: [types_1.DatasourceFeature.CONNECTION_CHECKING],
|
|
32
31
|
datasource: {
|
|
33
32
|
connectionString: {
|
|
34
33
|
type: types_1.DatasourceFieldType.STRING,
|
|
@@ -341,21 +340,6 @@ class MongoIntegration {
|
|
|
341
340
|
};
|
|
342
341
|
this.client = new mongodb_1.MongoClient(config.connectionString, options);
|
|
343
342
|
}
|
|
344
|
-
testConnection() {
|
|
345
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
346
|
-
const response = {
|
|
347
|
-
connected: false,
|
|
348
|
-
};
|
|
349
|
-
try {
|
|
350
|
-
yield this.connect();
|
|
351
|
-
response.connected = true;
|
|
352
|
-
}
|
|
353
|
-
catch (e) {
|
|
354
|
-
response.error = e.message;
|
|
355
|
-
}
|
|
356
|
-
return response;
|
|
357
|
-
});
|
|
358
|
-
}
|
|
359
343
|
connect() {
|
|
360
344
|
return __awaiter(this, void 0, void 0, function* () {
|
|
361
345
|
return this.client.connect();
|