@digipair/skill-s3 0.92.1 → 0.93.0-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.
Files changed (47) hide show
  1. package/README.md +7 -0
  2. package/dist/index.cjs.js +22 -0
  3. package/dist/index.cjs10.js +1581 -0
  4. package/dist/index.cjs11.js +2639 -0
  5. package/dist/index.cjs2.js +25 -0
  6. package/dist/index.cjs3.js +39239 -0
  7. package/dist/index.cjs4.js +450 -0
  8. package/dist/index.cjs5.js +3698 -0
  9. package/dist/index.cjs6.js +433 -0
  10. package/dist/index.cjs7.js +706 -0
  11. package/dist/index.cjs8.js +1691 -0
  12. package/dist/index.cjs9.js +1515 -0
  13. package/dist/index.esm.js +13 -0
  14. package/dist/index.esm10.js +1577 -0
  15. package/dist/index.esm11.js +2619 -0
  16. package/dist/index.esm2.js +13 -0
  17. package/dist/index.esm3.js +39118 -0
  18. package/dist/index.esm4.js +447 -0
  19. package/dist/index.esm5.js +3676 -0
  20. package/dist/index.esm6.js +431 -0
  21. package/dist/index.esm7.js +704 -0
  22. package/dist/index.esm8.js +1689 -0
  23. package/dist/index.esm9.js +1504 -0
  24. package/dist/loadSso.cjs.js +2092 -0
  25. package/dist/loadSso.esm.js +2089 -0
  26. package/dist/noAuth.cjs.js +167 -0
  27. package/dist/noAuth.esm.js +165 -0
  28. package/dist/package.cjs.js +187 -0
  29. package/dist/package.esm.js +184 -0
  30. package/dist/parseJsonBody.cjs.js +257 -0
  31. package/dist/parseJsonBody.esm.js +252 -0
  32. package/dist/parseKnownFiles.cjs.js +250 -0
  33. package/dist/parseKnownFiles.esm.js +248 -0
  34. package/dist/src/index.d.ts +2 -0
  35. package/dist/src/index.d.ts.map +1 -0
  36. package/{libs/skill-s3 → dist}/src/lib/skill-s3.d.ts +1 -0
  37. package/dist/src/lib/skill-s3.d.ts.map +1 -0
  38. package/dist/src/lib/skill-s3.spec.d.ts +2 -0
  39. package/dist/src/lib/skill-s3.spec.d.ts.map +1 -0
  40. package/package.json +20 -6
  41. package/index.cjs.js +0 -72
  42. package/index.d.ts +0 -1
  43. package/index.esm.js +0 -65
  44. package/libs/skill-s3/src/index.d.ts +0 -1
  45. /package/{index.cjs.d.ts → dist/index.d.ts} +0 -0
  46. /package/{schema.fr.json → dist/schema.fr.json} +0 -0
  47. /package/{schema.json → dist/schema.json} +0 -0
