@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.
- package/__mocks__/aws-sdk.ts +0 -14
- package/builder/assets/{index.b14b0f23.js → index.5c6dfcb5.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 +1 -6
- package/dist/api/controllers/row/index.js +7 -16
- package/dist/integrations/elasticsearch.js +2 -26
- package/dist/integrations/s3.js +1 -157
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +6 -6
- package/src/api/controllers/row/ExternalRequest.ts +3 -5
- package/src/api/controllers/row/index.ts +9 -17
- package/src/integrations/elasticsearch.ts +2 -32
- package/src/integrations/s3.ts +3 -179
- package/src/integrations/tests/s3.spec.ts +1 -85
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:2
|
|
5106
5106
|
FNDA:2,(anonymous_0)
|
|
5107
5107
|
FNDA:22,(anonymous_1)
|
|
5108
|
-
FNDA:
|
|
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,
|
|
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:
|
|
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
|
-
|
|
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
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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
|
|
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
|
-
|
|
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* () {
|
package/dist/integrations/s3.js
CHANGED
|
@@ -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:
|
|
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,
|