effect-cf 0.25.3 → 0.27.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.
@@ -0,0 +1,231 @@
1
+ import { c as WorkerEnvironment, r as BindingValidationError, t as BindingNotFoundError } from "./Binding-COCtoJXa.mjs";
2
+ import { Context, Effect, Layer } from "effect";
3
+ declare namespace Artifacts_d_exports {
4
+ export { ArtifactsBinding, ArtifactsClient, ArtifactsCommit, 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
+ }
6
+ /** Artifacts operation represented by {@link ArtifactsOperationError}. */
7
+ type ArtifactsOperation = "createClient" | "create" | "get" | "import" | "list" | "delete" | "createToken" | "listTokens" | "getToken" | "revokeToken" | "fork" | "log" | "readCommit" | "readTree" | "cli";
8
+ /** Documented string error codes returned by Cloudflare Artifacts. */
9
+ 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
+ declare const artifactsErrorNumericCodes: {
12
+ readonly ALREADY_EXISTS: 10201;
13
+ readonly NOT_FOUND: 10200;
14
+ readonly IMPORT_IN_PROGRESS: 10302;
15
+ readonly FORK_IN_PROGRESS: 10303;
16
+ readonly INVALID_INPUT: 10100;
17
+ readonly INVALID_REPO_NAME: 10101;
18
+ readonly INVALID_TTL: 10103;
19
+ readonly INVALID_URL: 10104;
20
+ readonly REMOTE_AUTH_REQUIRED: 10106;
21
+ readonly UPSTREAM_UNAVAILABLE: 10401;
22
+ readonly MEMORY_LIMIT: 10402;
23
+ readonly INTERNAL_ERROR: 10400;
24
+ };
25
+ /** A documented Cloudflare Artifacts string error code. */
26
+ type ArtifactsErrorCode = CloudflareArtifactsErrorCode;
27
+ 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
+ readonly _tag: "ArtifactsOperationError";
29
+ } & Readonly<A>;
30
+ /** Error raised when a Cloudflare Artifacts operation fails. */
31
+ declare class ArtifactsOperationError extends ArtifactsOperationError_base<{
32
+ readonly binding: string;
33
+ readonly operation: ArtifactsOperation;
34
+ readonly cause: unknown;
35
+ /** Cloudflare string error code, when retained by the runtime. */
36
+ readonly code?: ArtifactsErrorCode | (string & {});
37
+ /** Cloudflare REST-compatible numeric error code, when retained by the runtime. */
38
+ readonly numericCode?: number;
39
+ }> {
40
+ get message(): string;
41
+ }
42
+ /** Typed Cloudflare Artifacts binding definition. */
43
+ interface ArtifactsDefinition {
44
+ /** Binding name from an `artifacts` entry in `wrangler.jsonc`. */
45
+ readonly binding: string;
46
+ }
47
+ /** Repository name containing alphanumeric characters, dots, hyphens, or underscores. */
48
+ type RepoName = string;
49
+ /** Cursor used by repository list pagination. */
50
+ type Cursor = string;
51
+ /** Scope granted to a repository token. */
52
+ type ArtifactsTokenScope = "read" | "write";
53
+ /** Lifecycle state of a repository token. */
54
+ type ArtifactsTokenState = "active" | "expired" | "revoked";
55
+ /** Lifecycle state included with repositories returned by `list()`. */
56
+ type ArtifactsRepoStatus = "ready" | "importing" | "forking";
57
+ /** Stable repository metadata returned by Cloudflare Artifacts. */
58
+ type ArtifactsRepoInfo = CloudflareArtifactsRepoInfo;
59
+ /** Result of creating, importing, or forking a repository. */
60
+ type ArtifactsCreateRepoResult = Readonly<CloudflareArtifactsCreateRepoResult>;
61
+ /** Repository metadata returned by `list()`. */
62
+ interface ArtifactsRepoListEntry extends ArtifactsRepoInfo {
63
+ readonly status: ArtifactsRepoStatus;
64
+ }
65
+ /** Cursor-paginated repository list result. */
66
+ interface ArtifactsRepoListResult {
67
+ readonly repos: ReadonlyArray<ArtifactsRepoListEntry>;
68
+ readonly total: number;
69
+ readonly cursor?: Cursor;
70
+ }
71
+ /** Result of creating a repository token. */
72
+ type ArtifactsCreateTokenResult = CloudflareArtifactsCreateTokenResult;
73
+ /** Repository token metadata, excluding its plaintext secret. */
74
+ type ArtifactsTokenInfo = CloudflareArtifactsTokenInfo;
75
+ /** Repository token list result. */
76
+ type ArtifactsTokenListResult = CloudflareArtifactsTokenListResult;
77
+ /**
78
+ * Commit history returned by `log()`.
79
+ *
80
+ * Cloudflare currently documents this generated type by name but does not
81
+ * publish its fields in the binding reference or Workers type declarations.
82
+ */
83
+ interface ArtifactsLogResult {
84
+ readonly [field: string]: unknown;
85
+ }
86
+ /**
87
+ * Parsed Git commit returned by `readCommit()`.
88
+ *
89
+ * Cloudflare currently documents this generated type by name but does not
90
+ * publish its fields in the binding reference or Workers type declarations.
91
+ */
92
+ interface ArtifactsCommit {
93
+ readonly [field: string]: unknown;
94
+ }
95
+ /**
96
+ * Parsed Git tree returned by `readTree()`.
97
+ *
98
+ * Cloudflare currently documents this generated type by name but does not
99
+ * publish its fields in the binding reference or Workers type declarations.
100
+ */
101
+ interface ArtifactsTree {
102
+ readonly [field: string]: unknown;
103
+ }
104
+ /** Options for `Artifacts.create()`. */
105
+ interface ArtifactsCreateOptions {
106
+ /** Prevent pushes to the repository. */
107
+ readonly readOnly?: boolean;
108
+ readonly description?: string;
109
+ /** Initial default branch name. */
110
+ readonly setDefaultBranch?: string;
111
+ }
112
+ /** Options for cursor-paginating `Artifacts.list()`. */
113
+ interface ArtifactsListOptions {
114
+ /** Page size from 1 through 200. Defaults to 50. */
115
+ readonly limit?: number;
116
+ /** Cursor returned by a previous list result. */
117
+ readonly cursor?: Cursor;
118
+ }
119
+ /** External Git source used by `Artifacts.import()`. */
120
+ interface ArtifactsImportSource {
121
+ /** Full HTTPS URL of the Git repository. */
122
+ readonly url: string;
123
+ /** Source branch. Defaults to the remote's default branch. */
124
+ readonly branch?: string;
125
+ /** Shallow clone depth. */
126
+ readonly depth?: number;
127
+ }
128
+ /** Options for the target of `Artifacts.import()`. */
129
+ interface ArtifactsImportTargetOptions {
130
+ readonly description?: string;
131
+ readonly readOnly?: boolean;
132
+ }
133
+ /** Target repository used by `Artifacts.import()`. */
134
+ interface ArtifactsImportTarget {
135
+ readonly name: RepoName;
136
+ readonly opts?: ArtifactsImportTargetOptions;
137
+ }
138
+ /** Parameters for `Artifacts.import()`. */
139
+ interface ArtifactsImportParams {
140
+ readonly source: ArtifactsImportSource;
141
+ readonly target: ArtifactsImportTarget;
142
+ }
143
+ /** Options for `ArtifactsRepoClient.fork()`. */
144
+ interface ArtifactsForkOptions {
145
+ readonly description?: string;
146
+ readonly readOnly?: boolean;
147
+ /** Only copy the default branch. Defaults to `true`. */
148
+ readonly defaultBranchOnly?: boolean;
149
+ }
150
+ /** Options for `ArtifactsRepoClient.log()`. */
151
+ interface ArtifactsLogOptions {
152
+ /** Branch, tag, or commit hash. */
153
+ readonly ref?: string;
154
+ readonly limit?: number;
155
+ readonly offset?: number;
156
+ }
157
+ /** Runtime repository handle, including methods absent from current shipped Workers types. */
158
+ interface ArtifactsRepoBinding extends ArtifactsRepoInfo {
159
+ /**
160
+ * Create a Git token for the repository.
161
+ *
162
+ * Scope defaults to `"write"`. TTL is measured in seconds, defaults to
163
+ * 86,400, and must be between 60 and 31,536,000.
164
+ */
165
+ readonly createToken: (scope?: ArtifactsTokenScope, ttl?: number) => Promise<ArtifactsCreateTokenResult>;
166
+ readonly listTokens: () => Promise<ArtifactsTokenListResult>;
167
+ readonly revokeToken: (tokenOrId: string) => Promise<boolean>;
168
+ readonly fork: (name: RepoName, options?: ArtifactsForkOptions) => Promise<ArtifactsCreateRepoResult>;
169
+ readonly log: (options?: ArtifactsLogOptions) => Promise<ArtifactsLogResult>;
170
+ readonly readCommit: (hash: string) => Promise<ArtifactsCommit>;
171
+ readonly readTree: (hash: string) => Promise<ArtifactsTree>;
172
+ }
173
+ /** Cloudflare Artifacts namespace binding. */
174
+ interface ArtifactsBinding {
175
+ readonly create: (name: RepoName, options?: ArtifactsCreateOptions) => Promise<ArtifactsCreateRepoResult>;
176
+ readonly get: (name: RepoName) => Promise<ArtifactsRepoBinding>;
177
+ readonly import: (params: ArtifactsImportParams) => Promise<ArtifactsCreateRepoResult>;
178
+ readonly list: (options?: ArtifactsListOptions) => Promise<ArtifactsRepoListResult>;
179
+ readonly delete: (name: RepoName) => Promise<boolean>;
180
+ }
181
+ /** Effect wrapper around a repository handle returned by `Artifacts.get()`. */
182
+ interface ArtifactsRepoClient extends ArtifactsRepoInfo {
183
+ /**
184
+ * Create a Git token for the repository.
185
+ *
186
+ * Scope defaults to `"write"`. TTL is measured in seconds, defaults to
187
+ * 86,400, and must be between 60 and 31,536,000.
188
+ */
189
+ readonly createToken: (scope?: ArtifactsTokenScope, ttl?: number) => Effect.Effect<ArtifactsCreateTokenResult, ArtifactsOperationError>;
190
+ readonly listTokens: Effect.Effect<ArtifactsTokenListResult, ArtifactsOperationError>;
191
+ readonly revokeToken: (tokenOrId: string) => Effect.Effect<boolean, ArtifactsOperationError>;
192
+ readonly fork: (name: RepoName, options?: ArtifactsForkOptions) => Effect.Effect<ArtifactsCreateRepoResult, ArtifactsOperationError>;
193
+ readonly log: (options?: ArtifactsLogOptions) => Effect.Effect<ArtifactsLogResult, ArtifactsOperationError>;
194
+ readonly readCommit: (hash: string) => Effect.Effect<ArtifactsCommit, ArtifactsOperationError>;
195
+ readonly readTree: (hash: string) => Effect.Effect<ArtifactsTree, ArtifactsOperationError>;
196
+ readonly raw: ArtifactsRepoBinding;
197
+ }
198
+ /** Effect wrapper around a Cloudflare Artifacts namespace binding. */
199
+ interface ArtifactsClient {
200
+ readonly create: (name: RepoName, options?: ArtifactsCreateOptions) => Effect.Effect<ArtifactsCreateRepoResult, ArtifactsOperationError>;
201
+ readonly get: (name: RepoName) => Effect.Effect<ArtifactsRepoClient, ArtifactsOperationError>;
202
+ readonly import: (params: ArtifactsImportParams) => Effect.Effect<ArtifactsCreateRepoResult, ArtifactsOperationError>;
203
+ readonly list: (options?: ArtifactsListOptions) => Effect.Effect<ArtifactsRepoListResult, ArtifactsOperationError>;
204
+ readonly delete: (name: RepoName) => Effect.Effect<boolean, ArtifactsOperationError>;
205
+ readonly rawUnsafe: Effect.Effect<ArtifactsBinding>;
206
+ readonly definition: ArtifactsDefinition;
207
+ }
208
+ declare const ArtifactsServiceTypeId: unique symbol;
209
+ /** Nominal service marker for Artifacts services created with {@link make}. */
210
+ interface ArtifactsService<Id extends string> {
211
+ readonly [ArtifactsServiceTypeId]: {
212
+ readonly id: Id;
213
+ };
214
+ }
215
+ type LayerOptions = {
216
+ readonly binding: string;
217
+ };
218
+ interface TagClass<Self, Id extends string> extends Context.ServiceClass<Self, Id, ArtifactsClient> {
219
+ readonly id: Id;
220
+ readonly layer: (options: LayerOptions) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
221
+ }
222
+ /** Tests whether a value exposes the complete documented Artifacts repo handle API. */
223
+ declare const isArtifactsRepoBinding: (value: unknown) => value is ArtifactsRepoBinding;
224
+ /** Tests whether a value exposes the complete documented Artifacts namespace API. */
225
+ declare const isArtifactsBinding: (value: unknown) => value is ArtifactsBinding;
226
+ declare const makeClient: (definition: ArtifactsDefinition) => (artifacts: ArtifactsBinding) => ArtifactsClient;
227
+ declare const layer: <Self>(tag: Context.Service<Self, ArtifactsClient>, definition: ArtifactsDefinition) => Layer.Layer<Self, BindingNotFoundError | BindingValidationError, WorkerEnvironment>;
228
+ declare const make: <Id extends string>(id: Id) => TagClass<ArtifactsService<Id>, Id>;
229
+ declare const Tag: <Self>() => <Id extends string>(id: Id) => TagClass<Self, Id>;
230
+ //#endregion
231
+ export { ArtifactsOperationError as a, ArtifactsTokenListResult as c, ArtifactsCreateTokenResult as i, Artifacts_d_exports as l, ArtifactsCreateOptions as n, ArtifactsRepoInfo as o, ArtifactsCreateRepoResult as r, ArtifactsTokenInfo as s, ArtifactsBinding as t, RepoName as u };
@@ -0,0 +1,55 @@
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-DcoXcRP5.mjs";
2
+ import { Effect } from "effect";
3
+ import { ArtifactClient, ArtifactImportOptions, ArtifactImportSource, ArtifactRepoSummary, ArtifactScope, ArtifactsCLIInput, ArtifactsCLIResult, RemoteAddFn } from "@cloudflare/computer/artifacts";
4
+ //#region src/ComputerArtifacts.d.ts
5
+ /** External Git source accepted by a session-scoped repository import. */
6
+ type ComputerArtifactImportSource = Readonly<ArtifactImportSource>;
7
+ /** Target options accepted by a session-scoped repository import. */
8
+ type ComputerArtifactImportOptions = Readonly<ArtifactImportOptions>;
9
+ /** Repository metadata returned by a session-scoped list operation. */
10
+ type ComputerArtifactRepoSummary = Readonly<ArtifactRepoSummary>;
11
+ /** Token scope accepted by the upstream session facade. */
12
+ type ComputerArtifactScope = ArtifactScope;
13
+ /** Optional Git remote-registration seam accepted by the argv API. */
14
+ type ComputerArtifactsRemoteAdd = RemoteAddFn;
15
+ /** Input to the session-scoped `artifacts` argv API. */
16
+ type ComputerArtifactsCliInput = ArtifactsCLIInput;
17
+ /** Result from the session-scoped `artifacts` argv API. */
18
+ type ComputerArtifactsCliResult = Readonly<ArtifactsCLIResult>;
19
+ /** Options used when wrapping a session-scoped Artifacts client. */
20
+ interface ComputerArtifactsClientOptions {
21
+ /** Binding name attached to errors and tracing spans. Defaults to `ARTIFACTS`. */
22
+ readonly binding?: string;
23
+ }
24
+ /**
25
+ * Effect-native facade over `@cloudflare/computer/artifacts`.
26
+ *
27
+ * Repository names are local to {@link sessionId}. Prefixing and filtering are
28
+ * intentionally delegated to the upstream `createArtifact` implementation so
29
+ * this client and the worker-shell `artifacts` command always use the same
30
+ * namespace convention.
31
+ */
32
+ interface ComputerArtifactsClient {
33
+ readonly sessionId: string;
34
+ readonly create: (name: RepoName, options?: ArtifactsCreateOptions) => Effect.Effect<ArtifactsCreateRepoResult, ArtifactsOperationError>;
35
+ readonly get: (name: RepoName) => Effect.Effect<ArtifactsRepoInfo, ArtifactsOperationError>;
36
+ readonly list: Effect.Effect<ReadonlyArray<ComputerArtifactRepoSummary>, ArtifactsOperationError>;
37
+ readonly import: (name: RepoName, source: ComputerArtifactImportSource, options?: ComputerArtifactImportOptions) => Effect.Effect<ArtifactsCreateRepoResult, ArtifactsOperationError>;
38
+ readonly delete: (name: RepoName) => Effect.Effect<boolean, ArtifactsOperationError>;
39
+ readonly createToken: (name: RepoName, scope?: ComputerArtifactScope, ttl?: number) => Effect.Effect<ArtifactsCreateTokenResult, ArtifactsOperationError>;
40
+ readonly listTokens: (name: RepoName) => Effect.Effect<ArtifactsTokenListResult, ArtifactsOperationError>;
41
+ readonly getToken: (name: RepoName, id: string) => Effect.Effect<ArtifactsTokenInfo, ArtifactsOperationError>;
42
+ readonly revokeToken: (name: RepoName, tokenOrId: string) => Effect.Effect<boolean, ArtifactsOperationError>;
43
+ readonly cli: (input: ComputerArtifactsCliInput) => Effect.Effect<ComputerArtifactsCliResult, ArtifactsOperationError>;
44
+ readonly rawUnsafe: Effect.Effect<ArtifactClient>;
45
+ }
46
+ /** Wraps an already-created upstream session client. */
47
+ declare const fromClient: (client: ArtifactClient, options?: ComputerArtifactsClientOptions) => ComputerArtifactsClient;
48
+ /**
49
+ * Creates an Effect-native session client directly from a Worker Artifacts
50
+ * binding. `@cloudflare/computer` is loaded only when this Effect runs, keeping
51
+ * the optional peer out of applications that do not use this integration.
52
+ */
53
+ declare const makeClient: (bindingValue: ArtifactsBinding, sessionId: string, options?: ComputerArtifactsClientOptions | undefined) => Effect.Effect<ComputerArtifactsClient, ArtifactsOperationError, never>;
54
+ //#endregion
55
+ export { ComputerArtifactImportOptions, ComputerArtifactImportSource, ComputerArtifactRepoSummary, ComputerArtifactScope, ComputerArtifactsCliInput, ComputerArtifactsCliResult, ComputerArtifactsClient, ComputerArtifactsClientOptions, ComputerArtifactsRemoteAdd, fromClient, makeClient };
@@ -0,0 +1,95 @@
1
+ import { t as ArtifactsOperationError } from "./Artifacts-BhWrdyqX.mjs";
2
+ import { Effect } from "effect";
3
+ //#region src/ComputerArtifacts.ts
4
+ const artifactsErrorDetails = (cause) => {
5
+ if (typeof cause !== "object" || cause === null) return {};
6
+ const code = Reflect.get(cause, "code");
7
+ const numericCode = Reflect.get(cause, "numericCode");
8
+ return {
9
+ ...typeof code === "string" ? { code } : {},
10
+ ...typeof numericCode === "number" ? { numericCode } : {}
11
+ };
12
+ };
13
+ const operationError = (binding, operation, cause) => new ArtifactsOperationError({
14
+ binding,
15
+ operation,
16
+ cause,
17
+ ...artifactsErrorDetails(cause)
18
+ });
19
+ const tryOperation = (binding, operation, evaluate) => Effect.tryPromise({
20
+ try: evaluate,
21
+ catch: (cause) => operationError(binding, operation, cause)
22
+ });
23
+ const spanOptions = (binding, sessionId, operation) => ({ attributes: {
24
+ binding,
25
+ sessionId,
26
+ operation
27
+ } });
28
+ /** Wraps an already-created upstream session client. */
29
+ const fromClient = (client, options = {}) => {
30
+ const binding = options.binding ?? "ARTIFACTS";
31
+ const { sessionId } = client;
32
+ return {
33
+ sessionId,
34
+ create: Effect.fn("ComputerArtifacts.create", spanOptions(binding, sessionId, "create"))(function* (name, createOptions) {
35
+ yield* Effect.annotateCurrentSpan("repo", name);
36
+ return yield* tryOperation(binding, "create", () => client.create(name, createOptions));
37
+ }),
38
+ get: Effect.fn("ComputerArtifacts.get", spanOptions(binding, sessionId, "get"))(function* (name) {
39
+ yield* Effect.annotateCurrentSpan("repo", name);
40
+ return yield* tryOperation(binding, "get", () => client.get(name));
41
+ }),
42
+ list: tryOperation(binding, "list", () => client.list()).pipe(Effect.withSpan("ComputerArtifacts.list", spanOptions(binding, sessionId, "list"))),
43
+ import: Effect.fn("ComputerArtifacts.import", spanOptions(binding, sessionId, "import"))(function* (name, source, importOptions) {
44
+ yield* Effect.annotateCurrentSpan("repo", name);
45
+ return yield* tryOperation(binding, "import", () => client.import(name, source, importOptions));
46
+ }),
47
+ delete: Effect.fn("ComputerArtifacts.delete", spanOptions(binding, sessionId, "delete"))(function* (name) {
48
+ yield* Effect.annotateCurrentSpan("repo", name);
49
+ return yield* tryOperation(binding, "delete", () => client.delete(name));
50
+ }),
51
+ createToken: Effect.fn("ComputerArtifacts.createToken", spanOptions(binding, sessionId, "createToken"))(function* (name, scope, ttl) {
52
+ yield* Effect.annotateCurrentSpan("repo", name);
53
+ return yield* tryOperation(binding, "createToken", () => client.createToken(name, scope, ttl));
54
+ }),
55
+ listTokens: Effect.fn("ComputerArtifacts.listTokens", spanOptions(binding, sessionId, "listTokens"))(function* (name) {
56
+ yield* Effect.annotateCurrentSpan("repo", name);
57
+ return yield* tryOperation(binding, "listTokens", () => client.listTokens(name));
58
+ }),
59
+ getToken: Effect.fn("ComputerArtifacts.getToken", spanOptions(binding, sessionId, "getToken"))(function* (name, id) {
60
+ yield* Effect.annotateCurrentSpan({
61
+ repo: name,
62
+ tokenId: id
63
+ });
64
+ return yield* tryOperation(binding, "getToken", () => client.getToken(name, id));
65
+ }),
66
+ revokeToken: Effect.fn("ComputerArtifacts.revokeToken", spanOptions(binding, sessionId, "revokeToken"))(function* (name, tokenOrId) {
67
+ yield* Effect.annotateCurrentSpan("repo", name);
68
+ return yield* tryOperation(binding, "revokeToken", () => client.revokeToken(name, tokenOrId));
69
+ }),
70
+ cli: Effect.fn("ComputerArtifacts.cli", spanOptions(binding, sessionId, "cli"))(function* (input) {
71
+ yield* Effect.annotateCurrentSpan("argv", input.argv.join(" "));
72
+ return yield* tryOperation(binding, "cli", () => client.cli(input));
73
+ }),
74
+ rawUnsafe: Effect.succeed(client)
75
+ };
76
+ };
77
+ /**
78
+ * Creates an Effect-native session client directly from a Worker Artifacts
79
+ * binding. `@cloudflare/computer` is loaded only when this Effect runs, keeping
80
+ * the optional peer out of applications that do not use this integration.
81
+ */
82
+ const makeClient = Effect.fn("ComputerArtifacts.makeClient")(function* (bindingValue, sessionId, options = {}) {
83
+ const binding = options.binding ?? "ARTIFACTS";
84
+ const computerArtifacts = yield* Effect.tryPromise({
85
+ try: () => import("@cloudflare/computer/artifacts"),
86
+ catch: (cause) => operationError(binding, "createClient", cause)
87
+ });
88
+ const client = yield* Effect.try({
89
+ try: () => computerArtifacts.createArtifact(bindingValue, sessionId),
90
+ catch: (cause) => operationError(binding, "createClient", cause)
91
+ });
92
+ return fromClient(client, { binding });
93
+ });
94
+ //#endregion
95
+ export { fromClient, makeClient };