@aws-sdk/token-providers 3.379.1 → 3.385.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,709 @@
1
+ import { getHostHeaderPlugin, resolveHostHeaderConfig } from "@aws-sdk/middleware-host-header";
2
+ import { getLoggerPlugin } from "@aws-sdk/middleware-logger";
3
+ import { getRecursionDetectionPlugin } from "@aws-sdk/middleware-recursion-detection";
4
+ import { getUserAgentPlugin, resolveUserAgentConfig } from "@aws-sdk/middleware-user-agent";
5
+ import { resolveRegionConfig } from "@smithy/config-resolver";
6
+ import { getContentLengthPlugin } from "@smithy/middleware-content-length";
7
+ import { resolveEndpointConfig } from "@smithy/middleware-endpoint";
8
+ import { getRetryPlugin, resolveRetryConfig } from "@smithy/middleware-retry";
9
+ import { Client as __Client } from "@smithy/smithy-client";
10
+ var resolveClientEndpointParameters = (options) => {
11
+ return {
12
+ ...options,
13
+ useDualstackEndpoint: options.useDualstackEndpoint ?? false,
14
+ useFipsEndpoint: options.useFipsEndpoint ?? false,
15
+ defaultSigningName: "awsssooidc"
16
+ };
17
+ };
18
+ var package_default = {
19
+ name: "@aws-sdk/client-sso-oidc",
20
+ description: "AWS SDK for JavaScript Sso Oidc Client for Node.js, Browser and React Native",
21
+ version: "3.382.0",
22
+ scripts: {
23
+ build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
24
+ "build:cjs": "tsc -p tsconfig.cjs.json",
25
+ "build:docs": "typedoc",
26
+ "build:es": "tsc -p tsconfig.es.json",
27
+ "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build",
28
+ "build:types": "tsc -p tsconfig.types.json",
29
+ "build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4",
30
+ clean: "rimraf ./dist-* && rimraf *.tsbuildinfo",
31
+ "extract:docs": "api-extractor run --local",
32
+ "generate:client": "node ../../scripts/generate-clients/single-service --solo sso-oidc"
33
+ },
34
+ main: "./dist-cjs/index.js",
35
+ types: "./dist-types/index.d.ts",
36
+ module: "./dist-es/index.js",
37
+ sideEffects: false,
38
+ dependencies: {
39
+ "@aws-crypto/sha256-browser": "3.0.0",
40
+ "@aws-crypto/sha256-js": "3.0.0",
41
+ "@aws-sdk/middleware-host-header": "*",
42
+ "@aws-sdk/middleware-logger": "*",
43
+ "@aws-sdk/middleware-recursion-detection": "*",
44
+ "@aws-sdk/middleware-user-agent": "*",
45
+ "@aws-sdk/types": "*",
46
+ "@aws-sdk/util-endpoints": "*",
47
+ "@aws-sdk/util-user-agent-browser": "*",
48
+ "@aws-sdk/util-user-agent-node": "*",
49
+ "@smithy/config-resolver": "^2.0.1",
50
+ "@smithy/fetch-http-handler": "^2.0.1",
51
+ "@smithy/hash-node": "^2.0.1",
52
+ "@smithy/invalid-dependency": "^2.0.1",
53
+ "@smithy/middleware-content-length": "^2.0.1",
54
+ "@smithy/middleware-endpoint": "^2.0.1",
55
+ "@smithy/middleware-retry": "^2.0.1",
56
+ "@smithy/middleware-serde": "^2.0.1",
57
+ "@smithy/middleware-stack": "^2.0.0",
58
+ "@smithy/node-config-provider": "^2.0.1",
59
+ "@smithy/node-http-handler": "^2.0.1",
60
+ "@smithy/protocol-http": "^2.0.1",
61
+ "@smithy/smithy-client": "^2.0.1",
62
+ "@smithy/types": "^2.0.2",
63
+ "@smithy/url-parser": "^2.0.1",
64
+ "@smithy/util-base64": "^2.0.0",
65
+ "@smithy/util-body-length-browser": "^2.0.0",
66
+ "@smithy/util-body-length-node": "^2.0.0",
67
+ "@smithy/util-defaults-mode-browser": "^2.0.1",
68
+ "@smithy/util-defaults-mode-node": "^2.0.1",
69
+ "@smithy/util-retry": "^2.0.0",
70
+ "@smithy/util-utf8": "^2.0.0",
71
+ tslib: "^2.5.0"
72
+ },
73
+ devDependencies: {
74
+ "@smithy/service-client-documentation-generator": "^2.0.0",
75
+ "@tsconfig/node14": "1.0.3",
76
+ "@types/node": "^14.14.31",
77
+ concurrently: "7.0.0",
78
+ "downlevel-dts": "0.10.1",
79
+ rimraf: "3.0.2",
80
+ typedoc: "0.23.23",
81
+ typescript: "~4.9.5"
82
+ },
83
+ engines: {
84
+ node: ">=14.0.0"
85
+ },
86
+ typesVersions: {
87
+ "<4.0": {
88
+ "dist-types/*": [
89
+ "dist-types/ts3.4/*"
90
+ ]
91
+ }
92
+ },
93
+ files: [
94
+ "dist-*/**"
95
+ ],
96
+ author: {
97
+ name: "AWS SDK for JavaScript Team",
98
+ url: "https://aws.amazon.com/javascript/"
99
+ },
100
+ license: "Apache-2.0",
101
+ browser: {
102
+ "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.browser"
103
+ },
104
+ "react-native": {
105
+ "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.native"
106
+ },
107
+ homepage: "https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-sso-oidc",
108
+ repository: {
109
+ type: "git",
110
+ url: "https://github.com/aws/aws-sdk-js-v3.git",
111
+ directory: "clients/client-sso-oidc"
112
+ }
113
+ };
114
+ import { Sha256 } from "@aws-crypto/sha256-browser";
115
+ import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser";
116
+ import { DEFAULT_USE_DUALSTACK_ENDPOINT, DEFAULT_USE_FIPS_ENDPOINT } from "@smithy/config-resolver";
117
+ import { FetchHttpHandler as RequestHandler, streamCollector } from "@smithy/fetch-http-handler";
118
+ import { invalidProvider } from "@smithy/invalid-dependency";
119
+ import { calculateBodyLength } from "@smithy/util-body-length-browser";
120
+ import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@smithy/util-retry";
121
+ import { NoOpLogger } from "@smithy/smithy-client";
122
+ import { parseUrl } from "@smithy/url-parser";
123
+ import { fromBase64, toBase64 } from "@smithy/util-base64";
124
+ import { fromUtf8, toUtf8 } from "@smithy/util-utf8";
125
+ import { resolveEndpoint } from "@aws-sdk/util-endpoints";
126
+ var p = "required";
127
+ var q = "fn";
128
+ var r = "argv";
129
+ var s = "ref";
130
+ var a = "PartitionResult";
131
+ var b = "tree";
132
+ var c = "error";
133
+ var d = "endpoint";
134
+ var e = { [p]: false, "type": "String" };
135
+ var f = { [p]: true, "default": false, "type": "Boolean" };
136
+ var g = { [s]: "Endpoint" };
137
+ var h = { [q]: "booleanEquals", [r]: [{ [s]: "UseFIPS" }, true] };
138
+ var i = { [q]: "booleanEquals", [r]: [{ [s]: "UseDualStack" }, true] };
139
+ var j = {};
140
+ var k = { [q]: "booleanEquals", [r]: [true, { [q]: "getAttr", [r]: [{ [s]: a }, "supportsFIPS"] }] };
141
+ var l = { [q]: "booleanEquals", [r]: [true, { [q]: "getAttr", [r]: [{ [s]: a }, "supportsDualStack"] }] };
142
+ var m = [g];
143
+ var n = [h];
144
+ var o = [i];
145
+ var _data = { version: "1.0", parameters: { Region: e, UseDualStack: f, UseFIPS: f, Endpoint: e }, rules: [{ conditions: [{ [q]: "aws.partition", [r]: [{ [s]: "Region" }], assign: a }], type: b, rules: [{ conditions: [{ [q]: "isSet", [r]: m }, { [q]: "parseURL", [r]: m, assign: "url" }], type: b, rules: [{ conditions: n, error: "Invalid Configuration: FIPS and custom endpoint are not supported", type: c }, { type: b, rules: [{ conditions: o, error: "Invalid Configuration: Dualstack and custom endpoint are not supported", type: c }, { endpoint: { url: g, properties: j, headers: j }, type: d }] }] }, { conditions: [h, i], type: b, rules: [{ conditions: [k, l], type: b, rules: [{ endpoint: { url: "https://oidc-fips.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: j, headers: j }, type: d }] }, { error: "FIPS and DualStack are enabled, but this partition does not support one or both", type: c }] }, { conditions: n, type: b, rules: [{ conditions: [k], type: b, rules: [{ type: b, rules: [{ endpoint: { url: "https://oidc-fips.{Region}.{PartitionResult#dnsSuffix}", properties: j, headers: j }, type: d }] }] }, { error: "FIPS is enabled but this partition does not support FIPS", type: c }] }, { conditions: o, type: b, rules: [{ conditions: [l], type: b, rules: [{ endpoint: { url: "https://oidc.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: j, headers: j }, type: d }] }, { error: "DualStack is enabled but this partition does not support DualStack", type: c }] }, { endpoint: { url: "https://oidc.{Region}.{PartitionResult#dnsSuffix}", properties: j, headers: j }, type: d }] }] };
146
+ var ruleSet = _data;
147
+ var defaultEndpointResolver = (endpointParams, context = {}) => {
148
+ return resolveEndpoint(ruleSet, {
149
+ endpointParams,
150
+ logger: context.logger
151
+ });
152
+ };
153
+ var getRuntimeConfig = (config) => ({
154
+ apiVersion: "2019-06-10",
155
+ base64Decoder: config?.base64Decoder ?? fromBase64,
156
+ base64Encoder: config?.base64Encoder ?? toBase64,
157
+ disableHostPrefix: config?.disableHostPrefix ?? false,
158
+ endpointProvider: config?.endpointProvider ?? defaultEndpointResolver,
159
+ logger: config?.logger ?? new NoOpLogger(),
160
+ serviceId: config?.serviceId ?? "SSO OIDC",
161
+ urlParser: config?.urlParser ?? parseUrl,
162
+ utf8Decoder: config?.utf8Decoder ?? fromUtf8,
163
+ utf8Encoder: config?.utf8Encoder ?? toUtf8
164
+ });
165
+ import { loadConfigsForDefaultMode } from "@smithy/smithy-client";
166
+ import { resolveDefaultsModeConfig } from "@smithy/util-defaults-mode-browser";
167
+ var getRuntimeConfig2 = (config) => {
168
+ const defaultsMode = resolveDefaultsModeConfig(config);
169
+ const defaultConfigProvider = () => defaultsMode().then(loadConfigsForDefaultMode);
170
+ const clientSharedValues = getRuntimeConfig(config);
171
+ return {
172
+ ...clientSharedValues,
173
+ ...config,
174
+ runtime: "browser",
175
+ defaultsMode,
176
+ bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength,
177
+ defaultUserAgentProvider: config?.defaultUserAgentProvider ?? defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: package_default.version }),
178
+ maxAttempts: config?.maxAttempts ?? DEFAULT_MAX_ATTEMPTS,
179
+ region: config?.region ?? invalidProvider("Region is missing"),
180
+ requestHandler: config?.requestHandler ?? new RequestHandler(defaultConfigProvider),
181
+ retryMode: config?.retryMode ?? (async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE),
182
+ sha256: config?.sha256 ?? Sha256,
183
+ streamCollector: config?.streamCollector ?? streamCollector,
184
+ useDualstackEndpoint: config?.useDualstackEndpoint ?? (() => Promise.resolve(DEFAULT_USE_DUALSTACK_ENDPOINT)),
185
+ useFipsEndpoint: config?.useFipsEndpoint ?? (() => Promise.resolve(DEFAULT_USE_FIPS_ENDPOINT))
186
+ };
187
+ };
188
+ var SSOOIDCClient = class extends __Client {
189
+ constructor(configuration) {
190
+ const _config_0 = getRuntimeConfig2(configuration);
191
+ const _config_1 = resolveClientEndpointParameters(_config_0);
192
+ const _config_2 = resolveRegionConfig(_config_1);
193
+ const _config_3 = resolveEndpointConfig(_config_2);
194
+ const _config_4 = resolveRetryConfig(_config_3);
195
+ const _config_5 = resolveHostHeaderConfig(_config_4);
196
+ const _config_6 = resolveUserAgentConfig(_config_5);
197
+ super(_config_6);
198
+ this.config = _config_6;
199
+ this.middlewareStack.use(getRetryPlugin(this.config));
200
+ this.middlewareStack.use(getContentLengthPlugin(this.config));
201
+ this.middlewareStack.use(getHostHeaderPlugin(this.config));
202
+ this.middlewareStack.use(getLoggerPlugin(this.config));
203
+ this.middlewareStack.use(getRecursionDetectionPlugin(this.config));
204
+ this.middlewareStack.use(getUserAgentPlugin(this.config));
205
+ }
206
+ destroy() {
207
+ super.destroy();
208
+ }
209
+ };
210
+ import { getEndpointPlugin } from "@smithy/middleware-endpoint";
211
+ import { getSerdePlugin } from "@smithy/middleware-serde";
212
+ import { Command as $Command } from "@smithy/smithy-client";
213
+ import { HttpRequest as __HttpRequest } from "@smithy/protocol-http";
214
+ import { _json, collectBody, decorateServiceException as __decorateServiceException, expectInt32 as __expectInt32, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, map, take, withBaseException } from "@smithy/smithy-client";
215
+ import { ServiceException as __ServiceException } from "@smithy/smithy-client";
216
+ var SSOOIDCServiceException = class _SSOOIDCServiceException extends __ServiceException {
217
+ constructor(options) {
218
+ super(options);
219
+ Object.setPrototypeOf(this, _SSOOIDCServiceException.prototype);
220
+ }
221
+ };
222
+ var AccessDeniedException = class _AccessDeniedException extends SSOOIDCServiceException {
223
+ constructor(opts) {
224
+ super({
225
+ name: "AccessDeniedException",
226
+ $fault: "client",
227
+ ...opts
228
+ });
229
+ this.name = "AccessDeniedException";
230
+ this.$fault = "client";
231
+ Object.setPrototypeOf(this, _AccessDeniedException.prototype);
232
+ this.error = opts.error;
233
+ this.error_description = opts.error_description;
234
+ }
235
+ };
236
+ var AuthorizationPendingException = class _AuthorizationPendingException extends SSOOIDCServiceException {
237
+ constructor(opts) {
238
+ super({
239
+ name: "AuthorizationPendingException",
240
+ $fault: "client",
241
+ ...opts
242
+ });
243
+ this.name = "AuthorizationPendingException";
244
+ this.$fault = "client";
245
+ Object.setPrototypeOf(this, _AuthorizationPendingException.prototype);
246
+ this.error = opts.error;
247
+ this.error_description = opts.error_description;
248
+ }
249
+ };
250
+ var ExpiredTokenException = class _ExpiredTokenException extends SSOOIDCServiceException {
251
+ constructor(opts) {
252
+ super({
253
+ name: "ExpiredTokenException",
254
+ $fault: "client",
255
+ ...opts
256
+ });
257
+ this.name = "ExpiredTokenException";
258
+ this.$fault = "client";
259
+ Object.setPrototypeOf(this, _ExpiredTokenException.prototype);
260
+ this.error = opts.error;
261
+ this.error_description = opts.error_description;
262
+ }
263
+ };
264
+ var InternalServerException = class _InternalServerException extends SSOOIDCServiceException {
265
+ constructor(opts) {
266
+ super({
267
+ name: "InternalServerException",
268
+ $fault: "server",
269
+ ...opts
270
+ });
271
+ this.name = "InternalServerException";
272
+ this.$fault = "server";
273
+ Object.setPrototypeOf(this, _InternalServerException.prototype);
274
+ this.error = opts.error;
275
+ this.error_description = opts.error_description;
276
+ }
277
+ };
278
+ var InvalidClientException = class _InvalidClientException extends SSOOIDCServiceException {
279
+ constructor(opts) {
280
+ super({
281
+ name: "InvalidClientException",
282
+ $fault: "client",
283
+ ...opts
284
+ });
285
+ this.name = "InvalidClientException";
286
+ this.$fault = "client";
287
+ Object.setPrototypeOf(this, _InvalidClientException.prototype);
288
+ this.error = opts.error;
289
+ this.error_description = opts.error_description;
290
+ }
291
+ };
292
+ var InvalidGrantException = class _InvalidGrantException extends SSOOIDCServiceException {
293
+ constructor(opts) {
294
+ super({
295
+ name: "InvalidGrantException",
296
+ $fault: "client",
297
+ ...opts
298
+ });
299
+ this.name = "InvalidGrantException";
300
+ this.$fault = "client";
301
+ Object.setPrototypeOf(this, _InvalidGrantException.prototype);
302
+ this.error = opts.error;
303
+ this.error_description = opts.error_description;
304
+ }
305
+ };
306
+ var InvalidRequestException = class _InvalidRequestException extends SSOOIDCServiceException {
307
+ constructor(opts) {
308
+ super({
309
+ name: "InvalidRequestException",
310
+ $fault: "client",
311
+ ...opts
312
+ });
313
+ this.name = "InvalidRequestException";
314
+ this.$fault = "client";
315
+ Object.setPrototypeOf(this, _InvalidRequestException.prototype);
316
+ this.error = opts.error;
317
+ this.error_description = opts.error_description;
318
+ }
319
+ };
320
+ var InvalidScopeException = class _InvalidScopeException extends SSOOIDCServiceException {
321
+ constructor(opts) {
322
+ super({
323
+ name: "InvalidScopeException",
324
+ $fault: "client",
325
+ ...opts
326
+ });
327
+ this.name = "InvalidScopeException";
328
+ this.$fault = "client";
329
+ Object.setPrototypeOf(this, _InvalidScopeException.prototype);
330
+ this.error = opts.error;
331
+ this.error_description = opts.error_description;
332
+ }
333
+ };
334
+ var SlowDownException = class _SlowDownException extends SSOOIDCServiceException {
335
+ constructor(opts) {
336
+ super({
337
+ name: "SlowDownException",
338
+ $fault: "client",
339
+ ...opts
340
+ });
341
+ this.name = "SlowDownException";
342
+ this.$fault = "client";
343
+ Object.setPrototypeOf(this, _SlowDownException.prototype);
344
+ this.error = opts.error;
345
+ this.error_description = opts.error_description;
346
+ }
347
+ };
348
+ var UnauthorizedClientException = class _UnauthorizedClientException extends SSOOIDCServiceException {
349
+ constructor(opts) {
350
+ super({
351
+ name: "UnauthorizedClientException",
352
+ $fault: "client",
353
+ ...opts
354
+ });
355
+ this.name = "UnauthorizedClientException";
356
+ this.$fault = "client";
357
+ Object.setPrototypeOf(this, _UnauthorizedClientException.prototype);
358
+ this.error = opts.error;
359
+ this.error_description = opts.error_description;
360
+ }
361
+ };
362
+ var UnsupportedGrantTypeException = class _UnsupportedGrantTypeException extends SSOOIDCServiceException {
363
+ constructor(opts) {
364
+ super({
365
+ name: "UnsupportedGrantTypeException",
366
+ $fault: "client",
367
+ ...opts
368
+ });
369
+ this.name = "UnsupportedGrantTypeException";
370
+ this.$fault = "client";
371
+ Object.setPrototypeOf(this, _UnsupportedGrantTypeException.prototype);
372
+ this.error = opts.error;
373
+ this.error_description = opts.error_description;
374
+ }
375
+ };
376
+ var se_CreateTokenCommand = async (input, context) => {
377
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
378
+ const headers = {
379
+ "content-type": "application/json"
380
+ };
381
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}/token`;
382
+ let body;
383
+ body = JSON.stringify(take(input, {
384
+ clientId: [],
385
+ clientSecret: [],
386
+ code: [],
387
+ deviceCode: [],
388
+ grantType: [],
389
+ redirectUri: [],
390
+ refreshToken: [],
391
+ scope: (_) => _json(_)
392
+ }));
393
+ return new __HttpRequest({
394
+ protocol,
395
+ hostname,
396
+ port,
397
+ method: "POST",
398
+ headers,
399
+ path: resolvedPath,
400
+ body
401
+ });
402
+ };
403
+ var de_CreateTokenCommand = async (output, context) => {
404
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
405
+ return de_CreateTokenCommandError(output, context);
406
+ }
407
+ const contents = map({
408
+ $metadata: deserializeMetadata(output)
409
+ });
410
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
411
+ const doc = take(data, {
412
+ accessToken: __expectString,
413
+ expiresIn: __expectInt32,
414
+ idToken: __expectString,
415
+ refreshToken: __expectString,
416
+ tokenType: __expectString
417
+ });
418
+ Object.assign(contents, doc);
419
+ return contents;
420
+ };
421
+ var de_CreateTokenCommandError = async (output, context) => {
422
+ const parsedOutput = {
423
+ ...output,
424
+ body: await parseErrorBody(output.body, context)
425
+ };
426
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
427
+ switch (errorCode) {
428
+ case "AccessDeniedException":
429
+ case "com.amazonaws.ssooidc#AccessDeniedException":
430
+ throw await de_AccessDeniedExceptionRes(parsedOutput, context);
431
+ case "AuthorizationPendingException":
432
+ case "com.amazonaws.ssooidc#AuthorizationPendingException":
433
+ throw await de_AuthorizationPendingExceptionRes(parsedOutput, context);
434
+ case "ExpiredTokenException":
435
+ case "com.amazonaws.ssooidc#ExpiredTokenException":
436
+ throw await de_ExpiredTokenExceptionRes(parsedOutput, context);
437
+ case "InternalServerException":
438
+ case "com.amazonaws.ssooidc#InternalServerException":
439
+ throw await de_InternalServerExceptionRes(parsedOutput, context);
440
+ case "InvalidClientException":
441
+ case "com.amazonaws.ssooidc#InvalidClientException":
442
+ throw await de_InvalidClientExceptionRes(parsedOutput, context);
443
+ case "InvalidGrantException":
444
+ case "com.amazonaws.ssooidc#InvalidGrantException":
445
+ throw await de_InvalidGrantExceptionRes(parsedOutput, context);
446
+ case "InvalidRequestException":
447
+ case "com.amazonaws.ssooidc#InvalidRequestException":
448
+ throw await de_InvalidRequestExceptionRes(parsedOutput, context);
449
+ case "InvalidScopeException":
450
+ case "com.amazonaws.ssooidc#InvalidScopeException":
451
+ throw await de_InvalidScopeExceptionRes(parsedOutput, context);
452
+ case "SlowDownException":
453
+ case "com.amazonaws.ssooidc#SlowDownException":
454
+ throw await de_SlowDownExceptionRes(parsedOutput, context);
455
+ case "UnauthorizedClientException":
456
+ case "com.amazonaws.ssooidc#UnauthorizedClientException":
457
+ throw await de_UnauthorizedClientExceptionRes(parsedOutput, context);
458
+ case "UnsupportedGrantTypeException":
459
+ case "com.amazonaws.ssooidc#UnsupportedGrantTypeException":
460
+ throw await de_UnsupportedGrantTypeExceptionRes(parsedOutput, context);
461
+ default:
462
+ const parsedBody = parsedOutput.body;
463
+ return throwDefaultError({
464
+ output,
465
+ parsedBody,
466
+ errorCode
467
+ });
468
+ }
469
+ };
470
+ var throwDefaultError = withBaseException(SSOOIDCServiceException);
471
+ var de_AccessDeniedExceptionRes = async (parsedOutput, context) => {
472
+ const contents = map({});
473
+ const data = parsedOutput.body;
474
+ const doc = take(data, {
475
+ error: __expectString,
476
+ error_description: __expectString
477
+ });
478
+ Object.assign(contents, doc);
479
+ const exception = new AccessDeniedException({
480
+ $metadata: deserializeMetadata(parsedOutput),
481
+ ...contents
482
+ });
483
+ return __decorateServiceException(exception, parsedOutput.body);
484
+ };
485
+ var de_AuthorizationPendingExceptionRes = async (parsedOutput, context) => {
486
+ const contents = map({});
487
+ const data = parsedOutput.body;
488
+ const doc = take(data, {
489
+ error: __expectString,
490
+ error_description: __expectString
491
+ });
492
+ Object.assign(contents, doc);
493
+ const exception = new AuthorizationPendingException({
494
+ $metadata: deserializeMetadata(parsedOutput),
495
+ ...contents
496
+ });
497
+ return __decorateServiceException(exception, parsedOutput.body);
498
+ };
499
+ var de_ExpiredTokenExceptionRes = async (parsedOutput, context) => {
500
+ const contents = map({});
501
+ const data = parsedOutput.body;
502
+ const doc = take(data, {
503
+ error: __expectString,
504
+ error_description: __expectString
505
+ });
506
+ Object.assign(contents, doc);
507
+ const exception = new ExpiredTokenException({
508
+ $metadata: deserializeMetadata(parsedOutput),
509
+ ...contents
510
+ });
511
+ return __decorateServiceException(exception, parsedOutput.body);
512
+ };
513
+ var de_InternalServerExceptionRes = async (parsedOutput, context) => {
514
+ const contents = map({});
515
+ const data = parsedOutput.body;
516
+ const doc = take(data, {
517
+ error: __expectString,
518
+ error_description: __expectString
519
+ });
520
+ Object.assign(contents, doc);
521
+ const exception = new InternalServerException({
522
+ $metadata: deserializeMetadata(parsedOutput),
523
+ ...contents
524
+ });
525
+ return __decorateServiceException(exception, parsedOutput.body);
526
+ };
527
+ var de_InvalidClientExceptionRes = async (parsedOutput, context) => {
528
+ const contents = map({});
529
+ const data = parsedOutput.body;
530
+ const doc = take(data, {
531
+ error: __expectString,
532
+ error_description: __expectString
533
+ });
534
+ Object.assign(contents, doc);
535
+ const exception = new InvalidClientException({
536
+ $metadata: deserializeMetadata(parsedOutput),
537
+ ...contents
538
+ });
539
+ return __decorateServiceException(exception, parsedOutput.body);
540
+ };
541
+ var de_InvalidGrantExceptionRes = async (parsedOutput, context) => {
542
+ const contents = map({});
543
+ const data = parsedOutput.body;
544
+ const doc = take(data, {
545
+ error: __expectString,
546
+ error_description: __expectString
547
+ });
548
+ Object.assign(contents, doc);
549
+ const exception = new InvalidGrantException({
550
+ $metadata: deserializeMetadata(parsedOutput),
551
+ ...contents
552
+ });
553
+ return __decorateServiceException(exception, parsedOutput.body);
554
+ };
555
+ var de_InvalidRequestExceptionRes = async (parsedOutput, context) => {
556
+ const contents = map({});
557
+ const data = parsedOutput.body;
558
+ const doc = take(data, {
559
+ error: __expectString,
560
+ error_description: __expectString
561
+ });
562
+ Object.assign(contents, doc);
563
+ const exception = new InvalidRequestException({
564
+ $metadata: deserializeMetadata(parsedOutput),
565
+ ...contents
566
+ });
567
+ return __decorateServiceException(exception, parsedOutput.body);
568
+ };
569
+ var de_InvalidScopeExceptionRes = async (parsedOutput, context) => {
570
+ const contents = map({});
571
+ const data = parsedOutput.body;
572
+ const doc = take(data, {
573
+ error: __expectString,
574
+ error_description: __expectString
575
+ });
576
+ Object.assign(contents, doc);
577
+ const exception = new InvalidScopeException({
578
+ $metadata: deserializeMetadata(parsedOutput),
579
+ ...contents
580
+ });
581
+ return __decorateServiceException(exception, parsedOutput.body);
582
+ };
583
+ var de_SlowDownExceptionRes = async (parsedOutput, context) => {
584
+ const contents = map({});
585
+ const data = parsedOutput.body;
586
+ const doc = take(data, {
587
+ error: __expectString,
588
+ error_description: __expectString
589
+ });
590
+ Object.assign(contents, doc);
591
+ const exception = new SlowDownException({
592
+ $metadata: deserializeMetadata(parsedOutput),
593
+ ...contents
594
+ });
595
+ return __decorateServiceException(exception, parsedOutput.body);
596
+ };
597
+ var de_UnauthorizedClientExceptionRes = async (parsedOutput, context) => {
598
+ const contents = map({});
599
+ const data = parsedOutput.body;
600
+ const doc = take(data, {
601
+ error: __expectString,
602
+ error_description: __expectString
603
+ });
604
+ Object.assign(contents, doc);
605
+ const exception = new UnauthorizedClientException({
606
+ $metadata: deserializeMetadata(parsedOutput),
607
+ ...contents
608
+ });
609
+ return __decorateServiceException(exception, parsedOutput.body);
610
+ };
611
+ var de_UnsupportedGrantTypeExceptionRes = async (parsedOutput, context) => {
612
+ const contents = map({});
613
+ const data = parsedOutput.body;
614
+ const doc = take(data, {
615
+ error: __expectString,
616
+ error_description: __expectString
617
+ });
618
+ Object.assign(contents, doc);
619
+ const exception = new UnsupportedGrantTypeException({
620
+ $metadata: deserializeMetadata(parsedOutput),
621
+ ...contents
622
+ });
623
+ return __decorateServiceException(exception, parsedOutput.body);
624
+ };
625
+ var deserializeMetadata = (output) => ({
626
+ httpStatusCode: output.statusCode,
627
+ requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
628
+ extendedRequestId: output.headers["x-amz-id-2"],
629
+ cfId: output.headers["x-amz-cf-id"]
630
+ });
631
+ var collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
632
+ var parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
633
+ if (encoded.length) {
634
+ return JSON.parse(encoded);
635
+ }
636
+ return {};
637
+ });
638
+ var parseErrorBody = async (errorBody, context) => {
639
+ const value = await parseBody(errorBody, context);
640
+ value.message = value.message ?? value.Message;
641
+ return value;
642
+ };
643
+ var loadRestJsonErrorCode = (output, data) => {
644
+ const findKey = (object, key) => Object.keys(object).find((k2) => k2.toLowerCase() === key.toLowerCase());
645
+ const sanitizeErrorCode = (rawValue) => {
646
+ let cleanValue = rawValue;
647
+ if (typeof cleanValue === "number") {
648
+ cleanValue = cleanValue.toString();
649
+ }
650
+ if (cleanValue.indexOf(",") >= 0) {
651
+ cleanValue = cleanValue.split(",")[0];
652
+ }
653
+ if (cleanValue.indexOf(":") >= 0) {
654
+ cleanValue = cleanValue.split(":")[0];
655
+ }
656
+ if (cleanValue.indexOf("#") >= 0) {
657
+ cleanValue = cleanValue.split("#")[1];
658
+ }
659
+ return cleanValue;
660
+ };
661
+ const headerKey = findKey(output.headers, "x-amzn-errortype");
662
+ if (headerKey !== void 0) {
663
+ return sanitizeErrorCode(output.headers[headerKey]);
664
+ }
665
+ if (data.code !== void 0) {
666
+ return sanitizeErrorCode(data.code);
667
+ }
668
+ if (data["__type"] !== void 0) {
669
+ return sanitizeErrorCode(data["__type"]);
670
+ }
671
+ };
672
+ var CreateTokenCommand = class _CreateTokenCommand extends $Command {
673
+ constructor(input) {
674
+ super();
675
+ this.input = input;
676
+ }
677
+ static getEndpointParameterInstructions() {
678
+ return {
679
+ UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" },
680
+ Endpoint: { type: "builtInParams", name: "endpoint" },
681
+ Region: { type: "builtInParams", name: "region" },
682
+ UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" }
683
+ };
684
+ }
685
+ resolveMiddleware(clientStack, configuration, options) {
686
+ this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
687
+ this.middlewareStack.use(getEndpointPlugin(configuration, _CreateTokenCommand.getEndpointParameterInstructions()));
688
+ const stack = clientStack.concat(this.middlewareStack);
689
+ const { logger } = configuration;
690
+ const clientName = "SSOOIDCClient";
691
+ const commandName = "CreateTokenCommand";
692
+ const handlerExecutionContext = {
693
+ logger,
694
+ clientName,
695
+ commandName,
696
+ inputFilterSensitiveLog: (_) => _,
697
+ outputFilterSensitiveLog: (_) => _
698
+ };
699
+ const { requestHandler } = configuration;
700
+ return stack.resolve((request) => requestHandler.handle(request.request, options || {}), handlerExecutionContext);
701
+ }
702
+ serialize(input, context) {
703
+ return se_CreateTokenCommand(input, context);
704
+ }
705
+ deserialize(output, context) {
706
+ return de_CreateTokenCommand(output, context);
707
+ }
708
+ };
709
+ export { AccessDeniedException, AuthorizationPendingException, CreateTokenCommand, ExpiredTokenException, InternalServerException, InvalidClientException, InvalidRequestException, InvalidScopeException, SSOOIDCClient, SlowDownException, UnauthorizedClientException, UnsupportedGrantTypeException };