@effect-aws/client-api-gateway-v2 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/ApiGatewayV2ClientInstance/package.json +6 -0
  2. package/ApiGatewayV2Service/package.json +6 -0
  3. package/ApiGatewayV2ServiceConfig/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/ApiGatewayV2ClientInstance.d.ts +24 -0
  8. package/dist/cjs/ApiGatewayV2ClientInstance.d.ts.map +1 -0
  9. package/dist/cjs/ApiGatewayV2ClientInstance.js +50 -0
  10. package/dist/cjs/ApiGatewayV2ClientInstance.js.map +1 -0
  11. package/dist/cjs/ApiGatewayV2Service.d.ts +330 -0
  12. package/dist/cjs/ApiGatewayV2Service.d.ts.map +1 -0
  13. package/dist/cjs/ApiGatewayV2Service.js +131 -0
  14. package/dist/cjs/ApiGatewayV2Service.js.map +1 -0
  15. package/dist/cjs/ApiGatewayV2ServiceConfig.d.ts +25 -0
  16. package/dist/cjs/ApiGatewayV2ServiceConfig.d.ts.map +1 -0
  17. package/dist/cjs/ApiGatewayV2ServiceConfig.js +35 -0
  18. package/dist/cjs/ApiGatewayV2ServiceConfig.js.map +1 -0
  19. package/dist/cjs/Errors.d.ts +12 -0
  20. package/dist/cjs/Errors.d.ts.map +1 -0
  21. package/dist/cjs/Errors.js +13 -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/ApiGatewayV2ClientInstance.d.ts +24 -0
  28. package/dist/dts/ApiGatewayV2ClientInstance.d.ts.map +1 -0
  29. package/dist/dts/ApiGatewayV2Service.d.ts +330 -0
  30. package/dist/dts/ApiGatewayV2Service.d.ts.map +1 -0
  31. package/dist/dts/ApiGatewayV2ServiceConfig.d.ts +25 -0
  32. package/dist/dts/ApiGatewayV2ServiceConfig.d.ts.map +1 -0
  33. package/dist/dts/Errors.d.ts +12 -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/ApiGatewayV2ClientInstance.js +23 -0
  38. package/dist/esm/ApiGatewayV2ClientInstance.js.map +1 -0
  39. package/dist/esm/ApiGatewayV2Service.js +104 -0
  40. package/dist/esm/ApiGatewayV2Service.js.map +1 -0
  41. package/dist/esm/ApiGatewayV2ServiceConfig.js +31 -0
  42. package/dist/esm/ApiGatewayV2ServiceConfig.js.map +1 -0
  43. package/dist/esm/Errors.js +10 -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/ApiGatewayV2ClientInstance.ts +33 -0
  50. package/src/ApiGatewayV2Service.ts +1170 -0
  51. package/src/ApiGatewayV2ServiceConfig.ts +52 -0
  52. package/src/Errors.ts +26 -0
  53. package/src/index.ts +44 -0
@@ -0,0 +1,52 @@
1
+ /**
2
+ * @since 1.0.0
3
+ */
4
+ import type { ApiGatewayV2ClientConfig } from "@aws-sdk/client-apigatewayv2";
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 { ApiGatewayV2Service } from "./ApiGatewayV2Service.js";
10
+
11
+ /**
12
+ * @since 1.0.0
13
+ * @category api-gateway-v2 service config
14
+ */
15
+ const currentApiGatewayV2ServiceConfig = globalValue(
16
+ "@effect-aws/client-api-gateway-v2/currentApiGatewayV2ServiceConfig",
17
+ () => FiberRef.unsafeMake<ApiGatewayV2Service.Config>({}),
18
+ );
19
+
20
+ /**
21
+ * @since 1.0.0
22
+ * @category api-gateway-v2 service config
23
+ */
24
+ export const withApiGatewayV2ServiceConfig: {
25
+ (config: ApiGatewayV2Service.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: ApiGatewayV2Service.Config): Effect.Effect<A, E, R>;
27
+ } = dual(
28
+ 2,
29
+ <A, E, R>(effect: Effect.Effect<A, E, R>, config: ApiGatewayV2Service.Config): Effect.Effect<A, E, R> =>
30
+ Effect.locally(effect, currentApiGatewayV2ServiceConfig, config),
31
+ );
32
+
33
+ /**
34
+ * @since 1.0.0
35
+ * @category api-gateway-v2 service config
36
+ */
37
+ export const setApiGatewayV2ServiceConfig = (config: ApiGatewayV2Service.Config) =>
38
+ Layer.locallyScoped(currentApiGatewayV2ServiceConfig, config);
39
+
40
+ /**
41
+ * @since 1.0.0
42
+ * @category adapters
43
+ */
44
+ export const toApiGatewayV2ClientConfig: Effect.Effect<ApiGatewayV2ClientConfig> = Effect.gen(function*() {
45
+ const { logger: serviceLogger, ...config } = yield* FiberRef.get(currentApiGatewayV2ServiceConfig);
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,26 @@
1
+ import type {
2
+ AccessDeniedException,
3
+ BadRequestException,
4
+ ConflictException,
5
+ NotFoundException,
6
+ TooManyRequestsException,
7
+ } from "@aws-sdk/client-apigatewayv2";
8
+ import type { TaggedException } from "@effect-aws/commons";
9
+ import { SdkError as CommonSdkError } from "@effect-aws/commons";
10
+
11
+ export const AllServiceErrors = [
12
+ "AccessDeniedException",
13
+ "BadRequestException",
14
+ "ConflictException",
15
+ "NotFoundException",
16
+ "TooManyRequestsException",
17
+ ] as const;
18
+
19
+ export type AccessDeniedError = TaggedException<AccessDeniedException>;
20
+ export type BadRequestError = TaggedException<BadRequestException>;
21
+ export type ConflictError = TaggedException<ConflictException>;
22
+ export type NotFoundError = TaggedException<NotFoundException>;
23
+ export type TooManyRequestsError = TaggedException<TooManyRequestsException>;
24
+
25
+ export type SdkError = CommonSdkError;
26
+ export const SdkError = CommonSdkError;
package/src/index.ts ADDED
@@ -0,0 +1,44 @@
1
+ /**
2
+ * @since 1.0.0
3
+ */
4
+ import { ApiGatewayV2Service } from "./ApiGatewayV2Service.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 ApiGatewayV2ClientInstance from "./ApiGatewayV2ClientInstance.js";
15
+
16
+ /**
17
+ * @since 1.0.0
18
+ */
19
+ export * as ApiGatewayV2ServiceConfig from "./ApiGatewayV2ServiceConfig.js";
20
+
21
+ /**
22
+ * @since 1.0.0
23
+ */
24
+ export * from "./ApiGatewayV2Service.js";
25
+
26
+ /**
27
+ * @since 1.0.0
28
+ * @category exports
29
+ * @alias ApiGatewayV2Service
30
+ */
31
+ export declare namespace ApiGatewayV2 {
32
+ /**
33
+ * @since 1.0.0
34
+ * @alias ApiGatewayV2Service.Config
35
+ */
36
+ export type Config = ApiGatewayV2Service.Config;
37
+ }
38
+
39
+ /**
40
+ * @since 1.0.0
41
+ * @category exports
42
+ * @alias ApiGatewayV2Service
43
+ */
44
+ export const ApiGatewayV2 = ApiGatewayV2Service;