effect-cf 0.33.0 → 0.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +31 -1079
- package/dist/{Artifacts-DnHQA-Ax.d.mts → Artifacts-B3r3RuTB.d.mts} +1 -48
- package/dist/{Artifacts-CSIk1Oml.mjs → Artifacts-CBxWGeZB.mjs} +2 -7
- package/dist/{Binding-pfilNJmP.mjs → Binding-C82jRhdr.mjs} +1 -2
- package/dist/{Binding-xJJJPmiD.d.mts → Binding-DKcLrQCM.d.mts} +0 -45
- package/dist/ComputerArtifacts.d.mts +1 -3
- package/dist/ComputerArtifacts.mjs +1 -2
- package/dist/ComputerWorkspace.d.mts +1 -10
- package/dist/ComputerWorkspace.mjs +1 -2
- package/dist/ComputerWorkspaceHost.d.mts +1 -9
- package/dist/{ContainerNamespace-CFjiLw8b.d.mts → ContainerNamespace-DbLaeFhN.d.mts} +1 -14
- package/dist/{DurableObjectState-BpRjz6-q.d.mts → DurableObjectState-CrEunfQ-.d.mts} +82 -252
- package/dist/{DurableObjectState-CVLLse69.mjs → DurableObjectState-De4ZojhY.mjs} +1 -39
- package/dist/{ErrorMessage-BM0K-Nik.mjs → ErrorMessage-Byx2OgNd.mjs} +0 -1
- package/dist/{Hyperdrive-z-9fFz15.d.mts → Hyperdrive-HrwFlZ6x.d.mts} +1 -4
- package/dist/HyperdrivePg.d.mts +2 -11
- package/dist/HyperdrivePg.mjs +0 -8
- package/dist/Sandbox.d.mts +2 -32
- package/dist/Sandbox.mjs +2 -11
- package/dist/Vitest.d.mts +3 -31
- package/dist/Vitest.mjs +2 -17
- package/dist/{WorkflowBinding-lBR4_-op.d.mts → WorkflowBinding-BumVQTuW.d.mts} +2 -5
- package/dist/index.d.mts +34 -480
- package/dist/index.mjs +174 -312
- package/package.json +1 -1
- package/src/AiGateway.ts +0 -6
- package/src/AnalyticsEngine.ts +0 -9
- package/src/Artifacts.ts +0 -47
- package/src/Binding.ts +0 -8
- package/src/BrowserRendering.ts +0 -4
- package/src/Cache.ts +0 -19
- package/src/CloudflareOtlp.ts +3 -39
- package/src/ComputerArtifacts.ts +0 -2
- package/src/ComputerWorkspace.ts +0 -9
- package/src/ComputerWorkspaceHost.ts +0 -8
- package/src/ContainerNamespace.ts +0 -13
- package/src/D1.ts +0 -22
- package/src/DurableObject.ts +45 -25
- package/src/DurableObjectAlarm.ts +6 -210
- package/src/DurableObjectDefinition.ts +8 -20
- package/src/DurableObjectNamespace.ts +57 -112
- package/src/DurableObjectRpcWebSocket.ts +3 -19
- package/src/DurableObjectSqlite.ts +0 -12
- package/src/DurableObjectState.ts +0 -18
- package/src/DurableObjectStorage.ts +2 -35
- package/src/DurableObjectWebSocket.ts +0 -31
- package/src/Email.ts +0 -12
- package/src/Environment.ts +0 -37
- package/src/Hyperdrive.ts +0 -3
- package/src/HyperdrivePg.ts +0 -9
- package/src/Images.ts +0 -5
- package/src/Kv.ts +0 -15
- package/src/QueueBinding.ts +0 -2
- package/src/R2.ts +0 -5
- package/src/RpcDefinition.ts +0 -2
- package/src/RpcTracing.ts +133 -0
- package/src/Sandbox.ts +0 -30
- package/src/ServiceBinding.ts +48 -125
- package/src/Vectorize.ts +0 -5
- package/src/Vitest.ts +0 -28
- package/src/WebTransport.ts +0 -15
- package/src/Worker.ts +36 -57
- package/src/WorkerDefinition.ts +5 -14
- package/src/WorkersAi.ts +0 -4
- package/src/Workflow.ts +0 -5
- package/src/WorkflowBinding.ts +0 -3
- package/src/index.ts +1 -0
- package/src/internal/Entrypoint.ts +23 -4
- package/src/internal/ErrorMessage.ts +0 -1
- package/src/internal/RpcInvocation.ts +18 -1
- package/src/internal/Runtime.ts +12 -7
- package/src/internal/WorkerContext.ts +0 -11
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import { c as WorkerEnvironment, r as BindingValidationError, t as BindingNotFoundError } from "./Binding-
|
|
1
|
+
import { c as WorkerEnvironment, r as BindingValidationError, t as BindingNotFoundError } from "./Binding-DKcLrQCM.mjs";
|
|
2
2
|
import { Context, Effect, Layer } from "effect";
|
|
3
3
|
declare namespace Artifacts_d_exports {
|
|
4
4
|
export { ArtifactsBinding, ArtifactsClient, ArtifactsCommit, ArtifactsCommitIdentity, ArtifactsCreateOptions, ArtifactsCreateRepoResult, ArtifactsCreateTokenResult, ArtifactsDefinition, ArtifactsErrorCode, ArtifactsForkOptions, ArtifactsImportParams, ArtifactsImportSource, ArtifactsImportTarget, ArtifactsImportTargetOptions, ArtifactsListOptions, ArtifactsLogOptions, ArtifactsLogResult, ArtifactsOperation, ArtifactsOperationError, ArtifactsRepoBinding, ArtifactsRepoClient, ArtifactsRepoInfo, ArtifactsRepoListEntry, ArtifactsRepoListResult, ArtifactsRepoStatus, ArtifactsService, ArtifactsTokenInfo, ArtifactsTokenListResult, ArtifactsTokenScope, ArtifactsTokenState, ArtifactsTree, Cursor, LayerOptions, RepoName, Tag, TagClass, artifactsErrorCodes, artifactsErrorNumericCodes, isArtifactsBinding, isArtifactsRepoBinding, layer, make, makeClient };
|
|
5
5
|
}
|
|
6
|
-
/** Artifacts operation represented by {@link ArtifactsOperationError}. */
|
|
7
6
|
type ArtifactsOperation = "createClient" | "create" | "get" | "import" | "list" | "delete" | "createToken" | "listTokens" | "getToken" | "revokeToken" | "fork" | "info" | "log" | "readCommit" | "readTree" | "cli";
|
|
8
|
-
/** Documented string error codes returned by Cloudflare Artifacts. */
|
|
9
7
|
declare const artifactsErrorCodes: readonly ["ALREADY_EXISTS", "NOT_FOUND", "IMPORT_IN_PROGRESS", "FORK_IN_PROGRESS", "INVALID_INPUT", "INVALID_REPO_NAME", "INVALID_TTL", "INVALID_URL", "REMOTE_AUTH_REQUIRED", "UPSTREAM_UNAVAILABLE", "MEMORY_LIMIT", "INTERNAL_ERROR"];
|
|
10
|
-
/** Documented numeric error codes returned by Cloudflare Artifacts. */
|
|
11
8
|
declare const artifactsErrorNumericCodes: {
|
|
12
9
|
readonly ALREADY_EXISTS: 10201;
|
|
13
10
|
readonly NOT_FOUND: 10200;
|
|
@@ -22,47 +19,34 @@ declare const artifactsErrorNumericCodes: {
|
|
|
22
19
|
readonly MEMORY_LIMIT: 10402;
|
|
23
20
|
readonly INTERNAL_ERROR: 10400;
|
|
24
21
|
};
|
|
25
|
-
/** A documented Cloudflare Artifacts string error code. */
|
|
26
22
|
type ArtifactsErrorCode = CloudflareArtifactsErrorCode;
|
|
27
23
|
declare const ArtifactsOperationError_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 & {
|
|
28
24
|
readonly _tag: "ArtifactsOperationError";
|
|
29
25
|
} & Readonly<A>;
|
|
30
|
-
/** Error raised when a Cloudflare Artifacts operation fails. */
|
|
31
26
|
declare class ArtifactsOperationError extends ArtifactsOperationError_base<{
|
|
32
27
|
readonly binding: string;
|
|
33
28
|
readonly operation: ArtifactsOperation;
|
|
34
29
|
readonly cause: unknown;
|
|
35
|
-
/** Cloudflare string error code, when retained by the runtime. */
|
|
36
30
|
readonly code?: ArtifactsErrorCode | (string & {});
|
|
37
|
-
/** Cloudflare REST-compatible numeric error code, when retained by the runtime. */
|
|
38
31
|
readonly numericCode?: number;
|
|
39
32
|
}> {
|
|
40
33
|
get message(): string;
|
|
41
34
|
}
|
|
42
|
-
/** Typed Cloudflare Artifacts binding definition. */
|
|
43
35
|
interface ArtifactsDefinition {
|
|
44
|
-
/** Binding name from an `artifacts` entry in `wrangler.jsonc`. */
|
|
45
36
|
readonly binding: string;
|
|
46
37
|
}
|
|
47
|
-
/** Repository name containing alphanumeric characters, dots, hyphens, or underscores. */
|
|
48
38
|
type RepoName = string;
|
|
49
|
-
/** Cursor used by repository list pagination. */
|
|
50
39
|
type Cursor = string;
|
|
51
40
|
/** Scope granted to a repository token. */
|
|
52
41
|
type ArtifactsTokenScope = "read" | "write";
|
|
53
42
|
/** Lifecycle state of a repository token. */
|
|
54
43
|
type ArtifactsTokenState = "active" | "expired" | "revoked";
|
|
55
|
-
/** Lifecycle state included with repositories returned by `list()`. */
|
|
56
44
|
type ArtifactsRepoStatus = "ready" | "importing" | "forking";
|
|
57
|
-
/** Stable repository metadata returned by Cloudflare Artifacts. */
|
|
58
45
|
type ArtifactsRepoInfo = CloudflareArtifactsRepoInfo;
|
|
59
|
-
/** Result of creating, importing, or forking a repository. */
|
|
60
46
|
type ArtifactsCreateRepoResult = Readonly<CloudflareArtifactsCreateRepoResult>;
|
|
61
|
-
/** Repository metadata returned by `list()`. */
|
|
62
47
|
interface ArtifactsRepoListEntry extends ArtifactsRepoInfo {
|
|
63
48
|
readonly status: ArtifactsRepoStatus;
|
|
64
49
|
}
|
|
65
|
-
/** Cursor-paginated repository list result. */
|
|
66
50
|
interface ArtifactsRepoListResult {
|
|
67
51
|
readonly repos: ReadonlyArray<ArtifactsRepoListEntry>;
|
|
68
52
|
readonly total: number;
|
|
@@ -87,12 +71,9 @@ interface ArtifactsCommit {
|
|
|
87
71
|
readonly author: ArtifactsCommitIdentity;
|
|
88
72
|
readonly committer: ArtifactsCommitIdentity;
|
|
89
73
|
readonly parents: ReadonlyArray<string>;
|
|
90
|
-
/** Unix timestamp in seconds. */
|
|
91
74
|
readonly authoredAt: number;
|
|
92
|
-
/** Unix timestamp in seconds. */
|
|
93
75
|
readonly committedAt: number;
|
|
94
76
|
}
|
|
95
|
-
/** Bare commit array returned by `log()`. */
|
|
96
77
|
type ArtifactsLogResult = ReadonlyArray<ArtifactsCommit>;
|
|
97
78
|
/**
|
|
98
79
|
* Parsed Git tree returned by `readTree()`.
|
|
@@ -103,60 +84,44 @@ type ArtifactsLogResult = ReadonlyArray<ArtifactsCommit>;
|
|
|
103
84
|
interface ArtifactsTree<Field = unknown> {
|
|
104
85
|
readonly [field: string]: Field;
|
|
105
86
|
}
|
|
106
|
-
/** Options for `Artifacts.create()`. */
|
|
107
87
|
interface ArtifactsCreateOptions {
|
|
108
|
-
/** Prevent pushes to the repository. */
|
|
109
88
|
readonly readOnly?: boolean;
|
|
110
89
|
readonly description?: string;
|
|
111
|
-
/** Initial default branch name. */
|
|
112
90
|
readonly setDefaultBranch?: string;
|
|
113
91
|
}
|
|
114
|
-
/** Options for cursor-paginating `Artifacts.list()`. */
|
|
115
92
|
interface ArtifactsListOptions {
|
|
116
|
-
/** Page size from 1 through 200. Defaults to 50. */
|
|
117
93
|
readonly limit?: number;
|
|
118
|
-
/** Cursor returned by a previous list result. */
|
|
119
94
|
readonly cursor?: Cursor;
|
|
120
95
|
}
|
|
121
96
|
/** External Git source used by `Artifacts.import()`. */
|
|
122
97
|
interface ArtifactsImportSource {
|
|
123
98
|
/** Full HTTPS URL of the Git repository. */
|
|
124
99
|
readonly url: string;
|
|
125
|
-
/** Source branch. Defaults to the remote's default branch. */
|
|
126
100
|
readonly branch?: string;
|
|
127
|
-
/** Shallow clone depth. */
|
|
128
101
|
readonly depth?: number;
|
|
129
102
|
}
|
|
130
|
-
/** Options for the target of `Artifacts.import()`. */
|
|
131
103
|
interface ArtifactsImportTargetOptions {
|
|
132
104
|
readonly description?: string;
|
|
133
105
|
readonly readOnly?: boolean;
|
|
134
106
|
}
|
|
135
|
-
/** Target repository used by `Artifacts.import()`. */
|
|
136
107
|
interface ArtifactsImportTarget {
|
|
137
108
|
readonly name: RepoName;
|
|
138
109
|
readonly opts?: ArtifactsImportTargetOptions;
|
|
139
110
|
}
|
|
140
|
-
/** Parameters for `Artifacts.import()`. */
|
|
141
111
|
interface ArtifactsImportParams {
|
|
142
112
|
readonly source: ArtifactsImportSource;
|
|
143
113
|
readonly target: ArtifactsImportTarget;
|
|
144
114
|
}
|
|
145
|
-
/** Options for `ArtifactsRepoClient.fork()`. */
|
|
146
115
|
interface ArtifactsForkOptions {
|
|
147
116
|
readonly description?: string;
|
|
148
117
|
readonly readOnly?: boolean;
|
|
149
|
-
/** Only copy the default branch. Defaults to `true`. */
|
|
150
118
|
readonly defaultBranchOnly?: boolean;
|
|
151
119
|
}
|
|
152
|
-
/** Options for `ArtifactsRepoClient.log()`. */
|
|
153
120
|
interface ArtifactsLogOptions {
|
|
154
|
-
/** Branch, tag, or commit hash. */
|
|
155
121
|
readonly ref?: string;
|
|
156
122
|
readonly limit?: number;
|
|
157
123
|
readonly offset?: number;
|
|
158
124
|
}
|
|
159
|
-
/** Runtime repository handle, including methods absent from current shipped Workers types. */
|
|
160
125
|
interface ArtifactsRepoBinding extends Partial<ArtifactsRepoInfo> {
|
|
161
126
|
/**
|
|
162
127
|
* Read repository metadata.
|
|
@@ -180,7 +145,6 @@ interface ArtifactsRepoBinding extends Partial<ArtifactsRepoInfo> {
|
|
|
180
145
|
readonly readCommit: (hash: string) => Promise<ArtifactsCommit>;
|
|
181
146
|
readonly readTree: (hash: string) => Promise<ArtifactsTree>;
|
|
182
147
|
}
|
|
183
|
-
/** Cloudflare Artifacts namespace binding. */
|
|
184
148
|
interface ArtifactsBinding {
|
|
185
149
|
readonly create: (name: RepoName, options?: ArtifactsCreateOptions) => Promise<ArtifactsCreateRepoResult>;
|
|
186
150
|
readonly get: (name: RepoName) => Promise<ArtifactsRepoBinding>;
|
|
@@ -188,14 +152,7 @@ interface ArtifactsBinding {
|
|
|
188
152
|
readonly list: (options?: ArtifactsListOptions) => Promise<ArtifactsRepoListResult>;
|
|
189
153
|
readonly delete: (name: RepoName) => Promise<boolean>;
|
|
190
154
|
}
|
|
191
|
-
/**
|
|
192
|
-
* Effect wrapper around a repository handle returned by `Artifacts.get()`.
|
|
193
|
-
*
|
|
194
|
-
* The inherited metadata is the snapshot read while resolving the client.
|
|
195
|
-
* Use `info()` to refresh it from the repository handle.
|
|
196
|
-
*/
|
|
197
155
|
interface ArtifactsRepoClient extends ArtifactsRepoInfo {
|
|
198
|
-
/** Read and validate the repository's current metadata. */
|
|
199
156
|
readonly info: () => Effect.Effect<ArtifactsRepoInfo, ArtifactsOperationError>;
|
|
200
157
|
/**
|
|
201
158
|
* Create a Git token for the repository.
|
|
@@ -212,7 +169,6 @@ interface ArtifactsRepoClient extends ArtifactsRepoInfo {
|
|
|
212
169
|
readonly readTree: (hash: string) => Effect.Effect<ArtifactsTree, ArtifactsOperationError>;
|
|
213
170
|
readonly raw: ArtifactsRepoBinding;
|
|
214
171
|
}
|
|
215
|
-
/** Effect wrapper around a Cloudflare Artifacts namespace binding. */
|
|
216
172
|
interface ArtifactsClient {
|
|
217
173
|
readonly create: (name: RepoName, options?: ArtifactsCreateOptions) => Effect.Effect<ArtifactsCreateRepoResult, ArtifactsOperationError>;
|
|
218
174
|
readonly get: (name: RepoName) => Effect.Effect<ArtifactsRepoClient, ArtifactsOperationError>;
|
|
@@ -223,7 +179,6 @@ interface ArtifactsClient {
|
|
|
223
179
|
readonly definition: ArtifactsDefinition;
|
|
224
180
|
}
|
|
225
181
|
declare const ArtifactsServiceTypeId: unique symbol;
|
|
226
|
-
/** Nominal service marker for Artifacts services created with {@link make}. */
|
|
227
182
|
interface ArtifactsService<Id extends string> {
|
|
228
183
|
readonly [ArtifactsServiceTypeId]: {
|
|
229
184
|
readonly id: Id;
|
|
@@ -236,9 +191,7 @@ interface TagClass<Self, Id extends string> extends Context.ServiceClass<Self, I
|
|
|
236
191
|
readonly id: Id;
|
|
237
192
|
readonly layer: (options: LayerOptions) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
238
193
|
}
|
|
239
|
-
/** Tests whether a value exposes the complete documented Artifacts repo handle API. */
|
|
240
194
|
declare const isArtifactsRepoBinding: <Candidate>(value: Candidate) => value is Candidate & ArtifactsRepoBinding;
|
|
241
|
-
/** Tests whether a value exposes the complete documented Artifacts namespace API. */
|
|
242
195
|
declare const isArtifactsBinding: <Candidate>(value: Candidate) => value is Candidate & ArtifactsBinding;
|
|
243
196
|
declare const makeClient: (definition: ArtifactsDefinition) => (artifacts: ArtifactsBinding) => ArtifactsClient;
|
|
244
197
|
declare const layer: <Self>(tag: Context.Service<Self, ArtifactsClient>, definition: ArtifactsDefinition) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
-
import { t as causeMessage } from "./ErrorMessage-
|
|
3
|
-
import { r as layer$1 } from "./Binding-
|
|
2
|
+
import { t as causeMessage } from "./ErrorMessage-Byx2OgNd.mjs";
|
|
3
|
+
import { r as layer$1 } from "./Binding-C82jRhdr.mjs";
|
|
4
4
|
import { Context, Data, Effect, Predicate, Schema } from "effect";
|
|
5
5
|
//#region src/Artifacts.ts
|
|
6
6
|
var Artifacts_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -16,7 +16,6 @@ var Artifacts_exports = /* @__PURE__ */ __exportAll({
|
|
|
16
16
|
});
|
|
17
17
|
const expectedArtifactsBinding = "Artifacts binding with create(), get(), import(), list(), and delete()";
|
|
18
18
|
const expectedArtifactsRepo = "Artifacts repo handle with createToken(), listTokens(), revokeToken(), fork(), log(), readCommit(), and readTree()";
|
|
19
|
-
/** Documented string error codes returned by Cloudflare Artifacts. */
|
|
20
19
|
const artifactsErrorCodes = [
|
|
21
20
|
"ALREADY_EXISTS",
|
|
22
21
|
"NOT_FOUND",
|
|
@@ -31,7 +30,6 @@ const artifactsErrorCodes = [
|
|
|
31
30
|
"MEMORY_LIMIT",
|
|
32
31
|
"INTERNAL_ERROR"
|
|
33
32
|
];
|
|
34
|
-
/** Documented numeric error codes returned by Cloudflare Artifacts. */
|
|
35
33
|
const artifactsErrorNumericCodes = {
|
|
36
34
|
ALREADY_EXISTS: 10201,
|
|
37
35
|
NOT_FOUND: 10200,
|
|
@@ -46,7 +44,6 @@ const artifactsErrorNumericCodes = {
|
|
|
46
44
|
MEMORY_LIMIT: 10402,
|
|
47
45
|
INTERNAL_ERROR: 10400
|
|
48
46
|
};
|
|
49
|
-
/** Error raised when a Cloudflare Artifacts operation fails. */
|
|
50
47
|
var ArtifactsOperationError = class extends Data.TaggedError("ArtifactsOperationError") {
|
|
51
48
|
get message() {
|
|
52
49
|
const code = this.code === void 0 ? "" : ` (${this.code})`;
|
|
@@ -94,9 +91,7 @@ const readRepoInfo = (binding, repo) => {
|
|
|
94
91
|
if (hasFunction(repo, "info")) return tryArtifactsPromise(binding, "info", () => repo.info()).pipe(Effect.flatMap((info) => decodeRepoInfo(binding, info)), Effect.withSpan("Artifacts.info", spanOptions(binding, "info")));
|
|
95
92
|
return decodeRepoInfo(binding, repo).pipe(Effect.withSpan("Artifacts.info", spanOptions(binding, "info")));
|
|
96
93
|
};
|
|
97
|
-
/** Tests whether a value exposes the complete documented Artifacts repo handle API. */
|
|
98
94
|
const isArtifactsRepoBinding = (value) => hasFunction(value, "createToken") && hasFunction(value, "listTokens") && hasFunction(value, "revokeToken") && hasFunction(value, "fork") && hasFunction(value, "log") && hasFunction(value, "readCommit") && hasFunction(value, "readTree");
|
|
99
|
-
/** Tests whether a value exposes the complete documented Artifacts namespace API. */
|
|
100
95
|
const isArtifactsBinding = (value) => hasFunction(value, "create") && hasFunction(value, "get") && hasFunction(value, "import") && hasFunction(value, "list") && hasFunction(value, "delete");
|
|
101
96
|
const wrapRepo = (binding, repo, info) => ({
|
|
102
97
|
...info,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
2
|
-
import { a as WorkerEnvironment } from "./ErrorMessage-
|
|
2
|
+
import { a as WorkerEnvironment } from "./ErrorMessage-Byx2OgNd.mjs";
|
|
3
3
|
import { Context, Data, Effect, Layer, Predicate } from "effect";
|
|
4
4
|
//#region src/Binding.ts
|
|
5
5
|
var Binding_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -9,7 +9,6 @@ var Binding_exports = /* @__PURE__ */ __exportAll({
|
|
|
9
9
|
TypeId: () => TypeId,
|
|
10
10
|
layer: () => layer
|
|
11
11
|
});
|
|
12
|
-
/** Internal type id marker used by binding helper services. */
|
|
13
12
|
const TypeId = "~effect-cf/Binding";
|
|
14
13
|
/** Error raised when a configured binding does not exist on `env`. */
|
|
15
14
|
var BindingNotFoundError = class extends Data.TaggedError("BindingNotFoundError") {};
|
|
@@ -2,7 +2,6 @@ import { Config, ConfigProvider, Context, Effect, Layer, Predicate } from "effec
|
|
|
2
2
|
declare namespace Environment_d_exports {
|
|
3
3
|
export { WorkerConfig, WorkerEnv, WorkerEnvironment };
|
|
4
4
|
}
|
|
5
|
-
/** Cloudflare worker environment object (`env`). */
|
|
6
5
|
type WorkerEnv = Cloudflare.Env;
|
|
7
6
|
declare const WorkerEnvironment_base: Context.ServiceClass<WorkerEnvironment, "effect-cf/WorkerEnvironment", Cloudflare.Env>;
|
|
8
7
|
/**
|
|
@@ -11,37 +10,8 @@ declare const WorkerEnvironment_base: Context.ServiceClass<WorkerEnvironment, "e
|
|
|
11
10
|
declare class WorkerEnvironment extends WorkerEnvironment_base {}
|
|
12
11
|
type ScalarConfigValue = string | number | boolean;
|
|
13
12
|
type ScalarConfigKey = Extract<{ readonly [Key in keyof Cloudflare.Env]-?: NonNullable<Cloudflare.Env[Key]> extends ScalarConfigValue ? Key : never; }[keyof Cloudflare.Env], string>;
|
|
14
|
-
/**
|
|
15
|
-
* Effect `Config` helpers for scalar Cloudflare vars and secrets declared on
|
|
16
|
-
* `Cloudflare.Env`.
|
|
17
|
-
*
|
|
18
|
-
* Users still author their app config explicitly with Effect `Config`:
|
|
19
|
-
*
|
|
20
|
-
* ```ts
|
|
21
|
-
* import { Config, Effect } from "effect";
|
|
22
|
-
* import { WorkerConfig } from "effect-cf";
|
|
23
|
-
*
|
|
24
|
-
* const AppConfig = Config.all({
|
|
25
|
-
* databaseUrl: WorkerConfig.redacted("DATABASE_URL"),
|
|
26
|
-
* port: WorkerConfig.integer("PORT").pipe(Config.withDefault(8787)),
|
|
27
|
-
* });
|
|
28
|
-
*
|
|
29
|
-
* const program = Effect.gen(function* () {
|
|
30
|
-
* const config = yield* AppConfig;
|
|
31
|
-
* // ...
|
|
32
|
-
* }).pipe(Effect.provide(WorkerConfig.providerLayer));
|
|
33
|
-
* ```
|
|
34
|
-
*
|
|
35
|
-
* Keys are constrained to scalar `Cloudflare.Env` properties (`string`,
|
|
36
|
-
* `number`, or `boolean`, including optional scalar properties). Binding
|
|
37
|
-
* objects such as `KVNamespace`, `DurableObjectNamespace`, and service
|
|
38
|
-
* bindings are intentionally excluded; keep using the package binding helpers
|
|
39
|
-
* for those live resources.
|
|
40
|
-
*/
|
|
41
13
|
declare namespace WorkerConfig {
|
|
42
|
-
/** Scalar env value types supported by the typed config key helpers. */
|
|
43
14
|
type Scalar = ScalarConfigValue;
|
|
44
|
-
/** Scalar keys available on the current consumer's `Cloudflare.Env`. */
|
|
45
15
|
type Key = ScalarConfigKey;
|
|
46
16
|
/** Read a scalar Cloudflare var or secret as a string. */
|
|
47
17
|
const string: <const Name extends Key>(name: Name) => Config.Config<string>;
|
|
@@ -53,7 +23,6 @@ declare namespace WorkerConfig {
|
|
|
53
23
|
const integer: <const Name extends Key>(name: Name) => Config.Config<number>;
|
|
54
24
|
/** Read a scalar Cloudflare var or secret as a boolean. */
|
|
55
25
|
const boolean: <const Name extends Key>(name: Name) => Config.Config<boolean>;
|
|
56
|
-
/** Options for building a `ConfigProvider` from a Cloudflare worker `env` object. */
|
|
57
26
|
interface ProviderOptions {
|
|
58
27
|
/**
|
|
59
28
|
* Keep empty-string env values as explicit `""` config values.
|
|
@@ -73,27 +42,19 @@ declare namespace WorkerConfig {
|
|
|
73
42
|
* `{ preserveEmptyStrings: true }` to keep them as explicit values.
|
|
74
43
|
*/
|
|
75
44
|
const providerFromEnv: (env: WorkerEnv, options?: ProviderOptions) => ConfigProvider.ConfigProvider;
|
|
76
|
-
/**
|
|
77
|
-
* Build a `ConfigProvider` from the current `WorkerEnvironment` with a custom
|
|
78
|
-
* conversion function.
|
|
79
|
-
*/
|
|
80
45
|
const providerWith: (makeProvider: (env: WorkerEnv) => ConfigProvider.ConfigProvider) => Effect.Effect<ConfigProvider.ConfigProvider, never, WorkerEnvironment>;
|
|
81
|
-
/** Build a `ConfigProvider` from the current `WorkerEnvironment`. */
|
|
82
46
|
const provider: Effect.Effect<ConfigProvider.ConfigProvider, never, WorkerEnvironment>;
|
|
83
47
|
/**
|
|
84
48
|
* Replace the active Effect `ConfigProvider` with one backed by the current
|
|
85
49
|
* Cloudflare worker `env` object.
|
|
86
50
|
*/
|
|
87
51
|
const providerLayer: Layer.Layer<never, never, WorkerEnvironment>;
|
|
88
|
-
/** Build a `ConfigProvider` layer with a custom `env` conversion function. */
|
|
89
52
|
const layerWith: (makeProvider: (env: WorkerEnv) => ConfigProvider.ConfigProvider) => Layer.Layer<never, never, WorkerEnvironment>;
|
|
90
53
|
}
|
|
91
54
|
declare namespace Binding_d_exports {
|
|
92
55
|
export { BindingNotFoundError, BindingService, BindingValidationError, Service, TypeId, ValidationOptions, layer };
|
|
93
56
|
}
|
|
94
|
-
/** Internal type id marker used by binding helper services. */
|
|
95
57
|
declare const TypeId: "~effect-cf/Binding";
|
|
96
|
-
/** Internal type id marker used by binding helper services. */
|
|
97
58
|
type TypeId = typeof TypeId;
|
|
98
59
|
declare const BindingNotFoundError_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 & {
|
|
99
60
|
readonly _tag: "BindingNotFoundError";
|
|
@@ -117,12 +78,6 @@ interface ValidationOptions {
|
|
|
117
78
|
readonly expected?: string;
|
|
118
79
|
}
|
|
119
80
|
type BindingCandidate = Parameters<typeof Predicate.isUnknown>[0];
|
|
120
|
-
/**
|
|
121
|
-
* Creates a Context tag + layer for reading and validating a Cloudflare binding.
|
|
122
|
-
*
|
|
123
|
-
* The Context key is namespaced as `effect-cf/Binding/<id>`; `id` stays the
|
|
124
|
-
* bare user-supplied identifier.
|
|
125
|
-
*/
|
|
126
81
|
interface BindingService<Self, Id extends string, Service> extends Context.ServiceClass<Self, `effect-cf/Binding/${Id}`, Service> {
|
|
127
82
|
readonly [TypeId]: TypeId;
|
|
128
83
|
readonly id: Id;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as ArtifactsOperationError, c as ArtifactsTokenListResult, i as ArtifactsCreateTokenResult, n as ArtifactsCreateOptions, o as ArtifactsRepoInfo, r as ArtifactsCreateRepoResult, s as ArtifactsTokenInfo, t as ArtifactsBinding, u as RepoName } from "./Artifacts-
|
|
1
|
+
import { a as ArtifactsOperationError, c as ArtifactsTokenListResult, i as ArtifactsCreateTokenResult, n as ArtifactsCreateOptions, o as ArtifactsRepoInfo, r as ArtifactsCreateRepoResult, s as ArtifactsTokenInfo, t as ArtifactsBinding, u as RepoName } from "./Artifacts-B3r3RuTB.mjs";
|
|
2
2
|
import { Effect } from "effect";
|
|
3
3
|
import { ArtifactClient, ArtifactImportOptions, ArtifactImportSource, ArtifactRepoSummary, ArtifactScope, ArtifactsCLIInput, ArtifactsCLIResult, RemoteAddFn } from "@cloudflare/computer/artifacts";
|
|
4
4
|
//#region src/ComputerArtifacts.d.ts
|
|
@@ -18,7 +18,6 @@ type ComputerArtifactsCliInput = ArtifactsCLIInput;
|
|
|
18
18
|
type ComputerArtifactsCliResult = Readonly<ArtifactsCLIResult>;
|
|
19
19
|
/** Options used when wrapping a session-scoped Artifacts client. */
|
|
20
20
|
interface ComputerArtifactsClientOptions {
|
|
21
|
-
/** Binding name attached to errors and tracing spans. Defaults to `ARTIFACTS`. */
|
|
22
21
|
readonly binding?: string;
|
|
23
22
|
}
|
|
24
23
|
/**
|
|
@@ -43,7 +42,6 @@ interface ComputerArtifactsClient {
|
|
|
43
42
|
readonly cli: (input: ComputerArtifactsCliInput) => Effect.Effect<ComputerArtifactsCliResult, ArtifactsOperationError>;
|
|
44
43
|
readonly rawUnsafe: Effect.Effect<ArtifactClient>;
|
|
45
44
|
}
|
|
46
|
-
/** Wraps an already-created upstream session client. */
|
|
47
45
|
declare const fromClient: (client: ArtifactClient, options?: ComputerArtifactsClientOptions) => ComputerArtifactsClient;
|
|
48
46
|
/**
|
|
49
47
|
* Creates an Effect-native session client directly from a Worker Artifacts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as ArtifactsOperationError } from "./Artifacts-
|
|
1
|
+
import { t as ArtifactsOperationError } from "./Artifacts-CBxWGeZB.mjs";
|
|
2
2
|
import { Effect, Predicate } from "effect";
|
|
3
3
|
//#region src/ComputerArtifacts.ts
|
|
4
4
|
const artifactsErrorDetails = (cause) => {
|
|
@@ -25,7 +25,6 @@ const spanOptions = (binding, sessionId, operation) => ({ attributes: {
|
|
|
25
25
|
sessionId,
|
|
26
26
|
operation
|
|
27
27
|
} });
|
|
28
|
-
/** Wraps an already-created upstream session client. */
|
|
29
28
|
const fromClient = (client, options = {}) => {
|
|
30
29
|
const binding = options.binding ?? "ARTIFACTS";
|
|
31
30
|
const { sessionId } = client;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComputerArtifactsClient } from "./ComputerArtifacts.mjs";
|
|
2
|
-
import { t as DurableObjectState } from "./DurableObjectState-
|
|
2
|
+
import { t as DurableObjectState } from "./DurableObjectState-CrEunfQ-.mjs";
|
|
3
3
|
import { Context, Effect, Layer, Schema, Scope, Stream } from "effect";
|
|
4
4
|
import { CommitView, GitClient, GitCloneOptions, GitCommitOptions, GitDiffOptions, GitFetchOptions, GitLogOptions, GitUpdateRefOptions } from "@cloudflare/computer/git";
|
|
5
5
|
import { ExecSyncResult, RuntimeExecOptions, RuntimeGetOptions, RuntimeKillOptions, ShellValue, SkippedEntry, ThinkWorkspaceCompatibility, WorkspaceClient, WorkspaceRuntimeResult, WorkspaceRuntimeValue as WorkspaceRuntimeValue$1 } from "@cloudflare/computer";
|
|
@@ -79,7 +79,6 @@ interface WorkspaceReadFile {
|
|
|
79
79
|
readonly encoding: "stream";
|
|
80
80
|
}): Effect.Effect<ReadableStream<Uint8Array>, WorkspaceFsError>;
|
|
81
81
|
}
|
|
82
|
-
/** Complete Effect wrapper of `WorkspaceClient.fs`. */
|
|
83
82
|
interface ComputerWorkspaceFilesystem {
|
|
84
83
|
readonly readFile: WorkspaceReadFile;
|
|
85
84
|
readonly stat: (path: string) => Effect.Effect<WorkspaceEntryStat, WorkspaceFsError>;
|
|
@@ -104,7 +103,6 @@ type WorkspaceGitUpdateRefOptions = GitUpdateRefOptions;
|
|
|
104
103
|
type WorkspaceGitDiffOptions = GitDiffOptions;
|
|
105
104
|
type WorkspaceGitCommitOptions = GitCommitOptions;
|
|
106
105
|
interface WorkspaceGitLogOptions extends Omit<GitLogOptions, "depth"> {
|
|
107
|
-
/** Preferred upstream name for the history bound. */
|
|
108
106
|
readonly depth?: number;
|
|
109
107
|
/** Consumer-port compatibility alias for `depth`. */
|
|
110
108
|
readonly maxCount?: number;
|
|
@@ -142,7 +140,6 @@ type CloudflareEncoding<Encoding extends WorkspaceExecEncoding> = Encoding exten
|
|
|
142
140
|
type WorkspaceExecChunk<Encoding extends WorkspaceExecEncoding> = Encoding extends "utf8" ? string : Uint8Array;
|
|
143
141
|
type WorkspaceExecOptions<Encoding extends WorkspaceExecEncoding = "utf8"> = Omit<RuntimeExecOptions, "encoding" | "timeoutMs"> & {
|
|
144
142
|
readonly encoding?: Encoding;
|
|
145
|
-
/** Upstream runtime option name. */
|
|
146
143
|
readonly timeoutMs?: number;
|
|
147
144
|
/** Consumer-port compatibility alias for `timeoutMs`. */
|
|
148
145
|
readonly timeoutMillis?: number;
|
|
@@ -211,7 +208,6 @@ interface WorkspaceExecCollect {
|
|
|
211
208
|
(command: string, options?: WorkspaceExecOptions<"utf8">): Effect.Effect<WorkspaceExecResult<"utf8">, WorkspaceExecError>;
|
|
212
209
|
(command: string, options: WorkspaceExecOptions<"binary">): Effect.Effect<WorkspaceExecResult<"binary">, WorkspaceExecError>;
|
|
213
210
|
}
|
|
214
|
-
/** Complete Effect wrapper of `WorkspaceClient.runtime`. */
|
|
215
211
|
interface ComputerWorkspaceRuntime {
|
|
216
212
|
readonly exec: WorkspaceExec;
|
|
217
213
|
readonly execCollect: WorkspaceExecCollect;
|
|
@@ -221,14 +217,12 @@ interface ComputerWorkspaceRuntime {
|
|
|
221
217
|
readonly backend?: string;
|
|
222
218
|
}) => Effect.Effect<void, WorkspaceExecError>;
|
|
223
219
|
}
|
|
224
|
-
/** Effect wrapper over a configured local `Workspace.assets` client. */
|
|
225
220
|
interface ComputerWorkspaceAssets {
|
|
226
221
|
readonly share: (path: string, options: ShareOptions) => Effect.Effect<string, WorkspaceAssetsError>;
|
|
227
222
|
}
|
|
228
223
|
type EffectThinkMethod<Method> = Method extends ((...args: infer Args) => Promise<infer Success>) ? (...args: Args) => Effect.Effect<Success, WorkspaceFsError> : never;
|
|
229
224
|
/** Effect wrapper of the optional Think compatibility surface. */
|
|
230
225
|
type ComputerWorkspaceThink = { readonly [Name in keyof ThinkWorkspaceCompatibility]: EffectThinkMethod<ThinkWorkspaceCompatibility[Name]>; };
|
|
231
|
-
/** Effect service over every client surface exposed by Cloudflare Computer. */
|
|
232
226
|
interface ComputerWorkspaceService {
|
|
233
227
|
readonly fs: ComputerWorkspaceFilesystem;
|
|
234
228
|
readonly git: ComputerWorkspaceGit;
|
|
@@ -236,7 +230,6 @@ interface ComputerWorkspaceService {
|
|
|
236
230
|
readonly artifacts: ComputerArtifactsClient;
|
|
237
231
|
readonly assets: ComputerWorkspaceAssets | undefined;
|
|
238
232
|
readonly think: ComputerWorkspaceThink | undefined;
|
|
239
|
-
/** Flat filesystem aliases retained for mechanical consumer migration. */
|
|
240
233
|
readonly readFile: WorkspaceReadFile;
|
|
241
234
|
readonly stat: ComputerWorkspaceFilesystem["stat"];
|
|
242
235
|
readonly lstat: ComputerWorkspaceFilesystem["lstat"];
|
|
@@ -253,7 +246,6 @@ interface ComputerWorkspaceService {
|
|
|
253
246
|
readonly removePath: ComputerWorkspaceFilesystem["rm"];
|
|
254
247
|
readonly chmod: ComputerWorkspaceFilesystem["chmod"];
|
|
255
248
|
readonly symlink: ComputerWorkspaceFilesystem["symlink"];
|
|
256
|
-
/** Flat runtime aliases retained for mechanical consumer migration. */
|
|
257
249
|
readonly exec: WorkspaceExec;
|
|
258
250
|
readonly execCollect: WorkspaceExecCollect;
|
|
259
251
|
readonly getExec: WorkspaceGetExec;
|
|
@@ -267,7 +259,6 @@ interface ComputerWorkspaceService {
|
|
|
267
259
|
*/
|
|
268
260
|
declare const fromWorkspaceClient: (client: WorkspaceClient) => ComputerWorkspaceService;
|
|
269
261
|
declare const ComputerWorkspace_base: Context.ServiceClass<ComputerWorkspace, "effect-cf/ComputerWorkspace", ComputerWorkspaceService>;
|
|
270
|
-
/** Effect service for the workspace owned by the enclosing Durable Object. */
|
|
271
262
|
declare class ComputerWorkspace extends ComputerWorkspace_base {
|
|
272
263
|
/**
|
|
273
264
|
* Acquires the single workspace registered by `withComputerWorkspace` and
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as DurableObjectState } from "./DurableObjectState-
|
|
1
|
+
import { t as DurableObjectState } from "./DurableObjectState-De4ZojhY.mjs";
|
|
2
2
|
import { fromClient } from "./ComputerArtifacts.mjs";
|
|
3
3
|
import { t as lookup } from "./ComputerWorkspaceHostRegistry-CY5Fv4Ng.mjs";
|
|
4
4
|
import { Context, Effect, Layer, Predicate, Schema, Stream } from "effect";
|
|
@@ -559,7 +559,6 @@ const fromWorkspaceClient = (client) => {
|
|
|
559
559
|
disposeExec: runtime.disposeExec
|
|
560
560
|
};
|
|
561
561
|
};
|
|
562
|
-
/** Effect service for the workspace owned by the enclosing Durable Object. */
|
|
563
562
|
var ComputerWorkspace = class ComputerWorkspace extends Context.Service()("effect-cf/ComputerWorkspace") {
|
|
564
563
|
/**
|
|
565
564
|
* Acquires the single workspace registered by `withComputerWorkspace` and
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { t as ArtifactsBinding } from "./Artifacts-
|
|
1
|
+
import { t as ArtifactsBinding } from "./Artifacts-B3r3RuTB.mjs";
|
|
2
2
|
import { GitClientFactory } from "@cloudflare/computer/git";
|
|
3
3
|
import { DurableObjectStorageLike, SyncRetryIntent, SyncRetryOptions, SyncRetryScheduler, WithWorkspaceCtor, WorkspaceAttributeValue, WorkspaceAttributes, WorkspaceObserver, WorkspaceOptions, WorkspaceRegisteredBackend, WorkspaceRetryPendingSyncResult, WorkspaceServiceProxy, WorkspaceSpan } from "@cloudflare/computer";
|
|
4
4
|
import { ShellModuleGroup, WorkerShellBackendOptions, WorkerShellLoader, WorkspaceEgressPolicy } from "@cloudflare/computer/backends/worker-shell";
|
|
5
5
|
//#region src/ComputerWorkspaceHost.d.ts
|
|
6
|
-
/** The value of a `worker_loaders` binding. */
|
|
7
6
|
type DynamicWorkerLoader = WorkerShellLoader;
|
|
8
7
|
/** Default author and committer identity for workspace Git operations. */
|
|
9
8
|
interface ComputerWorkspaceGitIdentity {
|
|
@@ -25,20 +24,13 @@ interface ComputerWorkspaceArtifactsOptions {
|
|
|
25
24
|
*/
|
|
26
25
|
interface ComputerWorkspaceShellOptions extends Omit<WorkerShellBackendOptions, "source" | "loader" | "workspace" | "ctx" | "egress"> {
|
|
27
26
|
readonly loader: DynamicWorkerLoader;
|
|
28
|
-
/** Durable Object namespace binding that points back to the wrapped class. */
|
|
29
27
|
readonly hostBinding: string;
|
|
30
|
-
/** Current Durable Object id, normally `ctx.id.toString()`. */
|
|
31
28
|
readonly hostId: string;
|
|
32
|
-
/** Current Durable Object execution context, normally `ctx`. */
|
|
33
29
|
readonly executionContext: unknown;
|
|
34
|
-
/** Dynamic Worker egress policy. Defaults to `{ mode: "none" }`. */
|
|
35
30
|
readonly egress?: WorkspaceEgressPolicy;
|
|
36
31
|
}
|
|
37
|
-
/** Configuration accepted by {@link withComputerWorkspace}. */
|
|
38
32
|
interface ComputerWorkspaceHostConfig {
|
|
39
|
-
/** Native SQLite-backed Durable Object storage (`ctx.storage`). */
|
|
40
33
|
readonly storage: globalThis.DurableObjectStorage | DurableObjectStorageLike;
|
|
41
|
-
/** Stable workspace id used by mounts and as the default Artifacts session. */
|
|
42
34
|
readonly sessionId?: string;
|
|
43
35
|
readonly gitIdentity?: ComputerWorkspaceGitIdentity;
|
|
44
36
|
/** Override the default `createGitClient()` factory. */
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import { c as WorkerEnvironment, r as BindingValidationError, t as BindingNotFoundError } from "./Binding-
|
|
1
|
+
import { c as WorkerEnvironment, r as BindingValidationError, t as BindingNotFoundError } from "./Binding-DKcLrQCM.mjs";
|
|
2
2
|
import { Context, Effect, Layer, Schema } from "effect";
|
|
3
3
|
declare namespace ContainerNamespace_d_exports {
|
|
4
4
|
export { ContainerInstanceClient, ContainerNamespace, ContainerNamespaceClient, ContainerNamespaceDefinition, ContainerNamespaceResource, ContainerNamespaceService, ContainerNamespaceStaticClient, ContainerOperationError, ContainerReadinessOptions, ContainerSignal, ContainerStartAndWaitForPortsOptions, ContainerStartOptions, ContainerState, ContainerStopSignal, ContainerStub, ContainerStubOf, ContainerWaitOptions, LayerOptions, Tag, TagClass, isContainerNamespaceResource, layer, make, makeClient };
|
|
5
5
|
}
|
|
6
|
-
/** Named signal accepted by Cloudflare Container instances. */
|
|
7
6
|
type ContainerSignal = "SIGKILL" | "SIGINT" | "SIGTERM";
|
|
8
|
-
/** Named or numeric signal accepted by Container `stop()`. */
|
|
9
7
|
type ContainerStopSignal = ContainerSignal | number;
|
|
10
|
-
/** Per-instance Container startup configuration. */
|
|
11
8
|
interface ContainerStartOptions {
|
|
12
9
|
readonly envVars?: Record<string, string>;
|
|
13
10
|
readonly entrypoint?: Array<string>;
|
|
@@ -26,7 +23,6 @@ interface ContainerReadinessOptions {
|
|
|
26
23
|
readonly portReadyTimeoutMS?: number;
|
|
27
24
|
readonly waitInterval?: number;
|
|
28
25
|
}
|
|
29
|
-
/** Options for starting a Container and waiting for its ports. */
|
|
30
26
|
interface ContainerStartAndWaitForPortsOptions {
|
|
31
27
|
readonly startOptions?: ContainerStartOptions;
|
|
32
28
|
readonly ports?: number | Array<number>;
|
|
@@ -63,21 +59,16 @@ interface ContainerStub {
|
|
|
63
59
|
removeAllowedHost(hostname: string): Promise<void>;
|
|
64
60
|
removeDeniedHost(hostname: string): Promise<void>;
|
|
65
61
|
}
|
|
66
|
-
/** Native Container namespace binding shape. */
|
|
67
62
|
interface ContainerNamespaceResource {
|
|
68
63
|
getByName(name: string, options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions): ContainerStub;
|
|
69
64
|
}
|
|
70
|
-
/** Exact native stub type produced by a Container namespace binding. */
|
|
71
65
|
type ContainerStubOf<Namespace extends ContainerNamespaceResource> = ReturnType<Namespace["getByName"]>;
|
|
72
|
-
/** Container namespace binding metadata. */
|
|
73
66
|
interface ContainerNamespaceDefinition {
|
|
74
|
-
/** Binding name as configured in `wrangler.jsonc`. */
|
|
75
67
|
readonly binding: string;
|
|
76
68
|
}
|
|
77
69
|
declare const ContainerOperationError_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 & {
|
|
78
70
|
readonly _tag: "ContainerOperationError";
|
|
79
71
|
} & Readonly<A>;
|
|
80
|
-
/** Failure raised when invoking a named Container operation. */
|
|
81
72
|
declare class ContainerOperationError extends ContainerOperationError_base<{
|
|
82
73
|
readonly binding: string;
|
|
83
74
|
readonly instance: string;
|
|
@@ -86,7 +77,6 @@ declare class ContainerOperationError extends ContainerOperationError_base<{
|
|
|
86
77
|
}> {
|
|
87
78
|
get message(): string;
|
|
88
79
|
}
|
|
89
|
-
/** Effect-wrapped client for one named Container instance. */
|
|
90
80
|
interface ContainerInstanceClient<Stub extends ContainerStub = ContainerStub> {
|
|
91
81
|
readonly rawUnsafe: Effect.Effect<Stub, ContainerOperationError>;
|
|
92
82
|
readonly state: Effect.Effect<ContainerState, ContainerOperationError>;
|
|
@@ -103,7 +93,6 @@ interface ContainerInstanceClient<Stub extends ContainerStub = ContainerStub> {
|
|
|
103
93
|
readonly removeAllowedHost: (hostname: string) => Effect.Effect<void, ContainerOperationError>;
|
|
104
94
|
readonly removeDeniedHost: (hostname: string) => Effect.Effect<void, ContainerOperationError>;
|
|
105
95
|
}
|
|
106
|
-
/** Effect client for a Container namespace binding. */
|
|
107
96
|
interface ContainerNamespaceClient<Namespace extends ContainerNamespaceResource = ContainerNamespaceResource> {
|
|
108
97
|
readonly definition: ContainerNamespaceDefinition;
|
|
109
98
|
readonly getByName: (name: string, options?: globalThis.DurableObjectNamespaceGetDurableObjectOptions) => Effect.Effect<ContainerInstanceClient<ContainerStubOf<Namespace>>, ContainerOperationError>;
|
|
@@ -142,13 +131,11 @@ declare const makeClient: (definition: ContainerNamespaceDefinition) => <Namespa
|
|
|
142
131
|
declare const layer: <Self, Namespace extends ContainerNamespaceResource>(tag: Context.Service<Self, ContainerNamespaceClient<Namespace>>, definition: ContainerNamespaceDefinition) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
|
|
143
132
|
declare const make: <Id extends string>(id: Id) => TagClass<ContainerNamespaceService<Id>, Id, ContainerNamespaceResource>;
|
|
144
133
|
declare const ContainerNamespaceServiceTypeId: unique symbol;
|
|
145
|
-
/** Nominal service marker for Container namespaces created with {@link make}. */
|
|
146
134
|
interface ContainerNamespaceService<Id extends string> {
|
|
147
135
|
readonly [ContainerNamespaceServiceTypeId]: {
|
|
148
136
|
readonly id: Id;
|
|
149
137
|
};
|
|
150
138
|
}
|
|
151
|
-
/** Creates a typed Effect service for a Cloudflare Container namespace. */
|
|
152
139
|
declare const Tag: <Self, Namespace extends ContainerNamespaceResource = ContainerNamespaceResource>() => <Id extends string>(id: Id) => TagClass<Self, Id, Namespace>;
|
|
153
140
|
declare const ContainerNamespace: typeof Tag;
|
|
154
141
|
//#endregion
|