import { IRNodeBase } from "@prisma-next/framework-components/ir"; import { MongoIndexKey } from "@prisma-next/mongo-contract"; import { CollationOptions } from "@prisma-next/mongo-value/mongodb-types"; import { DiffableNode } from "@prisma-next/framework-components/control"; //#region src/canonicalize.d.ts declare function canonicalize(obj: unknown): string; //#endregion //#region src/schema-collection-options.d.ts interface MongoSchemaCollectionOptionsInput { readonly capped?: { size: number; max?: number; }; readonly timeseries?: { timeField: string; metaField?: string; granularity?: 'seconds' | 'minutes' | 'hours'; }; readonly collation?: CollationOptions; readonly changeStreamPreAndPostImages?: { enabled: boolean; }; readonly clusteredIndex?: { name?: string; }; } declare class MongoSchemaCollectionOptions extends MongoSchemaIRNode { readonly nodeKind: "collectionOptions"; /** Fixed sentinel: at most one options node exists per collection. */ readonly id = "options"; readonly capped?: { size: number; max?: number; } | undefined; readonly timeseries?: { timeField: string; metaField?: string; granularity?: 'seconds' | 'minutes' | 'hours'; } | undefined; readonly collation?: CollationOptions | undefined; readonly changeStreamPreAndPostImages?: { enabled: boolean; } | undefined; readonly clusteredIndex?: { name?: string; } | undefined; constructor(options: MongoSchemaCollectionOptionsInput); accept(visitor: MongoSchemaVisitor): R; } //#endregion //#region src/schema-validator.d.ts interface MongoSchemaValidatorOptions { readonly jsonSchema: Record; readonly validationLevel: 'strict' | 'moderate'; readonly validationAction: 'error' | 'warn'; } declare class MongoSchemaValidator extends MongoSchemaIRNode { readonly nodeKind: "validator"; /** Fixed sentinel: at most one validator exists per collection. */ readonly id = "validator"; readonly jsonSchema: Record; readonly validationLevel: 'strict' | 'moderate'; readonly validationAction: 'error' | 'warn'; constructor(options: MongoSchemaValidatorOptions); accept(visitor: MongoSchemaVisitor): R; } //#endregion //#region src/schema-collection.d.ts interface MongoSchemaCollectionCtorOptions { readonly name: string; readonly indexes?: ReadonlyArray; readonly validator?: MongoSchemaValidator; readonly options?: MongoSchemaCollectionOptions; } declare class MongoSchemaCollection extends MongoSchemaIRNode { readonly nodeKind: "collection"; readonly id: string; readonly name: string; readonly indexes: ReadonlyArray; readonly validator?: MongoSchemaValidator | undefined; readonly options?: MongoSchemaCollectionOptions | undefined; constructor(options: MongoSchemaCollectionCtorOptions); accept(visitor: MongoSchemaVisitor): R; } //#endregion //#region src/schema-ir.d.ts declare class MongoSchemaIR extends MongoSchemaIRNode { readonly nodeKind: "schema"; /** Fixed sentinel: the schema is always the diff tree's single root. */ readonly id = "schema"; readonly collections: ReadonlyArray; readonly collectionNames: ReadonlyArray; private readonly _byName; constructor(collections: ReadonlyArray); accept(visitor: MongoSchemaVisitor): R; collection(name: string): MongoSchemaCollection | undefined; } //#endregion //#region src/visitor.d.ts interface MongoSchemaVisitor { schema(node: MongoSchemaIR): R; collection(node: MongoSchemaCollection): R; index(node: MongoSchemaIndex): R; validator(node: MongoSchemaValidator): R; collectionOptions(node: MongoSchemaCollectionOptions): R; } //#endregion //#region src/schema-node.d.ts /** * Every concrete Mongo schema-IR node also implements the framework's * `DiffableNode` interface, so a node can be carried as the `expected`/ * `actual` payload of a `SchemaDiffIssue`. Mongo's own diff (`diffMongoSchemas`) * still hand-rolls its comparisons and never calls `isEqualTo`/`children` — * this conformance exists so an issue can carry the real collection/index/ * validator/options node it concerns, not a coordinate string. * * Follow-up: `isEqualTo`/`children` are dead weight on every Mongo node * (nothing calls them). The honest fix is splitting `DiffableNode` into a * narrower "issue payload" bound (just `id`) that this class implements, * separate from the full walkable `DiffableNode` (`id` + `isEqualTo` + * `children`) the generic differ actually pairs and recurses over. */ declare abstract class MongoSchemaIRNode extends IRNodeBase implements DiffableNode { readonly kind: string; abstract readonly id: string; /** Per-node discriminant `DiffableNode` requires: collection / index / validator / collectionOptions / schema. */ abstract readonly nodeKind: string; abstract accept(visitor: MongoSchemaVisitor): R; constructor(); isEqualTo(other: DiffableNode): boolean; children(): readonly DiffableNode[]; } //#endregion //#region src/schema-index.d.ts interface MongoSchemaIndexOptions { readonly keys: ReadonlyArray; readonly unique?: boolean | undefined; readonly sparse?: boolean | undefined; readonly expireAfterSeconds?: number | undefined; readonly partialFilterExpression?: Record | undefined; readonly wildcardProjection?: Record | undefined; readonly collation?: CollationOptions | undefined; readonly weights?: Record | undefined; readonly default_language?: string | undefined; readonly language_override?: string | undefined; } declare class MongoSchemaIndex extends MongoSchemaIRNode { readonly nodeKind: "index"; readonly id: string; readonly keys: ReadonlyArray; readonly unique: boolean; readonly sparse?: boolean | undefined; readonly expireAfterSeconds?: number | undefined; readonly partialFilterExpression?: Record | undefined; readonly wildcardProjection?: Record | undefined; readonly collation?: CollationOptions | undefined; readonly weights?: Record | undefined; readonly default_language?: string | undefined; readonly language_override?: string | undefined; constructor(options: MongoSchemaIndexOptions); accept(visitor: MongoSchemaVisitor): R; } //#endregion //#region src/index-equivalence.d.ts /** * Key-order-sensitive structural comparison. For key-order-independent * comparison (e.g. lookup key construction), use {@link canonicalize}. */ declare function deepEqual(a: unknown, b: unknown): boolean; declare function indexesEquivalent(a: MongoSchemaIndex, b: MongoSchemaIndex): boolean; //#endregion //#region src/types.d.ts type AnyMongoSchemaNode = MongoSchemaIR | MongoSchemaCollection | MongoSchemaCollectionOptions | MongoSchemaIndex | MongoSchemaValidator; //#endregion export { type AnyMongoSchemaNode, MongoSchemaCollection, type MongoSchemaCollectionCtorOptions, MongoSchemaCollectionOptions, type MongoSchemaCollectionOptionsInput, MongoSchemaIR, MongoSchemaIRNode, MongoSchemaIndex, type MongoSchemaIndexOptions, MongoSchemaValidator, type MongoSchemaValidatorOptions, type MongoSchemaVisitor, canonicalize, deepEqual, indexesEquivalent }; //# sourceMappingURL=index.d.mts.map