@digipair/skill-s3 0.136.3 → 0.136.5

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.
@@ -1,97 +1,704 @@
1
- import { i as fromUtf8, t as toUtf8 } from './index.esm3.js';
2
- export { j as EventStreamCodec, k as EventStreamMarshaller, H as HeaderMarshaller, I as Int64, M as MessageDecoderStream, m as MessageEncoderStream, S as SmithyMessageDecoderStream, n as SmithyMessageEncoderStream, o as UniversalEventStreamMarshaller, p as eventStreamSerdeProvider, q as getChunkedStream, r as getMessageUnmarshaller, u as getUnmarshalledStream, v as resolveEventStreamSerdeConfig, w as universalEventStreamSerdeProvider } from './index.esm3.js';
3
- import 'node:crypto';
4
- import 'node:path';
5
- import 'node:os';
1
+ import { g as getSSOTokenFilepath, a as getSSOTokenFromFile } from './getSSOTokenFromFile.esm.js';
2
+ import { T as TokenProviderError, l as loadSsoSessionData } from './loadSsoSessionData.esm.js';
3
+ import { promises } from 'fs';
4
+ import { p as parseKnownFiles } from './parseKnownFiles.esm.js';
5
+ import { g as getProfileName, C as CredentialsProviderError, s as setCredentialFeature } from './index.esm2.js';
6
+ import 'fs/promises';
7
+ import 'crypto';
8
+ import 'path';
9
+ import 'buffer';
10
+ import 'os';
6
11
  import 'node:fs/promises';
12
+ import 'stream';
7
13
  import 'node:stream';
8
- import 'node:process';
9
- import 'buffer';
14
+ import 'http';
15
+ import 'https';
16
+ import 'process';
10
17
  import 'node:fs';
11
- import 'node:https';
12
- import 'node:zlib';
18
+ import 'zlib';
19
+
20
+ var isSsoProfile = function(arg) {
21
+ 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");
22
+ };
13
23
 
