import type { Environment } from '../config/environments.js'; import { type ApiDeps } from './client.js'; /** The api-server route; the same one `forge/upload-proxy.ts` forwards the engine to. */ export declare const SIGNED_UPLOAD_PATH = "/api/cli/v1/uploads/signed-url"; export interface SignedUploadRequest { gameId: string; /** A bare basename. api-server refuses (never rewrites) a path separator or `..`. */ filename: string; contentType: string; } /** `cli-uploads.ts`'s `generateUploadSignedUrl` response, the fields a caller needs. */ export interface SignedUpload { signedUrl: string; /** Where the object is served from once the PUT lands — what goes into world.json. */ publicUrl: string; cacheControl?: string; /** `'gzip'` when the server bound that encoding into the signature; the PUT must then gzip. */ contentEncoding?: string; } /** * Ask api-server for a presigned PUT under `worlds/v3//`. Ownership is checked there * before anything is minted, so a refusal here has cost nothing and changed nothing. */ export declare function mintSignedUpload(environment: Environment, accessToken: string, body: SignedUploadRequest, deps: ApiDeps): Promise; export interface PutSignedUrlOptions { /** Exit code for a failed PUT. `bitmagic publish` documents 6 for its upload step; default 1. */ exitCode?: number; } /** * Raw PUT of already-prepared bytes to a GCS V4 signed URL. * * `headers` must match exactly what the URL's signature bound (Content-Type, Cache-Control, and * Content-Encoding when the server chose to gzip). A mismatch is a 403 from GCS, not a stale-cache * symptom; see cli-publish.ts's and cli-uploads.ts's own doc comments for why. */ export declare function putSignedUrl(url: string, body: string | Uint8Array, headers: Record, deps: ApiDeps, options?: PutSignedUrlOptions): Promise; /** * PUT `bytes` to the URL `mintSignedUpload` returned, gzipping first when the server bound * `Content-Encoding: gzip` into the signature. `contentType` is the SAME value the caller minted * with (the server never echoes it back), while `cacheControl` and `contentEncoding` are read off * the signed response, because the server — not the caller — decides both. * * Returns the byte count that actually went over the wire, which is also what is stored. */ export declare function putSignedUpload(signed: SignedUpload, bytes: Uint8Array, contentType: string, deps: ApiDeps, options?: PutSignedUrlOptions): Promise<{ storedBytes: number; }>; export interface UploadProjectFileInput extends SignedUploadRequest { bytes: Uint8Array; } /** Mint and PUT in one call — the whole upload for a file the CLI holds in memory. */ export declare function uploadProjectFile(environment: Environment, accessToken: string, input: UploadProjectFileInput, deps: ApiDeps): Promise<{ url: string; storedBytes: number; }>;