effect-cf 0.40.0 → 0.40.2

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 (166) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +2 -0
  3. package/dist/AiGateway.d.mts +86 -0
  4. package/dist/AiGateway.mjs +178 -0
  5. package/dist/AnalyticsEngine.d.mts +170 -0
  6. package/dist/AnalyticsEngine.mjs +275 -0
  7. package/dist/{Artifacts-B3r3RuTB.d.mts → Artifacts.d.mts} +8 -5
  8. package/dist/{Artifacts-CBxWGeZB.mjs → Artifacts.mjs} +9 -5
  9. package/dist/Binding.d.mts +45 -0
  10. package/dist/{Binding-C82jRhdr.mjs → Binding.mjs} +8 -4
  11. package/dist/BrowserRendering.d.mts +85 -0
  12. package/dist/BrowserRendering.mjs +81 -0
  13. package/dist/Cache.d.mts +40 -0
  14. package/dist/Cache.mjs +51 -0
  15. package/dist/CloudflareOtlp.d.mts +95 -0
  16. package/dist/CloudflareOtlp.mjs +125 -0
  17. package/dist/CloudflareTracer.d.mts +20 -0
  18. package/dist/CloudflareTracer.mjs +69 -0
  19. package/dist/ComputerArtifacts.d.mts +2 -2
  20. package/dist/ComputerArtifacts.mjs +3 -2
  21. package/dist/ComputerWorkspace.d.mts +36 -31
  22. package/dist/ComputerWorkspace.mjs +8 -3
  23. package/dist/ComputerWorkspaceHost.d.mts +1 -1
  24. package/dist/ComputerWorkspaceHost.mjs +1 -1
  25. package/dist/{ContainerNamespace-DbLaeFhN.d.mts → ContainerNamespace.d.mts} +16 -12
  26. package/dist/ContainerNamespace.mjs +165 -0
  27. package/dist/D1.d.mts +33 -0
  28. package/dist/D1.mjs +32 -0
  29. package/dist/DurableObject.d.mts +103 -0
  30. package/dist/DurableObject.mjs +77 -0
  31. package/dist/DurableObjectAlarm.d.mts +187 -0
  32. package/dist/DurableObjectAlarm.mjs +344 -0
  33. package/dist/DurableObjectDefinition.d.mts +87 -0
  34. package/dist/DurableObjectDefinition.mjs +125 -0
  35. package/dist/DurableObjectNamespace.d.mts +154 -0
  36. package/dist/DurableObjectNamespace.mjs +144 -0
  37. package/dist/DurableObjectRpcWebSocket.d.mts +112 -0
  38. package/dist/DurableObjectRpcWebSocket.mjs +547 -0
  39. package/dist/DurableObjectSqlite.d.mts +11 -0
  40. package/dist/DurableObjectSqlite.mjs +16 -0
  41. package/dist/DurableObjectState.d.mts +65 -0
  42. package/dist/DurableObjectState.mjs +47 -0
  43. package/dist/DurableObjectStorage.d.mts +112 -0
  44. package/dist/{DurableObjectState-DLL0YgBd.mjs → DurableObjectStorage.mjs} +19 -157
  45. package/dist/DurableObjectWebSocket.d.mts +83 -0
  46. package/dist/DurableObjectWebSocket.mjs +120 -0
  47. package/dist/Email.d.mts +106 -0
  48. package/dist/Email.mjs +247 -0
  49. package/dist/Environment.d.mts +59 -0
  50. package/dist/{ErrorMessage-Byx2OgNd.mjs → Environment.mjs} +7 -18
  51. package/dist/{Hyperdrive-HrwFlZ6x.d.mts → Hyperdrive.d.mts} +8 -5
  52. package/dist/Hyperdrive.mjs +32 -0
  53. package/dist/HyperdrivePg.d.mts +4 -3
  54. package/dist/HyperdrivePg.mjs +3 -1
  55. package/dist/Images.d.mts +191 -0
  56. package/dist/Images.mjs +112 -0
  57. package/dist/Kv.d.mts +84 -0
  58. package/dist/Kv.mjs +132 -0
  59. package/dist/Mcp.d.mts +5 -3
  60. package/dist/Mcp.mjs +13 -4
  61. package/dist/Queue.d.mts +64 -0
  62. package/dist/Queue.mjs +52 -0
  63. package/dist/QueueBinding.d.mts +42 -0
  64. package/dist/QueueBinding.mjs +69 -0
  65. package/dist/QueueDefinition.d.mts +48 -0
  66. package/dist/QueueDefinition.mjs +63 -0
  67. package/dist/R2.d.mts +89 -0
  68. package/dist/R2.mjs +117 -0
  69. package/dist/Rpc.d.mts +29 -0
  70. package/dist/Rpc.mjs +28 -0
  71. package/dist/RpcDefinition.d.mts +116 -0
  72. package/dist/RpcDefinition.mjs +184 -0
  73. package/dist/RpcTracing.d.mts +52 -0
  74. package/dist/RpcTracing.mjs +77 -0
  75. package/dist/Sandbox.d.mts +10 -5
  76. package/dist/Sandbox.mjs +9 -3
  77. package/dist/ServiceBinding.d.mts +112 -0
  78. package/dist/ServiceBinding.mjs +145 -0
  79. package/dist/Vectorize.d.mts +68 -0
  80. package/dist/Vectorize.mjs +76 -0
  81. package/dist/Vitest.d.mts +6 -4
  82. package/dist/Vitest.mjs +8 -4
  83. package/dist/WebTransport.d.mts +66 -0
  84. package/dist/WebTransport.mjs +63 -0
  85. package/dist/Worker.d.mts +139 -0
  86. package/dist/Worker.mjs +141 -0
  87. package/dist/WorkerDefinition.d.mts +100 -0
  88. package/dist/WorkerDefinition.mjs +103 -0
  89. package/dist/WorkersAi.d.mts +84 -0
  90. package/dist/WorkersAi.mjs +84 -0
  91. package/dist/Workflow.d.mts +86 -0
  92. package/dist/Workflow.mjs +137 -0
  93. package/dist/{WorkflowBinding-DtVykUCz.d.mts → WorkflowBinding.d.mts} +14 -10
  94. package/dist/WorkflowBinding.mjs +100 -0
  95. package/dist/WorkflowDefinition.d.mts +51 -0
  96. package/dist/WorkflowDefinition.mjs +69 -0
  97. package/dist/{rolldown-runtime-D7D4PA-g.mjs → _virtual/_rolldown/runtime.mjs} +1 -1
  98. package/dist/index.d.mts +40 -1839
  99. package/dist/index.mjs +40 -3161
  100. package/dist/{ComputerWorkspaceHostRegistry-CY5Fv4Ng.mjs → internal/ComputerWorkspaceHostRegistry.mjs} +1 -1
  101. package/dist/internal/Entrypoint.mjs +37 -0
  102. package/dist/internal/ErrorMessage.mjs +17 -0
  103. package/dist/internal/NativeCallback.mjs +33 -0
  104. package/dist/internal/RpcInvocation.d.mts +13 -0
  105. package/dist/internal/RpcInvocation.mjs +34 -0
  106. package/dist/internal/Runtime.mjs +31 -0
  107. package/dist/internal/Telemetry.mjs +20 -0
  108. package/dist/{WorkerContext-Yobnfw-K.mjs → internal/WorkerContext.mjs} +4 -31
  109. package/package.json +1 -1
  110. package/src/AiGateway.ts +5 -1
  111. package/src/AnalyticsEngine.ts +14 -19
  112. package/src/Artifacts.ts +6 -1
  113. package/src/Binding.ts +5 -1
  114. package/src/BrowserRendering.ts +5 -1
  115. package/src/Cache.ts +5 -1
  116. package/src/CloudflareOtlp.ts +12 -10
  117. package/src/CloudflareTracer.ts +7 -1
  118. package/src/ComputerArtifacts.ts +2 -1
  119. package/src/ComputerWorkspace.ts +7 -1
  120. package/src/ContainerNamespace.ts +6 -1
  121. package/src/D1.ts +4 -1
  122. package/src/DurableObject.ts +4 -1
  123. package/src/DurableObjectAlarm.ts +10 -12
  124. package/src/DurableObjectDefinition.ts +3 -1
  125. package/src/DurableObjectNamespace.ts +4 -1
  126. package/src/DurableObjectRpcWebSocket.ts +7 -1
  127. package/src/DurableObjectSqlite.ts +2 -1
  128. package/src/DurableObjectState.ts +4 -1
  129. package/src/DurableObjectStorage.ts +11 -13
  130. package/src/DurableObjectWebSocket.ts +5 -1
  131. package/src/Email.ts +5 -1
  132. package/src/Environment.ts +6 -1
  133. package/src/Hyperdrive.ts +4 -1
  134. package/src/HyperdrivePg.ts +3 -1
  135. package/src/Images.ts +7 -1
  136. package/src/Kv.ts +7 -1
  137. package/src/Mcp.ts +13 -13
  138. package/src/Queue.ts +5 -11
  139. package/src/QueueBinding.ts +5 -1
  140. package/src/QueueDefinition.ts +4 -1
  141. package/src/R2.ts +7 -1
  142. package/src/Rpc.ts +4 -1
  143. package/src/RpcDefinition.ts +4 -1
  144. package/src/RpcTracing.ts +9 -1
  145. package/src/Sandbox.ts +7 -1
  146. package/src/ServiceBinding.ts +6 -1
  147. package/src/Vectorize.ts +7 -1
  148. package/src/Vitest.ts +5 -1
  149. package/src/WebTransport.ts +6 -1
  150. package/src/Worker.ts +10 -16
  151. package/src/WorkerDefinition.ts +3 -1
  152. package/src/WorkersAi.ts +7 -1
  153. package/src/Workflow.ts +10 -25
  154. package/src/WorkflowBinding.ts +6 -1
  155. package/src/WorkflowDefinition.ts +4 -1
  156. package/src/internal/Entrypoint.ts +3 -1
  157. package/src/internal/ErrorMessage.ts +1 -1
  158. package/src/internal/NativeCallback.ts +3 -1
  159. package/src/internal/RpcInvocation.ts +5 -1
  160. package/src/internal/Runtime.ts +5 -1
  161. package/src/internal/Telemetry.ts +4 -3
  162. package/src/internal/WorkerContext.ts +3 -1
  163. package/dist/Binding-DKcLrQCM.d.mts +0 -94
  164. package/dist/DurableObjectState-DJ0K-zyd.d.mts +0 -244
  165. package/dist/Worker-XsGJsCJX.mjs +0 -885
  166. package/dist/Worker-gV4mDqIs.d.mts +0 -641
