import type { DeepMutable, DeepReadonly, HashFunction, MaybeReadonly, RxDocumentData, RxJsonSchema, StringKeys } from './types/index.js'; export declare class RxSchema { readonly jsonSchema: RxJsonSchema>; readonly hashFunction: HashFunction; indexes: MaybeReadonly[]; readonly primaryPath: StringKeys>; finalFields: string[]; constructor(jsonSchema: RxJsonSchema>, hashFunction: HashFunction); get version(): number; get defaultValues(): { [P in keyof RxDocType]: RxDocType[P]; }; getJsonSchemaWithoutMeta(): RxJsonSchema>; /** * @overrides itself on the first call */ get hash(): Promise; /** * checks if a given change on a document is allowed * Ensures that: * - final fields are not modified * @throws {Error} if not valid */ validateChange(dataBefore: any, dataAfter: any): void; /** * creates the schema-based document-prototype, * see RxCollection.getDocumentPrototype() */ getDocumentPrototype(): any; getPrimaryOfDocumentData(documentData: Partial): string; } export declare function getIndexes(jsonSchema: RxJsonSchema): MaybeReadonly[]; /** * array with previous version-numbers */ export declare function getPreviousVersions(schema: RxJsonSchema): number[]; export declare function createRxSchema(jsonSchema: RxJsonSchema, hashFunction: HashFunction, runPreCreateHooks?: boolean): RxSchema; export declare function isRxSchema(obj: any): boolean; /** * Helper function to generate the document type out of the schema via TypeScript. * Always use this together with `as const` on the schema literal so that the * TypeScript compiler can infer the narrowest possible type. * * ## AI Agent Guidance — Canonical Schema Definition Pattern * * ```ts * import { * toTypedRxJsonSchema, * ExtractDocumentTypeFromTypedRxJsonSchema, * RxJsonSchema * } from 'rxdb'; * * const todoSchemaLiteral = { * title: 'todo schema', * version: 0, * primaryKey: 'id', * type: 'object', * properties: { * id: { type: 'string', maxLength: 100 }, * title: { type: 'string' }, * completed: { type: 'boolean' }, * createdAt: { type: 'string', format: 'date-time' }, * updatedAt: { type: 'string', format: 'date-time' } * }, * required: ['id', 'title', 'completed', 'createdAt', 'updatedAt'], * indexes: ['updatedAt', ['completed', 'updatedAt']] * } as const; * * const schemaTyped = toTypedRxJsonSchema(todoSchemaLiteral); * export type TodoDocType = ExtractDocumentTypeFromTypedRxJsonSchema; * export const todoSchema: RxJsonSchema = todoSchemaLiteral; * ``` * * @link https://github.com/pubkey/rxdb/discussions/3467 */ export declare function toTypedRxJsonSchema>>(schema: T): DeepMutable;