@digipair/skill-s3 0.114.1 → 0.114.2
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/dist/externalDataInterceptor.esm.js +19 -0
- package/dist/getSSOTokenFromFile.esm.js +169 -0
- package/dist/index.esm.js +14 -65
- package/dist/index.esm10.js +1603 -0
- package/dist/index.esm11.js +2635 -0
- package/dist/index.esm2.js +14 -0
- package/dist/index.esm3.js +40088 -0
- package/dist/index.esm4.js +450 -0
- package/dist/index.esm5.js +3677 -0
- package/dist/index.esm6.js +434 -0
- package/dist/index.esm7.js +705 -0
- package/dist/index.esm8.js +1690 -0
- package/dist/index.esm9.js +1519 -0
- package/dist/loadSso.esm.js +2090 -0
- package/dist/noAuth.esm.js +165 -0
- package/dist/package.esm.js +184 -0
- package/dist/parseJsonBody.esm.js +252 -0
- package/dist/parseKnownFiles.esm.js +248 -0
- package/package.json +4 -2
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { t as tokenIntercept } from './getSSOTokenFromFile.esm.js';
|
|
2
|
+
import { g as fileIntercept } from './index.esm3.js';
|
|
3
|
+
|
|
4
|
+
var externalDataInterceptor = {
|
|
5
|
+
getFileRecord: function getFileRecord() {
|
|
6
|
+
return fileIntercept;
|
|
7
|
+
},
|
|
8
|
+
interceptFile: function interceptFile(path, contents) {
|
|
9
|
+
fileIntercept[path] = Promise.resolve(contents);
|
|
10
|
+
},
|
|
11
|
+
getTokenRecord: function getTokenRecord() {
|
|
12
|
+
return tokenIntercept;
|
|
13
|
+
},
|
|
14
|
+
interceptToken: function interceptToken(id, contents) {
|
|
15
|
+
tokenIntercept[id] = contents;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export { externalDataInterceptor as e };
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { promises } from 'fs';
|
|
2
|
+
import { createHash } from 'crypto';
|
|
3
|
+
import { join } from 'path';
|
|
4
|
+
import { h as getHomeDir } from './index.esm3.js';
|
|
5
|
+
|
|
6
|
+
var getSSOTokenFilepath = function(id) {
|
|
7
|
+
var hasher = createHash("sha1");
|
|
8
|
+
var cacheName = hasher.update(id).digest("hex");
|
|
9
|
+
return join(getHomeDir(), ".aws", "sso", "cache", "".concat(cacheName, ".json"));
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
13
|
+
try {
|
|
14
|
+
var info = gen[key](arg);
|
|
15
|
+
var value = info.value;
|
|
16
|
+
} catch (error) {
|
|
17
|
+
reject(error);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
if (info.done) {
|
|
21
|
+
resolve(value);
|
|
22
|
+
} else {
|
|
23
|
+
Promise.resolve(value).then(_next, _throw);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function _async_to_generator(fn) {
|
|
27
|
+
return function() {
|
|
28
|
+
var self = this, args = arguments;
|
|
29
|
+
return new Promise(function(resolve, reject) {
|
|
30
|
+
var gen = fn.apply(self, args);
|
|
31
|
+
function _next(value) {
|
|
32
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
33
|
+
}
|
|
34
|
+
function _throw(err) {
|
|
35
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
36
|
+
}
|
|
37
|
+
_next(undefined);
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function _ts_generator(thisArg, body) {
|
|
42
|
+
var f, y, t, g, _ = {
|
|
43
|
+
label: 0,
|
|
44
|
+
sent: function() {
|
|
45
|
+
if (t[0] & 1) throw t[1];
|
|
46
|
+
return t[1];
|
|
47
|
+
},
|
|
48
|
+
trys: [],
|
|
49
|
+
ops: []
|
|
50
|
+
};
|
|
51
|
+
return g = {
|
|
52
|
+
next: verb(0),
|
|
53
|
+
"throw": verb(1),
|
|
54
|
+
"return": verb(2)
|
|
55
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
56
|
+
return this;
|
|
57
|
+
}), g;
|
|
58
|
+
function verb(n) {
|
|
59
|
+
return function(v) {
|
|
60
|
+
return step([
|
|
61
|
+
n,
|
|
62
|
+
v
|
|
63
|
+
]);
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
function step(op) {
|
|
67
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
68
|
+
while(_)try {
|
|
69
|
+
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;
|
|
70
|
+
if (y = 0, t) op = [
|
|
71
|
+
op[0] & 2,
|
|
72
|
+
t.value
|
|
73
|
+
];
|
|
74
|
+
switch(op[0]){
|
|
75
|
+
case 0:
|
|
76
|
+
case 1:
|
|
77
|
+
t = op;
|
|
78
|
+
break;
|
|
79
|
+
case 4:
|
|
80
|
+
_.label++;
|
|
81
|
+
return {
|
|
82
|
+
value: op[1],
|
|
83
|
+
done: false
|
|
84
|
+
};
|
|
85
|
+
case 5:
|
|
86
|
+
_.label++;
|
|
87
|
+
y = op[1];
|
|
88
|
+
op = [
|
|
89
|
+
0
|
|
90
|
+
];
|
|
91
|
+
continue;
|
|
92
|
+
case 7:
|
|
93
|
+
op = _.ops.pop();
|
|
94
|
+
_.trys.pop();
|
|
95
|
+
continue;
|
|
96
|
+
default:
|
|
97
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
98
|
+
_ = 0;
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
102
|
+
_.label = op[1];
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
106
|
+
_.label = t[1];
|
|
107
|
+
t = op;
|
|
108
|
+
break;
|
|
109
|
+
}
|
|
110
|
+
if (t && _.label < t[2]) {
|
|
111
|
+
_.label = t[2];
|
|
112
|
+
_.ops.push(op);
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
if (t[2]) _.ops.pop();
|
|
116
|
+
_.trys.pop();
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
op = body.call(thisArg, _);
|
|
120
|
+
} catch (e) {
|
|
121
|
+
op = [
|
|
122
|
+
6,
|
|
123
|
+
e
|
|
124
|
+
];
|
|
125
|
+
y = 0;
|
|
126
|
+
} finally{
|
|
127
|
+
f = t = 0;
|
|
128
|
+
}
|
|
129
|
+
if (op[0] & 5) throw op[1];
|
|
130
|
+
return {
|
|
131
|
+
value: op[0] ? op[1] : void 0,
|
|
132
|
+
done: true
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
var readFile = promises.readFile;
|
|
137
|
+
var tokenIntercept = {};
|
|
138
|
+
var getSSOTokenFromFile = function() {
|
|
139
|
+
var _ref = _async_to_generator(function(id) {
|
|
140
|
+
var ssoTokenFilepath, ssoTokenText;
|
|
141
|
+
return _ts_generator(this, function(_state) {
|
|
142
|
+
switch(_state.label){
|
|
143
|
+
case 0:
|
|
144
|
+
if (tokenIntercept[id]) {
|
|
145
|
+
return [
|
|
146
|
+
2,
|
|
147
|
+
tokenIntercept[id]
|
|
148
|
+
];
|
|
149
|
+
}
|
|
150
|
+
ssoTokenFilepath = getSSOTokenFilepath(id);
|
|
151
|
+
return [
|
|
152
|
+
4,
|
|
153
|
+
readFile(ssoTokenFilepath, "utf8")
|
|
154
|
+
];
|
|
155
|
+
case 1:
|
|
156
|
+
ssoTokenText = _state.sent();
|
|
157
|
+
return [
|
|
158
|
+
2,
|
|
159
|
+
JSON.parse(ssoTokenText)
|
|
160
|
+
];
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
return function getSSOTokenFromFile(id) {
|
|
165
|
+
return _ref.apply(this, arguments);
|
|
166
|
+
};
|
|
167
|
+
}();
|
|
168
|
+
|
|
169
|
+
export { getSSOTokenFromFile as a, getSSOTokenFilepath as g, tokenIntercept as t };
|
package/dist/index.esm.js
CHANGED
|
@@ -1,65 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
Body: Buffer.from(content.replace(/^data:.*;base64,/, ''), 'base64'),
|
|
16
|
-
ContentType: contentType
|
|
17
|
-
});
|
|
18
|
-
return await client.send(command);
|
|
19
|
-
}
|
|
20
|
-
async download(params, _pinsSettingsList, context) {
|
|
21
|
-
const { bucket, key, range, config = context.privates.S3_CONFIG } = params;
|
|
22
|
-
const client = this.getClient(config);
|
|
23
|
-
const command = new GetObjectCommand({
|
|
24
|
-
Bucket: bucket,
|
|
25
|
-
Key: key,
|
|
26
|
-
Range: range
|
|
27
|
-
});
|
|
28
|
-
const response = await client.send(command);
|
|
29
|
-
const stream = response.Body;
|
|
30
|
-
const chunks = [];
|
|
31
|
-
for await (const chunk of stream){
|
|
32
|
-
chunks.push(chunk);
|
|
33
|
-
}
|
|
34
|
-
const buffer = Buffer.concat(chunks);
|
|
35
|
-
const base64 = buffer.toString('base64');
|
|
36
|
-
return `data:${response.ContentType};base64,${base64}`;
|
|
37
|
-
}
|
|
38
|
-
async delete(params, _pinsSettingsList, context) {
|
|
39
|
-
const { bucket, key, config = context.privates.S3_CONFIG } = params;
|
|
40
|
-
const client = this.getClient(config);
|
|
41
|
-
const command = new DeleteObjectCommand({
|
|
42
|
-
Bucket: bucket,
|
|
43
|
-
Key: key
|
|
44
|
-
});
|
|
45
|
-
await client.send(command);
|
|
46
|
-
return client.send(command);
|
|
47
|
-
}
|
|
48
|
-
async list(params, _pinsSettingsList, context) {
|
|
49
|
-
const { bucket, prefix = '', config = context.privates.S3_CONFIG } = params;
|
|
50
|
-
const client = this.getClient(config);
|
|
51
|
-
const command = new ListObjectsV2Command({
|
|
52
|
-
Bucket: bucket,
|
|
53
|
-
Prefix: prefix
|
|
54
|
-
});
|
|
55
|
-
return await client.send(command);
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
// Export helpers
|
|
59
|
-
const service = new S3Service();
|
|
60
|
-
const upload = (params, pinsSettingsList, context)=>service.upload(params, pinsSettingsList, context);
|
|
61
|
-
const download = (params, pinsSettingsList, context)=>service.download(params, pinsSettingsList, context);
|
|
62
|
-
const remove = (params, pinsSettingsList, context)=>service.delete(params, pinsSettingsList, context);
|
|
63
|
-
const list = (params, pinsSettingsList, context)=>service.list(params, pinsSettingsList, context);
|
|
64
|
-
|
|
65
|
-
export { download, list, remove, upload };
|
|
1
|
+
export { aJ as download, aL as list, aK as remove, aI as upload } from './index.esm3.js';
|
|
2
|
+
import 'buffer';
|
|
3
|
+
import 'path';
|
|
4
|
+
import 'os';
|
|
5
|
+
import 'fs';
|
|
6
|
+
import 'stream';
|
|
7
|
+
import 'crypto';
|
|
8
|
+
import 'http';
|
|
9
|
+
import 'https';
|
|
10
|
+
import 'process';
|
|
11
|
+
import 'node:fs';
|
|
12
|
+
import 'async_hooks';
|
|
13
|
+
import 'zlib';
|
|
14
|
+
import 'node:stream';
|