@effect-aws/client-api-gateway 1.10.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.
Files changed (53) hide show
  1. package/APIGatewayClientInstance/package.json +6 -0
  2. package/APIGatewayService/package.json +6 -0
  3. package/APIGatewayServiceConfig/package.json +6 -0
  4. package/Errors/package.json +6 -0
  5. package/LICENSE +19 -0
  6. package/README.md +58 -0
  7. package/dist/cjs/APIGatewayClientInstance.d.ts +24 -0
  8. package/dist/cjs/APIGatewayClientInstance.d.ts.map +1 -0
  9. package/dist/cjs/APIGatewayClientInstance.js +50 -0
  10. package/dist/cjs/APIGatewayClientInstance.js.map +1 -0
  11. package/dist/cjs/APIGatewayService.d.ts +538 -0
  12. package/dist/cjs/APIGatewayService.d.ts.map +1 -0
  13. package/dist/cjs/APIGatewayService.js +183 -0
  14. package/dist/cjs/APIGatewayService.js.map +1 -0
  15. package/dist/cjs/APIGatewayServiceConfig.d.ts +25 -0
  16. package/dist/cjs/APIGatewayServiceConfig.d.ts.map +1 -0
  17. package/dist/cjs/APIGatewayServiceConfig.js +35 -0
  18. package/dist/cjs/APIGatewayServiceConfig.js.map +1 -0
  19. package/dist/cjs/Errors.d.ts +14 -0
  20. package/dist/cjs/Errors.d.ts.map +1 -0
  21. package/dist/cjs/Errors.js +15 -0
  22. package/dist/cjs/Errors.js.map +1 -0
  23. package/dist/cjs/index.d.ts +39 -0
  24. package/dist/cjs/index.d.ts.map +1 -0
  25. package/dist/cjs/index.js +56 -0
  26. package/dist/cjs/index.js.map +1 -0
  27. package/dist/dts/APIGatewayClientInstance.d.ts +24 -0
  28. package/dist/dts/APIGatewayClientInstance.d.ts.map +1 -0
  29. package/dist/dts/APIGatewayService.d.ts +538 -0
  30. package/dist/dts/APIGatewayService.d.ts.map +1 -0
  31. package/dist/dts/APIGatewayServiceConfig.d.ts +25 -0
  32. package/dist/dts/APIGatewayServiceConfig.d.ts.map +1 -0
  33. package/dist/dts/Errors.d.ts +14 -0
  34. package/dist/dts/Errors.d.ts.map +1 -0
  35. package/dist/dts/index.d.ts +39 -0
  36. package/dist/dts/index.d.ts.map +1 -0
  37. package/dist/esm/APIGatewayClientInstance.js +23 -0
  38. package/dist/esm/APIGatewayClientInstance.js.map +1 -0
  39. package/dist/esm/APIGatewayService.js +156 -0
  40. package/dist/esm/APIGatewayService.js.map +1 -0
  41. package/dist/esm/APIGatewayServiceConfig.js +31 -0
  42. package/dist/esm/APIGatewayServiceConfig.js.map +1 -0
  43. package/dist/esm/Errors.js +12 -0
  44. package/dist/esm/Errors.js.map +1 -0
  45. package/dist/esm/index.js +27 -0
  46. package/dist/esm/index.js.map +1 -0
  47. package/dist/esm/package.json +4 -0
  48. package/package.json +71 -0
  49. package/src/APIGatewayClientInstance.ts +33 -0
  50. package/src/APIGatewayService.ts +2479 -0
  51. package/src/APIGatewayServiceConfig.ts +52 -0
  52. package/src/Errors.ts +32 -0
  53. package/src/index.ts +44 -0
