@budibase/server 2.6.16-alpha.3 → 2.6.16-alpha.5
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.40a27943.js → index.b9eeb2a8.js} +216 -216
- package/builder/index.html +1 -1
- package/dist/api/controllers/datasource.js +70 -39
- package/dist/api/controllers/integration.js +2 -2
- package/dist/api/routes/datasource.js +1 -0
- package/dist/db/dynamoClient.js +1 -1
- package/dist/integrations/airtable.js +28 -2
- package/dist/integrations/arangodb.js +19 -3
- package/dist/integrations/couchdb.js +16 -1
- package/dist/integrations/dynamodb.js +16 -0
- package/dist/integrations/elasticsearch.js +15 -0
- package/dist/integrations/firebase.js +15 -0
- package/dist/integrations/googlesheets.js +16 -0
- package/dist/integrations/index.js +5 -2
- package/dist/integrations/microsoftSqlServer.js +16 -0
- package/dist/integrations/mongodb.js +16 -0
- package/dist/integrations/mysql.js +21 -5
- package/dist/integrations/oracle.js +29 -0
- package/dist/integrations/postgres.js +26 -7
- package/dist/integrations/redis.js +20 -1
- package/dist/integrations/s3.js +23 -4
- package/dist/integrations/snowflake.js +15 -0
- package/dist/migrations/functions/backfill/app/queries.js +1 -2
- package/dist/sdk/app/datasources/datasources.js +10 -3
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +10 -9
- package/src/api/controllers/datasource.ts +88 -49
- package/src/api/controllers/integration.ts +3 -3
- package/src/api/routes/datasource.ts +5 -0
- package/src/db/dynamoClient.ts +1 -1
- package/src/integration-test/postgres.spec.ts +0 -1
- package/src/integrations/airtable.ts +31 -4
- package/src/integrations/arangodb.ts +18 -2
- package/src/integrations/couchdb.ts +18 -4
- package/src/integrations/dynamodb.ts +34 -5
- package/src/integrations/elasticsearch.ts +16 -1
- package/src/integrations/firebase.ts +15 -0
- package/src/integrations/googlesheets.ts +16 -0
- package/src/integrations/index.ts +12 -7
- package/src/integrations/microsoftSqlServer.ts +16 -0
- package/src/integrations/mongodb.ts +16 -0
- package/src/integrations/mysql.ts +27 -16
- package/src/integrations/oracle.ts +28 -6
- package/src/integrations/postgres.ts +21 -3
- package/src/integrations/redis.ts +26 -3
- package/src/integrations/s3.ts +19 -3
- package/src/integrations/snowflake.ts +20 -1
- package/src/migrations/functions/backfill/app/queries.ts +1 -1
- package/src/sdk/app/datasources/datasources.ts +7 -1
|
@@ -16,14 +16,14 @@ const types_1 = require("@budibase/types");
|
|
|
16
16
|
const utils_1 = require("./utils");
|
|
17
17
|
const sql_1 = __importDefault(require("./base/sql"));
|
|
18
18
|
const utilities_1 = require("../utilities");
|
|
19
|
-
const
|
|
19
|
+
const pg_1 = require("pg");
|
|
20
20
|
// Return "date" and "timestamp" types as plain strings.
|
|
21
21
|
// This lets us reference the original stored timezone.
|
|
22
22
|
// types is undefined when running in a test env for some reason.
|
|
23
|
-
if (types) {
|
|
24
|
-
types.setTypeParser(1114, (val) => val); // timestamp
|
|
25
|
-
types.setTypeParser(1082, (val) => val); // date
|
|
26
|
-
types.setTypeParser(1184, (val) => val); // timestampz
|
|
23
|
+
if (pg_1.types) {
|
|
24
|
+
pg_1.types.setTypeParser(1114, (val) => val); // timestamp
|
|
25
|
+
pg_1.types.setTypeParser(1082, (val) => val); // date
|
|
26
|
+
pg_1.types.setTypeParser(1184, (val) => val); // timestampz
|
|
27
27
|
}
|
|
28
28
|
const JSON_REGEX = /'{.*}'::json/s;
|
|
29
29
|
const SCHEMA = {
|
|
@@ -32,6 +32,7 @@ const SCHEMA = {
|
|
|
32
32
|
friendlyName: "PostgreSQL",
|
|
33
33
|
type: "Relational",
|
|
34
34
|
description: "PostgreSQL, also known as Postgres, is a free and open-source relational database management system emphasizing extensibility and SQL compliance.",
|
|
35
|
+
features: [types_1.DatasourceFeature.CONNECTION_CHECKING],
|
|
35
36
|
datasource: {
|
|
36
37
|
host: {
|
|
37
38
|
type: types_1.DatasourceFieldType.STRING,
|
|
@@ -116,9 +117,27 @@ class PostgresIntegration extends sql_1.default {
|
|
|
116
117
|
ca: this.config.ca,
|
|
117
118
|
}
|
|
118
119
|
: undefined });
|
|
119
|
-
this.client = new Client(newConfig);
|
|
120
|
+
this.client = new pg_1.Client(newConfig);
|
|
120
121
|
this.open = false;
|
|
121
122
|
}
|
|
123
|
+
testConnection() {
|
|
124
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
125
|
+
const response = {
|
|
126
|
+
connected: false,
|
|
127
|
+
};
|
|
128
|
+
try {
|
|
129
|
+
yield this.openConnection();
|
|
130
|
+
response.connected = true;
|
|
131
|
+
}
|
|
132
|
+
catch (e) {
|
|
133
|
+
response.error = e.message;
|
|
134
|
+
}
|
|
135
|
+
finally {
|
|
136
|
+
yield this.closeConnection();
|
|
137
|
+
}
|
|
138
|
+
return response;
|
|
139
|
+
});
|
|
140
|
+
}
|
|
122
141
|
getBindingIdentifier() {
|
|
123
142
|
return `$${this.index++}`;
|
|
124
143
|
}
|
|
@@ -131,7 +150,7 @@ class PostgresIntegration extends sql_1.default {
|
|
|
131
150
|
if (!this.config.schema) {
|
|
132
151
|
this.config.schema = "public";
|
|
133
152
|
}
|
|
134
|
-
this.client.query(`SET search_path TO ${this.config.schema}`);
|
|
153
|
+
yield this.client.query(`SET search_path TO ${this.config.schema}`);
|
|
135
154
|
this.COLUMNS_SQL = `select * from information_schema.columns where table_schema = '${this.config.schema}'`;
|
|
136
155
|
this.open = true;
|
|
137
156
|
});
|
|
@@ -16,9 +16,10 @@ const types_1 = require("@budibase/types");
|
|
|
16
16
|
const ioredis_1 = __importDefault(require("ioredis"));
|
|
17
17
|
const SCHEMA = {
|
|
18
18
|
docs: "https://redis.io/docs/",
|
|
19
|
-
description: "",
|
|
19
|
+
description: "Redis is a caching tool, providing powerful key-value store capabilities.",
|
|
20
20
|
friendlyName: "Redis",
|
|
21
21
|
type: "Non-relational",
|
|
22
|
+
features: [types_1.DatasourceFeature.CONNECTION_CHECKING],
|
|
22
23
|
datasource: {
|
|
23
24
|
host: {
|
|
24
25
|
type: "string",
|
|
@@ -99,6 +100,24 @@ class RedisIntegration {
|
|
|
99
100
|
db: this.config.db,
|
|
100
101
|
});
|
|
101
102
|
}
|
|
103
|
+
testConnection() {
|
|
104
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
105
|
+
const response = {
|
|
106
|
+
connected: false,
|
|
107
|
+
};
|
|
108
|
+
try {
|
|
109
|
+
yield this.client.ping();
|
|
110
|
+
response.connected = true;
|
|
111
|
+
}
|
|
112
|
+
catch (e) {
|
|
113
|
+
response.error = e.message;
|
|
114
|
+
}
|
|
115
|
+
finally {
|
|
116
|
+
yield this.disconnect();
|
|
117
|
+
}
|
|
118
|
+
return response;
|
|
119
|
+
});
|
|
120
|
+
}
|
|
102
121
|
disconnect() {
|
|
103
122
|
return __awaiter(this, void 0, void 0, function* () {
|
|
104
123
|
return this.client.quit();
|
package/dist/integrations/s3.js
CHANGED
|
@@ -8,15 +8,19 @@ 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
|
+
};
|
|
11
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
15
|
const types_1 = require("@budibase/types");
|
|
13
|
-
const
|
|
14
|
-
const
|
|
16
|
+
const aws_sdk_1 = __importDefault(require("aws-sdk"));
|
|
17
|
+
const csvtojson_1 = __importDefault(require("csvtojson"));
|
|
15
18
|
const SCHEMA = {
|
|
16
19
|
docs: "https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html",
|
|
17
20
|
description: "Amazon Simple Storage Service (Amazon S3) is an object storage service that offers industry-leading scalability, data availability, security, and performance.",
|
|
18
21
|
friendlyName: "Amazon S3",
|
|
19
22
|
type: "Object store",
|
|
23
|
+
features: [types_1.DatasourceFeature.CONNECTION_CHECKING],
|
|
20
24
|
datasource: {
|
|
21
25
|
region: {
|
|
22
26
|
type: "string",
|
|
@@ -153,7 +157,22 @@ class S3Integration {
|
|
|
153
157
|
else {
|
|
154
158
|
delete this.config.endpoint;
|
|
155
159
|
}
|
|
156
|
-
this.client = new
|
|
160
|
+
this.client = new aws_sdk_1.default.S3(this.config);
|
|
161
|
+
}
|
|
162
|
+
testConnection() {
|
|
163
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
164
|
+
const response = {
|
|
165
|
+
connected: false,
|
|
166
|
+
};
|
|
167
|
+
try {
|
|
168
|
+
yield this.client.listBuckets().promise();
|
|
169
|
+
response.connected = true;
|
|
170
|
+
}
|
|
171
|
+
catch (e) {
|
|
172
|
+
response.error = e.message;
|
|
173
|
+
}
|
|
174
|
+
return response;
|
|
175
|
+
});
|
|
157
176
|
}
|
|
158
177
|
create(query) {
|
|
159
178
|
var _a;
|
|
@@ -202,7 +221,7 @@ class S3Integration {
|
|
|
202
221
|
stream.on("error", (err) => {
|
|
203
222
|
reject(err);
|
|
204
223
|
});
|
|
205
|
-
const response =
|
|
224
|
+
const response = (0, csvtojson_1.default)()
|
|
206
225
|
.fromStream(stream)
|
|
207
226
|
.on("error", () => {
|
|
208
227
|
csvError = true;
|
|
@@ -16,6 +16,7 @@ const SCHEMA = {
|
|
|
16
16
|
description: "Snowflake is a solution for data warehousing, data lakes, data engineering, data science, data application development, and securely sharing and consuming shared data.",
|
|
17
17
|
friendlyName: "Snowflake",
|
|
18
18
|
type: "Relational",
|
|
19
|
+
features: [types_1.DatasourceFeature.CONNECTION_CHECKING],
|
|
19
20
|
datasource: {
|
|
20
21
|
account: {
|
|
21
22
|
type: "string",
|
|
@@ -61,6 +62,20 @@ class SnowflakeIntegration {
|
|
|
61
62
|
constructor(config) {
|
|
62
63
|
this.client = new snowflake_promise_1.Snowflake(config);
|
|
63
64
|
}
|
|
65
|
+
testConnection() {
|
|
66
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
67
|
+
try {
|
|
68
|
+
yield this.client.connect();
|
|
69
|
+
return { connected: true };
|
|
70
|
+
}
|
|
71
|
+
catch (e) {
|
|
72
|
+
return {
|
|
73
|
+
connected: false,
|
|
74
|
+
error: e.message,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
64
79
|
internalQuery(query) {
|
|
65
80
|
return __awaiter(this, void 0, void 0, function* () {
|
|
66
81
|
yield this.client.connect();
|
|
@@ -12,7 +12,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.backfill = void 0;
|
|
13
13
|
const backend_core_1 = require("@budibase/backend-core");
|
|
14
14
|
const utils_1 = require("../../../../db/utils");
|
|
15
|
-
const types_1 = require("@budibase/types");
|
|
16
15
|
const getQueries = (appDb) => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
16
|
const response = yield appDb.allDocs((0, utils_1.getQueryParams)(null, {
|
|
18
17
|
include_docs: true,
|
|
@@ -36,7 +35,7 @@ const backfill = (appDb, timestamp) => __awaiter(void 0, void 0, void 0, functio
|
|
|
36
35
|
datasource = {
|
|
37
36
|
type: "unknown",
|
|
38
37
|
_id: query.datasourceId,
|
|
39
|
-
source:
|
|
38
|
+
source: "unknown",
|
|
40
39
|
};
|
|
41
40
|
}
|
|
42
41
|
else {
|
|
@@ -8,6 +8,9 @@ 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
|
+
};
|
|
11
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
15
|
exports.mergeConfigs = exports.removeSecretSingle = exports.removeSecrets = exports.getWithEnvVars = exports.get = exports.enrich = exports.checkDatasourceTypes = void 0;
|
|
13
16
|
const backend_core_1 = require("@budibase/backend-core");
|
|
@@ -16,6 +19,7 @@ const types_1 = require("@budibase/types");
|
|
|
16
19
|
const fp_1 = require("lodash/fp");
|
|
17
20
|
const utils_1 = require("../../utils");
|
|
18
21
|
const integrations_1 = require("../../../integrations");
|
|
22
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
19
23
|
const ENV_VAR_PREFIX = "env.";
|
|
20
24
|
function checkDatasourceTypes(schema, config) {
|
|
21
25
|
for (let key of Object.keys(config)) {
|
|
@@ -130,7 +134,7 @@ function removeSecretSingle(datasource) {
|
|
|
130
134
|
}
|
|
131
135
|
exports.removeSecretSingle = removeSecretSingle;
|
|
132
136
|
function mergeConfigs(update, old) {
|
|
133
|
-
var _a, _b, _c, _d;
|
|
137
|
+
var _a, _b, _c, _d, _e;
|
|
134
138
|
if (!update.config) {
|
|
135
139
|
return update;
|
|
136
140
|
}
|
|
@@ -149,13 +153,16 @@ function mergeConfigs(update, old) {
|
|
|
149
153
|
}
|
|
150
154
|
}
|
|
151
155
|
}
|
|
156
|
+
if ((_c = old.config) === null || _c === void 0 ? void 0 : _c.auth) {
|
|
157
|
+
update.config = lodash_1.default.merge(old.config, update.config);
|
|
158
|
+
}
|
|
152
159
|
// update back to actual passwords for everything else
|
|
153
160
|
for (let [key, value] of Object.entries(update.config)) {
|
|
154
161
|
if (value !== types_1.PASSWORD_REPLACEMENT) {
|
|
155
162
|
continue;
|
|
156
163
|
}
|
|
157
|
-
if ((
|
|
158
|
-
update.config[key] = (
|
|
164
|
+
if ((_d = old.config) === null || _d === void 0 ? void 0 : _d[key]) {
|
|
165
|
+
update.config[key] = (_e = old.config) === null || _e === void 0 ? void 0 : _e[key];
|
|
159
166
|
}
|
|
160
167
|
else {
|
|
161
168
|
delete update.config[key];
|