@budibase/server 2.1.13 → 2.1.14-alpha.0
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/__mocks__/aws-sdk.ts +14 -0
- package/builder/assets/{index.0d3147a2.js → index.d5568baa.js} +216 -216
- package/builder/index.html +1 -1
- package/coverage/clover.xml +6 -6
- package/coverage/coverage-final.json +1 -1
- package/coverage/lcov-report/api/controllers/apikeys.js.html +1 -1
- package/coverage/lcov-report/api/controllers/automation.js.html +1 -1
- package/coverage/lcov-report/api/controllers/cloud.js.html +1 -1
- package/coverage/lcov-report/api/controllers/datasource.js.html +1 -1
- package/coverage/lcov-report/api/controllers/dev.js.html +1 -1
- package/coverage/lcov-report/api/controllers/index.html +1 -1
- package/coverage/lcov-report/api/controllers/integration.js.html +1 -1
- package/coverage/lcov-report/api/controllers/layout.js.html +1 -1
- package/coverage/lcov-report/api/controllers/metadata.js.html +1 -1
- package/coverage/lcov-report/api/controllers/migrations.js.html +1 -1
- package/coverage/lcov-report/api/controllers/permission.js.html +1 -1
- package/coverage/lcov-report/api/controllers/query/index.html +1 -1
- package/coverage/lcov-report/api/controllers/query/validation.js.html +1 -1
- package/coverage/lcov-report/api/controllers/role.js.html +1 -1
- package/coverage/lcov-report/api/controllers/routing.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/external.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/index.html +1 -1
- package/coverage/lcov-report/api/controllers/row/internal.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/internalSearch.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/staticFormula.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/utils.js.html +1 -1
- package/coverage/lcov-report/api/controllers/script.js.html +1 -1
- package/coverage/lcov-report/api/controllers/table/bulkFormula.js.html +1 -1
- package/coverage/lcov-report/api/controllers/table/external.js.html +1 -1
- package/coverage/lcov-report/api/controllers/table/index.html +1 -1
- package/coverage/lcov-report/api/controllers/table/index.js.html +1 -1
- package/coverage/lcov-report/api/controllers/templates.js.html +1 -1
- package/coverage/lcov-report/api/controllers/user.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/exporters.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/index.html +1 -1
- package/coverage/lcov-report/api/controllers/view/index.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/utils.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/viewBuilder.js.html +1 -1
- 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/automation.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 +1 -1
- package/coverage/lcov-report/api/routes/index.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/migrations.js.html +1 -1
- package/coverage/lcov-report/api/routes/permission.js.html +1 -1
- package/coverage/lcov-report/api/routes/query.js.html +1 -1
- 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/screen.js.html +1 -1
- package/coverage/lcov-report/api/routes/script.js.html +1 -1
- package/coverage/lcov-report/api/routes/table.js.html +1 -1
- package/coverage/lcov-report/api/routes/templates.js.html +1 -1
- package/coverage/lcov-report/api/routes/user.js.html +1 -1
- package/coverage/lcov-report/api/routes/utils/index.html +1 -1
- package/coverage/lcov-report/api/routes/utils/validators.js.html +1 -1
- package/coverage/lcov-report/api/routes/view.js.html +1 -1
- package/coverage/lcov-report/automations/actions.js.html +1 -1
- package/coverage/lcov-report/automations/automationUtils.js.html +1 -1
- package/coverage/lcov-report/automations/bullboard.js.html +1 -1
- package/coverage/lcov-report/automations/index.html +1 -1
- package/coverage/lcov-report/automations/index.js.html +1 -1
- package/coverage/lcov-report/automations/steps/bash.js.html +1 -1
- package/coverage/lcov-report/automations/steps/delay.js.html +1 -1
- package/coverage/lcov-report/automations/steps/discord.js.html +1 -1
- package/coverage/lcov-report/automations/steps/executeQuery.js.html +1 -1
- package/coverage/lcov-report/automations/steps/executeScript.js.html +1 -1
- package/coverage/lcov-report/automations/steps/filter.js.html +1 -1
- package/coverage/lcov-report/automations/steps/index.html +15 -15
- package/coverage/lcov-report/automations/steps/integromat.js.html +1 -1
- package/coverage/lcov-report/automations/steps/loop.js.html +1 -1
- package/coverage/lcov-report/automations/steps/outgoingWebhook.js.html +1 -1
- package/coverage/lcov-report/automations/steps/queryRows.js.html +1 -1
- 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 +10 -10
- package/coverage/lcov-report/automations/steps/zapier.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/app.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/cron.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/index.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/index.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/rowDeleted.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/rowSaved.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/rowUpdated.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/webhook.js.html +1 -1
- package/coverage/lcov-report/automations/triggers.js.html +1 -1
- package/coverage/lcov-report/constants/index.html +1 -1
- package/coverage/lcov-report/constants/index.js.html +1 -1
- 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/inMemoryView.js.html +1 -1
- package/coverage/lcov-report/db/index.html +1 -1
- package/coverage/lcov-report/db/index.js.html +1 -1
- package/coverage/lcov-report/db/linkedRows/LinkController.js.html +1 -1
- package/coverage/lcov-report/db/linkedRows/index.html +1 -1
- package/coverage/lcov-report/db/linkedRows/index.js.html +1 -1
- package/coverage/lcov-report/db/linkedRows/linkUtils.js.html +1 -1
- package/coverage/lcov-report/db/newid.js.html +1 -1
- package/coverage/lcov-report/db/utils.js.html +1 -1
- package/coverage/lcov-report/events/AutomationEmitter.js.html +1 -1
- package/coverage/lcov-report/events/index.html +1 -1
- package/coverage/lcov-report/events/index.js.html +1 -1
- package/coverage/lcov-report/events/utils.js.html +1 -1
- package/coverage/lcov-report/index.html +14 -14
- 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 +1 -1
- package/coverage/lcov-report/middleware/builder.js.html +1 -1
- package/coverage/lcov-report/middleware/currentapp.js.html +1 -1
- package/coverage/lcov-report/middleware/index.html +1 -1
- package/coverage/lcov-report/middleware/joi-validator.js.html +1 -1
- package/coverage/lcov-report/middleware/publicApi.js.html +1 -1
- package/coverage/lcov-report/middleware/resourceId.js.html +1 -1
- package/coverage/lcov-report/middleware/selfhost.js.html +1 -1
- package/coverage/lcov-report/middleware/utils.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 +1 -1
- package/coverage/lcov-report/utilities/global.js.html +1 -1
- package/coverage/lcov-report/utilities/index.html +1 -1
- package/coverage/lcov-report/utilities/index.js.html +1 -1
- package/coverage/lcov-report/utilities/plugins.js.html +1 -1
- package/coverage/lcov-report/utilities/queue/inMemoryQueue.js.html +1 -1
- package/coverage/lcov-report/utilities/queue/index.html +1 -1
- 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 +1 -1
- package/coverage/lcov-report/utilities/rowProcessor/index.js.html +1 -1
- package/coverage/lcov-report/utilities/rowProcessor/utils.js.html +1 -1
- package/coverage/lcov-report/utilities/scriptRunner.js.html +1 -1
- package/coverage/lcov-report/utilities/security.js.html +1 -1
- package/coverage/lcov-report/utilities/statusCodes.js.html +1 -1
- package/coverage/lcov-report/utilities/usageQuota/index.html +1 -1
- package/coverage/lcov-report/utilities/usageQuota/rows.js.html +1 -1
- package/coverage/lcov-report/utilities/usageQuota/usageQuoteReset.js.html +1 -1
- package/coverage/lcov-report/utilities/users.js.html +1 -1
- package/coverage/lcov-report/utilities/workerRequests.js.html +1 -1
- package/coverage/lcov.info +4 -4
- package/dist/api/controllers/row/ExternalRequest.js +6 -1
- package/dist/api/controllers/row/index.js +16 -7
- package/dist/integrations/elasticsearch.js +26 -2
- package/dist/integrations/s3.js +157 -1
- package/dist/package.json +6 -6
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +7 -7
- package/src/api/controllers/row/ExternalRequest.ts +5 -3
- package/src/api/controllers/row/index.ts +17 -9
- package/src/integrations/elasticsearch.ts +32 -2
- package/src/integrations/s3.ts +179 -3
- package/src/integrations/tests/s3.spec.ts +85 -1
package/coverage/lcov.info
CHANGED
|
@@ -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:
|
|
5105
|
+
FNH:3
|
|
5106
5106
|
FNDA:2,(anonymous_0)
|
|
5107
5107
|
FNDA:22,(anonymous_1)
|
|
5108
|
-
FNDA:
|
|
5108
|
+
FNDA:1,(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,
|
|
5120
|
+
DA:27,1
|
|
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:
|
|
5129
|
+
LH:17
|
|
5130
5130
|
BRDA:6,0,0,2
|
|
5131
5131
|
BRDA:6,0,1,0
|
|
5132
5132
|
BRDA:6,1,0,2
|
|
@@ -196,6 +196,7 @@ var External;
|
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
198
|
inputProcessing(row, table) {
|
|
199
|
+
var _a;
|
|
199
200
|
if (!row) {
|
|
200
201
|
return { row, manyRelationships: [] };
|
|
201
202
|
}
|
|
@@ -235,7 +236,11 @@ var External;
|
|
|
235
236
|
const linkTablePrimary = linkTable.primary[0];
|
|
236
237
|
// one to many
|
|
237
238
|
if (isOneSide(field)) {
|
|
238
|
-
|
|
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];
|
|
239
244
|
}
|
|
240
245
|
// many to many
|
|
241
246
|
else if (field.through) {
|
|
@@ -43,13 +43,22 @@ function patch(ctx) {
|
|
|
43
43
|
if (body && !body._id) {
|
|
44
44
|
return (0, exports.save)(ctx);
|
|
45
45
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
+
}
|
|
53
62
|
});
|
|
54
63
|
}
|
|
55
64
|
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
|
|
13
|
+
const elasticsearch_1 = 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,6 +22,21 @@ 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
|
+
},
|
|
25
40
|
},
|
|
26
41
|
query: {
|
|
27
42
|
create: {
|
|
@@ -76,7 +91,16 @@ const SCHEMA = {
|
|
|
76
91
|
class ElasticSearchIntegration {
|
|
77
92
|
constructor(config) {
|
|
78
93
|
this.config = config;
|
|
79
|
-
|
|
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);
|
|
80
104
|
}
|
|
81
105
|
create(query) {
|
|
82
106
|
return __awaiter(this, void 0, void 0, function* () {
|
package/dist/integrations/s3.js
CHANGED
|
@@ -11,6 +11,7 @@ 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");
|
|
14
15
|
const SCHEMA = {
|
|
15
16
|
docs: "https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html",
|
|
16
17
|
description: "Amazon Simple Storage Service (Amazon S3) is an object storage service that offers industry-leading scalability, data availability, security, and performance.",
|
|
@@ -41,16 +42,106 @@ const SCHEMA = {
|
|
|
41
42
|
},
|
|
42
43
|
},
|
|
43
44
|
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
|
+
},
|
|
44
80
|
read: {
|
|
45
81
|
type: types_1.QueryType.FIELDS,
|
|
46
82
|
fields: {
|
|
47
83
|
bucket: {
|
|
48
|
-
type:
|
|
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,
|
|
49
125
|
required: true,
|
|
50
126
|
},
|
|
51
127
|
},
|
|
52
128
|
},
|
|
53
129
|
},
|
|
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
|
+
},
|
|
54
145
|
};
|
|
55
146
|
class S3Integration {
|
|
56
147
|
constructor(config) {
|
|
@@ -63,16 +154,81 @@ class S3Integration {
|
|
|
63
154
|
}
|
|
64
155
|
this.client = new AWS.S3(this.config);
|
|
65
156
|
}
|
|
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
|
+
}
|
|
66
177
|
read(query) {
|
|
67
178
|
return __awaiter(this, void 0, void 0, function* () {
|
|
68
179
|
const response = yield this.client
|
|
69
180
|
.listObjects({
|
|
70
181
|
Bucket: query.bucket,
|
|
182
|
+
Delimiter: query.delimiter,
|
|
183
|
+
Marker: query.marker,
|
|
184
|
+
MaxKeys: query.maxKeys,
|
|
185
|
+
Prefix: query.prefix,
|
|
71
186
|
})
|
|
72
187
|
.promise();
|
|
73
188
|
return response.Contents;
|
|
74
189
|
});
|
|
75
190
|
}
|
|
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
|
+
}
|
|
76
232
|
}
|
|
77
233
|
exports.default = {
|
|
78
234
|
schema: SCHEMA,
|
package/dist/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@budibase/server",
|
|
3
3
|
"email": "hi@budibase.com",
|
|
4
|
-
"version": "2.1.
|
|
4
|
+
"version": "2.1.13",
|
|
5
5
|
"description": "Budibase Web Server",
|
|
6
6
|
"main": "src/index.ts",
|
|
7
7
|
"repository": {
|
|
@@ -77,11 +77,11 @@
|
|
|
77
77
|
"license": "GPL-3.0",
|
|
78
78
|
"dependencies": {
|
|
79
79
|
"@apidevtools/swagger-parser": "10.0.3",
|
|
80
|
-
"@budibase/backend-core": "^2.1.
|
|
81
|
-
"@budibase/client": "^2.1.
|
|
82
|
-
"@budibase/pro": "2.1.
|
|
83
|
-
"@budibase/string-templates": "^2.1.
|
|
84
|
-
"@budibase/types": "^2.1.
|
|
80
|
+
"@budibase/backend-core": "^2.1.13",
|
|
81
|
+
"@budibase/client": "^2.1.13",
|
|
82
|
+
"@budibase/pro": "2.1.13",
|
|
83
|
+
"@budibase/string-templates": "^2.1.13",
|
|
84
|
+
"@budibase/types": "^2.1.13",
|
|
85
85
|
"@bull-board/api": "3.7.0",
|
|
86
86
|
"@bull-board/koa": "3.9.4",
|
|
87
87
|
"@elastic/elasticsearch": "7.10.0",
|