@@ -0,0 +1,52 @@
1
+ /**
2
+ * @since 1.0.0
3
+ */
4
+ import type { APIGatewayClientConfig } from "@aws-sdk/client-api-gateway";
5
+ import { ServiceLogger } from "@effect-aws/commons";
6
+ import { Effect, FiberRef, Layer } from "effect";
7
+ import { dual } from "effect/Function";
8
+ import { globalValue } from "effect/GlobalValue";
9
+ import type { APIGatewayService } from "./APIGatewayService.js";
10
+
11
+ /**
12
+ * @since 1.0.0
13
+ * @category api-gateway service config
14
+ */
15
+ const currentAPIGatewayServiceConfig = globalValue(
16
+ "@effect-aws/client-api-gateway/currentAPIGatewayServiceConfig",
17
+ () => FiberRef.unsafeMake<APIGatewayService.Config>({}),
18
+ );
19
+
20
+ /**
21
+ * @since 1.0.0
22
+ * @category api-gateway service config
23
+ */
24
+ export const withAPIGatewayServiceConfig: {
25
+ (config: APIGatewayService.Config): <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
26
+ <A, E, R>(effect: Effect.Effect<A, E, R>, config: APIGatewayService.Config): Effect.Effect<A, E, R>;
27
+ } = dual(
28
+ 2,
29
+ <A, E, R>(effect: Effect.Effect<A, E, R>, config: APIGatewayService.Config): Effect.Effect<A, E, R> =>
30
+ Effect.locally(effect, currentAPIGatewayServiceConfig, config),
31
+ );
32
+
33
+ /**
34
+ * @since 1.0.0
35
+ * @category api-gateway service config
36
+ */
37
+ export const setAPIGatewayServiceConfig = (config: APIGatewayService.Config) =>
38
+ Layer.locallyScoped(currentAPIGatewayServiceConfig, config);
39
+
40
+ /**
41
+ * @since 1.0.0
42
+ * @category adapters
43
+ */
44
+ export const toAPIGatewayClientConfig: Effect.Effect<APIGatewayClientConfig> = Effect.gen(function*() {
45
+ const { logger: serviceLogger, ...config } = yield* FiberRef.get(currentAPIGatewayServiceConfig);
46
+
47
+ const logger = serviceLogger === true
48
+ ? yield* ServiceLogger.toClientLogger(ServiceLogger.defaultServiceLogger)
49
+ : (serviceLogger ? yield* ServiceLogger.toClientLogger(ServiceLogger.make(serviceLogger)) : undefined);
50
+
51
+ return { logger, ...config };
52
+ });
package/src/Errors.ts ADDED
@@ -0,0 +1,32 @@
1
+ import type {
2
+ BadRequestException,
3
+ ConflictException,
4
+ LimitExceededException,
5
+ NotFoundException,
6
+ ServiceUnavailableException,
7
+ TooManyRequestsException,
8
+ UnauthorizedException,
9
+ } from "@aws-sdk/client-api-gateway";
10
+ import type { TaggedException } from "@effect-aws/commons";
11
+ import { SdkError as CommonSdkError } from "@effect-aws/commons";
12
+
13
+ export const AllServiceErrors = [
14
+ "BadRequestException",
15
+ "ConflictException",
16
+ "LimitExceededException",
17
+ "NotFoundException",
18
+ "ServiceUnavailableException",
19
+ "TooManyRequestsException",
20
+ "UnauthorizedException",
21
+ ] as const;
22
+
23
+ export type BadRequestError = TaggedException<BadRequestException>;
24
+ export type ConflictError = TaggedException<ConflictException>;
25
+ export type LimitExceededError = TaggedException<LimitExceededException>;
26
+ export type NotFoundError = TaggedException<NotFoundException>;
27
+ export type ServiceUnavailableError = TaggedException<ServiceUnavailableException>;
28
+ export type TooManyRequestsError = TaggedException<TooManyRequestsException>;
29
+ export type UnauthorizedError = TaggedException<UnauthorizedException>;
30
+
31
+ export type SdkError = CommonSdkError;
32
+ export const SdkError = CommonSdkError;
package/src/index.ts ADDED
@@ -0,0 +1,44 @@
1
+ /**
2
+ * @since 1.0.0
3
+ */
4
+ import { APIGatewayService } from "./APIGatewayService.js";
5
+
6
+ /**
7
+ * @since 1.0.0
8
+ */
9
+ export * from "./Errors.js";
10
+
11
+ /**
12
+ * @since 1.0.0
13
+ */
14
+ export * as APIGatewayClientInstance from "./APIGatewayClientInstance.js";
15
+
16
+ /**
17
+ * @since 1.0.0
18
+ */
19
+ export * as APIGatewayServiceConfig from "./APIGatewayServiceConfig.js";
20
+
21
+ /**
22
+ * @since 1.0.0
23
+ */
24
+ export * from "./APIGatewayService.js";
25
+
26
+ /**
27
+ * @since 1.0.0
28
+ * @category exports
29
+ * @alias APIGatewayService
30
+ */
31
+ export declare namespace APIGateway {
32
+ /**
33
+ * @since 1.0.0
34
+ * @alias APIGatewayService.Config
35
+ */
36
+ export type Config = APIGatewayService.Config;
37
+ }
38
+
39
+ /**
40
+ * @since 1.0.0
41
+ * @category exports
42
+ * @alias APIGatewayService
43
+ */
44
+ export const APIGateway = APIGatewayService;