@digipair/skill-s3 0.136.0 → 0.136.3
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/AwsRestJsonProtocol.esm.js +1773 -0
- package/dist/create-aggregated-client.esm.js +366 -0
- package/dist/getSSOTokenFromFile.esm.js +4 -4
- package/dist/index.esm.js +8 -10
- package/dist/index.esm10.js +89 -81
- package/dist/index.esm11.js +1416 -1014
- package/dist/index.esm12.js +790 -3214
- package/dist/index.esm13.js +1600 -896
- package/dist/index.esm2.js +8 -10
- package/dist/index.esm3.js +40820 -47659
- package/dist/index.esm4.js +275 -780
- package/dist/index.esm5.js +4925 -113
- package/dist/index.esm6.js +865 -4383
- package/dist/index.esm7.js +10 -13
- package/dist/index.esm8.js +320 -1273
- package/dist/index.esm9.js +1367 -2081
- package/dist/loadSso.esm.js +1115 -1939
- package/dist/package.esm.js +316 -0
- package/package.json +1 -1
- package/dist/index.esm14.js +0 -7181
- package/dist/noAuth.esm.js +0 -165
- package/dist/parseJsonBody.esm.js +0 -216
- package/dist/src/index.d.ts +0 -2
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/lib/skill-s3.d.ts +0 -6
- package/dist/src/lib/skill-s3.d.ts.map +0 -1
package/dist/index.esm9.js
CHANGED
|
@@ -1,433 +1,255 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import '
|
|
7
|
-
import 'path';
|
|
8
|
-
import 'os';
|
|
1
|
+
import { C as CredentialsProviderError, a4 as chain, s as setCredentialFeature, x as getProfileName, a5 as readFile, y as HttpRequest } from './index.esm3.js';
|
|
2
|
+
import { createHash, createPrivateKey, createPublicKey, sign } from 'node:crypto';
|
|
3
|
+
import { promises } from 'node:fs';
|
|
4
|
+
import { homedir } from 'node:os';
|
|
5
|
+
import { join, dirname } from 'node:path';
|
|
6
|
+
import { p as parseKnownFiles } from './parseKnownFiles.esm.js';
|
|
9
7
|
import 'node:fs/promises';
|
|
10
|
-
import 'crypto';
|
|
11
8
|
import 'node:stream';
|
|
12
|
-
import 'process';
|
|
13
|
-
import '
|
|
14
|
-
import '
|
|
15
|
-
|
|
16
|
-
function setCredentialFeature(credentials, feature, value) {
|
|
17
|
-
if (!credentials.$source) {
|
|
18
|
-
credentials.$source = {};
|
|
19
|
-
}
|
|
20
|
-
credentials.$source[feature] = value;
|
|
21
|
-
return credentials;
|
|
22
|
-
}
|
|
9
|
+
import 'node:process';
|
|
10
|
+
import 'buffer';
|
|
11
|
+
import 'node:https';
|
|
12
|
+
import 'node:zlib';
|
|
23
13
|
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
function _class_call_check$5(instance, Constructor) {
|
|
33
|
-
if (!(instance instanceof Constructor)) {
|
|
34
|
-
throw new TypeError("Cannot call a class as a function");
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
function _defineProperties$4(target, props) {
|
|
38
|
-
for(var i = 0; i < props.length; i++){
|
|
39
|
-
var descriptor = props[i];
|
|
40
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
41
|
-
descriptor.configurable = true;
|
|
42
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
43
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
function _create_class$4(Constructor, protoProps, staticProps) {
|
|
47
|
-
if (protoProps) _defineProperties$4(Constructor.prototype, protoProps);
|
|
48
|
-
if (staticProps) _defineProperties$4(Constructor, staticProps);
|
|
49
|
-
return Constructor;
|
|
50
|
-
}
|
|
51
|
-
function _define_property$5(obj, key, value) {
|
|
52
|
-
if (key in obj) {
|
|
53
|
-
Object.defineProperty(obj, key, {
|
|
54
|
-
value: value,
|
|
55
|
-
enumerable: true,
|
|
56
|
-
configurable: true,
|
|
57
|
-
writable: true
|
|
58
|
-
});
|
|
59
|
-
} else {
|
|
60
|
-
obj[key] = value;
|
|
61
|
-
}
|
|
62
|
-
return obj;
|
|
63
|
-
}
|
|
64
|
-
function _iterable_to_array(iter) {
|
|
65
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
66
|
-
}
|
|
67
|
-
function _non_iterable_spread() {
|
|
68
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
69
|
-
}
|
|
70
|
-
function _object_spread$1(target) {
|
|
71
|
-
for(var i = 1; i < arguments.length; i++){
|
|
72
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
73
|
-
var ownKeys = Object.keys(source);
|
|
74
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
75
|
-
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
76
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
77
|
-
}));
|
|
78
|
-
}
|
|
79
|
-
ownKeys.forEach(function(key) {
|
|
80
|
-
_define_property$5(target, key, source[key]);
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
return target;
|
|
84
|
-
}
|
|
85
|
-
function ownKeys$1(object, enumerableOnly) {
|
|
86
|
-
var keys = Object.keys(object);
|
|
87
|
-
if (Object.getOwnPropertySymbols) {
|
|
88
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
89
|
-
keys.push.apply(keys, symbols);
|
|
14
|
+
function asyncGeneratorStep$a(gen, resolve, reject, _next, _throw, key, arg) {
|
|
15
|
+
try {
|
|
16
|
+
var info = gen[key](arg);
|
|
17
|
+
var value = info.value;
|
|
18
|
+
} catch (error) {
|
|
19
|
+
reject(error);
|
|
20
|
+
return;
|
|
90
21
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
function _object_spread_props$1(target, source) {
|
|
94
|
-
source = source != null ? source : {};
|
|
95
|
-
if (Object.getOwnPropertyDescriptors) {
|
|
96
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
22
|
+
if (info.done) {
|
|
23
|
+
resolve(value);
|
|
97
24
|
} else {
|
|
98
|
-
|
|
99
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
100
|
-
});
|
|
25
|
+
Promise.resolve(value).then(_next, _throw);
|
|
101
26
|
}
|
|
102
|
-
return target;
|
|
103
|
-
}
|
|
104
|
-
function _to_consumable_array(arr) {
|
|
105
|
-
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array$2(arr) || _non_iterable_spread();
|
|
106
|
-
}
|
|
107
|
-
function _type_of$7(obj) {
|
|
108
|
-
"@swc/helpers - typeof";
|
|
109
|
-
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
110
|
-
}
|
|
111
|
-
function _unsupported_iterable_to_array$2(o, minLen) {
|
|
112
|
-
if (!o) return;
|
|
113
|
-
if (typeof o === "string") return _array_like_to_array$2(o, minLen);
|
|
114
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
115
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
116
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
117
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$2(o, minLen);
|
|
118
27
|
}
|
|
119
|
-
|
|
120
|
-
function
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
_define_property$5(this, "path", void 0);
|
|
127
|
-
_define_property$5(this, "query", void 0);
|
|
128
|
-
_define_property$5(this, "headers", void 0);
|
|
129
|
-
_define_property$5(this, "username", void 0);
|
|
130
|
-
_define_property$5(this, "password", void 0);
|
|
131
|
-
_define_property$5(this, "fragment", void 0);
|
|
132
|
-
_define_property$5(this, "body", void 0);
|
|
133
|
-
this.method = options.method || "GET";
|
|
134
|
-
this.hostname = options.hostname || "localhost";
|
|
135
|
-
this.port = options.port;
|
|
136
|
-
this.query = options.query || {};
|
|
137
|
-
this.headers = options.headers || {};
|
|
138
|
-
this.body = options.body;
|
|
139
|
-
this.protocol = options.protocol ? options.protocol.slice(-1) !== ":" ? "".concat(options.protocol, ":") : options.protocol : "https:";
|
|
140
|
-
this.path = options.path ? options.path.charAt(0) !== "/" ? "/".concat(options.path) : options.path : "/";
|
|
141
|
-
this.username = options.username;
|
|
142
|
-
this.password = options.password;
|
|
143
|
-
this.fragment = options.fragment;
|
|
144
|
-
}
|
|
145
|
-
_create_class$4(HttpRequest, [
|
|
146
|
-
{
|
|
147
|
-
key: "clone",
|
|
148
|
-
value: function clone() {
|
|
149
|
-
return HttpRequest.clone(this);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
], [
|
|
153
|
-
{
|
|
154
|
-
key: "clone",
|
|
155
|
-
value: function clone(request) {
|
|
156
|
-
var cloned = new HttpRequest(_object_spread_props$1(_object_spread$1({}, request), {
|
|
157
|
-
headers: _object_spread$1({}, request.headers)
|
|
158
|
-
}));
|
|
159
|
-
if (cloned.query) {
|
|
160
|
-
cloned.query = cloneQuery(cloned.query);
|
|
161
|
-
}
|
|
162
|
-
return cloned;
|
|
28
|
+
function _async_to_generator$a(fn) {
|
|
29
|
+
return function() {
|
|
30
|
+
var self = this, args = arguments;
|
|
31
|
+
return new Promise(function(resolve, reject) {
|
|
32
|
+
var gen = fn.apply(self, args);
|
|
33
|
+
function _next(value) {
|
|
34
|
+
asyncGeneratorStep$a(gen, resolve, reject, _next, _throw, "next", value);
|
|
163
35
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
key: "isInstance",
|
|
167
|
-
value: function isInstance(request) {
|
|
168
|
-
if (!request) {
|
|
169
|
-
return false;
|
|
170
|
-
}
|
|
171
|
-
var req = request;
|
|
172
|
-
return "method" in req && "protocol" in req && "hostname" in req && "path" in req && _type_of$7(req["query"]) === "object" && _type_of$7(req["headers"]) === "object";
|
|
36
|
+
function _throw(err) {
|
|
37
|
+
asyncGeneratorStep$a(gen, resolve, reject, _next, _throw, "throw", err);
|
|
173
38
|
}
|
|
174
|
-
|
|
175
|
-
]);
|
|
176
|
-
return HttpRequest;
|
|
177
|
-
}();
|
|
178
|
-
function cloneQuery(query) {
|
|
179
|
-
return Object.keys(query).reduce(function(carry, paramName) {
|
|
180
|
-
var param = query[paramName];
|
|
181
|
-
return _object_spread_props$1(_object_spread$1({}, carry), _define_property$5({}, paramName, Array.isArray(param) ? _to_consumable_array(param) : param));
|
|
182
|
-
}, {});
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
function _class_call_check$4(instance, Constructor) {
|
|
186
|
-
if (!(instance instanceof Constructor)) {
|
|
187
|
-
throw new TypeError("Cannot call a class as a function");
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
function _defineProperties$3(target, props) {
|
|
191
|
-
for(var i = 0; i < props.length; i++){
|
|
192
|
-
var descriptor = props[i];
|
|
193
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
194
|
-
descriptor.configurable = true;
|
|
195
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
196
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
function _create_class$3(Constructor, protoProps, staticProps) {
|
|
200
|
-
if (staticProps) _defineProperties$3(Constructor, staticProps);
|
|
201
|
-
return Constructor;
|
|
202
|
-
}
|
|
203
|
-
function _define_property$4(obj, key, value) {
|
|
204
|
-
if (key in obj) {
|
|
205
|
-
Object.defineProperty(obj, key, {
|
|
206
|
-
value: value,
|
|
207
|
-
enumerable: true,
|
|
208
|
-
configurable: true,
|
|
209
|
-
writable: true
|
|
39
|
+
_next(undefined);
|
|
210
40
|
});
|
|
211
|
-
}
|
|
212
|
-
obj[key] = value;
|
|
213
|
-
}
|
|
214
|
-
return obj;
|
|
215
|
-
}
|
|
216
|
-
function _type_of$6(obj) {
|
|
217
|
-
"@swc/helpers - typeof";
|
|
218
|
-
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
41
|
+
};
|
|
219
42
|
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
function buildQueryString(query) {
|
|
246
|
-
var parts = [];
|
|
247
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
248
|
-
try {
|
|
249
|
-
for(var _iterator = Object.keys(query).sort()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
250
|
-
var key = _step.value;
|
|
251
|
-
var value = query[key];
|
|
252
|
-
key = escapeUri(key);
|
|
253
|
-
if (Array.isArray(value)) {
|
|
254
|
-
for(var i = 0, iLen = value.length; i < iLen; i++){
|
|
255
|
-
parts.push("".concat(key, "=").concat(escapeUri(value[i])));
|
|
256
|
-
}
|
|
257
|
-
} else {
|
|
258
|
-
var qsEntry = key;
|
|
259
|
-
if (value || typeof value === "string") {
|
|
260
|
-
qsEntry += "=".concat(escapeUri(value));
|
|
261
|
-
}
|
|
262
|
-
parts.push(qsEntry);
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
} catch (err) {
|
|
266
|
-
_didIteratorError = true;
|
|
267
|
-
_iteratorError = err;
|
|
268
|
-
} finally{
|
|
269
|
-
try {
|
|
270
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
271
|
-
_iterator.return();
|
|
272
|
-
}
|
|
273
|
-
} finally{
|
|
274
|
-
if (_didIteratorError) {
|
|
275
|
-
throw _iteratorError;
|
|
276
|
-
}
|
|
277
|
-
}
|
|
43
|
+
function _ts_generator$a(thisArg, body) {
|
|
44
|
+
var f, y, t, g, _ = {
|
|
45
|
+
label: 0,
|
|
46
|
+
sent: function() {
|
|
47
|
+
if (t[0] & 1) throw t[1];
|
|
48
|
+
return t[1];
|
|
49
|
+
},
|
|
50
|
+
trys: [],
|
|
51
|
+
ops: []
|
|
52
|
+
};
|
|
53
|
+
return g = {
|
|
54
|
+
next: verb(0),
|
|
55
|
+
"throw": verb(1),
|
|
56
|
+
"return": verb(2)
|
|
57
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
58
|
+
return this;
|
|
59
|
+
}), g;
|
|
60
|
+
function verb(n) {
|
|
61
|
+
return function(v) {
|
|
62
|
+
return step([
|
|
63
|
+
n,
|
|
64
|
+
v
|
|
65
|
+
]);
|
|
66
|
+
};
|
|
278
67
|
}
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
];
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
68
|
+
function step(op) {
|
|
69
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
70
|
+
while(_)try {
|
|
71
|
+
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;
|
|
72
|
+
if (y = 0, t) op = [
|
|
73
|
+
op[0] & 2,
|
|
74
|
+
t.value
|
|
75
|
+
];
|
|
76
|
+
switch(op[0]){
|
|
77
|
+
case 0:
|
|
78
|
+
case 1:
|
|
79
|
+
t = op;
|
|
80
|
+
break;
|
|
81
|
+
case 4:
|
|
82
|
+
_.label++;
|
|
83
|
+
return {
|
|
84
|
+
value: op[1],
|
|
85
|
+
done: false
|
|
86
|
+
};
|
|
87
|
+
case 5:
|
|
88
|
+
_.label++;
|
|
89
|
+
y = op[1];
|
|
90
|
+
op = [
|
|
91
|
+
0
|
|
92
|
+
];
|
|
93
|
+
continue;
|
|
94
|
+
case 7:
|
|
95
|
+
op = _.ops.pop();
|
|
96
|
+
_.trys.pop();
|
|
97
|
+
continue;
|
|
98
|
+
default:
|
|
99
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
100
|
+
_ = 0;
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
104
|
+
_.label = op[1];
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
108
|
+
_.label = t[1];
|
|
109
|
+
t = op;
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
if (t && _.label < t[2]) {
|
|
113
|
+
_.label = t[2];
|
|
114
|
+
_.ops.push(op);
|
|
115
|
+
break;
|
|
116
|
+
}
|
|
117
|
+
if (t[2]) _.ops.pop();
|
|
118
|
+
_.trys.pop();
|
|
119
|
+
continue;
|
|
304
120
|
}
|
|
121
|
+
op = body.call(thisArg, _);
|
|
122
|
+
} catch (e) {
|
|
123
|
+
op = [
|
|
124
|
+
6,
|
|
125
|
+
e
|
|
126
|
+
];
|
|
127
|
+
y = 0;
|
|
305
128
|
} finally{
|
|
306
|
-
|
|
307
|
-
throw _iteratorError;
|
|
308
|
-
}
|
|
129
|
+
f = t = 0;
|
|
309
130
|
}
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
var timing = {
|
|
315
|
-
setTimeout: function(cb, ms) {
|
|
316
|
-
return setTimeout(cb, ms);
|
|
317
|
-
},
|
|
318
|
-
clearTimeout: function(timeoutId) {
|
|
319
|
-
return clearTimeout(timeoutId);
|
|
320
|
-
}
|
|
321
|
-
};
|
|
322
|
-
|
|
323
|
-
var DEFER_EVENT_LISTENER_TIME$2 = 1000;
|
|
324
|
-
var setConnectionTimeout = function(request, reject) {
|
|
325
|
-
var timeoutInMs = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0;
|
|
326
|
-
if (!timeoutInMs) {
|
|
327
|
-
return -1;
|
|
328
|
-
}
|
|
329
|
-
var registerTimeout = function(offset) {
|
|
330
|
-
var timeoutId = timing.setTimeout(function() {
|
|
331
|
-
request.destroy();
|
|
332
|
-
reject(Object.assign(new Error("@smithy/node-http-handler - the request socket did not establish a connection with the server within the configured timeout of ".concat(timeoutInMs, " ms.")), {
|
|
333
|
-
name: "TimeoutError"
|
|
334
|
-
}));
|
|
335
|
-
}, timeoutInMs - offset);
|
|
336
|
-
var doWithSocket = function(socket) {
|
|
337
|
-
if (socket === null || socket === void 0 ? void 0 : socket.connecting) {
|
|
338
|
-
socket.on("connect", function() {
|
|
339
|
-
timing.clearTimeout(timeoutId);
|
|
340
|
-
});
|
|
341
|
-
} else {
|
|
342
|
-
timing.clearTimeout(timeoutId);
|
|
343
|
-
}
|
|
131
|
+
if (op[0] & 5) throw op[1];
|
|
132
|
+
return {
|
|
133
|
+
value: op[0] ? op[1] : void 0,
|
|
134
|
+
done: true
|
|
344
135
|
};
|
|
345
|
-
if (request.socket) {
|
|
346
|
-
doWithSocket(request.socket);
|
|
347
|
-
} else {
|
|
348
|
-
request.on("socket", doWithSocket);
|
|
349
|
-
}
|
|
350
|
-
};
|
|
351
|
-
if (timeoutInMs < 2000) {
|
|
352
|
-
registerTimeout(0);
|
|
353
|
-
return 0;
|
|
354
136
|
}
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
137
|
+
}
|
|
138
|
+
var resolveCredentialSource = function(credentialSource, profileName, logger) {
|
|
139
|
+
var sourceProvidersMap = {
|
|
140
|
+
EcsContainer: function() {
|
|
141
|
+
var _ref = _async_to_generator$a(function(options) {
|
|
142
|
+
var fromHttp, fromContainerMetadata;
|
|
143
|
+
return _ts_generator$a(this, function(_state) {
|
|
144
|
+
switch(_state.label){
|
|
145
|
+
case 0:
|
|
146
|
+
return [
|
|
147
|
+
4,
|
|
148
|
+
import('./index.esm8.js')
|
|
149
|
+
];
|
|
150
|
+
case 1:
|
|
151
|
+
fromHttp = _state.sent().fromHttp;
|
|
152
|
+
return [
|
|
153
|
+
4,
|
|
154
|
+
import('./index.esm10.js')
|
|
155
|
+
];
|
|
156
|
+
case 2:
|
|
157
|
+
fromContainerMetadata = _state.sent().fromContainerMetadata;
|
|
158
|
+
logger === null || logger === void 0 ? void 0 : logger.debug("@aws-sdk/credential-provider-ini - credential_source is EcsContainer");
|
|
159
|
+
return [
|
|
160
|
+
2,
|
|
161
|
+
/*#__PURE__*/ _async_to_generator$a(function() {
|
|
162
|
+
return _ts_generator$a(this, function(_state) {
|
|
163
|
+
return [
|
|
164
|
+
2,
|
|
165
|
+
chain(fromHttp(options !== null && options !== void 0 ? options : {}), fromContainerMetadata(options))().then(setNamedProvider)
|
|
166
|
+
];
|
|
167
|
+
});
|
|
168
|
+
})
|
|
169
|
+
];
|
|
170
|
+
}
|
|
367
171
|
});
|
|
368
|
-
req.destroy(error);
|
|
369
|
-
reject(error);
|
|
370
|
-
} else {
|
|
371
|
-
var _logger_warn;
|
|
372
|
-
msg += " Init client requestHandler with throwOnRequestTimeout=true to turn this into an error.";
|
|
373
|
-
logger === null || logger === void 0 ? void 0 : (_logger_warn = logger.warn) === null || _logger_warn === void 0 ? void 0 : _logger_warn.call(logger, msg);
|
|
374
|
-
}
|
|
375
|
-
}, timeoutInMs);
|
|
376
|
-
}
|
|
377
|
-
return -1;
|
|
378
|
-
};
|
|
379
|
-
|
|
380
|
-
var DEFER_EVENT_LISTENER_TIME$1 = 3000;
|
|
381
|
-
var setSocketKeepAlive = function(request, param) {
|
|
382
|
-
var keepAlive = param.keepAlive, keepAliveMsecs = param.keepAliveMsecs, deferTimeMs = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : DEFER_EVENT_LISTENER_TIME$1;
|
|
383
|
-
if (keepAlive !== true) {
|
|
384
|
-
return -1;
|
|
385
|
-
}
|
|
386
|
-
var registerListener = function() {
|
|
387
|
-
if (request.socket) {
|
|
388
|
-
request.socket.setKeepAlive(keepAlive, keepAliveMsecs || 0);
|
|
389
|
-
} else {
|
|
390
|
-
request.on("socket", function(socket) {
|
|
391
|
-
socket.setKeepAlive(keepAlive, keepAliveMsecs || 0);
|
|
392
172
|
});
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
173
|
+
return function(options) {
|
|
174
|
+
return _ref.apply(this, arguments);
|
|
175
|
+
};
|
|
176
|
+
}(),
|
|
177
|
+
Ec2InstanceMetadata: function() {
|
|
178
|
+
var _ref = _async_to_generator$a(function(options) {
|
|
179
|
+
var fromInstanceMetadata;
|
|
180
|
+
return _ts_generator$a(this, function(_state) {
|
|
181
|
+
switch(_state.label){
|
|
182
|
+
case 0:
|
|
183
|
+
logger === null || logger === void 0 ? void 0 : logger.debug("@aws-sdk/credential-provider-ini - credential_source is Ec2InstanceMetadata");
|
|
184
|
+
return [
|
|
185
|
+
4,
|
|
186
|
+
import('./index.esm10.js')
|
|
187
|
+
];
|
|
188
|
+
case 1:
|
|
189
|
+
fromInstanceMetadata = _state.sent().fromInstanceMetadata;
|
|
190
|
+
return [
|
|
191
|
+
2,
|
|
192
|
+
/*#__PURE__*/ _async_to_generator$a(function() {
|
|
193
|
+
return _ts_generator$a(this, function(_state) {
|
|
194
|
+
return [
|
|
195
|
+
2,
|
|
196
|
+
fromInstanceMetadata(options)().then(setNamedProvider)
|
|
197
|
+
];
|
|
198
|
+
});
|
|
199
|
+
})
|
|
200
|
+
];
|
|
201
|
+
}
|
|
202
|
+
});
|
|
418
203
|
});
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
204
|
+
return function(options) {
|
|
205
|
+
return _ref.apply(this, arguments);
|
|
206
|
+
};
|
|
207
|
+
}(),
|
|
208
|
+
Environment: function() {
|
|
209
|
+
var _ref = _async_to_generator$a(function(options) {
|
|
210
|
+
var fromEnv;
|
|
211
|
+
return _ts_generator$a(this, function(_state) {
|
|
212
|
+
switch(_state.label){
|
|
213
|
+
case 0:
|
|
214
|
+
logger === null || logger === void 0 ? void 0 : logger.debug("@aws-sdk/credential-provider-ini - credential_source is Environment");
|
|
215
|
+
return [
|
|
216
|
+
4,
|
|
217
|
+
import('./index.esm2.js')
|
|
218
|
+
];
|
|
219
|
+
case 1:
|
|
220
|
+
fromEnv = _state.sent().fromEnv;
|
|
221
|
+
return [
|
|
222
|
+
2,
|
|
223
|
+
/*#__PURE__*/ _async_to_generator$a(function() {
|
|
224
|
+
return _ts_generator$a(this, function(_state) {
|
|
225
|
+
return [
|
|
226
|
+
2,
|
|
227
|
+
fromEnv(options)().then(setNamedProvider)
|
|
228
|
+
];
|
|
229
|
+
});
|
|
230
|
+
})
|
|
231
|
+
];
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
});
|
|
235
|
+
return function(options) {
|
|
236
|
+
return _ref.apply(this, arguments);
|
|
237
|
+
};
|
|
238
|
+
}()
|
|
422
239
|
};
|
|
423
|
-
if (
|
|
424
|
-
|
|
425
|
-
|
|
240
|
+
if (credentialSource in sourceProvidersMap) {
|
|
241
|
+
return sourceProvidersMap[credentialSource];
|
|
242
|
+
} else {
|
|
243
|
+
throw new CredentialsProviderError("Unsupported credential source in profile ".concat(profileName, ". Got ").concat(credentialSource, ", ") + "expected EcsContainer or Ec2InstanceMetadata or Environment.", {
|
|
244
|
+
logger: logger
|
|
245
|
+
});
|
|
426
246
|
}
|
|
427
|
-
|
|
247
|
+
};
|
|
248
|
+
var setNamedProvider = function(creds) {
|
|
249
|
+
return setCredentialFeature(creds, "CREDENTIALS_PROFILE_NAMED_PROVIDER", "p");
|
|
428
250
|
};
|
|
429
251
|
|
|
430
|
-
function asyncGeneratorStep$
|
|
252
|
+
function asyncGeneratorStep$9(gen, resolve, reject, _next, _throw, key, arg) {
|
|
431
253
|
try {
|
|
432
254
|
var info = gen[key](arg);
|
|
433
255
|
var value = info.value;
|
|
@@ -441,33 +263,73 @@ function asyncGeneratorStep$8(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
441
263
|
Promise.resolve(value).then(_next, _throw);
|
|
442
264
|
}
|
|
443
265
|
}
|
|
444
|
-
function _async_to_generator$
|
|
266
|
+
function _async_to_generator$9(fn) {
|
|
445
267
|
return function() {
|
|
446
268
|
var self = this, args = arguments;
|
|
447
269
|
return new Promise(function(resolve, reject) {
|
|
448
270
|
var gen = fn.apply(self, args);
|
|
449
271
|
function _next(value) {
|
|
450
|
-
asyncGeneratorStep$
|
|
272
|
+
asyncGeneratorStep$9(gen, resolve, reject, _next, _throw, "next", value);
|
|
451
273
|
}
|
|
452
274
|
function _throw(err) {
|
|
453
|
-
asyncGeneratorStep$
|
|
275
|
+
asyncGeneratorStep$9(gen, resolve, reject, _next, _throw, "throw", err);
|
|
454
276
|
}
|
|
455
277
|
_next(undefined);
|
|
456
278
|
});
|
|
457
279
|
};
|
|
458
280
|
}
|
|
459
|
-
function
|
|
460
|
-
if (
|
|
461
|
-
|
|
281
|
+
function _define_property$4(obj, key, value) {
|
|
282
|
+
if (key in obj) {
|
|
283
|
+
Object.defineProperty(obj, key, {
|
|
284
|
+
value: value,
|
|
285
|
+
enumerable: true,
|
|
286
|
+
configurable: true,
|
|
287
|
+
writable: true
|
|
288
|
+
});
|
|
462
289
|
} else {
|
|
463
|
-
|
|
290
|
+
obj[key] = value;
|
|
291
|
+
}
|
|
292
|
+
return obj;
|
|
293
|
+
}
|
|
294
|
+
function _object_spread$4(target) {
|
|
295
|
+
for(var i = 1; i < arguments.length; i++){
|
|
296
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
297
|
+
var ownKeys = Object.keys(source);
|
|
298
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
299
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
300
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
301
|
+
}));
|
|
302
|
+
}
|
|
303
|
+
ownKeys.forEach(function(key) {
|
|
304
|
+
_define_property$4(target, key, source[key]);
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
return target;
|
|
308
|
+
}
|
|
309
|
+
function ownKeys$3(object, enumerableOnly) {
|
|
310
|
+
var keys = Object.keys(object);
|
|
311
|
+
if (Object.getOwnPropertySymbols) {
|
|
312
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
313
|
+
keys.push.apply(keys, symbols);
|
|
314
|
+
}
|
|
315
|
+
return keys;
|
|
316
|
+
}
|
|
317
|
+
function _object_spread_props$3(target, source) {
|
|
318
|
+
source = source != null ? source : {};
|
|
319
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
320
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
321
|
+
} else {
|
|
322
|
+
ownKeys$3(Object(source)).forEach(function(key) {
|
|
323
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
324
|
+
});
|
|
464
325
|
}
|
|
326
|
+
return target;
|
|
465
327
|
}
|
|
466
|
-
function _type_of$
|
|
328
|
+
function _type_of$3(obj) {
|
|
467
329
|
"@swc/helpers - typeof";
|
|
468
330
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
469
331
|
}
|
|
470
|
-
function _ts_generator$
|
|
332
|
+
function _ts_generator$9(thisArg, body) {
|
|
471
333
|
var f, y, t, g, _ = {
|
|
472
334
|
label: 0,
|
|
473
335
|
sent: function() {
|
|
@@ -562,87 +424,162 @@ function _ts_generator$8(thisArg, body) {
|
|
|
562
424
|
};
|
|
563
425
|
}
|
|
564
426
|
}
|
|
565
|
-
var
|
|
566
|
-
|
|
567
|
-
return
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
427
|
+
var isAssumeRoleProfile = function(arg) {
|
|
428
|
+
var _ref = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, _ref_profile = _ref.profile, profile = _ref_profile === void 0 ? "default" : _ref_profile, logger = _ref.logger;
|
|
429
|
+
return Boolean(arg) && (typeof arg === "undefined" ? "undefined" : _type_of$3(arg)) === "object" && typeof arg.role_arn === "string" && [
|
|
430
|
+
"undefined",
|
|
431
|
+
"string"
|
|
432
|
+
].indexOf(_type_of$3(arg.role_session_name)) > -1 && [
|
|
433
|
+
"undefined",
|
|
434
|
+
"string"
|
|
435
|
+
].indexOf(_type_of$3(arg.external_id)) > -1 && [
|
|
436
|
+
"undefined",
|
|
437
|
+
"string"
|
|
438
|
+
].indexOf(_type_of$3(arg.mfa_serial)) > -1 && (isAssumeRoleWithSourceProfile(arg, {
|
|
439
|
+
profile: profile,
|
|
440
|
+
logger: logger
|
|
441
|
+
}) || isCredentialSourceProfile(arg, {
|
|
442
|
+
profile: profile,
|
|
443
|
+
logger: logger
|
|
444
|
+
}));
|
|
445
|
+
};
|
|
446
|
+
var isAssumeRoleWithSourceProfile = function(arg, param) {
|
|
447
|
+
var profile = param.profile, logger = param.logger;
|
|
448
|
+
var withSourceProfile = typeof arg.source_profile === "string" && typeof arg.credential_source === "undefined";
|
|
449
|
+
if (withSourceProfile) {
|
|
450
|
+
var _logger_debug;
|
|
451
|
+
logger === null || logger === void 0 ? void 0 : (_logger_debug = logger.debug) === null || _logger_debug === void 0 ? void 0 : _logger_debug.call(logger, " ".concat(profile, " isAssumeRoleWithSourceProfile source_profile=").concat(arg.source_profile));
|
|
452
|
+
}
|
|
453
|
+
return withSourceProfile;
|
|
454
|
+
};
|
|
455
|
+
var isCredentialSourceProfile = function(arg, param) {
|
|
456
|
+
var profile = param.profile, logger = param.logger;
|
|
457
|
+
var withProviderProfile = typeof arg.credential_source === "string" && typeof arg.source_profile === "undefined";
|
|
458
|
+
if (withProviderProfile) {
|
|
459
|
+
var _logger_debug;
|
|
460
|
+
logger === null || logger === void 0 ? void 0 : (_logger_debug = logger.debug) === null || _logger_debug === void 0 ? void 0 : _logger_debug.call(logger, " ".concat(profile, " isCredentialSourceProfile credential_source=").concat(arg.credential_source));
|
|
461
|
+
}
|
|
462
|
+
return withProviderProfile;
|
|
463
|
+
};
|
|
464
|
+
var resolveAssumeRoleCredentials = function() {
|
|
465
|
+
var _ref = _async_to_generator$9(function(profileName, profiles, options, callerClientConfig) {
|
|
466
|
+
var visitedProfiles, resolveProfileData, _options_logger, _options_logger1, profileData, source_profile, region, _options_parentClientConfig, getDefaultRoleAssumer, _ref, _profiles_source_profile, sourceCredsProvider, _tmp, params, mfa_serial, sourceCreds;
|
|
572
467
|
var _arguments = arguments;
|
|
573
|
-
return _ts_generator$
|
|
468
|
+
return _ts_generator$9(this, function(_state) {
|
|
574
469
|
switch(_state.label){
|
|
575
470
|
case 0:
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
if (!(expect === "100-continue")) return [
|
|
471
|
+
visitedProfiles = _arguments.length > 4 && _arguments[4] !== void 0 ? _arguments[4] : {}, resolveProfileData = _arguments.length > 5 ? _arguments[5] : void 0;
|
|
472
|
+
(_options_logger = options.logger) === null || _options_logger === void 0 ? void 0 : _options_logger.debug("@aws-sdk/credential-provider-ini - resolveAssumeRoleCredentials (STS)");
|
|
473
|
+
profileData = profiles[profileName];
|
|
474
|
+
source_profile = profileData.source_profile, region = profileData.region;
|
|
475
|
+
if (!!options.roleAssumer) return [
|
|
582
476
|
3,
|
|
583
477
|
2
|
|
584
478
|
];
|
|
585
479
|
return [
|
|
586
480
|
4,
|
|
587
|
-
|
|
588
|
-
new Promise(function(resolve) {
|
|
589
|
-
timeoutId = Number(timing.setTimeout(function() {
|
|
590
|
-
return resolve(true);
|
|
591
|
-
}, Math.max(MIN_WAIT_TIME, maxContinueTimeoutMs)));
|
|
592
|
-
}),
|
|
593
|
-
new Promise(function(resolve) {
|
|
594
|
-
httpRequest.on("continue", function() {
|
|
595
|
-
timing.clearTimeout(timeoutId);
|
|
596
|
-
resolve(true);
|
|
597
|
-
});
|
|
598
|
-
httpRequest.on("response", function() {
|
|
599
|
-
timing.clearTimeout(timeoutId);
|
|
600
|
-
resolve(false);
|
|
601
|
-
});
|
|
602
|
-
httpRequest.on("error", function() {
|
|
603
|
-
timing.clearTimeout(timeoutId);
|
|
604
|
-
resolve(false);
|
|
605
|
-
});
|
|
606
|
-
})
|
|
607
|
-
])
|
|
481
|
+
import('./index.esm5.js')
|
|
608
482
|
];
|
|
609
483
|
case 1:
|
|
610
|
-
|
|
484
|
+
getDefaultRoleAssumer = _state.sent().getDefaultRoleAssumer;
|
|
485
|
+
options.roleAssumer = getDefaultRoleAssumer(_object_spread_props$3(_object_spread$4({}, options.clientConfig), {
|
|
486
|
+
credentialProviderLogger: options.logger,
|
|
487
|
+
parentClientConfig: _object_spread_props$3(_object_spread$4({}, callerClientConfig, options === null || options === void 0 ? void 0 : options.parentClientConfig), {
|
|
488
|
+
region: (_ref = region !== null && region !== void 0 ? region : options === null || options === void 0 ? void 0 : (_options_parentClientConfig = options.parentClientConfig) === null || _options_parentClientConfig === void 0 ? void 0 : _options_parentClientConfig.region) !== null && _ref !== void 0 ? _ref : callerClientConfig === null || callerClientConfig === void 0 ? void 0 : callerClientConfig.region
|
|
489
|
+
})
|
|
490
|
+
}), options.clientPlugins);
|
|
611
491
|
_state.label = 2;
|
|
612
492
|
case 2:
|
|
613
|
-
if (
|
|
614
|
-
|
|
493
|
+
if (source_profile && source_profile in visitedProfiles) {
|
|
494
|
+
throw new CredentialsProviderError("Detected a cycle attempting to resolve credentials for profile" + " ".concat(getProfileName(options), ". Profiles visited: ") + Object.keys(visitedProfiles).join(", "), {
|
|
495
|
+
logger: options.logger
|
|
496
|
+
});
|
|
497
|
+
}
|
|
498
|
+
(_options_logger1 = options.logger) === null || _options_logger1 === void 0 ? void 0 : _options_logger1.debug("@aws-sdk/credential-provider-ini - finding credential resolver using ".concat(source_profile ? "source_profile=[".concat(source_profile, "]") : "profile=[".concat(profileName, "]")));
|
|
499
|
+
if (!source_profile) return [
|
|
500
|
+
3,
|
|
501
|
+
3
|
|
502
|
+
];
|
|
503
|
+
_tmp = resolveProfileData(source_profile, profiles, options, callerClientConfig, _object_spread_props$3(_object_spread$4({}, visitedProfiles), _define_property$4({}, source_profile, true)), isCredentialSourceWithoutRoleArn((_profiles_source_profile = profiles[source_profile]) !== null && _profiles_source_profile !== void 0 ? _profiles_source_profile : {}));
|
|
504
|
+
return [
|
|
505
|
+
3,
|
|
506
|
+
5
|
|
507
|
+
];
|
|
508
|
+
case 3:
|
|
509
|
+
return [
|
|
510
|
+
4,
|
|
511
|
+
resolveCredentialSource(profileData.credential_source, profileName, options.logger)(options)
|
|
512
|
+
];
|
|
513
|
+
case 4:
|
|
514
|
+
_tmp = _state.sent()();
|
|
515
|
+
_state.label = 5;
|
|
516
|
+
case 5:
|
|
517
|
+
sourceCredsProvider = _tmp;
|
|
518
|
+
if (!isCredentialSourceWithoutRoleArn(profileData)) return [
|
|
519
|
+
3,
|
|
520
|
+
6
|
|
521
|
+
];
|
|
522
|
+
return [
|
|
523
|
+
2,
|
|
524
|
+
sourceCredsProvider.then(function(creds) {
|
|
525
|
+
return setCredentialFeature(creds, "CREDENTIALS_PROFILE_SOURCE_PROFILE", "o");
|
|
526
|
+
})
|
|
527
|
+
];
|
|
528
|
+
case 6:
|
|
529
|
+
params = {
|
|
530
|
+
RoleArn: profileData.role_arn,
|
|
531
|
+
RoleSessionName: profileData.role_session_name || "aws-sdk-js-".concat(Date.now()),
|
|
532
|
+
ExternalId: profileData.external_id,
|
|
533
|
+
DurationSeconds: parseInt(profileData.duration_seconds || "3600", 10)
|
|
534
|
+
};
|
|
535
|
+
mfa_serial = profileData.mfa_serial;
|
|
536
|
+
if (!mfa_serial) return [
|
|
537
|
+
3,
|
|
538
|
+
8
|
|
539
|
+
];
|
|
540
|
+
if (!options.mfaCodeProvider) {
|
|
541
|
+
throw new CredentialsProviderError("Profile ".concat(profileName, " requires multi-factor authentication, but no MFA code callback was provided."), {
|
|
542
|
+
logger: options.logger,
|
|
543
|
+
tryNextLink: false
|
|
544
|
+
});
|
|
615
545
|
}
|
|
546
|
+
params.SerialNumber = mfa_serial;
|
|
547
|
+
return [
|
|
548
|
+
4,
|
|
549
|
+
options.mfaCodeProvider(mfa_serial)
|
|
550
|
+
];
|
|
551
|
+
case 7:
|
|
552
|
+
params.TokenCode = _state.sent();
|
|
553
|
+
_state.label = 8;
|
|
554
|
+
case 8:
|
|
555
|
+
return [
|
|
556
|
+
4,
|
|
557
|
+
sourceCredsProvider
|
|
558
|
+
];
|
|
559
|
+
case 9:
|
|
560
|
+
sourceCreds = _state.sent();
|
|
561
|
+
return [
|
|
562
|
+
2,
|
|
563
|
+
options.roleAssumer(sourceCreds, params).then(function(creds) {
|
|
564
|
+
return setCredentialFeature(creds, "CREDENTIALS_PROFILE_SOURCE_PROFILE", "o");
|
|
565
|
+
})
|
|
566
|
+
];
|
|
567
|
+
case 10:
|
|
616
568
|
return [
|
|
617
569
|
2
|
|
618
570
|
];
|
|
619
571
|
}
|
|
620
572
|
});
|
|
621
573
|
});
|
|
622
|
-
return
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
if (body) {
|
|
630
|
-
if (Buffer.isBuffer(body) || typeof body === "string") {
|
|
631
|
-
httpRequest.end(body);
|
|
632
|
-
return;
|
|
633
|
-
}
|
|
634
|
-
var uint8 = body;
|
|
635
|
-
if ((typeof uint8 === "undefined" ? "undefined" : _type_of$5(uint8)) === "object" && uint8.buffer && typeof uint8.byteOffset === "number" && typeof uint8.byteLength === "number") {
|
|
636
|
-
httpRequest.end(Buffer.from(uint8.buffer, uint8.byteOffset, uint8.byteLength));
|
|
637
|
-
return;
|
|
638
|
-
}
|
|
639
|
-
httpRequest.end(Buffer.from(body));
|
|
640
|
-
return;
|
|
641
|
-
}
|
|
642
|
-
httpRequest.end();
|
|
643
|
-
}
|
|
574
|
+
return function resolveAssumeRoleCredentials(profileName, profiles, options, callerClientConfig) {
|
|
575
|
+
return _ref.apply(this, arguments);
|
|
576
|
+
};
|
|
577
|
+
}();
|
|
578
|
+
var isCredentialSourceWithoutRoleArn = function(section) {
|
|
579
|
+
return !section.role_arn && !!section.credential_source;
|
|
580
|
+
};
|
|
644
581
|
|
|
645
|
-
function asyncGeneratorStep$
|
|
582
|
+
function asyncGeneratorStep$8(gen, resolve, reject, _next, _throw, key, arg) {
|
|
646
583
|
try {
|
|
647
584
|
var info = gen[key](arg);
|
|
648
585
|
var value = info.value;
|
|
@@ -656,27 +593,27 @@ function asyncGeneratorStep$7(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
656
593
|
Promise.resolve(value).then(_next, _throw);
|
|
657
594
|
}
|
|
658
595
|
}
|
|
659
|
-
function _async_to_generator$
|
|
596
|
+
function _async_to_generator$8(fn) {
|
|
660
597
|
return function() {
|
|
661
598
|
var self = this, args = arguments;
|
|
662
599
|
return new Promise(function(resolve, reject) {
|
|
663
600
|
var gen = fn.apply(self, args);
|
|
664
601
|
function _next(value) {
|
|
665
|
-
asyncGeneratorStep$
|
|
602
|
+
asyncGeneratorStep$8(gen, resolve, reject, _next, _throw, "next", value);
|
|
666
603
|
}
|
|
667
604
|
function _throw(err) {
|
|
668
|
-
asyncGeneratorStep$
|
|
605
|
+
asyncGeneratorStep$8(gen, resolve, reject, _next, _throw, "throw", err);
|
|
669
606
|
}
|
|
670
607
|
_next(undefined);
|
|
671
608
|
});
|
|
672
609
|
};
|
|
673
610
|
}
|
|
674
|
-
function _class_call_check
|
|
611
|
+
function _class_call_check(instance, Constructor) {
|
|
675
612
|
if (!(instance instanceof Constructor)) {
|
|
676
613
|
throw new TypeError("Cannot call a class as a function");
|
|
677
614
|
}
|
|
678
615
|
}
|
|
679
|
-
function _defineProperties
|
|
616
|
+
function _defineProperties(target, props) {
|
|
680
617
|
for(var i = 0; i < props.length; i++){
|
|
681
618
|
var descriptor = props[i];
|
|
682
619
|
descriptor.enumerable = descriptor.enumerable || false;
|
|
@@ -685,9 +622,8 @@ function _defineProperties$2(target, props) {
|
|
|
685
622
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
686
623
|
}
|
|
687
624
|
}
|
|
688
|
-
function _create_class
|
|
689
|
-
if (protoProps) _defineProperties
|
|
690
|
-
if (staticProps) _defineProperties$2(Constructor, staticProps);
|
|
625
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
626
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
691
627
|
return Constructor;
|
|
692
628
|
}
|
|
693
629
|
function _define_property$3(obj, key, value) {
|
|
@@ -703,14 +639,14 @@ function _define_property$3(obj, key, value) {
|
|
|
703
639
|
}
|
|
704
640
|
return obj;
|
|
705
641
|
}
|
|
706
|
-
function _instanceof
|
|
642
|
+
function _instanceof(left, right) {
|
|
707
643
|
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
708
644
|
return !!right[Symbol.hasInstance](left);
|
|
709
645
|
} else {
|
|
710
646
|
return left instanceof right;
|
|
711
647
|
}
|
|
712
648
|
}
|
|
713
|
-
function _object_spread(target) {
|
|
649
|
+
function _object_spread$3(target) {
|
|
714
650
|
for(var i = 1; i < arguments.length; i++){
|
|
715
651
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
716
652
|
var ownKeys = Object.keys(source);
|
|
@@ -725,7 +661,7 @@ function _object_spread(target) {
|
|
|
725
661
|
}
|
|
726
662
|
return target;
|
|
727
663
|
}
|
|
728
|
-
function ownKeys(object, enumerableOnly) {
|
|
664
|
+
function ownKeys$2(object, enumerableOnly) {
|
|
729
665
|
var keys = Object.keys(object);
|
|
730
666
|
if (Object.getOwnPropertySymbols) {
|
|
731
667
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
@@ -733,22 +669,18 @@ function ownKeys(object, enumerableOnly) {
|
|
|
733
669
|
}
|
|
734
670
|
return keys;
|
|
735
671
|
}
|
|
736
|
-
function _object_spread_props(target, source) {
|
|
672
|
+
function _object_spread_props$2(target, source) {
|
|
737
673
|
source = source != null ? source : {};
|
|
738
674
|
if (Object.getOwnPropertyDescriptors) {
|
|
739
675
|
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
740
676
|
} else {
|
|
741
|
-
ownKeys(Object(source)).forEach(function(key) {
|
|
677
|
+
ownKeys$2(Object(source)).forEach(function(key) {
|
|
742
678
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
743
679
|
});
|
|
744
680
|
}
|
|
745
681
|
return target;
|
|
746
682
|
}
|
|
747
|
-
function
|
|
748
|
-
"@swc/helpers - typeof";
|
|
749
|
-
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
750
|
-
}
|
|
751
|
-
function _ts_generator$7(thisArg, body) {
|
|
683
|
+
function _ts_generator$8(thisArg, body) {
|
|
752
684
|
var f, y, t, g, _ = {
|
|
753
685
|
label: 0,
|
|
754
686
|
sent: function() {
|
|
@@ -843,430 +775,529 @@ function _ts_generator$7(thisArg, body) {
|
|
|
843
775
|
};
|
|
844
776
|
}
|
|
845
777
|
}
|
|
846
|
-
var
|
|
847
|
-
function
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
_define_property$3(this, "
|
|
851
|
-
_define_property$3(this, "
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
});
|
|
856
|
-
this.configProvider = new Promise(function(resolve, reject) {
|
|
857
|
-
if (typeof options === "function") {
|
|
858
|
-
options().then(function(_options) {
|
|
859
|
-
resolve(_this.resolveDefaultConfig(_options));
|
|
860
|
-
}).catch(reject);
|
|
861
|
-
} else {
|
|
862
|
-
resolve(_this.resolveDefaultConfig(options));
|
|
863
|
-
}
|
|
864
|
-
});
|
|
778
|
+
var LoginCredentialsFetcher = /*#__PURE__*/ function() {
|
|
779
|
+
function LoginCredentialsFetcher(profileData, init, callerClientConfig) {
|
|
780
|
+
_class_call_check(this, LoginCredentialsFetcher);
|
|
781
|
+
_define_property$3(this, "profileData", void 0);
|
|
782
|
+
_define_property$3(this, "init", void 0);
|
|
783
|
+
_define_property$3(this, "callerClientConfig", void 0);
|
|
784
|
+
this.profileData = profileData;
|
|
785
|
+
this.init = init;
|
|
786
|
+
this.callerClientConfig = callerClientConfig;
|
|
865
787
|
}
|
|
866
|
-
_create_class
|
|
788
|
+
_create_class(LoginCredentialsFetcher, [
|
|
867
789
|
{
|
|
868
|
-
key: "
|
|
869
|
-
value: function
|
|
870
|
-
var
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
790
|
+
key: "loadCredentials",
|
|
791
|
+
value: function loadCredentials() {
|
|
792
|
+
var _this = this;
|
|
793
|
+
return _async_to_generator$8(function() {
|
|
794
|
+
var token, accessToken, now, expiryTime, timeUntilExpiry;
|
|
795
|
+
return _ts_generator$8(this, function(_state) {
|
|
796
|
+
switch(_state.label){
|
|
797
|
+
case 0:
|
|
798
|
+
return [
|
|
799
|
+
4,
|
|
800
|
+
_this.loadToken()
|
|
801
|
+
];
|
|
802
|
+
case 1:
|
|
803
|
+
token = _state.sent();
|
|
804
|
+
if (!token) {
|
|
805
|
+
throw new CredentialsProviderError("Failed to load a token for session ".concat(_this.loginSession, ", please re-authenticate using aws login"), {
|
|
806
|
+
tryNextLink: false,
|
|
807
|
+
logger: _this.logger
|
|
808
|
+
});
|
|
809
|
+
}
|
|
810
|
+
accessToken = token.accessToken;
|
|
811
|
+
now = Date.now();
|
|
812
|
+
expiryTime = new Date(accessToken.expiresAt).getTime();
|
|
813
|
+
timeUntilExpiry = expiryTime - now;
|
|
814
|
+
if (timeUntilExpiry <= LoginCredentialsFetcher.REFRESH_THRESHOLD) {
|
|
815
|
+
return [
|
|
816
|
+
2,
|
|
817
|
+
_this.refresh(token)
|
|
818
|
+
];
|
|
819
|
+
}
|
|
820
|
+
return [
|
|
821
|
+
2,
|
|
822
|
+
{
|
|
823
|
+
accessKeyId: accessToken.accessKeyId,
|
|
824
|
+
secretAccessKey: accessToken.secretAccessKey,
|
|
825
|
+
sessionToken: accessToken.sessionToken,
|
|
826
|
+
accountId: accessToken.accountId,
|
|
827
|
+
expiration: new Date(accessToken.expiresAt)
|
|
828
|
+
}
|
|
829
|
+
];
|
|
891
830
|
}
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
maxSockets: maxSockets
|
|
895
|
-
}, httpsAgent));
|
|
896
|
-
}(),
|
|
897
|
-
logger: console
|
|
898
|
-
};
|
|
831
|
+
});
|
|
832
|
+
})();
|
|
899
833
|
}
|
|
900
834
|
},
|
|
901
835
|
{
|
|
902
|
-
key: "
|
|
903
|
-
|
|
904
|
-
var
|
|
905
|
-
(
|
|
906
|
-
(_this_config1 = this.config) === null || _this_config1 === void 0 ? void 0 : (_this_config_httpsAgent = _this_config1.httpsAgent) === null || _this_config_httpsAgent === void 0 ? void 0 : _this_config_httpsAgent.destroy();
|
|
836
|
+
key: "logger",
|
|
837
|
+
get: function get() {
|
|
838
|
+
var _this_init;
|
|
839
|
+
return (_this_init = this.init) === null || _this_init === void 0 ? void 0 : _this_init.logger;
|
|
907
840
|
}
|
|
908
841
|
},
|
|
909
842
|
{
|
|
910
|
-
key: "
|
|
911
|
-
|
|
912
|
-
|
|
843
|
+
key: "loginSession",
|
|
844
|
+
get: function get() {
|
|
845
|
+
return this.profileData.login_session;
|
|
846
|
+
}
|
|
847
|
+
},
|
|
848
|
+
{
|
|
849
|
+
key: "refresh",
|
|
850
|
+
value: function refresh(token) {
|
|
913
851
|
var _this = this;
|
|
914
|
-
return _async_to_generator$
|
|
915
|
-
|
|
852
|
+
return _async_to_generator$8(function() {
|
|
853
|
+
var _this_callerClientConfig, _this_callerClientConfig1, _this_callerClientConfig_region, _this_callerClientConfig2, _this_init, _ref, SigninClient, CreateOAuth2TokenCommand, _this_callerClientConfig3, _ref1, logger, userAgentAppId, isH2, requestHandler, _this_profileData_region, _ref2, region, _tmp, client, commandInput, _response_tokenOutput, response, _response_tokenOutput_accessToken, _ref3, accessKeyId, secretAccessKey, sessionToken, _response_tokenOutput1, _ref4, refreshToken, expiresIn, expiresInMs, expiration, updatedToken, newAccessToken, error, errorType, message;
|
|
854
|
+
return _ts_generator$8(this, function(_state) {
|
|
916
855
|
switch(_state.label){
|
|
917
856
|
case 0:
|
|
918
|
-
|
|
857
|
+
return [
|
|
858
|
+
4,
|
|
859
|
+
import('./index.esm11.js')
|
|
860
|
+
];
|
|
861
|
+
case 1:
|
|
862
|
+
_ref = _state.sent(), SigninClient = _ref.SigninClient, CreateOAuth2TokenCommand = _ref.CreateOAuth2TokenCommand;
|
|
863
|
+
_ref1 = (_this_callerClientConfig3 = _this.callerClientConfig) !== null && _this_callerClientConfig3 !== void 0 ? _this_callerClientConfig3 : {}, logger = _ref1.logger, userAgentAppId = _ref1.userAgentAppId;
|
|
864
|
+
isH2 = function(requestHandler) {
|
|
865
|
+
var _requestHandler_metadata;
|
|
866
|
+
return (requestHandler === null || requestHandler === void 0 ? void 0 : (_requestHandler_metadata = requestHandler.metadata) === null || _requestHandler_metadata === void 0 ? void 0 : _requestHandler_metadata.handlerProtocol) === "h2";
|
|
867
|
+
};
|
|
868
|
+
requestHandler = isH2((_this_callerClientConfig = _this.callerClientConfig) === null || _this_callerClientConfig === void 0 ? void 0 : _this_callerClientConfig.requestHandler) ? undefined : (_this_callerClientConfig1 = _this.callerClientConfig) === null || _this_callerClientConfig1 === void 0 ? void 0 : _this_callerClientConfig1.requestHandler;
|
|
869
|
+
if (!((_this_profileData_region = _this.profileData.region) !== null && _this_profileData_region !== void 0)) return [
|
|
919
870
|
3,
|
|
920
871
|
2
|
|
921
872
|
];
|
|
873
|
+
_tmp = _this_profileData_region;
|
|
874
|
+
return [
|
|
875
|
+
3,
|
|
876
|
+
4
|
|
877
|
+
];
|
|
878
|
+
case 2:
|
|
879
|
+
return [
|
|
880
|
+
4,
|
|
881
|
+
(_this_callerClientConfig2 = _this.callerClientConfig) === null || _this_callerClientConfig2 === void 0 ? void 0 : (_this_callerClientConfig_region = _this_callerClientConfig2.region) === null || _this_callerClientConfig_region === void 0 ? void 0 : _this_callerClientConfig_region.call(_this_callerClientConfig2)
|
|
882
|
+
];
|
|
883
|
+
case 3:
|
|
884
|
+
_tmp = _state.sent();
|
|
885
|
+
_state.label = 4;
|
|
886
|
+
case 4:
|
|
887
|
+
region = (_ref2 = _tmp) !== null && _ref2 !== void 0 ? _ref2 : process.env.AWS_REGION;
|
|
888
|
+
client = new SigninClient(_object_spread$3({
|
|
889
|
+
credentials: {
|
|
890
|
+
accessKeyId: "",
|
|
891
|
+
secretAccessKey: ""
|
|
892
|
+
},
|
|
893
|
+
region: region,
|
|
894
|
+
requestHandler: requestHandler,
|
|
895
|
+
logger: logger,
|
|
896
|
+
userAgentAppId: userAgentAppId
|
|
897
|
+
}, (_this_init = _this.init) === null || _this_init === void 0 ? void 0 : _this_init.clientConfig));
|
|
898
|
+
_this.createDPoPInterceptor(client.middlewareStack);
|
|
899
|
+
commandInput = {
|
|
900
|
+
tokenInput: {
|
|
901
|
+
clientId: token.clientId,
|
|
902
|
+
refreshToken: token.refreshToken,
|
|
903
|
+
grantType: "refresh_token"
|
|
904
|
+
}
|
|
905
|
+
};
|
|
906
|
+
_state.label = 5;
|
|
907
|
+
case 5:
|
|
908
|
+
_state.trys.push([
|
|
909
|
+
5,
|
|
910
|
+
8,
|
|
911
|
+
,
|
|
912
|
+
9
|
|
913
|
+
]);
|
|
914
|
+
return [
|
|
915
|
+
4,
|
|
916
|
+
client.send(new CreateOAuth2TokenCommand(commandInput))
|
|
917
|
+
];
|
|
918
|
+
case 6:
|
|
919
|
+
response = _state.sent();
|
|
920
|
+
_ref3 = (_response_tokenOutput_accessToken = (_response_tokenOutput = response.tokenOutput) === null || _response_tokenOutput === void 0 ? void 0 : _response_tokenOutput.accessToken) !== null && _response_tokenOutput_accessToken !== void 0 ? _response_tokenOutput_accessToken : {}, accessKeyId = _ref3.accessKeyId, secretAccessKey = _ref3.secretAccessKey, sessionToken = _ref3.sessionToken;
|
|
921
|
+
_ref4 = (_response_tokenOutput1 = response.tokenOutput) !== null && _response_tokenOutput1 !== void 0 ? _response_tokenOutput1 : {}, refreshToken = _ref4.refreshToken, expiresIn = _ref4.expiresIn;
|
|
922
|
+
if (!accessKeyId || !secretAccessKey || !sessionToken || !refreshToken) {
|
|
923
|
+
throw new CredentialsProviderError("Token refresh response missing required fields", {
|
|
924
|
+
logger: _this.logger,
|
|
925
|
+
tryNextLink: false
|
|
926
|
+
});
|
|
927
|
+
}
|
|
928
|
+
expiresInMs = (expiresIn !== null && expiresIn !== void 0 ? expiresIn : 900) * 1000;
|
|
929
|
+
expiration = new Date(Date.now() + expiresInMs);
|
|
930
|
+
updatedToken = _object_spread_props$2(_object_spread$3({}, token), {
|
|
931
|
+
accessToken: _object_spread_props$2(_object_spread$3({}, token.accessToken), {
|
|
932
|
+
accessKeyId: accessKeyId,
|
|
933
|
+
secretAccessKey: secretAccessKey,
|
|
934
|
+
sessionToken: sessionToken,
|
|
935
|
+
expiresAt: expiration.toISOString()
|
|
936
|
+
}),
|
|
937
|
+
refreshToken: refreshToken
|
|
938
|
+
});
|
|
922
939
|
return [
|
|
923
940
|
4,
|
|
924
|
-
_this.
|
|
941
|
+
_this.saveToken(updatedToken)
|
|
942
|
+
];
|
|
943
|
+
case 7:
|
|
944
|
+
_state.sent();
|
|
945
|
+
newAccessToken = updatedToken.accessToken;
|
|
946
|
+
return [
|
|
947
|
+
2,
|
|
948
|
+
{
|
|
949
|
+
accessKeyId: newAccessToken.accessKeyId,
|
|
950
|
+
secretAccessKey: newAccessToken.secretAccessKey,
|
|
951
|
+
sessionToken: newAccessToken.sessionToken,
|
|
952
|
+
accountId: newAccessToken.accountId,
|
|
953
|
+
expiration: expiration
|
|
954
|
+
}
|
|
955
|
+
];
|
|
956
|
+
case 8:
|
|
957
|
+
error = _state.sent();
|
|
958
|
+
if (error.name === "AccessDeniedException") {
|
|
959
|
+
errorType = error.error;
|
|
960
|
+
switch(errorType){
|
|
961
|
+
case "TOKEN_EXPIRED":
|
|
962
|
+
message = "Your session has expired. Please reauthenticate.";
|
|
963
|
+
break;
|
|
964
|
+
case "USER_CREDENTIALS_CHANGED":
|
|
965
|
+
message = "Unable to refresh credentials because of a change in your password. Please reauthenticate with your new password.";
|
|
966
|
+
break;
|
|
967
|
+
case "INSUFFICIENT_PERMISSIONS":
|
|
968
|
+
message = "Unable to refresh credentials due to insufficient permissions. You may be missing permission for the 'CreateOAuth2Token' action.";
|
|
969
|
+
break;
|
|
970
|
+
default:
|
|
971
|
+
message = "Failed to refresh token: ".concat(String(error), ". Please re-authenticate using `aws login`");
|
|
972
|
+
}
|
|
973
|
+
throw new CredentialsProviderError(message, {
|
|
974
|
+
logger: _this.logger,
|
|
975
|
+
tryNextLink: false
|
|
976
|
+
});
|
|
977
|
+
}
|
|
978
|
+
throw new CredentialsProviderError("Failed to refresh token: ".concat(String(error), ". Please re-authenticate using aws login"), {
|
|
979
|
+
logger: _this.logger
|
|
980
|
+
});
|
|
981
|
+
case 9:
|
|
982
|
+
return [
|
|
983
|
+
2
|
|
925
984
|
];
|
|
985
|
+
}
|
|
986
|
+
});
|
|
987
|
+
})();
|
|
988
|
+
}
|
|
989
|
+
},
|
|
990
|
+
{
|
|
991
|
+
key: "loadToken",
|
|
992
|
+
value: function loadToken() {
|
|
993
|
+
var _this = this;
|
|
994
|
+
return _async_to_generator$8(function() {
|
|
995
|
+
var tokenFilePath, _token_accessToken, tokenData, _this_init, token, missingFields, error;
|
|
996
|
+
return _ts_generator$8(this, function(_state) {
|
|
997
|
+
switch(_state.label){
|
|
998
|
+
case 0:
|
|
999
|
+
tokenFilePath = _this.getTokenFilePath();
|
|
1000
|
+
_state.label = 1;
|
|
926
1001
|
case 1:
|
|
927
|
-
|
|
1002
|
+
_state.trys.push([
|
|
1003
|
+
1,
|
|
1004
|
+
7,
|
|
1005
|
+
,
|
|
1006
|
+
8
|
|
1007
|
+
]);
|
|
928
1008
|
_state.label = 2;
|
|
929
1009
|
case 2:
|
|
930
|
-
|
|
1010
|
+
_state.trys.push([
|
|
931
1011
|
2,
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
return [
|
|
941
|
-
4,
|
|
942
|
-
writeRequestBodyPromise
|
|
943
|
-
];
|
|
944
|
-
case 1:
|
|
945
|
-
_state.sent();
|
|
946
|
-
timeouts.forEach(timing.clearTimeout);
|
|
947
|
-
_resolve(arg);
|
|
948
|
-
return [
|
|
949
|
-
2
|
|
950
|
-
];
|
|
951
|
-
}
|
|
952
|
-
});
|
|
953
|
-
});
|
|
954
|
-
return function resolve(arg) {
|
|
955
|
-
return _ref.apply(this, arguments);
|
|
956
|
-
};
|
|
957
|
-
}();
|
|
958
|
-
var reject = function() {
|
|
959
|
-
var _ref = _async_to_generator$7(function(arg) {
|
|
960
|
-
return _ts_generator$7(this, function(_state) {
|
|
961
|
-
switch(_state.label){
|
|
962
|
-
case 0:
|
|
963
|
-
return [
|
|
964
|
-
4,
|
|
965
|
-
writeRequestBodyPromise
|
|
966
|
-
];
|
|
967
|
-
case 1:
|
|
968
|
-
_state.sent();
|
|
969
|
-
timeouts.forEach(timing.clearTimeout);
|
|
970
|
-
_reject(arg);
|
|
971
|
-
return [
|
|
972
|
-
2
|
|
973
|
-
];
|
|
974
|
-
}
|
|
975
|
-
});
|
|
976
|
-
});
|
|
977
|
-
return function reject(arg) {
|
|
978
|
-
return _ref.apply(this, arguments);
|
|
979
|
-
};
|
|
980
|
-
}();
|
|
981
|
-
if (!_this.config) {
|
|
982
|
-
throw new Error("Node HTTP request handler config is not resolved");
|
|
983
|
-
}
|
|
984
|
-
if (abortSignal === null || abortSignal === void 0 ? void 0 : abortSignal.aborted) {
|
|
985
|
-
var abortError = new Error("Request aborted");
|
|
986
|
-
abortError.name = "AbortError";
|
|
987
|
-
reject(abortError);
|
|
988
|
-
return;
|
|
989
|
-
}
|
|
990
|
-
var isSSL = request$2.protocol === "https:";
|
|
991
|
-
var agent = isSSL ? _this.config.httpsAgent : _this.config.httpAgent;
|
|
992
|
-
var _this_config_requestTimeout, _this_config_connectionTimeout, _this_config_socketAcquisitionWarningTimeout;
|
|
993
|
-
timeouts.push(timing.setTimeout(function() {
|
|
994
|
-
_this.socketWarningTimestamp = NodeHttpHandler.checkSocketUsage(agent, _this.socketWarningTimestamp, _this.config.logger);
|
|
995
|
-
}, (_this_config_socketAcquisitionWarningTimeout = _this.config.socketAcquisitionWarningTimeout) !== null && _this_config_socketAcquisitionWarningTimeout !== void 0 ? _this_config_socketAcquisitionWarningTimeout : ((_this_config_requestTimeout = _this.config.requestTimeout) !== null && _this_config_requestTimeout !== void 0 ? _this_config_requestTimeout : 2000) + ((_this_config_connectionTimeout = _this.config.connectionTimeout) !== null && _this_config_connectionTimeout !== void 0 ? _this_config_connectionTimeout : 1000)));
|
|
996
|
-
var queryString = buildQueryString(request$2.query || {});
|
|
997
|
-
var auth = undefined;
|
|
998
|
-
if (request$2.username != null || request$2.password != null) {
|
|
999
|
-
var _request_username;
|
|
1000
|
-
var username = (_request_username = request$2.username) !== null && _request_username !== void 0 ? _request_username : "";
|
|
1001
|
-
var _request_password;
|
|
1002
|
-
var password = (_request_password = request$2.password) !== null && _request_password !== void 0 ? _request_password : "";
|
|
1003
|
-
auth = "".concat(username, ":").concat(password);
|
|
1004
|
-
}
|
|
1005
|
-
var path = request$2.path;
|
|
1006
|
-
if (queryString) {
|
|
1007
|
-
path += "?".concat(queryString);
|
|
1008
|
-
}
|
|
1009
|
-
if (request$2.fragment) {
|
|
1010
|
-
path += "#".concat(request$2.fragment);
|
|
1011
|
-
}
|
|
1012
|
-
var _request_hostname;
|
|
1013
|
-
var hostname = (_request_hostname = request$2.hostname) !== null && _request_hostname !== void 0 ? _request_hostname : "";
|
|
1014
|
-
if (hostname[0] === "[" && hostname.endsWith("]")) {
|
|
1015
|
-
hostname = request$2.hostname.slice(1, -1);
|
|
1016
|
-
} else {
|
|
1017
|
-
hostname = request$2.hostname;
|
|
1018
|
-
}
|
|
1019
|
-
var nodeHttpsOptions = {
|
|
1020
|
-
headers: request$2.headers,
|
|
1021
|
-
host: hostname,
|
|
1022
|
-
method: request$2.method,
|
|
1023
|
-
path: path,
|
|
1024
|
-
port: request$2.port,
|
|
1025
|
-
agent: agent,
|
|
1026
|
-
auth: auth
|
|
1027
|
-
};
|
|
1028
|
-
var requestFunc = isSSL ? request : request$1;
|
|
1029
|
-
var req = requestFunc(nodeHttpsOptions, function(res) {
|
|
1030
|
-
var httpResponse = new HttpResponse({
|
|
1031
|
-
statusCode: res.statusCode || -1,
|
|
1032
|
-
reason: res.statusMessage,
|
|
1033
|
-
headers: getTransformedHeaders(res.headers),
|
|
1034
|
-
body: res
|
|
1035
|
-
});
|
|
1036
|
-
resolve({
|
|
1037
|
-
response: httpResponse
|
|
1038
|
-
});
|
|
1039
|
-
});
|
|
1040
|
-
req.on("error", function(err) {
|
|
1041
|
-
if (NODEJS_TIMEOUT_ERROR_CODES.includes(err.code)) {
|
|
1042
|
-
reject(Object.assign(err, {
|
|
1043
|
-
name: "TimeoutError"
|
|
1044
|
-
}));
|
|
1045
|
-
} else {
|
|
1046
|
-
reject(err);
|
|
1047
|
-
}
|
|
1048
|
-
});
|
|
1049
|
-
if (abortSignal) {
|
|
1050
|
-
var onAbort = function() {
|
|
1051
|
-
req.destroy();
|
|
1052
|
-
var abortError = new Error("Request aborted");
|
|
1053
|
-
abortError.name = "AbortError";
|
|
1054
|
-
reject(abortError);
|
|
1055
|
-
};
|
|
1056
|
-
if (typeof abortSignal.addEventListener === "function") {
|
|
1057
|
-
var signal = abortSignal;
|
|
1058
|
-
signal.addEventListener("abort", onAbort, {
|
|
1059
|
-
once: true
|
|
1060
|
-
});
|
|
1061
|
-
req.once("close", function() {
|
|
1062
|
-
return signal.removeEventListener("abort", onAbort);
|
|
1063
|
-
});
|
|
1064
|
-
} else {
|
|
1065
|
-
abortSignal.onabort = onAbort;
|
|
1066
|
-
}
|
|
1067
|
-
}
|
|
1068
|
-
var effectiveRequestTimeout = requestTimeout !== null && requestTimeout !== void 0 ? requestTimeout : _this.config.requestTimeout;
|
|
1069
|
-
timeouts.push(setConnectionTimeout(req, reject, _this.config.connectionTimeout));
|
|
1070
|
-
var _this_config_logger;
|
|
1071
|
-
timeouts.push(setRequestTimeout(req, reject, effectiveRequestTimeout, _this.config.throwOnRequestTimeout, (_this_config_logger = _this.config.logger) !== null && _this_config_logger !== void 0 ? _this_config_logger : console));
|
|
1072
|
-
timeouts.push(setSocketTimeout(req, reject, _this.config.socketTimeout));
|
|
1073
|
-
var httpAgent = nodeHttpsOptions.agent;
|
|
1074
|
-
if ((typeof httpAgent === "undefined" ? "undefined" : _type_of$4(httpAgent)) === "object" && "keepAlive" in httpAgent) {
|
|
1075
|
-
timeouts.push(setSocketKeepAlive(req, {
|
|
1076
|
-
keepAlive: httpAgent.keepAlive,
|
|
1077
|
-
keepAliveMsecs: httpAgent.keepAliveMsecs
|
|
1078
|
-
}));
|
|
1079
|
-
}
|
|
1080
|
-
writeRequestBodyPromise = writeRequestBody(req, request$2, effectiveRequestTimeout).catch(function(e) {
|
|
1081
|
-
timeouts.forEach(timing.clearTimeout);
|
|
1082
|
-
return _reject(e);
|
|
1083
|
-
});
|
|
1012
|
+
4,
|
|
1013
|
+
,
|
|
1014
|
+
6
|
|
1015
|
+
]);
|
|
1016
|
+
return [
|
|
1017
|
+
4,
|
|
1018
|
+
readFile(tokenFilePath, {
|
|
1019
|
+
ignoreCache: (_this_init = _this.init) === null || _this_init === void 0 ? void 0 : _this_init.ignoreCache
|
|
1084
1020
|
})
|
|
1085
1021
|
];
|
|
1022
|
+
case 3:
|
|
1023
|
+
tokenData = _state.sent();
|
|
1024
|
+
return [
|
|
1025
|
+
3,
|
|
1026
|
+
6
|
|
1027
|
+
];
|
|
1028
|
+
case 4:
|
|
1029
|
+
_state.sent();
|
|
1030
|
+
return [
|
|
1031
|
+
4,
|
|
1032
|
+
promises.readFile(tokenFilePath, "utf8")
|
|
1033
|
+
];
|
|
1034
|
+
case 5:
|
|
1035
|
+
tokenData = _state.sent();
|
|
1036
|
+
return [
|
|
1037
|
+
3,
|
|
1038
|
+
6
|
|
1039
|
+
];
|
|
1040
|
+
case 6:
|
|
1041
|
+
token = JSON.parse(tokenData);
|
|
1042
|
+
missingFields = [
|
|
1043
|
+
"accessToken",
|
|
1044
|
+
"clientId",
|
|
1045
|
+
"refreshToken",
|
|
1046
|
+
"dpopKey"
|
|
1047
|
+
].filter(function(k) {
|
|
1048
|
+
return !token[k];
|
|
1049
|
+
});
|
|
1050
|
+
if (!((_token_accessToken = token.accessToken) === null || _token_accessToken === void 0 ? void 0 : _token_accessToken.accountId)) {
|
|
1051
|
+
missingFields.push("accountId");
|
|
1052
|
+
}
|
|
1053
|
+
if (missingFields.length > 0) {
|
|
1054
|
+
throw new CredentialsProviderError("Token validation failed, missing fields: ".concat(missingFields.join(", ")), {
|
|
1055
|
+
logger: _this.logger,
|
|
1056
|
+
tryNextLink: false
|
|
1057
|
+
});
|
|
1058
|
+
}
|
|
1059
|
+
return [
|
|
1060
|
+
2,
|
|
1061
|
+
token
|
|
1062
|
+
];
|
|
1063
|
+
case 7:
|
|
1064
|
+
error = _state.sent();
|
|
1065
|
+
throw new CredentialsProviderError("Failed to load token from ".concat(tokenFilePath, ": ").concat(String(error)), {
|
|
1066
|
+
logger: _this.logger,
|
|
1067
|
+
tryNextLink: false
|
|
1068
|
+
});
|
|
1069
|
+
case 8:
|
|
1070
|
+
return [
|
|
1071
|
+
2
|
|
1072
|
+
];
|
|
1086
1073
|
}
|
|
1087
1074
|
});
|
|
1088
1075
|
})();
|
|
1089
1076
|
}
|
|
1090
1077
|
},
|
|
1091
1078
|
{
|
|
1092
|
-
key: "
|
|
1093
|
-
value: function
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1079
|
+
key: "saveToken",
|
|
1080
|
+
value: function saveToken(token) {
|
|
1081
|
+
var _this = this;
|
|
1082
|
+
return _async_to_generator$8(function() {
|
|
1083
|
+
var tokenFilePath, directory;
|
|
1084
|
+
return _ts_generator$8(this, function(_state) {
|
|
1085
|
+
switch(_state.label){
|
|
1086
|
+
case 0:
|
|
1087
|
+
tokenFilePath = _this.getTokenFilePath();
|
|
1088
|
+
directory = dirname(tokenFilePath);
|
|
1089
|
+
_state.label = 1;
|
|
1090
|
+
case 1:
|
|
1091
|
+
_state.trys.push([
|
|
1092
|
+
1,
|
|
1093
|
+
3,
|
|
1094
|
+
,
|
|
1095
|
+
4
|
|
1096
|
+
]);
|
|
1097
|
+
return [
|
|
1098
|
+
4,
|
|
1099
|
+
promises.mkdir(directory, {
|
|
1100
|
+
recursive: true
|
|
1101
|
+
})
|
|
1102
|
+
];
|
|
1103
|
+
case 2:
|
|
1104
|
+
_state.sent();
|
|
1105
|
+
return [
|
|
1106
|
+
3,
|
|
1107
|
+
4
|
|
1108
|
+
];
|
|
1109
|
+
case 3:
|
|
1110
|
+
_state.sent();
|
|
1111
|
+
return [
|
|
1112
|
+
3,
|
|
1113
|
+
4
|
|
1114
|
+
];
|
|
1115
|
+
case 4:
|
|
1116
|
+
return [
|
|
1117
|
+
4,
|
|
1118
|
+
promises.writeFile(tokenFilePath, JSON.stringify(token, null, 2), "utf8")
|
|
1119
|
+
];
|
|
1120
|
+
case 5:
|
|
1121
|
+
_state.sent();
|
|
1122
|
+
return [
|
|
1123
|
+
2
|
|
1124
|
+
];
|
|
1125
|
+
}
|
|
1126
|
+
});
|
|
1127
|
+
})();
|
|
1098
1128
|
}
|
|
1099
1129
|
},
|
|
1100
1130
|
{
|
|
1101
|
-
key: "
|
|
1102
|
-
value: function
|
|
1103
|
-
var
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
{
|
|
1109
|
-
key: "create",
|
|
1110
|
-
value: function create(instanceOrOptions) {
|
|
1111
|
-
if (typeof (instanceOrOptions === null || instanceOrOptions === void 0 ? void 0 : instanceOrOptions.handle) === "function") {
|
|
1112
|
-
return instanceOrOptions;
|
|
1113
|
-
}
|
|
1114
|
-
return new NodeHttpHandler(instanceOrOptions);
|
|
1131
|
+
key: "getTokenFilePath",
|
|
1132
|
+
value: function getTokenFilePath() {
|
|
1133
|
+
var _process_env_AWS_LOGIN_CACHE_DIRECTORY;
|
|
1134
|
+
var directory = (_process_env_AWS_LOGIN_CACHE_DIRECTORY = process.env.AWS_LOGIN_CACHE_DIRECTORY) !== null && _process_env_AWS_LOGIN_CACHE_DIRECTORY !== void 0 ? _process_env_AWS_LOGIN_CACHE_DIRECTORY : join(homedir(), ".aws", "login", "cache");
|
|
1135
|
+
var loginSessionBytes = Buffer.from(this.loginSession, "utf8");
|
|
1136
|
+
var loginSessionSha256 = createHash("sha256").update(loginSessionBytes).digest("hex");
|
|
1137
|
+
return join(directory, "".concat(loginSessionSha256, ".json"));
|
|
1115
1138
|
}
|
|
1116
1139
|
},
|
|
1117
1140
|
{
|
|
1118
|
-
key: "
|
|
1119
|
-
value: function
|
|
1120
|
-
var
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
return socketWarningTimestamp;
|
|
1141
|
+
key: "derToRawSignature",
|
|
1142
|
+
value: function derToRawSignature(derSignature) {
|
|
1143
|
+
var offset = 2;
|
|
1144
|
+
if (derSignature[offset] !== 0x02) {
|
|
1145
|
+
throw new Error("Invalid DER signature");
|
|
1124
1146
|
}
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1147
|
+
offset++;
|
|
1148
|
+
var rLength = derSignature[offset++];
|
|
1149
|
+
var r = derSignature.subarray(offset, offset + rLength);
|
|
1150
|
+
offset += rLength;
|
|
1151
|
+
if (derSignature[offset] !== 0x02) {
|
|
1152
|
+
throw new Error("Invalid DER signature");
|
|
1128
1153
|
}
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1154
|
+
offset++;
|
|
1155
|
+
var sLength = derSignature[offset++];
|
|
1156
|
+
var s = derSignature.subarray(offset, offset + sLength);
|
|
1157
|
+
r = r[0] === 0x00 ? r.subarray(1) : r;
|
|
1158
|
+
s = s[0] === 0x00 ? s.subarray(1) : s;
|
|
1159
|
+
var rPadded = Buffer.concat([
|
|
1160
|
+
Buffer.alloc(32 - r.length),
|
|
1161
|
+
r
|
|
1162
|
+
]);
|
|
1163
|
+
var sPadded = Buffer.concat([
|
|
1164
|
+
Buffer.alloc(32 - s.length),
|
|
1165
|
+
s
|
|
1166
|
+
]);
|
|
1167
|
+
return Buffer.concat([
|
|
1168
|
+
rPadded,
|
|
1169
|
+
sPadded
|
|
1170
|
+
]);
|
|
1144
1171
|
}
|
|
1145
|
-
}
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
function
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
}
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
}
|
|
1193
|
-
function _inherits$2(subClass, superClass) {
|
|
1194
|
-
if (typeof superClass !== "function" && superClass !== null) {
|
|
1195
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
1196
|
-
}
|
|
1197
|
-
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
1198
|
-
constructor: {
|
|
1199
|
-
value: subClass,
|
|
1200
|
-
writable: true,
|
|
1201
|
-
configurable: true
|
|
1202
|
-
}
|
|
1203
|
-
});
|
|
1204
|
-
if (superClass) _set_prototype_of$2(subClass, superClass);
|
|
1205
|
-
}
|
|
1206
|
-
function _possible_constructor_return$2(self, call) {
|
|
1207
|
-
if (call && (_type_of$3(call) === "object" || typeof call === "function")) {
|
|
1208
|
-
return call;
|
|
1209
|
-
}
|
|
1210
|
-
return _assert_this_initialized$2(self);
|
|
1211
|
-
}
|
|
1212
|
-
function _set_prototype_of$2(o, p) {
|
|
1213
|
-
_set_prototype_of$2 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
1214
|
-
o.__proto__ = p;
|
|
1215
|
-
return o;
|
|
1216
|
-
};
|
|
1217
|
-
return _set_prototype_of$2(o, p);
|
|
1218
|
-
}
|
|
1219
|
-
function _type_of$3(obj) {
|
|
1220
|
-
"@swc/helpers - typeof";
|
|
1221
|
-
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
1222
|
-
}
|
|
1223
|
-
function _is_native_reflect_construct$2() {
|
|
1224
|
-
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
1225
|
-
if (Reflect.construct.sham) return false;
|
|
1226
|
-
if (typeof Proxy === "function") return true;
|
|
1227
|
-
try {
|
|
1228
|
-
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
1229
|
-
return true;
|
|
1230
|
-
} catch (e) {
|
|
1231
|
-
return false;
|
|
1232
|
-
}
|
|
1233
|
-
}
|
|
1234
|
-
function _create_super$2(Derived) {
|
|
1235
|
-
var hasNativeReflectConstruct = _is_native_reflect_construct$2();
|
|
1236
|
-
return function _createSuperInternal() {
|
|
1237
|
-
var Super = _get_prototype_of$2(Derived), result;
|
|
1238
|
-
if (hasNativeReflectConstruct) {
|
|
1239
|
-
var NewTarget = _get_prototype_of$2(this).constructor;
|
|
1240
|
-
result = Reflect.construct(Super, arguments, NewTarget);
|
|
1241
|
-
} else {
|
|
1242
|
-
result = Super.apply(this, arguments);
|
|
1243
|
-
}
|
|
1244
|
-
return _possible_constructor_return$2(this, result);
|
|
1245
|
-
};
|
|
1246
|
-
}
|
|
1247
|
-
var Collector = /*#__PURE__*/ function(Writable) {
|
|
1248
|
-
_inherits$2(Collector, Writable);
|
|
1249
|
-
var _super = _create_super$2(Collector);
|
|
1250
|
-
function Collector() {
|
|
1251
|
-
_class_call_check$2(this, Collector);
|
|
1252
|
-
var _this;
|
|
1253
|
-
_this = _super.apply(this, arguments);
|
|
1254
|
-
_define_property$2(_assert_this_initialized$2(_this), "bufferedBytes", []);
|
|
1255
|
-
return _this;
|
|
1256
|
-
}
|
|
1257
|
-
_create_class$1(Collector, [
|
|
1172
|
+
},
|
|
1173
|
+
{
|
|
1174
|
+
key: "createDPoPInterceptor",
|
|
1175
|
+
value: function createDPoPInterceptor(middlewareStack) {
|
|
1176
|
+
var _this = this;
|
|
1177
|
+
middlewareStack.add(function(next) {
|
|
1178
|
+
return function() {
|
|
1179
|
+
var _ref = _async_to_generator$8(function(args) {
|
|
1180
|
+
var request, actualEndpoint, dpop;
|
|
1181
|
+
return _ts_generator$8(this, function(_state) {
|
|
1182
|
+
switch(_state.label){
|
|
1183
|
+
case 0:
|
|
1184
|
+
if (!HttpRequest.isInstance(args.request)) return [
|
|
1185
|
+
3,
|
|
1186
|
+
2
|
|
1187
|
+
];
|
|
1188
|
+
request = args.request;
|
|
1189
|
+
actualEndpoint = "".concat(request.protocol, "//").concat(request.hostname).concat(request.port ? ":".concat(request.port) : "").concat(request.path);
|
|
1190
|
+
return [
|
|
1191
|
+
4,
|
|
1192
|
+
_this.generateDpop(request.method, actualEndpoint)
|
|
1193
|
+
];
|
|
1194
|
+
case 1:
|
|
1195
|
+
dpop = _state.sent();
|
|
1196
|
+
request.headers = _object_spread_props$2(_object_spread$3({}, request.headers), {
|
|
1197
|
+
DPoP: dpop
|
|
1198
|
+
});
|
|
1199
|
+
_state.label = 2;
|
|
1200
|
+
case 2:
|
|
1201
|
+
return [
|
|
1202
|
+
2,
|
|
1203
|
+
next(args)
|
|
1204
|
+
];
|
|
1205
|
+
}
|
|
1206
|
+
});
|
|
1207
|
+
});
|
|
1208
|
+
return function(args) {
|
|
1209
|
+
return _ref.apply(this, arguments);
|
|
1210
|
+
};
|
|
1211
|
+
}();
|
|
1212
|
+
}, {
|
|
1213
|
+
step: "finalizeRequest",
|
|
1214
|
+
name: "dpopInterceptor",
|
|
1215
|
+
override: true
|
|
1216
|
+
});
|
|
1217
|
+
}
|
|
1218
|
+
},
|
|
1258
1219
|
{
|
|
1259
|
-
key: "
|
|
1260
|
-
value: function
|
|
1261
|
-
|
|
1262
|
-
|
|
1220
|
+
key: "generateDpop",
|
|
1221
|
+
value: function generateDpop() {
|
|
1222
|
+
var method = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "POST", endpoint = arguments.length > 1 ? arguments[1] : void 0;
|
|
1223
|
+
var _this = this;
|
|
1224
|
+
return _async_to_generator$8(function() {
|
|
1225
|
+
var token, privateKey, publicKey, publicDer, pointStart, i, x, y, header, payload, headerB64, payloadB64, message, asn1Signature, rawSignature, signatureB64;
|
|
1226
|
+
return _ts_generator$8(this, function(_state) {
|
|
1227
|
+
switch(_state.label){
|
|
1228
|
+
case 0:
|
|
1229
|
+
return [
|
|
1230
|
+
4,
|
|
1231
|
+
_this.loadToken()
|
|
1232
|
+
];
|
|
1233
|
+
case 1:
|
|
1234
|
+
token = _state.sent();
|
|
1235
|
+
try {
|
|
1236
|
+
privateKey = createPrivateKey({
|
|
1237
|
+
key: token.dpopKey,
|
|
1238
|
+
format: "pem",
|
|
1239
|
+
type: "sec1"
|
|
1240
|
+
});
|
|
1241
|
+
publicKey = createPublicKey(privateKey);
|
|
1242
|
+
publicDer = publicKey.export({
|
|
1243
|
+
format: "der",
|
|
1244
|
+
type: "spki"
|
|
1245
|
+
});
|
|
1246
|
+
pointStart = -1;
|
|
1247
|
+
for(i = 0; i < publicDer.length; i++){
|
|
1248
|
+
if (publicDer[i] === 0x04) {
|
|
1249
|
+
pointStart = i;
|
|
1250
|
+
break;
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
x = publicDer.slice(pointStart + 1, pointStart + 33);
|
|
1254
|
+
y = publicDer.slice(pointStart + 33, pointStart + 65);
|
|
1255
|
+
header = {
|
|
1256
|
+
alg: "ES256",
|
|
1257
|
+
typ: "dpop+jwt",
|
|
1258
|
+
jwk: {
|
|
1259
|
+
kty: "EC",
|
|
1260
|
+
crv: "P-256",
|
|
1261
|
+
x: x.toString("base64url"),
|
|
1262
|
+
y: y.toString("base64url")
|
|
1263
|
+
}
|
|
1264
|
+
};
|
|
1265
|
+
payload = {
|
|
1266
|
+
jti: crypto.randomUUID(),
|
|
1267
|
+
htm: method,
|
|
1268
|
+
htu: endpoint,
|
|
1269
|
+
iat: Math.floor(Date.now() / 1000)
|
|
1270
|
+
};
|
|
1271
|
+
headerB64 = Buffer.from(JSON.stringify(header)).toString("base64url");
|
|
1272
|
+
payloadB64 = Buffer.from(JSON.stringify(payload)).toString("base64url");
|
|
1273
|
+
message = "".concat(headerB64, ".").concat(payloadB64);
|
|
1274
|
+
asn1Signature = sign("sha256", Buffer.from(message), privateKey);
|
|
1275
|
+
rawSignature = _this.derToRawSignature(asn1Signature);
|
|
1276
|
+
signatureB64 = rawSignature.toString("base64url");
|
|
1277
|
+
return [
|
|
1278
|
+
2,
|
|
1279
|
+
"".concat(message, ".").concat(signatureB64)
|
|
1280
|
+
];
|
|
1281
|
+
} catch (error) {
|
|
1282
|
+
throw new CredentialsProviderError("Failed to generate Dpop proof: ".concat(_instanceof(error, Error) ? error.message : String(error)), {
|
|
1283
|
+
logger: _this.logger,
|
|
1284
|
+
tryNextLink: false
|
|
1285
|
+
});
|
|
1286
|
+
}
|
|
1287
|
+
return [
|
|
1288
|
+
2
|
|
1289
|
+
];
|
|
1290
|
+
}
|
|
1291
|
+
});
|
|
1292
|
+
})();
|
|
1263
1293
|
}
|
|
1264
1294
|
}
|
|
1265
1295
|
]);
|
|
1266
|
-
return
|
|
1267
|
-
}(
|
|
1296
|
+
return LoginCredentialsFetcher;
|
|
1297
|
+
}();
|
|
1298
|
+
_define_property$3(LoginCredentialsFetcher, "REFRESH_THRESHOLD", 5 * 60 * 1000);
|
|
1268
1299
|
|
|
1269
|
-
function asyncGeneratorStep$
|
|
1300
|
+
function asyncGeneratorStep$7(gen, resolve, reject, _next, _throw, key, arg) {
|
|
1270
1301
|
try {
|
|
1271
1302
|
var info = gen[key](arg);
|
|
1272
1303
|
var value = info.value;
|
|
@@ -1280,29 +1311,22 @@ function asyncGeneratorStep$6(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
1280
1311
|
Promise.resolve(value).then(_next, _throw);
|
|
1281
1312
|
}
|
|
1282
1313
|
}
|
|
1283
|
-
function _async_to_generator$
|
|
1314
|
+
function _async_to_generator$7(fn) {
|
|
1284
1315
|
return function() {
|
|
1285
1316
|
var self = this, args = arguments;
|
|
1286
1317
|
return new Promise(function(resolve, reject) {
|
|
1287
1318
|
var gen = fn.apply(self, args);
|
|
1288
1319
|
function _next(value) {
|
|
1289
|
-
asyncGeneratorStep$
|
|
1320
|
+
asyncGeneratorStep$7(gen, resolve, reject, _next, _throw, "next", value);
|
|
1290
1321
|
}
|
|
1291
1322
|
function _throw(err) {
|
|
1292
|
-
asyncGeneratorStep$
|
|
1323
|
+
asyncGeneratorStep$7(gen, resolve, reject, _next, _throw, "throw", err);
|
|
1293
1324
|
}
|
|
1294
1325
|
_next(undefined);
|
|
1295
1326
|
});
|
|
1296
1327
|
};
|
|
1297
1328
|
}
|
|
1298
|
-
function
|
|
1299
|
-
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
1300
|
-
return !!right[Symbol.hasInstance](left);
|
|
1301
|
-
} else {
|
|
1302
|
-
return left instanceof right;
|
|
1303
|
-
}
|
|
1304
|
-
}
|
|
1305
|
-
function _ts_generator$6(thisArg, body) {
|
|
1329
|
+
function _ts_generator$7(thisArg, body) {
|
|
1306
1330
|
var f, y, t, g, _ = {
|
|
1307
1331
|
label: 0,
|
|
1308
1332
|
sent: function() {
|
|
@@ -1397,288 +1421,77 @@ function _ts_generator$6(thisArg, body) {
|
|
|
1397
1421
|
};
|
|
1398
1422
|
}
|
|
1399
1423
|
}
|
|
1400
|
-
var
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
var collector = new Collector();
|
|
1406
|
-
stream.pipe(collector);
|
|
1407
|
-
stream.on("error", function(err) {
|
|
1408
|
-
collector.end();
|
|
1409
|
-
reject(err);
|
|
1410
|
-
});
|
|
1411
|
-
collector.on("error", reject);
|
|
1412
|
-
collector.on("finish", function() {
|
|
1413
|
-
var bytes = new Uint8Array(Buffer.concat(this.bufferedBytes));
|
|
1414
|
-
resolve(bytes);
|
|
1415
|
-
});
|
|
1416
|
-
});
|
|
1417
|
-
};
|
|
1418
|
-
var isReadableStreamInstance = function(stream) {
|
|
1419
|
-
return typeof ReadableStream === "function" && _instanceof$4(stream, ReadableStream);
|
|
1420
|
-
};
|
|
1421
|
-
function collectReadableStream(stream) {
|
|
1422
|
-
return _collectReadableStream.apply(this, arguments);
|
|
1423
|
-
}
|
|
1424
|
-
function _collectReadableStream() {
|
|
1425
|
-
_collectReadableStream = _async_to_generator$6(function(stream) {
|
|
1426
|
-
var chunks, reader, isDone, length, _ref, done, value, collected, offset, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, chunk;
|
|
1427
|
-
return _ts_generator$6(this, function(_state) {
|
|
1424
|
+
var fromLoginCredentials = function(init) {
|
|
1425
|
+
return /*#__PURE__*/ _async_to_generator$7(function() {
|
|
1426
|
+
var callerClientConfig, _init_logger_debug, _init_logger, profiles, _init_profile, profileName, profile, fetcher, credentials;
|
|
1427
|
+
var _arguments = arguments;
|
|
1428
|
+
return _ts_generator$7(this, function(_state) {
|
|
1428
1429
|
switch(_state.label){
|
|
1429
1430
|
case 0:
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
isDone = false;
|
|
1433
|
-
length = 0;
|
|
1434
|
-
_state.label = 1;
|
|
1435
|
-
case 1:
|
|
1436
|
-
if (!!isDone) return [
|
|
1437
|
-
3,
|
|
1438
|
-
3
|
|
1439
|
-
];
|
|
1431
|
+
callerClientConfig = (_arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : {}).callerClientConfig;
|
|
1432
|
+
init === null || init === void 0 ? void 0 : (_init_logger = init.logger) === null || _init_logger === void 0 ? void 0 : (_init_logger_debug = _init_logger.debug) === null || _init_logger_debug === void 0 ? void 0 : _init_logger_debug.call(_init_logger, "@aws-sdk/credential-providers - fromLoginCredentials");
|
|
1440
1433
|
return [
|
|
1441
1434
|
4,
|
|
1442
|
-
|
|
1435
|
+
parseKnownFiles(init || {})
|
|
1443
1436
|
];
|
|
1444
|
-
case
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1437
|
+
case 1:
|
|
1438
|
+
profiles = _state.sent();
|
|
1439
|
+
profileName = getProfileName({
|
|
1440
|
+
profile: (_init_profile = init === null || init === void 0 ? void 0 : init.profile) !== null && _init_profile !== void 0 ? _init_profile : callerClientConfig === null || callerClientConfig === void 0 ? void 0 : callerClientConfig.profile
|
|
1441
|
+
});
|
|
1442
|
+
profile = profiles[profileName];
|
|
1443
|
+
if (!(profile === null || profile === void 0 ? void 0 : profile.login_session)) {
|
|
1444
|
+
throw new CredentialsProviderError("Profile ".concat(profileName, " does not contain login_session."), {
|
|
1445
|
+
tryNextLink: true,
|
|
1446
|
+
logger: init === null || init === void 0 ? void 0 : init.logger
|
|
1447
|
+
});
|
|
1449
1448
|
}
|
|
1450
|
-
|
|
1449
|
+
fetcher = new LoginCredentialsFetcher(profile, init, callerClientConfig);
|
|
1451
1450
|
return [
|
|
1452
|
-
|
|
1453
|
-
|
|
1451
|
+
4,
|
|
1452
|
+
fetcher.loadCredentials()
|
|
1454
1453
|
];
|
|
1455
|
-
case
|
|
1456
|
-
|
|
1457
|
-
offset = 0;
|
|
1458
|
-
_iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
1459
|
-
try {
|
|
1460
|
-
for(_iterator = chunks[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
1461
|
-
chunk = _step.value;
|
|
1462
|
-
collected.set(chunk, offset);
|
|
1463
|
-
offset += chunk.length;
|
|
1464
|
-
}
|
|
1465
|
-
} catch (err) {
|
|
1466
|
-
_didIteratorError = true;
|
|
1467
|
-
_iteratorError = err;
|
|
1468
|
-
} finally{
|
|
1469
|
-
try {
|
|
1470
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
1471
|
-
_iterator.return();
|
|
1472
|
-
}
|
|
1473
|
-
} finally{
|
|
1474
|
-
if (_didIteratorError) {
|
|
1475
|
-
throw _iteratorError;
|
|
1476
|
-
}
|
|
1477
|
-
}
|
|
1478
|
-
}
|
|
1454
|
+
case 2:
|
|
1455
|
+
credentials = _state.sent();
|
|
1479
1456
|
return [
|
|
1480
1457
|
2,
|
|
1481
|
-
|
|
1458
|
+
setCredentialFeature(credentials, "CREDENTIALS_LOGIN", "AD")
|
|
1482
1459
|
];
|
|
1483
1460
|
}
|
|
1484
1461
|
});
|
|
1485
1462
|
});
|
|
1486
|
-
|
|
1487
|
-
}
|
|
1463
|
+
};
|
|
1488
1464
|
|
|
1489
|
-
function
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
if (!(instance instanceof Constructor)) {
|
|
1497
|
-
throw new TypeError("Cannot call a class as a function");
|
|
1498
|
-
}
|
|
1499
|
-
}
|
|
1500
|
-
function _construct(Parent, args, Class) {
|
|
1501
|
-
if (_is_native_reflect_construct$1()) {
|
|
1502
|
-
_construct = Reflect.construct;
|
|
1503
|
-
} else {
|
|
1504
|
-
_construct = function construct(Parent, args, Class) {
|
|
1505
|
-
var a = [
|
|
1506
|
-
null
|
|
1507
|
-
];
|
|
1508
|
-
a.push.apply(a, args);
|
|
1509
|
-
var Constructor = Function.bind.apply(Parent, a);
|
|
1510
|
-
var instance = new Constructor();
|
|
1511
|
-
if (Class) _set_prototype_of$1(instance, Class.prototype);
|
|
1512
|
-
return instance;
|
|
1513
|
-
};
|
|
1514
|
-
}
|
|
1515
|
-
return _construct.apply(null, arguments);
|
|
1516
|
-
}
|
|
1517
|
-
function _defineProperties(target, props) {
|
|
1518
|
-
for(var i = 0; i < props.length; i++){
|
|
1519
|
-
var descriptor = props[i];
|
|
1520
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
1521
|
-
descriptor.configurable = true;
|
|
1522
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
1523
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
1465
|
+
function asyncGeneratorStep$6(gen, resolve, reject, _next, _throw, key, arg) {
|
|
1466
|
+
try {
|
|
1467
|
+
var info = gen[key](arg);
|
|
1468
|
+
var value = info.value;
|
|
1469
|
+
} catch (error) {
|
|
1470
|
+
reject(error);
|
|
1471
|
+
return;
|
|
1524
1472
|
}
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
1528
|
-
return Constructor;
|
|
1529
|
-
}
|
|
1530
|
-
function _define_property$1(obj, key, value) {
|
|
1531
|
-
if (key in obj) {
|
|
1532
|
-
Object.defineProperty(obj, key, {
|
|
1533
|
-
value: value,
|
|
1534
|
-
enumerable: true,
|
|
1535
|
-
configurable: true,
|
|
1536
|
-
writable: true
|
|
1537
|
-
});
|
|
1473
|
+
if (info.done) {
|
|
1474
|
+
resolve(value);
|
|
1538
1475
|
} else {
|
|
1539
|
-
|
|
1540
|
-
}
|
|
1541
|
-
return obj;
|
|
1542
|
-
}
|
|
1543
|
-
function _get_prototype_of$1(o) {
|
|
1544
|
-
_get_prototype_of$1 = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
1545
|
-
return o.__proto__ || Object.getPrototypeOf(o);
|
|
1546
|
-
};
|
|
1547
|
-
return _get_prototype_of$1(o);
|
|
1548
|
-
}
|
|
1549
|
-
function _inherits$1(subClass, superClass) {
|
|
1550
|
-
if (typeof superClass !== "function" && superClass !== null) {
|
|
1551
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
1552
|
-
}
|
|
1553
|
-
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
1554
|
-
constructor: {
|
|
1555
|
-
value: subClass,
|
|
1556
|
-
writable: true,
|
|
1557
|
-
configurable: true
|
|
1558
|
-
}
|
|
1559
|
-
});
|
|
1560
|
-
if (superClass) _set_prototype_of$1(subClass, superClass);
|
|
1561
|
-
}
|
|
1562
|
-
function _is_native_function(fn) {
|
|
1563
|
-
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
|
1564
|
-
}
|
|
1565
|
-
function _possible_constructor_return$1(self, call) {
|
|
1566
|
-
if (call && (_type_of$2(call) === "object" || typeof call === "function")) {
|
|
1567
|
-
return call;
|
|
1476
|
+
Promise.resolve(value).then(_next, _throw);
|
|
1568
1477
|
}
|
|
1569
|
-
return _assert_this_initialized$1(self);
|
|
1570
|
-
}
|
|
1571
|
-
function _set_prototype_of$1(o, p) {
|
|
1572
|
-
_set_prototype_of$1 = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
1573
|
-
o.__proto__ = p;
|
|
1574
|
-
return o;
|
|
1575
|
-
};
|
|
1576
|
-
return _set_prototype_of$1(o, p);
|
|
1577
|
-
}
|
|
1578
|
-
function _type_of$2(obj) {
|
|
1579
|
-
"@swc/helpers - typeof";
|
|
1580
|
-
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
1581
1478
|
}
|
|
1582
|
-
function
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
}
|
|
1593
|
-
function Wrapper() {
|
|
1594
|
-
return _construct(Class, arguments, _get_prototype_of$1(this).constructor);
|
|
1595
|
-
}
|
|
1596
|
-
Wrapper.prototype = Object.create(Class.prototype, {
|
|
1597
|
-
constructor: {
|
|
1598
|
-
value: Wrapper,
|
|
1599
|
-
enumerable: false,
|
|
1600
|
-
writable: true,
|
|
1601
|
-
configurable: true
|
|
1479
|
+
function _async_to_generator$6(fn) {
|
|
1480
|
+
return function() {
|
|
1481
|
+
var self = this, args = arguments;
|
|
1482
|
+
return new Promise(function(resolve, reject) {
|
|
1483
|
+
var gen = fn.apply(self, args);
|
|
1484
|
+
function _next(value) {
|
|
1485
|
+
asyncGeneratorStep$6(gen, resolve, reject, _next, _throw, "next", value);
|
|
1486
|
+
}
|
|
1487
|
+
function _throw(err) {
|
|
1488
|
+
asyncGeneratorStep$6(gen, resolve, reject, _next, _throw, "throw", err);
|
|
1602
1489
|
}
|
|
1490
|
+
_next(undefined);
|
|
1603
1491
|
});
|
|
1604
|
-
return _set_prototype_of$1(Wrapper, Class);
|
|
1605
|
-
};
|
|
1606
|
-
return _wrap_native_super(Class);
|
|
1607
|
-
}
|
|
1608
|
-
function _is_native_reflect_construct$1() {
|
|
1609
|
-
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
1610
|
-
if (Reflect.construct.sham) return false;
|
|
1611
|
-
if (typeof Proxy === "function") return true;
|
|
1612
|
-
try {
|
|
1613
|
-
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
1614
|
-
return true;
|
|
1615
|
-
} catch (e) {
|
|
1616
|
-
return false;
|
|
1617
|
-
}
|
|
1618
|
-
}
|
|
1619
|
-
function _create_super$1(Derived) {
|
|
1620
|
-
var hasNativeReflectConstruct = _is_native_reflect_construct$1();
|
|
1621
|
-
return function _createSuperInternal() {
|
|
1622
|
-
var Super = _get_prototype_of$1(Derived), result;
|
|
1623
|
-
if (hasNativeReflectConstruct) {
|
|
1624
|
-
var NewTarget = _get_prototype_of$1(this).constructor;
|
|
1625
|
-
result = Reflect.construct(Super, arguments, NewTarget);
|
|
1626
|
-
} else {
|
|
1627
|
-
result = Super.apply(this, arguments);
|
|
1628
|
-
}
|
|
1629
|
-
return _possible_constructor_return$1(this, result);
|
|
1630
1492
|
};
|
|
1631
1493
|
}
|
|
1632
|
-
|
|
1633
|
-
_inherits$1(ProviderError, Error1);
|
|
1634
|
-
var _super = _create_super$1(ProviderError);
|
|
1635
|
-
function ProviderError(message) {
|
|
1636
|
-
var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
|
|
1637
|
-
_class_call_check$1(this, ProviderError);
|
|
1638
|
-
var _this;
|
|
1639
|
-
var _logger_debug;
|
|
1640
|
-
var logger;
|
|
1641
|
-
var tryNextLink = true;
|
|
1642
|
-
if (typeof options === "boolean") {
|
|
1643
|
-
logger = undefined;
|
|
1644
|
-
tryNextLink = options;
|
|
1645
|
-
} else if (options != null && (typeof options === "undefined" ? "undefined" : _type_of$2(options)) === "object") {
|
|
1646
|
-
logger = options.logger;
|
|
1647
|
-
var _options_tryNextLink;
|
|
1648
|
-
tryNextLink = (_options_tryNextLink = options.tryNextLink) !== null && _options_tryNextLink !== void 0 ? _options_tryNextLink : true;
|
|
1649
|
-
}
|
|
1650
|
-
_this = _super.call(this, message);
|
|
1651
|
-
_define_property$1(_assert_this_initialized$1(_this), "name", "ProviderError");
|
|
1652
|
-
_define_property$1(_assert_this_initialized$1(_this), "tryNextLink", void 0);
|
|
1653
|
-
_this.tryNextLink = tryNextLink;
|
|
1654
|
-
Object.setPrototypeOf(_assert_this_initialized$1(_this), ProviderError.prototype);
|
|
1655
|
-
logger === null || logger === void 0 ? void 0 : (_logger_debug = logger.debug) === null || _logger_debug === void 0 ? void 0 : _logger_debug.call(logger, "@smithy/property-provider ".concat(tryNextLink ? "->" : "(!)", " ").concat(message));
|
|
1656
|
-
return _this;
|
|
1657
|
-
}
|
|
1658
|
-
_create_class(ProviderError, null, [
|
|
1659
|
-
{
|
|
1660
|
-
key: "from",
|
|
1661
|
-
value: function from(error) {
|
|
1662
|
-
var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
|
|
1663
|
-
return Object.assign(new this(error.message, options), error);
|
|
1664
|
-
}
|
|
1665
|
-
}
|
|
1666
|
-
]);
|
|
1667
|
-
return ProviderError;
|
|
1668
|
-
}(_wrap_native_super(Error));
|
|
1669
|
-
|
|
1670
|
-
function _assert_this_initialized(self) {
|
|
1671
|
-
if (self === void 0) {
|
|
1672
|
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
1673
|
-
}
|
|
1674
|
-
return self;
|
|
1675
|
-
}
|
|
1676
|
-
function _class_call_check(instance, Constructor) {
|
|
1677
|
-
if (!(instance instanceof Constructor)) {
|
|
1678
|
-
throw new TypeError("Cannot call a class as a function");
|
|
1679
|
-
}
|
|
1680
|
-
}
|
|
1681
|
-
function _define_property(obj, key, value) {
|
|
1494
|
+
function _define_property$2(obj, key, value) {
|
|
1682
1495
|
if (key in obj) {
|
|
1683
1496
|
Object.defineProperty(obj, key, {
|
|
1684
1497
|
value: value,
|
|
@@ -1691,124 +1504,165 @@ function _define_property(obj, key, value) {
|
|
|
1691
1504
|
}
|
|
1692
1505
|
return obj;
|
|
1693
1506
|
}
|
|
1694
|
-
function
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
1703
|
-
}
|
|
1704
|
-
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
1705
|
-
constructor: {
|
|
1706
|
-
value: subClass,
|
|
1707
|
-
writable: true,
|
|
1708
|
-
configurable: true
|
|
1507
|
+
function _object_spread$2(target) {
|
|
1508
|
+
for(var i = 1; i < arguments.length; i++){
|
|
1509
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
1510
|
+
var ownKeys = Object.keys(source);
|
|
1511
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
1512
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
1513
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
1514
|
+
}));
|
|
1709
1515
|
}
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
}
|
|
1713
|
-
function _possible_constructor_return(self, call) {
|
|
1714
|
-
if (call && (_type_of$1(call) === "object" || typeof call === "function")) {
|
|
1715
|
-
return call;
|
|
1516
|
+
ownKeys.forEach(function(key) {
|
|
1517
|
+
_define_property$2(target, key, source[key]);
|
|
1518
|
+
});
|
|
1716
1519
|
}
|
|
1717
|
-
return
|
|
1718
|
-
}
|
|
1719
|
-
function _set_prototype_of(o, p) {
|
|
1720
|
-
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
1721
|
-
o.__proto__ = p;
|
|
1722
|
-
return o;
|
|
1723
|
-
};
|
|
1724
|
-
return _set_prototype_of(o, p);
|
|
1520
|
+
return target;
|
|
1725
1521
|
}
|
|
1726
|
-
function
|
|
1727
|
-
|
|
1728
|
-
|
|
1522
|
+
function ownKeys$1(object, enumerableOnly) {
|
|
1523
|
+
var keys = Object.keys(object);
|
|
1524
|
+
if (Object.getOwnPropertySymbols) {
|
|
1525
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
1526
|
+
keys.push.apply(keys, symbols);
|
|
1527
|
+
}
|
|
1528
|
+
return keys;
|
|
1729
1529
|
}
|
|
1730
|
-
function
|
|
1731
|
-
|
|
1732
|
-
if (
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
return false;
|
|
1530
|
+
function _object_spread_props$1(target, source) {
|
|
1531
|
+
source = source != null ? source : {};
|
|
1532
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
1533
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
1534
|
+
} else {
|
|
1535
|
+
ownKeys$1(Object(source)).forEach(function(key) {
|
|
1536
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
1537
|
+
});
|
|
1739
1538
|
}
|
|
1539
|
+
return target;
|
|
1740
1540
|
}
|
|
1741
|
-
function
|
|
1742
|
-
var
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
}
|
|
1751
|
-
return _possible_constructor_return(this, result);
|
|
1541
|
+
function _ts_generator$6(thisArg, body) {
|
|
1542
|
+
var f, y, t, g, _ = {
|
|
1543
|
+
label: 0,
|
|
1544
|
+
sent: function() {
|
|
1545
|
+
if (t[0] & 1) throw t[1];
|
|
1546
|
+
return t[1];
|
|
1547
|
+
},
|
|
1548
|
+
trys: [],
|
|
1549
|
+
ops: []
|
|
1752
1550
|
};
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
function
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
}(ProviderError);
|
|
1768
|
-
|
|
1769
|
-
var ECS_CONTAINER_HOST = "169.254.170.2";
|
|
1770
|
-
var EKS_CONTAINER_HOST_IPv4 = "169.254.170.23";
|
|
1771
|
-
var EKS_CONTAINER_HOST_IPv6 = "[fd00:ec2::23]";
|
|
1772
|
-
var checkUrl = function(url, logger) {
|
|
1773
|
-
if (url.protocol === "https:") {
|
|
1774
|
-
return;
|
|
1775
|
-
}
|
|
1776
|
-
if (url.hostname === ECS_CONTAINER_HOST || url.hostname === EKS_CONTAINER_HOST_IPv4 || url.hostname === EKS_CONTAINER_HOST_IPv6) {
|
|
1777
|
-
return;
|
|
1551
|
+
return g = {
|
|
1552
|
+
next: verb(0),
|
|
1553
|
+
"throw": verb(1),
|
|
1554
|
+
"return": verb(2)
|
|
1555
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
1556
|
+
return this;
|
|
1557
|
+
}), g;
|
|
1558
|
+
function verb(n) {
|
|
1559
|
+
return function(v) {
|
|
1560
|
+
return step([
|
|
1561
|
+
n,
|
|
1562
|
+
v
|
|
1563
|
+
]);
|
|
1564
|
+
};
|
|
1778
1565
|
}
|
|
1779
|
-
|
|
1780
|
-
if (
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1566
|
+
function step(op) {
|
|
1567
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
1568
|
+
while(_)try {
|
|
1569
|
+
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;
|
|
1570
|
+
if (y = 0, t) op = [
|
|
1571
|
+
op[0] & 2,
|
|
1572
|
+
t.value
|
|
1573
|
+
];
|
|
1574
|
+
switch(op[0]){
|
|
1575
|
+
case 0:
|
|
1576
|
+
case 1:
|
|
1577
|
+
t = op;
|
|
1578
|
+
break;
|
|
1579
|
+
case 4:
|
|
1580
|
+
_.label++;
|
|
1581
|
+
return {
|
|
1582
|
+
value: op[1],
|
|
1583
|
+
done: false
|
|
1584
|
+
};
|
|
1585
|
+
case 5:
|
|
1586
|
+
_.label++;
|
|
1587
|
+
y = op[1];
|
|
1588
|
+
op = [
|
|
1589
|
+
0
|
|
1590
|
+
];
|
|
1591
|
+
continue;
|
|
1592
|
+
case 7:
|
|
1593
|
+
op = _.ops.pop();
|
|
1594
|
+
_.trys.pop();
|
|
1595
|
+
continue;
|
|
1596
|
+
default:
|
|
1597
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
1598
|
+
_ = 0;
|
|
1599
|
+
continue;
|
|
1600
|
+
}
|
|
1601
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
1602
|
+
_.label = op[1];
|
|
1603
|
+
break;
|
|
1604
|
+
}
|
|
1605
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
1606
|
+
_.label = t[1];
|
|
1607
|
+
t = op;
|
|
1608
|
+
break;
|
|
1609
|
+
}
|
|
1610
|
+
if (t && _.label < t[2]) {
|
|
1611
|
+
_.label = t[2];
|
|
1612
|
+
_.ops.push(op);
|
|
1613
|
+
break;
|
|
1614
|
+
}
|
|
1615
|
+
if (t[2]) _.ops.pop();
|
|
1616
|
+
_.trys.pop();
|
|
1617
|
+
continue;
|
|
1618
|
+
}
|
|
1619
|
+
op = body.call(thisArg, _);
|
|
1620
|
+
} catch (e) {
|
|
1621
|
+
op = [
|
|
1622
|
+
6,
|
|
1623
|
+
e
|
|
1624
|
+
];
|
|
1625
|
+
y = 0;
|
|
1626
|
+
} finally{
|
|
1627
|
+
f = t = 0;
|
|
1786
1628
|
}
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1629
|
+
if (op[0] & 5) throw op[1];
|
|
1630
|
+
return {
|
|
1631
|
+
value: op[0] ? op[1] : void 0,
|
|
1632
|
+
done: true
|
|
1791
1633
|
};
|
|
1792
|
-
if (ipComponents[0] === "127" && inRange(ipComponents[1]) && inRange(ipComponents[2]) && inRange(ipComponents[3]) && ipComponents.length === 4) {
|
|
1793
|
-
return;
|
|
1794
|
-
}
|
|
1795
|
-
}
|
|
1796
|
-
throw new CredentialsProviderError("URL not accepted. It must either be HTTPS or match one of the following:\n - loopback CIDR 127.0.0.0/8 or [::1/128]\n - ECS container host 169.254.170.2\n - EKS container host 169.254.170.23 or [fd00:ec2::23]", {
|
|
1797
|
-
logger: logger
|
|
1798
|
-
});
|
|
1799
|
-
};
|
|
1800
|
-
|
|
1801
|
-
function _instanceof$3(left, right) {
|
|
1802
|
-
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
1803
|
-
return !!right[Symbol.hasInstance](left);
|
|
1804
|
-
} else {
|
|
1805
|
-
return left instanceof right;
|
|
1806
1634
|
}
|
|
1807
1635
|
}
|
|
1808
|
-
var
|
|
1809
|
-
|
|
1810
|
-
return typeof ReadableStream === "function" && ((stream === null || stream === void 0 ? void 0 : (_stream_constructor = stream.constructor) === null || _stream_constructor === void 0 ? void 0 : _stream_constructor.name) === ReadableStream.name || _instanceof$3(stream, ReadableStream));
|
|
1636
|
+
var isLoginProfile = function(data) {
|
|
1637
|
+
return Boolean(data && data.login_session);
|
|
1811
1638
|
};
|
|
1639
|
+
var resolveLoginCredentials = function() {
|
|
1640
|
+
var _ref = _async_to_generator$6(function(profileName, options, callerClientConfig) {
|
|
1641
|
+
var credentials;
|
|
1642
|
+
return _ts_generator$6(this, function(_state) {
|
|
1643
|
+
switch(_state.label){
|
|
1644
|
+
case 0:
|
|
1645
|
+
return [
|
|
1646
|
+
4,
|
|
1647
|
+
fromLoginCredentials(_object_spread_props$1(_object_spread$2({}, options), {
|
|
1648
|
+
profile: profileName
|
|
1649
|
+
}))({
|
|
1650
|
+
callerClientConfig: callerClientConfig
|
|
1651
|
+
})
|
|
1652
|
+
];
|
|
1653
|
+
case 1:
|
|
1654
|
+
credentials = _state.sent();
|
|
1655
|
+
return [
|
|
1656
|
+
2,
|
|
1657
|
+
setCredentialFeature(credentials, "CREDENTIALS_PROFILE_LOGIN", "AC")
|
|
1658
|
+
];
|
|
1659
|
+
}
|
|
1660
|
+
});
|
|
1661
|
+
});
|
|
1662
|
+
return function resolveLoginCredentials(profileName, options, callerClientConfig) {
|
|
1663
|
+
return _ref.apply(this, arguments);
|
|
1664
|
+
};
|
|
1665
|
+
}();
|
|
1812
1666
|
|
|
1813
1667
|
function asyncGeneratorStep$5(gen, resolve, reject, _next, _throw, key, arg) {
|
|
1814
1668
|
try {
|
|
@@ -1839,12 +1693,56 @@ function _async_to_generator$5(fn) {
|
|
|
1839
1693
|
});
|
|
1840
1694
|
};
|
|
1841
1695
|
}
|
|
1842
|
-
function
|
|
1843
|
-
if (
|
|
1844
|
-
|
|
1696
|
+
function _define_property$1(obj, key, value) {
|
|
1697
|
+
if (key in obj) {
|
|
1698
|
+
Object.defineProperty(obj, key, {
|
|
1699
|
+
value: value,
|
|
1700
|
+
enumerable: true,
|
|
1701
|
+
configurable: true,
|
|
1702
|
+
writable: true
|
|
1703
|
+
});
|
|
1845
1704
|
} else {
|
|
1846
|
-
|
|
1705
|
+
obj[key] = value;
|
|
1706
|
+
}
|
|
1707
|
+
return obj;
|
|
1708
|
+
}
|
|
1709
|
+
function _object_spread$1(target) {
|
|
1710
|
+
for(var i = 1; i < arguments.length; i++){
|
|
1711
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
1712
|
+
var ownKeys = Object.keys(source);
|
|
1713
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
1714
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
1715
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
1716
|
+
}));
|
|
1717
|
+
}
|
|
1718
|
+
ownKeys.forEach(function(key) {
|
|
1719
|
+
_define_property$1(target, key, source[key]);
|
|
1720
|
+
});
|
|
1721
|
+
}
|
|
1722
|
+
return target;
|
|
1723
|
+
}
|
|
1724
|
+
function ownKeys(object, enumerableOnly) {
|
|
1725
|
+
var keys = Object.keys(object);
|
|
1726
|
+
if (Object.getOwnPropertySymbols) {
|
|
1727
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
1728
|
+
keys.push.apply(keys, symbols);
|
|
1729
|
+
}
|
|
1730
|
+
return keys;
|
|
1731
|
+
}
|
|
1732
|
+
function _object_spread_props(target, source) {
|
|
1733
|
+
source = source != null ? source : {};
|
|
1734
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
1735
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
1736
|
+
} else {
|
|
1737
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
1738
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
1739
|
+
});
|
|
1847
1740
|
}
|
|
1741
|
+
return target;
|
|
1742
|
+
}
|
|
1743
|
+
function _type_of$2(obj) {
|
|
1744
|
+
"@swc/helpers - typeof";
|
|
1745
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
1848
1746
|
}
|
|
1849
1747
|
function _ts_generator$5(thisArg, body) {
|
|
1850
1748
|
var f, y, t, g, _ = {
|
|
@@ -1941,164 +1839,29 @@ function _ts_generator$5(thisArg, body) {
|
|
|
1941
1839
|
};
|
|
1942
1840
|
}
|
|
1943
1841
|
}
|
|
1944
|
-
var
|
|
1945
|
-
|
|
1946
|
-
|
|
1842
|
+
var isProcessProfile = function(arg) {
|
|
1843
|
+
return Boolean(arg) && (typeof arg === "undefined" ? "undefined" : _type_of$2(arg)) === "object" && typeof arg.credential_process === "string";
|
|
1844
|
+
};
|
|
1845
|
+
var resolveProcessCredentials = function() {
|
|
1846
|
+
var _ref = _async_to_generator$5(function(options, profile) {
|
|
1947
1847
|
return _ts_generator$5(this, function(_state) {
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
return [
|
|
1960
|
-
4,
|
|
1961
|
-
stream.arrayBuffer()
|
|
1962
|
-
];
|
|
1963
|
-
case 1:
|
|
1964
|
-
return [
|
|
1965
|
-
2,
|
|
1966
|
-
new (_.apply(Uint8Array, [
|
|
1967
|
-
void 0,
|
|
1968
|
-
_state.sent()
|
|
1969
|
-
]))
|
|
1970
|
-
];
|
|
1971
|
-
case 2:
|
|
1972
|
-
return [
|
|
1973
|
-
2,
|
|
1974
|
-
collectBlob(stream)
|
|
1975
|
-
];
|
|
1976
|
-
case 3:
|
|
1977
|
-
return [
|
|
1978
|
-
2,
|
|
1979
|
-
collectStream(stream)
|
|
1980
|
-
];
|
|
1981
|
-
}
|
|
1848
|
+
return [
|
|
1849
|
+
2,
|
|
1850
|
+
import('./index.esm7.js').then(function(param) {
|
|
1851
|
+
var fromProcess = param.fromProcess;
|
|
1852
|
+
return fromProcess(_object_spread_props(_object_spread$1({}, options), {
|
|
1853
|
+
profile: profile
|
|
1854
|
+
}))().then(function(creds) {
|
|
1855
|
+
return setCredentialFeature(creds, "CREDENTIALS_PROFILE_PROCESS", "v");
|
|
1856
|
+
});
|
|
1857
|
+
})
|
|
1858
|
+
];
|
|
1982
1859
|
});
|
|
1983
1860
|
});
|
|
1984
|
-
return function
|
|
1861
|
+
return function resolveProcessCredentials(options, profile) {
|
|
1985
1862
|
return _ref.apply(this, arguments);
|
|
1986
1863
|
};
|
|
1987
1864
|
}();
|
|
1988
|
-
function collectBlob(blob) {
|
|
1989
|
-
return _collectBlob.apply(this, arguments);
|
|
1990
|
-
}
|
|
1991
|
-
function _collectBlob() {
|
|
1992
|
-
_collectBlob = _async_to_generator$5(function(blob) {
|
|
1993
|
-
var base64, arrayBuffer;
|
|
1994
|
-
return _ts_generator$5(this, function(_state) {
|
|
1995
|
-
switch(_state.label){
|
|
1996
|
-
case 0:
|
|
1997
|
-
return [
|
|
1998
|
-
4,
|
|
1999
|
-
readToBase64(blob)
|
|
2000
|
-
];
|
|
2001
|
-
case 1:
|
|
2002
|
-
base64 = _state.sent();
|
|
2003
|
-
arrayBuffer = fromBase64(base64);
|
|
2004
|
-
return [
|
|
2005
|
-
2,
|
|
2006
|
-
new Uint8Array(arrayBuffer)
|
|
2007
|
-
];
|
|
2008
|
-
}
|
|
2009
|
-
});
|
|
2010
|
-
});
|
|
2011
|
-
return _collectBlob.apply(this, arguments);
|
|
2012
|
-
}
|
|
2013
|
-
function collectStream(stream) {
|
|
2014
|
-
return _collectStream.apply(this, arguments);
|
|
2015
|
-
}
|
|
2016
|
-
function _collectStream() {
|
|
2017
|
-
_collectStream = _async_to_generator$5(function(stream) {
|
|
2018
|
-
var chunks, reader, isDone, length, _ref, done, value, collected, offset, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, chunk;
|
|
2019
|
-
return _ts_generator$5(this, function(_state) {
|
|
2020
|
-
switch(_state.label){
|
|
2021
|
-
case 0:
|
|
2022
|
-
chunks = [];
|
|
2023
|
-
reader = stream.getReader();
|
|
2024
|
-
isDone = false;
|
|
2025
|
-
length = 0;
|
|
2026
|
-
_state.label = 1;
|
|
2027
|
-
case 1:
|
|
2028
|
-
if (!!isDone) return [
|
|
2029
|
-
3,
|
|
2030
|
-
3
|
|
2031
|
-
];
|
|
2032
|
-
return [
|
|
2033
|
-
4,
|
|
2034
|
-
reader.read()
|
|
2035
|
-
];
|
|
2036
|
-
case 2:
|
|
2037
|
-
_ref = _state.sent(), done = _ref.done, value = _ref.value;
|
|
2038
|
-
if (value) {
|
|
2039
|
-
chunks.push(value);
|
|
2040
|
-
length += value.length;
|
|
2041
|
-
}
|
|
2042
|
-
isDone = done;
|
|
2043
|
-
return [
|
|
2044
|
-
3,
|
|
2045
|
-
1
|
|
2046
|
-
];
|
|
2047
|
-
case 3:
|
|
2048
|
-
collected = new Uint8Array(length);
|
|
2049
|
-
offset = 0;
|
|
2050
|
-
_iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
2051
|
-
try {
|
|
2052
|
-
for(_iterator = chunks[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
2053
|
-
chunk = _step.value;
|
|
2054
|
-
collected.set(chunk, offset);
|
|
2055
|
-
offset += chunk.length;
|
|
2056
|
-
}
|
|
2057
|
-
} catch (err) {
|
|
2058
|
-
_didIteratorError = true;
|
|
2059
|
-
_iteratorError = err;
|
|
2060
|
-
} finally{
|
|
2061
|
-
try {
|
|
2062
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
2063
|
-
_iterator.return();
|
|
2064
|
-
}
|
|
2065
|
-
} finally{
|
|
2066
|
-
if (_didIteratorError) {
|
|
2067
|
-
throw _iteratorError;
|
|
2068
|
-
}
|
|
2069
|
-
}
|
|
2070
|
-
}
|
|
2071
|
-
return [
|
|
2072
|
-
2,
|
|
2073
|
-
collected
|
|
2074
|
-
];
|
|
2075
|
-
}
|
|
2076
|
-
});
|
|
2077
|
-
});
|
|
2078
|
-
return _collectStream.apply(this, arguments);
|
|
2079
|
-
}
|
|
2080
|
-
function readToBase64(blob) {
|
|
2081
|
-
return new Promise(function(resolve, reject) {
|
|
2082
|
-
var reader = new FileReader();
|
|
2083
|
-
reader.onloadend = function() {
|
|
2084
|
-
if (reader.readyState !== 2) {
|
|
2085
|
-
return reject(new Error("Reader aborted too early"));
|
|
2086
|
-
}
|
|
2087
|
-
var _reader_result;
|
|
2088
|
-
var result = (_reader_result = reader.result) !== null && _reader_result !== void 0 ? _reader_result : "";
|
|
2089
|
-
var commaIndex = result.indexOf(",");
|
|
2090
|
-
var dataOffset = commaIndex > -1 ? commaIndex + 1 : result.length;
|
|
2091
|
-
resolve(result.substring(dataOffset));
|
|
2092
|
-
};
|
|
2093
|
-
reader.onabort = function() {
|
|
2094
|
-
return reject(new Error("Read aborted"));
|
|
2095
|
-
};
|
|
2096
|
-
reader.onerror = function() {
|
|
2097
|
-
return reject(reader.error);
|
|
2098
|
-
};
|
|
2099
|
-
reader.readAsDataURL(blob);
|
|
2100
|
-
});
|
|
2101
|
-
}
|
|
2102
1865
|
|
|
2103
1866
|
function asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, key, arg) {
|
|
2104
1867
|
try {
|
|
@@ -2129,13 +1892,6 @@ function _async_to_generator$4(fn) {
|
|
|
2129
1892
|
});
|
|
2130
1893
|
};
|
|
2131
1894
|
}
|
|
2132
|
-
function _instanceof$1(left, right) {
|
|
2133
|
-
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
2134
|
-
return !!right[Symbol.hasInstance](left);
|
|
2135
|
-
} else {
|
|
2136
|
-
return left instanceof right;
|
|
2137
|
-
}
|
|
2138
|
-
}
|
|
2139
1895
|
function _ts_generator$4(thisArg, body) {
|
|
2140
1896
|
var f, y, t, g, _ = {
|
|
2141
1897
|
label: 0,
|
|
@@ -2231,106 +1987,46 @@ function _ts_generator$4(thisArg, body) {
|
|
|
2231
1987
|
};
|
|
2232
1988
|
}
|
|
2233
1989
|
}
|
|
2234
|
-
var
|
|
2235
|
-
var
|
|
2236
|
-
|
|
2237
|
-
var
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
}
|
|
2261
|
-
});
|
|
2262
|
-
});
|
|
2263
|
-
return function transformToByteArray() {
|
|
2264
|
-
return _ref.apply(this, arguments);
|
|
2265
|
-
};
|
|
2266
|
-
}();
|
|
2267
|
-
var blobToWebStream = function(blob) {
|
|
2268
|
-
if (typeof blob.stream !== "function") {
|
|
2269
|
-
throw new Error("Cannot transform payload Blob to web stream. Please make sure the Blob.stream() is polyfilled.\n" + "If you are using React Native, this API is not yet supported, see: https://react-native.canny.io/feature-requests/p/fetch-streaming-body");
|
|
2270
|
-
}
|
|
2271
|
-
return blob.stream();
|
|
2272
|
-
};
|
|
2273
|
-
return Object.assign(stream, {
|
|
2274
|
-
transformToByteArray: transformToByteArray,
|
|
2275
|
-
transformToString: function() {
|
|
2276
|
-
var _ref = _async_to_generator$4(function(encoding) {
|
|
2277
|
-
var buf;
|
|
2278
|
-
return _ts_generator$4(this, function(_state) {
|
|
2279
|
-
switch(_state.label){
|
|
2280
|
-
case 0:
|
|
2281
|
-
return [
|
|
2282
|
-
4,
|
|
2283
|
-
transformToByteArray()
|
|
2284
|
-
];
|
|
2285
|
-
case 1:
|
|
2286
|
-
buf = _state.sent();
|
|
2287
|
-
if (encoding === "base64") {
|
|
2288
|
-
return [
|
|
2289
|
-
2,
|
|
2290
|
-
toBase64(buf)
|
|
2291
|
-
];
|
|
2292
|
-
} else if (encoding === "hex") {
|
|
2293
|
-
return [
|
|
2294
|
-
2,
|
|
2295
|
-
toHex(buf)
|
|
2296
|
-
];
|
|
2297
|
-
} else if (encoding === undefined || encoding === "utf8" || encoding === "utf-8") {
|
|
2298
|
-
return [
|
|
2299
|
-
2,
|
|
2300
|
-
toUtf8(buf)
|
|
2301
|
-
];
|
|
2302
|
-
} else if (typeof TextDecoder === "function") {
|
|
2303
|
-
return [
|
|
2304
|
-
2,
|
|
2305
|
-
new TextDecoder(encoding).decode(buf)
|
|
2306
|
-
];
|
|
1990
|
+
var resolveSsoCredentials = function() {
|
|
1991
|
+
var _ref = _async_to_generator$4(function(profile, profileData) {
|
|
1992
|
+
var options, callerClientConfig, fromSSO;
|
|
1993
|
+
var _arguments = arguments;
|
|
1994
|
+
return _ts_generator$4(this, function(_state) {
|
|
1995
|
+
switch(_state.label){
|
|
1996
|
+
case 0:
|
|
1997
|
+
options = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : {}, callerClientConfig = _arguments.length > 3 ? _arguments[3] : void 0;
|
|
1998
|
+
return [
|
|
1999
|
+
4,
|
|
2000
|
+
import('./index.esm12.js')
|
|
2001
|
+
];
|
|
2002
|
+
case 1:
|
|
2003
|
+
fromSSO = _state.sent().fromSSO;
|
|
2004
|
+
return [
|
|
2005
|
+
2,
|
|
2006
|
+
fromSSO({
|
|
2007
|
+
profile: profile,
|
|
2008
|
+
logger: options.logger,
|
|
2009
|
+
parentClientConfig: options.parentClientConfig,
|
|
2010
|
+
clientConfig: options.clientConfig
|
|
2011
|
+
})({
|
|
2012
|
+
callerClientConfig: callerClientConfig
|
|
2013
|
+
}).then(function(creds) {
|
|
2014
|
+
if (profileData.sso_session) {
|
|
2015
|
+
return setCredentialFeature(creds, "CREDENTIALS_PROFILE_SSO", "r");
|
|
2307
2016
|
} else {
|
|
2308
|
-
|
|
2017
|
+
return setCredentialFeature(creds, "CREDENTIALS_PROFILE_SSO_LEGACY", "t");
|
|
2309
2018
|
}
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
});
|
|
2313
|
-
return function(encoding) {
|
|
2314
|
-
return _ref.apply(this, arguments);
|
|
2315
|
-
};
|
|
2316
|
-
}(),
|
|
2317
|
-
transformToWebStream: function() {
|
|
2318
|
-
if (transformed) {
|
|
2319
|
-
throw new Error(ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED$1);
|
|
2320
|
-
}
|
|
2321
|
-
transformed = true;
|
|
2322
|
-
if (isBlobInstance(stream)) {
|
|
2323
|
-
return blobToWebStream(stream);
|
|
2324
|
-
} else if (isReadableStream(stream)) {
|
|
2325
|
-
return stream;
|
|
2326
|
-
} else {
|
|
2327
|
-
throw new Error("Cannot transform payload to web stream, got ".concat(stream));
|
|
2019
|
+
})
|
|
2020
|
+
];
|
|
2328
2021
|
}
|
|
2329
|
-
}
|
|
2022
|
+
});
|
|
2330
2023
|
});
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2024
|
+
return function resolveSsoCredentials(profile, profileData) {
|
|
2025
|
+
return _ref.apply(this, arguments);
|
|
2026
|
+
};
|
|
2027
|
+
}();
|
|
2028
|
+
var isSsoProfile = function(arg) {
|
|
2029
|
+
return arg && (typeof arg.sso_start_url === "string" || typeof arg.sso_account_id === "string" || typeof arg.sso_session === "string" || typeof arg.sso_region === "string" || typeof arg.sso_role_name === "string");
|
|
2334
2030
|
};
|
|
2335
2031
|
|
|
2336
2032
|
function asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, key, arg) {
|
|
@@ -2362,12 +2058,37 @@ function _async_to_generator$3(fn) {
|
|
|
2362
2058
|
});
|
|
2363
2059
|
};
|
|
2364
2060
|
}
|
|
2365
|
-
function
|
|
2366
|
-
if (
|
|
2367
|
-
|
|
2061
|
+
function _define_property(obj, key, value) {
|
|
2062
|
+
if (key in obj) {
|
|
2063
|
+
Object.defineProperty(obj, key, {
|
|
2064
|
+
value: value,
|
|
2065
|
+
enumerable: true,
|
|
2066
|
+
configurable: true,
|
|
2067
|
+
writable: true
|
|
2068
|
+
});
|
|
2368
2069
|
} else {
|
|
2369
|
-
|
|
2070
|
+
obj[key] = value;
|
|
2071
|
+
}
|
|
2072
|
+
return obj;
|
|
2073
|
+
}
|
|
2074
|
+
function _object_spread(target) {
|
|
2075
|
+
for(var i = 1; i < arguments.length; i++){
|
|
2076
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
2077
|
+
var ownKeys = Object.keys(source);
|
|
2078
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
2079
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
2080
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
2081
|
+
}));
|
|
2082
|
+
}
|
|
2083
|
+
ownKeys.forEach(function(key) {
|
|
2084
|
+
_define_property(target, key, source[key]);
|
|
2085
|
+
});
|
|
2370
2086
|
}
|
|
2087
|
+
return target;
|
|
2088
|
+
}
|
|
2089
|
+
function _type_of$1(obj) {
|
|
2090
|
+
"@swc/helpers - typeof";
|
|
2091
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
2371
2092
|
}
|
|
2372
2093
|
function _ts_generator$3(thisArg, body) {
|
|
2373
2094
|
var f, y, t, g, _ = {
|
|
@@ -2464,337 +2185,40 @@ function _ts_generator$3(thisArg, body) {
|
|
|
2464
2185
|
};
|
|
2465
2186
|
}
|
|
2466
2187
|
}
|
|
2467
|
-
var
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
4,
|
|
2490
|
-
streamCollector$1(stream)
|
|
2491
|
-
];
|
|
2492
|
-
case 1:
|
|
2493
|
-
return [
|
|
2494
|
-
2,
|
|
2495
|
-
_state.sent()
|
|
2496
|
-
];
|
|
2497
|
-
}
|
|
2188
|
+
var isStaticCredsProfile = function(arg) {
|
|
2189
|
+
return Boolean(arg) && (typeof arg === "undefined" ? "undefined" : _type_of$1(arg)) === "object" && typeof arg.aws_access_key_id === "string" && typeof arg.aws_secret_access_key === "string" && [
|
|
2190
|
+
"undefined",
|
|
2191
|
+
"string"
|
|
2192
|
+
].indexOf(_type_of$1(arg.aws_session_token)) > -1 && [
|
|
2193
|
+
"undefined",
|
|
2194
|
+
"string"
|
|
2195
|
+
].indexOf(_type_of$1(arg.aws_account_id)) > -1;
|
|
2196
|
+
};
|
|
2197
|
+
var resolveStaticCredentials = function() {
|
|
2198
|
+
var _ref = _async_to_generator$3(function(profile, options) {
|
|
2199
|
+
var _options_logger, credentials;
|
|
2200
|
+
return _ts_generator$3(this, function(_state) {
|
|
2201
|
+
options === null || options === void 0 ? void 0 : (_options_logger = options.logger) === null || _options_logger === void 0 ? void 0 : _options_logger.debug("@aws-sdk/credential-provider-ini - resolveStaticCredentials");
|
|
2202
|
+
credentials = _object_spread({
|
|
2203
|
+
accessKeyId: profile.aws_access_key_id,
|
|
2204
|
+
secretAccessKey: profile.aws_secret_access_key,
|
|
2205
|
+
sessionToken: profile.aws_session_token
|
|
2206
|
+
}, profile.aws_credential_scope && {
|
|
2207
|
+
credentialScope: profile.aws_credential_scope
|
|
2208
|
+
}, profile.aws_account_id && {
|
|
2209
|
+
accountId: profile.aws_account_id
|
|
2498
2210
|
});
|
|
2211
|
+
return [
|
|
2212
|
+
2,
|
|
2213
|
+
setCredentialFeature(credentials, "CREDENTIALS_PROFILE", "n")
|
|
2214
|
+
];
|
|
2499
2215
|
});
|
|
2500
|
-
return function transformToByteArray() {
|
|
2501
|
-
return _ref.apply(this, arguments);
|
|
2502
|
-
};
|
|
2503
|
-
}();
|
|
2504
|
-
return Object.assign(stream, {
|
|
2505
|
-
transformToByteArray: transformToByteArray,
|
|
2506
|
-
transformToString: function() {
|
|
2507
|
-
var _ref = _async_to_generator$3(function(encoding) {
|
|
2508
|
-
var buf, decoder;
|
|
2509
|
-
return _ts_generator$3(this, function(_state) {
|
|
2510
|
-
switch(_state.label){
|
|
2511
|
-
case 0:
|
|
2512
|
-
return [
|
|
2513
|
-
4,
|
|
2514
|
-
transformToByteArray()
|
|
2515
|
-
];
|
|
2516
|
-
case 1:
|
|
2517
|
-
buf = _state.sent();
|
|
2518
|
-
if (encoding === undefined || Buffer.isEncoding(encoding)) {
|
|
2519
|
-
return [
|
|
2520
|
-
2,
|
|
2521
|
-
fromArrayBuffer(buf.buffer, buf.byteOffset, buf.byteLength).toString(encoding)
|
|
2522
|
-
];
|
|
2523
|
-
} else {
|
|
2524
|
-
decoder = new TextDecoder(encoding);
|
|
2525
|
-
return [
|
|
2526
|
-
2,
|
|
2527
|
-
decoder.decode(buf)
|
|
2528
|
-
];
|
|
2529
|
-
}
|
|
2530
|
-
}
|
|
2531
|
-
});
|
|
2532
|
-
});
|
|
2533
|
-
return function(encoding) {
|
|
2534
|
-
return _ref.apply(this, arguments);
|
|
2535
|
-
};
|
|
2536
|
-
}(),
|
|
2537
|
-
transformToWebStream: function() {
|
|
2538
|
-
if (transformed) {
|
|
2539
|
-
throw new Error(ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED);
|
|
2540
|
-
}
|
|
2541
|
-
if (stream.readableFlowing !== null) {
|
|
2542
|
-
throw new Error("The stream has been consumed by other callbacks.");
|
|
2543
|
-
}
|
|
2544
|
-
if (typeof Readable.toWeb !== "function") {
|
|
2545
|
-
throw new Error("Readable.toWeb() is not supported. Please ensure a polyfill is available.");
|
|
2546
|
-
}
|
|
2547
|
-
transformed = true;
|
|
2548
|
-
return Readable.toWeb(stream);
|
|
2549
|
-
}
|
|
2550
|
-
});
|
|
2551
|
-
};
|
|
2552
|
-
|
|
2553
|
-
function _type_of(obj) {
|
|
2554
|
-
"@swc/helpers - typeof";
|
|
2555
|
-
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
2556
|
-
}
|
|
2557
|
-
var expectNumber = function(value) {
|
|
2558
|
-
if (value === null || value === undefined) {
|
|
2559
|
-
return undefined;
|
|
2560
|
-
}
|
|
2561
|
-
if (typeof value === "string") {
|
|
2562
|
-
var parsed = parseFloat(value);
|
|
2563
|
-
if (!Number.isNaN(parsed)) {
|
|
2564
|
-
if (String(parsed) !== String(value)) {
|
|
2565
|
-
logger.warn(stackTraceWarning("Expected number but observed string: ".concat(value)));
|
|
2566
|
-
}
|
|
2567
|
-
return parsed;
|
|
2568
|
-
}
|
|
2569
|
-
}
|
|
2570
|
-
if (typeof value === "number") {
|
|
2571
|
-
return value;
|
|
2572
|
-
}
|
|
2573
|
-
throw new TypeError("Expected number, got ".concat(typeof value === "undefined" ? "undefined" : _type_of(value), ": ").concat(value));
|
|
2574
|
-
};
|
|
2575
|
-
var MAX_FLOAT = Math.ceil(Math.pow(2, 127) * (2 - Math.pow(2, -23)));
|
|
2576
|
-
var expectFloat32 = function(value) {
|
|
2577
|
-
var expected = expectNumber(value);
|
|
2578
|
-
if (expected !== undefined && !Number.isNaN(expected) && expected !== Infinity && expected !== -Infinity) {
|
|
2579
|
-
if (Math.abs(expected) > MAX_FLOAT) {
|
|
2580
|
-
throw new TypeError("Expected 32-bit float, got ".concat(value));
|
|
2581
|
-
}
|
|
2582
|
-
}
|
|
2583
|
-
return expected;
|
|
2584
|
-
};
|
|
2585
|
-
var expectLong = function(value) {
|
|
2586
|
-
if (value === null || value === undefined) {
|
|
2587
|
-
return undefined;
|
|
2588
|
-
}
|
|
2589
|
-
if (Number.isInteger(value) && !Number.isNaN(value)) {
|
|
2590
|
-
return value;
|
|
2591
|
-
}
|
|
2592
|
-
throw new TypeError("Expected integer, got ".concat(typeof value === "undefined" ? "undefined" : _type_of(value), ": ").concat(value));
|
|
2593
|
-
};
|
|
2594
|
-
var expectShort = function(value) {
|
|
2595
|
-
return expectSizedInt(value, 16);
|
|
2596
|
-
};
|
|
2597
|
-
var expectByte = function(value) {
|
|
2598
|
-
return expectSizedInt(value, 8);
|
|
2599
|
-
};
|
|
2600
|
-
var expectSizedInt = function(value, size) {
|
|
2601
|
-
var expected = expectLong(value);
|
|
2602
|
-
if (expected !== undefined && castInt(expected, size) !== expected) {
|
|
2603
|
-
throw new TypeError("Expected ".concat(size, "-bit integer, got ").concat(value));
|
|
2604
|
-
}
|
|
2605
|
-
return expected;
|
|
2606
|
-
};
|
|
2607
|
-
var castInt = function(value, size) {
|
|
2608
|
-
switch(size){
|
|
2609
|
-
case 32:
|
|
2610
|
-
return Int32Array.of(value)[0];
|
|
2611
|
-
case 16:
|
|
2612
|
-
return Int16Array.of(value)[0];
|
|
2613
|
-
case 8:
|
|
2614
|
-
return Int8Array.of(value)[0];
|
|
2615
|
-
}
|
|
2616
|
-
};
|
|
2617
|
-
var strictParseFloat32 = function(value) {
|
|
2618
|
-
if (typeof value == "string") {
|
|
2619
|
-
return expectFloat32(parseNumber(value));
|
|
2620
|
-
}
|
|
2621
|
-
return expectFloat32(value);
|
|
2622
|
-
};
|
|
2623
|
-
var NUMBER_REGEX = /(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|(-?Infinity)|(NaN)/g;
|
|
2624
|
-
var parseNumber = function(value) {
|
|
2625
|
-
var matches = value.match(NUMBER_REGEX);
|
|
2626
|
-
if (matches === null || matches[0].length !== value.length) {
|
|
2627
|
-
throw new TypeError("Expected real number, got implicit NaN");
|
|
2628
|
-
}
|
|
2629
|
-
return parseFloat(value);
|
|
2630
|
-
};
|
|
2631
|
-
var strictParseShort = function(value) {
|
|
2632
|
-
if (typeof value === "string") {
|
|
2633
|
-
return expectShort(parseNumber(value));
|
|
2634
|
-
}
|
|
2635
|
-
return expectShort(value);
|
|
2636
|
-
};
|
|
2637
|
-
var strictParseByte = function(value) {
|
|
2638
|
-
if (typeof value === "string") {
|
|
2639
|
-
return expectByte(parseNumber(value));
|
|
2640
|
-
}
|
|
2641
|
-
return expectByte(value);
|
|
2642
|
-
};
|
|
2643
|
-
var stackTraceWarning = function(message) {
|
|
2644
|
-
return String(new TypeError(message).stack || message).split("\n").slice(0, 5).filter(function(s) {
|
|
2645
|
-
return !s.includes("stackTraceWarning");
|
|
2646
|
-
}).join("\n");
|
|
2647
|
-
};
|
|
2648
|
-
var logger = {
|
|
2649
|
-
warn: console.warn
|
|
2650
|
-
};
|
|
2651
|
-
|
|
2652
|
-
function _array_like_to_array$1(arr, len) {
|
|
2653
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
2654
|
-
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
2655
|
-
return arr2;
|
|
2656
|
-
}
|
|
2657
|
-
function _array_with_holes$1(arr) {
|
|
2658
|
-
if (Array.isArray(arr)) return arr;
|
|
2659
|
-
}
|
|
2660
|
-
function _iterable_to_array_limit$1(arr, i) {
|
|
2661
|
-
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
2662
|
-
if (_i == null) return;
|
|
2663
|
-
var _arr = [];
|
|
2664
|
-
var _n = true;
|
|
2665
|
-
var _d = false;
|
|
2666
|
-
var _s, _e;
|
|
2667
|
-
try {
|
|
2668
|
-
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
2669
|
-
_arr.push(_s.value);
|
|
2670
|
-
if (i && _arr.length === i) break;
|
|
2671
|
-
}
|
|
2672
|
-
} catch (err) {
|
|
2673
|
-
_d = true;
|
|
2674
|
-
_e = err;
|
|
2675
|
-
} finally{
|
|
2676
|
-
try {
|
|
2677
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
2678
|
-
} finally{
|
|
2679
|
-
if (_d) throw _e;
|
|
2680
|
-
}
|
|
2681
|
-
}
|
|
2682
|
-
return _arr;
|
|
2683
|
-
}
|
|
2684
|
-
function _non_iterable_rest$1() {
|
|
2685
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
2686
|
-
}
|
|
2687
|
-
function _sliced_to_array$1(arr, i) {
|
|
2688
|
-
return _array_with_holes$1(arr) || _iterable_to_array_limit$1(arr, i) || _unsupported_iterable_to_array$1(arr, i) || _non_iterable_rest$1();
|
|
2689
|
-
}
|
|
2690
|
-
function _unsupported_iterable_to_array$1(o, minLen) {
|
|
2691
|
-
if (!o) return;
|
|
2692
|
-
if (typeof o === "string") return _array_like_to_array$1(o, minLen);
|
|
2693
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
2694
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
2695
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
2696
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$1(o, minLen);
|
|
2697
|
-
}
|
|
2698
|
-
var MONTHS = [
|
|
2699
|
-
"Jan",
|
|
2700
|
-
"Feb",
|
|
2701
|
-
"Mar",
|
|
2702
|
-
"Apr",
|
|
2703
|
-
"May",
|
|
2704
|
-
"Jun",
|
|
2705
|
-
"Jul",
|
|
2706
|
-
"Aug",
|
|
2707
|
-
"Sep",
|
|
2708
|
-
"Oct",
|
|
2709
|
-
"Nov",
|
|
2710
|
-
"Dec"
|
|
2711
|
-
];
|
|
2712
|
-
var RFC3339 = new RegExp(/^(\d{4})-(\d{2})-(\d{2})[tT](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?[zZ]$/);
|
|
2713
|
-
var parseRfc3339DateTime = function(value) {
|
|
2714
|
-
if (value === null || value === undefined) {
|
|
2715
|
-
return undefined;
|
|
2716
|
-
}
|
|
2717
|
-
if (typeof value !== "string") {
|
|
2718
|
-
throw new TypeError("RFC-3339 date-times must be expressed as strings");
|
|
2719
|
-
}
|
|
2720
|
-
var match = RFC3339.exec(value);
|
|
2721
|
-
if (!match) {
|
|
2722
|
-
throw new TypeError("Invalid RFC-3339 date-time value");
|
|
2723
|
-
}
|
|
2724
|
-
var _match = _sliced_to_array$1(match, 8); _match[0]; var yearStr = _match[1], monthStr = _match[2], dayStr = _match[3], hours = _match[4], minutes = _match[5], seconds = _match[6], fractionalMilliseconds = _match[7];
|
|
2725
|
-
var year = strictParseShort(stripLeadingZeroes(yearStr));
|
|
2726
|
-
var month = parseDateValue(monthStr, "month", 1, 12);
|
|
2727
|
-
var day = parseDateValue(dayStr, "day", 1, 31);
|
|
2728
|
-
return buildDate(year, month, day, {
|
|
2729
|
-
hours: hours,
|
|
2730
|
-
minutes: minutes,
|
|
2731
|
-
seconds: seconds,
|
|
2732
|
-
fractionalMilliseconds: fractionalMilliseconds
|
|
2733
2216
|
});
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
return new Date(Date.UTC(year, adjustedMonth, day, parseDateValue(time.hours, "hour", 0, 23), parseDateValue(time.minutes, "minute", 0, 59), parseDateValue(time.seconds, "seconds", 0, 60), parseMilliseconds(time.fractionalMilliseconds)));
|
|
2739
|
-
};
|
|
2740
|
-
var DAYS_IN_MONTH = [
|
|
2741
|
-
31,
|
|
2742
|
-
28,
|
|
2743
|
-
31,
|
|
2744
|
-
30,
|
|
2745
|
-
31,
|
|
2746
|
-
30,
|
|
2747
|
-
31,
|
|
2748
|
-
31,
|
|
2749
|
-
30,
|
|
2750
|
-
31,
|
|
2751
|
-
30,
|
|
2752
|
-
31
|
|
2753
|
-
];
|
|
2754
|
-
var validateDayOfMonth = function(year, month, day) {
|
|
2755
|
-
var maxDays = DAYS_IN_MONTH[month];
|
|
2756
|
-
if (month === 1 && isLeapYear(year)) {
|
|
2757
|
-
maxDays = 29;
|
|
2758
|
-
}
|
|
2759
|
-
if (day > maxDays) {
|
|
2760
|
-
throw new TypeError("Invalid day for ".concat(MONTHS[month], " in ").concat(year, ": ").concat(day));
|
|
2761
|
-
}
|
|
2762
|
-
};
|
|
2763
|
-
var isLeapYear = function(year) {
|
|
2764
|
-
return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
|
|
2765
|
-
};
|
|
2766
|
-
var parseDateValue = function(value, type, lower, upper) {
|
|
2767
|
-
var dateVal = strictParseByte(stripLeadingZeroes(value));
|
|
2768
|
-
if (dateVal < lower || dateVal > upper) {
|
|
2769
|
-
throw new TypeError("".concat(type, " must be between ").concat(lower, " and ").concat(upper, ", inclusive"));
|
|
2770
|
-
}
|
|
2771
|
-
return dateVal;
|
|
2772
|
-
};
|
|
2773
|
-
var parseMilliseconds = function(value) {
|
|
2774
|
-
if (value === null || value === undefined) {
|
|
2775
|
-
return 0;
|
|
2776
|
-
}
|
|
2777
|
-
return strictParseFloat32("0." + value) * 1000;
|
|
2778
|
-
};
|
|
2779
|
-
var stripLeadingZeroes = function(value) {
|
|
2780
|
-
var idx = 0;
|
|
2781
|
-
while(idx < value.length - 1 && value.charAt(idx) === "0"){
|
|
2782
|
-
idx++;
|
|
2783
|
-
}
|
|
2784
|
-
if (idx === 0) {
|
|
2785
|
-
return value;
|
|
2786
|
-
}
|
|
2787
|
-
return value.slice(idx);
|
|
2788
|
-
};
|
|
2217
|
+
return function resolveStaticCredentials(profile, options) {
|
|
2218
|
+
return _ref.apply(this, arguments);
|
|
2219
|
+
};
|
|
2220
|
+
}();
|
|
2789
2221
|
|
|
2790
|
-
function _array_like_to_array(arr, len) {
|
|
2791
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
2792
|
-
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
2793
|
-
return arr2;
|
|
2794
|
-
}
|
|
2795
|
-
function _array_with_holes(arr) {
|
|
2796
|
-
if (Array.isArray(arr)) return arr;
|
|
2797
|
-
}
|
|
2798
2222
|
function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
|
|
2799
2223
|
try {
|
|
2800
2224
|
var info = gen[key](arg);
|
|
@@ -2824,43 +2248,9 @@ function _async_to_generator$2(fn) {
|
|
|
2824
2248
|
});
|
|
2825
2249
|
};
|
|
2826
2250
|
}
|
|
2827
|
-
function
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
var _arr = [];
|
|
2831
|
-
var _n = true;
|
|
2832
|
-
var _d = false;
|
|
2833
|
-
var _s, _e;
|
|
2834
|
-
try {
|
|
2835
|
-
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
2836
|
-
_arr.push(_s.value);
|
|
2837
|
-
if (i && _arr.length === i) break;
|
|
2838
|
-
}
|
|
2839
|
-
} catch (err) {
|
|
2840
|
-
_d = true;
|
|
2841
|
-
_e = err;
|
|
2842
|
-
} finally{
|
|
2843
|
-
try {
|
|
2844
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
|
2845
|
-
} finally{
|
|
2846
|
-
if (_d) throw _e;
|
|
2847
|
-
}
|
|
2848
|
-
}
|
|
2849
|
-
return _arr;
|
|
2850
|
-
}
|
|
2851
|
-
function _non_iterable_rest() {
|
|
2852
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
2853
|
-
}
|
|
2854
|
-
function _sliced_to_array(arr, i) {
|
|
2855
|
-
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
2856
|
-
}
|
|
2857
|
-
function _unsupported_iterable_to_array(o, minLen) {
|
|
2858
|
-
if (!o) return;
|
|
2859
|
-
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
2860
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
2861
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
2862
|
-
if (n === "Map" || n === "Set") return Array.from(n);
|
|
2863
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
2251
|
+
function _type_of(obj) {
|
|
2252
|
+
"@swc/helpers - typeof";
|
|
2253
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
2864
2254
|
}
|
|
2865
2255
|
function _ts_generator$2(thisArg, body) {
|
|
2866
2256
|
var f, y, t, g, _ = {
|
|
@@ -2957,73 +2347,39 @@ function _ts_generator$2(thisArg, body) {
|
|
|
2957
2347
|
};
|
|
2958
2348
|
}
|
|
2959
2349
|
}
|
|
2960
|
-
function
|
|
2961
|
-
return
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
acc[k] = v;
|
|
2969
|
-
return acc;
|
|
2970
|
-
}, {}),
|
|
2971
|
-
fragment: url.hash
|
|
2972
|
-
});
|
|
2973
|
-
}
|
|
2974
|
-
function getCredentials(response, logger) {
|
|
2975
|
-
return _getCredentials.apply(this, arguments);
|
|
2976
|
-
}
|
|
2977
|
-
function _getCredentials() {
|
|
2978
|
-
_getCredentials = _async_to_generator$2(function(response, logger) {
|
|
2979
|
-
var stream, str, parsed, parsedBody;
|
|
2350
|
+
var isWebIdentityProfile = function(arg) {
|
|
2351
|
+
return Boolean(arg) && (typeof arg === "undefined" ? "undefined" : _type_of(arg)) === "object" && typeof arg.web_identity_token_file === "string" && typeof arg.role_arn === "string" && [
|
|
2352
|
+
"undefined",
|
|
2353
|
+
"string"
|
|
2354
|
+
].indexOf(_type_of(arg.role_session_name)) > -1;
|
|
2355
|
+
};
|
|
2356
|
+
var resolveWebIdentityCredentials = function() {
|
|
2357
|
+
var _ref = _async_to_generator$2(function(profile, options, callerClientConfig) {
|
|
2980
2358
|
return _ts_generator$2(this, function(_state) {
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
}
|
|
2997
|
-
return [
|
|
2998
|
-
2,
|
|
2999
|
-
{
|
|
3000
|
-
accessKeyId: parsed.AccessKeyId,
|
|
3001
|
-
secretAccessKey: parsed.SecretAccessKey,
|
|
3002
|
-
sessionToken: parsed.Token,
|
|
3003
|
-
expiration: parseRfc3339DateTime(parsed.Expiration)
|
|
3004
|
-
}
|
|
3005
|
-
];
|
|
3006
|
-
}
|
|
3007
|
-
if (response.statusCode >= 400 && response.statusCode < 500) {
|
|
3008
|
-
parsedBody = {};
|
|
3009
|
-
try {
|
|
3010
|
-
parsedBody = JSON.parse(str);
|
|
3011
|
-
} catch (e) {}
|
|
3012
|
-
throw Object.assign(new CredentialsProviderError("Server responded with status: ".concat(response.statusCode), {
|
|
3013
|
-
logger: logger
|
|
3014
|
-
}), {
|
|
3015
|
-
Code: parsedBody.Code,
|
|
3016
|
-
Message: parsedBody.Message
|
|
3017
|
-
});
|
|
3018
|
-
}
|
|
3019
|
-
throw new CredentialsProviderError("Server responded with status: ".concat(response.statusCode), {
|
|
3020
|
-
logger: logger
|
|
2359
|
+
return [
|
|
2360
|
+
2,
|
|
2361
|
+
import('./index.esm4.js').then(function(param) {
|
|
2362
|
+
var fromTokenFile = param.fromTokenFile;
|
|
2363
|
+
return fromTokenFile({
|
|
2364
|
+
webIdentityTokenFile: profile.web_identity_token_file,
|
|
2365
|
+
roleArn: profile.role_arn,
|
|
2366
|
+
roleSessionName: profile.role_session_name,
|
|
2367
|
+
roleAssumerWithWebIdentity: options.roleAssumerWithWebIdentity,
|
|
2368
|
+
logger: options.logger,
|
|
2369
|
+
parentClientConfig: options.parentClientConfig
|
|
2370
|
+
})({
|
|
2371
|
+
callerClientConfig: callerClientConfig
|
|
2372
|
+
}).then(function(creds) {
|
|
2373
|
+
return setCredentialFeature(creds, "CREDENTIALS_PROFILE_STS_WEB_ID_TOKEN", "q");
|
|
3021
2374
|
});
|
|
3022
|
-
|
|
2375
|
+
})
|
|
2376
|
+
];
|
|
3023
2377
|
});
|
|
3024
2378
|
});
|
|
3025
|
-
return
|
|
3026
|
-
|
|
2379
|
+
return function resolveWebIdentityCredentials(profile, options, callerClientConfig) {
|
|
2380
|
+
return _ref.apply(this, arguments);
|
|
2381
|
+
};
|
|
2382
|
+
}();
|
|
3027
2383
|
|
|
3028
2384
|
function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
|
|
3029
2385
|
try {
|
|
@@ -3149,70 +2505,78 @@ function _ts_generator$1(thisArg, body) {
|
|
|
3149
2505
|
};
|
|
3150
2506
|
}
|
|
3151
2507
|
}
|
|
3152
|
-
var
|
|
3153
|
-
|
|
3154
|
-
var
|
|
2508
|
+
var resolveProfileData = function() {
|
|
2509
|
+
var _ref = _async_to_generator$1(function(profileName, profiles, options, callerClientConfig) {
|
|
2510
|
+
var visitedProfiles, isAssumeRoleRecursiveCall, data;
|
|
2511
|
+
var _arguments = arguments;
|
|
3155
2512
|
return _ts_generator$1(this, function(_state) {
|
|
3156
2513
|
switch(_state.label){
|
|
3157
2514
|
case 0:
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
6
|
|
3195
|
-
];
|
|
3196
|
-
case 6:
|
|
3197
|
-
++i;
|
|
3198
|
-
return [
|
|
2515
|
+
visitedProfiles = _arguments.length > 4 && _arguments[4] !== void 0 ? _arguments[4] : {}, isAssumeRoleRecursiveCall = _arguments.length > 5 && _arguments[5] !== void 0 ? _arguments[5] : false;
|
|
2516
|
+
data = profiles[profileName];
|
|
2517
|
+
if (Object.keys(visitedProfiles).length > 0 && isStaticCredsProfile(data)) {
|
|
2518
|
+
return [
|
|
2519
|
+
2,
|
|
2520
|
+
resolveStaticCredentials(data, options)
|
|
2521
|
+
];
|
|
2522
|
+
}
|
|
2523
|
+
if (isAssumeRoleRecursiveCall || isAssumeRoleProfile(data, {
|
|
2524
|
+
profile: profileName,
|
|
2525
|
+
logger: options.logger
|
|
2526
|
+
})) {
|
|
2527
|
+
return [
|
|
2528
|
+
2,
|
|
2529
|
+
resolveAssumeRoleCredentials(profileName, profiles, options, callerClientConfig, visitedProfiles, resolveProfileData)
|
|
2530
|
+
];
|
|
2531
|
+
}
|
|
2532
|
+
if (isStaticCredsProfile(data)) {
|
|
2533
|
+
return [
|
|
2534
|
+
2,
|
|
2535
|
+
resolveStaticCredentials(data, options)
|
|
2536
|
+
];
|
|
2537
|
+
}
|
|
2538
|
+
if (isWebIdentityProfile(data)) {
|
|
2539
|
+
return [
|
|
2540
|
+
2,
|
|
2541
|
+
resolveWebIdentityCredentials(data, options, callerClientConfig)
|
|
2542
|
+
];
|
|
2543
|
+
}
|
|
2544
|
+
if (isProcessProfile(data)) {
|
|
2545
|
+
return [
|
|
2546
|
+
2,
|
|
2547
|
+
resolveProcessCredentials(options, profileName)
|
|
2548
|
+
];
|
|
2549
|
+
}
|
|
2550
|
+
if (!isSsoProfile(data)) return [
|
|
3199
2551
|
3,
|
|
3200
|
-
|
|
2552
|
+
2
|
|
3201
2553
|
];
|
|
3202
|
-
case 7:
|
|
3203
2554
|
return [
|
|
3204
2555
|
4,
|
|
3205
|
-
|
|
2556
|
+
resolveSsoCredentials(profileName, data, options, callerClientConfig)
|
|
3206
2557
|
];
|
|
3207
|
-
case
|
|
2558
|
+
case 1:
|
|
3208
2559
|
return [
|
|
3209
2560
|
2,
|
|
3210
2561
|
_state.sent()
|
|
3211
2562
|
];
|
|
2563
|
+
case 2:
|
|
2564
|
+
if (isLoginProfile(data)) {
|
|
2565
|
+
return [
|
|
2566
|
+
2,
|
|
2567
|
+
resolveLoginCredentials(profileName, options, callerClientConfig)
|
|
2568
|
+
];
|
|
2569
|
+
}
|
|
2570
|
+
throw new CredentialsProviderError("Could not resolve credentials using profile: [".concat(profileName, "] in configuration/credentials file(s)."), {
|
|
2571
|
+
logger: options.logger
|
|
2572
|
+
});
|
|
3212
2573
|
}
|
|
3213
2574
|
});
|
|
3214
2575
|
});
|
|
3215
|
-
|
|
2576
|
+
return function resolveProfileData(profileName, profiles, options, callerClientConfig) {
|
|
2577
|
+
return _ref.apply(this, arguments);
|
|
2578
|
+
};
|
|
2579
|
+
}();
|
|
3216
2580
|
|
|
3217
2581
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
3218
2582
|
try {
|
|
@@ -3338,109 +2702,31 @@ function _ts_generator(thisArg, body) {
|
|
|
3338
2702
|
};
|
|
3339
2703
|
}
|
|
3340
2704
|
}
|
|
3341
|
-
var
|
|
3342
|
-
var
|
|
3343
|
-
|
|
3344
|
-
var
|
|
3345
|
-
var
|
|
3346
|
-
var fromHttp = function() {
|
|
3347
|
-
var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
3348
|
-
var _options_logger, _options_logger_constructor, _options_logger1, _options_logger2;
|
|
3349
|
-
(_options_logger = options.logger) === null || _options_logger === void 0 ? void 0 : _options_logger.debug("@aws-sdk/credential-provider-http - fromHttp");
|
|
3350
|
-
var host;
|
|
3351
|
-
var _options_awsContainerCredentialsRelativeUri;
|
|
3352
|
-
var relative = (_options_awsContainerCredentialsRelativeUri = options.awsContainerCredentialsRelativeUri) !== null && _options_awsContainerCredentialsRelativeUri !== void 0 ? _options_awsContainerCredentialsRelativeUri : process.env[AWS_CONTAINER_CREDENTIALS_RELATIVE_URI];
|
|
3353
|
-
var _options_awsContainerCredentialsFullUri;
|
|
3354
|
-
var full = (_options_awsContainerCredentialsFullUri = options.awsContainerCredentialsFullUri) !== null && _options_awsContainerCredentialsFullUri !== void 0 ? _options_awsContainerCredentialsFullUri : process.env[AWS_CONTAINER_CREDENTIALS_FULL_URI];
|
|
3355
|
-
var _options_awsContainerAuthorizationToken;
|
|
3356
|
-
var token = (_options_awsContainerAuthorizationToken = options.awsContainerAuthorizationToken) !== null && _options_awsContainerAuthorizationToken !== void 0 ? _options_awsContainerAuthorizationToken : process.env[AWS_CONTAINER_AUTHORIZATION_TOKEN];
|
|
3357
|
-
var _options_awsContainerAuthorizationTokenFile;
|
|
3358
|
-
var tokenFile = (_options_awsContainerAuthorizationTokenFile = options.awsContainerAuthorizationTokenFile) !== null && _options_awsContainerAuthorizationTokenFile !== void 0 ? _options_awsContainerAuthorizationTokenFile : process.env[AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE];
|
|
3359
|
-
var warn = ((_options_logger1 = options.logger) === null || _options_logger1 === void 0 ? void 0 : (_options_logger_constructor = _options_logger1.constructor) === null || _options_logger_constructor === void 0 ? void 0 : _options_logger_constructor.name) === "NoOpLogger" || !((_options_logger2 = options.logger) === null || _options_logger2 === void 0 ? void 0 : _options_logger2.warn) ? console.warn : options.logger.warn.bind(options.logger);
|
|
3360
|
-
if (relative && full) {
|
|
3361
|
-
warn("@aws-sdk/credential-provider-http: " + "you have set both awsContainerCredentialsRelativeUri and awsContainerCredentialsFullUri.");
|
|
3362
|
-
warn("awsContainerCredentialsFullUri will take precedence.");
|
|
3363
|
-
}
|
|
3364
|
-
if (token && tokenFile) {
|
|
3365
|
-
warn("@aws-sdk/credential-provider-http: " + "you have set both awsContainerAuthorizationToken and awsContainerAuthorizationTokenFile.");
|
|
3366
|
-
warn("awsContainerAuthorizationToken will take precedence.");
|
|
3367
|
-
}
|
|
3368
|
-
if (full) {
|
|
3369
|
-
host = full;
|
|
3370
|
-
} else if (relative) {
|
|
3371
|
-
host = "".concat(DEFAULT_LINK_LOCAL_HOST).concat(relative);
|
|
3372
|
-
} else {
|
|
3373
|
-
throw new CredentialsProviderError("No HTTP credential provider host provided.\nSet AWS_CONTAINER_CREDENTIALS_FULL_URI or AWS_CONTAINER_CREDENTIALS_RELATIVE_URI.", {
|
|
3374
|
-
logger: options.logger
|
|
3375
|
-
});
|
|
3376
|
-
}
|
|
3377
|
-
var url = new URL(host);
|
|
3378
|
-
checkUrl(url, options.logger);
|
|
3379
|
-
var _options_timeout, _options_timeout1;
|
|
3380
|
-
var requestHandler = NodeHttpHandler.create({
|
|
3381
|
-
requestTimeout: (_options_timeout = options.timeout) !== null && _options_timeout !== void 0 ? _options_timeout : 1000,
|
|
3382
|
-
connectionTimeout: (_options_timeout1 = options.timeout) !== null && _options_timeout1 !== void 0 ? _options_timeout1 : 1000
|
|
3383
|
-
});
|
|
3384
|
-
var _options_maxRetries, _options_timeout2;
|
|
3385
|
-
return retryWrapper(/*#__PURE__*/ _async_to_generator(function() {
|
|
3386
|
-
var request, _, result, e;
|
|
2705
|
+
var fromIni = function() {
|
|
2706
|
+
var init = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
2707
|
+
return /*#__PURE__*/ _async_to_generator(function() {
|
|
2708
|
+
var callerClientConfig, _init_logger, profiles, _init_profile;
|
|
2709
|
+
var _arguments = arguments;
|
|
3387
2710
|
return _ts_generator(this, function(_state) {
|
|
3388
2711
|
switch(_state.label){
|
|
3389
2712
|
case 0:
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
3,
|
|
3393
|
-
1
|
|
3394
|
-
];
|
|
3395
|
-
request.headers.Authorization = token;
|
|
3396
|
-
return [
|
|
3397
|
-
3,
|
|
3398
|
-
3
|
|
3399
|
-
];
|
|
3400
|
-
case 1:
|
|
3401
|
-
if (!tokenFile) return [
|
|
3402
|
-
3,
|
|
3403
|
-
3
|
|
3404
|
-
];
|
|
3405
|
-
_ = request.headers;
|
|
3406
|
-
return [
|
|
3407
|
-
4,
|
|
3408
|
-
fs.readFile(tokenFile)
|
|
3409
|
-
];
|
|
3410
|
-
case 2:
|
|
3411
|
-
_.Authorization = _state.sent().toString();
|
|
3412
|
-
_state.label = 3;
|
|
3413
|
-
case 3:
|
|
3414
|
-
_state.trys.push([
|
|
3415
|
-
3,
|
|
3416
|
-
5,
|
|
3417
|
-
,
|
|
3418
|
-
6
|
|
3419
|
-
]);
|
|
2713
|
+
callerClientConfig = (_arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : {}).callerClientConfig;
|
|
2714
|
+
(_init_logger = init.logger) === null || _init_logger === void 0 ? void 0 : _init_logger.debug("@aws-sdk/credential-provider-ini - fromIni");
|
|
3420
2715
|
return [
|
|
3421
2716
|
4,
|
|
3422
|
-
|
|
2717
|
+
parseKnownFiles(init)
|
|
3423
2718
|
];
|
|
3424
|
-
case
|
|
3425
|
-
|
|
2719
|
+
case 1:
|
|
2720
|
+
profiles = _state.sent();
|
|
3426
2721
|
return [
|
|
3427
2722
|
2,
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
})
|
|
3431
|
-
];
|
|
3432
|
-
case 5:
|
|
3433
|
-
e = _state.sent();
|
|
3434
|
-
throw new CredentialsProviderError(String(e), {
|
|
3435
|
-
logger: options.logger
|
|
3436
|
-
});
|
|
3437
|
-
case 6:
|
|
3438
|
-
return [
|
|
3439
|
-
2
|
|
2723
|
+
resolveProfileData(getProfileName({
|
|
2724
|
+
profile: (_init_profile = init.profile) !== null && _init_profile !== void 0 ? _init_profile : callerClientConfig === null || callerClientConfig === void 0 ? void 0 : callerClientConfig.profile
|
|
2725
|
+
}), profiles, init, callerClientConfig)
|
|
3440
2726
|
];
|
|
3441
2727
|
}
|
|
3442
2728
|
});
|
|
3443
|
-
})
|
|
2729
|
+
});
|
|
3444
2730
|
};
|
|
3445
2731
|
|
|
3446
|
-
export {
|
|
2732
|
+
export { fromIni };
|