@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,715 @@
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 { defaultUserAgent } from "@aws-sdk/util-user-agent-node";
115
+ import { NODE_REGION_CONFIG_FILE_OPTIONS, NODE_REGION_CONFIG_OPTIONS, NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS } from "@smithy/config-resolver";
116
+ import { Hash } from "@smithy/hash-node";
117
+ import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@smithy/middleware-retry";
118
+ import { loadConfig as loadNodeConfig } from "@smithy/node-config-provider";
119
+ import { NodeHttpHandler as RequestHandler, streamCollector } from "@smithy/node-http-handler";
120
+ import { calculateBodyLength } from "@smithy/util-body-length-node";
121
+ import { DEFAULT_RETRY_MODE } from "@smithy/util-retry";
122
+ import { NoOpLogger } from "@smithy/smithy-client";
123
+ import { parseUrl } from "@smithy/url-parser";
124
+ import { fromBase64, toBase64 } from "@smithy/util-base64";
125
+ import { fromUtf8, toUtf8 } from "@smithy/util-utf8";
126
+ import { resolveEndpoint } from "@aws-sdk/util-endpoints";
127
+ var p = "required";
128
+ var q = "fn";
129
+ var r = "argv";
130
+ var s = "ref";
131
+ var a = "PartitionResult";
132
+ var b = "tree";
133
+ var c = "error";
134
+ var d = "endpoint";
135
+ var e = { [p]: false, "type": "String" };
136
+ var f = { [p]: true, "default": false, "type": "Boolean" };
137
+ var g = { [s]: "Endpoint" };
138
+ var h = { [q]: "booleanEquals", [r]: [{ [s]: "UseFIPS" }, true] };
139
+ var i = { [q]: "booleanEquals", [r]: [{ [s]: "UseDualStack" }, true] };
140
+ var j = {};
141
+ var k = { [q]: "booleanEquals", [r]: [true, { [q]: "getAttr", [r]: [{ [s]: a }, "supportsFIPS"] }] };
142
+ var l = { [q]: "booleanEquals", [r]: [true, { [q]: "getAttr", [r]: [{ [s]: a }, "supportsDualStack"] }] };
143
+ var m = [g];
144
+ var n = [h];
145
+ var o = [i];
146
+ 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 }] }] };
147
+ var ruleSet = _data;
148
+ var defaultEndpointResolver = (endpointParams, context = {}) => {
149
+ return resolveEndpoint(ruleSet, {
150
+ endpointParams,
151
+ logger: context.logger
152
+ });
153
+ };
154
+ var getRuntimeConfig = (config) => ({
155
+ apiVersion: "2019-06-10",
156
+ base64Decoder: config?.base64Decoder ?? fromBase64,
157
+ base64Encoder: config?.base64Encoder ?? toBase64,
158
+ disableHostPrefix: config?.disableHostPrefix ?? false,
159
+ endpointProvider: config?.endpointProvider ?? defaultEndpointResolver,
160
+ logger: config?.logger ?? new NoOpLogger(),
161
+ serviceId: config?.serviceId ?? "SSO OIDC",
162
+ urlParser: config?.urlParser ?? parseUrl,
163
+ utf8Decoder: config?.utf8Decoder ?? fromUtf8,
164
+ utf8Encoder: config?.utf8Encoder ?? toUtf8
165
+ });
166
+ import { loadConfigsForDefaultMode } from "@smithy/smithy-client";
167
+ import { resolveDefaultsModeConfig } from "@smithy/util-defaults-mode-node";
168
+ import { emitWarningIfUnsupportedVersion } from "@smithy/smithy-client";
169
+ var getRuntimeConfig2 = (config) => {
170
+ emitWarningIfUnsupportedVersion(process.version);
171
+ const defaultsMode = resolveDefaultsModeConfig(config);
172
+ const defaultConfigProvider = () => defaultsMode().then(loadConfigsForDefaultMode);
173
+ const clientSharedValues = getRuntimeConfig(config);
174
+ return {
175
+ ...clientSharedValues,
176
+ ...config,
177
+ runtime: "node",
178
+ defaultsMode,
179
+ bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength,
180
+ defaultUserAgentProvider: config?.defaultUserAgentProvider ?? defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: package_default.version }),
181
+ maxAttempts: config?.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS),
182
+ region: config?.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS),
183
+ requestHandler: config?.requestHandler ?? new RequestHandler(defaultConfigProvider),
184
+ retryMode: config?.retryMode ?? loadNodeConfig({
185
+ ...NODE_RETRY_MODE_CONFIG_OPTIONS,
186
+ default: async () => (await defaultConfigProvider()).retryMode || DEFAULT_RETRY_MODE
187
+ }),
188
+ sha256: config?.sha256 ?? Hash.bind(null, "sha256"),
189
+ streamCollector: config?.streamCollector ?? streamCollector,
190
+ useDualstackEndpoint: config?.useDualstackEndpoint ?? loadNodeConfig(NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS),
191
+ useFipsEndpoint: config?.useFipsEndpoint ?? loadNodeConfig(NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS)
192
+ };
193
+ };
194
+ var SSOOIDCClient = class extends __Client {
195
+ constructor(configuration) {
196
+ const _config_0 = getRuntimeConfig2(configuration);
197
+ const _config_1 = resolveClientEndpointParameters(_config_0);
198
+ const _config_2 = resolveRegionConfig(_config_1);
199
+ const _config_3 = resolveEndpointConfig(_config_2);
200
+ const _config_4 = resolveRetryConfig(_config_3);
201
+ const _config_5 = resolveHostHeaderConfig(_config_4);
202
+ const _config_6 = resolveUserAgentConfig(_config_5);
203
+ super(_config_6);
204
+ this.config = _config_6;
205
+ this.middlewareStack.use(getRetryPlugin(this.config));
206
+ this.middlewareStack.use(getContentLengthPlugin(this.config));
207
+ this.middlewareStack.use(getHostHeaderPlugin(this.config));
208
+ this.middlewareStack.use(getLoggerPlugin(this.config));
209
+ this.middlewareStack.use(getRecursionDetectionPlugin(this.config));
210
+ this.middlewareStack.use(getUserAgentPlugin(this.config));
211
+ }
212
+ destroy() {
213
+ super.destroy();
214
+ }
215
+ };
216
+ import { getEndpointPlugin } from "@smithy/middleware-endpoint";
217
+ import { getSerdePlugin } from "@smithy/middleware-serde";
218
+ import { Command as $Command } from "@smithy/smithy-client";
219
+ import { HttpRequest as __HttpRequest } from "@smithy/protocol-http";
220
+ 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";
221
+ import { ServiceException as __ServiceException } from "@smithy/smithy-client";
222
+ var SSOOIDCServiceException = class _SSOOIDCServiceException extends __ServiceException {
223
+ constructor(options) {
224
+ super(options);
225
+ Object.setPrototypeOf(this, _SSOOIDCServiceException.prototype);
226
+ }
227
+ };
228
+ var AccessDeniedException = class _AccessDeniedException extends SSOOIDCServiceException {
229
+ constructor(opts) {
230
+ super({
231
+ name: "AccessDeniedException",
232
+ $fault: "client",
233
+ ...opts
234
+ });
235
+ this.name = "AccessDeniedException";
236
+ this.$fault = "client";
237
+ Object.setPrototypeOf(this, _AccessDeniedException.prototype);
238
+ this.error = opts.error;
239
+ this.error_description = opts.error_description;
240
+ }
241
+ };
242
+ var AuthorizationPendingException = class _AuthorizationPendingException extends SSOOIDCServiceException {
243
+ constructor(opts) {
244
+ super({
245
+ name: "AuthorizationPendingException",
246
+ $fault: "client",
247
+ ...opts
248
+ });
249
+ this.name = "AuthorizationPendingException";
250
+ this.$fault = "client";
251
+ Object.setPrototypeOf(this, _AuthorizationPendingException.prototype);
252
+ this.error = opts.error;
253
+ this.error_description = opts.error_description;
254
+ }
255
+ };
256
+ var ExpiredTokenException = class _ExpiredTokenException extends SSOOIDCServiceException {
257
+ constructor(opts) {
258
+ super({
259
+ name: "ExpiredTokenException",
260
+ $fault: "client",
261
+ ...opts
262
+ });
263
+ this.name = "ExpiredTokenException";
264
+ this.$fault = "client";
265
+ Object.setPrototypeOf(this, _ExpiredTokenException.prototype);
266
+ this.error = opts.error;
267
+ this.error_description = opts.error_description;
268
+ }
269
+ };
270
+ var InternalServerException = class _InternalServerException extends SSOOIDCServiceException {
271
+ constructor(opts) {
272
+ super({
273
+ name: "InternalServerException",
274
+ $fault: "server",
275
+ ...opts
276
+ });
277
+ this.name = "InternalServerException";
278
+ this.$fault = "server";
279
+ Object.setPrototypeOf(this, _InternalServerException.prototype);
280
+ this.error = opts.error;
281
+ this.error_description = opts.error_description;
282
+ }
283
+ };
284
+ var InvalidClientException = class _InvalidClientException extends SSOOIDCServiceException {
285
+ constructor(opts) {
286
+ super({
287
+ name: "InvalidClientException",
288
+ $fault: "client",
289
+ ...opts
290
+ });
291
+ this.name = "InvalidClientException";
292
+ this.$fault = "client";
293
+ Object.setPrototypeOf(this, _InvalidClientException.prototype);
294
+ this.error = opts.error;
295
+ this.error_description = opts.error_description;
296
+ }
297
+ };
298
+ var InvalidGrantException = class _InvalidGrantException extends SSOOIDCServiceException {
299
+ constructor(opts) {
300
+ super({
301
+ name: "InvalidGrantException",
302
+ $fault: "client",
303
+ ...opts
304
+ });
305
+ this.name = "InvalidGrantException";
306
+ this.$fault = "client";
307
+ Object.setPrototypeOf(this, _InvalidGrantException.prototype);
308
+ this.error = opts.error;
309
+ this.error_description = opts.error_description;
310
+ }
311
+ };
312
+ var InvalidRequestException = class _InvalidRequestException extends SSOOIDCServiceException {
313
+ constructor(opts) {
314
+ super({
315
+ name: "InvalidRequestException",
316
+ $fault: "client",
317
+ ...opts
318
+ });
319
+ this.name = "InvalidRequestException";
320
+ this.$fault = "client";
321
+ Object.setPrototypeOf(this, _InvalidRequestException.prototype);
322
+ this.error = opts.error;
323
+ this.error_description = opts.error_description;
324
+ }
325
+ };
326
+ var InvalidScopeException = class _InvalidScopeException extends SSOOIDCServiceException {
327
+ constructor(opts) {
328
+ super({
329
+ name: "InvalidScopeException",
330
+ $fault: "client",
331
+ ...opts
332
+ });
333
+ this.name = "InvalidScopeException";
334
+ this.$fault = "client";
335
+ Object.setPrototypeOf(this, _InvalidScopeException.prototype);
336
+ this.error = opts.error;
337
+ this.error_description = opts.error_description;
338
+ }
339
+ };
340
+ var SlowDownException = class _SlowDownException extends SSOOIDCServiceException {
341
+ constructor(opts) {
342
+ super({
343
+ name: "SlowDownException",
344
+ $fault: "client",
345
+ ...opts
346
+ });
347
+ this.name = "SlowDownException";
348
+ this.$fault = "client";
349
+ Object.setPrototypeOf(this, _SlowDownException.prototype);
350
+ this.error = opts.error;
351
+ this.error_description = opts.error_description;
352
+ }
353
+ };
354
+ var UnauthorizedClientException = class _UnauthorizedClientException extends SSOOIDCServiceException {
355
+ constructor(opts) {
356
+ super({
357
+ name: "UnauthorizedClientException",
358
+ $fault: "client",
359
+ ...opts
360
+ });
361
+ this.name = "UnauthorizedClientException";
362
+ this.$fault = "client";
363
+ Object.setPrototypeOf(this, _UnauthorizedClientException.prototype);
364
+ this.error = opts.error;
365
+ this.error_description = opts.error_description;
366
+ }
367
+ };
368
+ var UnsupportedGrantTypeException = class _UnsupportedGrantTypeException extends SSOOIDCServiceException {
369
+ constructor(opts) {
370
+ super({
371
+ name: "UnsupportedGrantTypeException",
372
+ $fault: "client",
373
+ ...opts
374
+ });
375
+ this.name = "UnsupportedGrantTypeException";
376
+ this.$fault = "client";
377
+ Object.setPrototypeOf(this, _UnsupportedGrantTypeException.prototype);
378
+ this.error = opts.error;
379
+ this.error_description = opts.error_description;
380
+ }
381
+ };
382
+ var se_CreateTokenCommand = async (input, context) => {
383
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
384
+ const headers = {
385
+ "content-type": "application/json"
386
+ };
387
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}/token`;
388
+ let body;
389
+ body = JSON.stringify(take(input, {
390
+ clientId: [],
391
+ clientSecret: [],
392
+ code: [],
393
+ deviceCode: [],
394
+ grantType: [],
395
+ redirectUri: [],
396
+ refreshToken: [],
397
+ scope: (_) => _json(_)
398
+ }));
399
+ return new __HttpRequest({
400
+ protocol,
401
+ hostname,
402
+ port,
403
+ method: "POST",
404
+ headers,
405
+ path: resolvedPath,
406
+ body
407
+ });
408
+ };
409
+ var de_CreateTokenCommand = async (output, context) => {
410
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
411
+ return de_CreateTokenCommandError(output, context);
412
+ }
413
+ const contents = map({
414
+ $metadata: deserializeMetadata(output)
415
+ });
416
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
417
+ const doc = take(data, {
418
+ accessToken: __expectString,
419
+ expiresIn: __expectInt32,
420
+ idToken: __expectString,
421
+ refreshToken: __expectString,
422
+ tokenType: __expectString
423
+ });
424
+ Object.assign(contents, doc);
425
+ return contents;
426
+ };
427
+ var de_CreateTokenCommandError = async (output, context) => {
428
+ const parsedOutput = {
429
+ ...output,
430
+ body: await parseErrorBody(output.body, context)
431
+ };
432
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
433
+ switch (errorCode) {
434
+ case "AccessDeniedException":
435
+ case "com.amazonaws.ssooidc#AccessDeniedException":
436
+ throw await de_AccessDeniedExceptionRes(parsedOutput, context);
437
+ case "AuthorizationPendingException":
438
+ case "com.amazonaws.ssooidc#AuthorizationPendingException":
439
+ throw await de_AuthorizationPendingExceptionRes(parsedOutput, context);
440
+ case "ExpiredTokenException":
441
+ case "com.amazonaws.ssooidc#ExpiredTokenException":
442
+ throw await de_ExpiredTokenExceptionRes(parsedOutput, context);
443
+ case "InternalServerException":
444
+ case "com.amazonaws.ssooidc#InternalServerException":
445
+ throw await de_InternalServerExceptionRes(parsedOutput, context);
446
+ case "InvalidClientException":
447
+ case "com.amazonaws.ssooidc#InvalidClientException":
448
+ throw await de_InvalidClientExceptionRes(parsedOutput, context);
449
+ case "InvalidGrantException":
450
+ case "com.amazonaws.ssooidc#InvalidGrantException":
451
+ throw await de_InvalidGrantExceptionRes(parsedOutput, context);
452
+ case "InvalidRequestException":
453
+ case "com.amazonaws.ssooidc#InvalidRequestException":
454
+ throw await de_InvalidRequestExceptionRes(parsedOutput, context);
455
+ case "InvalidScopeException":
456
+ case "com.amazonaws.ssooidc#InvalidScopeException":
457
+ throw await de_InvalidScopeExceptionRes(parsedOutput, context);
458
+ case "SlowDownException":
459
+ case "com.amazonaws.ssooidc#SlowDownException":
460
+ throw await de_SlowDownExceptionRes(parsedOutput, context);
461
+ case "UnauthorizedClientException":
462
+ case "com.amazonaws.ssooidc#UnauthorizedClientException":
463
+ throw await de_UnauthorizedClientExceptionRes(parsedOutput, context);
464
+ case "UnsupportedGrantTypeException":
465
+ case "com.amazonaws.ssooidc#UnsupportedGrantTypeException":
466
+ throw await de_UnsupportedGrantTypeExceptionRes(parsedOutput, context);
467
+ default:
468
+ const parsedBody = parsedOutput.body;
469
+ return throwDefaultError({
470
+ output,
471
+ parsedBody,
472
+ errorCode
473
+ });
474
+ }
475
+ };
476
+ var throwDefaultError = withBaseException(SSOOIDCServiceException);
477
+ var de_AccessDeniedExceptionRes = async (parsedOutput, context) => {
478
+ const contents = map({});
479
+ const data = parsedOutput.body;
480
+ const doc = take(data, {
481
+ error: __expectString,
482
+ error_description: __expectString
483
+ });
484
+ Object.assign(contents, doc);
485
+ const exception = new AccessDeniedException({
486
+ $metadata: deserializeMetadata(parsedOutput),
487
+ ...contents
488
+ });
489
+ return __decorateServiceException(exception, parsedOutput.body);
490
+ };
491
+ var de_AuthorizationPendingExceptionRes = async (parsedOutput, context) => {
492
+ const contents = map({});
493
+ const data = parsedOutput.body;
494
+ const doc = take(data, {
495
+ error: __expectString,
496
+ error_description: __expectString
497
+ });
498
+ Object.assign(contents, doc);
499
+ const exception = new AuthorizationPendingException({
500
+ $metadata: deserializeMetadata(parsedOutput),
501
+ ...contents
502
+ });
503
+ return __decorateServiceException(exception, parsedOutput.body);
504
+ };
505
+ var de_ExpiredTokenExceptionRes = async (parsedOutput, context) => {
506
+ const contents = map({});
507
+ const data = parsedOutput.body;
508
+ const doc = take(data, {
509
+ error: __expectString,
510
+ error_description: __expectString
511
+ });
512
+ Object.assign(contents, doc);
513
+ const exception = new ExpiredTokenException({
514
+ $metadata: deserializeMetadata(parsedOutput),
515
+ ...contents
516
+ });
517
+ return __decorateServiceException(exception, parsedOutput.body);
518
+ };
519
+ var de_InternalServerExceptionRes = async (parsedOutput, context) => {
520
+ const contents = map({});
521
+ const data = parsedOutput.body;
522
+ const doc = take(data, {
523
+ error: __expectString,
524
+ error_description: __expectString
525
+ });
526
+ Object.assign(contents, doc);
527
+ const exception = new InternalServerException({
528
+ $metadata: deserializeMetadata(parsedOutput),
529
+ ...contents
530
+ });
531
+ return __decorateServiceException(exception, parsedOutput.body);
532
+ };
533
+ var de_InvalidClientExceptionRes = async (parsedOutput, context) => {
534
+ const contents = map({});
535
+ const data = parsedOutput.body;
536
+ const doc = take(data, {
537
+ error: __expectString,
538
+ error_description: __expectString
539
+ });
540
+ Object.assign(contents, doc);
541
+ const exception = new InvalidClientException({
542
+ $metadata: deserializeMetadata(parsedOutput),
543
+ ...contents
544
+ });
545
+ return __decorateServiceException(exception, parsedOutput.body);
546
+ };
547
+ var de_InvalidGrantExceptionRes = async (parsedOutput, context) => {
548
+ const contents = map({});
549
+ const data = parsedOutput.body;
550
+ const doc = take(data, {
551
+ error: __expectString,
552
+ error_description: __expectString
553
+ });
554
+ Object.assign(contents, doc);
555
+ const exception = new InvalidGrantException({
556
+ $metadata: deserializeMetadata(parsedOutput),
557
+ ...contents
558
+ });
559
+ return __decorateServiceException(exception, parsedOutput.body);
560
+ };
561
+ var de_InvalidRequestExceptionRes = async (parsedOutput, context) => {
562
+ const contents = map({});
563
+ const data = parsedOutput.body;
564
+ const doc = take(data, {
565
+ error: __expectString,
566
+ error_description: __expectString
567
+ });
568
+ Object.assign(contents, doc);
569
+ const exception = new InvalidRequestException({
570
+ $metadata: deserializeMetadata(parsedOutput),
571
+ ...contents
572
+ });
573
+ return __decorateServiceException(exception, parsedOutput.body);
574
+ };
575
+ var de_InvalidScopeExceptionRes = async (parsedOutput, context) => {
576
+ const contents = map({});
577
+ const data = parsedOutput.body;
578
+ const doc = take(data, {
579
+ error: __expectString,
580
+ error_description: __expectString
581
+ });
582
+ Object.assign(contents, doc);
583
+ const exception = new InvalidScopeException({
584
+ $metadata: deserializeMetadata(parsedOutput),
585
+ ...contents
586
+ });
587
+ return __decorateServiceException(exception, parsedOutput.body);
588
+ };
589
+ var de_SlowDownExceptionRes = async (parsedOutput, context) => {
590
+ const contents = map({});
591
+ const data = parsedOutput.body;
592
+ const doc = take(data, {
593
+ error: __expectString,
594
+ error_description: __expectString
595
+ });
596
+ Object.assign(contents, doc);
597
+ const exception = new SlowDownException({
598
+ $metadata: deserializeMetadata(parsedOutput),
599
+ ...contents
600
+ });
601
+ return __decorateServiceException(exception, parsedOutput.body);
602
+ };
603
+ var de_UnauthorizedClientExceptionRes = async (parsedOutput, context) => {
604
+ const contents = map({});
605
+ const data = parsedOutput.body;
606
+ const doc = take(data, {
607
+ error: __expectString,
608
+ error_description: __expectString
609
+ });
610
+ Object.assign(contents, doc);
611
+ const exception = new UnauthorizedClientException({
612
+ $metadata: deserializeMetadata(parsedOutput),
613
+ ...contents
614
+ });
615
+ return __decorateServiceException(exception, parsedOutput.body);
616
+ };
617
+ var de_UnsupportedGrantTypeExceptionRes = async (parsedOutput, context) => {
618
+ const contents = map({});
619
+ const data = parsedOutput.body;
620
+ const doc = take(data, {
621
+ error: __expectString,
622
+ error_description: __expectString
623
+ });
624
+ Object.assign(contents, doc);
625
+ const exception = new UnsupportedGrantTypeException({
626
+ $metadata: deserializeMetadata(parsedOutput),
627
+ ...contents
628
+ });
629
+ return __decorateServiceException(exception, parsedOutput.body);
630
+ };
631
+ var deserializeMetadata = (output) => ({
632
+ httpStatusCode: output.statusCode,
633
+ requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
634
+ extendedRequestId: output.headers["x-amz-id-2"],
635
+ cfId: output.headers["x-amz-cf-id"]
636
+ });
637
+ var collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
638
+ var parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
639
+ if (encoded.length) {
640
+ return JSON.parse(encoded);
641
+ }
642
+ return {};
643
+ });
644
+ var parseErrorBody = async (errorBody, context) => {
645
+ const value = await parseBody(errorBody, context);
646
+ value.message = value.message ?? value.Message;
647
+ return value;
648
+ };
649
+ var loadRestJsonErrorCode = (output, data) => {
650
+ const findKey = (object, key) => Object.keys(object).find((k2) => k2.toLowerCase() === key.toLowerCase());
651
+ const sanitizeErrorCode = (rawValue) => {
652
+ let cleanValue = rawValue;
653
+ if (typeof cleanValue === "number") {
654
+ cleanValue = cleanValue.toString();
655
+ }
656
+ if (cleanValue.indexOf(",") >= 0) {
657
+ cleanValue = cleanValue.split(",")[0];
658
+ }
659
+ if (cleanValue.indexOf(":") >= 0) {
660
+ cleanValue = cleanValue.split(":")[0];
661
+ }
662
+ if (cleanValue.indexOf("#") >= 0) {
663
+ cleanValue = cleanValue.split("#")[1];
664
+ }
665
+ return cleanValue;
666
+ };
667
+ const headerKey = findKey(output.headers, "x-amzn-errortype");
668
+ if (headerKey !== void 0) {
669
+ return sanitizeErrorCode(output.headers[headerKey]);
670
+ }
671
+ if (data.code !== void 0) {
672
+ return sanitizeErrorCode(data.code);
673
+ }
674
+ if (data["__type"] !== void 0) {
675
+ return sanitizeErrorCode(data["__type"]);
676
+ }
677
+ };
678
+ var CreateTokenCommand = class _CreateTokenCommand extends $Command {
679
+ constructor(input) {
680
+ super();
681
+ this.input = input;
682
+ }
683
+ static getEndpointParameterInstructions() {
684
+ return {
685
+ UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" },
686
+ Endpoint: { type: "builtInParams", name: "endpoint" },
687
+ Region: { type: "builtInParams", name: "region" },
688
+ UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" }
689
+ };
690
+ }
691
+ resolveMiddleware(clientStack, configuration, options) {
692
+ this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
693
+ this.middlewareStack.use(getEndpointPlugin(configuration, _CreateTokenCommand.getEndpointParameterInstructions()));
694
+ const stack = clientStack.concat(this.middlewareStack);
695
+ const { logger } = configuration;
696
+ const clientName = "SSOOIDCClient";
697
+ const commandName = "CreateTokenCommand";
698
+ const handlerExecutionContext = {
699
+ logger,
700
+ clientName,
701
+ commandName,
702
+ inputFilterSensitiveLog: (_) => _,
703
+ outputFilterSensitiveLog: (_) => _
704
+ };
705
+ const { requestHandler } = configuration;
706
+ return stack.resolve((request) => requestHandler.handle(request.request, options || {}), handlerExecutionContext);
707
+ }
708
+ serialize(input, context) {
709
+ return se_CreateTokenCommand(input, context);
710
+ }
711
+ deserialize(output, context) {
712
+ return de_CreateTokenCommand(output, context);
713
+ }
714
+ };
715
+ export { AccessDeniedException, AuthorizationPendingException, CreateTokenCommand, ExpiredTokenException, InternalServerException, InvalidClientException, InvalidRequestException, InvalidScopeException, SSOOIDCClient, SlowDownException, UnauthorizedClientException, UnsupportedGrantTypeException };