@effect-aws/client-athena 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 (53) hide show
  1. package/AthenaClientInstance/package.json +6 -0
  2. package/AthenaService/package.json +6 -0
  3. package/AthenaServiceConfig/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/AthenaClientInstance.d.ts +24 -0
  8. package/dist/cjs/AthenaClientInstance.d.ts.map +1 -0
  9. package/dist/cjs/AthenaClientInstance.js +50 -0
  10. package/dist/cjs/AthenaClientInstance.js.map +1 -0
  11. package/dist/cjs/AthenaService.d.ts +313 -0
  12. package/dist/cjs/AthenaService.d.ts.map +1 -0
  13. package/dist/cjs/AthenaService.js +127 -0
  14. package/dist/cjs/AthenaService.js.map +1 -0
  15. package/dist/cjs/AthenaServiceConfig.d.ts +25 -0
  16. package/dist/cjs/AthenaServiceConfig.d.ts.map +1 -0
  17. package/dist/cjs/AthenaServiceConfig.js +35 -0
  18. package/dist/cjs/AthenaServiceConfig.js.map +1 -0
  19. package/dist/cjs/Errors.d.ts +13 -0
  20. package/dist/cjs/Errors.d.ts.map +1 -0
  21. package/dist/cjs/Errors.js +14 -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/AthenaClientInstance.d.ts +24 -0
  28. package/dist/dts/AthenaClientInstance.d.ts.map +1 -0
  29. package/dist/dts/AthenaService.d.ts +313 -0
  30. package/dist/dts/AthenaService.d.ts.map +1 -0
  31. package/dist/dts/AthenaServiceConfig.d.ts +25 -0
  32. package/dist/dts/AthenaServiceConfig.d.ts.map +1 -0
  33. package/dist/dts/Errors.d.ts +13 -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/AthenaClientInstance.js +23 -0
  38. package/dist/esm/AthenaClientInstance.js.map +1 -0
  39. package/dist/esm/AthenaService.js +100 -0
  40. package/dist/esm/AthenaService.js.map +1 -0
  41. package/dist/esm/AthenaServiceConfig.js +31 -0
  42. package/dist/esm/AthenaServiceConfig.js.map +1 -0
  43. package/dist/esm/Errors.js +11 -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/AthenaClientInstance.ts +33 -0
  50. package/src/AthenaService.ts +1109 -0
  51. package/src/AthenaServiceConfig.ts +52 -0
  52. package/src/Errors.ts +29 -0
  53. package/src/index.ts +44 -0
@@ -0,0 +1,52 @@
1
+ /**
2
+ * @since 1.0.0
3
+ */
4
+ import type { AthenaClientConfig } from "@aws-sdk/client-athena";
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 { AthenaService } from "./AthenaService.js";
10
+
11
+ /**
12
+ * @since 1.0.0
13
+ * @category athena service config
14
+ */
15
+ const currentAthenaServiceConfig = globalValue(
16
+ "@effect-aws/client-athena/currentAthenaServiceConfig",
17
+ () => FiberRef.unsafeMake<AthenaService.Config>({}),
18
+ );
19
+
20
+ /**
21
+ * @since 1.0.0
22
+ * @category athena service config
23
+ */
24
+ export const withAthenaServiceConfig: {
25
+ (config: AthenaService.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: AthenaService.Config): Effect.Effect<A, E, R>;
27
+ } = dual(
28
+ 2,
29
+ <A, E, R>(effect: Effect.Effect<A, E, R>, config: AthenaService.Config): Effect.Effect<A, E, R> =>
30
+ Effect.locally(effect, currentAthenaServiceConfig, config),
31
+ );
32
+
33
+ /**
34
+ * @since 1.0.0
35
+ * @category athena service config
36
+ */
37
+ export const setAthenaServiceConfig = (config: AthenaService.Config) =>
38
+ Layer.locallyScoped(currentAthenaServiceConfig, config);
39
+
40
+ /**
41
+ * @since 1.0.0
42
+ * @category adapters
43
+ */
44
+ export const toAthenaClientConfig: Effect.Effect<AthenaClientConfig> = Effect.gen(function*() {
45
+ const { logger: serviceLogger, ...config } = yield* FiberRef.get(currentAthenaServiceConfig);
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,29 @@
1
+ import type {
2
+ InternalServerException,
3
+ InvalidRequestException,
4
+ MetadataException,
5
+ ResourceNotFoundException,
6
+ SessionAlreadyExistsException,
7
+ TooManyRequestsException,
8
+ } from "@aws-sdk/client-athena";
9
+ import type { TaggedException } from "@effect-aws/commons";
10
+ import { SdkError as CommonSdkError } from "@effect-aws/commons";
11
+
12
+ export const AllServiceErrors = [
13
+ "InternalServerException",
14
+ "InvalidRequestException",
15
+ "MetadataException",
16
+ "ResourceNotFoundException",
17
+ "SessionAlreadyExistsException",
18
+ "TooManyRequestsException",
19
+ ] as const;
20
+
21
+ export type InternalServerError = TaggedException<InternalServerException>;
22
+ export type InvalidRequestError = TaggedException<InvalidRequestException>;
23
+ export type MetadataError = TaggedException<MetadataException>;
24
+ export type ResourceNotFoundError = TaggedException<ResourceNotFoundException>;
25
+ export type SessionAlreadyExistsError = TaggedException<SessionAlreadyExistsException>;
26
+ export type TooManyRequestsError = TaggedException<TooManyRequestsException>;
27
+
28
+ export type SdkError = CommonSdkError;
29
+ export const SdkError = CommonSdkError;
package/src/index.ts ADDED
@@ -0,0 +1,44 @@
1
+ /**
2
+ * @since 1.0.0
3
+ */
4
+ import { AthenaService } from "./AthenaService.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 AthenaClientInstance from "./AthenaClientInstance.js";
15
+
16
+ /**
17
+ * @since 1.0.0
18
+ */
19
+ export * as AthenaServiceConfig from "./AthenaServiceConfig.js";
20
+
21
+ /**
22
+ * @since 1.0.0
23
+ */
24
+ export * from "./AthenaService.js";
25
+
26
+ /**
27
+ * @since 1.0.0
28
+ * @category exports
29
+ * @alias AthenaService
30
+ */
31
+ export declare namespace Athena {
32
+ /**
33
+ * @since 1.0.0
34
+ * @alias AthenaService.Config
35
+ */
36
+ export type Config = AthenaService.Config;
37
+ }
38
+
39
+ /**
40
+ * @since 1.0.0
41
+ * @category exports
42
+ * @alias AthenaService
43
+ */
44
+ export const Athena = AthenaService;