import { z } from 'zod'; /** Private object storage needed by versioned publications (compatible with R2). */ export interface RpgPublicationBucket { /** Read an immutable artifact. */ get(key: string): Promise<{ text(): Promise; } | null>; /** Create an artifact only if its key does not already exist. */ put(key: string, value: string, options: { onlyIf: { etagDoesNotMatch: string; }; }): Promise; } declare const mapSchema: z.ZodObject<{ id: z.ZodString; width: z.ZodNumber; height: z.ZodNumber; }, z.core.$loose>; declare const sharedSchema: z.ZodObject<{ config: z.ZodRecord; database: z.ZodUnion, z.ZodRecord]>; }, z.core.$strict>; declare const manifestSchema: z.ZodObject<{ schemaVersion: z.ZodLiteral<1>; projectId: z.ZodString; startMapId: z.ZodString; shared: z.ZodString; maps: z.ZodRecord; }, z.core.$strict>; /** Immutable project version. Hashes address private objects within this project. */ export type RpgPublicationManifest = z.infer; /** Server-owned prepared map, before its shared config/database are attached. */ export type RpgPublicationMap = z.infer; /** Data shared by all maps in a publication. */ export type RpgPublicationShared = z.infer; /** Compact durable pointer to an activated project version. */ export interface RpgPublicationHead { /** Monotonically increasing activation number. */ revision: number; /** SHA-256 of the project's immutable manifest. */ manifest: string; } /** * Upload one complete version without activating it. Objects are addressed by * content hash; identical input reuses the same keys. Call the authenticated * activation endpoint with the returned hash and the expected current revision. * @example * const manifest = await prepareRpgPublication(env.GAME_DATA, { * projectId: 'game', startMapId: 'town', * shared: { config: {}, database: [] }, maps: [{ id: 'town', width: 640, height: 480 }], * }); */ export declare function prepareRpgPublication(bucket: RpgPublicationBucket, input: { /** Stable project identifier. Map identifiers must be globally unique per room binding. */ projectId: string; /** First map entered by new players. */ startMapId: string; /** Project configuration (including world topology) and database. */ shared: RpgPublicationShared; /** Complete server-prepared maps, with config/database stored in shared instead. */ maps: RpgPublicationMap[]; }): Promise; export declare function readManifest(bucket: RpgPublicationBucket, projectId: string, ref: string): Promise<{ schemaVersion: 1; projectId: string; startMapId: string; shared: string; maps: Record; }>; export declare function readPublicationMap(bucket: RpgPublicationBucket, manifest: RpgPublicationManifest, mapId: string): Promise<{ config: { startMapId: string; }; database: Record | unknown[]; id: string; width: number; height: number; }>; export declare function validatePublication(bucket: RpgPublicationBucket, manifest: RpgPublicationManifest): Promise; export declare function ownershipKey(mapId: string): string; export declare function getMapOwner(bucket: RpgPublicationBucket, mapId: string): Promise; export {};