14
- function _async_generator$1(gen) {
15
- var front, back;
16
- function send(key, arg) {
24
+ var EXPIRE_WINDOW_MS = 5 * 60 * 1000;
25
+ var REFRESH_MESSAGE = "To refresh this SSO session run 'aws sso login' with the corresponding profile.";
26
+
27
+ function asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, key, arg) {
28
+ try {
29
+ var info = gen[key](arg);
30
+ var value = info.value;
31
+ } catch (error) {
32
+ reject(error);
33
+ return;
34
+ }
35
+ if (info.done) {
36
+ resolve(value);
37
+ } else {
38
+ Promise.resolve(value).then(_next, _throw);
39
+ }
40
+ }
41
+ function _async_to_generator$4(fn) {
42
+ return function() {
43
+ var self = this, args = arguments;
17
44
  return new Promise(function(resolve, reject) {
18
- var request = {
19
- key: key,
20
- arg: arg,
21
- resolve: resolve,
22
- reject: reject,
23
- next: null
24
- };
25
- if (back) {
26
- back = back.next = request;
27
- } else {
28
- front = back = request;
29
- resume(key, arg);
45
+ var gen = fn.apply(self, args);
46
+ function _next(value) {
47
+ asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, "next", value);
48
+ }
49
+ function _throw(err) {
50
+ asyncGeneratorStep$4(gen, resolve, reject, _next, _throw, "throw", err);
51
+ }
52
+ _next(undefined);
53
+ });
54
+ };
55
+ }
56
+ function _ts_generator$4(thisArg, body) {
57
+ var f, y, t, g, _ = {
58
+ label: 0,
59
+ sent: function() {
60
+ if (t[0] & 1) throw t[1];
61
+ return t[1];
62
+ },
63
+ trys: [],
64
+ ops: []
65
+ };
66
+ return g = {
67
+ next: verb(0),
68
+ "throw": verb(1),
69
+ "return": verb(2)
70
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
71
+ return this;
72
+ }), g;
73
+ function verb(n) {
74
+ return function(v) {
75
+ return step([
76
+ n,
77
+ v
78
+ ]);
79
+ };
80
+ }
81
+ function step(op) {
82
+ if (f) throw new TypeError("Generator is already executing.");
83
+ while(_)try {
84
+ 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;
85
+ if (y = 0, t) op = [
86
+ op[0] & 2,
87
+ t.value
88
+ ];
89
+ switch(op[0]){
90
+ case 0:
91
+ case 1:
92
+ t = op;
93
+ break;
94
+ case 4:
95
+ _.label++;
96
+ return {
97
+ value: op[1],
98
+ done: false
99
+ };
100
+ case 5:
101
+ _.label++;
102
+ y = op[1];
103
+ op = [
104
+ 0
105
+ ];
106
+ continue;
107
+ case 7:
108
+ op = _.ops.pop();
109
+ _.trys.pop();
110
+ continue;
111
+ default:
112
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
113
+ _ = 0;
114
+ continue;
115
+ }
116
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
117
+ _.label = op[1];
118
+ break;
119
+ }
120
+ if (op[0] === 6 && _.label < t[1]) {
121
+ _.label = t[1];
122
+ t = op;
123
+ break;
124
+ }
125
+ if (t && _.label < t[2]) {
126
+ _.label = t[2];
127
+ _.ops.push(op);
128
+ break;
129
+ }
130
+ if (t[2]) _.ops.pop();
131
+ _.trys.pop();
132
+ continue;
133
+ }
134
+ op = body.call(thisArg, _);
135
+ } catch (e) {
136
+ op = [
137
+ 6,
138
+ e
139
+ ];
140
+ y = 0;
141
+ } finally{
142
+ f = t = 0;
143
+ }
144
+ if (op[0] & 5) throw op[1];
145
+ return {
146
+ value: op[0] ? op[1] : void 0,
147
+ done: true
148
+ };
149
+ }
150
+ }
151
+ var getSsoOidcClient = function() {
152
+ var _ref = _async_to_generator$4(function(ssoRegion) {
153
+ var init, callerClientConfig, _init_clientConfig, SSOOIDCClient, coalesce, _init_clientConfig1, ssoOidcClient;
154
+ var _arguments = arguments;
155
+ return _ts_generator$4(this, function(_state) {
156
+ switch(_state.label){
157
+ case 0:
158
+ init = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : {}, callerClientConfig = _arguments.length > 2 ? _arguments[2] : void 0;
159
+ return [
160
+ 4,
161
+ import('./index.esm11.js')
162
+ ];
163
+ case 1:
164
+ SSOOIDCClient = _state.sent().SSOOIDCClient;
165
+ coalesce = function(prop) {
166
+ var _init_clientConfig, _init_parentClientConfig;
167
+ var _init_clientConfig_prop, _ref;
168
+ return (_ref = (_init_clientConfig_prop = (_init_clientConfig = init.clientConfig) === null || _init_clientConfig === void 0 ? void 0 : _init_clientConfig[prop]) !== null && _init_clientConfig_prop !== void 0 ? _init_clientConfig_prop : (_init_parentClientConfig = init.parentClientConfig) === null || _init_parentClientConfig === void 0 ? void 0 : _init_parentClientConfig[prop]) !== null && _ref !== void 0 ? _ref : callerClientConfig === null || callerClientConfig === void 0 ? void 0 : callerClientConfig[prop];
169
+ };
170
+ ssoOidcClient = new SSOOIDCClient(Object.assign({}, (_init_clientConfig1 = init.clientConfig) !== null && _init_clientConfig1 !== void 0 ? _init_clientConfig1 : {}, {
171
+ region: ssoRegion !== null && ssoRegion !== void 0 ? ssoRegion : (_init_clientConfig = init.clientConfig) === null || _init_clientConfig === void 0 ? void 0 : _init_clientConfig.region,
172
+ logger: coalesce("logger"),
173
+ userAgentAppId: coalesce("userAgentAppId")
174
+ }));
175
+ return [
176
+ 2,
177
+ ssoOidcClient
178
+ ];
179
+ }
180
+ });
181
+ });
182
+ return function getSsoOidcClient(ssoRegion) {
183
+ return _ref.apply(this, arguments);
184
+ };
185
+ }();
186
+
187
+ function asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, key, arg) {
188
+ try {
189
+ var info = gen[key](arg);
190
+ var value = info.value;
191
+ } catch (error) {
192
+ reject(error);
193
+ return;
194
+ }
195
+ if (info.done) {
196
+ resolve(value);
197
+ } else {
198
+ Promise.resolve(value).then(_next, _throw);
199
+ }
200
+ }
201
+ function _async_to_generator$3(fn) {
202
+ return function() {
203
+ var self = this, args = arguments;
204
+ return new Promise(function(resolve, reject) {
205
+ var gen = fn.apply(self, args);
206
+ function _next(value) {
207
+ asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "next", value);
208
+ }
209
+ function _throw(err) {
210
+ asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "throw", err);
211
+ }
212
+ _next(undefined);
213
+ });
214
+ };
215
+ }
216
+ function _ts_generator$3(thisArg, body) {
217
+ var f, y, t, g, _ = {
218
+ label: 0,
219
+ sent: function() {
220
+ if (t[0] & 1) throw t[1];
221
+ return t[1];
222
+ },
223
+ trys: [],
224
+ ops: []
225
+ };
226
+ return g = {
227
+ next: verb(0),
228
+ "throw": verb(1),
229
+ "return": verb(2)
230
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
231
+ return this;
232
+ }), g;
233
+ function verb(n) {
234
+ return function(v) {
235
+ return step([
236
+ n,
237
+ v
238
+ ]);
239
+ };
240
+ }
241
+ function step(op) {
242
+ if (f) throw new TypeError("Generator is already executing.");
243
+ while(_)try {
244
+ 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;
245
+ if (y = 0, t) op = [
246
+ op[0] & 2,
247
+ t.value
248
+ ];
249
+ switch(op[0]){
250
+ case 0:
251
+ case 1:
252
+ t = op;
253
+ break;
254
+ case 4:
255
+ _.label++;
256
+ return {
257
+ value: op[1],
258
+ done: false
259
+ };
260
+ case 5:
261
+ _.label++;
262
+ y = op[1];
263
+ op = [
264
+ 0
265
+ ];
266
+ continue;
267
+ case 7:
268
+ op = _.ops.pop();
269
+ _.trys.pop();
270
+ continue;
271
+ default:
272
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
273
+ _ = 0;
274
+ continue;
275
+ }
276
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
277
+ _.label = op[1];
278
+ break;
279
+ }
280
+ if (op[0] === 6 && _.label < t[1]) {
281
+ _.label = t[1];
282
+ t = op;
283
+ break;
284
+ }
285
+ if (t && _.label < t[2]) {
286
+ _.label = t[2];
287
+ _.ops.push(op);
288
+ break;
289
+ }
290
+ if (t[2]) _.ops.pop();
291
+ _.trys.pop();
292
+ continue;
293
+ }
294
+ op = body.call(thisArg, _);
295
+ } catch (e) {
296
+ op = [
297
+ 6,
298
+ e
299
+ ];
300
+ y = 0;
301
+ } finally{
302
+ f = t = 0;
303
+ }
304
+ if (op[0] & 5) throw op[1];
305
+ return {
306
+ value: op[0] ? op[1] : void 0,
307
+ done: true
308
+ };
309
+ }
310
+ }
311
+ var getNewSsoOidcToken = function() {
312
+ var _ref = _async_to_generator$3(function(ssoToken, ssoRegion) {
313
+ var init, callerClientConfig, CreateTokenCommand, ssoOidcClient;
314
+ var _arguments = arguments;
315
+ return _ts_generator$3(this, function(_state) {
316
+ switch(_state.label){
317
+ case 0:
318
+ init = _arguments.length > 2 && _arguments[2] !== void 0 ? _arguments[2] : {}, callerClientConfig = _arguments.length > 3 ? _arguments[3] : void 0;
319
+ return [
320
+ 4,
321
+ import('./index.esm11.js')
322
+ ];
323
+ case 1:
324
+ CreateTokenCommand = _state.sent().CreateTokenCommand;
325
+ return [
326
+ 4,
327
+ getSsoOidcClient(ssoRegion, init, callerClientConfig)
328
+ ];
329
+ case 2:
330
+ ssoOidcClient = _state.sent();
331
+ return [
332
+ 2,
333
+ ssoOidcClient.send(new CreateTokenCommand({
334
+ clientId: ssoToken.clientId,
335
+ clientSecret: ssoToken.clientSecret,
336
+ refreshToken: ssoToken.refreshToken,
337
+ grantType: "refresh_token"
338
+ }))
339
+ ];
340
+ }
341
+ });
342
+ });
343
+ return function getNewSsoOidcToken(ssoToken, ssoRegion) {
344
+ return _ref.apply(this, arguments);
345
+ };
346
+ }();
347
+
348
+ var validateTokenExpiry = function(token) {
349
+ if (token.expiration && token.expiration.getTime() < Date.now()) {
350
+ throw new TokenProviderError("Token is expired. ".concat(REFRESH_MESSAGE), false);
351
+ }
352
+ };
353
+
354
+ var validateTokenKey = function(key, value) {
355
+ var forRefresh = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
356
+ if (typeof value === "undefined") {
357
+ throw new TokenProviderError("Value not present for '".concat(key, "' in SSO Token").concat(forRefresh ? ". Cannot refresh" : "", ". ").concat(REFRESH_MESSAGE), false);
358
+ }
359
+ };
360
+
361
+ var writeFile = promises.writeFile;
362
+ var writeSSOTokenToFile = function(id, ssoToken) {
363
+ var tokenFilepath = getSSOTokenFilepath(id);
364
+ var tokenString = JSON.stringify(ssoToken, null, 2);
365
+ return writeFile(tokenFilepath, tokenString);
366
+ };
367
+
368
+ function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
369
+ try {
370
+ var info = gen[key](arg);
371
+ var value = info.value;
372
+ } catch (error) {
373
+ reject(error);
374
+ return;
375
+ }
376
+ if (info.done) {
377
+ resolve(value);
378
+ } else {
379
+ Promise.resolve(value).then(_next, _throw);
380
+ }
381
+ }
382
+ function _async_to_generator$2(fn) {
383
+ return function() {
384
+ var self = this, args = arguments;
385
+ return new Promise(function(resolve, reject) {
386
+ var gen = fn.apply(self, args);
387
+ function _next(value) {
388
+ asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "next", value);
389
+ }
390
+ function _throw(err) {
391
+ asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "throw", err);
392
+ }
393
+ _next(undefined);
394
+ });
395
+ };
396
+ }
397
+ function _define_property$1(obj, key, value) {
398
+ if (key in obj) {
399
+ Object.defineProperty(obj, key, {
400
+ value: value,
401
+ enumerable: true,
402
+ configurable: true,
403
+ writable: true
404
+ });
405
+ } else {
406
+ obj[key] = value;
407
+ }
408
+ return obj;
409
+ }
410
+ function _object_spread$1(target) {
411
+ for(var i = 1; i < arguments.length; i++){
412
+ var source = arguments[i] != null ? arguments[i] : {};
413
+ var ownKeys = Object.keys(source);
414
+ if (typeof Object.getOwnPropertySymbols === "function") {
415
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
416
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
417
+ }));
418
+ }
419
+ ownKeys.forEach(function(key) {
420
+ _define_property$1(target, key, source[key]);
421
+ });
422
+ }
423
+ return target;
424
+ }
425
+ function ownKeys(object, enumerableOnly) {
426
+ var keys = Object.keys(object);
427
+ if (Object.getOwnPropertySymbols) {
428
+ var symbols = Object.getOwnPropertySymbols(object);
429
+ keys.push.apply(keys, symbols);
430
+ }
431
+ return keys;
432
+ }
433
+ function _object_spread_props(target, source) {
434
+ source = source != null ? source : {};
435
+ if (Object.getOwnPropertyDescriptors) {
436
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
437
+ } else {
438
+ ownKeys(Object(source)).forEach(function(key) {
439
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
440
+ });
441
+ }
442
+ return target;
443
+ }
444
+ function _ts_generator$2(thisArg, body) {
445
+ var f, y, t, g, _ = {
446
+ label: 0,
447
+ sent: function() {
448
+ if (t[0] & 1) throw t[1];
449
+ return t[1];
450
+ },
451
+ trys: [],
452
+ ops: []
453
+ };
454
+ return g = {
455
+ next: verb(0),
456
+ "throw": verb(1),
457
+ "return": verb(2)
458
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
459
+ return this;
460
+ }), g;
461
+ function verb(n) {
462
+ return function(v) {
463
+ return step([
464
+ n,
465
+ v
466
+ ]);
467
+ };
468
+ }
469
+ function step(op) {
470
+ if (f) throw new TypeError("Generator is already executing.");
471
+ while(_)try {
472
+ 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;
473
+ if (y = 0, t) op = [
474
+ op[0] & 2,
475
+ t.value
476
+ ];
477
+ switch(op[0]){
478
+ case 0:
479
+ case 1:
480
+ t = op;
481
+ break;
482
+ case 4:
483
+ _.label++;
484
+ return {
485
+ value: op[1],
486
+ done: false
487
+ };
488
+ case 5:
489
+ _.label++;
490
+ y = op[1];
491
+ op = [
492
+ 0
493
+ ];
494
+ continue;
495
+ case 7:
496
+ op = _.ops.pop();
497
+ _.trys.pop();
498
+ continue;
499
+ default:
500
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
501
+ _ = 0;
502
+ continue;
503
+ }
504
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
505
+ _.label = op[1];
506
+ break;
507
+ }
508
+ if (op[0] === 6 && _.label < t[1]) {
509
+ _.label = t[1];
510
+ t = op;
511
+ break;
512
+ }
513
+ if (t && _.label < t[2]) {
514
+ _.label = t[2];
515
+ _.ops.push(op);
516
+ break;
517
+ }
518
+ if (t[2]) _.ops.pop();
519
+ _.trys.pop();
520
+ continue;
521
+ }
522
+ op = body.call(thisArg, _);
523
+ } catch (e) {
524
+ op = [
525
+ 6,
526
+ e
527
+ ];
528
+ y = 0;
529
+ } finally{
530
+ f = t = 0;
531
+ }
532
+ if (op[0] & 5) throw op[1];
533
+ return {
534
+ value: op[0] ? op[1] : void 0,
535
+ done: true
536
+ };
537
+ }
538
+ }
539
+ var lastRefreshAttemptTime = new Date(0);
540
+ var fromSso = function() {
541
+ var init = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
542
+ return /*#__PURE__*/ _async_to_generator$2(function() {
543
+ var callerClientConfig, _init_logger, profiles, _init_profile, profileName, profile, ssoSessionName, ssoSessions, ssoSession, _i, _iter, ssoSessionRequiredKey, ssoRegion, ssoToken, accessToken, expiresAt, existingToken, newSsoOidcToken, newTokenExpiration;
544
+ var _arguments = arguments;
545
+ return _ts_generator$2(this, function(_state) {
546
+ switch(_state.label){
547
+ case 0:
548
+ callerClientConfig = (_arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : {}).callerClientConfig;
549
+ (_init_logger = init.logger) === null || _init_logger === void 0 ? void 0 : _init_logger.debug("@aws-sdk/token-providers - fromSso");
550
+ return [
551
+ 4,
552
+ parseKnownFiles(init)
553
+ ];
554
+ case 1:
555
+ profiles = _state.sent();
556
+ profileName = getProfileName({
557
+ profile: (_init_profile = init.profile) !== null && _init_profile !== void 0 ? _init_profile : callerClientConfig === null || callerClientConfig === void 0 ? void 0 : callerClientConfig.profile
558
+ });
559
+ profile = profiles[profileName];
560
+ if (!profile) {
561
+ throw new TokenProviderError("Profile '".concat(profileName, "' could not be found in shared credentials file."), false);
562
+ } else if (!profile["sso_session"]) {
563
+ throw new TokenProviderError("Profile '".concat(profileName, "' is missing required property 'sso_session'."));
564
+ }
565
+ ssoSessionName = profile["sso_session"];
566
+ return [
567
+ 4,
568
+ loadSsoSessionData(init)
569
+ ];
570
+ case 2:
571
+ ssoSessions = _state.sent();
572
+ ssoSession = ssoSessions[ssoSessionName];
573
+ if (!ssoSession) {
574
+ throw new TokenProviderError("Sso session '".concat(ssoSessionName, "' could not be found in shared credentials file."), false);
575
+ }
576
+ for(_i = 0, _iter = [
577
+ "sso_start_url",
578
+ "sso_region"
579
+ ]; _i < _iter.length; _i++){
580
+ ssoSessionRequiredKey = _iter[_i];
581
+ if (!ssoSession[ssoSessionRequiredKey]) {
582
+ throw new TokenProviderError("Sso session '".concat(ssoSessionName, "' is missing required property '").concat(ssoSessionRequiredKey, "'."), false);
583
+ }
584
+ }
585
+ ssoSession["sso_start_url"];
586
+ ssoRegion = ssoSession["sso_region"];
587
+ _state.label = 3;
588
+ case 3:
589
+ _state.trys.push([
590
+ 3,
591
+ 5,
592
+ ,
593
+ 6
594
+ ]);
595
+ return [
596
+ 4,
597
+ getSSOTokenFromFile(ssoSessionName)
598
+ ];
599
+ case 4:
600
+ ssoToken = _state.sent();
601
+ return [
602
+ 3,
603
+ 6
604
+ ];
605
+ case 5:
606
+ _state.sent();
607
+ throw new TokenProviderError("The SSO session token associated with profile=".concat(profileName, " was not found or is invalid. ").concat(REFRESH_MESSAGE), false);
608
+ case 6:
609
+ validateTokenKey("accessToken", ssoToken.accessToken);
610
+ validateTokenKey("expiresAt", ssoToken.expiresAt);
611
+ accessToken = ssoToken.accessToken, expiresAt = ssoToken.expiresAt;
612
+ existingToken = {
613
+ token: accessToken,
614
+ expiration: new Date(expiresAt)
615
+ };
616
+ if (existingToken.expiration.getTime() - Date.now() > EXPIRE_WINDOW_MS) {
617
+ return [
618
+ 2,
619
+ existingToken
620
+ ];
621
+ }
622
+ if (Date.now() - lastRefreshAttemptTime.getTime() < 30 * 1000) {
623
+ validateTokenExpiry(existingToken);
624
+ return [
625
+ 2,
626
+ existingToken
627
+ ];
628
+ }
629
+ validateTokenKey("clientId", ssoToken.clientId, true);
630
+ validateTokenKey("clientSecret", ssoToken.clientSecret, true);
631
+ validateTokenKey("refreshToken", ssoToken.refreshToken, true);
632
+ _state.label = 7;
633
+ case 7:
634
+ _state.trys.push([
635
+ 7,
636
+ 13,
637
+ ,
638
+ 14
639
+ ]);
640
+ lastRefreshAttemptTime.setTime(Date.now());
641
+ return [
642
+ 4,
643
+ getNewSsoOidcToken(ssoToken, ssoRegion, init, callerClientConfig)
644
+ ];
645
+ case 8:
646
+ newSsoOidcToken = _state.sent();
647
+ validateTokenKey("accessToken", newSsoOidcToken.accessToken);
648
+ validateTokenKey("expiresIn", newSsoOidcToken.expiresIn);
649
+ newTokenExpiration = new Date(Date.now() + newSsoOidcToken.expiresIn * 1000);
650
+ _state.label = 9;
651
+ case 9:
652
+ _state.trys.push([
653
+ 9,
654
+ 11,
655
+ ,
656
+ 12
657
+ ]);
658
+ return [
659
+ 4,
660
+ writeSSOTokenToFile(ssoSessionName, _object_spread_props(_object_spread$1({}, ssoToken), {
661
+ accessToken: newSsoOidcToken.accessToken,
662
+ expiresAt: newTokenExpiration.toISOString(),
663
+ refreshToken: newSsoOidcToken.refreshToken
664
+ }))
665
+ ];
666
+ case 10:
667
+ _state.sent();
668
+ return [
669
+ 3,
670
+ 12
671
+ ];
672
+ case 11:
673
+ _state.sent();
674
+ return [
675
+ 3,
676
+ 12
677
+ ];
678
+ case 12:
679
+ return [
680
+ 2,
681
+ {
682
+ token: newSsoOidcToken.accessToken,
683
+ expiration: newTokenExpiration
684
+ }
685
+ ];
686
+ case 13:
687
+ _state.sent();
688
+ validateTokenExpiry(existingToken);
689
+ return [
690
+ 2,
691
+ existingToken
692
+ ];
693
+ case 14:
694
+ return [
695
+ 2
696
+ ];
30
697
  }
31
698
  });
32
- }
33
- function resume(key, arg) {
34
- try {
35
- var result = gen[key](arg);
36
- var value = result.value;
37
- var wrappedAwait = value instanceof _await_value$1;
38
- Promise.resolve(wrappedAwait ? value.wrapped : value).then(function(arg) {
39
- if (wrappedAwait) {
40
- resume("next", arg);
41
- return;
42
- }
43
- settle(result.done ? "return" : "normal", arg);
44
- }, function(err) {
45
- resume("throw", err);
46
- });
47
- } catch (err) {
48
- settle("throw", err);
49
- }
50
- }
51
- function settle(type, value) {
52
- switch(type){
53
- case "return":
54
- front.resolve({
55
- value: value,
56
- done: true
57
- });
58
- break;
59
- case "throw":
60
- front.reject(value);
61
- break;
62
- default:
63
- front.resolve({
64
- value: value,
65
- done: false
66
- });
67
- break;
68
- }
69
- front = front.next;
70
- if (front) {
71
- resume(front.key, front.arg);
72
- } else {
73
- back = null;
74
- }
75
- }
76
- this._invoke = send;
77
- if (typeof gen.return !== "function") {
78
- this.return = undefined;
79
- }
80
- }
81
- if (typeof Symbol === "function" && Symbol.asyncIterator) {
82
- _async_generator$1.prototype[Symbol.asyncIterator] = function() {
83
- return this;
84
- };
85
- }
86
- _async_generator$1.prototype.next = function(arg) {
87
- return this._invoke("next", arg);
88
- };
89
- _async_generator$1.prototype.throw = function(arg) {
90
- return this._invoke("throw", arg);
91
- };
92
- _async_generator$1.prototype.return = function(arg) {
93
- return this._invoke("return", arg);
699
+ });
94
700
  };
