@alienplatform/sdk 1.10.7 → 1.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/.turbo/turbo-build.log +37 -8
  2. package/dist/bearerTokenAuthenticationPolicy.js +3028 -0
  3. package/dist/bindings/index.d.ts +1 -0
  4. package/dist/bindings/index.d.ts.map +1 -1
  5. package/dist/bindings/postgres.d.ts +90 -0
  6. package/dist/bindings/postgres.d.ts.map +1 -0
  7. package/dist/bindings/postgres.test.d.ts +2 -0
  8. package/dist/bindings/postgres.test.d.ts.map +1 -0
  9. package/dist/client.js +2376 -0
  10. package/dist/commands/index.js +1 -1
  11. package/dist/dist-cjs.js +3 -0
  12. package/dist/dist-cjs2.js +718 -0
  13. package/dist/dist-cjs3.js +2486 -0
  14. package/dist/dist-cjs4.js +171 -0
  15. package/dist/dist-cjs5.js +429 -0
  16. package/dist/dist-cjs6.js +60 -0
  17. package/dist/dist-cjs7.js +978 -0
  18. package/dist/dist-cjs8.js +86 -0
  19. package/dist/dist-cjs9.js +319 -0
  20. package/dist/dist.js +498 -36
  21. package/dist/dist2.js +1239 -0
  22. package/dist/errors.d.ts +25 -0
  23. package/dist/errors.d.ts.map +1 -1
  24. package/dist/es5.js +1624 -0
  25. package/dist/esm.js +18211 -0
  26. package/dist/esm2.js +3104 -0
  27. package/dist/event-streams.js +203 -0
  28. package/dist/index.d.ts +2 -1
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js +336 -24996
  31. package/dist/jws.js +611 -0
  32. package/dist/open.js +460 -0
  33. package/dist/package.js +4 -0
  34. package/dist/protocols.js +954 -0
  35. package/dist/protocols2.js +5565 -0
  36. package/dist/rolldown-runtime.js +37 -0
  37. package/dist/serde.js +5542 -0
  38. package/dist/signin.js +723 -0
  39. package/dist/src.js +24900 -0
  40. package/dist/src2.js +114030 -0
  41. package/dist/sso-oidc.js +940 -0
  42. package/dist/sts.js +1329 -0
  43. package/dist/tslib.es6.js +543 -0
  44. package/package.json +26 -2
  45. package/src/bindings/index.ts +1 -0
  46. package/src/bindings/postgres.test.ts +17 -0
  47. package/src/bindings/postgres.ts +446 -0
  48. package/src/errors.ts +21 -0
  49. package/src/index.ts +5 -0
