@aws-sdk/token-providers 3.386.0 → 3.388.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.
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getNewSsoOidcToken = void 0;
4
- const dist_node_1 = require("./client-sso-oidc-bundle/dist-node");
4
+ const client_sso_oidc_node_1 = require("./bundle/client-sso-oidc-node");
5
5
  const getSsoOidcClient_1 = require("./getSsoOidcClient");
6
6
  const getNewSsoOidcToken = (ssoToken, ssoRegion) => {
7
7
  const ssoOidcClient = (0, getSsoOidcClient_1.getSsoOidcClient)(ssoRegion);
8
- return ssoOidcClient.send(new dist_node_1.CreateTokenCommand({
8
+ return ssoOidcClient.send(new client_sso_oidc_node_1.CreateTokenCommand({
9
9
  clientId: ssoToken.clientId,
10
10
  clientSecret: ssoToken.clientSecret,
11
11
  refreshToken: ssoToken.refreshToken,
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getSsoOidcClient = void 0;
4
- const dist_node_1 = require("./client-sso-oidc-bundle/dist-node");
4
+ const client_sso_oidc_node_1 = require("./bundle/client-sso-oidc-node");
5
5
  const ssoOidcClientsHash = {};
6
6
  const getSsoOidcClient = (ssoRegion) => {
7
7
  if (ssoOidcClientsHash[ssoRegion]) {
8
8
  return ssoOidcClientsHash[ssoRegion];
9
9
  }
10
- const ssoOidcClient = new dist_node_1.SSOOIDCClient({ region: ssoRegion });
10
+ const ssoOidcClient = new client_sso_oidc_node_1.SSOOIDCClient({ region: ssoRegion });
11
11
  ssoOidcClientsHash[ssoRegion] = ssoOidcClient;
12
12
  return ssoOidcClient;
13
13
  };
package/dist-cjs/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./client-sso-oidc-bundle/dist-node"), exports);
4
+ tslib_1.__exportStar(require("./bundle/client-sso-oidc-node"), exports);
5
5
  tslib_1.__exportStar(require("./fromSso"), exports);
6
6
  tslib_1.__exportStar(require("./fromStatic"), exports);
7
7
  tslib_1.__exportStar(require("./nodeProvider"), exports);
@@ -15,102 +15,7 @@ var resolveClientEndpointParameters = (options) => {
15
15
  defaultSigningName: "awsssooidc"
16
16
  };
17
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
- };
18
+ var package_default = { version: "3.387.0" };
114
19
  import { Sha256 } from "@aws-crypto/sha256-browser";
115
20
  import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser";
116
21
  import { DEFAULT_USE_DUALSTACK_ENDPOINT, DEFAULT_USE_FIPS_ENDPOINT } from "@smithy/config-resolver";
@@ -186,8 +91,8 @@ var getRuntimeConfig2 = (config) => {
186
91
  };
187
92
  };
188
93
  var SSOOIDCClient = class extends __Client {
189
- constructor(configuration) {
190
- const _config_0 = getRuntimeConfig2(configuration);
94
+ constructor(...[configuration]) {
95
+ const _config_0 = getRuntimeConfig2(configuration || {});
191
96
  const _config_1 = resolveClientEndpointParameters(_config_0);
192
97
  const _config_2 = resolveRegionConfig(_config_1);
193
98
  const _config_3 = resolveEndpointConfig(_config_2);
@@ -207,11 +112,12 @@ var SSOOIDCClient = class extends __Client {
207
112
  super.destroy();
208
113
  }
209
114
  };
115
+ import { createAggregatedClient } from "@smithy/smithy-client";
210
116
  import { getEndpointPlugin } from "@smithy/middleware-endpoint";
211
117
  import { getSerdePlugin } from "@smithy/middleware-serde";
212
118
  import { Command as $Command } from "@smithy/smithy-client";
213
119
  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";
120
+ import { _json, collectBody, decorateServiceException as __decorateServiceException, expectInt32 as __expectInt32, expectLong as __expectLong, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, map, take, withBaseException } from "@smithy/smithy-client";
215
121
  import { ServiceException as __ServiceException } from "@smithy/smithy-client";
216
122
  var SSOOIDCServiceException = class _SSOOIDCServiceException extends __ServiceException {
217
123
  constructor(options) {
@@ -373,6 +279,20 @@ var UnsupportedGrantTypeException = class _UnsupportedGrantTypeException extends
373
279
  this.error_description = opts.error_description;
374
280
  }
375
281
  };
282
+ var InvalidClientMetadataException = class _InvalidClientMetadataException extends SSOOIDCServiceException {
283
+ constructor(opts) {
284
+ super({
285
+ name: "InvalidClientMetadataException",
286
+ $fault: "client",
287
+ ...opts
288
+ });
289
+ this.name = "InvalidClientMetadataException";
290
+ this.$fault = "client";
291
+ Object.setPrototypeOf(this, _InvalidClientMetadataException.prototype);
292
+ this.error = opts.error;
293
+ this.error_description = opts.error_description;
294
+ }
295
+ };
376
296
  var se_CreateTokenCommand = async (input, context) => {
377
297
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
378
298
  const headers = {
@@ -400,6 +320,50 @@ var se_CreateTokenCommand = async (input, context) => {
400
320
  body
401
321
  });
402
322
  };
323
+ var se_RegisterClientCommand = async (input, context) => {
324
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
325
+ const headers = {
326
+ "content-type": "application/json"
327
+ };
328
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}/client/register`;
329
+ let body;
330
+ body = JSON.stringify(take(input, {
331
+ clientName: [],
332
+ clientType: [],
333
+ scopes: (_) => _json(_)
334
+ }));
335
+ return new __HttpRequest({
336
+ protocol,
337
+ hostname,
338
+ port,
339
+ method: "POST",
340
+ headers,
341
+ path: resolvedPath,
342
+ body
343
+ });
344
+ };
345
+ var se_StartDeviceAuthorizationCommand = async (input, context) => {
346
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
347
+ const headers = {
348
+ "content-type": "application/json"
349
+ };
350
+ const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}/device_authorization`;
351
+ let body;
352
+ body = JSON.stringify(take(input, {
353
+ clientId: [],
354
+ clientSecret: [],
355
+ startUrl: []
356
+ }));
357
+ return new __HttpRequest({
358
+ protocol,
359
+ hostname,
360
+ port,
361
+ method: "POST",
362
+ headers,
363
+ path: resolvedPath,
364
+ body
365
+ });
366
+ };
403
367
  var de_CreateTokenCommand = async (output, context) => {
404
368
  if (output.statusCode !== 200 && output.statusCode >= 300) {
405
369
  return de_CreateTokenCommandError(output, context);
@@ -467,6 +431,103 @@ var de_CreateTokenCommandError = async (output, context) => {
467
431
  });
468
432
  }
469
433
  };
434
+ var de_RegisterClientCommand = async (output, context) => {
435
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
436
+ return de_RegisterClientCommandError(output, context);
437
+ }
438
+ const contents = map({
439
+ $metadata: deserializeMetadata(output)
440
+ });
441
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
442
+ const doc = take(data, {
443
+ authorizationEndpoint: __expectString,
444
+ clientId: __expectString,
445
+ clientIdIssuedAt: __expectLong,
446
+ clientSecret: __expectString,
447
+ clientSecretExpiresAt: __expectLong,
448
+ tokenEndpoint: __expectString
449
+ });
450
+ Object.assign(contents, doc);
451
+ return contents;
452
+ };
453
+ var de_RegisterClientCommandError = async (output, context) => {
454
+ const parsedOutput = {
455
+ ...output,
456
+ body: await parseErrorBody(output.body, context)
457
+ };
458
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
459
+ switch (errorCode) {
460
+ case "InternalServerException":
461
+ case "com.amazonaws.ssooidc#InternalServerException":
462
+ throw await de_InternalServerExceptionRes(parsedOutput, context);
463
+ case "InvalidClientMetadataException":
464
+ case "com.amazonaws.ssooidc#InvalidClientMetadataException":
465
+ throw await de_InvalidClientMetadataExceptionRes(parsedOutput, context);
466
+ case "InvalidRequestException":
467
+ case "com.amazonaws.ssooidc#InvalidRequestException":
468
+ throw await de_InvalidRequestExceptionRes(parsedOutput, context);
469
+ case "InvalidScopeException":
470
+ case "com.amazonaws.ssooidc#InvalidScopeException":
471
+ throw await de_InvalidScopeExceptionRes(parsedOutput, context);
472
+ default:
473
+ const parsedBody = parsedOutput.body;
474
+ return throwDefaultError({
475
+ output,
476
+ parsedBody,
477
+ errorCode
478
+ });
479
+ }
480
+ };
481
+ var de_StartDeviceAuthorizationCommand = async (output, context) => {
482
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
483
+ return de_StartDeviceAuthorizationCommandError(output, context);
484
+ }
485
+ const contents = map({
486
+ $metadata: deserializeMetadata(output)
487
+ });
488
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
489
+ const doc = take(data, {
490
+ deviceCode: __expectString,
491
+ expiresIn: __expectInt32,
492
+ interval: __expectInt32,
493
+ userCode: __expectString,
494
+ verificationUri: __expectString,
495
+ verificationUriComplete: __expectString
496
+ });
497
+ Object.assign(contents, doc);
498
+ return contents;
499
+ };
500
+ var de_StartDeviceAuthorizationCommandError = async (output, context) => {
501
+ const parsedOutput = {
502
+ ...output,
503
+ body: await parseErrorBody(output.body, context)
504
+ };
505
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
506
+ switch (errorCode) {
507
+ case "InternalServerException":
508
+ case "com.amazonaws.ssooidc#InternalServerException":
509
+ throw await de_InternalServerExceptionRes(parsedOutput, context);
510
+ case "InvalidClientException":
511
+ case "com.amazonaws.ssooidc#InvalidClientException":
512
+ throw await de_InvalidClientExceptionRes(parsedOutput, context);
513
+ case "InvalidRequestException":
514
+ case "com.amazonaws.ssooidc#InvalidRequestException":
515
+ throw await de_InvalidRequestExceptionRes(parsedOutput, context);
516
+ case "SlowDownException":
517
+ case "com.amazonaws.ssooidc#SlowDownException":
518
+ throw await de_SlowDownExceptionRes(parsedOutput, context);
519
+ case "UnauthorizedClientException":
520
+ case "com.amazonaws.ssooidc#UnauthorizedClientException":
521
+ throw await de_UnauthorizedClientExceptionRes(parsedOutput, context);
522
+ default:
523
+ const parsedBody = parsedOutput.body;
524
+ return throwDefaultError({
525
+ output,
526
+ parsedBody,
527
+ errorCode
528
+ });
529
+ }
530
+ };
470
531
  var throwDefaultError = withBaseException(SSOOIDCServiceException);
471
532
  var de_AccessDeniedExceptionRes = async (parsedOutput, context) => {
472
533
  const contents = map({});
@@ -538,6 +599,20 @@ var de_InvalidClientExceptionRes = async (parsedOutput, context) => {
538
599
  });
539
600
  return __decorateServiceException(exception, parsedOutput.body);
540
601
  };
602
+ var de_InvalidClientMetadataExceptionRes = async (parsedOutput, context) => {
603
+ const contents = map({});
604
+ const data = parsedOutput.body;
605
+ const doc = take(data, {
606
+ error: __expectString,
607
+ error_description: __expectString
608
+ });
609
+ Object.assign(contents, doc);
610
+ const exception = new InvalidClientMetadataException({
611
+ $metadata: deserializeMetadata(parsedOutput),
612
+ ...contents
613
+ });
614
+ return __decorateServiceException(exception, parsedOutput.body);
615
+ };
541
616
  var de_InvalidGrantExceptionRes = async (parsedOutput, context) => {
542
617
  const contents = map({});
543
618
  const data = parsedOutput.body;
@@ -706,4 +781,92 @@ var CreateTokenCommand = class _CreateTokenCommand extends $Command {
706
781
  return de_CreateTokenCommand(output, context);
707
782
  }
708
783
  };
784
+ import { getEndpointPlugin as getEndpointPlugin2 } from "@smithy/middleware-endpoint";
785
+ import { getSerdePlugin as getSerdePlugin2 } from "@smithy/middleware-serde";
786
+ import { Command as $Command2 } from "@smithy/smithy-client";
787
+ var RegisterClientCommand = class _RegisterClientCommand extends $Command2 {
788
+ constructor(input) {
789
+ super();
790
+ this.input = input;
791
+ }
792
+ static getEndpointParameterInstructions() {
793
+ return {
794
+ UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" },
795
+ Endpoint: { type: "builtInParams", name: "endpoint" },
796
+ Region: { type: "builtInParams", name: "region" },
797
+ UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" }
798
+ };
799
+ }
800
+ resolveMiddleware(clientStack, configuration, options) {
801
+ this.middlewareStack.use(getSerdePlugin2(configuration, this.serialize, this.deserialize));
802
+ this.middlewareStack.use(getEndpointPlugin2(configuration, _RegisterClientCommand.getEndpointParameterInstructions()));
803
+ const stack = clientStack.concat(this.middlewareStack);
804
+ const { logger } = configuration;
805
+ const clientName = "SSOOIDCClient";
806
+ const commandName = "RegisterClientCommand";
807
+ const handlerExecutionContext = {
808
+ logger,
809
+ clientName,
810
+ commandName,
811
+ inputFilterSensitiveLog: (_) => _,
812
+ outputFilterSensitiveLog: (_) => _
813
+ };
814
+ const { requestHandler } = configuration;
815
+ return stack.resolve((request) => requestHandler.handle(request.request, options || {}), handlerExecutionContext);
816
+ }
817
+ serialize(input, context) {
818
+ return se_RegisterClientCommand(input, context);
819
+ }
820
+ deserialize(output, context) {
821
+ return de_RegisterClientCommand(output, context);
822
+ }
823
+ };
824
+ import { getEndpointPlugin as getEndpointPlugin3 } from "@smithy/middleware-endpoint";
825
+ import { getSerdePlugin as getSerdePlugin3 } from "@smithy/middleware-serde";
826
+ import { Command as $Command3 } from "@smithy/smithy-client";
827
+ var StartDeviceAuthorizationCommand = class _StartDeviceAuthorizationCommand extends $Command3 {
828
+ constructor(input) {
829
+ super();
830
+ this.input = input;
831
+ }
832
+ static getEndpointParameterInstructions() {
833
+ return {
834
+ UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" },
835
+ Endpoint: { type: "builtInParams", name: "endpoint" },
836
+ Region: { type: "builtInParams", name: "region" },
837
+ UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" }
838
+ };
839
+ }
840
+ resolveMiddleware(clientStack, configuration, options) {
841
+ this.middlewareStack.use(getSerdePlugin3(configuration, this.serialize, this.deserialize));
842
+ this.middlewareStack.use(getEndpointPlugin3(configuration, _StartDeviceAuthorizationCommand.getEndpointParameterInstructions()));
843
+ const stack = clientStack.concat(this.middlewareStack);
844
+ const { logger } = configuration;
845
+ const clientName = "SSOOIDCClient";
846
+ const commandName = "StartDeviceAuthorizationCommand";
847
+ const handlerExecutionContext = {
848
+ logger,
849
+ clientName,
850
+ commandName,
851
+ inputFilterSensitiveLog: (_) => _,
852
+ outputFilterSensitiveLog: (_) => _
853
+ };
854
+ const { requestHandler } = configuration;
855
+ return stack.resolve((request) => requestHandler.handle(request.request, options || {}), handlerExecutionContext);
856
+ }
857
+ serialize(input, context) {
858
+ return se_StartDeviceAuthorizationCommand(input, context);
859
+ }
860
+ deserialize(output, context) {
861
+ return de_StartDeviceAuthorizationCommand(output, context);
862
+ }
863
+ };
864
+ var commands = {
865
+ CreateTokenCommand,
866
+ RegisterClientCommand,
867
+ StartDeviceAuthorizationCommand
868
+ };
869
+ var SSOOIDC = class extends SSOOIDCClient {
870
+ };
871
+ createAggregatedClient(commands, SSOOIDC);
709
872
  export { AccessDeniedException, AuthorizationPendingException, CreateTokenCommand, ExpiredTokenException, InternalServerException, InvalidClientException, InvalidRequestException, InvalidScopeException, SSOOIDCClient, SlowDownException, UnauthorizedClientException, UnsupportedGrantTypeException };