@budibase/server 2.1.19-alpha.0 → 2.1.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 (159) hide show
  1. package/__mocks__/aws-sdk.ts +0 -14
  2. package/builder/assets/{index.b14b0f23.js → index.5c6dfcb5.js} +216 -216
  3. package/builder/index.html +1 -1
  4. package/coverage/clover.xml +6 -6
  5. package/coverage/coverage-final.json +1 -1
  6. package/coverage/lcov-report/api/controllers/apikeys.js.html +1 -1
  7. package/coverage/lcov-report/api/controllers/automation.js.html +1 -1
  8. package/coverage/lcov-report/api/controllers/cloud.js.html +1 -1
  9. package/coverage/lcov-report/api/controllers/datasource.js.html +1 -1
  10. package/coverage/lcov-report/api/controllers/dev.js.html +1 -1
  11. package/coverage/lcov-report/api/controllers/index.html +1 -1
  12. package/coverage/lcov-report/api/controllers/integration.js.html +1 -1
  13. package/coverage/lcov-report/api/controllers/layout.js.html +1 -1
  14. package/coverage/lcov-report/api/controllers/metadata.js.html +1 -1
  15. package/coverage/lcov-report/api/controllers/migrations.js.html +1 -1
  16. package/coverage/lcov-report/api/controllers/permission.js.html +1 -1
  17. package/coverage/lcov-report/api/controllers/query/index.html +1 -1
  18. package/coverage/lcov-report/api/controllers/query/validation.js.html +1 -1
  19. package/coverage/lcov-report/api/controllers/role.js.html +1 -1
  20. package/coverage/lcov-report/api/controllers/routing.js.html +1 -1
  21. package/coverage/lcov-report/api/controllers/row/external.js.html +1 -1
  22. package/coverage/lcov-report/api/controllers/row/index.html +1 -1
  23. package/coverage/lcov-report/api/controllers/row/internal.js.html +1 -1
  24. package/coverage/lcov-report/api/controllers/row/internalSearch.js.html +1 -1
  25. package/coverage/lcov-report/api/controllers/row/staticFormula.js.html +1 -1
  26. package/coverage/lcov-report/api/controllers/row/utils.js.html +1 -1
  27. package/coverage/lcov-report/api/controllers/script.js.html +1 -1
  28. package/coverage/lcov-report/api/controllers/table/bulkFormula.js.html +1 -1
  29. package/coverage/lcov-report/api/controllers/table/external.js.html +1 -1
  30. package/coverage/lcov-report/api/controllers/table/index.html +1 -1
  31. package/coverage/lcov-report/api/controllers/table/index.js.html +1 -1
  32. package/coverage/lcov-report/api/controllers/templates.js.html +1 -1
  33. package/coverage/lcov-report/api/controllers/user.js.html +1 -1
  34. package/coverage/lcov-report/api/controllers/view/exporters.js.html +1 -1
  35. package/coverage/lcov-report/api/controllers/view/index.html +1 -1
  36. package/coverage/lcov-report/api/controllers/view/index.js.html +1 -1
  37. package/coverage/lcov-report/api/controllers/view/utils.js.html +1 -1
  38. package/coverage/lcov-report/api/controllers/view/viewBuilder.js.html +1 -1
  39. package/coverage/lcov-report/api/index.html +1 -1
  40. package/coverage/lcov-report/api/index.js.html +1 -1
  41. package/coverage/lcov-report/api/routes/analytics.js.html +1 -1
  42. package/coverage/lcov-report/api/routes/apikeys.js.html +1 -1
  43. package/coverage/lcov-report/api/routes/automation.js.html +1 -1
  44. package/coverage/lcov-report/api/routes/cloud.js.html +1 -1
  45. package/coverage/lcov-report/api/routes/component.js.html +1 -1
  46. package/coverage/lcov-report/api/routes/datasource.js.html +1 -1
  47. package/coverage/lcov-report/api/routes/deploy.js.html +1 -1
  48. package/coverage/lcov-report/api/routes/dev.js.html +1 -1
  49. package/coverage/lcov-report/api/routes/index.html +1 -1
  50. package/coverage/lcov-report/api/routes/integration.js.html +1 -1
  51. package/coverage/lcov-report/api/routes/layout.js.html +1 -1
  52. package/coverage/lcov-report/api/routes/metadata.js.html +1 -1
  53. package/coverage/lcov-report/api/routes/migrations.js.html +1 -1
  54. package/coverage/lcov-report/api/routes/permission.js.html +1 -1
  55. package/coverage/lcov-report/api/routes/query.js.html +1 -1
  56. package/coverage/lcov-report/api/routes/role.js.html +1 -1
  57. package/coverage/lcov-report/api/routes/routing.js.html +1 -1
  58. package/coverage/lcov-report/api/routes/screen.js.html +1 -1
  59. package/coverage/lcov-report/api/routes/script.js.html +1 -1
  60. package/coverage/lcov-report/api/routes/table.js.html +1 -1
  61. package/coverage/lcov-report/api/routes/templates.js.html +1 -1
  62. package/coverage/lcov-report/api/routes/user.js.html +1 -1
  63. package/coverage/lcov-report/api/routes/utils/index.html +1 -1
  64. package/coverage/lcov-report/api/routes/utils/validators.js.html +1 -1
  65. package/coverage/lcov-report/api/routes/view.js.html +1 -1
  66. package/coverage/lcov-report/automations/actions.js.html +1 -1
  67. package/coverage/lcov-report/automations/automationUtils.js.html +1 -1
  68. package/coverage/lcov-report/automations/bullboard.js.html +1 -1
  69. package/coverage/lcov-report/automations/index.html +1 -1
  70. package/coverage/lcov-report/automations/index.js.html +1 -1
  71. package/coverage/lcov-report/automations/steps/bash.js.html +1 -1
  72. package/coverage/lcov-report/automations/steps/delay.js.html +1 -1
  73. package/coverage/lcov-report/automations/steps/discord.js.html +1 -1
  74. package/coverage/lcov-report/automations/steps/executeQuery.js.html +1 -1
  75. package/coverage/lcov-report/automations/steps/executeScript.js.html +1 -1
  76. package/coverage/lcov-report/automations/steps/filter.js.html +1 -1
  77. package/coverage/lcov-report/automations/steps/index.html +15 -15
  78. package/coverage/lcov-report/automations/steps/integromat.js.html +1 -1
  79. package/coverage/lcov-report/automations/steps/loop.js.html +1 -1
  80. package/coverage/lcov-report/automations/steps/outgoingWebhook.js.html +1 -1
  81. package/coverage/lcov-report/automations/steps/queryRows.js.html +1 -1
  82. package/coverage/lcov-report/automations/steps/sendSmtpEmail.js.html +1 -1
  83. package/coverage/lcov-report/automations/steps/serverLog.js.html +1 -1
  84. package/coverage/lcov-report/automations/steps/slack.js.html +1 -1
  85. package/coverage/lcov-report/automations/steps/updateRow.js.html +1 -1
  86. package/coverage/lcov-report/automations/steps/utils.js.html +10 -10
  87. package/coverage/lcov-report/automations/steps/zapier.js.html +1 -1
  88. package/coverage/lcov-report/automations/triggerInfo/app.js.html +1 -1
  89. package/coverage/lcov-report/automations/triggerInfo/cron.js.html +1 -1
  90. package/coverage/lcov-report/automations/triggerInfo/index.html +1 -1
  91. package/coverage/lcov-report/automations/triggerInfo/index.js.html +1 -1
  92. package/coverage/lcov-report/automations/triggerInfo/rowDeleted.js.html +1 -1
  93. package/coverage/lcov-report/automations/triggerInfo/rowSaved.js.html +1 -1
  94. package/coverage/lcov-report/automations/triggerInfo/rowUpdated.js.html +1 -1
  95. package/coverage/lcov-report/automations/triggerInfo/webhook.js.html +1 -1
  96. package/coverage/lcov-report/automations/triggers.js.html +1 -1
  97. package/coverage/lcov-report/constants/index.html +1 -1
  98. package/coverage/lcov-report/constants/index.js.html +1 -1
  99. package/coverage/lcov-report/constants/layouts.js.html +1 -1
  100. package/coverage/lcov-report/constants/screens.js.html +1 -1
  101. package/coverage/lcov-report/db/inMemoryView.js.html +1 -1
  102. package/coverage/lcov-report/db/index.html +1 -1
  103. package/coverage/lcov-report/db/index.js.html +1 -1
  104. package/coverage/lcov-report/db/linkedRows/LinkController.js.html +1 -1
  105. package/coverage/lcov-report/db/linkedRows/index.html +1 -1
  106. package/coverage/lcov-report/db/linkedRows/index.js.html +1 -1
  107. package/coverage/lcov-report/db/linkedRows/linkUtils.js.html +1 -1
  108. package/coverage/lcov-report/db/newid.js.html +1 -1
  109. package/coverage/lcov-report/db/utils.js.html +1 -1
  110. package/coverage/lcov-report/events/AutomationEmitter.js.html +1 -1
  111. package/coverage/lcov-report/events/index.html +1 -1
  112. package/coverage/lcov-report/events/index.js.html +1 -1
  113. package/coverage/lcov-report/events/utils.js.html +1 -1
  114. package/coverage/lcov-report/index.html +14 -14
  115. package/coverage/lcov-report/integrations/tests/TestConfiguration.js.html +1 -1
  116. package/coverage/lcov-report/integrations/tests/index.html +1 -1
  117. package/coverage/lcov-report/middleware/appInfo.js.html +1 -1
  118. package/coverage/lcov-report/middleware/builder.js.html +1 -1
  119. package/coverage/lcov-report/middleware/currentapp.js.html +1 -1
  120. package/coverage/lcov-report/middleware/index.html +1 -1
  121. package/coverage/lcov-report/middleware/joi-validator.js.html +1 -1
  122. package/coverage/lcov-report/middleware/publicApi.js.html +1 -1
  123. package/coverage/lcov-report/middleware/resourceId.js.html +1 -1
  124. package/coverage/lcov-report/middleware/selfhost.js.html +1 -1
  125. package/coverage/lcov-report/middleware/utils.js.html +1 -1
  126. package/coverage/lcov-report/utilities/budibaseDir.js.html +1 -1
  127. package/coverage/lcov-report/utilities/centralPath.js.html +1 -1
  128. package/coverage/lcov-report/utilities/csvParser.js.html +1 -1
  129. package/coverage/lcov-report/utilities/global.js.html +1 -1
  130. package/coverage/lcov-report/utilities/index.html +1 -1
  131. package/coverage/lcov-report/utilities/index.js.html +1 -1
  132. package/coverage/lcov-report/utilities/plugins.js.html +1 -1
  133. package/coverage/lcov-report/utilities/queue/inMemoryQueue.js.html +1 -1
  134. package/coverage/lcov-report/utilities/queue/index.html +1 -1
  135. package/coverage/lcov-report/utilities/routing/index.html +1 -1
  136. package/coverage/lcov-report/utilities/routing/index.js.html +1 -1
  137. package/coverage/lcov-report/utilities/rowProcessor/index.html +1 -1
  138. package/coverage/lcov-report/utilities/rowProcessor/index.js.html +1 -1
  139. package/coverage/lcov-report/utilities/rowProcessor/utils.js.html +1 -1
  140. package/coverage/lcov-report/utilities/scriptRunner.js.html +1 -1
  141. package/coverage/lcov-report/utilities/security.js.html +1 -1
  142. package/coverage/lcov-report/utilities/statusCodes.js.html +1 -1
  143. package/coverage/lcov-report/utilities/usageQuota/index.html +1 -1
  144. package/coverage/lcov-report/utilities/usageQuota/rows.js.html +1 -1
  145. package/coverage/lcov-report/utilities/usageQuota/usageQuoteReset.js.html +1 -1
  146. package/coverage/lcov-report/utilities/users.js.html +1 -1
  147. package/coverage/lcov-report/utilities/workerRequests.js.html +1 -1
  148. package/coverage/lcov.info +4 -4
  149. package/dist/api/controllers/row/ExternalRequest.js +1 -6
  150. package/dist/api/controllers/row/index.js +7 -16
  151. package/dist/integrations/elasticsearch.js +2 -26
  152. package/dist/integrations/s3.js +1 -157
  153. package/dist/tsconfig.build.tsbuildinfo +1 -1
  154. package/package.json +6 -6
  155. package/src/api/controllers/row/ExternalRequest.ts +3 -5
  156. package/src/api/controllers/row/index.ts +9 -17
  157. package/src/integrations/elasticsearch.ts +2 -32
  158. package/src/integrations/s3.ts +3 -179
  159. package/src/integrations/tests/s3.spec.ts +1 -85
