@teever/ez-hook-effect 0.5.0 → 0.5.19

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 (58) hide show
  1. package/dist/errors/WebhookError.d.ts +295 -0
  2. package/dist/errors/WebhookError.js +322 -0
  3. package/dist/errors/WebhookError.js.map +1 -0
  4. package/dist/errors/index.d.ts +1 -0
  5. package/dist/errors/index.js +2 -0
  6. package/dist/errors/index.js.map +1 -0
  7. package/dist/index.d.ts +89 -0
  8. package/dist/index.js +17 -965
  9. package/dist/index.js.map +5 -13
  10. package/dist/layers/Config.d.ts +48 -0
  11. package/dist/layers/Config.js +166 -0
  12. package/dist/layers/Config.js.map +1 -0
  13. package/dist/layers/Default.d.ts +6 -0
  14. package/dist/layers/Default.js +9 -0
  15. package/dist/layers/Default.js.map +1 -0
  16. package/dist/layers/HttpClient.d.ts +84 -0
  17. package/dist/layers/HttpClient.js +209 -0
  18. package/dist/layers/HttpClient.js.map +1 -0
  19. package/dist/layers/index.d.ts +2 -0
  20. package/dist/layers/index.js +3 -0
  21. package/dist/layers/index.js.map +1 -0
  22. package/dist/pipes/Embed.d.ts +51 -0
  23. package/dist/pipes/Embed.js +198 -0
  24. package/dist/pipes/Embed.js.map +1 -0
  25. package/dist/pipes/Webhook.d.ts +38 -0
  26. package/dist/pipes/Webhook.js +46 -0
  27. package/dist/pipes/Webhook.js.map +1 -0
  28. package/dist/pipes/index.d.ts +2 -0
  29. package/dist/pipes/index.js +3 -0
  30. package/dist/pipes/index.js.map +1 -0
  31. package/dist/schemas/Common.d.ts +10 -0
  32. package/dist/schemas/Common.js +30 -0
  33. package/dist/schemas/Common.js.map +1 -0
  34. package/dist/schemas/Discord.d.ts +16 -0
  35. package/dist/schemas/Discord.js +19 -0
  36. package/dist/schemas/Discord.js.map +1 -0
  37. package/dist/schemas/Embed.d.ts +143 -0
  38. package/dist/schemas/Embed.js +139 -0
  39. package/dist/schemas/Embed.js.map +1 -0
  40. package/dist/schemas/Field.d.ts +24 -0
  41. package/dist/schemas/Field.js +25 -0
  42. package/dist/schemas/Field.js.map +1 -0
  43. package/dist/schemas/Webhook.d.ts +88 -0
  44. package/dist/schemas/Webhook.js +87 -0
  45. package/dist/schemas/Webhook.js.map +1 -0
  46. package/dist/schemas/index.d.ts +5 -0
  47. package/dist/schemas/index.js +6 -0
  48. package/dist/schemas/index.js.map +1 -0
  49. package/dist/services/WebhookService.d.ts +94 -0
  50. package/dist/services/WebhookService.js +116 -0
  51. package/dist/services/WebhookService.js.map +1 -0
  52. package/dist/services/index.d.ts +1 -0
  53. package/dist/services/index.js +2 -0
  54. package/dist/services/index.js.map +1 -0
  55. package/dist/utils/normalize.d.ts +1 -0
  56. package/dist/utils/normalize.js +17 -0
  57. package/dist/utils/normalize.js.map +1 -0
  58. package/package.json +56 -55
