import * as z from 'zod'; import { type Collection, type Description, type RawUserId, type Timestamp, type Version } from './satellite'; /** * Represents a single HTTP header as a tuple of name and value. */ export type HeaderField = [string, string]; /** * @see HeaderFields */ export declare const HeaderFieldsSchema: z.ZodArray>; /** * Represents a list of HTTP headers. */ export type HeaderFields = HeaderField[]; /** * @see Blob */ export declare const BlobSchema: z.ZodCustom, Uint8Array>; /** * Binary content used in asset encoding. */ export type Blob = Uint8Array; /** * When stable memory is used, chunks are saved within a StableBTreeMap and their keys - StableEncodingChunkKey - are saved for reference as serialized values */ export type BlobOrKey = Uint8Array; /** * Represents a SHA-256 hash as a 32-byte binary value. */ export type Hash = Uint8Array; /** * @see AssetKey */ export declare const AssetKeySchema: z.ZodObject<{ name: z.ZodString; full_path: z.ZodString; token: z.ZodOptional; collection: z.ZodString; owner: z.ZodCustom, Uint8Array>; description: z.ZodOptional; }, z.core.$strict>; /** * Metadata identifying an asset within a collection and the storage system. */ export interface AssetKey { /** * The name of the asset (e.g., "logo.png"). */ name: string; /** * The full relative path of the asset (e.g., "/images/logo.png"). */ full_path: string; /** * Optional access token for the asset. * If set, can be used using a query parameter e.g. /full_path/?token=1223-3345-5564-3333 */ token?: string; /** * The collection to which this asset belongs. */ collection: Collection; /** * The owner of the asset. */ owner: RawUserId; /** * Optional description of the asset for indexing/search. */ description?: Description; } /** * @see AssetEncoding */ export declare const AssetEncodingSchema: z.ZodObject<{ modified: z.ZodBigInt; content_chunks: z.ZodArray, Uint8Array>>; total_length: z.ZodBigInt; sha256: z.ZodCustom, Uint8Array>; }, z.core.$strip>; /** * Represents a specific encoding of an asset, such as "gzip" or "identity" (no compression). */ export interface AssetEncoding { /** * Timestamp when the encoding was last modified. */ modified: Timestamp; /** * Chunks of binary content or references to them. */ content_chunks: BlobOrKey[]; /** * Total byte size of the encoded content. */ total_length: bigint; /** * SHA-256 hash of the encoded content. */ sha256: Hash; } /** * Represents a specific encoding of an asset, such as "gzip" or "identity" (no compression), without the chunks. */ export type AssetEncodingNoContent = Omit; /** * A string identifier representing a specific encoding format (e.g., "gzip", "identity"). */ export type EncodingType = 'identity' | 'gzip' | 'compress' | 'deflate' | 'br'; /** * @see Asset */ export declare const AssetSchema: z.ZodObject<{ key: z.ZodObject<{ name: z.ZodString; full_path: z.ZodString; token: z.ZodOptional; collection: z.ZodString; owner: z.ZodCustom, Uint8Array>; description: z.ZodOptional; }, z.core.$strict>; headers: z.ZodArray>; encodings: z.ZodArray, z.ZodObject<{ modified: z.ZodBigInt; content_chunks: z.ZodArray, Uint8Array>>; total_length: z.ZodBigInt; sha256: z.ZodCustom, Uint8Array>; }, z.core.$strip>], null>>; created_at: z.ZodBigInt; updated_at: z.ZodBigInt; version: z.ZodOptional; }, z.core.$strict>; /** * A stored asset including its metadata, encodings, and timestamps. */ export interface Asset { /** * Metadata about the asset's identity and ownership. */ key: AssetKey; /** * Optional HTTP headers associated with the asset. */ headers: HeaderField[]; /** * A mapping from encoding types (e.g., "identity", "gzip") to the corresponding encoded version. */ encodings: [EncodingType, AssetEncoding][]; /** * Timestamp when the asset was created. */ created_at: Timestamp; /** * Timestamp when the asset was last updated. */ updated_at: Timestamp; /** * Optional version number of the asset. */ version?: Version; } /** * @see AssetNoContent */ export declare const AssetNoContentSchema: z.ZodObject<{ created_at: z.ZodBigInt; updated_at: z.ZodBigInt; version: z.ZodOptional; key: z.ZodObject<{ name: z.ZodString; full_path: z.ZodString; token: z.ZodOptional; collection: z.ZodString; owner: z.ZodCustom, Uint8Array>; description: z.ZodOptional; }, z.core.$strict>; headers: z.ZodArray>; encodings: z.ZodArray, z.ZodObject<{ modified: z.ZodBigInt; sha256: z.ZodCustom, Uint8Array>; total_length: z.ZodBigInt; }, z.core.$strict>], null>>; }, z.core.$strict>; /** * A stored asset including its metadata, encodings without chunks, and timestamps. */ export type AssetNoContent = Omit & { encodings: [EncodingType, AssetEncodingNoContent][]; }; /** * A unique reference identifier for batches. */ export type ReferenceId = bigint; /** * @see Batch */ export declare const BatchSchema: z.ZodObject<{ key: z.ZodObject<{ name: z.ZodString; full_path: z.ZodString; token: z.ZodOptional; collection: z.ZodString; owner: z.ZodCustom, Uint8Array>; description: z.ZodOptional; }, z.core.$strict>; reference_id: z.ZodOptional; expires_at: z.ZodBigInt; encoding_type: z.ZodOptional>; }, z.core.$strict>; /** * Represents a batch of chunks to be uploaded and committed to an asset. */ export interface Batch { /** * The metadata key for the asset being uploaded. */ key: AssetKey; /** * Optional reference ID for tracking or validation. */ reference_id?: ReferenceId; /** * Timestamp when this batch expires. */ expires_at: Timestamp; /** * Optional encoding format (e.g., "gzip"). */ encoding_type?: EncodingType; } /** * A unique identifier representing a single chunk of data. */ export type ChunkId = bigint; /** * A unique identifier representing a batch of upload. */ export type BatchId = bigint; /** * @see CommitBatch */ export declare const CommitBatchSchema: z.ZodObject<{ batch_id: z.ZodBigInt; headers: z.ZodArray>; chunk_ids: z.ZodArray; }, z.core.$strict>; /** * Represents the final step in uploading an asset, committing the batch to storage. */ export interface CommitBatch { /** * The ID of the batch being committed. */ batch_id: BatchId; /** * HTTP headers associated with this asset. */ headers: HeaderField[]; /** * List of chunk IDs that make up the asset content. */ chunk_ids: ChunkId[]; } /** * @see FullPath */ export declare const FullPathSchema: z.ZodString; /** * Represents the relative path of an asset in storage. * For assets that are not part of the frontend app, the collection must be included at the root of the path. * * Example: `/images/a-sun-above-the-mountains.png` */ export type FullPath = string; /** * @see AssetAccessToken */ export declare const AssetAccessTokenSchema: z.ZodOptional; /** * An optional access token that can be used to make an asset private on the web. * Private as in practically unguessable (if complex enough and not shared of course). * * Example: `/images/a-sun-above-the-mountains.png?token=a-super-long-unguessable-not-shared-id` */ export type AssetAccessToken = string | undefined; /** * @see OptionAsset */ export declare const OptionAssetSchema: z.ZodOptional; collection: z.ZodString; owner: z.ZodCustom, Uint8Array>; description: z.ZodOptional; }, z.core.$strict>; headers: z.ZodArray>; encodings: z.ZodArray, z.ZodObject<{ modified: z.ZodBigInt; content_chunks: z.ZodArray, Uint8Array>>; total_length: z.ZodBigInt; sha256: z.ZodCustom, Uint8Array>; }, z.core.$strip>], null>>; created_at: z.ZodBigInt; updated_at: z.ZodBigInt; version: z.ZodOptional; }, z.core.$strict>>; /** * A shorthand for an asset that might or not be defined. */ export type OptionAsset = Asset | undefined;