@budibase/server 2.6.19-alpha.0 → 2.6.19

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.
Files changed (60) hide show
  1. package/builder/assets/{index.07382a47.css → index.86c992bf.css} +2 -2
  2. package/builder/assets/{index.b9eeb2a8.js → index.b131b0de.js} +317 -309
  3. package/builder/index.html +2 -2
  4. package/dist/api/controllers/datasource.js +39 -70
  5. package/dist/api/controllers/integration.js +2 -2
  6. package/dist/api/routes/datasource.js +0 -1
  7. package/dist/automations/steps/make.js +5 -19
  8. package/dist/automations/steps/zapier.js +6 -19
  9. package/dist/db/dynamoClient.js +1 -1
  10. package/dist/integrations/airtable.js +2 -28
  11. package/dist/integrations/arangodb.js +3 -19
  12. package/dist/integrations/couchdb.js +1 -16
  13. package/dist/integrations/dynamodb.js +0 -16
  14. package/dist/integrations/elasticsearch.js +0 -15
  15. package/dist/integrations/firebase.js +0 -15
  16. package/dist/integrations/googlesheets.js +1 -30
  17. package/dist/integrations/index.js +2 -5
  18. package/dist/integrations/microsoftSqlServer.js +0 -16
  19. package/dist/integrations/mongodb.js +0 -16
  20. package/dist/integrations/mysql.js +5 -21
  21. package/dist/integrations/oracle.js +0 -29
  22. package/dist/integrations/postgres.js +7 -26
  23. package/dist/integrations/redis.js +1 -20
  24. package/dist/integrations/s3.js +4 -23
  25. package/dist/integrations/snowflake.js +0 -15
  26. package/dist/migrations/functions/backfill/app/queries.js +2 -1
  27. package/dist/sdk/app/datasources/datasources.js +3 -10
  28. package/dist/tsconfig.build.tsbuildinfo +1 -1
  29. package/jest.config.ts +3 -3
  30. package/nodemon.json +3 -7
  31. package/package.json +9 -10
  32. package/src/api/controllers/datasource.ts +49 -88
  33. package/src/api/controllers/integration.ts +3 -3
  34. package/src/api/routes/datasource.ts +0 -5
  35. package/src/automations/steps/make.ts +1 -18
  36. package/src/automations/steps/zapier.ts +1 -18
  37. package/src/automations/tests/zapier.spec.js +27 -0
  38. package/src/db/dynamoClient.ts +1 -1
  39. package/src/integration-test/postgres.spec.ts +1 -0
  40. package/src/integrations/airtable.ts +4 -31
  41. package/src/integrations/arangodb.ts +2 -18
  42. package/src/integrations/couchdb.ts +4 -18
  43. package/src/integrations/dynamodb.ts +5 -34
  44. package/src/integrations/elasticsearch.ts +1 -16
  45. package/src/integrations/firebase.ts +0 -15
  46. package/src/integrations/googlesheets.ts +2 -31
  47. package/src/integrations/index.ts +7 -12
  48. package/src/integrations/microsoftSqlServer.ts +0 -16
  49. package/src/integrations/mongodb.ts +0 -16
  50. package/src/integrations/mysql.ts +16 -27
  51. package/src/integrations/oracle.ts +6 -28
  52. package/src/integrations/postgres.ts +3 -21
  53. package/src/integrations/redis.ts +3 -26
  54. package/src/integrations/s3.ts +3 -19
  55. package/src/integrations/snowflake.ts +1 -20
  56. package/src/migrations/functions/backfill/app/queries.ts +1 -1
  57. package/src/sdk/app/datasources/datasources.ts +1 -7
  58. package/tsconfig.json +1 -1
  59. package/src/automations/tests/make.spec.ts +0 -54
  60. package/src/automations/tests/zapier.spec.ts +0 -56
@@ -17,14 +17,13 @@ const utils_1 = require("./utils");
17
17
  const dayjs_1 = __importDefault(require("dayjs"));
18
18
  const utilities_1 = require("../utilities");
19
19
  const sql_1 = __importDefault(require("./base/sql"));