@@ -0,0 +1,94 @@
1
+ import { Context, Effect, Layer } from "effect";
2
+ import { HttpError, NetworkError, RateLimitError, ValidationError, WebhookError } from "../errors";
3
+ import { Config } from "../layers/Config";
4
+ import { HttpClient } from "../layers/HttpClient";
5
+ import { Webhook, WebhookParameter, WebhookResponse } from "../schemas";
6
+ declare const WebhookService_base: Context.ServiceClass<WebhookService, "WebhookService", {
7
+ /**
8
+ * Send a webhook message
9
+ */
10
+ readonly sendWebhook: (webhook: Webhook) => Effect.Effect<void, WebhookError | ValidationError | NetworkError | HttpError | RateLimitError>;
11
+ /**
12
+ * Send a webhook message and return the raw response.
13
+ */
14
+ readonly sendWebhookRaw: (webhook: Webhook) => Effect.Effect<SendWebhookRawResult, WebhookError | ValidationError | NetworkError | HttpError | RateLimitError>;
15
+ /**
16
+ * Modify webhook settings
17
+ */
18
+ readonly modifyWebhook: (params: WebhookParameter) => Effect.Effect<WebhookResponse, WebhookError | ValidationError | NetworkError | HttpError | RateLimitError>;
19
+ /**
20
+ * Get webhook information
21
+ */
22
+ readonly getWebhook: () => Effect.Effect<WebhookResponse, WebhookError | NetworkError | HttpError | RateLimitError>;
23
+ /**
24
+ * Delete the webhook
25
+ */
26
+ readonly deleteWebhook: () => Effect.Effect<boolean, WebhookError | NetworkError | HttpError | RateLimitError>;
27
+ /**
28
+ * Validate webhook by checking if it exists and is accessible
29
+ */
30
+ readonly validateWebhook: () => Effect.Effect<boolean, never>;
31
+ }>;
32
+ /**
33
+ * Webhook service tag
34
+ */
35
+ export declare class WebhookService extends WebhookService_base {
36
+ }
37
+ export type SendWebhookRawResult = {
38
+ status: number;
39
+ ok: boolean;
40
+ headers: Record<string, string>;
41
+ body: unknown;
42
+ text: string;
43
+ };
44
+ /**
45
+ * Create webhook service implementation
46
+ */
47
+ export declare const makeWebhookService: Effect.Effect<{
48
+ sendWebhook: (webhook: Webhook) => Effect.Effect<void, WebhookError | ValidationError | NetworkError | RateLimitError | HttpError, never>;
49
+ sendWebhookRaw: (webhook: Webhook) => Effect.Effect<{
50
+ status: number;
51
+ ok: boolean;
52
+ headers: Record<string, string>;
53
+ body: unknown;
54
+ text: string;
55
+ }, ValidationError | NetworkError | RateLimitError | HttpError, never>;
56
+ modifyWebhook: (params: WebhookParameter) => Effect.Effect<WebhookResponse, WebhookError | ValidationError | NetworkError | RateLimitError | HttpError, never>;
57
+ getWebhook: () => Effect.Effect<WebhookResponse, WebhookError | NetworkError | RateLimitError | HttpError, never>;
58
+ deleteWebhook: () => Effect.Effect<boolean, NetworkError | RateLimitError | HttpError, never>;
59
+ validateWebhook: () => Effect.Effect<boolean, never, never>;
60
+ }, never, Config | HttpClient>;
61
+ /**
62
+ * Live webhook service layer
63
+ */
64
+ export declare const WebhookServiceLive: Layer.Layer<WebhookService, never, Config | HttpClient>;
65
+ /**
66
+ * Send a webhook message
67
+ * Module-level accessor that reads from context
68
+ */
69
+ export declare const sendWebhook: (webhook: Webhook) => Effect.Effect<void, WebhookError | ValidationError | NetworkError | HttpError | RateLimitError, WebhookService>;
70
+ /**
71
+ * Send a webhook message and return the raw response.
72
+ */
73
+ export declare const sendWebhookRaw: (webhook: Webhook) => Effect.Effect<SendWebhookRawResult, WebhookError | ValidationError | NetworkError | HttpError | RateLimitError, WebhookService>;
74
+ /**
75
+ * Modify webhook settings
76
+ * Module-level accessor that reads from context
77
+ */
78
+ export declare const modifyWebhook: (params: WebhookParameter) => Effect.Effect<WebhookResponse, WebhookError | ValidationError | NetworkError | HttpError | RateLimitError, WebhookService>;
79
+ /**
80
+ * Get webhook information
81
+ * Module-level accessor that reads from context
82
+ */
83
+ export declare const getWebhook: () => Effect.Effect<WebhookResponse, WebhookError | NetworkError | HttpError | RateLimitError, WebhookService>;
84
+ /**
85
+ * Delete the webhook
86
+ * Module-level accessor that reads from context
87
+ */
88
+ export declare const deleteWebhook: () => Effect.Effect<boolean, WebhookError | NetworkError | HttpError | RateLimitError, WebhookService>;
89
+ /**
90
+ * Validate webhook by checking if it exists and is accessible
91
+ * Module-level accessor that reads from context
92
+ */
93
+ export declare const validateWebhook: () => Effect.Effect<boolean, never, WebhookService>;
94
+ export {};
@@ -0,0 +1,116 @@
1
+ import { Context, Duration, Effect, Layer, pipe, Schedule, Schema, } from "effect";
2
+ import { HttpError, NetworkError, RateLimitError, ValidationError, WebhookError, } from "../errors";
3
+ import { Config } from "../layers/Config";
4
+ import { createRetrySchedule, HttpClient } from "../layers/HttpClient";
5
+ import { Webhook, WebhookParameter, WebhookResponse } from "../schemas";
6
+ import { stripUndefined } from "../utils/normalize";
7
+ /**
8
+ * Webhook service tag
9
+ */
10
+ export class WebhookService extends Context.Service()("WebhookService") {
11
+ }
12
+ /**
13
+ * Create webhook service implementation
14
+ */
15
+ export const makeWebhookService = Effect.gen(function* () {
16
+ // body unchanged
17
+ const config = yield* Config;
18
+ const httpClient = yield* HttpClient;
19
+ const webhookUrl = config.webhook.webhookUrl;
20
+ // Create retry schedule based on config
21
+ const retrySchedule = createRetrySchedule({
22
+ maxRetries: config.webhook.maxRetries ?? httpClient.retryConfig.maxRetries,
23
+ baseDelay: Duration.millis(config.webhook.baseDelayMs ??
24
+ Duration.toMillis(httpClient.retryConfig.baseDelay)),
25
+ maxDelay: Duration.millis(config.webhook.maxDelayMs ??
26
+ Duration.toMillis(httpClient.retryConfig.maxDelay)),
27
+ jitter: config.webhook.enableJitter ?? httpClient.retryConfig.jitter,
28
+ });
29
+ const sendWebhookRaw = (webhook) => pipe(Schema.decodeUnknownEffect(Webhook)(stripUndefined(webhook)), Effect.mapError((e) => ValidationError.fromParseError(e, { field: "webhook", value: webhook })), Effect.flatMap((validatedWebhook) => httpClient
30
+ .request({
31
+ method: "POST",
32
+ url: webhookUrl,
33
+ body: validatedWebhook,
34
+ })
35
+ .pipe(Effect.retry(Schedule.while(retrySchedule, (meta) => Effect.succeed(meta.input instanceof NetworkError ||
36
+ meta.input instanceof RateLimitError ||
37
+ (meta.input instanceof HttpError &&
38
+ (meta.input.response?.status ?? 0) >= 500)))))), Effect.map((response) => ({
39
+ status: response.status,
40
+ ok: response.status >= 200 && response.status < 300,
41
+ headers: response.headers,
42
+ body: response.body,
43
+ text: response.text,
44
+ })));
45
+ const sendWebhook = (webhook) => pipe(sendWebhookRaw(webhook), Effect.flatMap((response) => response.status === 204 && response.text === ""
46
+ ? Effect.void
47
+ : Effect.fail(new WebhookError({
48
+ message: `Unexpected webhook response: ${response.status}`,
49
+ cause: response,
50
+ }))));
51
+ const modifyWebhook = (params) => pipe(Schema.decodeUnknownEffect(WebhookParameter)(stripUndefined(params)), Effect.mapError((e) => ValidationError.fromParseError(e, { field: "params", value: params })), Effect.flatMap((validatedParams) => httpClient.request({
52
+ method: "PATCH",
53
+ url: webhookUrl,
54
+ body: validatedParams,
55
+ })), Effect.flatMap((response) => Schema.decodeUnknownEffect(WebhookResponse)(response.body).pipe(Effect.mapError(() => new WebhookError({
56
+ message: "Invalid webhook response",
57
+ cause: response.body,
58
+ })))));
59
+ const getWebhook = () => pipe(httpClient.request({
60
+ method: "GET",
61
+ url: webhookUrl,
62
+ }), Effect.flatMap((response) => Schema.decodeUnknownEffect(WebhookResponse)(response.body).pipe(Effect.mapError(() => new WebhookError({
63
+ message: "Invalid webhook response",
64
+ cause: response.body,
65
+ })))));
66
+ const validateWebhook = () => pipe(httpClient.request({
67
+ method: "GET",
68
+ url: webhookUrl,
69
+ }), Effect.as(true), Effect.catch(() => Effect.succeed(false)));
70
+ const deleteWebhook = () => pipe(httpClient.request({
71
+ method: "DELETE",
72
+ url: webhookUrl,
73
+ }), Effect.map((response) => response.status === 204));
74
+ return {
75
+ sendWebhook,
76
+ sendWebhookRaw,
77
+ modifyWebhook,
78
+ getWebhook,
79
+ deleteWebhook,
80
+ validateWebhook,
81
+ };
82
+ });
83
+ /**
84
+ * Live webhook service layer
85
+ */
86
+ export const WebhookServiceLive = Layer.effect(WebhookService, makeWebhookService);
87
+ /**
88
+ * Send a webhook message
89
+ * Module-level accessor that reads from context
90
+ */
91
+ export const sendWebhook = (webhook) => WebhookService.use((service) => service.sendWebhook(webhook));
92
+ /**
93
+ * Send a webhook message and return the raw response.
94
+ */
95
+ export const sendWebhookRaw = (webhook) => WebhookService.use((service) => service.sendWebhookRaw(webhook));
96
+ /**
97
+ * Modify webhook settings
98
+ * Module-level accessor that reads from context
99
+ */
100
+ export const modifyWebhook = (params) => WebhookService.use((service) => service.modifyWebhook(params));
101
+ /**
102
+ * Get webhook information
103
+ * Module-level accessor that reads from context
104
+ */
105
+ export const getWebhook = () => WebhookService.use((service) => service.getWebhook());
106
+ /**
107
+ * Delete the webhook
108
+ * Module-level accessor that reads from context
109
+ */
110
+ export const deleteWebhook = () => WebhookService.use((service) => service.deleteWebhook());
111
+ /**
112
+ * Validate webhook by checking if it exists and is accessible
113
+ * Module-level accessor that reads from context
114
+ */
115
+ export const validateWebhook = () => WebhookService.use((service) => service.validateWebhook());
116
+ //# sourceMappingURL=WebhookService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WebhookService.js","sourceRoot":"","sources":["../../src/services/WebhookService.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,OAAO,EACP,QAAQ,EACR,MAAM,EACN,KAA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B,OAAgB,EAKf,EAAE,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC;AAEnE;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAC7B,OAAgB,EAKf,EAAE,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;AAEtE;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAC5B,MAAwB,EAKvB,EAAE,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;AAEpE;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,GAIxB,EAAE,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;AAE3D;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,GAI3B,EAAE,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;AAE9D;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,GAI7B,EAAE,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export * from "./WebhookService";
@@ -0,0 +1,2 @@
1
+ export * from "./WebhookService";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const stripUndefined: (input: unknown) => unknown;
@@ -0,0 +1,17 @@
1
+ export const stripUndefined = (input) => {
2
+ if (Array.isArray(input)) {
3
+ return input.map(stripUndefined);
4
+ }
5
+ if (input && typeof input === "object") {
6
+ const proto = Object.getPrototypeOf(input);
7
+ if (proto !== Object.prototype && proto !== null) {
8
+ return input;
9
+ }
10
+ const entries = Object.entries(input)
11
+ .filter(([, value]) => value !== undefined)
12
+ .map(([key, value]) => [key, stripUndefined(value)]);
13
+ return Object.fromEntries(entries);
14
+ }
15
+ return input;
16
+ };
17
+ //# sourceMappingURL=normalize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalize.js","sourceRoot":"","sources":["../../src/utils/normalize.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAc,EAAW,EAAE;IACzD,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAClC,CAAC;IAED,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACxC,MAAM,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;QAC3C,IAAI,KAAK,KAAK,MAAM,CAAC,SAAS,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;YAClD,OAAO,KAAK,CAAC;QACd,CAAC;QAED,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,KAAgC,CAAC;aAC9D,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC;aAC1C,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,cAAc,CAAC,KAAK,CAAC,CAAU,CAAC,CAAC;QAC/D,OAAO,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IACpC,CAAC;IAED,OAAO,KAAK,CAAC;AACd,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,57 +1,58 @@
1
1
  {
2
- "name": "@teever/ez-hook-effect",
3
- "version": "0.5.0",
4
- "description": "A Discord webhook library built with Effect - type-safe, composable, and resilient",
5
- "module": "src/index.ts",
6
- "main": "dist/index.js",
7
- "types": "dist/index.d.ts",
8
- "type": "module",
9
- "exports": {
10
- ".": {
11
- "types": "./dist/index.d.ts",
12
- "import": "./dist/index.js"
13
- }
14
- },
15
- "sideEffects": false,
16
- "files": [
17
- "dist",
18
- "README.md",
19
- "LICENSE"
20
- ],
21
- "author": "github.com/teeverc",
22
- "license": "MIT",
23
- "scripts": {
24
- "dev": "bun src/index.ts",
25
- "lint": "bun biome check ./src ./examples ./tests --write --unsafe",
26
- "jsr": "bunx jsr publish --allow-slow-types --allow-dirty",
27
- "build": "bun run clean && bun run build:bundle",
28
- "build:tsc": "tsc --project tsconfig.build.json",
29
- "build:bundle": "bun build ./src/index.ts --outdir ./dist --target node --format esm --sourcemap --external effect",
30
- "build:standalone": "bun build ./src/index.ts --compile --outfile ez-hook-effect",
31
- "clean": "rm -rf dist ez-hook-effect",
32
- "test": "bun test",
33
- "test:watch": "bun test --watch",
34
- "test:coverage": "bun test --coverage",
35
- "typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.examples.json",
36
- "typecheck:examples": "tsc --noEmit -p tsconfig.examples.json",
37
- "example": "bun run examples/05-complete-showcase.ts",
38
- "example:simple": "bun run examples/02-simple-demo.ts",
39
- "example:working": "bun run examples/04-comprehensive-demo.ts",
40
- "example:pipe": "bun run examples/03-pipe-style.ts",
41
- "sync:effect": "bun run ./scripts/update-effect-version.ts"
42
- },
43
- "devDependencies": {
44
- "@biomejs/biome": "^2.3.13",
45
- "@types/bun": "^1.3.8",
46
- "effect": "^4.0.0-beta.9",
47
- "typescript": "^5.9.3"
48
- },
49
- "peerDependencies": {
50
- "effect": ">=4.0.0-beta.9 <5"
51
- },
52
- "peerDependenciesMeta": {
53
- "effect": {
54
- "optional": false
55
- }
56
- }
2
+ "name": "@teever/ez-hook-effect",
3
+ "version": "0.5.19",
4
+ "description": "A Discord webhook library built with Effect - type-safe, composable, and resilient",
5
+ "module": "src/index.ts",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "type": "module",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js"
13
+ }
14
+ },
15
+ "sideEffects": false,
16
+ "files": [
17
+ "dist",
18
+ "README.md",
19
+ "LICENSE"
20
+ ],
21
+ "author": "github.com/teeverc",
22
+ "license": "MIT",
23
+ "scripts": {
24
+ "dev": "bun src/index.ts",
25
+ "lint": "bun biome check ./src ./examples ./tests --write --unsafe",
26
+ "jsr": "bunx jsr publish --allow-slow-types --allow-dirty",
27
+ "build": "bun run clean && bun run build:tsc && bun run build:bundle",
28
+ "build:tsc": "tsc --project tsconfig.build.json",
29
+ "build:bundle": "bun build ./src/index.ts --outdir ./dist --target node --format esm --sourcemap --external effect",
30
+ "build:standalone": "bun build ./src/index.ts --compile --outfile ez-hook-effect",
31
+ "clean": "rm -rf dist ez-hook-effect",
32
+ "prepublishOnly": "bun run build",
33
+ "test": "bun test",
34
+ "test:watch": "bun test --watch",
35
+ "test:coverage": "bun test --coverage",
36
+ "typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.examples.json",
37
+ "typecheck:examples": "tsc --noEmit -p tsconfig.examples.json",
38
+ "example": "bun run examples/05-complete-showcase.ts",
39
+ "example:simple": "bun run examples/02-simple-demo.ts",
40
+ "example:working": "bun run examples/04-comprehensive-demo.ts",
41
+ "example:pipe": "bun run examples/03-pipe-style.ts",
42
+ "sync:effect": "bun run ./scripts/update-effect-version.ts"
43
+ },
44
+ "devDependencies": {
45
+ "@biomejs/biome": "^2.3.13",
46
+ "@types/bun": "^1.3.8",
47
+ "effect": "4.0.0-beta.45",
48
+ "typescript": "^5.9.3"
49
+ },
50
+ "peerDependencies": {
51
+ "effect": ">=4.0.0-beta.45 <5"
52
+ },
53
+ "peerDependenciesMeta": {
54
+ "effect": {
55
+ "optional": false
56
+ }
57
+ }
57
58
  }