@@ -0,0 +1,250 @@
1
+ 'use strict';
2
+
3
+ var index = require('./index.cjs3.js');
4
+
5
+ function _array_like_to_array(arr, len) {
6
+ if (len == null || len > arr.length) len = arr.length;
7
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
8
+ return arr2;
9
+ }
10
+ function _array_with_holes(arr) {
11
+ if (Array.isArray(arr)) return arr;
12
+ }
13
+ function _iterable_to_array_limit(arr, i) {
14
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
15
+ if (_i == null) return;
16
+ var _arr = [];
17
+ var _n = true;
18
+ var _d = false;
19
+ var _s, _e;
20
+ try {
21
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
22
+ _arr.push(_s.value);
23
+ if (i && _arr.length === i) break;
24
+ }
25
+ } catch (err) {
26
+ _d = true;
27
+ _e = err;
28
+ } finally{
29
+ try {
30
+ if (!_n && _i["return"] != null) _i["return"]();
31
+ } finally{
32
+ if (_d) throw _e;
33
+ }
34
+ }
35
+ return _arr;
36
+ }
37
+ function _non_iterable_rest() {
38
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
39
+ }
40
+ function _sliced_to_array(arr, i) {
41
+ return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
42
+ }
43
+ function _unsupported_iterable_to_array(o, minLen) {
44
+ if (!o) return;
45
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
46
+ var n = Object.prototype.toString.call(o).slice(8, -1);
47
+ if (n === "Object" && o.constructor) n = o.constructor.name;
48
+ if (n === "Map" || n === "Set") return Array.from(n);
49
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
50
+ }
51
+ var mergeConfigFiles = function() {
52
+ for(var _len = arguments.length, files = new Array(_len), _key = 0; _key < _len; _key++){
53
+ files[_key] = arguments[_key];
54
+ }
55
+ var merged = {};
56
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
57
+ try {
58
+ for(var _iterator = files[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
59
+ var file = _step.value;
60
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
61
+ try {
62
+ for(var _iterator1 = Object.entries(file)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
63
+ var _step_value = _sliced_to_array(_step1.value, 2), key = _step_value[0], values = _step_value[1];
64
+ if (merged[key] !== undefined) {
65
+ Object.assign(merged[key], values);
66
+ } else {
67
+ merged[key] = values;
68
+ }
69
+ }
70
+ } catch (err) {
71
+ _didIteratorError1 = true;
72
+ _iteratorError1 = err;
73
+ } finally{
74
+ try {
75
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
76
+ _iterator1.return();
77
+ }
78
+ } finally{
79
+ if (_didIteratorError1) {
80
+ throw _iteratorError1;
81
+ }
82
+ }
83
+ }
84
+ }
85
+ } catch (err) {
86
+ _didIteratorError = true;
87
+ _iteratorError = err;
88
+ } finally{
89
+ try {
90
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
91
+ _iterator.return();
92
+ }
93
+ } finally{
94
+ if (_didIteratorError) {
95
+ throw _iteratorError;
96
+ }
97
+ }
98
+ }
99
+ return merged;
100
+ };
101
+
102
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
103
+ try {
104
+ var info = gen[key](arg);
105
+ var value = info.value;
106
+ } catch (error) {
107
+ reject(error);
108
+ return;
109
+ }
110
+ if (info.done) {
111
+ resolve(value);
112
+ } else {
113
+ Promise.resolve(value).then(_next, _throw);
114
+ }
115
+ }
116
+ function _async_to_generator(fn) {
117
+ return function() {
118
+ var self = this, args = arguments;
119
+ return new Promise(function(resolve, reject) {
120
+ var gen = fn.apply(self, args);
121
+ function _next(value) {
122
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
123
+ }
124
+ function _throw(err) {
125
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
126
+ }
127
+ _next(undefined);
128
+ });
129
+ };
130
+ }
131
+ function _ts_generator(thisArg, body) {
132
+ var f, y, t, g, _ = {
133
+ label: 0,
134
+ sent: function() {
135
+ if (t[0] & 1) throw t[1];
136
+ return t[1];
137
+ },
138
+ trys: [],
139
+ ops: []
140
+ };
141
+ return g = {
142
+ next: verb(0),
143
+ "throw": verb(1),
144
+ "return": verb(2)
145
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
146
+ return this;
147
+ }), g;
148
+ function verb(n) {
149
+ return function(v) {
150
+ return step([
151
+ n,
152
+ v
153
+ ]);
154
+ };
155
+ }
156
+ function step(op) {
157
+ if (f) throw new TypeError("Generator is already executing.");
158
+ while(_)try {
159
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
160
+ if (y = 0, t) op = [
161
+ op[0] & 2,
162
+ t.value
163
+ ];
164
+ switch(op[0]){
165
+ case 0:
166
+ case 1:
167
+ t = op;
168
+ break;
169
+ case 4:
170
+ _.label++;
171
+ return {
172
+ value: op[1],
173
+ done: false
174
+ };
175
+ case 5:
176
+ _.label++;
177
+ y = op[1];
178
+ op = [
179
+ 0
180
+ ];
181
+ continue;
182
+ case 7:
183
+ op = _.ops.pop();
184
+ _.trys.pop();
185
+ continue;
186
+ default:
187
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
188
+ _ = 0;
189
+ continue;
190
+ }
191
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
192
+ _.label = op[1];
193
+ break;
194
+ }
195
+ if (op[0] === 6 && _.label < t[1]) {
196
+ _.label = t[1];
197
+ t = op;
198
+ break;
199
+ }
200
+ if (t && _.label < t[2]) {
201
+ _.label = t[2];
202
+ _.ops.push(op);
203
+ break;
204
+ }
205
+ if (t[2]) _.ops.pop();
206
+ _.trys.pop();
207
+ continue;
208
+ }
209
+ op = body.call(thisArg, _);
210
+ } catch (e) {
211
+ op = [
212
+ 6,
213
+ e
214
+ ];
215
+ y = 0;
216
+ } finally{
217
+ f = t = 0;
218
+ }
219
+ if (op[0] & 5) throw op[1];
220
+ return {
221
+ value: op[0] ? op[1] : void 0,
222
+ done: true
223
+ };
224
+ }
225
+ }
226
+ var parseKnownFiles = function() {
227
+ var _ref = _async_to_generator(function(init) {
228
+ var parsedFiles;
229
+ return _ts_generator(this, function(_state) {
230
+ switch(_state.label){
231
+ case 0:
232
+ return [
233
+ 4,
234
+ index.loadSharedConfigFiles(init)
235
+ ];
236
+ case 1:
237
+ parsedFiles = _state.sent();
238
+ return [
239
+ 2,
240
+ mergeConfigFiles(parsedFiles.configFile, parsedFiles.credentialsFile)
241
+ ];
242
+ }
243
+ });
244
+ });
245
+ return function parseKnownFiles(init) {
246
+ return _ref.apply(this, arguments);
247
+ };
248
+ }();
249
+
250
+ exports.parseKnownFiles = parseKnownFiles;
@@ -0,0 +1,248 @@
1
+ import { l as loadSharedConfigFiles } from './index.esm3.js';
2
+
3
+ function _array_like_to_array(arr, len) {
4
+ if (len == null || len > arr.length) len = arr.length;
5
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
6
+ return arr2;
7
+ }
8
+ function _array_with_holes(arr) {
9
+ if (Array.isArray(arr)) return arr;
10
+ }
11
+ function _iterable_to_array_limit(arr, i) {
12
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
13
+ if (_i == null) return;
14
+ var _arr = [];
15
+ var _n = true;
16
+ var _d = false;
17
+ var _s, _e;
18
+ try {
19
+ for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
20
+ _arr.push(_s.value);
21
+ if (i && _arr.length === i) break;
22
+ }
23
+ } catch (err) {
24
+ _d = true;
25
+ _e = err;
26
+ } finally{
27
+ try {
28
+ if (!_n && _i["return"] != null) _i["return"]();
29
+ } finally{
30
+ if (_d) throw _e;
31
+ }
32
+ }
33
+ return _arr;
34
+ }
35
+ function _non_iterable_rest() {
36
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
37
+ }
38
+ function _sliced_to_array(arr, i) {
39
+ return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
40
+ }
41
+ function _unsupported_iterable_to_array(o, minLen) {
42
+ if (!o) return;
43
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
44
+ var n = Object.prototype.toString.call(o).slice(8, -1);
45
+ if (n === "Object" && o.constructor) n = o.constructor.name;
46
+ if (n === "Map" || n === "Set") return Array.from(n);
47
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
48
+ }
49
+ var mergeConfigFiles = function() {
50
+ for(var _len = arguments.length, files = new Array(_len), _key = 0; _key < _len; _key++){
51
+ files[_key] = arguments[_key];
52
+ }
53
+ var merged = {};
54
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
55
+ try {
56
+ for(var _iterator = files[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
57
+ var file = _step.value;
58
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
59
+ try {
60
+ for(var _iterator1 = Object.entries(file)[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
61
+ var _step_value = _sliced_to_array(_step1.value, 2), key = _step_value[0], values = _step_value[1];
62
+ if (merged[key] !== undefined) {
63
+ Object.assign(merged[key], values);
64
+ } else {
65
+ merged[key] = values;
66
+ }
67
+ }
68
+ } catch (err) {
69
+ _didIteratorError1 = true;
70
+ _iteratorError1 = err;
71
+ } finally{
72
+ try {
73
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
74
+ _iterator1.return();
75
+ }
76
+ } finally{
77
+ if (_didIteratorError1) {
78
+ throw _iteratorError1;
79
+ }
80
+ }
81
+ }
82
+ }
83
+ } catch (err) {
84
+ _didIteratorError = true;
85
+ _iteratorError = err;
86
+ } finally{
87
+ try {
88
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
89
+ _iterator.return();
90
+ }
91
+ } finally{
92
+ if (_didIteratorError) {
93
+ throw _iteratorError;
94
+ }
95
+ }
96
+ }
97
+ return merged;
98
+ };
99
+
100
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
101
+ try {
102
+ var info = gen[key](arg);
103
+ var value = info.value;
104
+ } catch (error) {
105
+ reject(error);
106
+ return;
107
+ }
108
+ if (info.done) {
109
+ resolve(value);
110
+ } else {
111
+ Promise.resolve(value).then(_next, _throw);
112
+ }
113
+ }
114
+ function _async_to_generator(fn) {
115
+ return function() {
116
+ var self = this, args = arguments;
117
+ return new Promise(function(resolve, reject) {
118
+ var gen = fn.apply(self, args);
119
+ function _next(value) {
120
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
121
+ }
122
+ function _throw(err) {
123
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
124
+ }
125
+ _next(undefined);
126
+ });
127
+ };
128
+ }
129
+ function _ts_generator(thisArg, body) {
130
+ var f, y, t, g, _ = {
131
+ label: 0,
132
+ sent: function() {
133
+ if (t[0] & 1) throw t[1];
134
+ return t[1];
135
+ },
136
+ trys: [],
137
+ ops: []
138
+ };
139
+ return g = {
140
+ next: verb(0),
141
+ "throw": verb(1),
142
+ "return": verb(2)
143
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
144
+ return this;
145
+ }), g;
146
+ function verb(n) {
147
+ return function(v) {
148
+ return step([
149
+ n,
150
+ v
151
+ ]);
152
+ };
153
+ }
154
+ function step(op) {
155
+ if (f) throw new TypeError("Generator is already executing.");
156
+ while(_)try {
157
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
158
+ if (y = 0, t) op = [
159
+ op[0] & 2,
160
+ t.value
161
+ ];
162
+ switch(op[0]){
163
+ case 0:
164
+ case 1:
165
+ t = op;
166
+ break;
167
+ case 4:
168
+ _.label++;
169
+ return {
170
+ value: op[1],
171
+ done: false
172
+ };
173
+ case 5:
174
+ _.label++;
175
+ y = op[1];
176
+ op = [
177
+ 0
178
+ ];
179
+ continue;
180
+ case 7:
181
+ op = _.ops.pop();
182
+ _.trys.pop();
183
+ continue;
184
+ default:
185
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
186
+ _ = 0;
187
+ continue;
188
+ }
189
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
190
+ _.label = op[1];
191
+ break;
192
+ }
193
+ if (op[0] === 6 && _.label < t[1]) {
194
+ _.label = t[1];
195
+ t = op;
196
+ break;
197
+ }
198
+ if (t && _.label < t[2]) {
199
+ _.label = t[2];
200
+ _.ops.push(op);
201
+ break;
202
+ }
203
+ if (t[2]) _.ops.pop();
204
+ _.trys.pop();
205
+ continue;
206
+ }
207
+ op = body.call(thisArg, _);
208
+ } catch (e) {
209
+ op = [
210
+ 6,
211
+ e
212
+ ];
213
+ y = 0;
214
+ } finally{
215
+ f = t = 0;
216
+ }
217
+ if (op[0] & 5) throw op[1];
218
+ return {
219
+ value: op[0] ? op[1] : void 0,
220
+ done: true
221
+ };
222
+ }
223
+ }
224
+ var parseKnownFiles = function() {
225
+ var _ref = _async_to_generator(function(init) {
226
+ var parsedFiles;
227
+ return _ts_generator(this, function(_state) {
228
+ switch(_state.label){
229
+ case 0:
230
+ return [
231
+ 4,
232
+ loadSharedConfigFiles(init)
233
+ ];
234
+ case 1:
235
+ parsedFiles = _state.sent();
236
+ return [
237
+ 2,
238
+ mergeConfigFiles(parsedFiles.configFile, parsedFiles.credentialsFile)
239
+ ];
240
+ }
241
+ });
242
+ });
243
+ return function parseKnownFiles(init) {
244
+ return _ref.apply(this, arguments);
245
+ };
246
+ }();
247
+
248
+ export { parseKnownFiles as p };
@@ -0,0 +1,2 @@
1
+ export * from './lib/skill-s3';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
@@ -3,3 +3,4 @@ export declare const upload: (params: any, pinsSettingsList: PinsSettings[], con
3
3
  export declare const download: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<string>;
4
4
  export declare const remove: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<import("@aws-sdk/client-s3").DeleteObjectCommandOutput>;
5
5
  export declare const list: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<import("@aws-sdk/client-s3").ListObjectsV2CommandOutput>;
6
+ //# sourceMappingURL=skill-s3.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skill-s3.d.ts","sourceRoot":"","sources":["../../../src/lib/skill-s3.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AA0EhD,eAAO,MAAM,MAAM,GAAI,QAAQ,GAAG,EAAE,kBAAkB,YAAY,EAAE,EAAE,SAAS,GAAG,iEAC/B,CAAC;AAEpD,eAAO,MAAM,QAAQ,GAAI,QAAQ,GAAG,EAAE,kBAAkB,YAAY,EAAE,EAAE,SAAS,GAAG,oBAC/B,CAAC;AAEtD,eAAO,MAAM,MAAM,GAAI,QAAQ,GAAG,EAAE,kBAAkB,YAAY,EAAE,EAAE,SAAS,GAAG,oEAC/B,CAAC;AAEpD,eAAO,MAAM,IAAI,GAAI,QAAQ,GAAG,EAAE,kBAAkB,YAAY,EAAE,EAAE,SAAS,GAAG,qEAC/B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=skill-s3.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skill-s3.spec.d.ts","sourceRoot":"","sources":["../../../src/lib/skill-s3.spec.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,14 +1,28 @@
1
1
  {
2
2
  "name": "@digipair/skill-s3",
3
- "version": "0.92.1",
3
+ "version": "0.93.0-0",
4
+ "main": "./dist/index.cjs.js",
5
+ "module": "./dist/index.esm.js",
6
+ "types": "./dist/index.d.ts",
4
7
  "keywords": [
5
8
  "digipair",
6
9
  "service",
7
10
  "tool"
8
11
  ],
9
- "dependencies": {
10
- "@aws-sdk/client-s3": "^3.787.0"
12
+ "exports": {
13
+ "./package.json": "./package.json",
14
+ ".": {
15
+ "types": "./dist/index.d.ts",
16
+ "import": "./dist/index.esm.js",
17
+ "default": "./dist/index.cjs.js"
18
+ }
11
19
  },
12
- "main": "./index.cjs.js",
13
- "module": "./index.esm.js"
14
- }
20
+ "files": [
21
+ "dist",
22
+ "!**/*.tsbuildinfo"
23
+ ],
24
+ "nx": {
25
+ "name": "skill-s3"
26
+ },
27
+ "dependencies": {}
28
+ }
package/index.cjs.js DELETED
@@ -1,72 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var clientS3 = require('@aws-sdk/client-s3');
6
-
7
- let S3Service = class S3Service {
8
- getClient(config) {
9
- return new clientS3.S3Client(config);
10
- }
11
- async upload(params, _pinsSettingsList, context) {
12
- const { bucket, key, content, config = context.privates.S3_CONFIG } = params;
13
- const client = this.getClient(config);
14
- const match = content.match(/^data:(.*?);base64,/);
15
- const contentType = match[1];
16
- const command = new clientS3.PutObjectCommand({
17
- Bucket: bucket,
18
- Key: key,
19
- Body: Buffer.from(content.replace(/^data:.*;base64,/, ''), 'base64'),
20
- ContentType: contentType
21
- });
22
- return await client.send(command);
23
- }
24
- async download(params, _pinsSettingsList, context) {
25
- const { bucket, key, range, config = context.privates.S3_CONFIG } = params;
26
- const client = this.getClient(config);
27
- const command = new clientS3.GetObjectCommand({
28
- Bucket: bucket,
29
- Key: key,
30
- Range: range
31
- });
32
- const response = await client.send(command);
33
- const stream = response.Body;
34
- const chunks = [];
35
- for await (const chunk of stream){
36
- chunks.push(chunk);
37
- }
38
- const buffer = Buffer.concat(chunks);
39
- const base64 = buffer.toString('base64');
40
- return `data:${response.ContentType};base64,${base64}`;
41
- }
42
- async delete(params, _pinsSettingsList, context) {
43
- const { bucket, key, config = context.privates.S3_CONFIG } = params;
44
- const client = this.getClient(config);
45
- const command = new clientS3.DeleteObjectCommand({
46
- Bucket: bucket,
47
- Key: key
48
- });
49
- await client.send(command);
50
- return client.send(command);
51
- }
52
- async list(params, _pinsSettingsList, context) {
53
- const { bucket, prefix = '', config = context.privates.S3_CONFIG } = params;
54
- const client = this.getClient(config);
55
- const command = new clientS3.ListObjectsV2Command({
56
- Bucket: bucket,
57
- Prefix: prefix
58
- });
59
- return await client.send(command);
60
- }
61
- };
62
- // Export helpers
63
- const service = new S3Service();
64
- const upload = (params, pinsSettingsList, context)=>service.upload(params, pinsSettingsList, context);
65
- const download = (params, pinsSettingsList, context)=>service.download(params, pinsSettingsList, context);
66
- const remove = (params, pinsSettingsList, context)=>service.delete(params, pinsSettingsList, context);
67
- const list = (params, pinsSettingsList, context)=>service.list(params, pinsSettingsList, context);
68
-
69
- exports.download = download;
70
- exports.list = list;
71
- exports.remove = remove;
72
- exports.upload = upload;
package/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export * from './libs/skill-s3/src/index';