@@ -0,0 +1,978 @@
1
+ import { a as __toCommonJS, i as __require, n as __esmMin, r as __exportAll, t as __commonJSMin } from "./rolldown-runtime.js";
2
+ import { A as getHttpSigningPlugin, B as resolveHostHeaderConfig, E as DefaultIdentityProviderConfig, G as NODE_RETRY_MODE_CONFIG_OPTIONS, H as init_retry, I as getLoggerPlugin, J as DEFAULT_RETRY_MODE, M as getHttpAuthSchemeEndpointRuleSetPlugin, P as getRecursionDetectionPlugin, Q as emitWarningIfUnsupportedVersion, R as getHostHeaderPlugin, V as getRetryPlugin, W as NODE_MAX_ATTEMPT_CONFIG_OPTIONS, _ as resolveUserAgentConfig, a as resolveAwsRegionExtensionConfiguration, c as awsEndpointFunctions, f as createDefaultUserAgentProvider, m as getUserAgentPlugin, n as init_client, q as resolveRetryConfig, r as getAwsRegionExtensionConfiguration, t as client_exports, u as NODE_APP_ID_CONFIG_OPTIONS, w as NoAuthSigner, y as init_dist_es } from "./client.js";
3
+ import { $ as calculateBodyLength, $t as TypeRegistry, A as config_exports, Bt as emitWarningIfUnsupportedVersion$1, Dt as fromUtf8, E as BinaryDecisionDiagram, En as getSmithyContext, Et as toBase64, F as resolveRegionConfig, I as NODE_REGION_CONFIG_FILE_OPTIONS, K as loadConfig, L as NODE_REGION_CONFIG_OPTIONS, Lt as getDefaultExtensionConfiguration, Mt as init_client$1, N as resolveDefaultsModeConfig, Nt as NoOpLogger, U as NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, Ut as loadConfigsForDefaultMode, V as NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, Wt as ServiceException, Yt as Command, Zt as init_schema, _n as normalizeProvider, an as getSchemaSerdePlugin, b as customEndpointFunctions, c as Hash, d as getEndpointPlugin, f as init_endpoints, g as decideEndpoint, j as init_config$1, kt as fromBase64, ln as Client, p as resolveEndpointConfig, pn as parseUrl, qt as createAggregatedClient, r as init_serde, w as EndpointCache, wt as toUtf8, zt as resolveDefaultRuntimeConfig } from "./serde.js";
4
+ import { a as getHttpHandlerExtensionConfiguration, r as getContentLengthPlugin, s as resolveHttpHandlerRuntimeConfig, t as init_protocols } from "./protocols.js";
5
+ import { a as AwsRestJsonProtocol, c as init_httpAuthSchemes, h as NODE_AUTH_SCHEME_PREFERENCE_OPTIONS, s as httpAuthSchemes_exports, t as init_protocols$1, u as resolveAwsSdkSigV4Config, y as AwsSdkSigV4Signer } from "./protocols2.js";
6
+ import { t as require_dist_cjs$2 } from "./dist-cjs2.js";
7
+ import { t as version } from "./package.js";
8
+ //#region ../../node_modules/.pnpm/@aws-sdk+token-providers@3.1066.0/node_modules/@aws-sdk/token-providers/dist-cjs/index.js
9
+ var require_dist_cjs$1 = /* @__PURE__ */ __commonJSMin(((exports) => {
10
+ var client = (init_client(), __toCommonJS(client_exports));
11
+ var httpAuthSchemes = (init_httpAuthSchemes(), __toCommonJS(httpAuthSchemes_exports));
12
+ var config = (init_config$1(), __toCommonJS(config_exports));
13
+ var node_fs = __require("node:fs");
14
+ const fromEnvSigningName = ({ logger, signingName } = {}) => async () => {
15
+ logger?.debug?.("@aws-sdk/token-providers - fromEnvSigningName");
16
+ if (!signingName) throw new config.TokenProviderError("Please pass 'signingName' to compute environment variable key", { logger });
17
+ const bearerTokenKey = httpAuthSchemes.getBearerTokenEnvKey(signingName);
18
+ if (!(bearerTokenKey in process.env)) throw new config.TokenProviderError(`Token not present in '${bearerTokenKey}' environment variable`, { logger });
19
+ const token = { token: process.env[bearerTokenKey] };
20
+ client.setTokenFeature(token, "BEARER_SERVICE_ENV_VARS", "3");
21
+ return token;
22
+ };
23
+ const EXPIRE_WINDOW_MS = 300 * 1e3;
24
+ const REFRESH_MESSAGE = `To refresh this SSO session run 'aws sso login' with the corresponding profile.`;
25
+ const getSsoOidcClient = async (ssoRegion, init = {}, callerClientConfig) => {
26
+ const { SSOOIDCClient } = await import("./sso-oidc.js");
27
+ const coalesce = (prop) => init.clientConfig?.[prop] ?? init.parentClientConfig?.[prop] ?? callerClientConfig?.[prop];
28
+ return new SSOOIDCClient(Object.assign({}, init.clientConfig ?? {}, {
29
+ region: ssoRegion ?? init.clientConfig?.region,
30
+ logger: coalesce("logger"),
31
+ userAgentAppId: coalesce("userAgentAppId")
32
+ }));
33
+ };
34
+ const getNewSsoOidcToken = async (ssoToken, ssoRegion, init = {}, callerClientConfig) => {
35
+ const { CreateTokenCommand } = await import("./sso-oidc.js");
36
+ return (await getSsoOidcClient(ssoRegion, init, callerClientConfig)).send(new CreateTokenCommand({
37
+ clientId: ssoToken.clientId,
38
+ clientSecret: ssoToken.clientSecret,
39
+ refreshToken: ssoToken.refreshToken,
40
+ grantType: "refresh_token"
41
+ }));
42
+ };
43
+ const validateTokenExpiry = (token) => {
44
+ if (token.expiration && token.expiration.getTime() < Date.now()) throw new config.TokenProviderError(`Token is expired. ${REFRESH_MESSAGE}`, false);
45
+ };
46
+ const validateTokenKey = (key, value, forRefresh = false) => {
47
+ if (typeof value === "undefined") throw new config.TokenProviderError(`Value not present for '${key}' in SSO Token${forRefresh ? ". Cannot refresh" : ""}. ${REFRESH_MESSAGE}`, false);
48
+ };
49
+ const { writeFile } = node_fs.promises;
50
+ const writeSSOTokenToFile = (id, ssoToken) => {
51
+ return writeFile(config.getSSOTokenFilepath(id), JSON.stringify(ssoToken, null, 2));
52
+ };
53
+ const lastRefreshAttemptTime = /* @__PURE__ */ new Date(0);
54
+ const fromSso = (init = {}) => async ({ callerClientConfig } = {}) => {
55
+ init.logger?.debug("@aws-sdk/token-providers - fromSso");
56
+ const profiles = await config.parseKnownFiles(init);
57
+ const profileName = config.getProfileName({ profile: init.profile ?? callerClientConfig?.profile });
58
+ const profile = profiles[profileName];
59
+ if (!profile) throw new config.TokenProviderError(`Profile '${profileName}' could not be found in shared credentials file.`, false);
60
+ else if (!profile["sso_session"]) throw new config.TokenProviderError(`Profile '${profileName}' is missing required property 'sso_session'.`);
61
+ const ssoSessionName = profile["sso_session"];
62
+ const ssoSession = (await config.loadSsoSessionData(init))[ssoSessionName];
63
+ if (!ssoSession) throw new config.TokenProviderError(`Sso session '${ssoSessionName}' could not be found in shared credentials file.`, false);
64
+ for (const ssoSessionRequiredKey of ["sso_start_url", "sso_region"]) if (!ssoSession[ssoSessionRequiredKey]) throw new config.TokenProviderError(`Sso session '${ssoSessionName}' is missing required property '${ssoSessionRequiredKey}'.`, false);
65
+ ssoSession["sso_start_url"];
66
+ const ssoRegion = ssoSession["sso_region"];
67
+ let ssoToken;
68
+ try {
69
+ ssoToken = await config.getSSOTokenFromFile(ssoSessionName);
70
+ } catch (e) {
71
+ throw new config.TokenProviderError(`The SSO session token associated with profile=${profileName} was not found or is invalid. ${REFRESH_MESSAGE}`, false);
72
+ }
73
+ validateTokenKey("accessToken", ssoToken.accessToken);
74
+ validateTokenKey("expiresAt", ssoToken.expiresAt);
75
+ const { accessToken, expiresAt } = ssoToken;
76
+ const existingToken = {
77
+ token: accessToken,
78
+ expiration: new Date(expiresAt)
79
+ };
80
+ if (existingToken.expiration.getTime() - Date.now() > EXPIRE_WINDOW_MS) return existingToken;
81
+ if (Date.now() - lastRefreshAttemptTime.getTime() < 30 * 1e3) {
82
+ validateTokenExpiry(existingToken);
83
+ return existingToken;
84
+ }
85
+ validateTokenKey("clientId", ssoToken.clientId, true);
86
+ validateTokenKey("clientSecret", ssoToken.clientSecret, true);
87
+ validateTokenKey("refreshToken", ssoToken.refreshToken, true);
88
+ try {
89
+ lastRefreshAttemptTime.setTime(Date.now());
90
+ const newSsoOidcToken = await getNewSsoOidcToken(ssoToken, ssoRegion, init, callerClientConfig);
91
+ validateTokenKey("accessToken", newSsoOidcToken.accessToken);
92
+ validateTokenKey("expiresIn", newSsoOidcToken.expiresIn);
93
+ const newTokenExpiration = new Date(Date.now() + newSsoOidcToken.expiresIn * 1e3);
94
+ try {
95
+ await writeSSOTokenToFile(ssoSessionName, {
96
+ ...ssoToken,
97
+ accessToken: newSsoOidcToken.accessToken,
98
+ expiresAt: newTokenExpiration.toISOString(),
99
+ refreshToken: newSsoOidcToken.refreshToken
100
+ });
101
+ } catch (error) {}
102
+ return {
103
+ token: newSsoOidcToken.accessToken,
104
+ expiration: newTokenExpiration
105
+ };
106
+ } catch (error) {
107
+ validateTokenExpiry(existingToken);
108
+ return existingToken;
109
+ }
110
+ };
111
+ const fromStatic = ({ token, logger }) => async () => {
112
+ logger?.debug("@aws-sdk/token-providers - fromStatic");
113
+ if (!token || !token.token) throw new config.TokenProviderError(`Please pass a valid token to fromStatic`, false);
114
+ return token;
115
+ };
116
+ const nodeProvider = (init = {}) => config.memoize(config.chain(fromSso(init), async () => {
117
+ throw new config.TokenProviderError("Could not load token from any providers", false);
118
+ }), (token) => token.expiration !== void 0 && token.expiration.getTime() - Date.now() < 3e5, (token) => token.expiration !== void 0);
119
+ exports.fromEnvSigningName = fromEnvSigningName;
120
+ exports.fromSso = fromSso;
121
+ exports.fromStatic = fromStatic;
122
+ exports.nodeProvider = nodeProvider;
123
+ }));
124
+ //#endregion
125
+ //#region ../../node_modules/.pnpm/@aws-sdk+nested-clients@3.997.20/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso/auth/httpAuthSchemeProvider.js
126
+ function createAwsAuthSigv4HttpAuthOption(authParameters) {
127
+ return {
128
+ schemeId: "aws.auth#sigv4",
129
+ signingProperties: {
130
+ name: "awsssoportal",
131
+ region: authParameters.region
132
+ },
133
+ propertiesExtractor: (config, context) => ({ signingProperties: {
134
+ config,
135
+ context
136
+ } })
137
+ };
138
+ }
139
+ function createSmithyApiNoAuthHttpAuthOption(authParameters) {
140
+ return { schemeId: "smithy.api#noAuth" };
141
+ }
142
+ var defaultSSOHttpAuthSchemeParametersProvider, defaultSSOHttpAuthSchemeProvider, resolveHttpAuthSchemeConfig;
143
+ var init_httpAuthSchemeProvider = __esmMin((() => {
144
+ init_httpAuthSchemes();
145
+ init_client$1();
146
+ defaultSSOHttpAuthSchemeParametersProvider = async (config, context, input) => {
147
+ return {
148
+ operation: getSmithyContext(context).operation,
149
+ region: await normalizeProvider(config.region)() || (() => {
150
+ throw new Error("expected `region` to be configured for `aws.auth#sigv4`");
151
+ })()
152
+ };
153
+ };
154
+ defaultSSOHttpAuthSchemeProvider = (authParameters) => {
155
+ const options = [];
156
+ switch (authParameters.operation) {
157
+ case "GetRoleCredentials":
158
+ options.push(createSmithyApiNoAuthHttpAuthOption(authParameters));
159
+ break;
160
+ default: options.push(createAwsAuthSigv4HttpAuthOption(authParameters));
161
+ }
162
+ return options;
163
+ };
164
+ resolveHttpAuthSchemeConfig = (config) => {
165
+ const config_0 = resolveAwsSdkSigV4Config(config);
166
+ return Object.assign(config_0, { authSchemePreference: normalizeProvider(config.authSchemePreference ?? []) });
167
+ };
168
+ }));
169
+ //#endregion
170
+ //#region ../../node_modules/.pnpm/@aws-sdk+nested-clients@3.997.20/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso/endpoint/EndpointParameters.js
171
+ var resolveClientEndpointParameters, commonParams;
172
+ var init_EndpointParameters = __esmMin((() => {
173
+ resolveClientEndpointParameters = (options) => {
174
+ return Object.assign(options, {
175
+ useDualstackEndpoint: options.useDualstackEndpoint ?? false,
176
+ useFipsEndpoint: options.useFipsEndpoint ?? false,
177
+ defaultSigningName: "awsssoportal"
178
+ });
179
+ };
180
+ commonParams = {
181
+ UseFIPS: {
182
+ type: "builtInParams",
183
+ name: "useFipsEndpoint"
184
+ },
185
+ Endpoint: {
186
+ type: "builtInParams",
187
+ name: "endpoint"
188
+ },
189
+ Region: {
190
+ type: "builtInParams",
191
+ name: "region"
192
+ },
193
+ UseDualStack: {
194
+ type: "builtInParams",
195
+ name: "useDualstackEndpoint"
196
+ }
197
+ };
198
+ }));
199
+ //#endregion
200
+ //#region ../../node_modules/.pnpm/@aws-sdk+nested-clients@3.997.20/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso/endpoint/bdd.js
201
+ var k, a, b, c, d, e, f, g, h, i, j, _data, root, nodes, bdd;
202
+ var init_bdd = __esmMin((() => {
203
+ init_endpoints();
204
+ k = "ref";
205
+ a = -1, b = true, c = "isSet", d = "PartitionResult", e = "booleanEquals", f = "getAttr", g = { [k]: "Endpoint" }, h = { [k]: d }, i = {}, j = [{ [k]: "Region" }];
206
+ _data = {
207
+ conditions: [
208
+ [c, [g]],
209
+ [c, j],
210
+ [
211
+ "aws.partition",
212
+ j,
213
+ d
214
+ ],
215
+ [e, [{ [k]: "UseFIPS" }, b]],
216
+ [e, [{ [k]: "UseDualStack" }, b]],
217
+ [e, [{
218
+ fn: f,
219
+ argv: [h, "supportsDualStack"]
220
+ }, b]],
221
+ [e, [{
222
+ fn: f,
223
+ argv: [h, "supportsFIPS"]
224
+ }, b]],
225
+ ["stringEquals", [{
226
+ fn: f,
227
+ argv: [h, "name"]
228
+ }, "aws-us-gov"]]
229
+ ],
230
+ results: [
231
+ [a],
232
+ [a, "Invalid Configuration: FIPS and custom endpoint are not supported"],
233
+ [a, "Invalid Configuration: Dualstack and custom endpoint are not supported"],
234
+ [g, i],
235
+ ["https://portal.sso-fips.{Region}.{PartitionResult#dualStackDnsSuffix}", i],
236
+ [a, "FIPS and DualStack are enabled, but this partition does not support one or both"],
237
+ ["https://portal.sso.{Region}.amazonaws.com", i],
238
+ ["https://portal.sso-fips.{Region}.{PartitionResult#dnsSuffix}", i],
239
+ [a, "FIPS is enabled but this partition does not support FIPS"],
240
+ ["https://portal.sso.{Region}.{PartitionResult#dualStackDnsSuffix}", i],
241
+ [a, "DualStack is enabled but this partition does not support DualStack"],
242
+ ["https://portal.sso.{Region}.{PartitionResult#dnsSuffix}", i],
243
+ [a, "Invalid Configuration: Missing Region"]
244
+ ]
245
+ };
246
+ root = 2;
247
+ nodes = new Int32Array([
248
+ -1,
249
+ 1,
250
+ -1,
251
+ 0,
252
+ 13,
253
+ 3,
254
+ 1,
255
+ 4,
256
+ 100000012,
257
+ 2,
258
+ 5,
259
+ 100000012,
260
+ 3,
261
+ 8,
262
+ 6,
263
+ 4,
264
+ 7,
265
+ 100000011,
266
+ 5,
267
+ 100000009,
268
+ 100000010,
269
+ 4,
270
+ 11,
271
+ 9,
272
+ 6,
273
+ 10,
274
+ 100000008,
275
+ 7,
276
+ 100000006,
277
+ 100000007,
278
+ 5,
279
+ 12,
280
+ 100000005,
281
+ 6,
282
+ 100000004,
283
+ 100000005,
284
+ 3,
285
+ 100000001,
286
+ 14,
287
+ 4,
288
+ 100000002,
289
+ 100000003
290
+ ]);
291
+ bdd = BinaryDecisionDiagram.from(nodes, root, _data.conditions, _data.results);
292
+ }));
293
+ //#endregion
294
+ //#region ../../node_modules/.pnpm/@aws-sdk+nested-clients@3.997.20/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso/endpoint/endpointResolver.js
295
+ var cache, defaultEndpointResolver;
296
+ var init_endpointResolver = __esmMin((() => {
297
+ init_client();
298
+ init_endpoints();
299
+ init_bdd();
300
+ cache = new EndpointCache({
301
+ size: 50,
302
+ params: [
303
+ "Endpoint",
304
+ "Region",
305
+ "UseDualStack",
306
+ "UseFIPS"
307
+ ]
308
+ });
309
+ defaultEndpointResolver = (endpointParams, context = {}) => {
310
+ return cache.get(endpointParams, () => decideEndpoint(bdd, {
311
+ endpointParams,
312
+ logger: context.logger
313
+ }));
314
+ };
315
+ customEndpointFunctions.aws = awsEndpointFunctions;
316
+ }));
317
+ //#endregion
318
+ //#region ../../node_modules/.pnpm/@aws-sdk+nested-clients@3.997.20/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso/models/SSOServiceException.js
319
+ var SSOServiceException;
320
+ var init_SSOServiceException = __esmMin((() => {
321
+ init_client$1();
322
+ SSOServiceException = class SSOServiceException extends ServiceException {
323
+ constructor(options) {
324
+ super(options);
325
+ Object.setPrototypeOf(this, SSOServiceException.prototype);
326
+ }
327
+ };
328
+ }));
329
+ //#endregion
330
+ //#region ../../node_modules/.pnpm/@aws-sdk+nested-clients@3.997.20/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso/models/errors.js
331
+ var InvalidRequestException, ResourceNotFoundException, TooManyRequestsException, UnauthorizedException;
332
+ var init_errors = __esmMin((() => {
333
+ init_SSOServiceException();
334
+ InvalidRequestException = class InvalidRequestException extends SSOServiceException {
335
+ name = "InvalidRequestException";
336
+ $fault = "client";
337
+ constructor(opts) {
338
+ super({
339
+ name: "InvalidRequestException",
340
+ $fault: "client",
341
+ ...opts
342
+ });
343
+ Object.setPrototypeOf(this, InvalidRequestException.prototype);
344
+ }
345
+ };
346
+ ResourceNotFoundException = class ResourceNotFoundException extends SSOServiceException {
347
+ name = "ResourceNotFoundException";
348
+ $fault = "client";
349
+ constructor(opts) {
350
+ super({
351
+ name: "ResourceNotFoundException",
352
+ $fault: "client",
353
+ ...opts
354
+ });
355
+ Object.setPrototypeOf(this, ResourceNotFoundException.prototype);
356
+ }
357
+ };
358
+ TooManyRequestsException = class TooManyRequestsException extends SSOServiceException {
359
+ name = "TooManyRequestsException";
360
+ $fault = "client";
361
+ constructor(opts) {
362
+ super({
363
+ name: "TooManyRequestsException",
364
+ $fault: "client",
365
+ ...opts
366
+ });
367
+ Object.setPrototypeOf(this, TooManyRequestsException.prototype);
368
+ }
369
+ };
370
+ UnauthorizedException = class UnauthorizedException extends SSOServiceException {
371
+ name = "UnauthorizedException";
372
+ $fault = "client";
373
+ constructor(opts) {
374
+ super({
375
+ name: "UnauthorizedException",
376
+ $fault: "client",
377
+ ...opts
378
+ });
379
+ Object.setPrototypeOf(this, UnauthorizedException.prototype);
380
+ }
381
+ };
382
+ }));
383
+ //#endregion
384
+ //#region ../../node_modules/.pnpm/@aws-sdk+nested-clients@3.997.20/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso/schemas/schemas_0.js
385
+ var _ATT, _GRC, _GRCR, _GRCRe, _IRE, _RC, _RNFE, _SAKT, _STT, _TMRE, _UE, _aI, _aKI, _aT, _ai, _c, _e, _ex, _h, _hE, _hH, _hQ, _m, _rC, _rN, _rn, _s, _sAK, _sT, _xasbt, n0, _s_registry, SSOServiceException$, n0_registry, InvalidRequestException$, ResourceNotFoundException$, TooManyRequestsException$, UnauthorizedException$, errorTypeRegistries, AccessTokenType, SecretAccessKeyType, SessionTokenType, GetRoleCredentialsRequest$, GetRoleCredentialsResponse$, RoleCredentials$, GetRoleCredentials$;
386
+ var init_schemas_0 = __esmMin((() => {
387
+ init_schema();
388
+ init_errors();
389
+ init_SSOServiceException();
390
+ _ATT = "AccessTokenType";
391
+ _GRC = "GetRoleCredentials";
392
+ _GRCR = "GetRoleCredentialsRequest";
393
+ _GRCRe = "GetRoleCredentialsResponse";
394
+ _IRE = "InvalidRequestException";
395
+ _RC = "RoleCredentials";
396
+ _RNFE = "ResourceNotFoundException";
397
+ _SAKT = "SecretAccessKeyType";
398
+ _STT = "SessionTokenType";
399
+ _TMRE = "TooManyRequestsException";
400
+ _UE = "UnauthorizedException";
401
+ _aI = "accountId";
402
+ _aKI = "accessKeyId";
403
+ _aT = "accessToken";
404
+ _ai = "account_id";
405
+ _c = "client";
406
+ _e = "error";
407
+ _ex = "expiration";
408
+ _h = "http";
409
+ _hE = "httpError";
410
+ _hH = "httpHeader";
411
+ _hQ = "httpQuery";
412
+ _m = "message";
413
+ _rC = "roleCredentials";
414
+ _rN = "roleName";
415
+ _rn = "role_name";
416
+ _s = "smithy.ts.sdk.synthetic.com.amazonaws.sso";
417
+ _sAK = "secretAccessKey";
418
+ _sT = "sessionToken";
419
+ _xasbt = "x-amz-sso_bearer_token";
420
+ n0 = "com.amazonaws.sso";
421
+ _s_registry = TypeRegistry.for(_s);
422
+ SSOServiceException$ = [
423
+ -3,
424
+ _s,
425
+ "SSOServiceException",
426
+ 0,
427
+ [],
428
+ []
429
+ ];
430
+ _s_registry.registerError(SSOServiceException$, SSOServiceException);
431
+ n0_registry = TypeRegistry.for(n0);
432
+ InvalidRequestException$ = [
433
+ -3,
434
+ n0,
435
+ _IRE,
436
+ {
437
+ [_e]: _c,
438
+ [_hE]: 400
439
+ },
440
+ [_m],
441
+ [0]
442
+ ];
443
+ n0_registry.registerError(InvalidRequestException$, InvalidRequestException);
444
+ ResourceNotFoundException$ = [
445
+ -3,
446
+ n0,
447
+ _RNFE,
448
+ {
449
+ [_e]: _c,
450
+ [_hE]: 404
451
+ },
452
+ [_m],
453
+ [0]
454
+ ];
455
+ n0_registry.registerError(ResourceNotFoundException$, ResourceNotFoundException);
456
+ TooManyRequestsException$ = [
457
+ -3,
458
+ n0,
459
+ _TMRE,
460
+ {
461
+ [_e]: _c,
462
+ [_hE]: 429
463
+ },
464
+ [_m],
465
+ [0]
466
+ ];
467
+ n0_registry.registerError(TooManyRequestsException$, TooManyRequestsException);
468
+ UnauthorizedException$ = [
469
+ -3,
470
+ n0,
471
+ _UE,
472
+ {
473
+ [_e]: _c,
474
+ [_hE]: 401
475
+ },
476
+ [_m],
477
+ [0]
478
+ ];
479
+ n0_registry.registerError(UnauthorizedException$, UnauthorizedException);
480
+ errorTypeRegistries = [_s_registry, n0_registry];
481
+ AccessTokenType = [
482
+ 0,
483
+ n0,
484
+ _ATT,
485
+ 8,
486
+ 0
487
+ ];
488
+ SecretAccessKeyType = [
489
+ 0,
490
+ n0,
491
+ _SAKT,
492
+ 8,
493
+ 0
494
+ ];
495
+ SessionTokenType = [
496
+ 0,
497
+ n0,
498
+ _STT,
499
+ 8,
500
+ 0
501
+ ];
502
+ GetRoleCredentialsRequest$ = [
503
+ 3,
504
+ n0,
505
+ _GRCR,
506
+ 0,
507
+ [
508
+ _rN,
509
+ _aI,
510
+ _aT
511
+ ],
512
+ [
513
+ [0, { [_hQ]: _rn }],
514
+ [0, { [_hQ]: _ai }],
515
+ [() => AccessTokenType, { [_hH]: _xasbt }]
516
+ ],
517
+ 3
518
+ ];
519
+ GetRoleCredentialsResponse$ = [
520
+ 3,
521
+ n0,
522
+ _GRCRe,
523
+ 0,
524
+ [_rC],
525
+ [[() => RoleCredentials$, 0]]
526
+ ];
527
+ RoleCredentials$ = [
528
+ 3,
529
+ n0,
530
+ _RC,
531
+ 0,
532
+ [
533
+ _aKI,
534
+ _sAK,
535
+ _sT,
536
+ _ex
537
+ ],
538
+ [
539
+ 0,
540
+ [() => SecretAccessKeyType, 0],
541
+ [() => SessionTokenType, 0],
542
+ 1
543
+ ]
544
+ ];
545
+ GetRoleCredentials$ = [
546
+ 9,
547
+ n0,
548
+ _GRC,
549
+ { [_h]: [
550
+ "GET",
551
+ "/federation/credentials",
552
+ 200
553
+ ] },
554
+ () => GetRoleCredentialsRequest$,
555
+ () => GetRoleCredentialsResponse$
556
+ ];
557
+ }));
558
+ //#endregion
559
+ //#region ../../node_modules/.pnpm/@aws-sdk+nested-clients@3.997.20/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso/runtimeConfig.shared.js
560
+ var getRuntimeConfig$1;
561
+ var init_runtimeConfig_shared = __esmMin((() => {
562
+ init_httpAuthSchemes();
563
+ init_protocols$1();
564
+ init_dist_es();
565
+ init_client$1();
566
+ init_protocols();
567
+ init_serde();
568
+ init_httpAuthSchemeProvider();
569
+ init_endpointResolver();
570
+ init_schemas_0();
571
+ getRuntimeConfig$1 = (config) => {
572
+ return {
573
+ apiVersion: "2019-06-10",
574
+ base64Decoder: config?.base64Decoder ?? fromBase64,
575
+ base64Encoder: config?.base64Encoder ?? toBase64,
576
+ disableHostPrefix: config?.disableHostPrefix ?? false,
577
+ endpointProvider: config?.endpointProvider ?? defaultEndpointResolver,
578
+ extensions: config?.extensions ?? [],
579
+ httpAuthSchemeProvider: config?.httpAuthSchemeProvider ?? defaultSSOHttpAuthSchemeProvider,
580
+ httpAuthSchemes: config?.httpAuthSchemes ?? [{
581
+ schemeId: "aws.auth#sigv4",
582
+ identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4"),
583
+ signer: new AwsSdkSigV4Signer()
584
+ }, {
585
+ schemeId: "smithy.api#noAuth",
586
+ identityProvider: (ipc) => ipc.getIdentityProvider("smithy.api#noAuth") || (async () => ({})),
587
+ signer: new NoAuthSigner()
588
+ }],
589
+ logger: config?.logger ?? new NoOpLogger(),
590
+ protocol: config?.protocol ?? AwsRestJsonProtocol,
591
+ protocolSettings: config?.protocolSettings ?? {
592
+ defaultNamespace: "com.amazonaws.sso",
593
+ errorTypeRegistries,
594
+ version: "2019-06-10",
595
+ serviceTarget: "SWBPortalService"
596
+ },
597
+ serviceId: config?.serviceId ?? "SSO",
598
+ urlParser: config?.urlParser ?? parseUrl,
599
+ utf8Decoder: config?.utf8Decoder ?? fromUtf8,
600
+ utf8Encoder: config?.utf8Encoder ?? toUtf8
601
+ };
602
+ };
603
+ }));
604
+ //#endregion
605
+ //#region ../../node_modules/.pnpm/@aws-sdk+nested-clients@3.997.20/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso/runtimeConfig.js
606
+ var import_dist_cjs, getRuntimeConfig;
607
+ var init_runtimeConfig = __esmMin((() => {
608
+ init_client();
609
+ init_httpAuthSchemes();
610
+ init_client$1();
611
+ init_config$1();
612
+ init_retry();
613
+ init_serde();
614
+ import_dist_cjs = require_dist_cjs$2();
615
+ init_runtimeConfig_shared();
616
+ getRuntimeConfig = (config) => {
617
+ emitWarningIfUnsupportedVersion$1(process.version);
618
+ const defaultsMode = resolveDefaultsModeConfig(config);
619
+ const defaultConfigProvider = () => defaultsMode().then(loadConfigsForDefaultMode);
620
+ const clientSharedValues = getRuntimeConfig$1(config);
621
+ emitWarningIfUnsupportedVersion(process.version);
622
+ const loaderConfig = {
623
+ profile: config?.profile,
624
+ logger: clientSharedValues.logger
625
+ };
626
+ return {
627
+ ...clientSharedValues,
628
+ ...config,
629
+ runtime: "node",
630
+ defaultsMode,
631
+ authSchemePreference: config?.authSchemePreference ?? loadConfig(NODE_AUTH_SCHEME_PREFERENCE_OPTIONS, loaderConfig),
632
+ bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength,
633
+ defaultUserAgentProvider: config?.defaultUserAgentProvider ?? createDefaultUserAgentProvider({
634
+ serviceId: clientSharedValues.serviceId,
635
+ clientVersion: version
636
+ }),
637
+ maxAttempts: config?.maxAttempts ?? loadConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS, config),
638
+ region: config?.region ?? loadConfig(NODE_REGION_CONFIG_OPTIONS, {
639
+ ...NODE_REGION_CONFIG_FILE_OPTIONS,
640
+ ...loaderConfig
641
+ }),
642
+ requestHandler: import_dist_cjs.NodeHttpHandler.create(config?.requestHandler ?? defaultConfigProvider),
643
+ retryMode: config?.retryMode ?? loadConfig({
644
+ ...NODE_RETRY_MODE_CONFIG_OPTIONS,
645
+ default: async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE
646
+ }, config),
647
+ sha256: config?.sha256 ?? Hash.bind(null, "sha256"),
648
+ streamCollector: config?.streamCollector ?? import_dist_cjs.streamCollector,
649
+ useDualstackEndpoint: config?.useDualstackEndpoint ?? loadConfig(NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
650
+ useFipsEndpoint: config?.useFipsEndpoint ?? loadConfig(NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
651
+ userAgentAppId: config?.userAgentAppId ?? loadConfig(NODE_APP_ID_CONFIG_OPTIONS, loaderConfig)
652
+ };
653
+ };
654
+ }));
655
+ //#endregion
656
+ //#region ../../node_modules/.pnpm/@aws-sdk+nested-clients@3.997.20/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso/auth/httpAuthExtensionConfiguration.js
657
+ var getHttpAuthExtensionConfiguration, resolveHttpAuthRuntimeConfig;
658
+ var init_httpAuthExtensionConfiguration = __esmMin((() => {
659
+ getHttpAuthExtensionConfiguration = (runtimeConfig) => {
660
+ const _httpAuthSchemes = runtimeConfig.httpAuthSchemes;
661
+ let _httpAuthSchemeProvider = runtimeConfig.httpAuthSchemeProvider;
662
+ let _credentials = runtimeConfig.credentials;
663
+ return {
664
+ setHttpAuthScheme(httpAuthScheme) {
665
+ const index = _httpAuthSchemes.findIndex((scheme) => scheme.schemeId === httpAuthScheme.schemeId);
666
+ if (index === -1) _httpAuthSchemes.push(httpAuthScheme);
667
+ else _httpAuthSchemes.splice(index, 1, httpAuthScheme);
668
+ },
669
+ httpAuthSchemes() {
670
+ return _httpAuthSchemes;
671
+ },
672
+ setHttpAuthSchemeProvider(httpAuthSchemeProvider) {
673
+ _httpAuthSchemeProvider = httpAuthSchemeProvider;
674
+ },
675
+ httpAuthSchemeProvider() {
676
+ return _httpAuthSchemeProvider;
677
+ },
678
+ setCredentials(credentials) {
679
+ _credentials = credentials;
680
+ },
681
+ credentials() {
682
+ return _credentials;
683
+ }
684
+ };
685
+ };
686
+ resolveHttpAuthRuntimeConfig = (config) => {
687
+ return {
688
+ httpAuthSchemes: config.httpAuthSchemes(),
689
+ httpAuthSchemeProvider: config.httpAuthSchemeProvider(),
690
+ credentials: config.credentials()
691
+ };
692
+ };
693
+ }));
694
+ //#endregion
695
+ //#region ../../node_modules/.pnpm/@aws-sdk+nested-clients@3.997.20/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso/runtimeExtensions.js
696
+ var resolveRuntimeExtensions;
697
+ var init_runtimeExtensions = __esmMin((() => {
698
+ init_client();
699
+ init_client$1();
700
+ init_protocols();
701
+ init_httpAuthExtensionConfiguration();
702
+ resolveRuntimeExtensions = (runtimeConfig, extensions) => {
703
+ const extensionConfiguration = Object.assign(getAwsRegionExtensionConfiguration(runtimeConfig), getDefaultExtensionConfiguration(runtimeConfig), getHttpHandlerExtensionConfiguration(runtimeConfig), getHttpAuthExtensionConfiguration(runtimeConfig));
704
+ extensions.forEach((extension) => extension.configure(extensionConfiguration));
705
+ return Object.assign(runtimeConfig, resolveAwsRegionExtensionConfiguration(extensionConfiguration), resolveDefaultRuntimeConfig(extensionConfiguration), resolveHttpHandlerRuntimeConfig(extensionConfiguration), resolveHttpAuthRuntimeConfig(extensionConfiguration));
706
+ };
707
+ }));
708
+ //#endregion
709
+ //#region ../../node_modules/.pnpm/@aws-sdk+nested-clients@3.997.20/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso/SSOClient.js
710
+ var SSOClient;
711
+ var init_SSOClient = __esmMin((() => {
712
+ init_client();
713
+ init_dist_es();
714
+ init_client$1();
715
+ init_config$1();
716
+ init_endpoints();
717
+ init_protocols();
718
+ init_retry();
719
+ init_schema();
720
+ init_httpAuthSchemeProvider();
721
+ init_EndpointParameters();
722
+ init_runtimeConfig();
723
+ init_runtimeExtensions();
724
+ SSOClient = class extends Client {
725
+ config;
726
+ constructor(...[configuration]) {
727
+ const _config_0 = getRuntimeConfig(configuration || {});
728
+ super(_config_0);
729
+ this.initConfig = _config_0;
730
+ const _config_8 = resolveRuntimeExtensions(resolveHttpAuthSchemeConfig(resolveEndpointConfig(resolveHostHeaderConfig(resolveRegionConfig(resolveRetryConfig(resolveUserAgentConfig(resolveClientEndpointParameters(_config_0))))))), configuration?.extensions || []);
731
+ this.config = _config_8;
732
+ this.middlewareStack.use(getSchemaSerdePlugin(this.config));
733
+ this.middlewareStack.use(getUserAgentPlugin(this.config));
734
+ this.middlewareStack.use(getRetryPlugin(this.config));
735
+ this.middlewareStack.use(getContentLengthPlugin(this.config));
736
+ this.middlewareStack.use(getHostHeaderPlugin(this.config));
737
+ this.middlewareStack.use(getLoggerPlugin(this.config));
738
+ this.middlewareStack.use(getRecursionDetectionPlugin(this.config));
739
+ this.middlewareStack.use(getHttpAuthSchemeEndpointRuleSetPlugin(this.config, {
740
+ httpAuthSchemeParametersProvider: defaultSSOHttpAuthSchemeParametersProvider,
741
+ identityProviderConfigProvider: async (config) => new DefaultIdentityProviderConfig({ "aws.auth#sigv4": config.credentials })
742
+ }));
743
+ this.middlewareStack.use(getHttpSigningPlugin(this.config));
744
+ }
745
+ destroy() {
746
+ super.destroy();
747
+ }
748
+ };
749
+ }));
750
+ //#endregion
751
+ //#region ../../node_modules/.pnpm/@aws-sdk+nested-clients@3.997.20/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso/commands/GetRoleCredentialsCommand.js
752
+ var GetRoleCredentialsCommand;
753
+ var init_GetRoleCredentialsCommand = __esmMin((() => {
754
+ init_client$1();
755
+ init_endpoints();
756
+ init_EndpointParameters();
757
+ init_schemas_0();
758
+ GetRoleCredentialsCommand = class extends Command.classBuilder().ep(commonParams).m(function(Command, cs, config, o) {
759
+ return [getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
760
+ }).s("SWBPortalService", "GetRoleCredentials", {}).n("SSOClient", "GetRoleCredentialsCommand").sc(GetRoleCredentials$).build() {};
761
+ }));
762
+ //#endregion
763
+ //#region ../../node_modules/.pnpm/@aws-sdk+nested-clients@3.997.20/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso/SSO.js
764
+ var commands, SSO;
765
+ var init_SSO = __esmMin((() => {
766
+ init_client$1();
767
+ init_GetRoleCredentialsCommand();
768
+ init_SSOClient();
769
+ commands = { GetRoleCredentialsCommand };
770
+ SSO = class extends SSOClient {};
771
+ createAggregatedClient(commands, SSO);
772
+ }));
773
+ //#endregion
774
+ //#region ../../node_modules/.pnpm/@aws-sdk+nested-clients@3.997.20/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso/commands/index.js
775
+ var init_commands = __esmMin((() => {
776
+ init_GetRoleCredentialsCommand();
777
+ }));
778
+ //#endregion
779
+ //#region ../../node_modules/.pnpm/@aws-sdk+nested-clients@3.997.20/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso/models/models_0.js
780
+ var init_models_0 = __esmMin((() => {}));
781
+ //#endregion
782
+ //#region ../../node_modules/.pnpm/@aws-sdk+nested-clients@3.997.20/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso/index.js
783
+ var sso_exports = /* @__PURE__ */ __exportAll({
784
+ $Command: () => Command,
785
+ GetRoleCredentials$: () => GetRoleCredentials$,
786
+ GetRoleCredentialsCommand: () => GetRoleCredentialsCommand,
787
+ GetRoleCredentialsRequest$: () => GetRoleCredentialsRequest$,
788
+ GetRoleCredentialsResponse$: () => GetRoleCredentialsResponse$,
789
+ InvalidRequestException: () => InvalidRequestException,
790
+ InvalidRequestException$: () => InvalidRequestException$,
791
+ ResourceNotFoundException: () => ResourceNotFoundException,
792
+ ResourceNotFoundException$: () => ResourceNotFoundException$,
793
+ RoleCredentials$: () => RoleCredentials$,
794
+ SSO: () => SSO,
795
+ SSOClient: () => SSOClient,
796
+ SSOServiceException: () => SSOServiceException,
797
+ SSOServiceException$: () => SSOServiceException$,
798
+ TooManyRequestsException: () => TooManyRequestsException,
799
+ TooManyRequestsException$: () => TooManyRequestsException$,
800
+ UnauthorizedException: () => UnauthorizedException,
801
+ UnauthorizedException$: () => UnauthorizedException$,
802
+ __Client: () => Client,
803
+ errorTypeRegistries: () => errorTypeRegistries
804
+ });
805
+ var init_sso = __esmMin((() => {
806
+ init_SSOClient();
807
+ init_SSO();
808
+ init_commands();
809
+ init_schemas_0();
810
+ init_errors();
811
+ init_models_0();
812
+ init_SSOServiceException();
813
+ }));
814
+ //#endregion
815
+ //#region ../../node_modules/.pnpm/@aws-sdk+credential-provider-sso@3.972.52/node_modules/@aws-sdk/credential-provider-sso/dist-cjs/loadSso-BKDNrsal.js
816
+ var require_loadSso_BKDNrsal = /* @__PURE__ */ __commonJSMin(((exports) => {
817
+ var sso = (init_sso(), __toCommonJS(sso_exports));
818
+ exports.GetRoleCredentialsCommand = sso.GetRoleCredentialsCommand;
819
+ exports.SSOClient = sso.SSOClient;
820
+ }));
821
+ //#endregion
822
+ //#region ../../node_modules/.pnpm/@aws-sdk+credential-provider-sso@3.972.52/node_modules/@aws-sdk/credential-provider-sso/dist-cjs/index.js
823
+ var require_dist_cjs = /* @__PURE__ */ __commonJSMin(((exports) => {
824
+ var config = (init_config$1(), __toCommonJS(config_exports));
825
+ var client = (init_client(), __toCommonJS(client_exports));
826
+ var tokenProviders = require_dist_cjs$1();
827
+ const isSsoProfile = (arg) => 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");
828
+ const SHOULD_FAIL_CREDENTIAL_CHAIN = false;
829
+ const resolveSSOCredentials = async ({ ssoStartUrl, ssoSession, ssoAccountId, ssoRegion, ssoRoleName, ssoClient, clientConfig, parentClientConfig, callerClientConfig, profile, filepath, configFilepath, ignoreCache, logger }) => {
830
+ let token;
831
+ const refreshMessage = `To refresh this SSO session run aws sso login with the corresponding profile.`;
832
+ if (ssoSession) try {
833
+ const _token = await tokenProviders.fromSso({
834
+ profile,
835
+ filepath,
836
+ configFilepath,
837
+ ignoreCache,
838
+ clientConfig,
839
+ parentClientConfig,
840
+ logger
841
+ })({ callerClientConfig });
842
+ token = {
843
+ accessToken: _token.token,
844
+ expiresAt: new Date(_token.expiration).toISOString()
845
+ };
846
+ } catch (e) {
847
+ throw new config.CredentialsProviderError(e.message, {
848
+ tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
849
+ logger
850
+ });
851
+ }
852
+ else try {
853
+ token = await config.getSSOTokenFromFile(ssoStartUrl);
854
+ } catch (e) {
855
+ throw new config.CredentialsProviderError(`The SSO session associated with this profile is invalid. ${refreshMessage}`, {
856
+ tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
857
+ logger
858
+ });
859
+ }
860
+ if (new Date(token.expiresAt).getTime() - Date.now() <= 0) throw new config.CredentialsProviderError(`The SSO session associated with this profile has expired. ${refreshMessage}`, {
861
+ tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
862
+ logger
863
+ });
864
+ const { accessToken } = token;
865
+ const { SSOClient, GetRoleCredentialsCommand } = await Promise.resolve().then(function() {
866
+ return require_loadSso_BKDNrsal();
867
+ });
868
+ const sso = ssoClient || new SSOClient(Object.assign({}, clientConfig ?? {}, {
869
+ logger: clientConfig?.logger ?? callerClientConfig?.logger ?? parentClientConfig?.logger,
870
+ region: clientConfig?.region ?? ssoRegion,
871
+ userAgentAppId: clientConfig?.userAgentAppId ?? callerClientConfig?.userAgentAppId ?? parentClientConfig?.userAgentAppId
872
+ }));
873
+ let ssoResp;
874
+ try {
875
+ ssoResp = await sso.send(new GetRoleCredentialsCommand({
876
+ accountId: ssoAccountId,
877
+ roleName: ssoRoleName,
878
+ accessToken
879
+ }));
880
+ } catch (e) {
881
+ throw new config.CredentialsProviderError(e, {
882
+ tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
883
+ logger
884
+ });
885
+ }
886
+ const { roleCredentials: { accessKeyId, secretAccessKey, sessionToken, expiration, credentialScope, accountId } = {} } = ssoResp;
887
+ if (!accessKeyId || !secretAccessKey || !sessionToken || !expiration) throw new config.CredentialsProviderError("SSO returns an invalid temporary credential.", {
888
+ tryNextLink: SHOULD_FAIL_CREDENTIAL_CHAIN,
889
+ logger
890
+ });
891
+ const credentials = {
892
+ accessKeyId,
893
+ secretAccessKey,
894
+ sessionToken,
895
+ expiration: new Date(expiration),
896
+ ...credentialScope && { credentialScope },
897
+ ...accountId && { accountId }
898
+ };
899
+ if (ssoSession) client.setCredentialFeature(credentials, "CREDENTIALS_SSO", "s");
900
+ else client.setCredentialFeature(credentials, "CREDENTIALS_SSO_LEGACY", "u");
901
+ return credentials;
902
+ };
903
+ const validateSsoProfile = (profile, logger) => {
904
+ const { sso_start_url, sso_account_id, sso_region, sso_role_name } = profile;
905
+ if (!sso_start_url || !sso_account_id || !sso_region || !sso_role_name) throw new config.CredentialsProviderError(`Profile is configured with invalid SSO credentials. Required parameters "sso_account_id", "sso_region", "sso_role_name", "sso_start_url". Got ${Object.keys(profile).join(", ")}\nReference: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html`, {
906
+ tryNextLink: false,
907
+ logger
908
+ });
909
+ return profile;
910
+ };
911
+ const fromSSO = (init = {}) => async ({ callerClientConfig } = {}) => {
912
+ init.logger?.debug("@aws-sdk/credential-provider-sso - fromSSO");
913
+ const { ssoStartUrl, ssoAccountId, ssoRegion, ssoRoleName, ssoSession } = init;
914
+ const { ssoClient } = init;
915
+ const profileName = config.getProfileName({ profile: init.profile ?? callerClientConfig?.profile });
916
+ if (!ssoStartUrl && !ssoAccountId && !ssoRegion && !ssoRoleName && !ssoSession) {
917
+ const profile = (await config.parseKnownFiles(init))[profileName];
918
+ if (!profile) throw new config.CredentialsProviderError(`Profile ${profileName} was not found.`, { logger: init.logger });
919
+ if (!isSsoProfile(profile)) throw new config.CredentialsProviderError(`Profile ${profileName} is not configured with SSO credentials.`, { logger: init.logger });
920
+ if (profile?.sso_session) {
921
+ const session = (await config.loadSsoSessionData(init))[profile.sso_session];
922
+ const conflictMsg = ` configurations in profile ${profileName} and sso-session ${profile.sso_session}`;
923
+ if (ssoRegion && ssoRegion !== session.sso_region) throw new config.CredentialsProviderError(`Conflicting SSO region` + conflictMsg, {
924
+ tryNextLink: false,
925
+ logger: init.logger
926
+ });
927
+ if (ssoStartUrl && ssoStartUrl !== session.sso_start_url) throw new config.CredentialsProviderError(`Conflicting SSO start_url` + conflictMsg, {
928
+ tryNextLink: false,
929
+ logger: init.logger
930
+ });
931
+ profile.sso_region = session.sso_region;
932
+ profile.sso_start_url = session.sso_start_url;
933
+ }
934
+ const { sso_start_url, sso_account_id, sso_region, sso_role_name, sso_session } = validateSsoProfile(profile, init.logger);
935
+ return resolveSSOCredentials({
936
+ ssoStartUrl: sso_start_url,
937
+ ssoSession: sso_session,
938
+ ssoAccountId: sso_account_id,
939
+ ssoRegion: sso_region,
940
+ ssoRoleName: sso_role_name,
941
+ ssoClient,
942
+ clientConfig: init.clientConfig,
943
+ parentClientConfig: init.parentClientConfig,
944
+ callerClientConfig: init.callerClientConfig,
945
+ profile: profileName,
946
+ filepath: init.filepath,
947
+ configFilepath: init.configFilepath,
948
+ ignoreCache: init.ignoreCache,
949
+ logger: init.logger
950
+ });
951
+ } else if (!ssoStartUrl || !ssoAccountId || !ssoRegion || !ssoRoleName) throw new config.CredentialsProviderError("Incomplete configuration. The fromSSO() argument hash must include \"ssoStartUrl\", \"ssoAccountId\", \"ssoRegion\", \"ssoRoleName\"", {
952
+ tryNextLink: false,
953
+ logger: init.logger
954
+ });
955
+ else return resolveSSOCredentials({
956
+ ssoStartUrl,
957
+ ssoSession,
958
+ ssoAccountId,
959
+ ssoRegion,
960
+ ssoRoleName,
961
+ ssoClient,
962
+ clientConfig: init.clientConfig,
963
+ parentClientConfig: init.parentClientConfig,
964
+ callerClientConfig: init.callerClientConfig,
965
+ profile: profileName,
966
+ filepath: init.filepath,
967
+ configFilepath: init.configFilepath,
968
+ ignoreCache: init.ignoreCache,
969
+ logger: init.logger
970
+ });
971
+ };
972
+ exports.fromSSO = fromSSO;
973
+ exports.isSsoProfile = isSsoProfile;
974
+ exports.validateSsoProfile = validateSsoProfile;
975
+ }));
976
+ //#endregion
977
+ export default require_dist_cjs();
978
+ export {};