import * as Effect from "effect/Effect"; import * as Binding from "../../Binding.ts"; import type { RuntimeContext } from "../../RuntimeContext.ts"; import type * as Artifacts from "./Namespace.ts"; /** * Bind a Cloudflare Artifacts namespace ({@link Namespace}) to a Worker and * obtain the Effect-native {@link ReadWriteNamespaceClient} (read + write: * create / list / get / delete / import). * * **Example:** Using Artifacts inside a Worker * ```typescript * const artifacts = yield* Cloudflare.Artifacts.ReadWriteNamespace(Repos); * const repo = yield* artifacts.create("starter-repo", { * setDefaultBranch: "main", * }); * ``` * * @binding * @product Artifacts * @category Developer Platform */ export interface ReadWriteNamespace extends Binding.Service Effect.Effect> { } export declare const ReadWriteNamespace: ReadWriteNamespace; declare const ArtifactsError_base: new = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & { readonly _tag: "ArtifactsError"; } & Readonly; export declare class ArtifactsError extends ArtifactsError_base<{ message: string; cause: Error; }> { } export type Scope = "read" | "write"; export type CreateOptions = { readOnly?: boolean; description?: string; setDefaultBranch?: string; }; export type ImportOptions = { source: { url: string; branch?: string; depth?: number; }; target: { name: string; opts?: { description?: string; readOnly?: boolean; }; }; }; export type ListOptions = { limit?: number; cursor?: string; }; export type ForkOptions = { description?: string; readOnly?: boolean; defaultBranchOnly?: boolean; }; /** * Effect-native handle to a single Artifacts repo. Wraps the runtime * {@link ArtifactsRepo} so each method returns an Effect. */ export interface RepoClient { /** Underlying Cloudflare runtime handle. */ raw: ArtifactsRepo; createToken(scope?: Scope, ttl?: number): Effect.Effect; listTokens(): Effect.Effect; revokeToken(tokenOrId: string): Effect.Effect; fork(name: string, opts?: ForkOptions): Effect.Effect; } /** * Read-only client surface for an Artifacts namespace binding (look up + list). */ export interface ReadNamespaceClient { /** Effect resolving to the raw Cloudflare runtime binding. */ raw: Effect.Effect; /** Look up an existing repo by name. Fails with `ArtifactsError` if missing. */ get(name: string): Effect.Effect; list(opts?: ListOptions): Effect.Effect; } /** * Write client surface for an Artifacts namespace binding (create / delete / import). */ export interface WriteNamespaceClient { /** Effect resolving to the raw Cloudflare runtime binding. */ raw: Effect.Effect; create(name: string, opts?: CreateOptions): Effect.Effect; delete(name: string): Effect.Effect; import(opts: ImportOptions): Effect.Effect; } /** * Full read + write client for a Cloudflare Artifacts namespace binding. */ export interface ReadWriteNamespaceClient extends ReadNamespaceClient, WriteNamespaceClient { } /** * Bind a Cloudflare Artifacts namespace with read-only access * (`Cloudflare.Artifacts.ReadNamespace(Repos)`): `get` / `list` / `raw`. * * @binding * @product Artifacts * @category Developer Platform */ export interface ReadNamespace extends Binding.Service Effect.Effect> { } export declare const ReadNamespace: ReadNamespace; /** * Bind a Cloudflare Artifacts namespace with write access * (`Cloudflare.Artifacts.WriteNamespace(Repos)`): `create` / `delete` / `import`. * * @binding * @product Artifacts * @category Developer Platform */ export interface WriteNamespace extends Binding.Service Effect.Effect> { } export declare const WriteNamespace: WriteNamespace; export {}; //# sourceMappingURL=ReadWriteNamespace.d.ts.map