20
- const promise_1 = __importDefault(require("mysql2/promise"));
20
+ const mysql = require("mysql2/promise");
21
21
  const SCHEMA = {
22
22
  docs: "https://github.com/sidorares/node-mysql2",
23
23
  plus: true,
24
24
  friendlyName: "MySQL",
25
25
  type: "Relational",
26
26
  description: "MySQL Database Service is a fully managed database service to deploy cloud-native applications. ",
27
- features: [types_1.DatasourceFeature.CONNECTION_CHECKING],
28
27
  datasource: {
29
28
  host: {
30
29
  type: types_1.DatasourceFieldType.STRING,
@@ -75,6 +74,7 @@ const SCHEMA = {
75
74
  },
76
75
  },
77
76
  };
77
+ const TimezoneAwareDateTypes = ["timestamp"];
78
78
  function bindingTypeCoerce(bindings) {
79
79
  for (let i = 0; i < bindings.length; i++) {
80
80
  const binding = bindings[i];
@@ -108,8 +108,7 @@ class MySQLIntegration extends sql_1.default {
108
108
  // make sure this defaults to true
109
109
  if (config.rejectUnauthorized != null &&
110
110
  !config.rejectUnauthorized &&
111
- config.ssl &&
112
- typeof config.ssl !== "string") {
111
+ config.ssl) {
113
112
  config.ssl.rejectUnauthorized = config.rejectUnauthorized;
114
113
  }
115
114
  // @ts-ignore
@@ -128,21 +127,6 @@ class MySQLIntegration extends sql_1.default {
128
127
  return next();
129
128
  } });
130
129
  }
131
- testConnection() {
132
- return __awaiter(this, void 0, void 0, function* () {
133
- const response = {
134
- connected: false,
135
- };
136
- try {
137
- const [result] = yield this.internalQuery({ sql: "SELECT 1+1 AS checkRes" }, { connect: true });
138
- response.connected = (result === null || result === void 0 ? void 0 : result.checkRes) == 2;
139
- }
140
- catch (e) {
141
- response.error = e.message;
142
- }
143
- return response;
144
- });
145
- }
146
130
  getBindingIdentifier() {
147
131
  return "?";
148
132
  }
@@ -151,7 +135,7 @@ class MySQLIntegration extends sql_1.default {
151
135
  }
152
136
  connect() {
153
137
  return __awaiter(this, void 0, void 0, function* () {
154
- this.client = yield promise_1.default.createConnection(this.config);
138
+ this.client = yield mysql.createConnection(this.config);
155
139
  });
156
140
  }
157
141
  disconnect() {
@@ -177,7 +161,7 @@ class MySQLIntegration extends sql_1.default {
177
161
  return response[0];
178
162
  }
179
163
  finally {
180
- if ((opts === null || opts === void 0 ? void 0 : opts.connect) && this.client) {
164
+ if (opts === null || opts === void 0 ? void 0 : opts.connect) {
181
165
  yield this.disconnect();
182
166
  }
183
167
  }
@@ -30,7 +30,6 @@ const SCHEMA = {
30
30
  friendlyName: "Oracle",
31
31
  type: "Relational",
32
32
  description: "Oracle Database is an object-relational database management system developed by Oracle Corporation",
33
- features: [types_1.DatasourceFeature.CONNECTION_CHECKING],
34
33
  datasource: {
35
34
  host: {
36
35
  type: types_1.DatasourceFieldType.STRING,
@@ -272,34 +271,6 @@ class OracleIntegration extends sql_1.default {
272
271
  this.schemaErrors = final.errors;
273
272
  });
274
273
  }
275
- testConnection() {
276
- return __awaiter(this, void 0, void 0, function* () {
277
- const response = {
278
- connected: false,
279
- };
280
- let connection;
281
- try {
282
- connection = yield this.getConnection();
283
- response.connected = true;
284
- }
285
- catch (err) {
286
- response.connected = false;
287
- response.error = err.message;
288
- }
289
- finally {
290
- if (connection) {
291
- try {
292
- yield connection.close();
293
- }
294
- catch (err) {
295
- response.connected = false;
296
- response.error = err.message;
297
- }
298
- }
299
- }
300
- return response;
301
- });
302
- }
303
274
  internalQuery(query) {
304
275
  return __awaiter(this, void 0, void 0, function* () {
305
276
  let connection;
@@ -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 pg_1 = require("pg");
19
+ const { Client, types } = 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 (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
23
+ if (types) {
24
+ types.setTypeParser(1114, (val) => val); // timestamp
25
+ types.setTypeParser(1082, (val) => val); // date
26
+ types.setTypeParser(1184, (val) => val); // timestampz
27
27
  }
28
28
  const JSON_REGEX = /'{.*}'::json/s;
29
29
  const SCHEMA = {
@@ -32,7 +32,6 @@ 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],
36
35
  datasource: {
37
36
  host: {
38
37
  type: types_1.DatasourceFieldType.STRING,
@@ -117,27 +116,9 @@ class PostgresIntegration extends sql_1.default {
117
116
  ca: this.config.ca,
118
117
  }
119
118
  : undefined });
120
- this.client = new pg_1.Client(newConfig);
119
+ this.client = new Client(newConfig);
121
120
  this.open = false;
122
121
  }
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
- }
141
122
  getBindingIdentifier() {
142
123
  return `$${this.index++}`;
143
124
  }
@@ -150,7 +131,7 @@ class PostgresIntegration extends sql_1.default {
150
131
  if (!this.config.schema) {
151
132
  this.config.schema = "public";
152
133
  }
153
- yield this.client.query(`SET search_path TO ${this.config.schema}`);
134
+ this.client.query(`SET search_path TO ${this.config.schema}`);
154
135
  this.COLUMNS_SQL = `select * from information_schema.columns where table_schema = '${this.config.schema}'`;
155
136
  this.open = true;
156
137
  });
@@ -16,10 +16,9 @@ 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: "Redis is a caching tool, providing powerful key-value store capabilities.",
19
+ description: "",
20
20
  friendlyName: "Redis",
21
21
  type: "Non-relational",
22
- features: [types_1.DatasourceFeature.CONNECTION_CHECKING],
23
22
  datasource: {
24
23
  host: {
25
24
  type: "string",
@@ -100,24 +99,6 @@ class RedisIntegration {
100
99
  db: this.config.db,
101
100
  });
102
101
  }
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
- }
121
102
  disconnect() {
122
103
  return __awaiter(this, void 0, void 0, function* () {
123
104
  return this.client.quit();
@@ -8,19 +8,15 @@ 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 aws_sdk_1 = __importDefault(require("aws-sdk"));
17
- const csvtojson_1 = __importDefault(require("csvtojson"));
13
+ const AWS = require("aws-sdk");
14
+ const csv = require("csvtojson");
18
15
  const SCHEMA = {
19
16
  docs: "https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html",
20
17
  description: "Amazon Simple Storage Service (Amazon S3) is an object storage service that offers industry-leading scalability, data availability, security, and performance.",
21
18
  friendlyName: "Amazon S3",
22
19
  type: "Object store",
23
- features: [types_1.DatasourceFeature.CONNECTION_CHECKING],
24
20
  datasource: {
25
21
  region: {
26
22
  type: "string",
@@ -157,22 +153,7 @@ class S3Integration {
157
153
  else {
158
154
  delete this.config.endpoint;
159
155
  }
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
- });
156
+ this.client = new AWS.S3(this.config);
176
157
  }
177
158
  create(query) {
178
159
  var _a;
@@ -221,7 +202,7 @@ class S3Integration {
221
202
  stream.on("error", (err) => {
222
203
  reject(err);
223
204
  });
224
- const response = (0, csvtojson_1.default)()
205
+ const response = csv()
225
206
  .fromStream(stream)
226
207
  .on("error", () => {
227
208
  csvError = true;
@@ -16,7 +16,6 @@ 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],
20
19
  datasource: {
21
20
  account: {
22
21
  type: "string",
@@ -62,20 +61,6 @@ class SnowflakeIntegration {
62
61
  constructor(config) {
63
62
  this.client = new snowflake_promise_1.Snowflake(config);
64
63
  }
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
- }
79
64
  internalQuery(query) {
80
65
  return __awaiter(this, void 0, void 0, function* () {
81
66
  yield this.client.connect();
@@ -12,6 +12,7 @@ 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");
15
16
  const getQueries = (appDb) => __awaiter(void 0, void 0, void 0, function* () {
16
17
  const response = yield appDb.allDocs((0, utils_1.getQueryParams)(null, {
17
18
  include_docs: true,
@@ -35,7 +36,7 @@ const backfill = (appDb, timestamp) => __awaiter(void 0, void 0, void 0, functio
35
36
  datasource = {
36
37
  type: "unknown",
37
38
  _id: query.datasourceId,
38
- source: "unknown",
39
+ source: types_1.SourceName.UNKNOWN,
39
40
  };
40
41
  }
41
42
  else {
@@ -8,9 +8,6 @@ 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
  exports.mergeConfigs = exports.removeSecretSingle = exports.removeSecrets = exports.getWithEnvVars = exports.get = exports.enrich = exports.checkDatasourceTypes = void 0;
16
13
  const backend_core_1 = require("@budibase/backend-core");
@@ -19,7 +16,6 @@ const types_1 = require("@budibase/types");
19
16
  const fp_1 = require("lodash/fp");
20
17
  const utils_1 = require("../../utils");
21
18
  const integrations_1 = require("../../../integrations");
22
- const lodash_1 = __importDefault(require("lodash"));
23
19
  const ENV_VAR_PREFIX = "env.";
24
20
  function checkDatasourceTypes(schema, config) {
25
21
  for (let key of Object.keys(config)) {
@@ -134,7 +130,7 @@ function removeSecretSingle(datasource) {
134
130
  }
135
131
  exports.removeSecretSingle = removeSecretSingle;
136
132
  function mergeConfigs(update, old) {
137
- var _a, _b, _c, _d, _e;
133
+ var _a, _b, _c, _d;
138
134
  if (!update.config) {
139
135
  return update;
140
136
  }
@@ -153,16 +149,13 @@ function mergeConfigs(update, old) {
153
149
  }
154
150
  }
155
151
  }
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
- }
159
152
  // update back to actual passwords for everything else
160
153
  for (let [key, value] of Object.entries(update.config)) {
161
154
  if (value !== types_1.PASSWORD_REPLACEMENT) {
162
155
  continue;
163
156
  }
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];
157
+ if ((_c = old.config) === null || _c === void 0 ? void 0 : _c[key]) {
158
+ update.config[key] = (_d = old.config) === null || _d === void 0 ? void 0 : _d[key];
166
159
  }
167
160
  else {
168
161
  delete update.config[key];