@@ -5102,10 +5102,10 @@ FN:1,(anonymous_0)
5102
5102
  FN:21,(anonymous_1)
5103
5103
  FN:26,(anonymous_2)
5104
5104
  FNF:3
5105
- FNH:3
5105
+ FNH:2
5106
5106
  FNDA:2,(anonymous_0)
5107
5107
  FNDA:22,(anonymous_1)
5108
- FNDA:1,(anonymous_2)
5108
+ FNDA:0,(anonymous_2)
5109
5109
  DA:1,45
5110
5110
  DA:2,2
5111
5111
  DA:4,2
@@ -5117,7 +5117,7 @@ DA:12,0
5117
5117
  DA:14,2
5118
5118
  DA:21,45
5119
5119
  DA:22,22
5120
- DA:27,1
5120
+ DA:27,0
5121
5121
  DA:30,22
5122
5122
  DA:31,17
5123
5123
  DA:33,22
@@ -5126,7 +5126,7 @@ DA:36,22
5126
5126
  DA:37,5
5127
5127
  DA:39,22
5128
5128
  LF:19
5129
- LH:17
5129
+ LH:16
5130
5130
  BRDA:6,0,0,2
5131
5131
  BRDA:6,0,1,0
5132
5132
  BRDA:6,1,0,2
