@effect-aws/client-sts 1.3.0 → 1.9.3

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 (69) hide show
  1. package/Errors/package.json +6 -0
  2. package/STSClientInstance/package.json +6 -0
  3. package/STSService/package.json +6 -0
  4. package/STSServiceConfig/package.json +6 -0
  5. package/{lib → dist/cjs}/Errors.d.ts +6 -11
  6. package/dist/cjs/Errors.d.ts.map +1 -0
  7. package/dist/cjs/Errors.js +16 -0
  8. package/dist/cjs/Errors.js.map +1 -0
  9. package/dist/cjs/STSClientInstance.d.ts +24 -0
  10. package/dist/cjs/STSClientInstance.d.ts.map +1 -0
  11. package/dist/cjs/STSClientInstance.js +50 -0
  12. package/dist/cjs/STSClientInstance.js.map +1 -0
  13. package/dist/cjs/STSService.d.ts +77 -0
  14. package/dist/cjs/STSService.d.ts.map +1 -0
  15. package/dist/cjs/STSService.js +68 -0
  16. package/dist/cjs/STSService.js.map +1 -0
  17. package/dist/cjs/STSServiceConfig.d.ts +25 -0
  18. package/dist/cjs/STSServiceConfig.d.ts.map +1 -0
  19. package/dist/cjs/STSServiceConfig.js +35 -0
  20. package/dist/cjs/STSServiceConfig.js.map +1 -0
  21. package/dist/cjs/index.d.ts +39 -0
  22. package/dist/cjs/index.d.ts.map +1 -0
  23. package/dist/cjs/index.js +56 -0
  24. package/dist/cjs/index.js.map +1 -0
  25. package/dist/dts/Errors.d.ts +15 -0
  26. package/dist/dts/Errors.d.ts.map +1 -0
  27. package/dist/dts/STSClientInstance.d.ts +24 -0
  28. package/dist/dts/STSClientInstance.d.ts.map +1 -0
  29. package/dist/dts/STSService.d.ts +77 -0
  30. package/dist/dts/STSService.d.ts.map +1 -0
  31. package/dist/dts/STSServiceConfig.d.ts +25 -0
  32. package/dist/dts/STSServiceConfig.d.ts.map +1 -0
  33. package/dist/dts/index.d.ts +39 -0
  34. package/dist/dts/index.d.ts.map +1 -0
  35. package/dist/esm/Errors.js +13 -0
  36. package/dist/esm/Errors.js.map +1 -0
  37. package/dist/esm/STSClientInstance.js +23 -0
  38. package/dist/esm/STSClientInstance.js.map +1 -0
  39. package/dist/esm/STSService.js +41 -0
  40. package/dist/esm/STSService.js.map +1 -0
  41. package/dist/esm/STSServiceConfig.js +31 -0
  42. package/dist/esm/STSServiceConfig.js.map +1 -0
  43. package/dist/esm/index.js +27 -0
  44. package/dist/esm/index.js.map +1 -0
  45. package/dist/esm/package.json +4 -0
  46. package/package.json +60 -43
  47. package/src/Errors.ts +35 -0
  48. package/src/STSClientInstance.ts +33 -0
  49. package/src/STSService.ts +234 -0
  50. package/src/STSServiceConfig.ts +51 -0
  51. package/src/index.ts +44 -0
  52. package/CHANGELOG.md +0 -41
  53. package/docgen.json +0 -8
  54. package/lib/Errors.js +0 -16
  55. package/lib/STSClientInstance.d.ts +0 -31
  56. package/lib/STSClientInstance.js +0 -57
  57. package/lib/STSClientInstanceConfig.d.ts +0 -23
  58. package/lib/STSClientInstanceConfig.js +0 -44
  59. package/lib/STSService.d.ts +0 -110
  60. package/lib/STSService.js +0 -97
  61. package/lib/esm/Errors.js +0 -13
  62. package/lib/esm/STSClientInstance.js +0 -30
  63. package/lib/esm/STSClientInstanceConfig.js +0 -40
  64. package/lib/esm/STSService.js +0 -93
  65. package/lib/esm/index.js +0 -5
  66. package/lib/index.d.ts +0 -4
  67. package/lib/index.js +0 -21
  68. package/project.json +0 -77
  69. package/vitest.config.ts +0 -3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"STSService.d.ts","sourceRoot":"","sources":["../../src/STSService.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAEL,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAE5B,KAAK,8BAA8B,EACnC,KAAK,+BAA+B,EAEpC,KAAK,qCAAqC,EAC1C,KAAK,sCAAsC,EAE3C,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAE5B,KAAK,sCAAsC,EAC3C,KAAK,uCAAuC,E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,CAAC,YAAY,wCAA0E;IACtG,MAAM,CAAC,QAAQ,CAAC,KAAK,WAAY,WAAW,MAAM,2CAI9C;IACJ,MAAM,CAAC,QAAQ,CAAC,SAAS,aACb,CAAC,aAAa,EAAE,eAAe,KAAK,SAAS,2CASrD;CACL;AAED;;GAEG;AACH,MAAM,CAAC,OAAO,WAAW,UAAU,CAAC;IAClC;;OAEG;IACH,UAAiB,MAAO,SAAQ,IAAI,CAAC,eAAe,EAAE,QAAQ,CAAC;QAC7D,QAAQ,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC,6BAA6B,GAAG,IAAI,CAAC;KACtE;CACF"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @since 1.0.0
3
+ */
4
+ import type { STSClientConfig } from "@aws-sdk/client-sts";
5
+ import { Effect, Layer } from "effect";
6
+ import type { STSService } from "./STSService.js";
7
+ /**
8
+ * @since 1.0.0
9
+ * @category sts service config
10
+ */
11
+ export declare const withSTSServiceConfig: {
12
+ (config: STSService.Config): <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
13
+ <A, E, R>(effect: Effect.Effect<A, E, R>, config: STSService.Config): Effect.Effect<A, E, R>;
14
+ };
15
+ /**
16
+ * @since 1.0.0
17
+ * @category sts service config
18
+ */
19
+ export declare const setSTSServiceConfig: (config: STSService.Config) => Layer.Layer<never, never, never>;
20
+ /**
21
+ * @since 1.0.0
22
+ * @category adapters
23
+ */
24
+ export declare const toSTSClientConfig: Effect.Effect<STSClientConfig>;
25
+ //# sourceMappingURL=STSServiceConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"STSServiceConfig.d.ts","sourceRoot":"","sources":["../../src/STSServiceConfig.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D,OAAO,EAAE,MAAM,EAAY,KAAK,EAAE,MAAM,QAAQ,CAAC;AAGjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAWlD;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE;IACjC,CAAC,MAAM,EAAE,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IACjG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;CAK9F,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,WAAY,WAAW,MAAM,qCAAyD,CAAC;AAEvH;;;GAGG;AACH,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,CAAC,eAAe,CAQ3D,CAAC"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * @since 1.0.0
3
+ */
4
+ import { STSService } from "./STSService.js";
5
+ /**
6
+ * @since 1.0.0
7
+ */
8
+ export * from "./Errors.js";
9
+ /**
10
+ * @since 1.0.0
11
+ */
12
+ export * as STSClientInstance from "./STSClientInstance.js";
13
+ /**
14
+ * @since 1.0.0
15
+ */
16
+ export * as STSServiceConfig from "./STSServiceConfig.js";
17
+ /**
18
+ * @since 1.0.0
19
+ */
20
+ export * from "./STSService.js";
21
+ /**
22
+ * @since 1.0.0
23
+ * @category exports
24
+ * @alias STSService
25
+ */
26
+ export declare namespace STS {
27
+ /**
28
+ * @since 1.0.0
29
+ * @alias STSService.Config
30
+ */
31
+ type Config = STSService.Config;
32
+ }
33
+ /**
34
+ * @since 1.0.0
35
+ * @category exports
36
+ * @alias STSService
37
+ */
38
+ export declare const STS: typeof STSService;
39
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C;;GAEG;AACH,cAAc,aAAa,CAAC;AAE5B;;GAEG;AACH,OAAO,KAAK,iBAAiB,MAAM,wBAAwB,CAAC;AAE5D;;GAEG;AACH,OAAO,KAAK,gBAAgB,MAAM,uBAAuB,CAAC;AAE1D;;GAEG;AACH,cAAc,iBAAiB,CAAC;AAEhC;;;;GAIG;AACH,MAAM,CAAC,OAAO,WAAW,GAAG,CAAC;IAC3B;;;OAGG;IACH,KAAY,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;CACxC;AAED;;;;GAIG;AACH,eAAO,MAAM,GAAG,mBAAa,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { SdkError as CommonSdkError } from "@effect-aws/commons";
2
+ export const AllServiceErrors = [
3
+ "ExpiredTokenException",
4
+ "IDPCommunicationErrorException",
5
+ "IDPRejectedClaimException",
6
+ "InvalidAuthorizationMessageException",
7
+ "InvalidIdentityTokenException",
8
+ "MalformedPolicyDocumentException",
9
+ "PackedPolicyTooLargeException",
10
+ "RegionDisabledException",
11
+ ];
12
+ export const SdkError = CommonSdkError;
13
+ //# sourceMappingURL=Errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Errors.js","sourceRoot":"","sources":["../../src/Errors.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,QAAQ,IAAI,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAEjE,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,uBAAuB;IACvB,gCAAgC;IAChC,2BAA2B;IAC3B,sCAAsC;IACtC,+BAA+B;IAC/B,kCAAkC;IAClC,+BAA+B;IAC/B,yBAAyB;CACjB,CAAC;AAYX,MAAM,CAAC,MAAM,QAAQ,GAAG,cAAc,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @since 1.0.0
3
+ */
4
+ import { STSClient } from "@aws-sdk/client-sts";
5
+ import { Context, Effect, Layer } from "effect";
6
+ import * as STSServiceConfig from "./STSServiceConfig.js";
7
+ /**
8
+ * @since 1.0.0
9
+ * @category tags
10
+ */
11
+ export class STSClientInstance extends Context.Tag("@effect-aws/client-sts/STSClientInstance")() {
12
+ }
13
+ /**
14
+ * @since 1.0.0
15
+ * @category constructors
16
+ */
17
+ export const make = Effect.flatMap(STSServiceConfig.toSTSClientConfig, (config) => Effect.acquireRelease(Effect.sync(() => new STSClient(config)), (client) => Effect.sync(() => client.destroy())));
18
+ /**
19
+ * @since 1.0.0
20
+ * @category layers
21
+ */
22
+ export const layer = Layer.scoped(STSClientInstance, make);
23
+ //# sourceMappingURL=STSClientInstance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"STSClientInstance.js","sourceRoot":"","sources":["../../src/STSClientInstance.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,KAAK,gBAAgB,MAAM,uBAAuB,CAAC;AAE1D;;;GAGG;AACH,MAAM,OAAO,iBAAkB,SAAQ,OAAO,CAAC,GAAG,CAChD,0CAA0C,CAC3C,EAAgC;CAAG;AAEpC;;;GAGG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAChC,gBAAgB,CAAC,iBAAiB,EAClC,CAAC,MAAM,EAAE,EAAE,CACT,MAAM,CAAC,cAAc,CACnB,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,SAAS,CAAC,MAAM,CAAC,CAAC,EACxC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAChD,CACJ,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * @since 1.0.0
3
+ */
4
+ import { AssumeRoleCommand, AssumeRoleWithSAMLCommand, AssumeRoleWithWebIdentityCommand, AssumeRootCommand, DecodeAuthorizationMessageCommand, GetAccessKeyInfoCommand, GetCallerIdentityCommand, GetFederationTokenCommand, GetSessionTokenCommand, } from "@aws-sdk/client-sts";
5
+ import { Service } from "@effect-aws/commons";
6
+ import { Effect, Layer } from "effect";
7
+ import { AllServiceErrors } from "./Errors.js";
8
+ import * as Instance from "./STSClientInstance.js";
9
+ import * as STSServiceConfig from "./STSServiceConfig.js";
10
+ const commands = {
11
+ AssumeRoleCommand,
12
+ AssumeRoleWithSAMLCommand,
13
+ AssumeRoleWithWebIdentityCommand,
14
+ AssumeRootCommand,
15
+ DecodeAuthorizationMessageCommand,
16
+ GetAccessKeyInfoCommand,
17
+ GetCallerIdentityCommand,
18
+ GetFederationTokenCommand,
19
+ GetSessionTokenCommand,
20
+ };
21
+ /**
22
+ * @since 1.0.0
23
+ * @category constructors
24
+ */
25
+ export const makeSTSService = Effect.gen(function* () {
26
+ const client = yield* Instance.STSClientInstance;
27
+ return Service.fromClientAndCommands(client, commands, {
28
+ errorTags: AllServiceErrors,
29
+ resolveClientConfig: STSServiceConfig.toSTSClientConfig,
30
+ });
31
+ });
32
+ /**
33
+ * @since 1.0.0
34
+ * @category models
35
+ */
36
+ export class STSService extends Effect.Tag("@effect-aws/client-sts/STSService")() {
37
+ static defaultLayer = Layer.effect(this, makeSTSService).pipe(Layer.provide(Instance.layer));
38
+ static layer = (config) => Layer.effect(this, makeSTSService).pipe(Layer.provide(Instance.layer), Layer.provide(STSServiceConfig.setSTSServiceConfig(config)));
39
+ static baseLayer = (evaluate) => Layer.effect(this, makeSTSService).pipe(Layer.provide(Layer.effect(Instance.STSClientInstance, Effect.map(STSServiceConfig.toSTSClientConfig, evaluate))));
40
+ }
41
+ //# sourceMappingURL=STSService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"STSService.js","sourceRoot":"","sources":["../../src/STSService.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EACL,iBAAiB,EAGjB,yBAAyB,EAGzB,gCAAgC,EAGhC,iBAAiB,EAGjB,iCAAiC,EAGjC,uBAAuB,EAGvB,wBAAwB,EAGxB,yBAAyB,EAGzB,sBAAsB,GAKvB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAWvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,QAAQ,MAAM,wBAAwB,CAAC;AACnD,OAAO,KAAK,gBAAgB,MAAM,uBAAuB,CAAC;AAE1D,MAAM,QAAQ,GAAG;IACf,iBAAiB;IACjB,yBAAyB;IACzB,gCAAgC;IAChC,iBAAiB;IACjB,iCAAiC;IACjC,uBAAuB;IACvB,wBAAwB;IACxB,yBAAyB;IACzB,sBAAsB;CACvB,CAAC;AAsHF;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAChD,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,QAAQ,CAAC,iBAAiB,CAAC;IAEjD,OAAO,OAAO,CAAC,qBAAqB,CAClC,MAAM,EACN,QAAQ,EACR;QACE,SAAS,EAAE,gBAAgB;QAC3B,mBAAmB,EAAE,gBAAgB,CAAC,iBAAiB;KACxD,CACF,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,OAAO,UAAW,SAAQ,MAAM,CAAC,GAAG,CAAC,mCAAmC,CAAC,EAG5E;IACD,MAAM,CAAU,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;IACtG,MAAM,CAAU,KAAK,GAAG,CAAC,MAAyB,EAAE,EAAE,CACpD,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC,IAAI,CACrC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,EAC7B,KAAK,CAAC,OAAO,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAC5D,CAAC;IACJ,MAAM,CAAU,SAAS,GAAG,CAC1B,QAAuD,EACvD,EAAE,CACF,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC,IAAI,CACrC,KAAK,CAAC,OAAO,CACX,KAAK,CAAC,MAAM,CACV,QAAQ,CAAC,iBAAiB,EAC1B,MAAM,CAAC,GAAG,CAAC,gBAAgB,CAAC,iBAAiB,EAAE,QAAQ,CAAC,CACzD,CACF,CACF,CAAC"}
@@ -0,0 +1,31 @@
1
+ import { ServiceLogger } from "@effect-aws/commons";
2
+ import { Effect, FiberRef, Layer } from "effect";
3
+ import { dual } from "effect/Function";
4
+ import { globalValue } from "effect/GlobalValue";
5
+ /**
6
+ * @since 1.0.0
7
+ * @category sts service config
8
+ */
9
+ const currentSTSServiceConfig = globalValue("@effect-aws/client-sts/currentSTSServiceConfig", () => FiberRef.unsafeMake({}));
10
+ /**
11
+ * @since 1.0.0
12
+ * @category sts service config
13
+ */
14
+ export const withSTSServiceConfig = dual(2, (effect, config) => Effect.locally(effect, currentSTSServiceConfig, config));
15
+ /**
16
+ * @since 1.0.0
17
+ * @category sts service config
18
+ */
19
+ export const setSTSServiceConfig = (config) => Layer.locallyScoped(currentSTSServiceConfig, config);
20
+ /**
21
+ * @since 1.0.0
22
+ * @category adapters
23
+ */
24
+ export const toSTSClientConfig = Effect.gen(function* () {
25
+ const { logger: serviceLogger, ...config } = yield* FiberRef.get(currentSTSServiceConfig);
26
+ const logger = serviceLogger === true
27
+ ? yield* ServiceLogger.toClientLogger(ServiceLogger.defaultServiceLogger)
28
+ : (serviceLogger ? yield* ServiceLogger.toClientLogger(ServiceLogger.make(serviceLogger)) : undefined);
29
+ return { logger, ...config };
30
+ });
31
+ //# sourceMappingURL=STSServiceConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"STSServiceConfig.js","sourceRoot":"","sources":["../../src/STSServiceConfig.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGjD;;;GAGG;AACH,MAAM,uBAAuB,GAAG,WAAW,CACzC,gDAAgD,EAChD,GAAG,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAoB,EAAE,CAAC,CACjD,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAG7B,IAAI,CACN,CAAC,EACD,CAAU,MAA8B,EAAE,MAAyB,EAA0B,EAAE,CAC7F,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,uBAAuB,EAAE,MAAM,CAAC,CAC1D,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,MAAyB,EAAE,EAAE,CAAC,KAAK,CAAC,aAAa,CAAC,uBAAuB,EAAE,MAAM,CAAC,CAAC;AAEvH;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAmC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IACnF,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;IAE1F,MAAM,MAAM,GAAG,aAAa,KAAK,IAAI;QACnC,CAAC,CAAC,KAAK,CAAC,CAAC,aAAa,CAAC,cAAc,CAAC,aAAa,CAAC,oBAAoB,CAAC;QACzE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,aAAa,CAAC,cAAc,CAAC,aAAa,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAEzG,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;AAC/B,CAAC,CAAC,CAAC"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * @since 1.0.0
3
+ */
4
+ import { STSService } from "./STSService.js";
5
+ /**
6
+ * @since 1.0.0
7
+ */
8
+ export * from "./Errors.js";
9
+ /**
10
+ * @since 1.0.0
11
+ */
12
+ export * as STSClientInstance from "./STSClientInstance.js";
13
+ /**
14
+ * @since 1.0.0
15
+ */
16
+ export * as STSServiceConfig from "./STSServiceConfig.js";
17
+ /**
18
+ * @since 1.0.0
19
+ */
20
+ export * from "./STSService.js";
21
+ /**
22
+ * @since 1.0.0
23
+ * @category exports
24
+ * @alias STSService
25
+ */
26
+ export const STS = STSService;
27
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C;;GAEG;AACH,cAAc,aAAa,CAAC;AAE5B;;GAEG;AACH,OAAO,KAAK,iBAAiB,MAAM,wBAAwB,CAAC;AAE5D;;GAEG;AACH,OAAO,KAAK,gBAAgB,MAAM,uBAAuB,CAAC;AAE1D;;GAEG;AACH,cAAc,iBAAiB,CAAC;AAehC;;;;GAIG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG,UAAU,CAAC"}
@@ -0,0 +1,4 @@
1
+ {
2
+ "type": "module",
3
+ "sideEffects": []
4
+ }
package/package.json CHANGED
@@ -1,54 +1,71 @@
1
1
  {
2
2
  "name": "@effect-aws/client-sts",
3
+ "version": "1.9.3",
4
+ "description": "Effectful AWS STS client",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "github:floydspace/effect-aws",
9
+ "directory": "packages/client-sts"
10
+ },
11
+ "sideEffects": [],
3
12
  "author": {
4
13
  "name": "Victor Korzunin",
5
- "email": "ifloydrose@gmail.com",
6
- "organization": false
14
+ "email": "ifloydrose@gmail.com"
7
15
  },
8
- "devDependencies": {
9
- "@types/node": "^18",
10
- "@typescript-eslint/eslint-plugin": "^7",
11
- "@typescript-eslint/parser": "^7",
12
- "aws-sdk-client-mock": "^4.0.2",
13
- "aws-sdk-client-mock-vitest": "^4.0.0",
14
- "effect": "3.0.0",
15
- "eslint": "^8",
16
- "eslint-config-prettier": "^9.1.0",
17
- "eslint-import-resolver-typescript": "^3.6.1",
18
- "eslint-plugin-import": "^2.29.1",
19
- "eslint-plugin-prettier": "^5.2.1",
20
- "prettier": "^3.2.5",
21
- "typescript": "^5.4.2",
22
- "vitest": "^2.0.5"
16
+ "homepage": "https://floydspace.github.io/effect-aws/docs/client-sts",
17
+ "dependencies": {
18
+ "@aws-sdk/client-sts": "^3",
19
+ "@effect-aws/commons": "^0.2.0"
23
20
  },
24
21
  "peerDependencies": {
25
- "effect": ">=3.0.0 <4.0.0"
22
+ "effect": ">=3.0.4 <4.0.0"
26
23
  },
27
- "dependencies": {
28
- "@aws-sdk/client-sts": "^3"
29
- },
30
- "main": "lib/index.js",
31
- "license": "MIT",
32
- "homepage": "https://floydspace.github.io/effect-aws",
33
- "publishConfig": {
34
- "access": "public"
24
+ "main": "./dist/cjs/index.js",
25
+ "module": "./dist/esm/index.js",
26
+ "types": "./dist/dts/index.d.ts",
27
+ "exports": {
28
+ "./package.json": "./package.json",
29
+ ".": {
30
+ "types": "./dist/dts/index.d.ts",
31
+ "import": "./dist/esm/index.js",
32
+ "default": "./dist/cjs/index.js"
33
+ },
34
+ "./Errors": {
35
+ "types": "./dist/dts/Errors.d.ts",
36
+ "import": "./dist/esm/Errors.js",
37
+ "default": "./dist/cjs/Errors.js"
38
+ },
39
+ "./STSClientInstance": {
40
+ "types": "./dist/dts/STSClientInstance.d.ts",
41
+ "import": "./dist/esm/STSClientInstance.js",
42
+ "default": "./dist/cjs/STSClientInstance.js"
43
+ },
44
+ "./STSService": {
45
+ "types": "./dist/dts/STSService.d.ts",
46
+ "import": "./dist/esm/STSService.js",
47
+ "default": "./dist/cjs/STSService.js"
48
+ },
49
+ "./STSServiceConfig": {
50
+ "types": "./dist/dts/STSServiceConfig.d.ts",
51
+ "import": "./dist/esm/STSServiceConfig.js",
52
+ "default": "./dist/cjs/STSServiceConfig.js"
53
+ }
35
54
  },
36
- "version": "1.3.0",
37
- "types": "lib/index.d.ts",
38
- "module": "lib/esm/index.js",
39
- "sideEffects": [],
40
- "//": "~~ Generated by projen. To modify, edit .projenrc.js and run \"npx projen\".",
41
- "scripts": {
42
- "build": "npx projen build",
43
- "compile": "npx projen compile",
44
- "default": "npx projen default",
45
- "eslint": "npx projen eslint",
46
- "package": "npx projen package",
47
- "post-compile": "npx projen post-compile",
48
- "pre-compile": "npx projen pre-compile",
49
- "test": "npx projen test",
50
- "test:watch": "npx projen test:watch",
51
- "watch": "npx projen watch",
52
- "docgen": "docgen"
55
+ "typesVersions": {
56
+ "*": {
57
+ "Errors": [
58
+ "./dist/dts/Errors.d.ts"
59
+ ],
60
+ "STSClientInstance": [
61
+ "./dist/dts/STSClientInstance.d.ts"
62
+ ],
63
+ "STSService": [
64
+ "./dist/dts/STSService.d.ts"
65
+ ],
66
+ "STSServiceConfig": [
67
+ "./dist/dts/STSServiceConfig.d.ts"
68
+ ]
69
+ }
53
70
  }
54
71
  }
package/src/Errors.ts ADDED
@@ -0,0 +1,35 @@
1
+ import type {
2
+ ExpiredTokenException,
3
+ IDPCommunicationErrorException,
4
+ IDPRejectedClaimException,
5
+ InvalidAuthorizationMessageException,
6
+ InvalidIdentityTokenException,
7
+ MalformedPolicyDocumentException,
8
+ PackedPolicyTooLargeException,
9
+ RegionDisabledException,
10
+ } from "@aws-sdk/client-sts";
11
+ import type { TaggedException } from "@effect-aws/commons";
12
+ import { SdkError as CommonSdkError } from "@effect-aws/commons";
13
+
14
+ export const AllServiceErrors = [
15
+ "ExpiredTokenException",
16
+ "IDPCommunicationErrorException",
17
+ "IDPRejectedClaimException",
18
+ "InvalidAuthorizationMessageException",
19
+ "InvalidIdentityTokenException",
20
+ "MalformedPolicyDocumentException",
21
+ "PackedPolicyTooLargeException",
22
+ "RegionDisabledException",
23
+ ] as const;
24
+
25
+ export type ExpiredTokenError = TaggedException<ExpiredTokenException>;
26
+ export type IDPCommunicationError = TaggedException<IDPCommunicationErrorException>;
27
+ export type IDPRejectedClaimError = TaggedException<IDPRejectedClaimException>;
28
+ export type InvalidAuthorizationMessageError = TaggedException<InvalidAuthorizationMessageException>;
29
+ export type InvalidIdentityTokenError = TaggedException<InvalidIdentityTokenException>;
30
+ export type MalformedPolicyDocumentError = TaggedException<MalformedPolicyDocumentException>;
31
+ export type PackedPolicyTooLargeError = TaggedException<PackedPolicyTooLargeException>;
32
+ export type RegionDisabledError = TaggedException<RegionDisabledException>;
33
+
34
+ export type SdkError = CommonSdkError;
35
+ export const SdkError = CommonSdkError;
@@ -0,0 +1,33 @@
1
+ /**
2
+ * @since 1.0.0
3
+ */
4
+ import { STSClient } from "@aws-sdk/client-sts";
5
+ import { Context, Effect, Layer } from "effect";
6
+ import * as STSServiceConfig from "./STSServiceConfig.js";
7
+
8
+ /**
9
+ * @since 1.0.0
10
+ * @category tags
11
+ */
12
+ export class STSClientInstance extends Context.Tag(
13
+ "@effect-aws/client-sts/STSClientInstance",
14
+ )<STSClientInstance, STSClient>() {}
15
+
16
+ /**
17
+ * @since 1.0.0
18
+ * @category constructors
19
+ */
20
+ export const make = Effect.flatMap(
21
+ STSServiceConfig.toSTSClientConfig,
22
+ (config) =>
23
+ Effect.acquireRelease(
24
+ Effect.sync(() => new STSClient(config)),
25
+ (client) => Effect.sync(() => client.destroy()),
26
+ ),
27
+ );
28
+
29
+ /**
30
+ * @since 1.0.0
31
+ * @category layers
32
+ */
33
+ export const layer = Layer.scoped(STSClientInstance, make);
@@ -0,0 +1,234 @@
1
+ /**
2
+ * @since 1.0.0
3
+ */
4
+ import {
5
+ AssumeRoleCommand,
6
+ type AssumeRoleCommandInput,
7
+ type AssumeRoleCommandOutput,
8
+ AssumeRoleWithSAMLCommand,
9
+ type AssumeRoleWithSAMLCommandInput,
10
+ type AssumeRoleWithSAMLCommandOutput,
11
+ AssumeRoleWithWebIdentityCommand,
12
+ type AssumeRoleWithWebIdentityCommandInput,
13
+ type AssumeRoleWithWebIdentityCommandOutput,
14
+ AssumeRootCommand,
15
+ type AssumeRootCommandInput,
16
+ type AssumeRootCommandOutput,
17
+ DecodeAuthorizationMessageCommand,
18
+ type DecodeAuthorizationMessageCommandInput,
19
+ type DecodeAuthorizationMessageCommandOutput,
20
+ GetAccessKeyInfoCommand,
21
+ type GetAccessKeyInfoCommandInput,
22
+ type GetAccessKeyInfoCommandOutput,
23
+ GetCallerIdentityCommand,
24
+ type GetCallerIdentityCommandInput,
25
+ type GetCallerIdentityCommandOutput,
26
+ GetFederationTokenCommand,
27
+ type GetFederationTokenCommandInput,
28
+ type GetFederationTokenCommandOutput,
29
+ GetSessionTokenCommand,
30
+ type GetSessionTokenCommandInput,
31
+ type GetSessionTokenCommandOutput,
32
+ type STSClient,
33
+ type STSClientConfig,
34
+ } from "@aws-sdk/client-sts";
35
+ import type { HttpHandlerOptions, SdkError, ServiceLogger } from "@effect-aws/commons";
36
+ import { Service } from "@effect-aws/commons";
37
+ import { Effect, Layer } from "effect";
38
+ import type {
39
+ ExpiredTokenError,
40
+ IDPCommunicationError,
41
+ IDPRejectedClaimError,
42
+ InvalidAuthorizationMessageError,
43
+ InvalidIdentityTokenError,
44
+ MalformedPolicyDocumentError,
45
+ PackedPolicyTooLargeError,
46
+ RegionDisabledError,
47
+ } from "./Errors.js";
48
+ import { AllServiceErrors } from "./Errors.js";
49
+ import * as Instance from "./STSClientInstance.js";
50
+ import * as STSServiceConfig from "./STSServiceConfig.js";
51
+
52
+ const commands = {
53
+ AssumeRoleCommand,
54
+ AssumeRoleWithSAMLCommand,
55
+ AssumeRoleWithWebIdentityCommand,
56
+ AssumeRootCommand,
57
+ DecodeAuthorizationMessageCommand,
58
+ GetAccessKeyInfoCommand,
59
+ GetCallerIdentityCommand,
60
+ GetFederationTokenCommand,
61
+ GetSessionTokenCommand,
62
+ };
63
+
64
+ interface STSService$ {
65
+ readonly _: unique symbol;
66
+
67
+ /**
68
+ * @see {@link AssumeRoleCommand}
69
+ */
70
+ assumeRole(
71
+ args: AssumeRoleCommandInput,
72
+ options?: HttpHandlerOptions,
73
+ ): Effect.Effect<
74
+ AssumeRoleCommandOutput,
75
+ SdkError | ExpiredTokenError | MalformedPolicyDocumentError | PackedPolicyTooLargeError | RegionDisabledError
76
+ >;
77
+
78
+ /**
79
+ * @see {@link AssumeRoleWithSAMLCommand}
80
+ */
81
+ assumeRoleWithSAML(
82
+ args: AssumeRoleWithSAMLCommandInput,
83
+ options?: HttpHandlerOptions,
84
+ ): Effect.Effect<
85
+ AssumeRoleWithSAMLCommandOutput,
86
+ | SdkError
87
+ | ExpiredTokenError
88
+ | IDPRejectedClaimError
89
+ | InvalidIdentityTokenError
90
+ | MalformedPolicyDocumentError
91
+ | PackedPolicyTooLargeError
92
+ | RegionDisabledError
93
+ >;
94
+
95
+ /**
96
+ * @see {@link AssumeRoleWithWebIdentityCommand}
97
+ */
98
+ assumeRoleWithWebIdentity(
99
+ args: AssumeRoleWithWebIdentityCommandInput,
100
+ options?: HttpHandlerOptions,
101
+ ): Effect.Effect<
102
+ AssumeRoleWithWebIdentityCommandOutput,
103
+ | SdkError
104
+ | ExpiredTokenError
105
+ | IDPCommunicationError
106
+ | IDPRejectedClaimError
107
+ | InvalidIdentityTokenError
108
+ | MalformedPolicyDocumentError
109
+ | PackedPolicyTooLargeError
110
+ | RegionDisabledError
111
+ >;
112
+
113
+ /**
114
+ * @see {@link AssumeRootCommand}
115
+ */
116
+ assumeRoot(
117
+ args: AssumeRootCommandInput,
118
+ options?: HttpHandlerOptions,
119
+ ): Effect.Effect<
120
+ AssumeRootCommandOutput,
121
+ SdkError | ExpiredTokenError | RegionDisabledError
122
+ >;
123
+
124
+ /**
125
+ * @see {@link DecodeAuthorizationMessageCommand}
126
+ */
127
+ decodeAuthorizationMessage(
128
+ args: DecodeAuthorizationMessageCommandInput,
129
+ options?: HttpHandlerOptions,
130
+ ): Effect.Effect<
131
+ DecodeAuthorizationMessageCommandOutput,
132
+ SdkError | InvalidAuthorizationMessageError
133
+ >;
134
+
135
+ /**
136
+ * @see {@link GetAccessKeyInfoCommand}
137
+ */
138
+ getAccessKeyInfo(
139
+ args: GetAccessKeyInfoCommandInput,
140
+ options?: HttpHandlerOptions,
141
+ ): Effect.Effect<
142
+ GetAccessKeyInfoCommandOutput,
143
+ SdkError
144
+ >;
145
+
146
+ /**
147
+ * @see {@link GetCallerIdentityCommand}
148
+ */
149
+ getCallerIdentity(
150
+ args: GetCallerIdentityCommandInput,
151
+ options?: HttpHandlerOptions,
152
+ ): Effect.Effect<
153
+ GetCallerIdentityCommandOutput,
154
+ SdkError
155
+ >;
156
+
157
+ /**
158
+ * @see {@link GetFederationTokenCommand}
159
+ */
160
+ getFederationToken(
161
+ args: GetFederationTokenCommandInput,
162
+ options?: HttpHandlerOptions,
163
+ ): Effect.Effect<
164
+ GetFederationTokenCommandOutput,
165
+ SdkError | MalformedPolicyDocumentError | PackedPolicyTooLargeError | RegionDisabledError
166
+ >;
167
+
168
+ /**
169
+ * @see {@link GetSessionTokenCommand}
170
+ */
171
+ getSessionToken(
172
+ args: GetSessionTokenCommandInput,
173
+ options?: HttpHandlerOptions,
174
+ ): Effect.Effect<
175
+ GetSessionTokenCommandOutput,
176
+ SdkError | RegionDisabledError
177
+ >;
178
+ }
179
+
180
+ /**
181
+ * @since 1.0.0
182
+ * @category constructors
183
+ */
184
+ export const makeSTSService = Effect.gen(function*() {
185
+ const client = yield* Instance.STSClientInstance;
186
+
187
+ return Service.fromClientAndCommands<STSService$>(
188
+ client,
189
+ commands,
190
+ {
191
+ errorTags: AllServiceErrors,
192
+ resolveClientConfig: STSServiceConfig.toSTSClientConfig,
193
+ },
194
+ );
195
+ });
196
+
197
+ /**
198
+ * @since 1.0.0
199
+ * @category models
200
+ */
201
+ export class STSService extends Effect.Tag("@effect-aws/client-sts/STSService")<
202
+ STSService,
203
+ STSService$
204
+ >() {
205
+ static readonly defaultLayer = Layer.effect(this, makeSTSService).pipe(Layer.provide(Instance.layer));
206
+ static readonly layer = (config: STSService.Config) =>
207
+ Layer.effect(this, makeSTSService).pipe(
208
+ Layer.provide(Instance.layer),
209
+ Layer.provide(STSServiceConfig.setSTSServiceConfig(config)),
210
+ );
211
+ static readonly baseLayer = (
212
+ evaluate: (defaultConfig: STSClientConfig) => STSClient,
213
+ ) =>
214
+ Layer.effect(this, makeSTSService).pipe(
215
+ Layer.provide(
216
+ Layer.effect(
217
+ Instance.STSClientInstance,
218
+ Effect.map(STSServiceConfig.toSTSClientConfig, evaluate),
219
+ ),
220
+ ),
221
+ );
222
+ }
223
+
224
+ /**
225
+ * @since 1.0.0
226
+ */
227
+ export declare namespace STSService {
228
+ /**
229
+ * @since 1.0.0
230
+ */
231
+ export interface Config extends Omit<STSClientConfig, "logger"> {
232
+ readonly logger?: ServiceLogger.ServiceLoggerConstructorProps | true;
233
+ }
234
+ }