import * as z from 'zod'; import { SatelliteEnvSchema } from '../schemas/satellite.env'; import { type Collections } from './schemas/collections'; import { type AssertFunction } from './schemas/context'; import { type AssertDeleteDocContext, type AssertSetDocContext } from './schemas/db/context'; import { type AssertDeleteAssetContext, type AssertUploadAssetContext } from './schemas/storage/context'; /** * A generic schema for defining assertions related to collections. * * @template T - The type of context passed to the assertions when triggered. */ export type OnAssert = Collections & { assert: AssertFunction; }; /** * @see AssertSetDoc */ export declare const AssertSetDocSchema: z.ZodObject<{ collections: z.ZodReadonly>; assert: z.ZodCustom, Uint8Array>; data: z.ZodObject<{ collection: z.ZodString; key: z.ZodString; data: z.ZodObject<{ current: z.ZodOptional, Uint8Array>; data: z.ZodCustom, Uint8Array>; description: z.ZodOptional; created_at: z.ZodBigInt; updated_at: z.ZodBigInt; version: z.ZodOptional; }, z.core.$strict>>; proposed: z.ZodObject<{ data: z.ZodCustom, Uint8Array>; description: z.ZodOptional; version: z.ZodOptional; }, z.core.$strict>; }, z.core.$strict>; }, z.core.$strict>; }, z.core.$strict>], null>, z.ZodVoid>, z.core.$InferInnerFunctionType, Uint8Array>; data: z.ZodObject<{ collection: z.ZodString; key: z.ZodString; data: z.ZodObject<{ current: z.ZodOptional, Uint8Array>; data: z.ZodCustom, Uint8Array>; description: z.ZodOptional; created_at: z.ZodBigInt; updated_at: z.ZodBigInt; version: z.ZodOptional; }, z.core.$strict>>; proposed: z.ZodObject<{ data: z.ZodCustom, Uint8Array>; description: z.ZodOptional; version: z.ZodOptional; }, z.core.$strict>; }, z.core.$strict>; }, z.core.$strict>; }, z.core.$strict>], null>, z.ZodVoid>>; }, z.core.$strict>; /** * An assertion that runs when a document is created or updated. */ export type AssertSetDoc = OnAssert; /** * @see AssertDeleteDoc */ export declare const AssertDeleteDocSchema: z.ZodObject<{ collections: z.ZodReadonly>; assert: z.ZodCustom, Uint8Array>; data: z.ZodObject<{ collection: z.ZodString; key: z.ZodString; data: z.ZodObject<{ current: z.ZodOptional, Uint8Array>; data: z.ZodCustom, Uint8Array>; description: z.ZodOptional; created_at: z.ZodBigInt; updated_at: z.ZodBigInt; version: z.ZodOptional; }, z.core.$strict>>; proposed: z.ZodObject<{ version: z.ZodOptional; }, z.core.$strict>; }, z.core.$strict>; }, z.core.$strict>; }, z.core.$strict>], null>, z.ZodVoid>, z.core.$InferInnerFunctionType, Uint8Array>; data: z.ZodObject<{ collection: z.ZodString; key: z.ZodString; data: z.ZodObject<{ current: z.ZodOptional, Uint8Array>; data: z.ZodCustom, Uint8Array>; description: z.ZodOptional; created_at: z.ZodBigInt; updated_at: z.ZodBigInt; version: z.ZodOptional; }, z.core.$strict>>; proposed: z.ZodObject<{ version: z.ZodOptional; }, z.core.$strict>; }, z.core.$strict>; }, z.core.$strict>; }, z.core.$strict>], null>, z.ZodVoid>>; }, z.core.$strict>; /** * An assertion that runs when a document is deleted. */ export type AssertDeleteDoc = OnAssert; /** * @see AssertUploadAsset */ export declare const AssertUploadAssetSchema: z.ZodObject<{ collections: z.ZodReadonly>; assert: z.ZodCustom, Uint8Array>; data: z.ZodObject<{ current: 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>>; batch: 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>; commit_batch: z.ZodObject<{ batch_id: z.ZodBigInt; headers: z.ZodArray>; chunk_ids: z.ZodArray; }, z.core.$strict>; }, z.core.$strict>; }, z.core.$strict>], null>, z.ZodVoid>, z.core.$InferInnerFunctionType, Uint8Array>; data: z.ZodObject<{ current: 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>>; batch: 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>; commit_batch: z.ZodObject<{ batch_id: z.ZodBigInt; headers: z.ZodArray>; chunk_ids: z.ZodArray; }, z.core.$strict>; }, z.core.$strict>; }, z.core.$strict>], null>, z.ZodVoid>>; }, z.core.$strict>; /** * An assertion that runs before an asset is uploaded. */ export type AssertUploadAsset = OnAssert; /** * @see AssertDeleteAsset */ export declare const AssertDeleteAssetSchema: z.ZodObject<{ collections: z.ZodReadonly>; assert: z.ZodCustom, Uint8Array>; data: 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>; }, z.core.$strict>], null>, z.ZodVoid>, z.core.$InferInnerFunctionType, Uint8Array>; data: 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>; }, z.core.$strict>], null>, z.ZodVoid>>; }, z.core.$strict>; /** * An assertion that runs before an asset is deleted. */ export type AssertDeleteAsset = OnAssert; /** * @see Assert */ export declare const AssertSchema: z.ZodUnion>; assert: z.ZodCustom, Uint8Array>; data: z.ZodObject<{ collection: z.ZodString; key: z.ZodString; data: z.ZodObject<{ current: z.ZodOptional, Uint8Array>; data: z.ZodCustom, Uint8Array>; description: z.ZodOptional; created_at: z.ZodBigInt; updated_at: z.ZodBigInt; version: z.ZodOptional; }, z.core.$strict>>; proposed: z.ZodObject<{ data: z.ZodCustom, Uint8Array>; description: z.ZodOptional; version: z.ZodOptional; }, z.core.$strict>; }, z.core.$strict>; }, z.core.$strict>; }, z.core.$strict>], null>, z.ZodVoid>, z.core.$InferInnerFunctionType, Uint8Array>; data: z.ZodObject<{ collection: z.ZodString; key: z.ZodString; data: z.ZodObject<{ current: z.ZodOptional, Uint8Array>; data: z.ZodCustom, Uint8Array>; description: z.ZodOptional; created_at: z.ZodBigInt; updated_at: z.ZodBigInt; version: z.ZodOptional; }, z.core.$strict>>; proposed: z.ZodObject<{ data: z.ZodCustom, Uint8Array>; description: z.ZodOptional; version: z.ZodOptional; }, z.core.$strict>; }, z.core.$strict>; }, z.core.$strict>; }, z.core.$strict>], null>, z.ZodVoid>>; }, z.core.$strict>, z.ZodObject<{ collections: z.ZodReadonly>; assert: z.ZodCustom, Uint8Array>; data: z.ZodObject<{ collection: z.ZodString; key: z.ZodString; data: z.ZodObject<{ current: z.ZodOptional, Uint8Array>; data: z.ZodCustom, Uint8Array>; description: z.ZodOptional; created_at: z.ZodBigInt; updated_at: z.ZodBigInt; version: z.ZodOptional; }, z.core.$strict>>; proposed: z.ZodObject<{ version: z.ZodOptional; }, z.core.$strict>; }, z.core.$strict>; }, z.core.$strict>; }, z.core.$strict>], null>, z.ZodVoid>, z.core.$InferInnerFunctionType, Uint8Array>; data: z.ZodObject<{ collection: z.ZodString; key: z.ZodString; data: z.ZodObject<{ current: z.ZodOptional, Uint8Array>; data: z.ZodCustom, Uint8Array>; description: z.ZodOptional; created_at: z.ZodBigInt; updated_at: z.ZodBigInt; version: z.ZodOptional; }, z.core.$strict>>; proposed: z.ZodObject<{ version: z.ZodOptional; }, z.core.$strict>; }, z.core.$strict>; }, z.core.$strict>; }, z.core.$strict>], null>, z.ZodVoid>>; }, z.core.$strict>, z.ZodObject<{ collections: z.ZodReadonly>; assert: z.ZodCustom, Uint8Array>; data: z.ZodObject<{ current: 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>>; batch: 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>; commit_batch: z.ZodObject<{ batch_id: z.ZodBigInt; headers: z.ZodArray>; chunk_ids: z.ZodArray; }, z.core.$strict>; }, z.core.$strict>; }, z.core.$strict>], null>, z.ZodVoid>, z.core.$InferInnerFunctionType, Uint8Array>; data: z.ZodObject<{ current: 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>>; batch: 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>; commit_batch: z.ZodObject<{ batch_id: z.ZodBigInt; headers: z.ZodArray>; chunk_ids: z.ZodArray; }, z.core.$strict>; }, z.core.$strict>; }, z.core.$strict>], null>, z.ZodVoid>>; }, z.core.$strict>, z.ZodObject<{ collections: z.ZodReadonly>; assert: z.ZodCustom, Uint8Array>; data: 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>; }, z.core.$strict>], null>, z.ZodVoid>, z.core.$InferInnerFunctionType, Uint8Array>; data: 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>; }, z.core.$strict>], null>, z.ZodVoid>>; }, z.core.$strict>]>; /** * All assertions definitions. */ export type Assert = AssertSetDoc | AssertDeleteDoc | AssertUploadAsset | AssertDeleteAsset; export declare const AssertFnSchema: (assertSchema: T) => z.ZodFunction], null>, T>; export type AssertFn = (assert: z.infer) => T; export declare const AssertFnOrObjectSchema: (assertSchema: T) => z.ZodUnion], null>, T>, z.core.$InferInnerFunctionType], null>, T>>]>; export type AssertFnOrObject = T | AssertFn; export declare function defineAssert(assert: T): T; export declare function defineAssert(assert: AssertFn): AssertFn; export declare function defineAssert(assert: AssertFnOrObject): AssertFnOrObject;