@@ -196,7 +196,6 @@ var External;
196
196
  }
197
197
  }
198
198
  inputProcessing(row, table) {
199
- var _a;
200
199
  if (!row) {
201
200
  return { row, manyRelationships: [] };
202
201
  }
@@ -236,11 +235,7 @@ var External;
236
235
  const linkTablePrimary = linkTable.primary[0];
237
236
  // one to many
238
237
  if (isOneSide(field)) {
239
- let id = row[key][0];
240
- if (typeof row[key] === "string") {
241
- id = (_a = decodeURIComponent(row[key]).match(/\[(.*?)\]/)) === null || _a === void 0 ? void 0 : _a[1];
242
- }
243
- newRow[field.foreignKey || linkTablePrimary] = (0, utils_1.breakRowIdField)(id)[0];
238
+ newRow[field.foreignKey || linkTablePrimary] = (0, utils_1.breakRowIdField)(row[key][0])[0];
244
239
  }
245
240
  // many to many
246
241
  else if (field.through) {
@@ -43,22 +43,13 @@ function patch(ctx) {
43
43
  if (body && !body._id) {
44
44
  return (0, exports.save)(ctx);
45
45
  }
46
- try {
47
- const { row, table } = yield pro_1.quotas.addQuery(() => pickApi(tableId).patch(ctx), {
48
- datasourceId: tableId,
49
- });
50
- if (!row) {
51
- ctx.throw(404, "Row not found");
52
- }
53
- ctx.status = 200;
54
- ctx.eventEmitter &&
55
- ctx.eventEmitter.emitRow(`row:update`, appId, row, table);
56
- ctx.message = `${table.name} updated successfully.`;
57
- ctx.body = row;
58
- }
59
- catch (err) {
60
- ctx.throw(400, err);
61
- }
46
+ const { row, table } = yield pro_1.quotas.addQuery(() => pickApi(tableId).patch(ctx), {
47
+ datasourceId: tableId,
48
+ });
49
+ ctx.status = 200;
50
+ ctx.eventEmitter && ctx.eventEmitter.emitRow(`row:update`, appId, row, table);
51
+ ctx.message = `${table.name} updated successfully.`;
52
+ ctx.body = row;
62
53
  });
63
54
  }