701
+
95
702
  function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
96
703
  try {
97
704
  var info = gen[key](arg);
@@ -121,13 +728,7 @@ function _async_to_generator$1(fn) {
121
728
  });
122
729
  };
123
730
  }
124
- function _await_async_generator(value) {
125
- return new _await_value$1(value);
126
- }
127
- function _await_value$1(value) {
128
- this.wrapped = value;
129
- }
130
- function _define_property$1(obj, key, value) {
731
+ function _define_property(obj, key, value) {
131
732
  if (key in obj) {
132
733
  Object.defineProperty(obj, key, {
133
734
  value: value,
@@ -140,10 +741,20 @@ function _define_property$1(obj, key, value) {
140
741
  }
141
742
  return obj;
142
743
  }
143
- function _wrap_async_generator$1(fn) {
144
- return function() {
145
- return new _async_generator$1(fn.apply(this, arguments));
146
- };
744
+ function _object_spread(target) {
745
+ for(var i = 1; i < arguments.length; i++){
746
+ var source = arguments[i] != null ? arguments[i] : {};
747
+ var ownKeys = Object.keys(source);
748
+ if (typeof Object.getOwnPropertySymbols === "function") {
749
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
750
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
751
+ }));
752
+ }
753
+ ownKeys.forEach(function(key) {
754
+ _define_property(target, key, source[key]);
755
+ });
756
+ }
757
+ return target;
147
758
  }
148
759
  function _ts_generator$1(thisArg, body) {
149
760
  var f, y, t, g, _ = {
@@ -240,222 +851,173 @@ function _ts_generator$1(thisArg, body) {
240
851
  };
241
852
  }
242
853
  }
243
- var readableStreamToIterable = function(readableStream) {
244
- return _define_property$1({}, Symbol.asyncIterator, /*#__PURE__*/ _wrap_async_generator$1(function() {
245
- var reader, _ref, done, value;
854
+ var SHOULD_FAIL_CREDENTIAL_CHAIN = false;
855
+ var resolveSSOCredentials = function() {
856
+ var _ref = _async_to_generator$1(function(param) {
857
+ var ssoStartUrl, ssoSession, ssoAccountId, ssoRegion, ssoRoleName, ssoClient, clientConfig, parentClientConfig, callerClientConfig, profile, filepath, configFilepath, ignoreCache, logger, token, refreshMessage, _token, e, accessToken, _ref, SSOClient, GetRoleCredentialsCommand, _clientConfig_logger, _ref1, _clientConfig_region, _clientConfig_userAgentAppId, _ref2, sso, ssoResp, e2, tmp, _ref3, accessKeyId, secretAccessKey, sessionToken, expiration, credentialScope, accountId, credentials;
246
858
  return _ts_generator$1(this, function(_state) {
247
859
  switch(_state.label){
248
860
  case 0:
249
- reader = readableStream.getReader();
861
+ ssoStartUrl = param.ssoStartUrl, ssoSession = param.ssoSession, ssoAccountId = param.ssoAccountId, ssoRegion = param.ssoRegion, ssoRoleName = param.ssoRoleName, ssoClient = param.ssoClient, clientConfig = param.clientConfig, parentClientConfig = param.parentClientConfig, callerClientConfig = param.callerClientConfig, profile = param.profile, filepath = param.filepath, configFilepath = param.configFilepath, ignoreCache = param.ignoreCache, logger = param.logger;
862
+ refreshMessage = "To refresh this SSO session run aws sso login with the corresponding profile.";
863
+ if (!ssoSession) return [
864
+ 3,
865
+ 5
866
+ ];
250
867
  _state.label = 1;
251
868
  case 1:
252
869
  _state.trys.push([
253
870
  1,
871
+ 3,
254
872
  ,
255
- 6,
256
- 7
873
+ 4
257
874
  ]);
258
- _state.label = 2;
259
- case 2:
260
875
  return [
261
876
  4,
262
- _await_async_generator(reader.read())
263
- ];
264
- case 3:
265
- _ref = _state.sent(), done = _ref.done, value = _ref.value;
266
- if (done) return [
267
- 2
877
+ fromSso({
878
+ profile: profile,
879
+ filepath: filepath,
880
+ configFilepath: configFilepath,
881
+ ignoreCache: ignoreCache
882
+ })()
268
883
  ];
884
+ case 2:
885
+ _token = _state.sent();
886
+ token = {
887
+ accessToken: _token.token,
888
+ expiresAt: new Date(_token.expiration).toISOString()
889
+ };
269
890
  return [
270
- 4,
271
- value
891
+ 3,
892
+ 4
272
893
  ];
894
+ case 3:
895
+ e = _state.sent();
896
+ throw new CredentialsProviderError(e.message, {
897
+ tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
898
+ logger: logger
899
+ });
273
900
  case 4:
274
- _state.sent();
275
901
  return [
276
902
  3,
277
- 2
903
+ 8
278
904
  ];
279
905
  case 5:
906
+ _state.trys.push([
907
+ 5,
908
+ 7,
909
+ ,
910
+ 8
911
+ ]);
280
912
  return [
281
- 3,
282
- 7
913
+ 4,
914
+ getSSOTokenFromFile(ssoStartUrl)
283
915
  ];
284
916
  case 6:
285
- reader.releaseLock();
917
+ token = _state.sent();
286
918
  return [
287
- 7
919
+ 3,
920
+ 8
288
921
  ];
289
922
  case 7:
923
+ _state.sent();
924
+ throw new CredentialsProviderError("The SSO session associated with this profile is invalid. ".concat(refreshMessage), {
925
+ tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
926
+ logger: logger
927
+ });
928
+ case 8:
929
+ if (new Date(token.expiresAt).getTime() - Date.now() <= 0) {
930
+ throw new CredentialsProviderError("The SSO session associated with this profile has expired. ".concat(refreshMessage), {
931
+ tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
932
+ logger: logger
933
+ });
934
+ }
935
+ accessToken = token.accessToken;
290
936
  return [
291
- 2
937
+ 4,
938
+ import('./loadSso.esm.js')
939
+ ];
940
+ case 9:
941
+ _ref = _state.sent(), SSOClient = _ref.SSOClient, GetRoleCredentialsCommand = _ref.GetRoleCredentialsCommand;
942
+ sso = ssoClient || new SSOClient(Object.assign({}, clientConfig !== null && clientConfig !== void 0 ? clientConfig : {}, {
943
+ logger: (_ref1 = (_clientConfig_logger = clientConfig === null || clientConfig === void 0 ? void 0 : clientConfig.logger) !== null && _clientConfig_logger !== void 0 ? _clientConfig_logger : callerClientConfig === null || callerClientConfig === void 0 ? void 0 : callerClientConfig.logger) !== null && _ref1 !== void 0 ? _ref1 : parentClientConfig === null || parentClientConfig === void 0 ? void 0 : parentClientConfig.logger,
944
+ region: (_clientConfig_region = clientConfig === null || clientConfig === void 0 ? void 0 : clientConfig.region) !== null && _clientConfig_region !== void 0 ? _clientConfig_region : ssoRegion,
945
+ userAgentAppId: (_ref2 = (_clientConfig_userAgentAppId = clientConfig === null || clientConfig === void 0 ? void 0 : clientConfig.userAgentAppId) !== null && _clientConfig_userAgentAppId !== void 0 ? _clientConfig_userAgentAppId : callerClientConfig === null || callerClientConfig === void 0 ? void 0 : callerClientConfig.userAgentAppId) !== null && _ref2 !== void 0 ? _ref2 : parentClientConfig === null || parentClientConfig === void 0 ? void 0 : parentClientConfig.userAgentAppId
946
+ }));
947
+ _state.label = 10;
948
+ case 10:
949
+ _state.trys.push([
950
+ 10,
951
+ 12,
952
+ ,
953
+ 13
954
+ ]);
955
+ return [
956
+ 4,
957
+ sso.send(new GetRoleCredentialsCommand({
958
+ accountId: ssoAccountId,
959
+ roleName: ssoRoleName,
960
+ accessToken: accessToken
961
+ }))
962
+ ];
963
+ case 11:
964
+ ssoResp = _state.sent();
965
+ return [
966
+ 3,
967
+ 13
968
+ ];
969
+ case 12:
970
+ e2 = _state.sent();
971
+ throw new CredentialsProviderError(e2, {
972
+ tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
973
+ logger: logger
974
+ });
975
+ case 13:
976
+ tmp = ssoResp.roleCredentials, _ref3 = tmp === void 0 ? {} : tmp, accessKeyId = _ref3.accessKeyId, secretAccessKey = _ref3.secretAccessKey, sessionToken = _ref3.sessionToken, expiration = _ref3.expiration, credentialScope = _ref3.credentialScope, accountId = _ref3.accountId;
977
+ if (!accessKeyId || !secretAccessKey || !sessionToken || !expiration) {
978
+ throw new CredentialsProviderError("SSO returns an invalid temporary credential.", {
979
+ tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
980
+ logger: logger
981
+ });
982
+ }
983
+ credentials = _object_spread({
984
+ accessKeyId: accessKeyId,
985
+ secretAccessKey: secretAccessKey,
986
+ sessionToken: sessionToken,
987
+ expiration: new Date(expiration)
988
+ }, credentialScope && {
989
+ credentialScope: credentialScope
990
+ }, accountId && {
991
+ accountId: accountId
992
+ });
993
+ if (ssoSession) {
994
+ setCredentialFeature(credentials, "CREDENTIALS_SSO", "s");
995
+ } else {
996
+ setCredentialFeature(credentials, "CREDENTIALS_SSO_LEGACY", "u");
997
+ }
998
+ return [
999
+ 2,
1000
+ credentials
292
1001
  ];
293
1002
  }
294
1003
  });
295
- }));
296
- };
297
- var iterableToReadableStream = function(asyncIterable) {
298
- var iterator = asyncIterable[Symbol.asyncIterator]();
299
- return new ReadableStream({
300
- pull: function pull(controller) {
301
- return _async_to_generator$1(function() {
302
- var _ref, done, value;
303
- return _ts_generator$1(this, function(_state) {
304
- switch(_state.label){
305
- case 0:
306
- return [
307
- 4,
308
- iterator.next()
309
- ];
310
- case 1:
311
- _ref = _state.sent(), done = _ref.done, value = _ref.value;
312
- if (done) {
313
- return [
314
- 2,
315
- controller.close()
316
- ];
317
- }
318
- controller.enqueue(value);
319
- return [
320
- 2
321
- ];
322
- }
323
- });
324
- })();
325
- }
326
1004
  });
327
- };
1005
+ return function resolveSSOCredentials(_) {
1006
+ return _ref.apply(this, arguments);
1007
+ };
1008
+ }();
328
1009
 
329
- function _array_like_to_array(arr, len) {
330
- if (len == null || len > arr.length) len = arr.length;
331
- for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
332
- return arr2;
333
- }
334
- function _array_with_holes(arr) {
335
- if (Array.isArray(arr)) return arr;
336
- }
337
- function _async_generator(gen) {
338
- var front, back;
339
- function send(key, arg) {
340
- return new Promise(function(resolve, reject) {
341
- var request = {
342
- key: key,
343
- arg: arg,
344
- resolve: resolve,
345
- reject: reject,
346
- next: null
347
- };
348
- if (back) {
349
- back = back.next = request;
350
- } else {
351
- front = back = request;
352
- resume(key, arg);
353
- }
1010
+ var validateSsoProfile = function(profile, logger) {
1011
+ var sso_start_url = profile.sso_start_url, sso_account_id = profile.sso_account_id, sso_region = profile.sso_region, sso_role_name = profile.sso_role_name;
1012
+ if (!sso_start_url || !sso_account_id || !sso_region || !sso_role_name) {
1013
+ throw new CredentialsProviderError('Profile is configured with invalid SSO credentials. Required parameters "sso_account_id", ' + '"sso_region", "sso_role_name", "sso_start_url". Got '.concat(Object.keys(profile).join(", "), "\nReference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html"), {
1014
+ tryNextLink: false,
1015
+ logger: logger
354
1016
  });
355
1017
  }
356
- function resume(key, arg) {
357
- try {
358
- var result = gen[key](arg);
359
- var value = result.value;
360
- var wrappedAwait = value instanceof _await_value;
361
- Promise.resolve(wrappedAwait ? value.wrapped : value).then(function(arg) {
362
- if (wrappedAwait) {
363
- resume("next", arg);
364
- return;
365
- }
366
- settle(result.done ? "return" : "normal", arg);
367
- }, function(err) {
368
- resume("throw", err);
369
- });
370
- } catch (err) {
371
- settle("throw", err);
372
- }
373
- }
374
- function settle(type, value) {
375
- switch(type){
376
- case "return":
377
- front.resolve({
378
- value: value,
379
- done: true
380
- });
381
- break;
382
- case "throw":
383
- front.reject(value);
384
- break;
385
- default:
386
- front.resolve({
387
- value: value,
388
- done: false
389
- });
390
- break;
391
- }
392
- front = front.next;
393
- if (front) {
394
- resume(front.key, front.arg);
395
- } else {
396
- back = null;
397
- }
398
- }
399
- this._invoke = send;
400
- if (typeof gen.return !== "function") {
401
- this.return = undefined;
402
- }
403
- }
404
- if (typeof Symbol === "function" && Symbol.asyncIterator) {
405
- _async_generator.prototype[Symbol.asyncIterator] = function() {
406
- return this;
407
- };
408
- }
409
- _async_generator.prototype.next = function(arg) {
410
- return this._invoke("next", arg);
411
- };
412
- _async_generator.prototype.throw = function(arg) {
413
- return this._invoke("throw", arg);
414
- };
415
- _async_generator.prototype.return = function(arg) {
416
- return this._invoke("return", arg);
1018
+ return profile;
417
1019
  };
418
- function _async_iterator(iterable) {
419
- var method, async, sync, retry = 2;
420
- for("undefined" != typeof Symbol && (async = Symbol.asyncIterator, sync = Symbol.iterator); retry--;){
421
- if (async && null != (method = iterable[async])) return method.call(iterable);
422
- if (sync && null != (method = iterable[sync])) return new AsyncFromSyncIterator(method.call(iterable));
423
- async = "@@asyncIterator", sync = "@@iterator";
424
- }
425
- throw new TypeError("Object is not async iterable");
426
- }
427
- function AsyncFromSyncIterator(s) {
428
- function AsyncFromSyncIteratorContinuation(r) {
429
- if (Object(r) !== r) return Promise.reject(new TypeError(r + " is not an object."));
430
- var done = r.done;
431
- return Promise.resolve(r.value).then(function(value) {
432
- return {
433
- value: value,
434
- done: done
435
- };
436
- });
437
- }
438
- return AsyncFromSyncIterator = function(s) {
439
- this.s = s, this.n = s.next;
440
- }, AsyncFromSyncIterator.prototype = {
441
- s: null,
442
- n: null,
443
- next: function() {
444
- return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments));
445
- },
446
- return: function(value) {
447
- var ret = this.s.return;
448
- return void 0 === ret ? Promise.resolve({
449
- value: value,
450
- done: true
451
- }) : AsyncFromSyncIteratorContinuation(ret.apply(this.s, arguments));
452
- },
453
- throw: function(value) {
454
- var thr = this.s.return;
455
- return void 0 === thr ? Promise.reject(value) : AsyncFromSyncIteratorContinuation(thr.apply(this.s, arguments));
456
- }
457
- }, new AsyncFromSyncIterator(s);
458
- }
1020
+
459
1021
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
460
1022
  try {
461
1023
  var info = gen[key](arg);
@@ -485,102 +1047,6 @@ function _async_to_generator(fn) {
485
1047
  });
486
1048
  };
487
1049
  }
488
- function _await_value(value) {
489
- this.wrapped = value;
490
- }
491
- function _class_call_check(instance, Constructor) {
492
- if (!(instance instanceof Constructor)) {
493
- throw new TypeError("Cannot call a class as a function");
494
- }
495
- }
496
- function _defineProperties(target, props) {
497
- for(var i = 0; i < props.length; i++){
498
- var descriptor = props[i];
499
- descriptor.enumerable = descriptor.enumerable || false;
500
- descriptor.configurable = true;
501
- if ("value" in descriptor) descriptor.writable = true;
502
- Object.defineProperty(target, descriptor.key, descriptor);
503
- }
504
- }
505
- function _create_class(Constructor, protoProps, staticProps) {
506
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
507
- return Constructor;
508
- }
509
- function _define_property(obj, key, value) {
510
- if (key in obj) {
511
- Object.defineProperty(obj, key, {
512
- value: value,
513
- enumerable: true,
514
- configurable: true,
515
- writable: true
516
- });
517
- } else {
518
- obj[key] = value;
519
- }
520
- return obj;
521
- }
522
- function _iterable_to_array_limit(arr, i) {
523
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
524
- if (_i == null) return;
525
- var _arr = [];
526
- var _n = true;
527
- var _d = false;
528
- var _s, _e;
529
- try {
530
- for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
531
- _arr.push(_s.value);
532
- if (i && _arr.length === i) break;
533
- }
534
- } catch (err) {
535
- _d = true;
536
- _e = err;
537
- } finally{
538
- try {
539
- if (!_n && _i["return"] != null) _i["return"]();
540
- } finally{
541
- if (_d) throw _e;
542
- }
543
- }
544
- return _arr;
545
- }
546
- function _non_iterable_rest() {
547
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
548
- }
549
- function _object_spread(target) {
550
- for(var i = 1; i < arguments.length; i++){
551
- var source = arguments[i] != null ? arguments[i] : {};
552
- var ownKeys = Object.keys(source);
553
- if (typeof Object.getOwnPropertySymbols === "function") {
554
- ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
555
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
556
- }));
557
- }
558
- ownKeys.forEach(function(key) {
559
- _define_property(target, key, source[key]);
560
- });
561
- }
562
- return target;
563
- }
564
- function _sliced_to_array(arr, i) {
565
- return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
566
- }
567
- function _type_of(obj) {
568
- "@swc/helpers - typeof";
569
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
570
- }
571
- function _unsupported_iterable_to_array(o, minLen) {
572
- if (!o) return;
573
- if (typeof o === "string") return _array_like_to_array(o, minLen);
574
- var n = Object.prototype.toString.call(o).slice(8, -1);
575
- if (n === "Object" && o.constructor) n = o.constructor.name;
576
- if (n === "Map" || n === "Set") return Array.from(n);
577
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
578
- }
579
- function _wrap_async_generator(fn) {
580
- return function() {
581
- return new _async_generator(fn.apply(this, arguments));
582
- };
583
- }
584
1050
  function _ts_generator(thisArg, body) {
585
1051
  var f, y, t, g, _ = {
586
1052
  label: 0,
@@ -676,587 +1142,124 @@ function _ts_generator(thisArg, body) {
676
1142
  };
677
1143
  }
678
1144
  }