@@ -0,0 +1,112 @@
1
+ import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
2
+ import { layer as layer$1 } from "./Binding.mjs";
3
+ import { causeMessage } from "./internal/ErrorMessage.mjs";
4
+ import * as Context from "effect/Context";
5
+ import * as Data from "effect/Data";
6
+ import * as Effect from "effect/Effect";
7
+ import * as Predicate from "effect/Predicate";
8
+ import * as Option from "effect/Option";
9
+ import * as Function from "effect/Function";
10
+ //#region src/Images.ts
11
+ var Images_exports = /* @__PURE__ */ __exportAll({
12
+ ImagesOperationError: () => ImagesOperationError,
13
+ Step: () => Step,
14
+ Tag: () => Tag,
15
+ draw: () => draw,
16
+ empty: () => empty,
17
+ isImagesBinding: () => isImagesBinding,
18
+ layer: () => layer,
19
+ make: () => make,
20
+ makeClient: () => makeClient,
21
+ transform: () => transform
22
+ });
23
+ const TypeId = "~effect-cf/Images/Steps";
24
+ const expectedImagesBinding = "Images binding with info() and input()";
25
+ var ImagesOperationError = class extends Data.TaggedError("ImagesOperationError") {
26
+ get message() {
27
+ return `Images ${this.operation} failed for binding "${this.binding}": ${causeMessage(this.cause)}`;
28
+ }
29
+ };
30
+ const Step = Data.taggedEnum();
31
+ const makeSteps = (steps) => ({
32
+ [TypeId]: TypeId,
33
+ steps
34
+ });
35
+ const empty = makeSteps([]);
36
+ const transform = Function.dual(2, (steps, transformValue) => makeSteps([...steps.steps, Step.Transform({ transform: transformValue })]));
37
+ const draw = Function.dual(2, (steps, drawValue) => makeSteps([...steps.steps, Step.Draw(drawValue)]));
38
+ const imagesError = (binding, operation, cause) => new ImagesOperationError({
39
+ binding,
40
+ operation,
41
+ cause
42
+ });
43
+ const tryImagesPromise = (binding, operation, evaluate) => Effect.tryPromise({
44
+ try: evaluate,
45
+ catch: (cause) => imagesError(binding, operation, cause)
46
+ });
47
+ const tryImagesSync = (binding, operation, evaluate) => Effect.try({
48
+ try: evaluate,
49
+ catch: (cause) => imagesError(binding, operation, cause)
50
+ });
51
+ const maybe = (value) => value === null ? Option.none() : Option.some(value);
52
+ const hasFunction = (value, key) => Predicate.hasProperty(value, key) && Predicate.isFunction(value[key]);
53
+ const isHostedImagesBinding = (value) => hasFunction(value, "image") && hasFunction(value, "upload") && hasFunction(value, "list") && hasFunction(value, "createDirectUpload");
54
+ const isImagesBinding = (value) => hasFunction(value, "info") && hasFunction(value, "input");
55
+ const wrapResult = (binding, result) => ({
56
+ raw: result,
57
+ response: (options) => tryImagesSync(binding, "response", () => result.response(options)),
58
+ contentType: tryImagesSync(binding, "contentType", () => result.contentType()),
59
+ image: (options) => tryImagesSync(binding, "image", () => result.image(options))
60
+ });
61
+ const wrapHandle = (binding, handle) => ({
62
+ raw: handle,
63
+ details: tryImagesPromise(binding, "details", () => handle.details()).pipe(Effect.map(maybe), Effect.withSpan("Images.details")),
64
+ bytes: tryImagesPromise(binding, "bytes", () => handle.bytes()).pipe(Effect.map(maybe), Effect.withSpan("Images.bytes")),
65
+ signedUrl: Effect.fn("Images.signedUrl")((options) => tryImagesPromise(binding, "signedUrl", () => handle.signedUrl(options))),
66
+ update: Effect.fn("Images.update")((options) => tryImagesPromise(binding, "update", () => handle.update(options))),
67
+ delete: tryImagesPromise(binding, "delete", () => handle.delete()).pipe(Effect.withSpan("Images.delete"))
68
+ });
69
+ const wrapHosted = (binding, hosted) => ({
70
+ image: (imageId) => wrapHandle(binding, hosted.image(imageId)),
71
+ upload: Effect.fn("Images.upload")((image, options) => tryImagesPromise(binding, "upload", () => hosted.upload(image, options))),
72
+ list: Effect.fn("Images.list")((options) => tryImagesPromise(binding, "list", () => hosted.list(options))),
73
+ createDirectUpload: Effect.fn("Images.createDirectUpload")((options) => tryImagesPromise(binding, "createDirectUpload", () => hosted.createDirectUpload(options))),
74
+ rawUnsafe: Effect.succeed(hosted)
75
+ });
76
+ const makeClient = (definition) => (images) => {
77
+ const input = (image, options) => tryImagesSync(definition.binding, "input", () => images.input(image, options));
78
+ const text = (content, options) => tryImagesSync(definition.binding, "text", () => {
79
+ if (!hasFunction(images, "text")) throw new Error("Images binding is missing text()");
80
+ return images.text(content, options);
81
+ });
82
+ const process = Effect.fn("Images.process")(function* (steps, options) {
83
+ let transformer = "text" in options ? yield* text(options.text, options.textOptions) : yield* input(options.stream, options.inputOptions);
84
+ for (const step of steps.steps) transformer = yield* Step.$match(step, {
85
+ Draw: (drawStep) => tryImagesSync(definition.binding, "draw", () => transformer.draw(drawStep.image, drawStep.options)),
86
+ Transform: (transformStep) => tryImagesSync(definition.binding, "transform", () => transformer.transform(transformStep.transform))
87
+ });
88
+ const result = yield* tryImagesPromise(definition.binding, "output", () => transformer.output(options.outputOptions));
89
+ return wrapResult(definition.binding, result);
90
+ });
91
+ return {
92
+ definition,
93
+ info: Effect.fn("Images.info")((image, options) => tryImagesPromise(definition.binding, "info", () => images.info(image, options))),
94
+ input,
95
+ text,
96
+ process,
97
+ hosted: isHostedImagesBinding(images.hosted) ? Option.some(wrapHosted(definition.binding, images.hosted)) : Option.none(),
98
+ rawUnsafe: Effect.succeed(images)
99
+ };
100
+ };
101
+ const layer = (tag, definition) => layer$1(tag, definition.binding, isImagesBinding, makeClient(definition), { expected: expectedImagesBinding });
102
+ const make = (id) => Tag()(id);
103
+ const Tag = () => (id) => {
104
+ const tag = Context.Service()(id);
105
+ const makeLayer = (definition) => layer(tag, definition);
106
+ return Object.assign(tag, {
107
+ id,
108
+ layer: makeLayer
109
+ });
110
+ };
111
+ //#endregion
112
+ export { ImagesOperationError, Images_exports, Step, Tag, draw, empty, isImagesBinding, layer, make, makeClient, transform };
package/dist/Kv.d.mts ADDED
@@ -0,0 +1,84 @@
1
+ import { WorkerEnvironment } from "./Environment.mjs";
2
+ import { BindingNotFoundError, BindingValidationError } from "./Binding.mjs";
3
+ import * as Context$1 from "effect/Context";
4
+ import * as Effect from "effect/Effect";
5
+ import * as S from "effect/Schema";
6
+ import * as Option from "effect/Option";
7
+ import { Layer } from "effect";
8
+ declare namespace Kv_d_exports {
9
+ export { Definition, KvClient, KvDefinition, KvListKey, KvListOptions, KvListResult, KvOperation, KvOperationError, KvPutOptions, KvWithMetadata, LayerOptions, Tag, TagClass, isKvNamespace, layer, makeClient };
10
+ }
11
+ type KvOperation = "put" | "get" | "getWithMetadata" | "list" | "delete";
12
+ declare const KvOperationError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
13
+ readonly _tag: "KvOperationError";
14
+ } & Readonly<A>;
15
+ declare class KvOperationError extends KvOperationError_base<{
16
+ readonly binding: string;
17
+ readonly operation: KvOperation;
18
+ readonly cause: unknown;
19
+ }> {
20
+ get message(): string;
21
+ }
22
+ type KvPutOptions = CloudflareKVNamespacePutOptions;
23
+ type KvListOptions<Metadata = unknown> = CloudflareKVNamespaceListOptions & {
24
+ readonly metadataSchema?: S.Codec<Metadata, unknown>;
25
+ };
26
+ interface KvWithMetadata<Value, Metadata> {
27
+ readonly value: Value;
28
+ readonly metadata: Option.Option<Metadata>;
29
+ readonly cacheStatus: Option.Option<string>;
30
+ }
31
+ interface KvListKey<Key, Metadata = unknown> {
32
+ readonly name: Key;
33
+ readonly expiration: Option.Option<number>;
34
+ readonly metadata: Option.Option<Metadata>;
35
+ }
36
+ interface KvListResult<Key, Metadata = unknown> {
37
+ readonly keys: ReadonlyArray<KvListKey<Key, Metadata>>;
38
+ readonly listComplete: boolean;
39
+ readonly cursor: Option.Option<string>;
40
+ readonly cacheStatus: Option.Option<string>;
41
+ }
42
+ interface KvDefinition<Key, Value, EncodedValue> {
43
+ readonly binding: string;
44
+ readonly key: S.Codec<Key, string>;
45
+ readonly value: S.Codec<Value, EncodedValue>;
46
+ }
47
+ /**
48
+ * Reusable typed KV resource definition without a concrete Cloudflare binding name.
49
+ */
50
+ interface Definition<Id extends string = string, Key = unknown, Value = unknown, EncodedValue = unknown> {
51
+ readonly id: Id;
52
+ readonly key: S.Codec<Key, string>;
53
+ readonly value: S.Codec<Value, EncodedValue>;
54
+ }
55
+ declare namespace Definition {
56
+ type Any = Definition<string, any, any, any>;
57
+ }
58
+ interface KvClient<Key, Value, EncodedValue> {
59
+ readonly put: (key: Key, value: Value, options?: KvPutOptions) => Effect.Effect<void, KvOperationError | S.SchemaError>;
60
+ readonly get: (key: Key) => Effect.Effect<Option.Option<Value>, KvOperationError | S.SchemaError>;
61
+ readonly getWithMetadata: <Metadata>(key: Key, metadataSchema: S.Codec<Metadata, unknown>) => Effect.Effect<Option.Option<KvWithMetadata<Value, Metadata>>, KvOperationError | S.SchemaError>;
62
+ readonly list: <Metadata = unknown>(options?: KvListOptions<Metadata>) => Effect.Effect<KvListResult<Key, Metadata>, KvOperationError | S.SchemaError>;
63
+ readonly delete: (key: Key) => Effect.Effect<void, KvOperationError | S.SchemaError>;
64
+ readonly rawUnsafe: Effect.Effect<KVNamespace>;
65
+ readonly definition: KvDefinition<Key, Value, EncodedValue>;
66
+ }
67
+ type LayerOptions = {
68
+ readonly binding: string;
69
+ };
70
+ interface TagClass<Self, Id extends string, Key, Value, EncodedValue> extends Context$1.ServiceClass<Self, Id, KvClient<Key, Value, EncodedValue>> {
71
+ readonly id: Id;
72
+ readonly keySchema: S.Codec<Key, string>;
73
+ readonly valueSchema: S.Codec<Value, EncodedValue>;
74
+ readonly layer: (options: LayerOptions) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
75
+ }
76
+ declare const isKvNamespace: <Candidate>(value: Candidate) => value is Candidate & KVNamespace;
77
+ declare const makeClient: <Key, Value, EncodedValue>(definition: KvDefinition<Key, Value, EncodedValue>) => ((kv: KVNamespace) => KvClient<Key, Value, EncodedValue>);
78
+ declare const layer: <Self, Key, Value, EncodedValue>(tag: Context$1.Service<Self, KvClient<Key, Value, EncodedValue>>, definition: KvDefinition<Key, Value, EncodedValue>) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
79
+ declare const Tag: <Self>() => <Id extends string, Key, Value, EncodedValue>(id: Id, definition: {
80
+ readonly key: S.Codec<Key, string>;
81
+ readonly value: S.Codec<Value, EncodedValue>;
82
+ }) => TagClass<Self, Id, Key, Value, EncodedValue>;
83
+ //#endregion
84
+ export { Definition, KvClient, KvDefinition, KvListKey, KvListOptions, KvListResult, KvOperation, KvOperationError, KvPutOptions, KvWithMetadata, Kv_d_exports, LayerOptions, Tag, TagClass, isKvNamespace, layer, makeClient };
package/dist/Kv.mjs ADDED
@@ -0,0 +1,132 @@
1
+ import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
2
+ import { layer as layer$1 } from "./Binding.mjs";
3
+ import { causeMessage } from "./internal/ErrorMessage.mjs";
4
+ import * as Context from "effect/Context";
5
+ import * as Data from "effect/Data";
6
+ import * as Effect from "effect/Effect";
7
+ import * as S from "effect/Schema";
8
+ import * as Predicate from "effect/Predicate";
9
+ import * as Option from "effect/Option";
10
+ //#region src/Kv.ts
11
+ var Kv_exports = /* @__PURE__ */ __exportAll({
12
+ KvOperationError: () => KvOperationError,
13
+ Tag: () => Tag,
14
+ isKvNamespace: () => isKvNamespace,
15
+ layer: () => layer,
16
+ makeClient: () => makeClient
17
+ });
18
+ const expectedKvNamespace = "KV namespace binding with get(), put(), delete(), getWithMetadata(), and list()";
19
+ var KvOperationError = class extends Data.TaggedError("KvOperationError") {
20
+ get message() {
21
+ return `Kv ${this.operation} failed for binding "${this.binding}": ${causeMessage(this.cause)}`;
22
+ }
23
+ };
24
+ const kvError = (binding, operation, cause) => new KvOperationError({
25
+ binding,
26
+ operation,
27
+ cause
28
+ });
29
+ const tryKvPromise = (binding, operation, evaluate) => Effect.tryPromise({
30
+ try: evaluate,
31
+ catch: (cause) => kvError(binding, operation, cause)
32
+ });
33
+ const isKvNamespace = (value) => Predicate.hasProperty(value, "get") && Predicate.isFunction(value.get) && Predicate.hasProperty(value, "put") && Predicate.isFunction(value.put) && Predicate.hasProperty(value, "delete") && Predicate.isFunction(value.delete) && Predicate.hasProperty(value, "getWithMetadata") && Predicate.isFunction(value.getWithMetadata) && Predicate.hasProperty(value, "list") && Predicate.isFunction(value.list);
34
+ const makeClient = (definition) => {
35
+ const encodeKey = S.encodeEffect(definition.key);
36
+ const decodeKey = S.decodeUnknownEffect(definition.key);
37
+ const jsonValue = S.fromJsonString(S.toCodecJson(definition.value));
38
+ const encodeValue = S.encodeEffect(jsonValue);
39
+ const decodeValue = S.decodeUnknownEffect(jsonValue);
40
+ return (kv) => ({
41
+ definition,
42
+ put: Effect.fn("Kv.put", { attributes: {
43
+ binding: definition.binding,
44
+ operation: "put"
45
+ } })(function* (key, value, options) {
46
+ const keyEncoded = yield* encodeKey(key);
47
+ const valueEncoded = yield* encodeValue(value);
48
+ yield* tryKvPromise(definition.binding, "put", () => kv.put(keyEncoded, valueEncoded, options));
49
+ }),
50
+ get: Effect.fn("Kv.get", { attributes: {
51
+ binding: definition.binding,
52
+ operation: "get"
53
+ } })(function* (key) {
54
+ const keyEncoded = yield* encodeKey(key);
55
+ const valueEncoded = yield* tryKvPromise(definition.binding, "get", () => kv.get(keyEncoded));
56
+ if (valueEncoded === null) return Option.none();
57
+ return yield* decodeValue(valueEncoded).pipe(Effect.map(Option.some));
58
+ }),
59
+ getWithMetadata: Effect.fn("Kv.getWithMetadata", { attributes: {
60
+ binding: definition.binding,
61
+ operation: "getWithMetadata"
62
+ } })(function* (key, metadataSchema) {
63
+ const keyEncoded = yield* encodeKey(key);
64
+ const result = yield* tryKvPromise(definition.binding, "getWithMetadata", () => kv.getWithMetadata(keyEncoded));
65
+ if (result.value === null) return Option.none();
66
+ const value = yield* decodeValue(result.value);
67
+ const metadata = result.metadata === null ? Option.none() : Option.some(yield* S.decodeUnknownEffect(metadataSchema)(result.metadata));
68
+ return Option.some({
69
+ value,
70
+ metadata,
71
+ cacheStatus: Option.fromNullishOr(result.cacheStatus)
72
+ });
73
+ }),
74
+ list: Effect.fn("Kv.list", { attributes: {
75
+ binding: definition.binding,
76
+ operation: "list"
77
+ } })(function* (options) {
78
+ const { metadataSchema, ...kvOptions } = options ?? {};
79
+ const result = yield* tryKvPromise(definition.binding, "list", () => kv.list(kvOptions));
80
+ const keys = [];
81
+ for (const key of result.keys) {
82
+ const decodedName = yield* decodeKey(key.name);
83
+ const decodedMetadata = key.metadata === void 0 ? Option.none() : metadataSchema === void 0 ? Option.some(key.metadata) : Option.some(yield* S.decodeUnknownEffect(metadataSchema)(key.metadata));
84
+ keys.push({
85
+ name: decodedName,
86
+ expiration: Option.fromUndefinedOr(key.expiration),
87
+ metadata: decodedMetadata
88
+ });
89
+ }
90
+ return {
91
+ keys,
92
+ listComplete: result.list_complete,
93
+ cursor: Option.fromNullishOr("cursor" in result ? result.cursor : void 0),
94
+ cacheStatus: Option.fromNullishOr(result.cacheStatus)
95
+ };
96
+ }),
97
+ delete: Effect.fn("Kv.delete", { attributes: {
98
+ binding: definition.binding,
99
+ operation: "delete"
100
+ } })(function* (key) {
101
+ const keyEncoded = yield* encodeKey(key);
102
+ yield* tryKvPromise(definition.binding, "delete", () => kv.delete(keyEncoded));
103
+ }),
104
+ rawUnsafe: Effect.succeed(kv)
105
+ });
106
+ };
107
+ const layer = (tag, definition) => layer$1(tag, definition.binding, isKvNamespace, makeClient(definition), { expected: expectedKvNamespace });
108
+ const makeDefinition = (id, definition) => {
109
+ const kvDefinition = {
110
+ id,
111
+ key: definition.key,
112
+ value: definition.value
113
+ };
114
+ return Object.assign(kvDefinition, { layer: (tag, binding) => layer(tag, {
115
+ ...binding,
116
+ key: definition.key,
117
+ value: definition.value
118
+ }) });
119
+ };
120
+ const Tag = () => (id, definition) => {
121
+ const kvDefinition = makeDefinition(id, definition);
122
+ const tag = Context.Service()(id);
123
+ const makeLayer = (binding) => kvDefinition.layer(tag, binding);
124
+ return Object.assign(tag, {
125
+ id: kvDefinition.id,
126
+ keySchema: kvDefinition.key,
127
+ valueSchema: kvDefinition.value,
128
+ layer: makeLayer
129
+ });
130
+ };
131
+ //#endregion
132
+ export { KvOperationError, Kv_exports, Tag, isKvNamespace, layer, makeClient };
package/dist/Mcp.d.mts CHANGED
@@ -1,7 +1,9 @@
1
- import { n as NativeRequest } from "./Worker-gV4mDqIs.mjs";
2
- import { Effect, Option } from "effect";
1
+ import { NativeRequest } from "./Worker.mjs";
2
+ import * as Effect from "effect/Effect";
3
+ import * as Option from "effect/Option";
3
4
  import { CreateMcpHandlerOptions, ServerOptions } from "@modelcontextprotocol/server";