64
55
  exports.patch = patch;
@@ -10,7 +10,7 @@ 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 elasticsearch_1 = require("@elastic/elasticsearch");
13
+ const { Client } = require("@elastic/elasticsearch");
14
14
  const SCHEMA = {
15
15
  docs: "https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/index.html",
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.",
@@ -22,21 +22,6 @@ const SCHEMA = {
22
22
  required: true,
23
23
  default: "http://localhost:9200",
24
24
  },
25
- ssl: {
26
- type: types_1.DatasourceFieldType.BOOLEAN,
27
- default: false,
28
- required: false,
29
- },
30
- rejectUnauthorized: {
31
- type: types_1.DatasourceFieldType.BOOLEAN,
32
- default: true,
33
- required: false,
34
- },
35
- ca: {
36
- type: types_1.DatasourceFieldType.LONGFORM,
37
- default: false,
38
- required: false,
39
- },
40
25
  },
41
26
  query: {
42
27
  create: {
@@ -91,16 +76,7 @@ const SCHEMA = {
91
76
  class ElasticSearchIntegration {
92
77
  constructor(config) {
93
78
  this.config = config;
94
- const clientConfig = {
95
- node: this.config.url,
96
- };
97
- if (this.config.ssl) {
98
- clientConfig.ssl = {
99
- rejectUnauthorized: this.config.rejectUnauthorized,
100
- ca: this.config.ca || undefined,
101
- };
102
- }
103
- this.client = new elasticsearch_1.Client(clientConfig);
79
+ this.client = new Client({ node: config.url });
104
80
  }
105
81
  create(query) {
106
82
  return __awaiter(this, void 0, void 0, function* () {
@@ -11,7 +11,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  const types_1 = require("@budibase/types");
13
13
  const AWS = require("aws-sdk");
14
- const csv = require("csvtojson");
15
14
  const SCHEMA = {
16
15
  docs: "https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html",
17
16
  description: "Amazon Simple Storage Service (Amazon S3) is an object storage service that offers industry-leading scalability, data availability, security, and performance.",
@@ -42,106 +41,16 @@ const SCHEMA = {
42
41
  },
43
42
  },
44
43
  query: {
45
- create: {
46
- type: types_1.QueryType.FIELDS,
47
- fields: {
48
- bucket: {
49
- display: "New Bucket",
50
- type: types_1.DatasourceFieldType.STRING,
51
- required: true,
52
- },
53
- location: {
54
- required: true,
55
- default: "us-east-1",
56
- type: types_1.DatasourceFieldType.STRING,
57
- },
58
- grantFullControl: {
59
- display: "Grant full control",
60
- type: types_1.DatasourceFieldType.STRING,
61
- },
62
- grantRead: {
63
- display: "Grant read",
64
- type: types_1.DatasourceFieldType.STRING,
65
- },
66
- grantReadAcp: {
67
- display: "Grant read ACP",
68
- type: types_1.DatasourceFieldType.STRING,
69
- },
70
- grantWrite: {
71
- display: "Grant write",
72
- type: types_1.DatasourceFieldType.STRING,
73
- },
74
- grantWriteAcp: {
75
- display: "Grant write ACP",
76
- type: types_1.DatasourceFieldType.STRING,
77
- },
78
- },
79
- },
80
44
  read: {
81
45
  type: types_1.QueryType.FIELDS,
82
46
  fields: {
83
47
  bucket: {
84
- type: types_1.DatasourceFieldType.STRING,
85
- required: true,
86
- },
87
- delimiter: {
88
- type: types_1.DatasourceFieldType.STRING,
89
- },
90
- marker: {
91
- type: types_1.DatasourceFieldType.STRING,
92
- },
93
- maxKeys: {
94
- type: types_1.DatasourceFieldType.NUMBER,
95
- display: "Max Keys",
96
- },
97
- prefix: {
98
- type: types_1.DatasourceFieldType.STRING,
99
- },
100
- },
101
- },
102
- readCsv: {
103
- displayName: "Read CSV",
104
- type: types_1.QueryType.FIELDS,
105
- fields: {
106
- bucket: {
107
- type: types_1.DatasourceFieldType.STRING,
108
- required: true,
109
- },
110
- key: {
111
- type: types_1.DatasourceFieldType.STRING,
112
- required: true,
113
- },
114
- },
115
- },
116
- delete: {
117
- type: types_1.QueryType.FIELDS,
118
- fields: {
119
- bucket: {
120
- type: types_1.DatasourceFieldType.STRING,
121
- required: true,
122
- },
123
- delete: {
124
- type: types_1.DatasourceFieldType.JSON,
48
+ type: "string",
125
49
  required: true,
126
50
  },
127
51
  },
128
52
  },
129
53
  },
130
- extra: {
131
- acl: {
132
- required: false,
133
- displayName: "ACL",
134
- type: types_1.DatasourceFieldType.LIST,
135
- data: {
136
- create: [
137
- "private",
138
- "public-read",
139
- "public-read-write",
140
- "authenticated-read",
141
- ],
142
- },
143
- },
144
- },
145
54
  };
146
55
  class S3Integration {
147
56
  constructor(config) {
@@ -154,81 +63,16 @@ class S3Integration {
154
63
  }
155
64
  this.client = new AWS.S3(this.config);
156
65
  }
157
- create(query) {
158
- var _a;
159
- return __awaiter(this, void 0, void 0, function* () {
160
- let params = {
161
- Bucket: query.bucket,
162
- ACL: (_a = query.extra) === null || _a === void 0 ? void 0 : _a.acl,
163
- GrantFullControl: query.grantFullControl,
164
- GrantRead: query.grantRead,
165
- GrantReadACP: query.grantReadAcp,
166
- GrantWrite: query.grantWrite,
167
- GrantWriteACP: query.grantWriteAcp,
168
- };
169
- if (query.location) {
170
- params["CreateBucketConfiguration"] = {
171
- LocationConstraint: query.location,
172
- };
173
- }
174
- return yield this.client.createBucket(params).promise();
175
- });
176
- }
177
66
  read(query) {
178
67
  return __awaiter(this, void 0, void 0, function* () {
179
68
  const response = yield this.client
180
69
  .listObjects({
181
70
  Bucket: query.bucket,
182
- Delimiter: query.delimiter,
183
- Marker: query.marker,
184
- MaxKeys: query.maxKeys,
185
- Prefix: query.prefix,
186
71
  })
187
72
  .promise();
188
73
  return response.Contents;
189
74
  });
190
75
  }
191
- readCsv(query) {
192
- return __awaiter(this, void 0, void 0, function* () {
193
- const stream = this.client
194
- .getObject({
195
- Bucket: query.bucket,
196
- Key: query.key,
197
- })
198
- .createReadStream();
199
- let csvError = false;
200
- return new Promise((resolve, reject) => {
201
- stream.on("error", (err) => {
202
- reject(err);
203
- });
204
- const response = csv()
205
- .fromStream(stream)
206
- .on("error", () => {
207
- csvError = true;
208
- });
209
- stream.on("finish", () => {
210
- resolve(response);
211
- });
212
- }).catch(err => {
213
- if (csvError) {
214
- throw new Error("Could not read CSV");
215
- }
216
- else {
217
- throw err;
218
- }
219
- });
220
- });
221
- }
222
- delete(query) {
223
- return __awaiter(this, void 0, void 0, function* () {
224
- return yield this.client
225
- .deleteObjects({
226
- Bucket: query.bucket,
227
- Delete: JSON.parse(query.delete),
228
- })
229
- .promise();
230
- });
231
- }
232
76
  }
233
77
  exports.default = {
234
78
  schema: SCHEMA,