679
- var EventStreamSerde = /*#__PURE__*/ function() {
680
- function EventStreamSerde(param) {
681
- var marshaller = param.marshaller, serializer = param.serializer, deserializer = param.deserializer, serdeContext = param.serdeContext, defaultContentType = param.defaultContentType;
682
- _class_call_check(this, EventStreamSerde);
683
- _define_property(this, "marshaller", void 0);
684
- _define_property(this, "serializer", void 0);
685
- _define_property(this, "deserializer", void 0);
686
- _define_property(this, "serdeContext", void 0);
687
- _define_property(this, "defaultContentType", void 0);
688
- this.marshaller = marshaller;
689
- this.serializer = serializer;
690
- this.deserializer = deserializer;
691
- this.serdeContext = serdeContext;
692
- this.defaultContentType = defaultContentType;
693
- }
694
- _create_class(EventStreamSerde, [
695
- {
696
- key: "serializeEventStream",
697
- value: function serializeEventStream(param) {
698
- var eventStream = param.eventStream, requestSchema = param.requestSchema, initialRequest = param.initialRequest;
699
- var _this = this;
700
- return _async_to_generator(function() {
701
- var marshaller, eventStreamMember, unionSchema, serializer, defaultContentType, initialRequestMarker, eventStreamIterable;
702
- return _ts_generator(this, function(_state) {
703
- marshaller = _this.marshaller;
704
- eventStreamMember = requestSchema.getEventStreamMember();
705
- unionSchema = requestSchema.getMemberSchema(eventStreamMember);
706
- serializer = _this.serializer;
707
- defaultContentType = _this.defaultContentType;
708
- initialRequestMarker = Symbol("initialRequestMarker");
709
- eventStreamIterable = _define_property({}, Symbol.asyncIterator, function() {
710
- return _wrap_async_generator(function() {
711
- var headers, body, _obj, _iteratorAbruptCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, page, err;
712
- return _ts_generator(this, function(_state) {
713
- switch(_state.label){
714
- case 0:
715
- if (!initialRequest) return [
716
- 3,
717
- 2
718
- ];
719
- headers = {
720
- ":event-type": {
721
- type: "string",
722
- value: "initial-request"
723
- },
724
- ":message-type": {
725
- type: "string",
726
- value: "event"
727
- },
728
- ":content-type": {
729
- type: "string",
730
- value: defaultContentType
731
- }
732
- };
733
- serializer.write(requestSchema, initialRequest);
734
- body = serializer.flush();
735
- return [
736
- 4,
737
- (_obj = {}, _define_property(_obj, initialRequestMarker, true), _define_property(_obj, "headers", headers), _define_property(_obj, "body", body), _obj)
738
- ];
739
- case 1:
740
- _state.sent();
741
- _state.label = 2;
742
- case 2:
743
- _iteratorAbruptCompletion = false, _didIteratorError = false;
744
- _state.label = 3;
745
- case 3:
746
- _state.trys.push([
747
- 3,
748
- 9,
749
- 10,
750
- 15
751
- ]);
752
- _iterator = _async_iterator(eventStream);
753
- _state.label = 4;
754
- case 4:
755
- return [
756
- 4,
757
- _iterator.next()
758
- ];
759
- case 5:
760
- if (!(_iteratorAbruptCompletion = !(_step = _state.sent()).done)) return [
761
- 3,
762
- 8
763
- ];
764
- _value = _step.value;
765
- page = _value;
766
- return [
767
- 4,
768
- page
769
- ];
770
- case 6:
771
- _state.sent();
772
- _state.label = 7;
773
- case 7:
774
- _iteratorAbruptCompletion = false;
775
- return [
776
- 3,
777
- 4
778
- ];
779
- case 8:
780
- return [
781
- 3,
782
- 15
783
- ];
784
- case 9:
785
- err = _state.sent();
786
- _didIteratorError = true;
787
- _iteratorError = err;
788
- return [
789
- 3,
790
- 15
791
- ];
792
- case 10:
793
- _state.trys.push([
794
- 10,
795
- ,
796
- 13,
797
- 14
798
- ]);
799
- if (!(_iteratorAbruptCompletion && _iterator.return != null)) return [
800
- 3,
801
- 12
802
- ];
803
- return [
804
- 4,
805
- _iterator.return()
806
- ];
807
- case 11:
808
- _state.sent();
809
- _state.label = 12;
810
- case 12:
811
- return [
812
- 3,
813
- 14
814
- ];
815
- case 13:
816
- if (_didIteratorError) {
817
- throw _iteratorError;
818
- }
819
- return [
820
- 7
821
- ];
822
- case 14:
823
- return [
824
- 7
825
- ];
826
- case 15:
827
- return [
828
- 2
829
- ];
830
- }
831
- });
832
- })();
1145
+ var fromSSO = function() {
1146
+ var init = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
1147
+ return /*#__PURE__*/ _async_to_generator(function() {
1148
+ var callerClientConfig, _init_logger, ssoStartUrl, ssoAccountId, ssoRegion, ssoRoleName, ssoSession, ssoClient, _init_profile, profileName, profiles, profile, ssoSessions, session, conflictMsg, _validateSsoProfile, sso_start_url, sso_account_id, sso_region, sso_role_name, sso_session;
1149
+ var _arguments = arguments;
1150
+ return _ts_generator(this, function(_state) {
1151
+ switch(_state.label){
1152
+ case 0:
1153
+ callerClientConfig = (_arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : {}).callerClientConfig;
1154
+ (_init_logger = init.logger) === null || _init_logger === void 0 ? void 0 : _init_logger.debug("@aws-sdk/credential-provider-sso - fromSSO");
1155
+ ssoStartUrl = init.ssoStartUrl, ssoAccountId = init.ssoAccountId, ssoRegion = init.ssoRegion, ssoRoleName = init.ssoRoleName, ssoSession = init.ssoSession;
1156
+ ssoClient = init.ssoClient;
1157
+ profileName = getProfileName({
1158
+ profile: (_init_profile = init.profile) !== null && _init_profile !== void 0 ? _init_profile : callerClientConfig === null || callerClientConfig === void 0 ? void 0 : callerClientConfig.profile
1159
+ });
1160
+ if (!(!ssoStartUrl && !ssoAccountId && !ssoRegion && !ssoRoleName && !ssoSession)) return [
1161
+ 3,
1162
+ 4
1163
+ ];
1164
+ return [
1165
+ 4,
1166
+ parseKnownFiles(init)
1167
+ ];
1168
+ case 1:
1169
+ profiles = _state.sent();
1170
+ profile = profiles[profileName];
1171
+ if (!profile) {
1172
+ throw new CredentialsProviderError("Profile ".concat(profileName, " was not found."), {
1173
+ logger: init.logger
1174
+ });
1175
+ }
1176
+ if (!isSsoProfile(profile)) {
1177
+ throw new CredentialsProviderError("Profile ".concat(profileName, " is not configured with SSO credentials."), {
1178
+ logger: init.logger
1179
+ });
1180
+ }
1181
+ if (!(profile === null || profile === void 0 ? void 0 : profile.sso_session)) return [
1182
+ 3,
1183
+ 3
1184
+ ];
1185
+ return [
1186
+ 4,
1187
+ loadSsoSessionData(init)
1188
+ ];
1189
+ case 2:
1190
+ ssoSessions = _state.sent();
1191
+ session = ssoSessions[profile.sso_session];
1192
+ conflictMsg = " configurations in profile ".concat(profileName, " and sso-session ").concat(profile.sso_session);
1193
+ if (ssoRegion && ssoRegion !== session.sso_region) {
1194
+ throw new CredentialsProviderError("Conflicting SSO region" + conflictMsg, {
1195
+ tryNextLink: false,
1196
+ logger: init.logger
1197
+ });
1198
+ }
1199
+ if (ssoStartUrl && ssoStartUrl !== session.sso_start_url) {
1200
+ throw new CredentialsProviderError("Conflicting SSO start_url" + conflictMsg, {
1201
+ tryNextLink: false,
1202
+ logger: init.logger
1203
+ });
1204
+ }
1205
+ profile.sso_region = session.sso_region;
1206
+ profile.sso_start_url = session.sso_start_url;
1207
+ _state.label = 3;
1208
+ case 3:
1209
+ _validateSsoProfile = validateSsoProfile(profile, init.logger), sso_start_url = _validateSsoProfile.sso_start_url, sso_account_id = _validateSsoProfile.sso_account_id, sso_region = _validateSsoProfile.sso_region, sso_role_name = _validateSsoProfile.sso_role_name, sso_session = _validateSsoProfile.sso_session;
1210
+ return [
1211
+ 2,
1212
+ resolveSSOCredentials({
1213
+ ssoStartUrl: sso_start_url,
1214
+ ssoSession: sso_session,
1215
+ ssoAccountId: sso_account_id,
1216
+ ssoRegion: sso_region,
1217
+ ssoRoleName: sso_role_name,
1218
+ ssoClient: ssoClient,
1219
+ clientConfig: init.clientConfig,
1220
+ parentClientConfig: init.parentClientConfig,
1221
+ callerClientConfig: init.callerClientConfig,
1222
+ profile: profileName,
1223
+ filepath: init.filepath,
1224
+ configFilepath: init.configFilepath,
1225
+ ignoreCache: init.ignoreCache,
1226
+ logger: init.logger
1227
+ })
1228
+ ];
1229
+ case 4:
1230
+ if (!ssoStartUrl || !ssoAccountId || !ssoRegion || !ssoRoleName) {
1231
+ throw new CredentialsProviderError("Incomplete configuration. The fromSSO() argument hash must include " + '"ssoStartUrl", "ssoAccountId", "ssoRegion", "ssoRoleName"', {
1232
+ tryNextLink: false,
1233
+ logger: init.logger
833
1234
  });
1235
+ } else {
834
1236
  return [
835
1237
  2,
836
- marshaller.serialize(eventStreamIterable, function(event) {
837
- if (event[initialRequestMarker]) {
838
- return {
839
- headers: event.headers,
840
- body: event.body
841
- };
842
- }
843
- var unionMember = "";
844
- for(var key in event){
845
- if (key !== "__type") {
846
- unionMember = key;
847
- break;
848
- }
849
- }
850
- var _this_writeEventBody = _this.writeEventBody(unionMember, unionSchema, event), additionalHeaders = _this_writeEventBody.additionalHeaders, body = _this_writeEventBody.body, eventType = _this_writeEventBody.eventType, explicitPayloadContentType = _this_writeEventBody.explicitPayloadContentType;
851
- var headers = _object_spread({
852
- ":event-type": {
853
- type: "string",
854
- value: eventType
855
- },
856
- ":message-type": {
857
- type: "string",
858
- value: "event"
859
- },
860
- ":content-type": {
861
- type: "string",
862
- value: explicitPayloadContentType !== null && explicitPayloadContentType !== void 0 ? explicitPayloadContentType : defaultContentType
863
- }
864
- }, additionalHeaders);
865
- return {
866
- headers: headers,
867
- body: body
868
- };
1238
+ resolveSSOCredentials({
1239
+ ssoStartUrl: ssoStartUrl,
1240
+ ssoSession: ssoSession,
1241
+ ssoAccountId: ssoAccountId,
1242
+ ssoRegion: ssoRegion,
1243
+ ssoRoleName: ssoRoleName,
1244
+ ssoClient: ssoClient,
1245
+ clientConfig: init.clientConfig,
1246
+ parentClientConfig: init.parentClientConfig,
1247
+ callerClientConfig: init.callerClientConfig,
1248
+ profile: profileName,
1249
+ filepath: init.filepath,
1250
+ configFilepath: init.configFilepath,
1251
+ ignoreCache: init.ignoreCache,
1252
+ logger: init.logger
869
1253
  })
870
1254
  ];
871
- });
872
- })();
873
- }
874
- },
875
- {
876
- key: "deserializeEventStream",
877
- value: function deserializeEventStream(param) {
878
- var response = param.response, responseSchema = param.responseSchema, initialResponseContainer = param.initialResponseContainer;
879
- var _this = this;
880
- return _async_to_generator(function() {
881
- var _firstEvent_value, marshaller, eventStreamMember, unionSchema, memberSchemas, initialResponseMarker, asyncIterable, asyncIterator, firstEvent;
882
- return _ts_generator(this, function(_state) {
883
- switch(_state.label){
884
- case 0:
885
- marshaller = _this.marshaller;
886
- eventStreamMember = responseSchema.getEventStreamMember();
887
- unionSchema = responseSchema.getMemberSchema(eventStreamMember);
888
- memberSchemas = unionSchema.getMemberSchemas();
889
- initialResponseMarker = Symbol("initialResponseMarker");
890
- asyncIterable = marshaller.deserialize(response.body, function() {
891
- var _ref = _async_to_generator(function(event) {
892
- var unionMember, body, dataObject, eventStreamSchema, out, hasBindings, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _step_value, name, member, _member_getMergedTraits, eventHeader, eventPayload, _this_serdeContext, _this_serdeContext_utf8Encoder, _event_unionMember_headers_name, value, err, _tmp;
893
- return _ts_generator(this, function(_state) {
894
- switch(_state.label){
895
- case 0:
896
- unionMember = "";
897
- for(var key in event){
898
- if (key !== "__type") {
899
- unionMember = key;
900
- break;
901
- }
902
- }
903
- body = event[unionMember].body;
904
- if (!(unionMember === "initial-response")) return [
905
- 3,
906
- 2
907
- ];
908
- return [
909
- 4,
910
- _this.deserializer.read(responseSchema, body)
911
- ];
912
- case 1:
913
- dataObject = _state.sent();
914
- delete dataObject[eventStreamMember];
915
- return [
916
- 2,
917
- _object_spread(_define_property({}, initialResponseMarker, true), dataObject)
918
- ];
919
- case 2:
920
- if (!(unionMember in memberSchemas)) return [
921
- 3,
922
- 17
923
- ];
924
- eventStreamSchema = memberSchemas[unionMember];
925
- if (!eventStreamSchema.isStructSchema()) return [
926
- 3,
927
- 15
928
- ];
929
- out = {};
930
- hasBindings = false;
931
- _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
932
- _state.label = 3;
933
- case 3:
934
- _state.trys.push([
935
- 3,
936
- 12,
937
- 13,
938
- 14
939
- ]);
940
- _iterator = eventStreamSchema.structIterator()[Symbol.iterator]();
941
- _state.label = 4;
942
- case 4:
943
- if (!!(_iteratorNormalCompletion = (_step = _iterator.next()).done)) return [
944
- 3,
945
- 11
946
- ];
947
- _step_value = _sliced_to_array(_step.value, 2), name = _step_value[0], member = _step_value[1];
948
- _member_getMergedTraits = member.getMergedTraits(), eventHeader = _member_getMergedTraits.eventHeader, eventPayload = _member_getMergedTraits.eventPayload;
949
- hasBindings = hasBindings || Boolean(eventHeader || eventPayload);
950
- if (!eventPayload) return [
951
- 3,
952
- 9
953
- ];
954
- if (!member.isBlobSchema()) return [
955
- 3,
956
- 5
957
- ];
958
- out[name] = body;
959
- return [
960
- 3,
961
- 8
962
- ];
963
- case 5:
964
- if (!member.isStringSchema()) return [
965
- 3,
966
- 6
967
- ];
968
- out[name] = ((_this_serdeContext_utf8Encoder = (_this_serdeContext = _this.serdeContext) === null || _this_serdeContext === void 0 ? void 0 : _this_serdeContext.utf8Encoder) !== null && _this_serdeContext_utf8Encoder !== void 0 ? _this_serdeContext_utf8Encoder : toUtf8)(body);
969
- return [
970
- 3,
971
- 8
972
- ];
973
- case 6:
974
- if (!member.isStructSchema()) return [
975
- 3,
976
- 8
977
- ];
978
- return [
979
- 4,
980
- _this.deserializer.read(member, body)
981
- ];
982
- case 7:
983
- out[name] = _state.sent();
984
- _state.label = 8;
985
- case 8:
986
- return [
987
- 3,
988
- 10
989
- ];
990
- case 9:
991
- if (eventHeader) {
992
- value = (_event_unionMember_headers_name = event[unionMember].headers[name]) === null || _event_unionMember_headers_name === void 0 ? void 0 : _event_unionMember_headers_name.value;
993
- if (value != null) {
994
- if (member.isNumericSchema()) {
995
- if (value && (typeof value === "undefined" ? "undefined" : _type_of(value)) === "object" && "bytes" in value) {
996
- out[name] = BigInt(value.toString());
997
- } else {
998
- out[name] = Number(value);
999
- }
1000
- } else {
1001
- out[name] = value;
1002
- }
1003
- }
1004
- }
1005
- _state.label = 10;
1006
- case 10:
1007
- _iteratorNormalCompletion = true;
1008
- return [
1009
- 3,
1010
- 4
1011
- ];
1012
- case 11:
1013
- return [
1014
- 3,
1015
- 14
1016
- ];
1017
- case 12:
1018
- err = _state.sent();
1019
- _didIteratorError = true;
1020
- _iteratorError = err;
1021
- return [
1022
- 3,
1023
- 14
1024
- ];
1025
- case 13:
1026
- try {
1027
- if (!_iteratorNormalCompletion && _iterator.return != null) {
1028
- _iterator.return();
1029
- }
1030
- } finally{
1031
- if (_didIteratorError) {
1032
- throw _iteratorError;
1033
- }
1034
- }
1035
- return [
1036
- 7
1037
- ];
1038
- case 14:
1039
- if (hasBindings) {
1040
- return [
1041
- 2,
1042
- _define_property({}, unionMember, out)
1043
- ];
1044
- }
1045
- if (body.byteLength === 0) {
1046
- return [
1047
- 2,
1048
- _define_property({}, unionMember, {})
1049
- ];
1050
- }
1051
- _state.label = 15;
1052
- case 15:
1053
- _tmp = [
1054
- {},
1055
- unionMember
1056
- ];
1057
- return [
1058
- 4,
1059
- _this.deserializer.read(eventStreamSchema, body)
1060
- ];
1061
- case 16:
1062
- return [
1063
- 2,
1064
- _define_property.apply(void 0, _tmp.concat([
1065
- _state.sent()
1066
- ]))
1067
- ];
1068
- case 17:
1069
- return [
1070
- 2,
1071
- {
1072
- $unknown: event
1073
- }
1074
- ];
1075
- case 18:
1076
- return [
1077
- 2
1078
- ];
1079
- }
1080
- });
1081
- });
1082
- return function(event) {
1083
- return _ref.apply(this, arguments);
1084
- };
1085
- }());
1086
- asyncIterator = asyncIterable[Symbol.asyncIterator]();
1087
- return [
1088
- 4,
1089
- asyncIterator.next()
1090
- ];
1091
- case 1:
1092
- firstEvent = _state.sent();
1093
- if (firstEvent.done) {
1094
- return [
1095
- 2,
1096
- asyncIterable
1097
- ];
1098
- }
1099
- if ((_firstEvent_value = firstEvent.value) === null || _firstEvent_value === void 0 ? void 0 : _firstEvent_value[initialResponseMarker]) {
1100
- if (!responseSchema) {
1101
- throw new Error("@smithy::core/protocols - initial-response event encountered in event stream but no response schema given.");
1102
- }
1103
- for(var key in firstEvent.value){
1104
- initialResponseContainer[key] = firstEvent.value[key];
1105
- }
1106
- }
1107
- return [
1108
- 2,
1109
- _define_property({}, Symbol.asyncIterator, function() {
1110
- return _wrap_async_generator(function() {
1111
- var _firstEvent_value, _ref, done, value;
1112
- return _ts_generator(this, function(_state) {
1113
- switch(_state.label){
1114
- case 0:
1115
- if (!!(firstEvent === null || firstEvent === void 0 ? void 0 : (_firstEvent_value = firstEvent.value) === null || _firstEvent_value === void 0 ? void 0 : _firstEvent_value[initialResponseMarker])) return [
1116
- 3,
1117
- 2
1118
- ];
1119
- return [
1120
- 4,
1121
- firstEvent.value
1122
- ];
1123
- case 1:
1124
- _state.sent();
1125
- _state.label = 2;
1126
- case 2:
1127
- return [
1128
- 4,
1129
- asyncIterator.next()
1130
- ];
1131
- case 3:
1132
- _ref = _state.sent(), done = _ref.done, value = _ref.value;
1133
- if (done) {
1134
- return [
1135
- 3,
1136
- 5
1137
- ];
1138
- }
1139
- return [
1140
- 4,
1141
- value
1142
- ];
1143
- case 4:
1144
- _state.sent();
1145
- return [
1146
- 3,
1147
- 2
1148
- ];
1149
- case 5:
1150
- return [
1151
- 2
1152
- ];
1153
- }
1154
- });
1155
- })();
1156
- })
1157
- ];
1158
- }
1159
- });
1160
- })();
1161
- }
1162
- },
1163
- {
1164
- key: "writeEventBody",
1165
- value: function writeEventBody(unionMember, unionSchema, event) {
1166
- var _this_serdeContext;
1167
- var serializer = this.serializer;
1168
- var eventType = unionMember;
1169
- var explicitPayloadMember = null;
1170
- var explicitPayloadContentType;
1171
- var isKnownSchema = function() {
1172
- var struct = unionSchema.getSchema();
1173
- return struct[4].includes(unionMember);
1174
- }();
1175
- var additionalHeaders = {};
1176
- if (!isKnownSchema) {
1177
- var _event_unionMember = _sliced_to_array(event[unionMember], 2), type = _event_unionMember[0], value = _event_unionMember[1];
1178
- eventType = type;
1179
- serializer.write(15, value);
1180
- } else {
1181
- var eventSchema = unionSchema.getMemberSchema(unionMember);
1182
- if (eventSchema.isStructSchema()) {
1183
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
1184
- try {
1185
- for(var _iterator = eventSchema.structIterator()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
1186
- var _step_value = _sliced_to_array(_step.value, 2), memberName = _step_value[0], memberSchema = _step_value[1];
1187
- var _memberSchema_getMergedTraits = memberSchema.getMergedTraits(), eventHeader = _memberSchema_getMergedTraits.eventHeader, eventPayload = _memberSchema_getMergedTraits.eventPayload;
1188
- if (eventPayload) {
1189
- explicitPayloadMember = memberName;
1190
- } else if (eventHeader) {
1191
- var value1 = event[unionMember][memberName];
1192
- var type1 = "binary";
1193
- if (memberSchema.isNumericSchema()) {
1194
- if (Math.pow(-2, 31) <= value1 && value1 <= Math.pow(2, 31) - 1) {
1195
- type1 = "integer";
1196
- } else {
1197
- type1 = "long";
1198
- }
1199
- } else if (memberSchema.isTimestampSchema()) {
1200
- type1 = "timestamp";
1201
- } else if (memberSchema.isStringSchema()) {
1202
- type1 = "string";
1203
- } else if (memberSchema.isBooleanSchema()) {
1204
- type1 = "boolean";
1205
- }
1206
- if (value1 != null) {
1207
- additionalHeaders[memberName] = {
1208
- type: type1,
1209
- value: value1
1210
- };
1211
- delete event[unionMember][memberName];
1212
- }
1213
- }
1214
- }
1215
- } catch (err) {
1216
- _didIteratorError = true;
1217
- _iteratorError = err;
1218
- } finally{
1219
- try {
1220
- if (!_iteratorNormalCompletion && _iterator.return != null) {
1221
- _iterator.return();
1222
- }
1223
- } finally{
1224
- if (_didIteratorError) {
1225
- throw _iteratorError;
1226
- }
1227
- }
1228
- }
1229
- if (explicitPayloadMember !== null) {
1230
- var payloadSchema = eventSchema.getMemberSchema(explicitPayloadMember);
1231
- if (payloadSchema.isBlobSchema()) {
1232
- explicitPayloadContentType = "application/octet-stream";
1233
- } else if (payloadSchema.isStringSchema()) {
1234
- explicitPayloadContentType = "text/plain";
1235
- }
1236
- serializer.write(payloadSchema, event[unionMember][explicitPayloadMember]);
1237
- } else {
1238
- serializer.write(eventSchema, event[unionMember]);
1239
- }
1240
- } else if (eventSchema.isUnitSchema()) {
1241
- serializer.write(eventSchema, {});
1242
- } else {
1243
- throw new Error("@smithy/core/event-streams - non-struct member not supported in event stream union.");
1244
1255
  }
1245
- }
1246
- var _serializer_flush;
1247
- var messageSerialization = (_serializer_flush = serializer.flush()) !== null && _serializer_flush !== void 0 ? _serializer_flush : new Uint8Array();
1248
- var _this_serdeContext_utf8Decoder;
1249
- var body = typeof messageSerialization === "string" ? ((_this_serdeContext_utf8Decoder = (_this_serdeContext = this.serdeContext) === null || _this_serdeContext === void 0 ? void 0 : _this_serdeContext.utf8Decoder) !== null && _this_serdeContext_utf8Decoder !== void 0 ? _this_serdeContext_utf8Decoder : fromUtf8)(messageSerialization) : messageSerialization;
1250
- return {
1251
- body: body,
1252
- eventType: eventType,
1253
- explicitPayloadContentType: explicitPayloadContentType,
1254
- additionalHeaders: additionalHeaders
1255
- };
1256
+ case 5:
1257
+ return [
1258
+ 2
1259
+ ];
1256
1260
  }
1257
- }
1258
- ]);
1259
- return EventStreamSerde;
1260
- }();
1261
+ });
1262
+ });
1263
+ };
1261
1264
 
1262
- export { EventStreamSerde, iterableToReadableStream, readableStreamToIterable };
1265
+ export { fromSSO, isSsoProfile, validateSsoProfile };