4
- import { Tool, Toolkit } from "effect/unstable/ai";
5
+ import * as Tool from "effect/unstable/ai/Tool";
6
+ import { Toolkit } from "effect/unstable/ai";
5
7
  //#region src/Mcp.d.ts
6
8
  /**
7
9
  * CORS headers applied to MCP responses.
package/dist/Mcp.mjs CHANGED
@@ -1,8 +1,17 @@
1
- import { r as runNativeCallback } from "./WorkerContext-Yobnfw-K.mjs";
2
- import { n as NativeRequest } from "./Worker-XsGJsCJX.mjs";
3
- import { Cause, Context, Effect, Exit, Option, Predicate, Schema, Sink, Stream } from "effect";
1
+ import { runNativeCallback } from "./internal/NativeCallback.mjs";
2
+ import { NativeRequest } from "./Worker.mjs";
3
+ import * as Context from "effect/Context";
4
+ import * as Effect from "effect/Effect";
5
+ import * as Schema from "effect/Schema";
6
+ import * as Predicate from "effect/Predicate";
7
+ import * as Option from "effect/Option";
8
+ import * as Cause from "effect/Cause";
9
+ import * as Exit from "effect/Exit";
10
+ import * as Stream from "effect/Stream";
4
11
  import { McpServer, createMcpHandler, hostHeaderValidationResponse, localhostAllowedHostnames, localhostAllowedOrigins, originValidationResponse } from "@modelcontextprotocol/server";
5
- import { AiError, Tool } from "effect/unstable/ai";
12
+ import * as Sink from "effect/Sink";
13
+ import * as AiError from "effect/unstable/ai/AiError";
14
+ import * as Tool from "effect/unstable/ai/Tool";
6
15
  //#region src/Mcp.ts
7
16
  const DEFAULT_CORS_OPTIONS = {
8
17
  origin: "*",
@@ -0,0 +1,64 @@
1
+ import { WorkerEnvironment } from "./Environment.mjs";
2
+ import { Definition as Definition$1, Handler as Handler$1, LayerOptions as LayerOptions$1, Options as Options$1, Tag, TagClass as TagClass$1, implement } from "./QueueDefinition.mjs";
3
+ import { ExecutionContext, WorkerContext } from "./Worker.mjs";
4
+ import * as Effect from "effect/Effect";
5
+ import { Scope } from "effect";
6
+ declare namespace Queue_d_exports {
7
+ export { Definition, Handler, LayerOptions, Options, QueueBatch, QueueHandler, QueueMessage, QueueMessageDecodeError, QueueOptions, Tag, TagClass, decodeBatch, fromMessage, fromMessageBatch, implement };
8
+ }
9
+ interface QueueMessage<Body> {
10
+ readonly raw: globalThis.Message<unknown>;
11
+ readonly id: string;
12
+ readonly timestamp: Date;
13
+ readonly body: Body;
14
+ readonly attempts: number;
15
+ readonly ack: Effect.Effect<void>;
16
+ readonly retry: (options?: globalThis.QueueRetryOptions) => Effect.Effect<void>;
17
+ }
18
+ interface QueueBatch<Body> {
19
+ readonly raw: globalThis.MessageBatch<unknown>;
20
+ readonly messages: ReadonlyArray<QueueMessage<Body>>;
21
+ readonly queue: string;
22
+ readonly metadata: globalThis.MessageBatchMetadata;
23
+ readonly ackAll: Effect.Effect<void>;
24
+ readonly retryAll: (options?: globalThis.QueueRetryOptions) => Effect.Effect<void>;
25
+ }
26
+ declare const QueueMessageDecodeError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
27
+ readonly _tag: "QueueMessageDecodeError";
28
+ } & Readonly<A>;
29
+ declare class QueueMessageDecodeError extends QueueMessageDecodeError_base<{
30
+ readonly queue: string;
31
+ readonly messageId: string;
32
+ readonly index: number;
33
+ readonly cause: unknown;
34
+ }> {
35
+ get message(): string;
36
+ }
37
+ type RuntimeContext<ROut> = ExecutionContext | WorkerContext | WorkerEnvironment | ROut;
38
+ type QueueHandlerContext<ROut> = RuntimeContext<ROut> | Scope.Scope;
39
+ type EncodedQueueBody = globalThis.Message<unknown>["body"];
40
+ type QueueHandler<ROut, Body = unknown> = (batch: QueueBatch<Body>) => Effect.Effect<void, unknown, QueueHandlerContext<ROut>>;
41
+ interface QueueOptions<ROut, Body = unknown> {
42
+ readonly queue: QueueHandler<ROut, Body>;
43
+ }
44
+ declare const fromMessage: <Body>(message: globalThis.Message<unknown>, body: Body) => {
45
+ raw: Message<unknown>;
46
+ id: string;
47
+ timestamp: Date;
48
+ body: Body;
49
+ attempts: number;
50
+ ack: Effect.Effect<void, never, never>;
51
+ retry: (options?: globalThis.QueueRetryOptions) => Effect.Effect<void, never, never>;
52
+ };
53
+ declare const fromMessageBatch: <Body>(batch: globalThis.MessageBatch<unknown>, messages: ReadonlyArray<QueueMessage<Body>>) => QueueBatch<Body>;
54
+ declare const decodeBatch: <Body>(batch: globalThis.MessageBatch<unknown>, decodeBody: (body: EncodedQueueBody) => Effect.Effect<Body, unknown>) => Effect.Effect<QueueBatch<Body>, QueueMessageDecodeError>;
55
+ type Definition<Id extends string = string, Message extends Definition$1.Any["message"] = Definition$1.Any["message"]> = Definition$1<Id, Message>;
56
+ declare namespace Definition {
57
+ type Any = Definition$1.Any;
58
+ }
59
+ type LayerOptions = LayerOptions$1;
60
+ type TagClass<Self, Id extends string, Message extends Definition$1.Any["message"]> = TagClass$1<Self, Id, Message>;
61
+ type Handler<ROut, Self extends Definition$1.Any> = Handler$1<ROut, Self>;
62
+ type Options<ROut, Self extends Definition$1.Any> = Options$1<ROut, Self>;
63
+ //#endregion
64
+ export { Definition, Handler, LayerOptions, Options, QueueBatch, QueueHandler, QueueMessage, QueueMessageDecodeError, QueueOptions, Queue_d_exports, Tag, TagClass, decodeBatch, fromMessage, fromMessageBatch, implement };
package/dist/Queue.mjs ADDED
@@ -0,0 +1,52 @@
1
+ import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
2
+ import { causeMessage } from "./internal/ErrorMessage.mjs";
3
+ import { Tag, implement } from "./QueueDefinition.mjs";
4
+ import * as Data from "effect/Data";
5
+ import * as Effect from "effect/Effect";
6
+ //#region src/Queue.ts
7
+ var Queue_exports = /* @__PURE__ */ __exportAll({
8
+ QueueMessageDecodeError: () => QueueMessageDecodeError,
9
+ Tag: () => Tag,
10
+ decodeBatch: () => decodeBatch,
11
+ fromMessage: () => fromMessage,
12
+ fromMessageBatch: () => fromMessageBatch,
13
+ implement: () => implement
14
+ });
15
+ var QueueMessageDecodeError = class extends Data.TaggedError("QueueMessageDecodeError") {
16
+ get message() {
17
+ return `Queue "${this.queue}" failed to decode message "${this.messageId}" at index ${this.index}: ${causeMessage(this.cause)}`;
18
+ }
19
+ };
20
+ const fromMessage = (message, body) => ({
21
+ raw: message,
22
+ id: message.id,
23
+ timestamp: message.timestamp,
24
+ body,
25
+ attempts: message.attempts,
26
+ ack: Effect.sync(() => message.ack()),
27
+ retry: (options) => Effect.sync(() => message.retry(options))
28
+ });
29
+ const fromMessageBatch = (batch, messages) => ({
30
+ raw: batch,
31
+ messages,
32
+ queue: batch.queue,
33
+ metadata: batch.metadata,
34
+ ackAll: Effect.sync(() => batch.ackAll()),
35
+ retryAll: (options) => Effect.sync(() => batch.retryAll(options))
36
+ });
37
+ const decodeBatch = (batch, decodeBody) => Effect.gen(function* () {
38
+ const messages = [];
39
+ for (let index = 0; index < batch.messages.length; index++) {
40
+ const message = batch.messages[index];
41
+ const body = yield* decodeBody(message.body).pipe(Effect.mapError((cause) => new QueueMessageDecodeError({
42
+ queue: batch.queue,
43
+ messageId: message.id,
44
+ index,
45
+ cause
46
+ })));
47
+ messages.push(fromMessage(message, body));
48
+ }
49
+ return fromMessageBatch(batch, messages);
50
+ });
51
+ //#endregion
52
+ export { QueueMessageDecodeError, Queue_exports, Tag, decodeBatch, fromMessage, fromMessageBatch, implement };
@@ -0,0 +1,42 @@
1
+ import { WorkerEnvironment } from "./Environment.mjs";
2
+ import { BindingNotFoundError, BindingValidationError } from "./Binding.mjs";
3
+ import { ServiceFreeSchema } from "./RpcDefinition.mjs";
4
+ import * as Effect from "effect/Effect";
5
+ import * as S from "effect/Schema";
6
+ import * as Predicate from "effect/Predicate";
7
+ import { Context } from "effect";
8
+ declare namespace QueueBinding_d_exports {
9
+ export { MessageSendRequest, QueueBindingClient, QueueBindingDefinition, QueueMetrics, QueueOperationError, QueueProducer, QueueSendBatchOptions, QueueSendBatchResponse, QueueSendOptions, QueueSendResponse, isQueue, layer, makeClient };
10
+ }
11
+ type QueueSendOptions = CloudflareQueueSendOptions;
12
+ type QueueSendResponse = CloudflareQueueSendResponse;
13
+ type QueueSendBatchOptions = CloudflareQueueSendBatchOptions;
14
+ type QueueSendBatchResponse = CloudflareQueueSendBatchResponse;
15
+ type QueueMetrics = CloudflareQueueMetrics;
16
+ type MessageSendRequest<Body> = CloudflareMessageSendRequest<Body>;
17
+ type QueueProducer<Body> = Pick<CloudflareQueue<Body>, "send"> & Partial<Pick<CloudflareQueue<Body>, "sendBatch" | "metrics">>;
18
+ type QueueCandidate = Parameters<typeof Predicate.isUnknown>[0];
19
+ interface QueueBindingDefinition<Message extends ServiceFreeSchema> {
20
+ readonly binding: string;
21
+ readonly message: Message;
22
+ }
23
+ interface QueueBindingClient<Message extends ServiceFreeSchema> {
24
+ readonly send: (message: S.Schema.Type<Message>, options?: QueueSendOptions) => Effect.Effect<void, QueueOperationError | S.SchemaError>;
25
+ readonly sendBatch: (messages: Iterable<MessageSendRequest<S.Schema.Type<Message>>>, options?: QueueSendBatchOptions) => Effect.Effect<void, QueueOperationError | S.SchemaError>;
26
+ readonly metrics: () => Effect.Effect<QueueMetrics, QueueOperationError>;
27
+ readonly rawUnsafe: Effect.Effect<QueueProducer<S.Codec.Encoded<Message>>>;
28
+ }
29
+ declare const QueueOperationError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
30
+ readonly _tag: "QueueOperationError";
31
+ } & Readonly<A>;
32
+ declare class QueueOperationError extends QueueOperationError_base<{
33
+ readonly binding: string;
34
+ readonly operation: string;
35
+ readonly cause: unknown;
36
+ readonly message: string;
37
+ }> {}
38
+ declare const isQueue: <Body>(value: QueueCandidate) => value is QueueProducer<Body>;
39
+ declare const makeClient: <Message extends ServiceFreeSchema>(definition: QueueBindingDefinition<Message>) => ((queue: QueueProducer<S.Codec.Encoded<Message>>) => QueueBindingClient<Message>);
40
+ declare const layer: <Self, Message extends ServiceFreeSchema>(tag: Context.Service<Self, QueueBindingClient<Message>>, definition: QueueBindingDefinition<Message>) => import("effect/Layer").Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
41
+ //#endregion
42
+ export { MessageSendRequest, QueueBindingClient, QueueBindingDefinition, QueueBinding_d_exports, QueueMetrics, QueueOperationError, QueueProducer, QueueSendBatchOptions, QueueSendBatchResponse, QueueSendOptions, QueueSendResponse, isQueue, layer, makeClient };
@@ -0,0 +1,69 @@
1
+ import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
2
+ import { layer as layer$1 } from "./Binding.mjs";
3
+ import * as Data from "effect/Data";
4
+ import * as Effect from "effect/Effect";
5
+ import * as S from "effect/Schema";
6
+ import * as Predicate from "effect/Predicate";
7
+ //#region src/QueueBinding.ts
8
+ var QueueBinding_exports = /* @__PURE__ */ __exportAll({
9
+ QueueOperationError: () => QueueOperationError,
10
+ isQueue: () => isQueue,
11
+ layer: () => layer,
12
+ makeClient: () => makeClient
13
+ });
14
+ const expectedQueueProducer = "Queue producer binding with send(); optional sendBatch()/metrics()";
15
+ var QueueOperationError = class extends Data.TaggedError("QueueOperationError") {};
16
+ const tryQueuePromise = (binding, operation, evaluate) => Effect.tryPromise({
17
+ try: evaluate,
18
+ catch: (cause) => new QueueOperationError({
19
+ binding,
20
+ operation,
21
+ cause,
22
+ message: `Cloudflare queue binding "${binding}" operation "${operation}" failed`
23
+ })
24
+ });
25
+ const isQueue = (value) => Predicate.hasProperty(value, "send") && Predicate.isFunction(value.send);
26
+ const makeClient = (definition) => {
27
+ const encodeMessage = S.encodeEffect(definition.message);
28
+ return (queue) => ({
29
+ send: Effect.fn("QueueBinding.send", { attributes: {
30
+ binding: definition.binding,
31
+ operation: "send"
32
+ } })(function* (message, options) {
33
+ const encoded = yield* encodeMessage(message);
34
+ yield* tryQueuePromise(definition.binding, "send", () => queue.send(encoded, options));
35
+ }),
36
+ sendBatch: Effect.fn("QueueBinding.sendBatch", { attributes: {
37
+ binding: definition.binding,
38
+ operation: "sendBatch"
39
+ } })(function* (messages, options) {
40
+ const encodedMessages = [];
41
+ for (const message of messages) encodedMessages.push({
42
+ ...message,
43
+ body: yield* encodeMessage(message.body)
44
+ });
45
+ const sendBatch = queue.sendBatch;
46
+ if (sendBatch === void 0) return yield* new QueueOperationError({
47
+ binding: definition.binding,
48
+ operation: "sendBatch",
49
+ cause: /* @__PURE__ */ new Error(`Queue binding "${definition.binding}" does not provide sendBatch()`),
50
+ message: `Cloudflare queue binding "${definition.binding}" does not provide sendBatch()`
51
+ });
52
+ yield* tryQueuePromise(definition.binding, "sendBatch", () => sendBatch.call(queue, encodedMessages, options));
53
+ }),
54
+ metrics: () => {
55
+ const metrics = queue.metrics;
56
+ if (metrics === void 0) return Effect.fail(new QueueOperationError({
57
+ binding: definition.binding,
58
+ operation: "metrics",
59
+ cause: /* @__PURE__ */ new Error(`Queue binding "${definition.binding}" does not provide metrics()`),
60
+ message: `Cloudflare queue binding "${definition.binding}" does not provide metrics()`
61
+ }));
62
+ return tryQueuePromise(definition.binding, "metrics", () => metrics.call(queue));
63
+ },
64
+ rawUnsafe: Effect.succeed(queue)
65
+ });
66
+ };
67
+ const layer = (tag, definition) => layer$1(tag, definition.binding, (value) => isQueue(value), makeClient(definition), { expected: expectedQueueProducer });
68
+ //#endregion
69
+ export { QueueBinding_exports, QueueOperationError, isQueue, layer, makeClient };
@@ -0,0 +1,48 @@
1
+ import { WorkerEnvironment } from "./Environment.mjs";
2
+ import { BindingNotFoundError, BindingValidationError } from "./Binding.mjs";
3
+ import { ServiceFreeSchema } from "./RpcDefinition.mjs";
4
+ import { MessageSendRequest, QueueBindingClient, QueueMetrics, QueueOperationError, QueueProducer, QueueSendBatchOptions, QueueSendOptions } from "./QueueBinding.mjs";
5
+ import { QueueBatch } from "./Queue.mjs";
6
+ import { ExecutionContext, WorkerClass, WorkerContext, WorkerOptions } from "./Worker.mjs";
7
+ import * as Context$1 from "effect/Context";
8
+ import * as Effect from "effect/Effect";
9
+ import * as S from "effect/Schema";
10
+ import { Layer, Scope } from "effect";
11
+ declare namespace QueueDefinition_d_exports {
12
+ export { Definition, Handler, LayerOptions, Options, Queue, Tag, TagClass, implement, make };
13
+ }
14
+ interface Definition<Id extends string = string, Message extends ServiceFreeSchema = ServiceFreeSchema> {
15
+ readonly id: Id;
16
+ readonly message: Message;
17
+ }
18
+ declare namespace Definition {
19
+ type Any = Definition<string, ServiceFreeSchema>;
20
+ }
21
+ type Handler<ROut, Self extends Definition.Any> = (batch: QueueBatch<S.Schema.Type<Self["message"]>>) => Effect.Effect<void, unknown, ExecutionContext | WorkerContext | WorkerEnvironment | Scope.Scope | ROut>;
22
+ interface Options<ROut, Self extends Definition.Any> extends Omit<WorkerOptions<ROut, never, never, Record<never, never>>, "queue" | "rpc"> {
23
+ readonly queue: Handler<ROut, Self>;
24
+ readonly rpc?: never;
25
+ }
26
+ type LayerOptions = {
27
+ readonly binding: string;
28
+ };
29
+ interface TagClass<Self, Id extends string, Message extends ServiceFreeSchema> extends Context$1.ServiceClass<Self, `effect-cf/Queue/${Id}`, QueueBindingClient<Message>> {
30
+ readonly id: Id;
31
+ readonly message: Message;
32
+ readonly make: <ROut, LayerError>(layer: Layer.Layer<ROut, LayerError, ExecutionContext | WorkerContext | WorkerEnvironment>, options: Options<ROut, Definition<Id, Message>>) => WorkerClass<Record<never, never>, ROut>;
33
+ readonly layer: (options: LayerOptions) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
34
+ readonly send: (message: S.Schema.Type<Message>, options?: QueueSendOptions) => Effect.Effect<void, QueueOperationError | S.SchemaError, Self>;
35
+ readonly sendBatch: (messages: Iterable<MessageSendRequest<S.Schema.Type<Message>>>, options?: QueueSendBatchOptions) => Effect.Effect<void, QueueOperationError | S.SchemaError, Self>;
36
+ readonly metrics: () => Effect.Effect<QueueMetrics, QueueOperationError, Self>;
37
+ readonly rawUnsafe: Effect.Effect<QueueProducer<S.Codec.Encoded<Message>>, never, Self>;
38
+ }
39
+ declare const make: <Id extends string, Message extends ServiceFreeSchema>(id: Id, definition: {
40
+ readonly message: Message;
41
+ }) => TagClass<Definition<Id, Message>, Id, Message>;
42
+ declare const Tag: <Self>() => <Id extends string, Message extends ServiceFreeSchema>(id: Id, definition: {
43
+ readonly message: Message;
44
+ }) => TagClass<Self, Id, Message>;
45
+ declare const Queue: typeof Tag;
46
+ declare const implement: <ROut, const Self extends Definition.Any>(_definition: Self, handler: Handler<ROut, Self>) => Handler<ROut, Self>;
47
+ //#endregion
48
+ export { Definition, Handler, LayerOptions, Options, Queue, QueueDefinition_d_exports, Tag, TagClass, implement, make };