// @requirements REQ-PRODUCT-ORDER-CONFIRMATION // @requirements REQ-EU-ORDER-CONFIRMATION // @requirements REQ-PRODUCT-PAID-ORDER-ARCHIVES /** @requirements REQ-PRODUCT-EVIDENCE-EXPORT */ /** @requirements REQ-PRODUCT-CF-ADMIN */ export type JsonValue = null | boolean | number | string | JsonValue[] | { [key: string]: JsonValue }; export interface EvidenceRecord { id: string; data: JsonValue } /** Retained review is separate from the small generic record/export projection. */ export interface PaidOrderArchive {id:string;review:import('./order-policy.js').PaidOrderReview} export interface RecordQuery { query: string; kind: string; from: string; to: string; keyPrefix: string; limit: number; after?: string; } export interface RecordPage { records: EvidenceRecord[]; /** Last examined key, relative to this store's fixed scope. Not a DO identifier. */ nextAfter?: string; /** Work examined in this segment, not a total or a count of all matching records. */ scanned?: number; } /** A host-created store must already be restricted to the caller's authorized scope. */ export interface RecordStore { list(query: RecordQuery): Promise; get(id: string): Promise; /** Optional, separately requested source inspection within this same host-authorized store scope. */ getSource?(releaseId:string,kind:'privacy'|'cookies'|'terms'):Promise; /** Separate private selected-reference view; never traversed by ordinary list/get/export. */ getCatalogReview?(releaseId:string):Promise; /** Private admission-bound archive. The same authorized record ID selects all original files. */ getOrderArchive?(id:string):Promise; /** Complete personally addressed confirmation; separate host permission, never included in generic exports. */ getOrderConfirmation?(id:string):Promise; getOrderConfirmationFile?(id:string,fileId:string):Promise; getOrderAsset?(id:string,sha256:string):Promise; } /** Minimal structural subset of the asynchronous Durable Object storage API. */ export interface DurableStorage { list(options: { prefix: string; startAfter?: string; limit: number }): Promise>; get(key: string): Promise; } export interface AuthorizationGrant { store: RecordStore; /** Display only; this string never selects a tenant, namespace, or storage prefix. */ scopeLabel?: string; /** Explicit per-request bulk-read permission. Omitted/false disables both export routes. */ allowExport?: boolean; /** Explicit per-request permission for retained selected-reference inspection/comparison. */ allowCatalogReview?:boolean; /** Explicit permission for complete paid-order review and original-file inspection. */ allowOrderArchive?:boolean; /** Separate per-request access to customer confirmation files and recipient/destination metadata. */ allowOrderConfirmation?:boolean; } export interface ExecutionContextLike { waitUntil(promise: Promise): void } /** Navigation is presentation only. Every destination must authorize its own requests. */ export interface AdminNavigationItem {label:string;href:string} export interface AdminPresentation { navigation?:readonly AdminNavigationItem[]; workspaceLabel?:string; workspaceNote?:string; } export interface AdminWorkerOptions extends AdminPresentation { /** Mandatory: verify the host's identity and permission on EVERY request. */ authorize(request: Request, env: Env, context?: ExecutionContextLike): Promise | AuthorizationGrant | null; basePath?: string; title?: string; } export interface AdminWorker { fetch(request: Request, env: Env, context?: ExecutionContextLike): Promise; }