import { MongoSchemaIR } from "@prisma-next/mongo-schema-ir"; import { Contract, ControlPolicy } from "@prisma-next/contract/types"; import { ContractSerializer, ContractSpace, ControlExtensionDescriptor, ControlFamilyDescriptor, ControlFamilyInstance, ControlStack, MigratableTargetDescriptor, MigrationPlanOperation, OperationPreview, OperationPreviewCapable, SchemaDiffIssue, SchemaVerifier, SchemaViewCapable } from "@prisma-next/framework-components/control"; import { MongoContract, MongoStorageShape } from "@prisma-next/mongo-contract"; //#region src/core/contract-to-schema.d.ts declare function contractToMongoSchemaIR(contract: MongoContract | null): MongoSchemaIR; //#endregion //#region src/core/control-instance.d.ts interface MongoControlFamilyInstance extends ControlFamilyInstance<'mongo', MongoSchemaIR>, SchemaViewCapable, OperationPreviewCapable { /** * The family seam-of-record for on-disk contract reads. Structurally * validates the JSON envelope, then casts to the framework `Contract` * shape; the per-target serializer (held on the Mongo target * descriptor) does the class-form wrap for downstream consumers, so * the family only needs the validated data. The single named entry * point every CLI on-disk read crosses (TML-2536) — `as Contract` * casts in production package sources are a serializer-bypass smell * guarded by `pnpm lint:no-contract-cast`. */ deserializeContract(contractJson: unknown): Contract; } declare function createMongoFamilyInstance(controlStack: ControlStack): MongoControlFamilyInstance; //#endregion //#region src/core/control-descriptor.d.ts declare const mongoFamilyDescriptor: ControlFamilyDescriptor<'mongo', MongoControlFamilyInstance>; //#endregion //#region src/core/control-target-descriptor.d.ts /** * Mongo target control descriptor type. Extends the framework's * `MigratableTargetDescriptor` with two named SPI properties next to * the existing `migrations` capability: * * - `contractSerializer` — JSON to class boundary for Mongo contracts. * - `schemaVerifier` — per-target verifier walking the family contract * against `MongoSchemaIR`. * * The descriptor itself is the aggregator; no extra `Target` interface is introduced. */ interface MongoControlTargetDescriptor extends MigratableTargetDescriptor<'mongo', 'mongo', MongoControlFamilyInstance> { readonly contractSerializer: ContractSerializer; readonly schemaVerifier: SchemaVerifier; } //#endregion //#region src/core/control-types.d.ts /** * Mongo-family extension descriptor. * * Extensions that contribute schema opt into the per-space planner / * runner / verifier by setting `contractSpace`. Extensions without it * are codec-only or query-ops-only — today's behaviour preserved. * * The shape comes from `@prisma-next/framework-components/control` * (`ContractSpace`) — contract-space identity is a framework concept, * not a Mongo-specific one. The Mongo family specialises the generic * to `MongoContract` so descriptor authors see a * typed contract value over the raw-JSON envelope shape; the runtime * in-memory class `MongoStorage` structurally satisfies the shape. * Mirrors `SqlControlExtensionDescriptor`. */ interface MongoControlExtensionDescriptor extends ControlExtensionDescriptor<'mongo', 'mongo'> { readonly contractSpace?: ContractSpace>; } //#endregion //#region src/core/operation-preview.d.ts declare function formatMongoOperations(operations: readonly MigrationPlanOperation[]): string[]; /** * Wraps `formatMongoOperations` into the family-agnostic * `OperationPreview` shape. Each statement carries * `language: 'mongodb-shell'`. Mirrors `sqlOperationsToPreview`. */ declare function mongoOperationsToPreview(operations: readonly MigrationPlanOperation[]): OperationPreview; //#endregion //#region src/core/schema-diff.d.ts /** * The Mongo schema diff, issue-only: `failures` carry the verdict (a verify * passes exactly when it is empty), `warnings` the surviving warn-graded * findings (live-only extras in non-strict mode, `observed` subjects). * * Each issue's `path` carries the coordinate — `[collectionName]` for a * whole-collection finding, `[collectionName, 'index:…' | 'validator' | * 'options']` for an auxiliary — and `expected`/`actual` carry the real * Mongo schema-IR node the finding concerns. */ interface MongoSchemaDiff { readonly failures: readonly SchemaDiffIssue[]; readonly warnings: readonly SchemaDiffIssue[]; } declare function diffMongoSchemas(live: MongoSchemaIR, expected: MongoSchemaIR, strict: boolean, collectionControlPolicy: (collectionName: string) => ControlPolicy): MongoSchemaDiff; //#endregion //#region src/core/schema-verify/canonicalize-introspection.d.ts interface CanonicalizedSchemas { readonly live: MongoSchemaIR; readonly expected: MongoSchemaIR; } declare function canonicalizeSchemasForVerification(live: MongoSchemaIR, expected: MongoSchemaIR): CanonicalizedSchemas; //#endregion export { type MongoControlExtensionDescriptor, type MongoControlFamilyInstance, type MongoControlTargetDescriptor, canonicalizeSchemasForVerification, contractToMongoSchemaIR, createMongoFamilyInstance, diffMongoSchemas, formatMongoOperations, mongoFamilyDescriptor, mongoOperationsToPreview }; //# sourceMappingURL=control.d.mts.map