effect-cf 0.16.0 → 0.17.1
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.
- package/CHANGELOG.md +12 -0
- package/README.md +42 -1
- package/dist/index.d.mts +165 -41
- package/dist/index.mjs +169 -57
- package/package.json +2 -1
- package/src/ContainerNamespace.ts +337 -0
- package/src/WorkflowBinding.ts +1 -1
- package/src/index.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# effect-cf
|
|
2
2
|
|
|
3
|
+
## 0.17.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#56](https://github.com/danieljvdm/effect-cf/pull/56) [`38df8ed`](https://github.com/danieljvdm/effect-cf/commit/38df8ed3153a77df117810e67a34cf039871c08c) Thanks [@danieljvdm](https://github.com/danieljvdm)! - Treat Cloudflare Workflow status responses with a null error as having no error.
|
|
8
|
+
|
|
9
|
+
## 0.17.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [#53](https://github.com/danieljvdm/effect-cf/pull/53) [`b36fc21`](https://github.com/danieljvdm/effect-cf/commit/b36fc2111670c6404a80d51a3c12b10080260256) Thanks [@danieljvdm](https://github.com/danieljvdm)! - Add `ContainerNamespace` services for named Cloudflare Container request forwarding and lifecycle operations.
|
|
14
|
+
|
|
3
15
|
## 0.16.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# effect-cf
|
|
2
2
|
|
|
3
|
-
Effect-native Cloudflare primitives for Workers, Durable Objects, bindings, KV, D1, Queues, Email, Analytics Engine, Workflows, and Durable Object storage.
|
|
3
|
+
Effect-native Cloudflare primitives for Workers, Durable Objects, Containers, bindings, KV, D1, Queues, Email, Analytics Engine, Workflows, and Durable Object storage.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
@@ -30,6 +30,7 @@ Runtime creation belongs at Cloudflare entrypoints, not inside binding helpers.
|
|
|
30
30
|
- `DurableObject` - Durable Object entrypoint factory and typed namespace helpers
|
|
31
31
|
- `DurableObjectState` / `DurableObjectStorage` - Effect wrappers for state, alarms, SQL, and embedded KV
|
|
32
32
|
- `DurableObjectWebSocket` - WebSocket upgrade helpers for Durable Objects
|
|
33
|
+
- `ContainerNamespace` - named Cloudflare Container instances with Effect-wrapped request and lifecycle operations
|
|
33
34
|
- `Kv` - typed KV namespace helper
|
|
34
35
|
- `D1` - typed D1 database binding helper with an `@effect/sql-d1` backed SQL layer
|
|
35
36
|
- `R2` - typed R2 bucket binding helper with Effect-wrapped object and multipart operations
|
|
@@ -85,6 +86,46 @@ export const readCounter = Effect.gen(function* () {
|
|
|
85
86
|
|
|
86
87
|
Define Wrangler bindings and migrations in the consuming application. Durable Object namespace bindings are provided with `YourObject.layer({ binding })`, and consumers use `const namespace = yield* YourObject`.
|
|
87
88
|
|
|
89
|
+
## Container Example
|
|
90
|
+
|
|
91
|
+
Container entrypoints remain owned by `@cloudflare/containers`; `effect-cf`
|
|
92
|
+
wraps the Container namespace used by a calling Worker.
|
|
93
|
+
|
|
94
|
+
```ts
|
|
95
|
+
import { Container, switchPort } from "@cloudflare/containers";
|
|
96
|
+
import { Effect, Layer } from "effect";
|
|
97
|
+
import { ContainerNamespace, Worker } from "effect-cf";
|
|
98
|
+
|
|
99
|
+
export class RendererContainer extends Container {
|
|
100
|
+
defaultPort = 8080;
|
|
101
|
+
sleepAfter = "10m";
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
class Renderers extends ContainerNamespace.Tag<Renderers>()("Renderers") {}
|
|
105
|
+
|
|
106
|
+
const RenderersLive = Renderers.layer({ binding: "RENDERERS" });
|
|
107
|
+
|
|
108
|
+
export default Worker.make(RenderersLive, {
|
|
109
|
+
fetch: Effect.gen(function* () {
|
|
110
|
+
const request = yield* Worker.NativeRequest;
|
|
111
|
+
const renderer = Renderers.byName(new URL(request.url).pathname);
|
|
112
|
+
|
|
113
|
+
yield* renderer.startAndWaitForPorts({ ports: 8080 });
|
|
114
|
+
return yield* renderer.fetch(switchPort(request, 8080));
|
|
115
|
+
}),
|
|
116
|
+
});
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
The instance client exposes `state`, `fetch`, `start`,
|
|
120
|
+
`startAndWaitForPorts`, `stop`, `destroy`, and the Effect-valued native
|
|
121
|
+
`unsafeRaw` stub.
|
|
122
|
+
Responses are returned unchanged, including non-2xx and WebSocket upgrade
|
|
123
|
+
responses. If the Container uses outbound interception, also export
|
|
124
|
+
`ContainerProxy` from `@cloudflare/containers`.
|
|
125
|
+
|
|
126
|
+
See [`examples/containers/README.md`](../../examples/containers/README.md) for
|
|
127
|
+
the corresponding Wrangler configuration and entrypoint responsibilities.
|
|
128
|
+
|
|
88
129
|
## Queue Example
|
|
89
130
|
|
|
90
131
|
Queues define the message contract once. The same class is the producer service tag and the consumer Worker definition: use `YourQueue.layer({ binding })` to provide a Cloudflare producer binding from `WorkerEnvironment`, and use `.make(...)` for the consumer Worker entrypoint.
|
package/dist/index.d.mts
CHANGED
|
@@ -16,7 +16,7 @@ import * as _$effect_Config0 from "effect/Config";
|
|
|
16
16
|
|
|
17
17
|
//#region src/WorkersAi.d.ts
|
|
18
18
|
declare namespace WorkersAi_d_exports {
|
|
19
|
-
export { LayerOptions$
|
|
19
|
+
export { LayerOptions$19 as LayerOptions, Tag$18 as Tag, TagClass$17 as TagClass, WorkersAiAsyncBatchResponse, WorkersAiBinding, WorkersAiClient, WorkersAiDefinition, WorkersAiEmbeddingInput, WorkersAiEmbeddingResponse, WorkersAiModelsSearchObject, WorkersAiModelsSearchParams, WorkersAiOperationError, WorkersAiOptions, WorkersAiService, embeddingResponse, isWorkersAiBinding, layer$16 as layer, make$17 as make, makeClient$13 as makeClient };
|
|
20
20
|
}
|
|
21
21
|
declare const WorkersAiOperationError_base: new <A extends Record<string, any> = {}>(args: _$effect_Types0.VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => _$effect_Cause0.YieldableError & {
|
|
22
22
|
readonly _tag: "WorkersAiOperationError";
|
|
@@ -75,24 +75,24 @@ interface WorkersAiService<Id extends string> {
|
|
|
75
75
|
readonly id: Id;
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
|
-
type LayerOptions$
|
|
78
|
+
type LayerOptions$19 = {
|
|
79
79
|
readonly binding: string;
|
|
80
80
|
};
|
|
81
|
-
interface TagClass$
|
|
81
|
+
interface TagClass$17<Self, Id extends string, ModelList extends AiModelListType = AiModels> extends Context.ServiceClass<Self, Id, WorkersAiClient<ModelList>> {
|
|
82
82
|
readonly id: Id;
|
|
83
|
-
readonly layer: (options: LayerOptions$
|
|
83
|
+
readonly layer: (options: LayerOptions$19) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
84
84
|
}
|
|
85
85
|
declare const isWorkersAiBinding: (value: unknown) => value is WorkersAiBinding;
|
|
86
86
|
declare const embeddingResponse: (value: {
|
|
87
87
|
readonly data?: ReadonlyArray<ReadonlyArray<number>>;
|
|
88
88
|
readonly shape?: ReadonlyArray<number>;
|
|
89
89
|
}) => WorkersAiEmbeddingResponse;
|
|
90
|
-
declare const makeClient$
|
|
91
|
-
declare const layer$
|
|
92
|
-
declare const make$
|
|
93
|
-
declare const Tag$
|
|
90
|
+
declare const makeClient$13: <ModelList extends AiModelListType = AiModels>(definition: WorkersAiDefinition) => (ai: WorkersAiBinding<ModelList>) => WorkersAiClient<ModelList>;
|
|
91
|
+
declare const layer$16: <Self, ModelList extends AiModelListType = AiModels>(tag: Context.Service<Self, WorkersAiClient<ModelList>>, definition: WorkersAiDefinition) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
92
|
+
declare const make$17: <Id extends string>(id: Id) => TagClass$17<WorkersAiService<Id>, Id, AiModels>;
|
|
93
|
+
declare const Tag$18: <Self>() => <Id extends string, ModelList extends AiModelListType = AiModels>(id: Id) => TagClass$17<Self, Id, ModelList>;
|
|
94
94
|
declare namespace AiGateway_d_exports {
|
|
95
|
-
export { AiGatewayBinding, AiGatewayClient, AiGatewayDefinition, AiGatewayFetchOptions, AiGatewayHeaders, AiGatewayLog, AiGatewayOperationError, AiGatewayPatchLog, AiGatewayProvider, AiGatewayRunOptions, AiGatewayService, AiGatewayUniversalRequest, LayerOptions$
|
|
95
|
+
export { AiGatewayBinding, AiGatewayClient, AiGatewayDefinition, AiGatewayFetchOptions, AiGatewayHeaders, AiGatewayLog, AiGatewayOperationError, AiGatewayPatchLog, AiGatewayProvider, AiGatewayRunOptions, AiGatewayService, AiGatewayUniversalRequest, LayerOptions$18 as LayerOptions, Tag$17 as Tag, TagClass$16 as TagClass, isAiGatewayBinding, layer$15 as layer, make$16 as make, makeClient$12 as makeClient, makeClientFromAi, makeHttpClient };
|
|
96
96
|
}
|
|
97
97
|
declare const AiGatewayOperationError_base: new <A extends Record<string, any> = {}>(args: _$effect_Types0.VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => _$effect_Cause0.YieldableError & {
|
|
98
98
|
readonly _tag: "AiGatewayOperationError";
|
|
@@ -141,17 +141,17 @@ interface AiGatewayService<Id extends string> {
|
|
|
141
141
|
readonly id: Id;
|
|
142
142
|
};
|
|
143
143
|
}
|
|
144
|
-
type LayerOptions$
|
|
144
|
+
type LayerOptions$18 = {
|
|
145
145
|
readonly binding: string;
|
|
146
146
|
readonly gatewayId: string;
|
|
147
147
|
readonly accountId?: string;
|
|
148
148
|
};
|
|
149
|
-
interface TagClass$
|
|
149
|
+
interface TagClass$16<Self, Id extends string> extends Context.ServiceClass<Self, Id, AiGatewayClient> {
|
|
150
150
|
readonly id: Id;
|
|
151
|
-
readonly layer: (options: LayerOptions$
|
|
151
|
+
readonly layer: (options: LayerOptions$18) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError | AiGatewayOperationError, WorkerEnvironment>;
|
|
152
152
|
}
|
|
153
153
|
declare const isAiGatewayBinding: (value: unknown) => value is WorkersAiBinding;
|
|
154
|
-
declare const makeClient$
|
|
154
|
+
declare const makeClient$12: (definition: AiGatewayDefinition, gateway: AiGatewayBinding) => {
|
|
155
155
|
definition: AiGatewayDefinition;
|
|
156
156
|
run: (data: _$_cloudflare_workers_types0.AIGatewayUniversalRequest | readonly _$_cloudflare_workers_types0.AIGatewayUniversalRequest[], options: {
|
|
157
157
|
gateway?: _$_cloudflare_workers_types0.UniversalGatewayOptions;
|
|
@@ -169,11 +169,11 @@ declare const makeHttpClient: (definition: Omit<AiGatewayDefinition, "binding">
|
|
|
169
169
|
readonly accountId: string;
|
|
170
170
|
readonly binding?: string;
|
|
171
171
|
}, request?: typeof fetch) => AiGatewayClient;
|
|
172
|
-
declare const layer$
|
|
173
|
-
declare const make$
|
|
174
|
-
declare const Tag$
|
|
172
|
+
declare const layer$15: <Self>(tag: Context.Service<Self, AiGatewayClient>, definition: AiGatewayDefinition) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
173
|
+
declare const make$16: <Id extends string>(id: Id) => TagClass$16<AiGatewayService<Id>, Id>;
|
|
174
|
+
declare const Tag$17: <Self>() => <Id extends string>(id: Id) => TagClass$16<Self, Id>;
|
|
175
175
|
declare namespace AnalyticsEngine_d_exports {
|
|
176
|
-
export { AnalyticsEngineBinding, AnalyticsEngineClient, AnalyticsEngineDataPoint, AnalyticsEngineDataPointSchema, AnalyticsEngineDefinition, AnalyticsEngineFieldValue, AnalyticsEngineFieldValueSchema, AnalyticsEngineInvalidWritePolicy, AnalyticsEngineOperationError, AnalyticsEngineQueryClient, AnalyticsEngineQueryColumn, AnalyticsEngineQueryDefinition, AnalyticsEngineQueryError, AnalyticsEngineQueryOptions, AnalyticsEngineQueryResult, AnalyticsEngineQueryRow, AnalyticsEngineQueryService, AnalyticsEngineService, AnalyticsEngineWriteBatchOptions, AnalyticsEngineWriteError, AnalyticsEngineWriteOptions, AnalyticsEngineWritePolicy, AnalyticsEngineWriteValidationError, AnalyticsEngineWriteViolation, LayerOptions$
|
|
176
|
+
export { AnalyticsEngineBinding, AnalyticsEngineClient, AnalyticsEngineDataPoint, AnalyticsEngineDataPointSchema, AnalyticsEngineDefinition, AnalyticsEngineFieldValue, AnalyticsEngineFieldValueSchema, AnalyticsEngineInvalidWritePolicy, AnalyticsEngineOperationError, AnalyticsEngineQueryClient, AnalyticsEngineQueryColumn, AnalyticsEngineQueryDefinition, AnalyticsEngineQueryError, AnalyticsEngineQueryOptions, AnalyticsEngineQueryResult, AnalyticsEngineQueryRow, AnalyticsEngineQueryService, AnalyticsEngineService, AnalyticsEngineWriteBatchOptions, AnalyticsEngineWriteError, AnalyticsEngineWriteOptions, AnalyticsEngineWritePolicy, AnalyticsEngineWriteValidationError, AnalyticsEngineWriteViolation, LayerOptions$17 as LayerOptions, QueryConfigOptions, QueryTag, QueryTagClass, Tag$16 as Tag, TagClass$15 as TagClass, isAnalyticsEngineDataset, layer$14 as layer, make$15 as make, makeClient$11 as makeClient, makeQuery, makeQueryClient, queryConfig, queryFetchLayer, queryFetchLayerConfig, queryLayer, queryLayerConfig, writeLimits };
|
|
177
177
|
}
|
|
178
178
|
declare const writeLimits: {
|
|
179
179
|
readonly maxBlobs: 20;
|
|
@@ -306,7 +306,7 @@ interface AnalyticsEngineQueryService<Id extends string> {
|
|
|
306
306
|
readonly id: Id;
|
|
307
307
|
};
|
|
308
308
|
}
|
|
309
|
-
type LayerOptions$
|
|
309
|
+
type LayerOptions$17 = {
|
|
310
310
|
readonly binding: string;
|
|
311
311
|
readonly write?: AnalyticsEngineWritePolicy;
|
|
312
312
|
};
|
|
@@ -315,9 +315,9 @@ type QueryConfigOptions = {
|
|
|
315
315
|
readonly apiToken?: Config.Config<Redacted.Redacted<string>>;
|
|
316
316
|
readonly apiBaseUrl?: Config.Config<string>;
|
|
317
317
|
};
|
|
318
|
-
interface TagClass$
|
|
318
|
+
interface TagClass$15<Self, Id extends string> extends Context.ServiceClass<Self, Id, AnalyticsEngineClient> {
|
|
319
319
|
readonly id: Id;
|
|
320
|
-
readonly layer: (options: LayerOptions$
|
|
320
|
+
readonly layer: (options: LayerOptions$17) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
321
321
|
}
|
|
322
322
|
interface QueryTagClass<Self, Id extends string> extends Context.ServiceClass<Self, Id, AnalyticsEngineQueryClient> {
|
|
323
323
|
readonly id: Id;
|
|
@@ -328,7 +328,7 @@ interface QueryTagClass<Self, Id extends string> extends Context.ServiceClass<Se
|
|
|
328
328
|
}
|
|
329
329
|
declare const makeQueryClient: (definition: AnalyticsEngineQueryDefinition) => Effect.Effect<AnalyticsEngineQueryClient, never, HttpClient.HttpClient>;
|
|
330
330
|
declare const isAnalyticsEngineDataset: (value: unknown) => value is AnalyticsEngineBinding;
|
|
331
|
-
declare const makeClient$
|
|
331
|
+
declare const makeClient$11: (definition: AnalyticsEngineDefinition, defaults?: AnalyticsEngineWritePolicy) => (dataset: AnalyticsEngineBinding) => AnalyticsEngineClient;
|
|
332
332
|
declare const queryConfig: (options?: QueryConfigOptions) => Config.Config<{
|
|
333
333
|
accountId: string;
|
|
334
334
|
apiToken: Redacted.Redacted<string>;
|
|
@@ -338,13 +338,13 @@ declare const queryLayer: <Self>(tag: Context.Service<Self, AnalyticsEngineQuery
|
|
|
338
338
|
declare const queryFetchLayer: <Self>(tag: Context.Service<Self, AnalyticsEngineQueryClient>, definition: AnalyticsEngineQueryDefinition) => Layer.Layer<Self, never, never>;
|
|
339
339
|
declare const queryLayerConfig: <Self>(tag: Context.Service<Self, AnalyticsEngineQueryClient>, config?: Config.Config<AnalyticsEngineQueryDefinition>) => Layer.Layer<Self, Config.ConfigError, HttpClient.HttpClient>;
|
|
340
340
|
declare const queryFetchLayerConfig: <Self>(tag: Context.Service<Self, AnalyticsEngineQueryClient>, config?: Config.Config<AnalyticsEngineQueryDefinition>) => Layer.Layer<Self, Config.ConfigError, never>;
|
|
341
|
-
declare const layer$
|
|
342
|
-
declare const make$
|
|
341
|
+
declare const layer$14: <Self>(tag: Context.Service<Self, AnalyticsEngineClient>, definition: LayerOptions$17) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
342
|
+
declare const make$15: <Id extends string>(id: Id) => TagClass$15<AnalyticsEngineService<Id>, Id>;
|
|
343
343
|
declare const makeQuery: <Id extends string>(id: Id) => QueryTagClass<AnalyticsEngineQueryService<Id>, Id>;
|
|
344
|
-
declare const Tag$
|
|
344
|
+
declare const Tag$16: <Self>() => <Id extends string>(id: Id) => TagClass$15<Self, Id>;
|
|
345
345
|
declare const QueryTag: <Self>() => <Id extends string>(id: Id) => QueryTagClass<Self, Id>;
|
|
346
346
|
declare namespace BrowserRendering_d_exports {
|
|
347
|
-
export { BrowserRenderingBinding, BrowserRenderingBrowserClient, BrowserRenderingBrowserLike, BrowserRenderingClient, BrowserRenderingConnect, BrowserRenderingDefinition, BrowserRenderingLaunch, BrowserRenderingOperationError, BrowserRenderingPageClient, BrowserRenderingPageLike, BrowserRenderingService, LayerOptions$
|
|
347
|
+
export { BrowserRenderingBinding, BrowserRenderingBrowserClient, BrowserRenderingBrowserLike, BrowserRenderingClient, BrowserRenderingConnect, BrowserRenderingDefinition, BrowserRenderingLaunch, BrowserRenderingOperationError, BrowserRenderingPageClient, BrowserRenderingPageLike, BrowserRenderingService, LayerOptions$16 as LayerOptions, Tag$15 as Tag, TagClass$14 as TagClass, isBrowserRenderingBinding, layer$13 as layer, make$14 as make, makeClient$10 as makeClient };
|
|
348
348
|
}
|
|
349
349
|
declare const BrowserRenderingOperationError_base: new <A extends Record<string, any> = {}>(args: _$effect_Types0.VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => _$effect_Cause0.YieldableError & {
|
|
350
350
|
readonly _tag: "BrowserRenderingOperationError";
|
|
@@ -408,18 +408,18 @@ interface BrowserRenderingService<Id extends string> {
|
|
|
408
408
|
readonly id: Id;
|
|
409
409
|
};
|
|
410
410
|
}
|
|
411
|
-
type LayerOptions$
|
|
411
|
+
type LayerOptions$16 = {
|
|
412
412
|
readonly binding: string;
|
|
413
413
|
};
|
|
414
|
-
interface TagClass$
|
|
414
|
+
interface TagClass$14<Self, Id extends string> extends Context.ServiceClass<Self, Id, BrowserRenderingClient> {
|
|
415
415
|
readonly id: Id;
|
|
416
|
-
readonly layer: (options: LayerOptions$
|
|
416
|
+
readonly layer: (options: LayerOptions$16) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
417
417
|
}
|
|
418
418
|
declare const isBrowserRenderingBinding: (value: unknown) => value is BrowserRenderingBinding;
|
|
419
|
-
declare const makeClient$
|
|
420
|
-
declare const layer$
|
|
421
|
-
declare const make$
|
|
422
|
-
declare const Tag$
|
|
419
|
+
declare const makeClient$10: <RawBinding extends BrowserRenderingBinding = BrowserRenderingBinding>(definition: BrowserRenderingDefinition) => (binding: RawBinding) => BrowserRenderingClient<RawBinding>;
|
|
420
|
+
declare const layer$13: <Self>(tag: Context.Service<Self, BrowserRenderingClient>, definition: BrowserRenderingDefinition) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
421
|
+
declare const make$14: <Id extends string>(id: Id) => TagClass$14<BrowserRenderingService<Id>, Id>;
|
|
422
|
+
declare const Tag$15: <Self>() => <Id extends string>(id: Id) => TagClass$14<Self, Id>;
|
|
423
423
|
declare namespace DurableObjectStorage_d_exports {
|
|
424
424
|
export { DurableObjectStorage, DurableObjectTransaction, SchemaBackedSyncKvStorage, SqlCursor, SqlStorage, SqlStorageValue, StorageOperationError, SyncKvDefinition, SyncKvStorage, fromDurableObjectStorage };
|
|
425
425
|
}
|
|
@@ -722,7 +722,7 @@ declare class DurableObjectState extends DurableObjectState_base {}
|
|
|
722
722
|
*/
|
|
723
723
|
declare const fromDurableObjectState: (state: globalThis.DurableObjectState) => DurableObjectStateService;
|
|
724
724
|
declare namespace CloudflareOtlp_d_exports {
|
|
725
|
-
export { DurableObjectLayerOptions, LayerOptions$
|
|
725
|
+
export { DurableObjectLayerOptions, LayerOptions$15 as LayerOptions, ResourceOptions, Serialization, Signal, WorkerLayerOptions, durableObjectLayer, layer$12 as layer, layerJson, layerProtobuf, workerLayer };
|
|
726
726
|
}
|
|
727
727
|
/** Telemetry signal groups supported by the Cloudflare OTLP layers. */
|
|
728
728
|
type Signal = "logs" | "traces" | "metrics";
|
|
@@ -738,7 +738,7 @@ interface ResourceOptions {
|
|
|
738
738
|
readonly attributes?: Record<string, unknown>;
|
|
739
739
|
}
|
|
740
740
|
/** Options shared by all Cloudflare OTLP telemetry layers. */
|
|
741
|
-
interface LayerOptions$
|
|
741
|
+
interface LayerOptions$15 {
|
|
742
742
|
/**
|
|
743
743
|
* Telemetry signals to export. Defaults to logs, traces, and metrics.
|
|
744
744
|
*
|
|
@@ -765,12 +765,12 @@ interface LayerOptions$14 {
|
|
|
765
765
|
readonly tracerContext?: <X>(primitive: Tracer.EffectPrimitive<X>, span: Tracer.AnySpan) => X;
|
|
766
766
|
}
|
|
767
767
|
/** Resource metadata specific to Cloudflare Workers. */
|
|
768
|
-
interface WorkerLayerOptions extends LayerOptions$
|
|
768
|
+
interface WorkerLayerOptions extends LayerOptions$15 {
|
|
769
769
|
/** Cloudflare Worker name to attach as `cloudflare.worker.name`. */
|
|
770
770
|
readonly workerName?: string;
|
|
771
771
|
}
|
|
772
772
|
/** Resource metadata specific to Cloudflare Durable Objects. */
|
|
773
|
-
interface DurableObjectLayerOptions extends LayerOptions$
|
|
773
|
+
interface DurableObjectLayerOptions extends LayerOptions$15 {
|
|
774
774
|
/** Durable Object class name to attach as `cloudflare.durable_object.class`. */
|
|
775
775
|
readonly className?: string;
|
|
776
776
|
/**
|
|
@@ -788,11 +788,11 @@ interface DurableObjectLayerOptions extends LayerOptions$14 {
|
|
|
788
788
|
* installed as the primary `ConfigProvider`; outside Cloudflare, the ambient
|
|
789
789
|
* Effect `ConfigProvider` remains the fallback.
|
|
790
790
|
*/
|
|
791
|
-
declare const layer$
|
|
791
|
+
declare const layer$12: (options?: LayerOptions$15) => Layer.Layer<never, never, never>;
|
|
792
792
|
/** Base OTLP telemetry layer forced to JSON serialization. */
|
|
793
|
-
declare const layerJson: (options?: Omit<LayerOptions$
|
|
793
|
+
declare const layerJson: (options?: Omit<LayerOptions$15, "serialization">) => Layer.Layer<never, never, never>;
|
|
794
794
|
/** Base OTLP telemetry layer forced to protobuf serialization. */
|
|
795
|
-
declare const layerProtobuf: (options?: Omit<LayerOptions$
|
|
795
|
+
declare const layerProtobuf: (options?: Omit<LayerOptions$15, "serialization">) => Layer.Layer<never, never, never>;
|
|
796
796
|
/**
|
|
797
797
|
* OTLP layer with Cloudflare Worker resource attributes.
|
|
798
798
|
*
|
|
@@ -808,6 +808,130 @@ declare const workerLayer: (options?: WorkerLayerOptions) => Layer.Layer<never,
|
|
|
808
808
|
* backend can tolerate high-cardinality resource attributes.
|
|
809
809
|
*/
|
|
810
810
|
declare const durableObjectLayer: (options?: DurableObjectLayerOptions) => Layer.Layer<never, never, DurableObjectState>;
|
|
811
|
+
declare namespace ContainerNamespace_d_exports {
|
|
812
|
+
export { ContainerInstanceClient, ContainerNamespace, ContainerNamespaceClient, ContainerNamespaceDefinition, ContainerNamespaceResource, ContainerNamespaceService, ContainerNamespaceStaticClient, ContainerOperationError, ContainerReadinessOptions, ContainerSignal, ContainerStartAndWaitForPortsOptions, ContainerStartOptions, ContainerState, ContainerStub, ContainerWaitOptions, LayerOptions$14 as LayerOptions, Tag$14 as Tag, TagClass$13 as TagClass, isContainerNamespaceResource, layer$11 as layer, make$13 as make, makeClient$9 as makeClient };
|
|
813
|
+
}
|
|
814
|
+
/** Signal accepted by Cloudflare Container instances. */
|
|
815
|
+
type ContainerSignal = "SIGKILL" | "SIGINT" | "SIGTERM";
|
|
816
|
+
/** Per-instance Container startup configuration. */
|
|
817
|
+
interface ContainerStartOptions {
|
|
818
|
+
readonly envVars?: Record<string, string>;
|
|
819
|
+
readonly entrypoint?: Array<string>;
|
|
820
|
+
readonly enableInternet?: boolean;
|
|
821
|
+
readonly labels?: Record<string, string>;
|
|
822
|
+
}
|
|
823
|
+
/** Serializable retry settings used while starting a Container. */
|
|
824
|
+
interface ContainerWaitOptions {
|
|
825
|
+
readonly portToCheck: number;
|
|
826
|
+
readonly retries?: number;
|
|
827
|
+
readonly waitInterval?: number;
|
|
828
|
+
}
|
|
829
|
+
/** Serializable timeout settings used while waiting for Container ports. */
|
|
830
|
+
interface ContainerReadinessOptions {
|
|
831
|
+
readonly instanceGetTimeoutMS?: number;
|
|
832
|
+
readonly portReadyTimeoutMS?: number;
|
|
833
|
+
readonly waitInterval?: number;
|
|
834
|
+
}
|
|
835
|
+
/** Options for starting a Container and waiting for its ports. */
|
|
836
|
+
interface ContainerStartAndWaitForPortsOptions {
|
|
837
|
+
readonly startOptions?: ContainerStartOptions;
|
|
838
|
+
readonly ports?: number | Array<number>;
|
|
839
|
+
readonly cancellationOptions?: ContainerReadinessOptions;
|
|
840
|
+
}
|
|
841
|
+
/** Serializable state reported by a Cloudflare Container instance. */
|
|
842
|
+
declare const ContainerState: Schema.Union<readonly [Schema.Struct<{
|
|
843
|
+
readonly lastChange: Schema.Finite;
|
|
844
|
+
readonly status: Schema.Literals<readonly ["running", "stopping", "stopped", "healthy"]>;
|
|
845
|
+
}>, Schema.Struct<{
|
|
846
|
+
readonly lastChange: Schema.Finite;
|
|
847
|
+
readonly status: Schema.Literal<"stopped_with_code">;
|
|
848
|
+
readonly exitCode: Schema.optionalKey<Schema.Int>;
|
|
849
|
+
}>]>;
|
|
850
|
+
type ContainerState = typeof ContainerState.Type;
|
|
851
|
+
/**
|
|
852
|
+
* Native Container stub shape exposed by a Container namespace binding.
|
|
853
|
+
*
|
|
854
|
+
* This is structural so using Container bindings does not make
|
|
855
|
+
* `@cloudflare/containers` a runtime dependency of effect-cf.
|
|
856
|
+
*/
|
|
857
|
+
interface ContainerStub {
|
|
858
|
+
fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
|
|
859
|
+
getState(): Promise<ContainerState>;
|
|
860
|
+
start(options?: ContainerStartOptions, waitOptions?: ContainerWaitOptions): Promise<void>;
|
|
861
|
+
startAndWaitForPorts(options?: ContainerStartAndWaitForPortsOptions): Promise<void>;
|
|
862
|
+
stop(signal?: ContainerSignal): Promise<void>;
|
|
863
|
+
destroy(): Promise<void>;
|
|
864
|
+
}
|
|
865
|
+
/** Native Container namespace binding shape. */
|
|
866
|
+
interface ContainerNamespaceResource {
|
|
867
|
+
getByName(name: string, options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions): ContainerStub;
|
|
868
|
+
}
|
|
869
|
+
/** Container namespace binding metadata. */
|
|
870
|
+
interface ContainerNamespaceDefinition {
|
|
871
|
+
/** Binding name as configured in `wrangler.jsonc`. */
|
|
872
|
+
readonly binding: string;
|
|
873
|
+
}
|
|
874
|
+
declare const ContainerOperationError_base: new <A extends Record<string, any> = {}>(args: _$effect_Types0.VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => _$effect_Cause0.YieldableError & {
|
|
875
|
+
readonly _tag: "ContainerOperationError";
|
|
876
|
+
} & Readonly<A>;
|
|
877
|
+
/** Failure raised when invoking a named Container operation. */
|
|
878
|
+
declare class ContainerOperationError extends ContainerOperationError_base<{
|
|
879
|
+
readonly binding: string;
|
|
880
|
+
readonly instance: string;
|
|
881
|
+
readonly operation: string;
|
|
882
|
+
readonly cause: unknown;
|
|
883
|
+
}> {}
|
|
884
|
+
/** Effect-wrapped client for one named Container instance. */
|
|
885
|
+
interface ContainerInstanceClient {
|
|
886
|
+
readonly unsafeRaw: Effect.Effect<ContainerStub, ContainerOperationError>;
|
|
887
|
+
readonly state: Effect.Effect<ContainerState, ContainerOperationError>;
|
|
888
|
+
readonly fetch: (input: RequestInfo | URL, init?: RequestInit) => Effect.Effect<Response, ContainerOperationError>;
|
|
889
|
+
readonly start: (options?: ContainerStartOptions, waitOptions?: ContainerWaitOptions) => Effect.Effect<void, ContainerOperationError>;
|
|
890
|
+
readonly startAndWaitForPorts: (options?: ContainerStartAndWaitForPortsOptions) => Effect.Effect<void, ContainerOperationError>;
|
|
891
|
+
readonly stop: (signal?: ContainerSignal) => Effect.Effect<void, ContainerOperationError>;
|
|
892
|
+
readonly destroy: Effect.Effect<void, ContainerOperationError>;
|
|
893
|
+
}
|
|
894
|
+
/** Effect client for a Container namespace binding. */
|
|
895
|
+
interface ContainerNamespaceClient {
|
|
896
|
+
readonly definition: ContainerNamespaceDefinition;
|
|
897
|
+
readonly getByName: (name: string, options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions) => Effect.Effect<ContainerInstanceClient, ContainerOperationError>;
|
|
898
|
+
readonly byName: (name: string, options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions) => ContainerInstanceClient;
|
|
899
|
+
readonly unsafeRaw: Effect.Effect<ContainerNamespaceResource>;
|
|
900
|
+
}
|
|
901
|
+
type ContainerNamespaceStaticClient<R> = {
|
|
902
|
+
readonly getByName: (name: string, options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions) => Effect.Effect<ContainerInstanceClient, ContainerOperationError, R>;
|
|
903
|
+
readonly byName: (name: string, options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions) => {
|
|
904
|
+
readonly state: Effect.Effect<ContainerState, ContainerOperationError, R>;
|
|
905
|
+
readonly fetch: (input: RequestInfo | URL, init?: RequestInit) => Effect.Effect<Response, ContainerOperationError, R>;
|
|
906
|
+
readonly start: (options?: ContainerStartOptions, waitOptions?: ContainerWaitOptions) => Effect.Effect<void, ContainerOperationError, R>;
|
|
907
|
+
readonly startAndWaitForPorts: (options?: ContainerStartAndWaitForPortsOptions) => Effect.Effect<void, ContainerOperationError, R>;
|
|
908
|
+
readonly stop: (signal?: ContainerSignal) => Effect.Effect<void, ContainerOperationError, R>;
|
|
909
|
+
readonly destroy: Effect.Effect<void, ContainerOperationError, R>;
|
|
910
|
+
readonly unsafeRaw: Effect.Effect<ContainerStub, ContainerOperationError, R>;
|
|
911
|
+
};
|
|
912
|
+
readonly unsafeRaw: () => Effect.Effect<ContainerNamespaceResource, never, R>;
|
|
913
|
+
};
|
|
914
|
+
type LayerOptions$14 = {
|
|
915
|
+
readonly binding: string;
|
|
916
|
+
};
|
|
917
|
+
interface TagClass$13<Self, Id extends string> extends Context.ServiceClass<Self, Id, ContainerNamespaceClient>, ContainerNamespaceStaticClient<Self> {
|
|
918
|
+
readonly id: Id;
|
|
919
|
+
readonly layer: (options: LayerOptions$14) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
920
|
+
}
|
|
921
|
+
declare const isContainerNamespaceResource: (value: unknown) => value is ContainerNamespaceResource;
|
|
922
|
+
declare const makeClient$9: (definition: ContainerNamespaceDefinition) => (namespace: ContainerNamespaceResource) => ContainerNamespaceClient;
|
|
923
|
+
declare const layer$11: <Self>(tag: Context.Service<Self, ContainerNamespaceClient>, definition: ContainerNamespaceDefinition) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
924
|
+
declare const make$13: <Id extends string>(id: Id) => TagClass$13<ContainerNamespaceService<Id>, Id>;
|
|
925
|
+
declare const ContainerNamespaceServiceTypeId: unique symbol;
|
|
926
|
+
/** Nominal service marker for Container namespaces created with {@link make}. */
|
|
927
|
+
interface ContainerNamespaceService<Id extends string> {
|
|
928
|
+
readonly [ContainerNamespaceServiceTypeId]: {
|
|
929
|
+
readonly id: Id;
|
|
930
|
+
};
|
|
931
|
+
}
|
|
932
|
+
/** Creates a typed Effect service for a Cloudflare Container namespace. */
|
|
933
|
+
declare const Tag$14: <Self>() => <Id extends string>(id: Id) => TagClass$13<Self, Id>;
|
|
934
|
+
declare const ContainerNamespace: <Self>() => <Id extends string>(id: Id) => TagClass$13<Self, Id>;
|
|
811
935
|
declare namespace D1_d_exports {
|
|
812
936
|
export { D1Definition, D1Service, D1SqlLayerOptions, Service$1 as Service, make$12 as make };
|
|
813
937
|
}
|
|
@@ -1480,7 +1604,7 @@ declare const method$2: {
|
|
|
1480
1604
|
<Success extends ServiceFreeSchema$2>(definition: {
|
|
1481
1605
|
readonly success: Success;
|
|
1482
1606
|
}): Method$3<readonly [], Success>;
|
|
1483
|
-
<const Args extends
|
|
1607
|
+
<const Args extends readonly ServiceFreeSchema$2[], Success extends ServiceFreeSchema$2>(definition: {
|
|
1484
1608
|
readonly args: Args;
|
|
1485
1609
|
readonly success: Success;
|
|
1486
1610
|
}): Method$3<Args, Success>;
|
|
@@ -2809,4 +2933,4 @@ declare const layer: <Self>(tag: Context.Service<Self, VectorizeClient>, definit
|
|
|
2809
2933
|
declare const make: <Id extends string>(id: Id) => TagClass<VectorizeService<Id>, Id>;
|
|
2810
2934
|
declare const Tag$1: <Self>() => <Id extends string>(id: Id) => TagClass<Self, Id>;
|
|
2811
2935
|
//#endregion
|
|
2812
|
-
export { AiGateway_d_exports as AiGateway, AnalyticsEngine_d_exports as AnalyticsEngine, Binding_d_exports as Binding, BrowserRendering_d_exports as BrowserRendering, CloudflareOtlp_d_exports as CloudflareOtlp, D1_d_exports as D1, DurableObject_d_exports as DurableObject, DurableObjectAlarm_d_exports as DurableObjectAlarm, DurableObjectDefinition_d_exports as DurableObjectDefinition, DurableObjectNamespace_d_exports as DurableObjectNamespace, DurableObjectRpcWebSocket_d_exports as DurableObjectRpcWebSocket, DurableObjectSqlite_d_exports as DurableObjectSqlite, DurableObjectState_d_exports as DurableObjectState, DurableObjectStorage_d_exports as DurableObjectStorage, DurableObjectWebSocket_d_exports as DurableObjectWebSocket, Email_d_exports as Email, Hyperdrive_d_exports as Hyperdrive, Images_d_exports as Images, Kv_d_exports as Kv, Queue_d_exports as Queue, QueueBinding_d_exports as QueueBinding, QueueDefinition_d_exports as QueueDefinition, R2_d_exports as R2, Rpc_d_exports as Rpc, RpcDefinition_d_exports as RpcDefinition, ServiceBinding_d_exports as ServiceBinding, Vectorize_d_exports as Vectorize, Worker_d_exports as Worker, WorkerConfig, WorkerDefinition_d_exports as WorkerDefinition, type WorkerEnv, WorkerEnvironment, WorkersAi_d_exports as WorkersAi, Workflow_d_exports as Workflow, WorkflowBinding_d_exports as WorkflowBinding, WorkflowDefinition_d_exports as WorkflowDefinition };
|
|
2936
|
+
export { AiGateway_d_exports as AiGateway, AnalyticsEngine_d_exports as AnalyticsEngine, Binding_d_exports as Binding, BrowserRendering_d_exports as BrowserRendering, CloudflareOtlp_d_exports as CloudflareOtlp, ContainerNamespace_d_exports as ContainerNamespace, D1_d_exports as D1, DurableObject_d_exports as DurableObject, DurableObjectAlarm_d_exports as DurableObjectAlarm, DurableObjectDefinition_d_exports as DurableObjectDefinition, DurableObjectNamespace_d_exports as DurableObjectNamespace, DurableObjectRpcWebSocket_d_exports as DurableObjectRpcWebSocket, DurableObjectSqlite_d_exports as DurableObjectSqlite, DurableObjectState_d_exports as DurableObjectState, DurableObjectStorage_d_exports as DurableObjectStorage, DurableObjectWebSocket_d_exports as DurableObjectWebSocket, Email_d_exports as Email, Hyperdrive_d_exports as Hyperdrive, Images_d_exports as Images, Kv_d_exports as Kv, Queue_d_exports as Queue, QueueBinding_d_exports as QueueBinding, QueueDefinition_d_exports as QueueDefinition, R2_d_exports as R2, Rpc_d_exports as Rpc, RpcDefinition_d_exports as RpcDefinition, ServiceBinding_d_exports as ServiceBinding, Vectorize_d_exports as Vectorize, Worker_d_exports as Worker, WorkerConfig, WorkerDefinition_d_exports as WorkerDefinition, type WorkerEnv, WorkerEnvironment, WorkersAi_d_exports as WorkersAi, Workflow_d_exports as Workflow, WorkflowBinding_d_exports as WorkflowBinding, WorkflowDefinition_d_exports as WorkflowDefinition };
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./chunk-CfYAbeIz.mjs";
|
|
2
|
-
import { a as WorkerConfig, i as layer$
|
|
2
|
+
import { a as WorkerConfig, i as layer$18, n as Binding_exports, o as WorkerEnvironment, r as Service$2, t as Hyperdrive_exports } from "./Hyperdrive-89hg_Fck.mjs";
|
|
3
3
|
import { Cause, Clock, Config, ConfigProvider, Context, Data, DateTime, Duration, Effect, Exit, Layer, ManagedRuntime, Option, Queue, Result, Schema } from "effect";
|
|
4
4
|
import { FetchHttpClient, HttpClient, HttpClientRequest, HttpServerRequest, HttpServerResponse } from "effect/unstable/http";
|
|
5
5
|
import { OtlpLogger, OtlpMetrics, OtlpSerialization, OtlpTracer } from "effect/unstable/observability";
|
|
@@ -11,13 +11,13 @@ import * as RpcServer from "effect/unstable/rpc/RpcServer";
|
|
|
11
11
|
import { SqliteClient } from "@effect/sql-sqlite-do";
|
|
12
12
|
//#region src/WorkersAi.ts
|
|
13
13
|
var WorkersAi_exports = /* @__PURE__ */ __exportAll({
|
|
14
|
-
Tag: () => Tag$
|
|
14
|
+
Tag: () => Tag$17,
|
|
15
15
|
WorkersAiOperationError: () => WorkersAiOperationError,
|
|
16
16
|
embeddingResponse: () => embeddingResponse,
|
|
17
17
|
isWorkersAiBinding: () => isWorkersAiBinding,
|
|
18
|
-
layer: () => layer$
|
|
19
|
-
make: () => make$
|
|
20
|
-
makeClient: () => makeClient$
|
|
18
|
+
layer: () => layer$17,
|
|
19
|
+
make: () => make$17,
|
|
20
|
+
makeClient: () => makeClient$13
|
|
21
21
|
});
|
|
22
22
|
const expectedWorkersAiBinding = "Workers AI binding with run(), gateway(), and models()";
|
|
23
23
|
/** Error raised when a Workers AI operation fails. */
|
|
@@ -41,7 +41,7 @@ const embeddingResponse = (value) => ({
|
|
|
41
41
|
data: value.data ?? [],
|
|
42
42
|
shape: value.shape ?? []
|
|
43
43
|
});
|
|
44
|
-
const makeClient$
|
|
44
|
+
const makeClient$13 = (definition) => (ai) => {
|
|
45
45
|
const run = ((model, input, options) => tryWorkersAiPromise(definition.binding, "run", () => ai.run(model, input, options)));
|
|
46
46
|
return {
|
|
47
47
|
definition,
|
|
@@ -53,11 +53,11 @@ const makeClient$12 = (definition) => (ai) => {
|
|
|
53
53
|
unsafeRaw: Effect.succeed(ai)
|
|
54
54
|
};
|
|
55
55
|
};
|
|
56
|
-
const layer$
|
|
57
|
-
const make$
|
|
58
|
-
const Tag$
|
|
56
|
+
const layer$17 = (tag, definition) => layer$18(tag, definition.binding, (value) => isWorkersAiBinding(value), makeClient$13(definition), { expected: expectedWorkersAiBinding });
|
|
57
|
+
const make$17 = (id) => Tag$17()(id);
|
|
58
|
+
const Tag$17 = () => (id) => {
|
|
59
59
|
const tag = Context.Service()(id);
|
|
60
|
-
const makeLayer = (definition) => layer$
|
|
60
|
+
const makeLayer = (definition) => layer$17(tag, definition);
|
|
61
61
|
return Object.assign(tag, {
|
|
62
62
|
id,
|
|
63
63
|
layer: makeLayer
|
|
@@ -67,11 +67,11 @@ const Tag$16 = () => (id) => {
|
|
|
67
67
|
//#region src/AiGateway.ts
|
|
68
68
|
var AiGateway_exports = /* @__PURE__ */ __exportAll({
|
|
69
69
|
AiGatewayOperationError: () => AiGatewayOperationError,
|
|
70
|
-
Tag: () => Tag$
|
|
70
|
+
Tag: () => Tag$16,
|
|
71
71
|
isAiGatewayBinding: () => isAiGatewayBinding,
|
|
72
|
-
layer: () => layer$
|
|
73
|
-
make: () => make$
|
|
74
|
-
makeClient: () => makeClient$
|
|
72
|
+
layer: () => layer$16,
|
|
73
|
+
make: () => make$16,
|
|
74
|
+
makeClient: () => makeClient$12,
|
|
75
75
|
makeClientFromAi: () => makeClientFromAi,
|
|
76
76
|
makeHttpClient: () => makeHttpClient
|
|
77
77
|
});
|
|
@@ -98,7 +98,7 @@ const providerUrl = (baseUrl, path = "") => {
|
|
|
98
98
|
};
|
|
99
99
|
const gatewayUrl = (definition) => `https://gateway.ai.cloudflare.com/v1/${definition.accountId}/${definition.gatewayId}/`;
|
|
100
100
|
const isAiGatewayBinding = (value) => isWorkersAiBinding(value);
|
|
101
|
-
const makeClient$
|
|
101
|
+
const makeClient$12 = (definition, gateway) => ({
|
|
102
102
|
definition,
|
|
103
103
|
run: (data, options) => tryAiGatewayPromise(definition.binding, "run", () => gateway.run(Array.isArray(data) ? [...data] : data, options)),
|
|
104
104
|
getUrl: (provider) => tryAiGatewayPromise(definition.binding, "getUrl", () => gateway.getUrl(provider)),
|
|
@@ -115,11 +115,11 @@ const makeClientFromAi = (definition, ai) => {
|
|
|
115
115
|
const withGateway = (operation) => gateway.pipe(Effect.flatMap(operation));
|
|
116
116
|
return {
|
|
117
117
|
definition,
|
|
118
|
-
run: (data, options) => withGateway((raw) => makeClient$
|
|
119
|
-
getUrl: (provider) => withGateway((raw) => makeClient$
|
|
120
|
-
fetch: (options) => withGateway((raw) => makeClient$
|
|
121
|
-
patchLog: (logId, data) => withGateway((raw) => makeClient$
|
|
122
|
-
getLog: (logId) => withGateway((raw) => makeClient$
|
|
118
|
+
run: (data, options) => withGateway((raw) => makeClient$12(definition, raw).run(data, options)),
|
|
119
|
+
getUrl: (provider) => withGateway((raw) => makeClient$12(definition, raw).getUrl(provider)),
|
|
120
|
+
fetch: (options) => withGateway((raw) => makeClient$12(definition, raw).fetch(options)),
|
|
121
|
+
patchLog: (logId, data) => withGateway((raw) => makeClient$12(definition, raw).patchLog(logId, data)),
|
|
122
|
+
getLog: (logId) => withGateway((raw) => makeClient$12(definition, raw).getLog(logId)),
|
|
123
123
|
unsafeRaw: gateway
|
|
124
124
|
};
|
|
125
125
|
};
|
|
@@ -159,11 +159,11 @@ const makeHttpClient = (definition, request = fetch) => {
|
|
|
159
159
|
unsafeRaw: Effect.fail(aiGatewayError(binding, "unsafeRaw", /* @__PURE__ */ new TypeError("HTTP AI Gateway clients have no raw binding")))
|
|
160
160
|
};
|
|
161
161
|
};
|
|
162
|
-
const layer$
|
|
163
|
-
const make$
|
|
164
|
-
const Tag$
|
|
162
|
+
const layer$16 = (tag, definition) => layer$18(tag, definition.binding, isAiGatewayBinding, (ai) => makeClientFromAi(definition, ai), { expected: expectedAiGatewayBinding });
|
|
163
|
+
const make$16 = (id) => Tag$16()(id);
|
|
164
|
+
const Tag$16 = () => (id) => {
|
|
165
165
|
const tag = Context.Service()(id);
|
|
166
|
-
const makeLayer = (definition) => layer$
|
|
166
|
+
const makeLayer = (definition) => layer$16(tag, definition);
|
|
167
167
|
return Object.assign(tag, {
|
|
168
168
|
id,
|
|
169
169
|
layer: makeLayer
|
|
@@ -178,11 +178,11 @@ var AnalyticsEngine_exports = /* @__PURE__ */ __exportAll({
|
|
|
178
178
|
AnalyticsEngineQueryError: () => AnalyticsEngineQueryError,
|
|
179
179
|
AnalyticsEngineWriteValidationError: () => AnalyticsEngineWriteValidationError,
|
|
180
180
|
QueryTag: () => QueryTag,
|
|
181
|
-
Tag: () => Tag$
|
|
181
|
+
Tag: () => Tag$15,
|
|
182
182
|
isAnalyticsEngineDataset: () => isAnalyticsEngineDataset,
|
|
183
|
-
layer: () => layer$
|
|
184
|
-
make: () => make$
|
|
185
|
-
makeClient: () => makeClient$
|
|
183
|
+
layer: () => layer$15,
|
|
184
|
+
make: () => make$15,
|
|
185
|
+
makeClient: () => makeClient$11,
|
|
186
186
|
makeQuery: () => makeQuery,
|
|
187
187
|
makeQueryClient: () => makeQueryClient,
|
|
188
188
|
queryConfig: () => queryConfig,
|
|
@@ -375,7 +375,7 @@ const isAnalyticsEngineDataset = (value) => {
|
|
|
375
375
|
if (typeof value !== "object" || value === null) return false;
|
|
376
376
|
return typeof Reflect.get(value, "writeDataPoint") === "function";
|
|
377
377
|
};
|
|
378
|
-
const makeClient$
|
|
378
|
+
const makeClient$11 = (definition, defaults) => (dataset) => {
|
|
379
379
|
const writeDataPoint = (dataPoint, options) => {
|
|
380
380
|
const policy = resolveWritePolicy(defaults, options);
|
|
381
381
|
return validateOptionalDataPoint(definition.binding, "writeDataPoint", dataPoint).pipe(Effect.matchEffect({
|
|
@@ -410,12 +410,12 @@ const queryLayerConfig = (tag, config = queryConfig()) => Layer.effect(tag, Effe
|
|
|
410
410
|
return yield* makeQueryClient(yield* config);
|
|
411
411
|
}));
|
|
412
412
|
const queryFetchLayerConfig = (tag, config = queryConfig()) => queryLayerConfig(tag, config).pipe(Layer.provide(FetchHttpClient.layer));
|
|
413
|
-
const layer$
|
|
414
|
-
const make$
|
|
413
|
+
const layer$15 = (tag, definition) => layer$18(tag, definition.binding, isAnalyticsEngineDataset, makeClient$11(definition, definition.write), { expected: expectedAnalyticsEngineDataset });
|
|
414
|
+
const make$15 = (id) => Tag$15()(id);
|
|
415
415
|
const makeQuery = (id) => QueryTag()(id);
|
|
416
|
-
const Tag$
|
|
416
|
+
const Tag$15 = () => (id) => {
|
|
417
417
|
const tag = Context.Service()(id);
|
|
418
|
-
const makeLayer = (definition) => layer$
|
|
418
|
+
const makeLayer = (definition) => layer$15(tag, definition);
|
|
419
419
|
return Object.assign(tag, {
|
|
420
420
|
id,
|
|
421
421
|
layer: makeLayer
|
|
@@ -439,11 +439,11 @@ const QueryTag = () => (id) => {
|
|
|
439
439
|
//#region src/BrowserRendering.ts
|
|
440
440
|
var BrowserRendering_exports = /* @__PURE__ */ __exportAll({
|
|
441
441
|
BrowserRenderingOperationError: () => BrowserRenderingOperationError,
|
|
442
|
-
Tag: () => Tag$
|
|
442
|
+
Tag: () => Tag$14,
|
|
443
443
|
isBrowserRenderingBinding: () => isBrowserRenderingBinding,
|
|
444
|
-
layer: () => layer$
|
|
445
|
-
make: () => make$
|
|
446
|
-
makeClient: () => makeClient$
|
|
444
|
+
layer: () => layer$14,
|
|
445
|
+
make: () => make$14,
|
|
446
|
+
makeClient: () => makeClient$10
|
|
447
447
|
});
|
|
448
448
|
const expectedBrowserRenderingBinding = "Browser Rendering binding resource";
|
|
449
449
|
/** Error raised when a Browser Rendering operation fails. */
|
|
@@ -480,17 +480,17 @@ const wrapBrowser = (binding, browser) => ({
|
|
|
480
480
|
disconnect: browser.disconnect === void 0 ? Effect.void : tryBrowserRenderingSync(binding, "disconnect", () => browser.disconnect())
|
|
481
481
|
});
|
|
482
482
|
const isBrowserRenderingBinding = (value) => (typeof value === "object" || typeof value === "function") && value !== null;
|
|
483
|
-
const makeClient$
|
|
483
|
+
const makeClient$10 = (definition) => (binding) => ({
|
|
484
484
|
definition,
|
|
485
485
|
launchWith: (launch, options) => tryBrowserRenderingPromise(definition.binding, "launch", () => launch(binding, options)).pipe(Effect.map((browser) => wrapBrowser(definition.binding, browser))),
|
|
486
486
|
connectWith: (connect, options) => tryBrowserRenderingPromise(definition.binding, "connect", () => connect(binding, options)).pipe(Effect.map((browser) => wrapBrowser(definition.binding, browser))),
|
|
487
487
|
unsafeRaw: Effect.succeed(binding)
|
|
488
488
|
});
|
|
489
|
-
const layer$
|
|
490
|
-
const make$
|
|
491
|
-
const Tag$
|
|
489
|
+
const layer$14 = (tag, definition) => layer$18(tag, definition.binding, isBrowserRenderingBinding, makeClient$10(definition), { expected: expectedBrowserRenderingBinding });
|
|
490
|
+
const make$14 = (id) => Tag$14()(id);
|
|
491
|
+
const Tag$14 = () => (id) => {
|
|
492
492
|
const tag = Context.Service()(id);
|
|
493
|
-
const makeLayer = (definition) => layer$
|
|
493
|
+
const makeLayer = (definition) => layer$14(tag, definition);
|
|
494
494
|
return Object.assign(tag, {
|
|
495
495
|
id,
|
|
496
496
|
layer: makeLayer
|
|
@@ -789,7 +789,7 @@ const runPromiseExitPreservingTypedFailures = async (effect) => {
|
|
|
789
789
|
//#region src/CloudflareOtlp.ts
|
|
790
790
|
var CloudflareOtlp_exports = /* @__PURE__ */ __exportAll({
|
|
791
791
|
durableObjectLayer: () => durableObjectLayer,
|
|
792
|
-
layer: () => layer$
|
|
792
|
+
layer: () => layer$13,
|
|
793
793
|
layerJson: () => layerJson,
|
|
794
794
|
layerProtobuf: () => layerProtobuf,
|
|
795
795
|
workerLayer: () => workerLayer
|
|
@@ -851,14 +851,14 @@ const makeLayer = (options = {}, runtimeAttributes = {}) => {
|
|
|
851
851
|
* installed as the primary `ConfigProvider`; outside Cloudflare, the ambient
|
|
852
852
|
* Effect `ConfigProvider` remains the fallback.
|
|
853
853
|
*/
|
|
854
|
-
const layer$
|
|
854
|
+
const layer$13 = (options = {}) => makeLayer(options);
|
|
855
855
|
/** Base OTLP telemetry layer forced to JSON serialization. */
|
|
856
|
-
const layerJson = (options = {}) => layer$
|
|
856
|
+
const layerJson = (options = {}) => layer$13({
|
|
857
857
|
...options,
|
|
858
858
|
serialization: "json"
|
|
859
859
|
});
|
|
860
860
|
/** Base OTLP telemetry layer forced to protobuf serialization. */
|
|
861
|
-
const layerProtobuf = (options = {}) => layer$
|
|
861
|
+
const layerProtobuf = (options = {}) => layer$13({
|
|
862
862
|
...options,
|
|
863
863
|
serialization: "protobuf"
|
|
864
864
|
});
|
|
@@ -885,6 +885,118 @@ const durableObjectLayer = (options = {}) => Layer.unwrap(Effect.map(DurableObje
|
|
|
885
885
|
"cloudflare.durable_object.id": options.includeObjectId ? state.id.toString() : void 0
|
|
886
886
|
})));
|
|
887
887
|
//#endregion
|
|
888
|
+
//#region src/ContainerNamespace.ts
|
|
889
|
+
var ContainerNamespace_exports = /* @__PURE__ */ __exportAll({
|
|
890
|
+
ContainerNamespace: () => ContainerNamespace,
|
|
891
|
+
ContainerOperationError: () => ContainerOperationError,
|
|
892
|
+
ContainerState: () => ContainerState,
|
|
893
|
+
Tag: () => Tag$13,
|
|
894
|
+
isContainerNamespaceResource: () => isContainerNamespaceResource,
|
|
895
|
+
layer: () => layer$12,
|
|
896
|
+
make: () => make$13,
|
|
897
|
+
makeClient: () => makeClient$9
|
|
898
|
+
});
|
|
899
|
+
const expectedContainerNamespace = "Container namespace binding with getByName()";
|
|
900
|
+
/** Serializable state reported by a Cloudflare Container instance. */
|
|
901
|
+
const ContainerState = Schema.Union([Schema.Struct({
|
|
902
|
+
lastChange: Schema.Finite,
|
|
903
|
+
status: Schema.Literals([
|
|
904
|
+
"running",
|
|
905
|
+
"stopping",
|
|
906
|
+
"stopped",
|
|
907
|
+
"healthy"
|
|
908
|
+
])
|
|
909
|
+
}), Schema.Struct({
|
|
910
|
+
lastChange: Schema.Finite,
|
|
911
|
+
status: Schema.Literal("stopped_with_code"),
|
|
912
|
+
exitCode: Schema.optionalKey(Schema.Int)
|
|
913
|
+
})]);
|
|
914
|
+
/** Failure raised when invoking a named Container operation. */
|
|
915
|
+
var ContainerOperationError = class extends Data.TaggedError("ContainerOperationError") {};
|
|
916
|
+
const tryContainerPromise = (definition, instance, operation, evaluate) => Effect.tryPromise({
|
|
917
|
+
try: evaluate,
|
|
918
|
+
catch: (cause) => new ContainerOperationError({
|
|
919
|
+
binding: definition.binding,
|
|
920
|
+
instance,
|
|
921
|
+
operation,
|
|
922
|
+
cause
|
|
923
|
+
})
|
|
924
|
+
});
|
|
925
|
+
const makeInstanceClient = (definition, instance, stub) => ({
|
|
926
|
+
unsafeRaw: Effect.succeed(stub),
|
|
927
|
+
state: tryContainerPromise(definition, instance, "state", () => stub.getState()).pipe(Effect.flatMap(Schema.decodeUnknownEffect(ContainerState)), Effect.mapError((cause) => cause instanceof ContainerOperationError ? cause : new ContainerOperationError({
|
|
928
|
+
binding: definition.binding,
|
|
929
|
+
instance,
|
|
930
|
+
operation: "state",
|
|
931
|
+
cause
|
|
932
|
+
}))),
|
|
933
|
+
fetch: (input, init) => tryContainerPromise(definition, instance, "fetch", () => stub.fetch(input, init)),
|
|
934
|
+
start: (options, waitOptions) => tryContainerPromise(definition, instance, "start", () => stub.start(options, waitOptions)),
|
|
935
|
+
startAndWaitForPorts: (options) => tryContainerPromise(definition, instance, "startAndWaitForPorts", () => stub.startAndWaitForPorts(options)),
|
|
936
|
+
stop: (signal) => tryContainerPromise(definition, instance, "stop", () => stub.stop(signal)),
|
|
937
|
+
destroy: tryContainerPromise(definition, instance, "destroy", () => stub.destroy())
|
|
938
|
+
});
|
|
939
|
+
const isContainerNamespaceResource = (value) => typeof value === "object" && value !== null && typeof Reflect.get(value, "getByName") === "function";
|
|
940
|
+
const makeClient$9 = (definition) => (namespace) => {
|
|
941
|
+
const getByName = (name, options) => Effect.try({
|
|
942
|
+
try: () => makeInstanceClient(definition, name, namespace.getByName(name, options)),
|
|
943
|
+
catch: (cause) => new ContainerOperationError({
|
|
944
|
+
binding: definition.binding,
|
|
945
|
+
instance: name,
|
|
946
|
+
operation: "getByName",
|
|
947
|
+
cause
|
|
948
|
+
})
|
|
949
|
+
});
|
|
950
|
+
const byName = (name, options) => {
|
|
951
|
+
const instance = getByName(name, options);
|
|
952
|
+
return {
|
|
953
|
+
unsafeRaw: Effect.flatMap(instance, (client) => client.unsafeRaw),
|
|
954
|
+
state: Effect.flatMap(instance, (client) => client.state),
|
|
955
|
+
fetch: (input, init) => Effect.flatMap(instance, (client) => client.fetch(input, init)),
|
|
956
|
+
start: (startOptions, waitOptions) => Effect.flatMap(instance, (client) => client.start(startOptions, waitOptions)),
|
|
957
|
+
startAndWaitForPorts: (startOptions) => Effect.flatMap(instance, (client) => client.startAndWaitForPorts(startOptions)),
|
|
958
|
+
stop: (signal) => Effect.flatMap(instance, (client) => client.stop(signal)),
|
|
959
|
+
destroy: Effect.flatMap(instance, (client) => client.destroy)
|
|
960
|
+
};
|
|
961
|
+
};
|
|
962
|
+
return {
|
|
963
|
+
definition,
|
|
964
|
+
getByName,
|
|
965
|
+
byName,
|
|
966
|
+
unsafeRaw: Effect.succeed(namespace)
|
|
967
|
+
};
|
|
968
|
+
};
|
|
969
|
+
const layer$12 = (tag, definition) => layer$18(tag, definition.binding, isContainerNamespaceResource, makeClient$9(definition), { expected: expectedContainerNamespace });
|
|
970
|
+
const make$13 = (id) => Tag$13()(id);
|
|
971
|
+
/** Creates a typed Effect service for a Cloudflare Container namespace. */
|
|
972
|
+
const Tag$13 = () => (id) => {
|
|
973
|
+
const tag = Context.Service()(id);
|
|
974
|
+
const makeLayer = (definition) => layer$12(tag, definition);
|
|
975
|
+
const getByName = (name, options) => Effect.gen(function* () {
|
|
976
|
+
return yield* (yield* tag).getByName(name, options);
|
|
977
|
+
});
|
|
978
|
+
const byName = (name, options) => ({
|
|
979
|
+
state: Effect.flatMap(getByName(name, options), (instance) => instance.state),
|
|
980
|
+
fetch: (input, init) => Effect.flatMap(getByName(name, options), (instance) => instance.fetch(input, init)),
|
|
981
|
+
start: (startOptions, waitOptions) => Effect.flatMap(getByName(name, options), (instance) => instance.start(startOptions, waitOptions)),
|
|
982
|
+
startAndWaitForPorts: (startOptions) => Effect.flatMap(getByName(name, options), (instance) => instance.startAndWaitForPorts(startOptions)),
|
|
983
|
+
stop: (signal) => Effect.flatMap(getByName(name, options), (instance) => instance.stop(signal)),
|
|
984
|
+
destroy: Effect.flatMap(getByName(name, options), (instance) => instance.destroy),
|
|
985
|
+
unsafeRaw: Effect.flatMap(getByName(name, options), (instance) => instance.unsafeRaw)
|
|
986
|
+
});
|
|
987
|
+
const unsafeRaw = Effect.fn(function* () {
|
|
988
|
+
return yield* (yield* tag).unsafeRaw;
|
|
989
|
+
});
|
|
990
|
+
return Object.assign(tag, {
|
|
991
|
+
id,
|
|
992
|
+
layer: makeLayer,
|
|
993
|
+
getByName,
|
|
994
|
+
byName,
|
|
995
|
+
unsafeRaw
|
|
996
|
+
});
|
|
997
|
+
};
|
|
998
|
+
const ContainerNamespace = Tag$13;
|
|
999
|
+
//#endregion
|
|
888
1000
|
//#region src/D1.ts
|
|
889
1001
|
var D1_exports = /* @__PURE__ */ __exportAll({
|
|
890
1002
|
Service: () => Service$1,
|
|
@@ -992,7 +1104,7 @@ const makeClient$8 = (definition) => {
|
|
|
992
1104
|
unsafeRaw: Effect.succeed(queue)
|
|
993
1105
|
});
|
|
994
1106
|
};
|
|
995
|
-
const layer$11 = (tag, definition) => layer$
|
|
1107
|
+
const layer$11 = (tag, definition) => layer$18(tag, definition.binding, (value) => isQueue(value), makeClient$8(definition), { expected: expectedQueueProducer });
|
|
996
1108
|
//#endregion
|
|
997
1109
|
//#region src/QueueDefinition.ts
|
|
998
1110
|
var QueueDefinition_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -1335,7 +1447,7 @@ const makeClient$7 = (definition) => {
|
|
|
1335
1447
|
});
|
|
1336
1448
|
};
|
|
1337
1449
|
};
|
|
1338
|
-
const layer$10 = (tag, definition) => layer$
|
|
1450
|
+
const layer$10 = (tag, definition) => layer$18(tag, definition.binding, (value) => isServiceBindingClient(value), makeClient$7(definition), { expected: expectedServiceBinding });
|
|
1339
1451
|
/**
|
|
1340
1452
|
* Creates a typed Effect service for a Worker service binding.
|
|
1341
1453
|
*
|
|
@@ -1712,7 +1824,7 @@ const makeClient$6 = (definition) => {
|
|
|
1712
1824
|
});
|
|
1713
1825
|
};
|
|
1714
1826
|
};
|
|
1715
|
-
const layer$8 = (tag, definition) => layer$
|
|
1827
|
+
const layer$8 = (tag, definition) => layer$18(tag, definition.binding, (value) => isDurableObjectNamespaceClient(value), makeClient$6(definition), { expected: expectedDurableObjectNamespace });
|
|
1716
1828
|
const makeDirectMethods = (rpcDefinition, helpers) => {
|
|
1717
1829
|
const methods = {};
|
|
1718
1830
|
if (rpcDefinition !== void 0) {
|
|
@@ -2427,7 +2539,7 @@ const makeClient$5 = (definition) => (email) => {
|
|
|
2427
2539
|
unsafeRaw: Effect.succeed(email)
|
|
2428
2540
|
};
|
|
2429
2541
|
};
|
|
2430
|
-
const layer$5 = (tag, definition) => layer$
|
|
2542
|
+
const layer$5 = (tag, definition) => layer$18(tag, definition.binding, isEmailBinding, makeClient$5(definition), { expected: expectedSendEmailBinding });
|
|
2431
2543
|
const make$5 = (id) => Tag$6()(id);
|
|
2432
2544
|
const Tag$6 = () => (id) => {
|
|
2433
2545
|
const tag = Context.Service()(id);
|
|
@@ -2534,7 +2646,7 @@ const makeClient$4 = (definition) => (images) => {
|
|
|
2534
2646
|
unsafeRaw: Effect.succeed(images)
|
|
2535
2647
|
};
|
|
2536
2648
|
};
|
|
2537
|
-
const layer$4 = (tag, definition) => layer$
|
|
2649
|
+
const layer$4 = (tag, definition) => layer$18(tag, definition.binding, isImagesBinding, makeClient$4(definition), { expected: expectedImagesBinding });
|
|
2538
2650
|
const make$4 = (id) => Tag$5()(id);
|
|
2539
2651
|
const Tag$5 = () => (id) => {
|
|
2540
2652
|
const tag = Context.Service()(id);
|
|
@@ -2629,7 +2741,7 @@ const makeClient$3 = (definition) => {
|
|
|
2629
2741
|
unsafeRaw: Effect.succeed(kv)
|
|
2630
2742
|
});
|
|
2631
2743
|
};
|
|
2632
|
-
const layer$3 = (tag, definition) => layer$
|
|
2744
|
+
const layer$3 = (tag, definition) => layer$18(tag, definition.binding, isKvNamespace, makeClient$3(definition), { expected: expectedKvNamespace });
|
|
2633
2745
|
const makeDefinition$1 = (id, definition) => {
|
|
2634
2746
|
const kvDefinition = {
|
|
2635
2747
|
id,
|
|
@@ -2746,7 +2858,7 @@ const makeClient$2 = (definition) => {
|
|
|
2746
2858
|
};
|
|
2747
2859
|
};
|
|
2748
2860
|
};
|
|
2749
|
-
const layer$2 = (tag, definition) => layer$
|
|
2861
|
+
const layer$2 = (tag, definition) => layer$18(tag, definition.binding, isR2Bucket, makeClient$2(definition), { expected: expectedR2Bucket });
|
|
2750
2862
|
const make$3 = (id) => Tag$3()(id);
|
|
2751
2863
|
const Tag$3 = () => (id) => {
|
|
2752
2864
|
const tag = Context.Service()(id);
|
|
@@ -2803,7 +2915,7 @@ const makeClient$1 = (definition) => {
|
|
|
2803
2915
|
return {
|
|
2804
2916
|
status: status.status,
|
|
2805
2917
|
output,
|
|
2806
|
-
error: status.error
|
|
2918
|
+
error: status.error == null ? Option.none() : Option.some(status.error)
|
|
2807
2919
|
};
|
|
2808
2920
|
}))),
|
|
2809
2921
|
sendEvent: (event) => operation("sendEvent", () => raw.sendEvent(event))
|
|
@@ -2832,7 +2944,7 @@ const makeClient$1 = (definition) => {
|
|
|
2832
2944
|
unsafeRaw: Effect.succeed(workflow)
|
|
2833
2945
|
});
|
|
2834
2946
|
};
|
|
2835
|
-
const layer$1 = (tag, definition) => layer$
|
|
2947
|
+
const layer$1 = (tag, definition) => layer$18(tag, definition.binding, (value) => isWorkflow(value), makeClient$1(definition), { expected: expectedWorkflow });
|
|
2836
2948
|
//#endregion
|
|
2837
2949
|
//#region src/WorkflowDefinition.ts
|
|
2838
2950
|
var WorkflowDefinition_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -3006,7 +3118,7 @@ const makeClient = (definition) => (index) => {
|
|
|
3006
3118
|
unsafeRaw: Effect.succeed(index)
|
|
3007
3119
|
};
|
|
3008
3120
|
};
|
|
3009
|
-
const layer = (tag, definition) => layer$
|
|
3121
|
+
const layer = (tag, definition) => layer$18(tag, definition.binding, isVectorizeBinding, makeClient(definition), { expected: expectedVectorizeBinding });
|
|
3010
3122
|
const make = (id) => Tag()(id);
|
|
3011
3123
|
const Tag = () => (id) => {
|
|
3012
3124
|
const tag = Context.Service()(id);
|
|
@@ -3017,4 +3129,4 @@ const Tag = () => (id) => {
|
|
|
3017
3129
|
});
|
|
3018
3130
|
};
|
|
3019
3131
|
//#endregion
|
|
3020
|
-
export { AiGateway_exports as AiGateway, AnalyticsEngine_exports as AnalyticsEngine, Binding_exports as Binding, BrowserRendering_exports as BrowserRendering, CloudflareOtlp_exports as CloudflareOtlp, D1_exports as D1, DurableObject_exports as DurableObject, DurableObjectAlarm_exports as DurableObjectAlarm, DurableObjectDefinition_exports as DurableObjectDefinition, DurableObjectNamespace_exports as DurableObjectNamespace, DurableObjectRpcWebSocket_exports as DurableObjectRpcWebSocket, DurableObjectSqlite_exports as DurableObjectSqlite, DurableObjectState_exports as DurableObjectState, DurableObjectStorage_exports as DurableObjectStorage, DurableObjectWebSocket_exports as DurableObjectWebSocket, Email_exports as Email, Hyperdrive_exports as Hyperdrive, Images_exports as Images, Kv_exports as Kv, Queue_exports as Queue, QueueBinding_exports as QueueBinding, QueueDefinition_exports as QueueDefinition, R2_exports as R2, Rpc_exports as Rpc, RpcDefinition_exports as RpcDefinition, ServiceBinding_exports as ServiceBinding, Vectorize_exports as Vectorize, Worker_exports as Worker, WorkerConfig, WorkerDefinition_exports as WorkerDefinition, WorkerEnvironment, WorkersAi_exports as WorkersAi, Workflow_exports as Workflow, WorkflowBinding_exports as WorkflowBinding, WorkflowDefinition_exports as WorkflowDefinition };
|
|
3132
|
+
export { AiGateway_exports as AiGateway, AnalyticsEngine_exports as AnalyticsEngine, Binding_exports as Binding, BrowserRendering_exports as BrowserRendering, CloudflareOtlp_exports as CloudflareOtlp, ContainerNamespace_exports as ContainerNamespace, D1_exports as D1, DurableObject_exports as DurableObject, DurableObjectAlarm_exports as DurableObjectAlarm, DurableObjectDefinition_exports as DurableObjectDefinition, DurableObjectNamespace_exports as DurableObjectNamespace, DurableObjectRpcWebSocket_exports as DurableObjectRpcWebSocket, DurableObjectSqlite_exports as DurableObjectSqlite, DurableObjectState_exports as DurableObjectState, DurableObjectStorage_exports as DurableObjectStorage, DurableObjectWebSocket_exports as DurableObjectWebSocket, Email_exports as Email, Hyperdrive_exports as Hyperdrive, Images_exports as Images, Kv_exports as Kv, Queue_exports as Queue, QueueBinding_exports as QueueBinding, QueueDefinition_exports as QueueDefinition, R2_exports as R2, Rpc_exports as Rpc, RpcDefinition_exports as RpcDefinition, ServiceBinding_exports as ServiceBinding, Vectorize_exports as Vectorize, Worker_exports as Worker, WorkerConfig, WorkerDefinition_exports as WorkerDefinition, WorkerEnvironment, WorkersAi_exports as WorkersAi, Workflow_exports as Workflow, WorkflowBinding_exports as WorkflowBinding, WorkflowDefinition_exports as WorkflowDefinition };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "effect-cf",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.1",
|
|
4
4
|
"description": "Effect-native primitives for Cloudflare Workers and bindings.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"prepublishOnly": "vp run build"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
+
"@cloudflare/containers": "catalog:",
|
|
42
43
|
"@cloudflare/vitest-pool-workers": "catalog:",
|
|
43
44
|
"@cloudflare/workers-types": "catalog:",
|
|
44
45
|
"@effect/platform-node": "4.0.0-beta.77",
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
import { Context, Data, Effect, Schema, type Layer } from "effect";
|
|
2
|
+
|
|
3
|
+
import * as Binding from "./Binding";
|
|
4
|
+
import type { WorkerEnvironment } from "./Environment";
|
|
5
|
+
|
|
6
|
+
const expectedContainerNamespace = "Container namespace binding with getByName()";
|
|
7
|
+
|
|
8
|
+
/** Signal accepted by Cloudflare Container instances. */
|
|
9
|
+
export type ContainerSignal = "SIGKILL" | "SIGINT" | "SIGTERM";
|
|
10
|
+
|
|
11
|
+
/** Per-instance Container startup configuration. */
|
|
12
|
+
export interface ContainerStartOptions {
|
|
13
|
+
readonly envVars?: Record<string, string>;
|
|
14
|
+
readonly entrypoint?: Array<string>;
|
|
15
|
+
readonly enableInternet?: boolean;
|
|
16
|
+
readonly labels?: Record<string, string>;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** Serializable retry settings used while starting a Container. */
|
|
20
|
+
export interface ContainerWaitOptions {
|
|
21
|
+
readonly portToCheck: number;
|
|
22
|
+
readonly retries?: number;
|
|
23
|
+
readonly waitInterval?: number;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** Serializable timeout settings used while waiting for Container ports. */
|
|
27
|
+
export interface ContainerReadinessOptions {
|
|
28
|
+
readonly instanceGetTimeoutMS?: number;
|
|
29
|
+
readonly portReadyTimeoutMS?: number;
|
|
30
|
+
readonly waitInterval?: number;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Options for starting a Container and waiting for its ports. */
|
|
34
|
+
export interface ContainerStartAndWaitForPortsOptions {
|
|
35
|
+
readonly startOptions?: ContainerStartOptions;
|
|
36
|
+
readonly ports?: number | Array<number>;
|
|
37
|
+
readonly cancellationOptions?: ContainerReadinessOptions;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Serializable state reported by a Cloudflare Container instance. */
|
|
41
|
+
export const ContainerState = Schema.Union([
|
|
42
|
+
Schema.Struct({
|
|
43
|
+
lastChange: Schema.Finite,
|
|
44
|
+
status: Schema.Literals(["running", "stopping", "stopped", "healthy"]),
|
|
45
|
+
}),
|
|
46
|
+
Schema.Struct({
|
|
47
|
+
lastChange: Schema.Finite,
|
|
48
|
+
status: Schema.Literal("stopped_with_code"),
|
|
49
|
+
exitCode: Schema.optionalKey(Schema.Int),
|
|
50
|
+
}),
|
|
51
|
+
]);
|
|
52
|
+
export type ContainerState = typeof ContainerState.Type;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Native Container stub shape exposed by a Container namespace binding.
|
|
56
|
+
*
|
|
57
|
+
* This is structural so using Container bindings does not make
|
|
58
|
+
* `@cloudflare/containers` a runtime dependency of effect-cf.
|
|
59
|
+
*/
|
|
60
|
+
export interface ContainerStub {
|
|
61
|
+
fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
|
|
62
|
+
getState(): Promise<ContainerState>;
|
|
63
|
+
start(options?: ContainerStartOptions, waitOptions?: ContainerWaitOptions): Promise<void>;
|
|
64
|
+
startAndWaitForPorts(options?: ContainerStartAndWaitForPortsOptions): Promise<void>;
|
|
65
|
+
stop(signal?: ContainerSignal): Promise<void>;
|
|
66
|
+
destroy(): Promise<void>;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** Native Container namespace binding shape. */
|
|
70
|
+
export interface ContainerNamespaceResource {
|
|
71
|
+
getByName(
|
|
72
|
+
name: string,
|
|
73
|
+
options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions,
|
|
74
|
+
): ContainerStub;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** Container namespace binding metadata. */
|
|
78
|
+
export interface ContainerNamespaceDefinition {
|
|
79
|
+
/** Binding name as configured in `wrangler.jsonc`. */
|
|
80
|
+
readonly binding: string;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** Failure raised when invoking a named Container operation. */
|
|
84
|
+
export class ContainerOperationError extends Data.TaggedError("ContainerOperationError")<{
|
|
85
|
+
readonly binding: string;
|
|
86
|
+
readonly instance: string;
|
|
87
|
+
readonly operation: string;
|
|
88
|
+
readonly cause: unknown;
|
|
89
|
+
}> {}
|
|
90
|
+
|
|
91
|
+
/** Effect-wrapped client for one named Container instance. */
|
|
92
|
+
export interface ContainerInstanceClient {
|
|
93
|
+
readonly unsafeRaw: Effect.Effect<ContainerStub, ContainerOperationError>;
|
|
94
|
+
readonly state: Effect.Effect<ContainerState, ContainerOperationError>;
|
|
95
|
+
readonly fetch: (
|
|
96
|
+
input: RequestInfo | URL,
|
|
97
|
+
init?: RequestInit,
|
|
98
|
+
) => Effect.Effect<Response, ContainerOperationError>;
|
|
99
|
+
readonly start: (
|
|
100
|
+
options?: ContainerStartOptions,
|
|
101
|
+
waitOptions?: ContainerWaitOptions,
|
|
102
|
+
) => Effect.Effect<void, ContainerOperationError>;
|
|
103
|
+
readonly startAndWaitForPorts: (
|
|
104
|
+
options?: ContainerStartAndWaitForPortsOptions,
|
|
105
|
+
) => Effect.Effect<void, ContainerOperationError>;
|
|
106
|
+
readonly stop: (signal?: ContainerSignal) => Effect.Effect<void, ContainerOperationError>;
|
|
107
|
+
readonly destroy: Effect.Effect<void, ContainerOperationError>;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** Effect client for a Container namespace binding. */
|
|
111
|
+
export interface ContainerNamespaceClient {
|
|
112
|
+
readonly definition: ContainerNamespaceDefinition;
|
|
113
|
+
readonly getByName: (
|
|
114
|
+
name: string,
|
|
115
|
+
options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions,
|
|
116
|
+
) => Effect.Effect<ContainerInstanceClient, ContainerOperationError>;
|
|
117
|
+
readonly byName: (
|
|
118
|
+
name: string,
|
|
119
|
+
options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions,
|
|
120
|
+
) => ContainerInstanceClient;
|
|
121
|
+
readonly unsafeRaw: Effect.Effect<ContainerNamespaceResource>;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export type ContainerNamespaceStaticClient<R> = {
|
|
125
|
+
readonly getByName: (
|
|
126
|
+
name: string,
|
|
127
|
+
options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions,
|
|
128
|
+
) => Effect.Effect<ContainerInstanceClient, ContainerOperationError, R>;
|
|
129
|
+
readonly byName: (
|
|
130
|
+
name: string,
|
|
131
|
+
options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions,
|
|
132
|
+
) => {
|
|
133
|
+
readonly state: Effect.Effect<ContainerState, ContainerOperationError, R>;
|
|
134
|
+
readonly fetch: (
|
|
135
|
+
input: RequestInfo | URL,
|
|
136
|
+
init?: RequestInit,
|
|
137
|
+
) => Effect.Effect<Response, ContainerOperationError, R>;
|
|
138
|
+
readonly start: (
|
|
139
|
+
options?: ContainerStartOptions,
|
|
140
|
+
waitOptions?: ContainerWaitOptions,
|
|
141
|
+
) => Effect.Effect<void, ContainerOperationError, R>;
|
|
142
|
+
readonly startAndWaitForPorts: (
|
|
143
|
+
options?: ContainerStartAndWaitForPortsOptions,
|
|
144
|
+
) => Effect.Effect<void, ContainerOperationError, R>;
|
|
145
|
+
readonly stop: (signal?: ContainerSignal) => Effect.Effect<void, ContainerOperationError, R>;
|
|
146
|
+
readonly destroy: Effect.Effect<void, ContainerOperationError, R>;
|
|
147
|
+
readonly unsafeRaw: Effect.Effect<ContainerStub, ContainerOperationError, R>;
|
|
148
|
+
};
|
|
149
|
+
readonly unsafeRaw: () => Effect.Effect<ContainerNamespaceResource, never, R>;
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
export type LayerOptions = {
|
|
153
|
+
readonly binding: string;
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
export interface TagClass<Self, Id extends string>
|
|
157
|
+
extends
|
|
158
|
+
Context.ServiceClass<Self, Id, ContainerNamespaceClient>,
|
|
159
|
+
ContainerNamespaceStaticClient<Self> {
|
|
160
|
+
readonly id: Id;
|
|
161
|
+
readonly layer: (
|
|
162
|
+
options: LayerOptions,
|
|
163
|
+
) => Layer.Layer<
|
|
164
|
+
Self,
|
|
165
|
+
Binding.BindingNotFoundError | Binding.BindingValidationError,
|
|
166
|
+
WorkerEnvironment
|
|
167
|
+
>;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const tryContainerPromise = <A>(
|
|
171
|
+
definition: ContainerNamespaceDefinition,
|
|
172
|
+
instance: string,
|
|
173
|
+
operation: string,
|
|
174
|
+
evaluate: () => Promise<A>,
|
|
175
|
+
): Effect.Effect<A, ContainerOperationError> =>
|
|
176
|
+
Effect.tryPromise({
|
|
177
|
+
try: evaluate,
|
|
178
|
+
catch: (cause) =>
|
|
179
|
+
new ContainerOperationError({
|
|
180
|
+
binding: definition.binding,
|
|
181
|
+
instance,
|
|
182
|
+
operation,
|
|
183
|
+
cause,
|
|
184
|
+
}),
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
const makeInstanceClient = (
|
|
188
|
+
definition: ContainerNamespaceDefinition,
|
|
189
|
+
instance: string,
|
|
190
|
+
stub: ContainerStub,
|
|
191
|
+
): ContainerInstanceClient => ({
|
|
192
|
+
unsafeRaw: Effect.succeed(stub),
|
|
193
|
+
state: tryContainerPromise(definition, instance, "state", () => stub.getState()).pipe(
|
|
194
|
+
Effect.flatMap(Schema.decodeUnknownEffect(ContainerState)),
|
|
195
|
+
Effect.mapError((cause) =>
|
|
196
|
+
cause instanceof ContainerOperationError
|
|
197
|
+
? cause
|
|
198
|
+
: new ContainerOperationError({
|
|
199
|
+
binding: definition.binding,
|
|
200
|
+
instance,
|
|
201
|
+
operation: "state",
|
|
202
|
+
cause,
|
|
203
|
+
}),
|
|
204
|
+
),
|
|
205
|
+
),
|
|
206
|
+
fetch: (input, init) =>
|
|
207
|
+
tryContainerPromise(definition, instance, "fetch", () => stub.fetch(input, init)),
|
|
208
|
+
start: (options, waitOptions) =>
|
|
209
|
+
tryContainerPromise(definition, instance, "start", () => stub.start(options, waitOptions)),
|
|
210
|
+
startAndWaitForPorts: (options) =>
|
|
211
|
+
tryContainerPromise(definition, instance, "startAndWaitForPorts", () =>
|
|
212
|
+
stub.startAndWaitForPorts(options),
|
|
213
|
+
),
|
|
214
|
+
stop: (signal) => tryContainerPromise(definition, instance, "stop", () => stub.stop(signal)),
|
|
215
|
+
destroy: tryContainerPromise(definition, instance, "destroy", () => stub.destroy()),
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
export const isContainerNamespaceResource = (value: unknown): value is ContainerNamespaceResource =>
|
|
219
|
+
typeof value === "object" &&
|
|
220
|
+
value !== null &&
|
|
221
|
+
typeof Reflect.get(value, "getByName") === "function";
|
|
222
|
+
|
|
223
|
+
export const makeClient =
|
|
224
|
+
(definition: ContainerNamespaceDefinition) =>
|
|
225
|
+
(namespace: ContainerNamespaceResource): ContainerNamespaceClient => {
|
|
226
|
+
const getByName = (
|
|
227
|
+
name: string,
|
|
228
|
+
options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions,
|
|
229
|
+
) =>
|
|
230
|
+
Effect.try({
|
|
231
|
+
try: () => makeInstanceClient(definition, name, namespace.getByName(name, options)),
|
|
232
|
+
catch: (cause) =>
|
|
233
|
+
new ContainerOperationError({
|
|
234
|
+
binding: definition.binding,
|
|
235
|
+
instance: name,
|
|
236
|
+
operation: "getByName",
|
|
237
|
+
cause,
|
|
238
|
+
}),
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
const byName = (
|
|
242
|
+
name: string,
|
|
243
|
+
options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions,
|
|
244
|
+
): ContainerInstanceClient => {
|
|
245
|
+
const instance = getByName(name, options);
|
|
246
|
+
return {
|
|
247
|
+
unsafeRaw: Effect.flatMap(instance, (client) => client.unsafeRaw),
|
|
248
|
+
state: Effect.flatMap(instance, (client) => client.state),
|
|
249
|
+
fetch: (input, init) => Effect.flatMap(instance, (client) => client.fetch(input, init)),
|
|
250
|
+
start: (startOptions, waitOptions) =>
|
|
251
|
+
Effect.flatMap(instance, (client) => client.start(startOptions, waitOptions)),
|
|
252
|
+
startAndWaitForPorts: (startOptions) =>
|
|
253
|
+
Effect.flatMap(instance, (client) => client.startAndWaitForPorts(startOptions)),
|
|
254
|
+
stop: (signal) => Effect.flatMap(instance, (client) => client.stop(signal)),
|
|
255
|
+
destroy: Effect.flatMap(instance, (client) => client.destroy),
|
|
256
|
+
};
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
return {
|
|
260
|
+
definition,
|
|
261
|
+
getByName,
|
|
262
|
+
byName,
|
|
263
|
+
unsafeRaw: Effect.succeed(namespace),
|
|
264
|
+
};
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
export const layer = <Self>(
|
|
268
|
+
tag: Context.Service<Self, ContainerNamespaceClient>,
|
|
269
|
+
definition: ContainerNamespaceDefinition,
|
|
270
|
+
) =>
|
|
271
|
+
Binding.layer(tag, definition.binding, isContainerNamespaceResource, makeClient(definition), {
|
|
272
|
+
expected: expectedContainerNamespace,
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
export const make = <Id extends string>(id: Id) => Tag<ContainerNamespaceService<Id>>()<Id>(id);
|
|
276
|
+
|
|
277
|
+
declare const ContainerNamespaceServiceTypeId: unique symbol;
|
|
278
|
+
|
|
279
|
+
/** Nominal service marker for Container namespaces created with {@link make}. */
|
|
280
|
+
export interface ContainerNamespaceService<Id extends string> {
|
|
281
|
+
readonly [ContainerNamespaceServiceTypeId]: {
|
|
282
|
+
readonly id: Id;
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/** Creates a typed Effect service for a Cloudflare Container namespace. */
|
|
287
|
+
export const Tag =
|
|
288
|
+
<Self>() =>
|
|
289
|
+
<Id extends string>(id: Id) => {
|
|
290
|
+
const tag = Context.Service<Self, ContainerNamespaceClient>()(id);
|
|
291
|
+
const makeLayer = (definition: LayerOptions) => layer(tag, definition);
|
|
292
|
+
|
|
293
|
+
const getByName = (
|
|
294
|
+
name: string,
|
|
295
|
+
options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions,
|
|
296
|
+
) =>
|
|
297
|
+
Effect.gen(function* () {
|
|
298
|
+
const namespace = yield* tag;
|
|
299
|
+
return yield* namespace.getByName(name, options);
|
|
300
|
+
});
|
|
301
|
+
|
|
302
|
+
const byName = (
|
|
303
|
+
name: string,
|
|
304
|
+
options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions,
|
|
305
|
+
) => ({
|
|
306
|
+
state: Effect.flatMap(getByName(name, options), (instance) => instance.state),
|
|
307
|
+
fetch: (input: RequestInfo | URL, init?: RequestInit) =>
|
|
308
|
+
Effect.flatMap(getByName(name, options), (instance) => instance.fetch(input, init)),
|
|
309
|
+
start: (startOptions?: ContainerStartOptions, waitOptions?: ContainerWaitOptions) =>
|
|
310
|
+
Effect.flatMap(getByName(name, options), (instance) =>
|
|
311
|
+
instance.start(startOptions, waitOptions),
|
|
312
|
+
),
|
|
313
|
+
startAndWaitForPorts: (startOptions?: ContainerStartAndWaitForPortsOptions) =>
|
|
314
|
+
Effect.flatMap(getByName(name, options), (instance) =>
|
|
315
|
+
instance.startAndWaitForPorts(startOptions),
|
|
316
|
+
),
|
|
317
|
+
stop: (signal?: ContainerSignal) =>
|
|
318
|
+
Effect.flatMap(getByName(name, options), (instance) => instance.stop(signal)),
|
|
319
|
+
destroy: Effect.flatMap(getByName(name, options), (instance) => instance.destroy),
|
|
320
|
+
unsafeRaw: Effect.flatMap(getByName(name, options), (instance) => instance.unsafeRaw),
|
|
321
|
+
});
|
|
322
|
+
|
|
323
|
+
const unsafeRaw = Effect.fn(function* () {
|
|
324
|
+
const namespace = yield* tag;
|
|
325
|
+
return yield* namespace.unsafeRaw;
|
|
326
|
+
});
|
|
327
|
+
|
|
328
|
+
return Object.assign(tag, {
|
|
329
|
+
id,
|
|
330
|
+
layer: makeLayer,
|
|
331
|
+
getByName,
|
|
332
|
+
byName,
|
|
333
|
+
unsafeRaw,
|
|
334
|
+
}) as TagClass<Self, Id>;
|
|
335
|
+
};
|
|
336
|
+
|
|
337
|
+
export const ContainerNamespace = Tag;
|
package/src/WorkflowBinding.ts
CHANGED
|
@@ -187,7 +187,7 @@ export const makeClient = <
|
|
|
187
187
|
return {
|
|
188
188
|
status: status.status,
|
|
189
189
|
output,
|
|
190
|
-
error: status.error
|
|
190
|
+
error: status.error == null ? Option.none() : Option.some(status.error),
|
|
191
191
|
};
|
|
192
192
|
}),
|
|
193
193
|
),
|
package/src/index.ts
CHANGED
|
@@ -3,6 +3,7 @@ export * as AnalyticsEngine from "./AnalyticsEngine";
|
|
|
3
3
|
export * as Binding from "./Binding";
|
|
4
4
|
export * as BrowserRendering from "./BrowserRendering";
|
|
5
5
|
export * as CloudflareOtlp from "./CloudflareOtlp";
|
|
6
|
+
export * as ContainerNamespace from "./ContainerNamespace";
|
|
6
7
|
export * as D1 from "./D1";
|
|
7
8
|
export * as DurableObject from "./DurableObject";
|
|
8
9
|
export * as DurableObjectAlarm from "./DurableObjectAlarm";
|