@prisma-next/family-mongo 0.7.0-dev.7 → 0.8.0-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/README.md +22 -9
  2. package/dist/control-adapter.d.mts +75 -0
  3. package/dist/control-adapter.d.mts.map +1 -0
  4. package/dist/control-adapter.mjs +1 -0
  5. package/dist/control.d.mts +60 -16
  6. package/dist/control.d.mts.map +1 -1
  7. package/dist/control.mjs +257 -276
  8. package/dist/control.mjs.map +1 -1
  9. package/dist/ir.d.mts +131 -0
  10. package/dist/ir.d.mts.map +1 -0
  11. package/dist/ir.mjs +54 -0
  12. package/dist/ir.mjs.map +1 -0
  13. package/dist/mongo-contract-serializer-Co3EaTVj.mjs +98 -0
  14. package/dist/mongo-contract-serializer-Co3EaTVj.mjs.map +1 -0
  15. package/dist/schema-verify.d.mts +22 -2
  16. package/dist/schema-verify.d.mts.map +1 -0
  17. package/dist/schema-verify.mjs +1 -1
  18. package/dist/verify-mongo-schema-BL7t9YTB.mjs +592 -0
  19. package/dist/verify-mongo-schema-BL7t9YTB.mjs.map +1 -0
  20. package/package.json +18 -20
  21. package/src/core/contract-to-schema.ts +84 -0
  22. package/src/core/control-adapter.ts +97 -0
  23. package/src/core/control-instance.ts +275 -272
  24. package/src/core/control-target-descriptor.ts +26 -0
  25. package/src/core/control-types.ts +6 -4
  26. package/src/core/ir/mongo-contract-serializer-base.ts +124 -0
  27. package/src/core/ir/mongo-contract-serializer.ts +18 -0
  28. package/src/core/ir/mongo-schema-verifier-base.ts +87 -0
  29. package/src/core/operation-preview.ts +131 -0
  30. package/src/core/schema-diff.ts +402 -0
  31. package/src/core/schema-verify/canonicalize-introspection.ts +389 -0
  32. package/src/core/schema-verify/verify-mongo-schema.ts +60 -0
  33. package/src/exports/control-adapter.ts +1 -0
  34. package/src/exports/control.ts +8 -1
  35. package/src/exports/ir.ts +3 -0
  36. package/src/exports/schema-verify.ts +4 -2
  37. package/src/core/mongo-target-descriptor.ts +0 -180
@@ -1 +1 @@
1
- {"version":3,"file":"control.mjs","names":["extractDb"],"sources":["../src/core/schema-to-view.ts","../src/core/control-instance.ts","../src/core/control-descriptor.ts","../src/core/mongo-target-descriptor.ts"],"sourcesContent":["import type { CoreSchemaView } from '@prisma-next/framework-components/control';\nimport { SchemaTreeNode } from '@prisma-next/framework-components/control';\nimport type { MongoSchemaCollection, MongoSchemaIR } from '@prisma-next/mongo-schema-ir';\nimport { ifDefined } from '@prisma-next/utils/defined';\n\nexport function mongoSchemaToView(schema: MongoSchemaIR): CoreSchemaView {\n const collectionNodes = schema.collections.map((collection) =>\n collectionToSchemaNode(collection.name, collection),\n );\n\n return {\n root: new SchemaTreeNode({\n kind: 'root',\n id: 'mongo-schema',\n label: 'database',\n ...ifDefined('children', collectionNodes.length > 0 ? collectionNodes : undefined),\n }),\n };\n}\n\nfunction collectionToSchemaNode(name: string, collection: MongoSchemaCollection): SchemaTreeNode {\n const children: SchemaTreeNode[] = [];\n\n for (const index of collection.indexes) {\n const keysSummary = index.keys\n .map((k) => {\n if (k.direction === 1) return k.field;\n if (k.direction === -1) return `${k.field} desc`;\n return `${k.field} ${k.direction}`;\n })\n .join(', ');\n const prefix = index.unique ? 'unique index' : 'index';\n const options: string[] = [];\n if (index.sparse) options.push('sparse');\n if (index.expireAfterSeconds != null) options.push(`ttl: ${index.expireAfterSeconds}s`);\n if (index.partialFilterExpression) options.push('partial');\n const optsSuffix = options.length > 0 ? ` (${options.join(', ')})` : '';\n\n children.push(\n new SchemaTreeNode({\n kind: 'index',\n id: `index-${name}-${index.keys.map((k) => `${k.field}_${k.direction}`).join('_')}`,\n label: `${prefix} (${keysSummary})${optsSuffix}`,\n meta: {\n keys: index.keys,\n unique: index.unique,\n ...ifDefined('sparse', index.sparse || undefined),\n ...ifDefined('expireAfterSeconds', index.expireAfterSeconds ?? undefined),\n ...ifDefined('partialFilterExpression', index.partialFilterExpression ?? undefined),\n },\n }),\n );\n }\n\n if (collection.validator) {\n const validatorChildren: SchemaTreeNode[] = [];\n const jsonSchema = collection.validator.jsonSchema as Record<string, unknown>;\n const properties = jsonSchema['properties'] as\n | Record<string, Record<string, unknown>>\n | undefined;\n const required = new Set((jsonSchema['required'] as string[] | undefined) ?? []);\n\n if (properties) {\n for (const [propName, propDef] of Object.entries(properties)) {\n const bsonType = (propDef['bsonType'] as string) ?? 'unknown';\n const suffix = required.has(propName) ? ' (required)' : '';\n validatorChildren.push(\n new SchemaTreeNode({\n kind: 'field',\n id: `field-${name}-${propName}`,\n label: `${propName}: ${bsonType}${suffix}`,\n }),\n );\n }\n }\n\n children.push(\n new SchemaTreeNode({\n kind: 'field',\n id: `validator-${name}`,\n label: `validator (level: ${collection.validator.validationLevel}, action: ${collection.validator.validationAction})`,\n meta: {\n validationLevel: collection.validator.validationLevel,\n validationAction: collection.validator.validationAction,\n jsonSchema: collection.validator.jsonSchema,\n },\n ...ifDefined('children', validatorChildren.length > 0 ? validatorChildren : undefined),\n }),\n );\n }\n\n if (collection.options) {\n const opts = collection.options;\n const optLabels: string[] = [];\n if (opts.capped) optLabels.push('capped');\n if (opts.timeseries) optLabels.push('timeseries');\n if (opts.collation) optLabels.push('collation');\n if (opts.changeStreamPreAndPostImages) optLabels.push('changeStreamPreAndPostImages');\n if (opts.clusteredIndex) optLabels.push('clusteredIndex');\n\n if (optLabels.length > 0) {\n children.push(\n new SchemaTreeNode({\n kind: 'field',\n id: `options-${name}`,\n label: `options (${optLabels.join(', ')})`,\n meta: {\n ...ifDefined('capped', opts.capped ?? undefined),\n ...ifDefined('timeseries', opts.timeseries ?? undefined),\n ...ifDefined('collation', opts.collation ?? undefined),\n ...ifDefined(\n 'changeStreamPreAndPostImages',\n opts.changeStreamPreAndPostImages ?? undefined,\n ),\n ...ifDefined('clusteredIndex', opts.clusteredIndex ?? undefined),\n },\n }),\n );\n }\n }\n\n return new SchemaTreeNode({\n kind: 'collection',\n id: `collection-${name}`,\n label: `collection ${name}`,\n ...ifDefined('children', children.length > 0 ? children : undefined),\n });\n}\n","import { introspectSchema } from '@prisma-next/adapter-mongo/control';\nimport type { Contract, ContractMarkerRecord } from '@prisma-next/contract/types';\nimport type { TargetBoundComponentDescriptor } from '@prisma-next/framework-components/components';\nimport type {\n ControlDriverInstance,\n ControlFamilyInstance,\n ControlStack,\n CoreSchemaView,\n MigrationPlanOperation,\n OperationPreview,\n OperationPreviewCapable,\n SchemaViewCapable,\n SignDatabaseResult,\n VerifyDatabaseResult,\n VerifyDatabaseSchemaResult,\n} from '@prisma-next/framework-components/control';\nimport {\n APP_SPACE_ID,\n VERIFY_CODE_HASH_MISMATCH,\n VERIFY_CODE_MARKER_MISSING,\n VERIFY_CODE_TARGET_MISMATCH,\n} from '@prisma-next/framework-components/control';\nimport { assertDescriptorSelfConsistency } from '@prisma-next/migration-tools/spaces';\nimport type { MongoContract } from '@prisma-next/mongo-contract';\nimport { validateMongoContract } from '@prisma-next/mongo-contract';\nimport type { MongoSchemaIR } from '@prisma-next/mongo-schema-ir';\nimport {\n formatMongoOperations,\n initMarker,\n readAllMarkers,\n readMarker,\n updateMarker,\n} from '@prisma-next/target-mongo/control';\nimport { verifyMongoSchema } from '@prisma-next/target-mongo/schema-verify';\nimport { ifDefined } from '@prisma-next/utils/defined';\nimport type { Db } from 'mongodb';\nimport type { MongoControlExtensionDescriptor } from './control-types';\nimport { mongoSchemaToView } from './schema-to-view';\n\nexport interface MongoControlFamilyInstance\n extends ControlFamilyInstance<'mongo', MongoSchemaIR>,\n SchemaViewCapable<MongoSchemaIR>,\n OperationPreviewCapable {\n validateContract(contractJson: unknown): Contract;\n}\n\nfunction extractDb(driver: ControlDriverInstance<'mongo', string>): Db {\n const mongoDriver = driver as ControlDriverInstance<'mongo', string> & { db?: Db };\n if (!mongoDriver.db) {\n throw new Error(\n 'Mongo control driver does not expose a db property. ' +\n 'Use createMongoControlDriver() from @prisma-next/adapter-mongo/control.',\n );\n }\n return mongoDriver.db;\n}\n\nclass MongoFamilyInstance implements MongoControlFamilyInstance {\n readonly familyId = 'mongo' as const;\n\n validateContract(contractJson: unknown): Contract {\n const validated = validateMongoContract<MongoContract>(contractJson);\n // MongoContract and Contract share structure but are typed independently;\n // validateMongoContract guarantees the shape, so the double cast is safe.\n return validated.contract as unknown as Contract;\n }\n\n async verify(options: {\n readonly driver: ControlDriverInstance<'mongo', string>;\n readonly contract: unknown;\n readonly expectedTargetId: string;\n readonly contractPath: string;\n readonly configPath?: string;\n }): Promise<VerifyDatabaseResult> {\n const { driver, contract: rawContract, expectedTargetId, contractPath, configPath } = options;\n const startTime = Date.now();\n\n const validated = validateMongoContract<MongoContract>(rawContract);\n const contract = validated.contract;\n\n const contractStorageHash = contract.storage.storageHash;\n const contractProfileHash = contract.profileHash;\n const contractTarget = contract.target;\n\n const baseOpts = {\n contractStorageHash,\n contractProfileHash,\n expectedTargetId,\n contractPath,\n ...ifDefined('configPath', configPath),\n };\n\n if (contractTarget !== expectedTargetId) {\n return buildVerifyResult({\n ...baseOpts,\n ok: false,\n code: VERIFY_CODE_TARGET_MISMATCH,\n summary: 'Target mismatch',\n actualTargetId: contractTarget,\n totalTime: Date.now() - startTime,\n });\n }\n\n const db = extractDb(driver);\n const marker = await readMarker(db, APP_SPACE_ID);\n\n if (!marker) {\n return buildVerifyResult({\n ...baseOpts,\n ok: false,\n code: VERIFY_CODE_MARKER_MISSING,\n summary: 'Marker missing',\n totalTime: Date.now() - startTime,\n });\n }\n\n if (marker.storageHash !== contractStorageHash) {\n return buildVerifyResult({\n ...baseOpts,\n ok: false,\n code: VERIFY_CODE_HASH_MISMATCH,\n summary: 'Hash mismatch',\n marker,\n totalTime: Date.now() - startTime,\n });\n }\n\n if (contractProfileHash && marker.profileHash !== contractProfileHash) {\n return buildVerifyResult({\n ...baseOpts,\n ok: false,\n code: VERIFY_CODE_HASH_MISMATCH,\n summary: 'Hash mismatch',\n marker,\n totalTime: Date.now() - startTime,\n });\n }\n\n return buildVerifyResult({\n ...baseOpts,\n ok: true,\n summary: 'Database matches contract',\n marker,\n totalTime: Date.now() - startTime,\n });\n }\n\n async schemaVerify(options: {\n readonly driver: ControlDriverInstance<'mongo', string>;\n readonly contract: unknown;\n readonly strict: boolean;\n readonly contractPath: string;\n readonly configPath?: string;\n readonly frameworkComponents: ReadonlyArray<TargetBoundComponentDescriptor<'mongo', string>>;\n }): Promise<VerifyDatabaseSchemaResult> {\n const { driver, contract: rawContract, strict, contractPath, configPath } = options;\n\n const validated = validateMongoContract<MongoContract>(rawContract);\n const contract = validated.contract;\n\n const db = extractDb(driver);\n const liveIR = await introspectSchema(db);\n\n return verifyMongoSchema({\n contract,\n schema: liveIR,\n strict,\n frameworkComponents: options.frameworkComponents,\n context: {\n contractPath,\n ...ifDefined('configPath', configPath),\n },\n });\n }\n\n schemaVerifyAgainstSchema(options: {\n readonly contract: unknown;\n readonly schema: MongoSchemaIR;\n readonly strict: boolean;\n readonly frameworkComponents: ReadonlyArray<TargetBoundComponentDescriptor<'mongo', string>>;\n }): VerifyDatabaseSchemaResult {\n const validated = validateMongoContract<MongoContract>(options.contract);\n return verifyMongoSchema({\n contract: validated.contract,\n schema: options.schema,\n strict: options.strict,\n frameworkComponents: options.frameworkComponents,\n });\n }\n\n async sign(options: {\n readonly driver: ControlDriverInstance<'mongo', string>;\n readonly contract: unknown;\n readonly contractPath: string;\n readonly configPath?: string;\n }): Promise<SignDatabaseResult> {\n const { driver, contract: rawContract, contractPath, configPath } = options;\n const startTime = Date.now();\n\n const validated = validateMongoContract<MongoContract>(rawContract);\n const contract = validated.contract;\n\n const contractStorageHash = contract.storage.storageHash;\n const contractProfileHash = contract.profileHash;\n\n const db = extractDb(driver);\n\n const existingMarker = await readMarker(db, APP_SPACE_ID);\n\n let markerCreated = false;\n let markerUpdated = false;\n let previousHashes: { storageHash?: string; profileHash?: string } | undefined;\n\n if (!existingMarker) {\n await initMarker(db, APP_SPACE_ID, {\n storageHash: contractStorageHash,\n profileHash: contractProfileHash,\n });\n markerCreated = true;\n } else {\n const storageHashMatches = existingMarker.storageHash === contractStorageHash;\n const profileHashMatches = existingMarker.profileHash === contractProfileHash;\n\n if (!storageHashMatches || !profileHashMatches) {\n previousHashes = {\n storageHash: existingMarker.storageHash,\n profileHash: existingMarker.profileHash,\n };\n const updated = await updateMarker(db, APP_SPACE_ID, existingMarker.storageHash, {\n storageHash: contractStorageHash,\n profileHash: contractProfileHash,\n });\n if (!updated) {\n throw new Error('CAS conflict: marker was modified by another process during sign');\n }\n markerUpdated = true;\n }\n }\n\n let summary: string;\n if (markerCreated) {\n summary = 'Database signed (marker created)';\n } else if (markerUpdated) {\n summary = `Database signed (marker updated from ${previousHashes?.storageHash ?? 'unknown'})`;\n } else {\n summary = 'Database already signed with this contract';\n }\n\n return {\n ok: true,\n summary,\n contract: {\n storageHash: contractStorageHash,\n profileHash: contractProfileHash,\n },\n target: {\n expected: contract.target,\n actual: contract.target,\n },\n marker: {\n created: markerCreated,\n updated: markerUpdated,\n ...ifDefined('previous', previousHashes),\n },\n meta: {\n contractPath,\n ...ifDefined('configPath', configPath),\n },\n timings: {\n total: Date.now() - startTime,\n },\n };\n }\n\n async readMarker(options: {\n readonly driver: ControlDriverInstance<'mongo', string>;\n readonly space: string;\n }): Promise<ContractMarkerRecord | null> {\n const db = extractDb(options.driver);\n return readMarker(db, options.space);\n }\n\n async readAllMarkers(options: {\n readonly driver: ControlDriverInstance<'mongo', string>;\n }): Promise<ReadonlyMap<string, ContractMarkerRecord>> {\n const db = extractDb(options.driver);\n return readAllMarkers(db);\n }\n\n async introspect(options: {\n readonly driver: ControlDriverInstance<'mongo', string>;\n readonly contract?: unknown;\n }): Promise<MongoSchemaIR> {\n const db = extractDb(options.driver);\n return introspectSchema(db);\n }\n\n toSchemaView(schema: MongoSchemaIR): CoreSchemaView {\n return mongoSchemaToView(schema);\n }\n\n toOperationPreview(operations: readonly MigrationPlanOperation[]): OperationPreview {\n return {\n statements: formatMongoOperations(operations).map((text) => ({\n text,\n language: 'mongodb-shell',\n })),\n };\n }\n}\n\nfunction buildVerifyResult(opts: {\n ok: boolean;\n code?: string;\n summary: string;\n contractStorageHash: string;\n contractProfileHash?: string;\n marker?: ContractMarkerRecord;\n expectedTargetId: string;\n actualTargetId?: string;\n contractPath: string;\n configPath?: string;\n totalTime: number;\n}): VerifyDatabaseResult {\n return {\n ok: opts.ok,\n ...ifDefined('code', opts.code),\n summary: opts.summary,\n contract: {\n storageHash: opts.contractStorageHash,\n ...ifDefined('profileHash', opts.contractProfileHash),\n },\n ...ifDefined(\n 'marker',\n opts.marker\n ? { storageHash: opts.marker.storageHash, profileHash: opts.marker.profileHash }\n : undefined,\n ),\n target: {\n expected: opts.expectedTargetId,\n ...ifDefined('actual', opts.actualTargetId),\n },\n meta: {\n contractPath: opts.contractPath,\n ...ifDefined('configPath', opts.configPath),\n },\n timings: { total: opts.totalTime },\n };\n}\n\nexport function createMongoFamilyInstance(controlStack: ControlStack): MongoControlFamilyInstance {\n // Descriptor self-consistency check.\n // Each extension that exposes a `contractSpace` must publish a\n // `headRef.hash` that matches the canonical hash recomputed from its\n // `contractJson`. A stale value would silently corrupt every downstream\n // boundary that trusts `headRef.hash` as the canonical identity (drift\n // detection, on-disk artefact emission, runner marker writes). Failing\n // fast at descriptor-load time turns \"extension author shipped an\n // inconsistent descriptor\" into an explicit, actionable error\n // (`MIGRATION.DESCRIPTOR_HEAD_HASH_MISMATCH`) rather than a confusing\n // mismatch surfacing several layers downstream. Mirrors the SQL family.\n const extensions = (controlStack.extensionPacks ??\n []) as readonly MongoControlExtensionDescriptor[];\n for (const extension of extensions) {\n if (extension.contractSpace) {\n const { contractJson, headRef } = extension.contractSpace;\n assertDescriptorSelfConsistency({\n extensionId: extension.id,\n target: contractJson.target,\n targetFamily: contractJson.targetFamily,\n storage: contractJson.storage,\n headRefHash: headRef.hash,\n });\n }\n }\n return new MongoFamilyInstance();\n}\n","import type {\n ControlFamilyDescriptor,\n ControlStack,\n} from '@prisma-next/framework-components/control';\nimport { mongoEmission } from '@prisma-next/mongo-emitter';\nimport { createMongoFamilyInstance, type MongoControlFamilyInstance } from './control-instance';\n\nclass MongoFamilyDescriptor\n implements ControlFamilyDescriptor<'mongo', MongoControlFamilyInstance>\n{\n readonly kind = 'family' as const;\n readonly id = 'mongo';\n readonly familyId = 'mongo' as const;\n readonly version = '0.0.1';\n readonly emission = mongoEmission;\n\n create<TTargetId extends string>(\n stack: ControlStack<'mongo', TTargetId>,\n ): MongoControlFamilyInstance {\n return createMongoFamilyInstance(stack);\n }\n}\n\nexport const mongoFamilyDescriptor: ControlFamilyDescriptor<'mongo', MongoControlFamilyInstance> =\n new MongoFamilyDescriptor();\n","import { createMongoRunnerDeps, extractDb } from '@prisma-next/adapter-mongo/control';\nimport type { Contract } from '@prisma-next/contract/types';\nimport { MongoDriverImpl } from '@prisma-next/driver-mongo';\nimport type {\n MigratableTargetDescriptor,\n MigrationRunner,\n MigrationRunnerResult,\n MigrationRunnerSuccessValue,\n MultiSpaceCapableRunner,\n MultiSpaceRunnerFailure,\n MultiSpaceRunnerPerSpaceOptions,\n MultiSpaceRunnerResult,\n} from '@prisma-next/framework-components/control';\nimport {\n type ContractSpaceMember,\n projectSchemaToSpace,\n} from '@prisma-next/migration-tools/aggregate';\nimport type { MongoContract } from '@prisma-next/mongo-contract';\nimport type { MongoSchemaCollection } from '@prisma-next/mongo-schema-ir';\nimport { MongoSchemaIR } from '@prisma-next/mongo-schema-ir';\nimport {\n contractToMongoSchemaIR,\n MongoMigrationPlanner,\n MongoMigrationRunner,\n type MongoMigrationRunnerExecuteOptions,\n type MongoRunnerDependencies,\n} from '@prisma-next/target-mongo/control';\nimport mongoTargetDescriptorMeta from '@prisma-next/target-mongo/pack';\nimport { notOk, ok } from '@prisma-next/utils/result';\nimport type { MongoControlFamilyInstance } from './control-instance';\n\n/**\n * `migration.ts` default-exports a `Migration` subclass whose `operations`\n * getter returns the ordered list of operations and whose `describe()`\n * returns the manifest identity metadata. `MongoMigrationPlanner.plan()`\n * returns a `MigrationPlanWithAuthoringSurface` that knows how to render\n * itself back to such a file; `MongoMigrationPlanner.emptyMigration()`\n * returns the same shape for `migration new`. Users run the scaffolded\n * `migration.ts` directly (via `node migration.ts`) to self-emit\n * `ops.json` and attest the `migrationHash`.\n */\nexport const mongoTargetDescriptor: MigratableTargetDescriptor<\n 'mongo',\n 'mongo',\n MongoControlFamilyInstance\n> = {\n ...mongoTargetDescriptorMeta,\n migrations: {\n createPlanner(_family: MongoControlFamilyInstance) {\n return new MongoMigrationPlanner();\n },\n createRunner(family: MongoControlFamilyInstance) {\n // Deps are bound to the first driver passed to execute() and cached for\n // subsequent calls. Callers must not change the driver between calls.\n let cachedDeps: MongoRunnerDependencies | undefined;\n\n const runMongo = async (\n driver: Parameters<MigrationRunner<'mongo', 'mongo'>['execute']>[0]['driver'],\n runnerOptions: Omit<MongoMigrationRunnerExecuteOptions, 'destinationContract'> & {\n readonly destinationContract: unknown;\n },\n ): Promise<MigrationRunnerResult> => {\n cachedDeps ??= createMongoRunnerDeps(\n driver,\n MongoDriverImpl.fromDb(extractDb(driver)),\n family,\n );\n // The framework `MigrationRunner` interface types `destinationContract`\n // as `unknown`; the Mongo runner narrows to `MongoContract`. Validation\n // happens upstream — `migration apply` calls\n // `familyInstance.validateContract(migration.toContract)` before\n // routing the contract here, so this cast preserves the framework\n // signature without weakening the runner's typed surface.\n return new MongoMigrationRunner(cachedDeps).execute({\n ...runnerOptions,\n destinationContract: runnerOptions.destinationContract as MongoContract,\n });\n };\n\n const runner: MigrationRunner<'mongo', 'mongo'> & MultiSpaceCapableRunner<'mongo', 'mongo'> =\n {\n async execute(options) {\n const { driver, ...runnerOptions } = options;\n return runMongo(driver, runnerOptions);\n },\n // Mongo cannot wrap DDL ops in a session transaction (createCollection,\n // createIndex, collMod, setValidation all bypass transactions even on\n // replica sets), so the cross-space envelope is *resumable* rather than\n // transactional. Per-space-internal verify-gated marker atomicity\n // already lives in `runner.execute`: ops apply, schema is introspected\n // and verified, and the marker advances only on verify-pass. This loop\n // composes that guarantee across spaces — earlier-advanced markers are\n // not rolled back when a later space fails. Re-running reads each\n // marker, finds spaces 1..N−1 at-head (no-op skip), retries N onward.\n //\n // Per-space verify is sliced via `projectSchemaToSpace`: the live DB\n // holds collections owned by sibling spaces, but each space's verify\n // only sees the slice that space's contract actually claims. Without\n // the projection an aggregate of two spaces could not pass strict\n // verify (every other-space collection would look like an extra).\n //\n // See `docs/architecture docs/subsystems/10. MongoDB Family.md` §\n // Contract spaces and ADR 212 — Contract spaces.\n async executeAcrossSpaces({ driver, perSpaceOptions }): Promise<MultiSpaceRunnerResult> {\n const members = perSpaceOptions.map(toSpaceMember);\n const perSpaceResults: Array<{\n space: string;\n value: MigrationRunnerSuccessValue;\n }> = [];\n for (let i = 0; i < perSpaceOptions.length; i++) {\n const spaceOptions = perSpaceOptions[i];\n if (!spaceOptions) continue;\n const member = members[i];\n if (!member) continue;\n const others = members.filter((_, j) => j !== i);\n const projectSchema = (schema: MongoSchemaIR): MongoSchemaIR => {\n // `projectSchemaToSpace` returns a plain object\n // `{...schemaIR, collections: prunedArray}` (not a\n // `MongoSchemaIR` instance), so the descriptor rewraps\n // the pruned collections into a fresh `MongoSchemaIR`\n // before handing it to `verifyMongoSchema` (which\n // depends on the class's `collectionNames` /\n // `collection(name)` accessors).\n const projected = projectSchemaToSpace(schema, member, others) as {\n readonly collections: ReadonlyArray<MongoSchemaCollection>;\n };\n return new MongoSchemaIR(projected.collections);\n };\n const result = await runMongo(driver, { ...spaceOptions, projectSchema });\n if (!result.ok) {\n return notOk<MultiSpaceRunnerFailure>({\n ...result.failure,\n failingSpace: spaceOptions.space,\n });\n }\n perSpaceResults.push({ space: spaceOptions.space, value: result.value });\n }\n return ok({ perSpaceResults });\n },\n };\n return runner;\n },\n contractToSchema(contract: Contract | null) {\n return contractToMongoSchemaIR(contract as MongoContract | null);\n },\n },\n create() {\n return { familyId: 'mongo' as const, targetId: 'mongo' as const };\n },\n};\n\n/**\n * Synthesise the minimum {@link projectSchemaToSpace}-compatible\n * `ContractSpaceMember` shape from a per-space option entry. The\n * projector only reads `spaceId` and `contract.storage`; the rest of\n * `ContractSpaceMember` (head ref invariants, hydrated migration\n * graph) is irrelevant at runner time and stubbed with sentinels.\n *\n * The `as unknown as ContractSpaceMember` cast is the load-bearing bit\n * — the projector duck-types its members so a sentinel-shaped graph\n * never gets read, but the framework type carries a richer shape.\n */\nfunction toSpaceMember(\n opts: MultiSpaceRunnerPerSpaceOptions<'mongo', 'mongo'>,\n): ContractSpaceMember {\n return {\n spaceId: opts.space,\n contract: opts.destinationContract as Contract,\n headRef: { hash: '', invariants: [] },\n migrations: {\n graph: {\n nodes: new Set<string>(),\n forwardChain: new Map(),\n reverseChain: new Map(),\n migrationByHash: new Map(),\n },\n packagesByMigrationHash: new Map(),\n },\n } as unknown as ContractSpaceMember;\n}\n"],"mappings":";;;;;;;;;;;;;;AAKA,SAAgB,kBAAkB,QAAuC;CACvE,MAAM,kBAAkB,OAAO,YAAY,KAAK,eAC9C,uBAAuB,WAAW,MAAM,WAAW,CACpD;CAED,OAAO,EACL,MAAM,IAAI,eAAe;EACvB,MAAM;EACN,IAAI;EACJ,OAAO;EACP,GAAG,UAAU,YAAY,gBAAgB,SAAS,IAAI,kBAAkB,KAAA,EAAU;EACnF,CAAC,EACH;;AAGH,SAAS,uBAAuB,MAAc,YAAmD;CAC/F,MAAM,WAA6B,EAAE;CAErC,KAAK,MAAM,SAAS,WAAW,SAAS;EACtC,MAAM,cAAc,MAAM,KACvB,KAAK,MAAM;GACV,IAAI,EAAE,cAAc,GAAG,OAAO,EAAE;GAChC,IAAI,EAAE,cAAc,IAAI,OAAO,GAAG,EAAE,MAAM;GAC1C,OAAO,GAAG,EAAE,MAAM,GAAG,EAAE;IACvB,CACD,KAAK,KAAK;EACb,MAAM,SAAS,MAAM,SAAS,iBAAiB;EAC/C,MAAM,UAAoB,EAAE;EAC5B,IAAI,MAAM,QAAQ,QAAQ,KAAK,SAAS;EACxC,IAAI,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a;OAC5B,CAAC;MAEJ,gBAAgB,KAAK;OAAE,OAAO,aAAa;OAAO,OAAO,OAAO;OAAO,CAAC;;KAE1E,OAAO,GAAG,EAAE,iBAAiB,CAAC;;IAGvB;;EAEf,iBAAiB,UAA2B;GAC1C,OAAO,wBAAwB,SAAiC;;EAEnE;CACD,SAAS;EACP,OAAO;GAAE,UAAU;GAAkB,UAAU;GAAkB;;CAEpE;;;;;;;;;;;;AAaD,SAAS,cACP,MACqB;CACrB,OAAO;EACL,SAAS,KAAK;EACd,UAAU,KAAK;EACf,SAAS;GAAE,MAAM;GAAI,YAAY,EAAE;GAAE;EACrC,YAAY;GACV,OAAO;IACL,uBAAO,IAAI,KAAa;IACxB,8BAAc,IAAI,KAAK;IACvB,8BAAc,IAAI,KAAK;IACvB,iCAAiB,IAAI,KAAK;IAC3B;GACD,yCAAyB,IAAI,KAAK;GACnC;EACF"}
1
+ {"version":3,"file":"control.mjs","names":[],"sources":["../src/core/operation-preview.ts","../src/core/schema-to-view.ts","../src/core/control-instance.ts","../src/core/control-descriptor.ts"],"sourcesContent":["import type {\n MigrationPlanOperation,\n OperationPreview,\n} from '@prisma-next/framework-components/control';\nimport type {\n CollModCommand,\n CreateCollectionCommand,\n CreateIndexCommand,\n DropCollectionCommand,\n DropIndexCommand,\n MongoDdlCommandVisitor,\n MongoIndexKey,\n} from '@prisma-next/mongo-query-ast/control';\n\nfunction formatKeySpec(keys: ReadonlyArray<MongoIndexKey>): string {\n const entries = keys.map((k) => `${JSON.stringify(k.field)}: ${JSON.stringify(k.direction)}`);\n return `{ ${entries.join(', ')} }`;\n}\n\nfunction formatOptions(cmd: CreateIndexCommand): string | undefined {\n const parts: string[] = [];\n if (cmd.unique) parts.push('unique: true');\n if (cmd.sparse) parts.push('sparse: true');\n if (cmd.expireAfterSeconds !== undefined)\n parts.push(`expireAfterSeconds: ${cmd.expireAfterSeconds}`);\n if (cmd.name) parts.push(`name: ${JSON.stringify(cmd.name)}`);\n if (cmd.collation) parts.push(`collation: ${JSON.stringify(cmd.collation)}`);\n if (cmd.weights) parts.push(`weights: ${JSON.stringify(cmd.weights)}`);\n if (cmd.default_language) parts.push(`default_language: ${JSON.stringify(cmd.default_language)}`);\n if (cmd.language_override)\n parts.push(`language_override: ${JSON.stringify(cmd.language_override)}`);\n if (cmd.wildcardProjection)\n parts.push(`wildcardProjection: ${JSON.stringify(cmd.wildcardProjection)}`);\n if (cmd.partialFilterExpression)\n parts.push(`partialFilterExpression: ${JSON.stringify(cmd.partialFilterExpression)}`);\n if (parts.length === 0) return undefined;\n return `{ ${parts.join(', ')} }`;\n}\n\nfunction formatCreateCollectionOptions(cmd: CreateCollectionCommand): string | undefined {\n const parts: string[] = [];\n if (cmd.capped) parts.push('capped: true');\n if (cmd.size !== undefined) parts.push(`size: ${cmd.size}`);\n if (cmd.max !== undefined) parts.push(`max: ${cmd.max}`);\n if (cmd.timeseries) parts.push(`timeseries: ${JSON.stringify(cmd.timeseries)}`);\n if (cmd.collation) parts.push(`collation: ${JSON.stringify(cmd.collation)}`);\n if (cmd.clusteredIndex) parts.push(`clusteredIndex: ${JSON.stringify(cmd.clusteredIndex)}`);\n if (cmd.validator) parts.push(`validator: ${JSON.stringify(cmd.validator)}`);\n if (cmd.validationLevel) parts.push(`validationLevel: ${JSON.stringify(cmd.validationLevel)}`);\n if (cmd.validationAction) parts.push(`validationAction: ${JSON.stringify(cmd.validationAction)}`);\n if (cmd.changeStreamPreAndPostImages)\n parts.push(`changeStreamPreAndPostImages: ${JSON.stringify(cmd.changeStreamPreAndPostImages)}`);\n if (parts.length === 0) return undefined;\n return `{ ${parts.join(', ')} }`;\n}\n\nclass MongoDdlCommandFormatter implements MongoDdlCommandVisitor<string> {\n createIndex(cmd: CreateIndexCommand): string {\n const keySpec = formatKeySpec(cmd.keys);\n const opts = formatOptions(cmd);\n return opts\n ? `db.${cmd.collection}.createIndex(${keySpec}, ${opts})`\n : `db.${cmd.collection}.createIndex(${keySpec})`;\n }\n\n dropIndex(cmd: DropIndexCommand): string {\n return `db.${cmd.collection}.dropIndex(${JSON.stringify(cmd.name)})`;\n }\n\n createCollection(cmd: CreateCollectionCommand): string {\n const opts = formatCreateCollectionOptions(cmd);\n return opts\n ? `db.createCollection(${JSON.stringify(cmd.collection)}, ${opts})`\n : `db.createCollection(${JSON.stringify(cmd.collection)})`;\n }\n\n dropCollection(cmd: DropCollectionCommand): string {\n return `db.${cmd.collection}.drop()`;\n }\n\n collMod(cmd: CollModCommand): string {\n const parts: string[] = [`collMod: ${JSON.stringify(cmd.collection)}`];\n if (cmd.validator) parts.push(`validator: ${JSON.stringify(cmd.validator)}`);\n if (cmd.validationLevel) parts.push(`validationLevel: ${JSON.stringify(cmd.validationLevel)}`);\n if (cmd.validationAction)\n parts.push(`validationAction: ${JSON.stringify(cmd.validationAction)}`);\n if (cmd.changeStreamPreAndPostImages)\n parts.push(\n `changeStreamPreAndPostImages: ${JSON.stringify(cmd.changeStreamPreAndPostImages)}`,\n );\n return `db.runCommand({ ${parts.join(', ')} })`;\n }\n}\n\nconst formatter = new MongoDdlCommandFormatter();\n\ninterface MongoExecuteStep {\n readonly command: { readonly accept: <R>(visitor: MongoDdlCommandVisitor<R>) => R };\n}\n\nexport function formatMongoOperations(operations: readonly MigrationPlanOperation[]): string[] {\n const statements: string[] = [];\n for (const operation of operations) {\n const candidate = operation as unknown as Record<string, unknown>;\n if (!('execute' in candidate) || !Array.isArray(candidate['execute'])) {\n continue;\n }\n for (const step of candidate['execute'] as MongoExecuteStep[]) {\n if (step.command && typeof step.command.accept === 'function') {\n statements.push(step.command.accept(formatter));\n }\n }\n }\n return statements;\n}\n\n/**\n * Wraps `formatMongoOperations` into the family-agnostic\n * `OperationPreview` shape. Each statement carries\n * `language: 'mongodb-shell'`. Mirrors `sqlOperationsToPreview`.\n */\nexport function mongoOperationsToPreview(\n operations: readonly MigrationPlanOperation[],\n): OperationPreview {\n return {\n statements: formatMongoOperations(operations).map((text) => ({\n text,\n language: 'mongodb-shell',\n })),\n };\n}\n","import type { CoreSchemaView } from '@prisma-next/framework-components/control';\nimport { SchemaTreeNode } from '@prisma-next/framework-components/control';\nimport type { MongoSchemaCollection, MongoSchemaIR } from '@prisma-next/mongo-schema-ir';\nimport { ifDefined } from '@prisma-next/utils/defined';\n\nexport function mongoSchemaToView(schema: MongoSchemaIR): CoreSchemaView {\n const collectionNodes = schema.collections.map((collection) =>\n collectionToSchemaNode(collection.name, collection),\n );\n\n return {\n root: new SchemaTreeNode({\n kind: 'root',\n id: 'mongo-schema',\n label: 'database',\n ...ifDefined('children', collectionNodes.length > 0 ? collectionNodes : undefined),\n }),\n };\n}\n\nfunction collectionToSchemaNode(name: string, collection: MongoSchemaCollection): SchemaTreeNode {\n const children: SchemaTreeNode[] = [];\n\n for (const index of collection.indexes) {\n const keysSummary = index.keys\n .map((k) => {\n if (k.direction === 1) return k.field;\n if (k.direction === -1) return `${k.field} desc`;\n return `${k.field} ${k.direction}`;\n })\n .join(', ');\n const prefix = index.unique ? 'unique index' : 'index';\n const options: string[] = [];\n if (index.sparse) options.push('sparse');\n if (index.expireAfterSeconds != null) options.push(`ttl: ${index.expireAfterSeconds}s`);\n if (index.partialFilterExpression) options.push('partial');\n const optsSuffix = options.length > 0 ? ` (${options.join(', ')})` : '';\n\n children.push(\n new SchemaTreeNode({\n kind: 'index',\n id: `index-${name}-${index.keys.map((k) => `${k.field}_${k.direction}`).join('_')}`,\n label: `${prefix} (${keysSummary})${optsSuffix}`,\n meta: {\n keys: index.keys,\n unique: index.unique,\n ...ifDefined('sparse', index.sparse || undefined),\n ...ifDefined('expireAfterSeconds', index.expireAfterSeconds ?? undefined),\n ...ifDefined('partialFilterExpression', index.partialFilterExpression ?? undefined),\n },\n }),\n );\n }\n\n if (collection.validator) {\n const validatorChildren: SchemaTreeNode[] = [];\n const jsonSchema = collection.validator.jsonSchema as Record<string, unknown>;\n const properties = jsonSchema['properties'] as\n | Record<string, Record<string, unknown>>\n | undefined;\n const required = new Set((jsonSchema['required'] as string[] | undefined) ?? []);\n\n if (properties) {\n for (const [propName, propDef] of Object.entries(properties)) {\n const bsonType = (propDef['bsonType'] as string) ?? 'unknown';\n const suffix = required.has(propName) ? ' (required)' : '';\n validatorChildren.push(\n new SchemaTreeNode({\n kind: 'field',\n id: `field-${name}-${propName}`,\n label: `${propName}: ${bsonType}${suffix}`,\n }),\n );\n }\n }\n\n children.push(\n new SchemaTreeNode({\n kind: 'field',\n id: `validator-${name}`,\n label: `validator (level: ${collection.validator.validationLevel}, action: ${collection.validator.validationAction})`,\n meta: {\n validationLevel: collection.validator.validationLevel,\n validationAction: collection.validator.validationAction,\n jsonSchema: collection.validator.jsonSchema,\n },\n ...ifDefined('children', validatorChildren.length > 0 ? validatorChildren : undefined),\n }),\n );\n }\n\n if (collection.options) {\n const opts = collection.options;\n const optLabels: string[] = [];\n if (opts.capped) optLabels.push('capped');\n if (opts.timeseries) optLabels.push('timeseries');\n if (opts.collation) optLabels.push('collation');\n if (opts.changeStreamPreAndPostImages) optLabels.push('changeStreamPreAndPostImages');\n if (opts.clusteredIndex) optLabels.push('clusteredIndex');\n\n if (optLabels.length > 0) {\n children.push(\n new SchemaTreeNode({\n kind: 'field',\n id: `options-${name}`,\n label: `options (${optLabels.join(', ')})`,\n meta: {\n ...ifDefined('capped', opts.capped ?? undefined),\n ...ifDefined('timeseries', opts.timeseries ?? undefined),\n ...ifDefined('collation', opts.collation ?? undefined),\n ...ifDefined(\n 'changeStreamPreAndPostImages',\n opts.changeStreamPreAndPostImages ?? undefined,\n ),\n ...ifDefined('clusteredIndex', opts.clusteredIndex ?? undefined),\n },\n }),\n );\n }\n }\n\n return new SchemaTreeNode({\n kind: 'collection',\n id: `collection-${name}`,\n label: `collection ${name}`,\n ...ifDefined('children', children.length > 0 ? children : undefined),\n });\n}\n","import type { Contract, ContractMarkerRecord } from '@prisma-next/contract/types';\nimport type { TargetBoundComponentDescriptor } from '@prisma-next/framework-components/components';\nimport type {\n ControlDriverInstance,\n ControlFamilyInstance,\n ControlStack,\n CoreSchemaView,\n MigrationPlanOperation,\n OperationPreview,\n OperationPreviewCapable,\n SchemaViewCapable,\n SignDatabaseResult,\n VerifyDatabaseResult,\n VerifyDatabaseSchemaResult,\n} from '@prisma-next/framework-components/control';\nimport {\n APP_SPACE_ID,\n VERIFY_CODE_HASH_MISMATCH,\n VERIFY_CODE_MARKER_MISSING,\n VERIFY_CODE_TARGET_MISMATCH,\n} from '@prisma-next/framework-components/control';\nimport { assertDescriptorSelfConsistency } from '@prisma-next/migration-tools/spaces';\nimport type { MongoContract } from '@prisma-next/mongo-contract';\nimport type { MongoSchemaIR } from '@prisma-next/mongo-schema-ir';\nimport { ifDefined } from '@prisma-next/utils/defined';\nimport type { MongoControlAdapter, MongoControlAdapterDescriptor } from './control-adapter';\nimport type { MongoControlExtensionDescriptor } from './control-types';\nimport { MongoContractSerializer } from './ir/mongo-contract-serializer';\nimport { mongoOperationsToPreview } from './operation-preview';\nimport { mongoSchemaToView } from './schema-to-view';\nimport { verifyMongoSchema } from './schema-verify/verify-mongo-schema';\n\nexport interface MongoControlFamilyInstance\n extends ControlFamilyInstance<'mongo', MongoSchemaIR>,\n SchemaViewCapable<MongoSchemaIR>,\n OperationPreviewCapable {\n /**\n * Validates the JSON contract envelope structurally and returns it\n * cast to the framework `Contract` shape. The per-target serializer\n * (held on the Mongo target descriptor) does the class-form wrap for\n * downstream consumers; the family only needs the validated data.\n */\n validateContract(contractJson: unknown): Contract;\n}\n\nfunction deserializeMongoContract(contractJson: unknown): MongoContract {\n // Structural validation only — the per-target serializer wraps the\n // result in a class-form `MongoTargetContract` for downstream\n // consumers (CLI, runner). The family-instance methods only read\n // hash/target fields off the validated shape, so the unwrapped\n // `MongoContract` is sufficient here and avoids a family→target\n // runtime dep.\n return new MongoContractSerializer().deserializeContract(contractJson);\n}\n\n/**\n * Family-method contract input. By the time control-plane methods\n * (`verify`, `verifySchema`, `sign`, …) are invoked through the CLI\n * control client (`client.ts`), the input has already been threaded\n * through `familyInstance.validateContract`. The value is therefore a\n * class-form `MongoTargetContract` (or a structurally-equivalent\n * envelope post-deserialization) and must NOT be re-fed through\n * structural validation (arktype rejects extra keys like `namespaces`).\n *\n * The parameter type on the framework SPI is `unknown` for variance\n * reasons (so the family can express its own contract type without\n * leaking it to the framework). This helper recovers the validated\n * shape with a single narrow cast.\n */\nfunction asValidatedMongoContract(contract: unknown): MongoContract {\n return contract as MongoContract;\n}\n\nfunction isMongoControlAdapter(value: unknown): value is MongoControlAdapter<'mongo'> {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'readMarker' in value &&\n typeof (value as { readMarker: unknown }).readMarker === 'function' &&\n 'readAllMarkers' in value &&\n typeof (value as { readAllMarkers: unknown }).readAllMarkers === 'function' &&\n 'introspectSchema' in value &&\n typeof (value as { introspectSchema: unknown }).introspectSchema === 'function'\n );\n}\n\nfunction buildVerifyResult(opts: {\n ok: boolean;\n code?: string;\n summary: string;\n contractStorageHash: string;\n contractProfileHash?: string;\n marker?: ContractMarkerRecord;\n expectedTargetId: string;\n actualTargetId?: string;\n contractPath: string;\n configPath?: string;\n totalTime: number;\n}): VerifyDatabaseResult {\n return {\n ok: opts.ok,\n ...ifDefined('code', opts.code),\n summary: opts.summary,\n contract: {\n storageHash: opts.contractStorageHash,\n ...ifDefined('profileHash', opts.contractProfileHash),\n },\n ...ifDefined(\n 'marker',\n opts.marker\n ? { storageHash: opts.marker.storageHash, profileHash: opts.marker.profileHash }\n : undefined,\n ),\n target: {\n expected: opts.expectedTargetId,\n ...ifDefined('actual', opts.actualTargetId),\n },\n meta: {\n contractPath: opts.contractPath,\n ...ifDefined('configPath', opts.configPath),\n },\n timings: { total: opts.totalTime },\n };\n}\n\nexport function createMongoFamilyInstance(controlStack: ControlStack): MongoControlFamilyInstance {\n // Descriptor self-consistency check.\n // Each extension that exposes a `contractSpace` must publish a\n // `headRef.hash` that matches the canonical hash recomputed from its\n // `contractJson`. A stale value would silently corrupt every downstream\n // boundary that trusts `headRef.hash` as the canonical identity (drift\n // detection, on-disk artefact emission, runner marker writes). Failing\n // fast at descriptor-load time turns \"extension author shipped an\n // inconsistent descriptor\" into an explicit, actionable error\n // (`MIGRATION.DESCRIPTOR_HEAD_HASH_MISMATCH`) rather than a confusing\n // mismatch surfacing several layers downstream. Mirrors the SQL family.\n const extensions = (controlStack.extensionPacks ??\n []) as readonly MongoControlExtensionDescriptor[];\n for (const extension of extensions) {\n if (extension.contractSpace) {\n const { contractJson, headRef } = extension.contractSpace;\n assertDescriptorSelfConsistency({\n extensionId: extension.id,\n target: contractJson.target,\n targetFamily: contractJson.targetFamily,\n storage: contractJson.storage,\n headRefHash: headRef.hash,\n });\n }\n }\n\n // Mongo dispatch surface. Every wire-level operation routes through\n // the adapter resolved from the control stack; the family carries no\n // direct imports of target/adapter/driver internals. Mirrors the SQL\n // family's `getControlAdapter()` helper.\n const adapter = controlStack.adapter as MongoControlAdapterDescriptor<'mongo'> | undefined;\n const getControlAdapter = (): MongoControlAdapter<'mongo'> => {\n if (!adapter) {\n throw new Error('Mongo family requires an adapter descriptor in ControlStack');\n }\n const controlAdapter = adapter.create(controlStack as ControlStack<'mongo', 'mongo'>);\n if (!isMongoControlAdapter(controlAdapter)) {\n throw new Error(\n 'Adapter does not implement MongoControlAdapter (missing readMarker, readAllMarkers, or introspectSchema)',\n );\n }\n return controlAdapter;\n };\n\n // The family-level driver type is `ControlDriverInstance<'mongo', string>`,\n // but the SPI methods are typed against `<'mongo', 'mongo'>`. Today's only\n // Mongo target is `'mongo'`, so the runtime values are identical; the cast\n // satisfies the structural type-system mismatch on `targetId`.\n const asMongoDriver = (\n driver: ControlDriverInstance<'mongo', string>,\n ): ControlDriverInstance<'mongo', 'mongo'> => driver as ControlDriverInstance<'mongo', 'mongo'>;\n\n return {\n familyId: 'mongo' as const,\n\n validateContract(contractJson: unknown): Contract {\n // The deserialized class form (MongoTargetContract, owned by\n // target-mongo) and the framework Contract are structurally\n // compatible — same fields, just a class instance on the storage\n // envelope. The cast preserves the framework signature.\n return deserializeMongoContract(contractJson) as unknown as Contract;\n },\n\n async verify(options): Promise<VerifyDatabaseResult> {\n const { driver, contract: rawContract, expectedTargetId, contractPath, configPath } = options;\n const startTime = Date.now();\n\n const contract = asValidatedMongoContract(rawContract);\n\n const contractStorageHash = contract.storage.storageHash;\n const contractProfileHash = contract.profileHash;\n const contractTarget = contract.target;\n\n const baseOpts = {\n contractStorageHash,\n contractProfileHash,\n expectedTargetId,\n contractPath,\n ...ifDefined('configPath', configPath),\n };\n\n if (contractTarget !== expectedTargetId) {\n return buildVerifyResult({\n ...baseOpts,\n ok: false,\n code: VERIFY_CODE_TARGET_MISMATCH,\n summary: 'Target mismatch',\n actualTargetId: contractTarget,\n totalTime: Date.now() - startTime,\n });\n }\n\n const marker = await getControlAdapter().readMarker(asMongoDriver(driver), APP_SPACE_ID);\n\n if (!marker) {\n return buildVerifyResult({\n ...baseOpts,\n ok: false,\n code: VERIFY_CODE_MARKER_MISSING,\n summary: 'Marker missing',\n totalTime: Date.now() - startTime,\n });\n }\n\n if (marker.storageHash !== contractStorageHash) {\n return buildVerifyResult({\n ...baseOpts,\n ok: false,\n code: VERIFY_CODE_HASH_MISMATCH,\n summary: 'Hash mismatch',\n marker,\n totalTime: Date.now() - startTime,\n });\n }\n\n if (contractProfileHash && marker.profileHash !== contractProfileHash) {\n return buildVerifyResult({\n ...baseOpts,\n ok: false,\n code: VERIFY_CODE_HASH_MISMATCH,\n summary: 'Hash mismatch',\n marker,\n totalTime: Date.now() - startTime,\n });\n }\n\n return buildVerifyResult({\n ...baseOpts,\n ok: true,\n summary: 'Database matches contract',\n marker,\n totalTime: Date.now() - startTime,\n });\n },\n\n verifySchema(options: {\n readonly contract: unknown;\n readonly schema: MongoSchemaIR;\n readonly strict: boolean;\n readonly frameworkComponents: ReadonlyArray<TargetBoundComponentDescriptor<'mongo', string>>;\n }): VerifyDatabaseSchemaResult {\n const contract = asValidatedMongoContract(options.contract);\n return verifyMongoSchema({\n contract,\n schema: options.schema,\n strict: options.strict,\n frameworkComponents: options.frameworkComponents,\n });\n },\n\n async sign(options): Promise<SignDatabaseResult> {\n const { driver, contract: rawContract, contractPath, configPath } = options;\n const startTime = Date.now();\n\n const contract = asValidatedMongoContract(rawContract);\n\n const contractStorageHash = contract.storage.storageHash;\n const contractProfileHash = contract.profileHash;\n\n const controlAdapter = getControlAdapter();\n const mongoDriver = asMongoDriver(driver);\n\n const existingMarker = await controlAdapter.readMarker(mongoDriver, APP_SPACE_ID);\n\n let markerCreated = false;\n let markerUpdated = false;\n let previousHashes: { storageHash?: string; profileHash?: string } | undefined;\n\n if (!existingMarker) {\n await controlAdapter.initMarker(mongoDriver, APP_SPACE_ID, {\n storageHash: contractStorageHash,\n profileHash: contractProfileHash,\n });\n markerCreated = true;\n } else {\n const storageHashMatches = existingMarker.storageHash === contractStorageHash;\n const profileHashMatches = existingMarker.profileHash === contractProfileHash;\n\n if (!storageHashMatches || !profileHashMatches) {\n previousHashes = {\n storageHash: existingMarker.storageHash,\n profileHash: existingMarker.profileHash,\n };\n const updated = await controlAdapter.updateMarker(\n mongoDriver,\n APP_SPACE_ID,\n existingMarker.storageHash,\n {\n storageHash: contractStorageHash,\n profileHash: contractProfileHash,\n },\n );\n if (!updated) {\n throw new Error('CAS conflict: marker was modified by another process during sign');\n }\n markerUpdated = true;\n }\n }\n\n let summary: string;\n if (markerCreated) {\n summary = 'Database signed (marker created)';\n } else if (markerUpdated) {\n summary = `Database signed (marker updated from ${previousHashes?.storageHash ?? 'unknown'})`;\n } else {\n summary = 'Database already signed with this contract';\n }\n\n return {\n ok: true,\n summary,\n contract: {\n storageHash: contractStorageHash,\n profileHash: contractProfileHash,\n },\n target: {\n expected: contract.target,\n actual: contract.target,\n },\n marker: {\n created: markerCreated,\n updated: markerUpdated,\n ...ifDefined('previous', previousHashes),\n },\n meta: {\n contractPath,\n ...ifDefined('configPath', configPath),\n },\n timings: {\n total: Date.now() - startTime,\n },\n };\n },\n\n async readMarker(options): Promise<ContractMarkerRecord | null> {\n return getControlAdapter().readMarker(asMongoDriver(options.driver), options.space);\n },\n\n async readAllMarkers(options): Promise<ReadonlyMap<string, ContractMarkerRecord>> {\n return getControlAdapter().readAllMarkers(asMongoDriver(options.driver));\n },\n\n async introspect(options): Promise<MongoSchemaIR> {\n return getControlAdapter().introspectSchema(asMongoDriver(options.driver));\n },\n\n toSchemaView(schema: MongoSchemaIR): CoreSchemaView {\n return mongoSchemaToView(schema);\n },\n\n toOperationPreview(operations: readonly MigrationPlanOperation[]): OperationPreview {\n return mongoOperationsToPreview(operations);\n },\n };\n}\n","import type {\n ControlFamilyDescriptor,\n ControlStack,\n} from '@prisma-next/framework-components/control';\nimport { mongoEmission } from '@prisma-next/mongo-emitter';\nimport { createMongoFamilyInstance, type MongoControlFamilyInstance } from './control-instance';\n\nclass MongoFamilyDescriptor\n implements ControlFamilyDescriptor<'mongo', MongoControlFamilyInstance>\n{\n readonly kind = 'family' as const;\n readonly id = 'mongo';\n readonly familyId = 'mongo' as const;\n readonly version = '0.0.1';\n readonly emission = mongoEmission;\n\n create<TTargetId extends string>(\n stack: ControlStack<'mongo', TTargetId>,\n ): MongoControlFamilyInstance {\n return createMongoFamilyInstance(stack);\n }\n}\n\nexport const mongoFamilyDescriptor: ControlFamilyDescriptor<'mongo', MongoControlFamilyInstance> =\n new MongoFamilyDescriptor();\n"],"mappings":";;;;;;;AAcA,SAAS,cAAc,MAA4C;CAEjE,OAAO,KADS,KAAK,KAAK,MAAM,GAAG,KAAK,UAAU,EAAE,MAAM,CAAC,IAAI,KAAK,UAAU,EAAE,UAAU,GACvE,CAAC,KAAK,KAAK,CAAC;;AAGjC,SAAS,cAAc,KAA6C;CAClE,MAAM,QAAkB,EAAE;CAC1B,IAAI,IAAI,QAAQ,MAAM,KAAK,eAAe;CAC1C,IAAI,IAAI,QAAQ,MAAM,KAAK,eAAe;CAC1C,IAAI,IAAI,uBAAuB,KAAA,GAC7B,MAAM,KAAK,uBAAuB,IAAI,qBAAqB;CAC7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ClD,OAAO,kBAAkB,OAAO;;EAGlC,mBAAmB,YAAiE;GAClF,OAAO,yBAAyB,WAAW;;EAE9C;;;;ACnXH,IAAM,wBAAN,MAEA;CACE,OAAgB;CAChB,KAAc;CACd,WAAoB;CACpB,UAAmB;CACnB,WAAoB;CAEpB,OACE,OAC4B;EAC5B,OAAO,0BAA0B,MAAM;;;AAI3C,MAAa,wBACX,IAAI,uBAAuB"}
package/dist/ir.d.mts ADDED
@@ -0,0 +1,131 @@
1
+ import { ContractSerializer, SchemaIssue, SchemaVerifier, SchemaVerifyOptions, SchemaVerifyResult } from "@prisma-next/framework-components/control";
2
+ import { MongoContract, MongoStorage } from "@prisma-next/mongo-contract";
3
+ import { JsonObject } from "@prisma-next/utils/json";
4
+ import { Namespace } from "@prisma-next/framework-components/ir";
5
+
6
+ //#region src/core/ir/mongo-contract-serializer-base.d.ts
7
+ /**
8
+ * Mongo family `ContractSerializer` abstract base. Owns the family-shared
9
+ * deserialization pipeline:
10
+ *
11
+ * 1. Structural validation against the Mongo contract arktype schema
12
+ * (`MongoContractSchema`).
13
+ * 2. Framework-shared domain validation (`validateContractDomain`).
14
+ * 3. Family-shared storage validation (`validateMongoStorage`).
15
+ *
16
+ * The validated value is handed to the target via the
17
+ * `constructTargetContract` hook, which wraps the plain-JSON shape in
18
+ * the family-layer `MongoStorage` class instance (carrying the
19
+ * target-supplied `namespaces` map). Targets that need to add
20
+ * structural checks beyond the family default can override
21
+ * `parseMongoContractStructure`.
22
+ *
23
+ * Default `serializeContract` is identity over the contract — Mongo
24
+ * target classes carry JSON-clean fields by construction, so the value
25
+ * can be `JSON.stringify`'d directly. Targets that need on-the-way-out
26
+ * canonicalization override `serializeContract`.
27
+ */
28
+ declare abstract class MongoContractSerializerBase<TContract> implements ContractSerializer<TContract> {
29
+ deserializeContract(json: unknown): TContract;
30
+ serializeContract(contract: TContract): JsonObject;
31
+ /**
32
+ * Family-shared structural validation: parse against the Mongo
33
+ * contract arktype schema, then run framework-shared domain + Mongo
34
+ * family storage checks, then hydrate the validated tree into Mongo
35
+ * Contract IR class instances. Targets can override to add
36
+ * target-specific structural checks; most targets accept the family
37
+ * default.
38
+ *
39
+ * The returned `MongoContract` carries class instances under
40
+ * `storage.collections` (each value is a `MongoCollection`, with
41
+ * nested `MongoIndex` / `MongoValidator` / `MongoCollectionOptions`
42
+ * constructed by the `MongoCollection` constructor). The rest of the
43
+ * contract envelope (models, valueObjects, capabilities, …) remains
44
+ * in plain-JSON form; those IR layers are handled by sibling
45
+ * subsystems and don't sit behind this SPI.
46
+ */
47
+ protected parseMongoContractStructure(json: unknown): MongoContract;
48
+ /**
49
+ * Walk a structurally-validated Mongo contract and convert
50
+ * `storage.collections` entries from plain data into
51
+ * `MongoCollection` IR-class instances. Idempotent: already-class
52
+ * instances pass through unchanged.
53
+ */
54
+ protected hydrateMongoContract(contract: MongoContract): MongoContract;
55
+ /**
56
+ * Target-specific class construction from the validated structural
57
+ * data. The target wraps the contract envelope in the family-layer
58
+ * `MongoStorage` class instance, supplying the `namespaces` map
59
+ * (target concretions like `MongoTargetUnspecifiedDatabase`). The
60
+ * leaf collection / index shapes are already family-layer IR-class
61
+ * instances after the hydration walk above.
62
+ */
63
+ protected abstract constructTargetContract(validated: MongoContract): TContract;
64
+ }
65
+ //#endregion
66
+ //#region src/core/ir/mongo-contract-serializer.d.ts
67
+ /**
68
+ * Default Mongo family `ContractSerializer` concretion. Inherits the
69
+ * Mongo-shared deserialization pipeline (structural validation +
70
+ * collection-level hydration) and falls through `constructTargetContract`
71
+ * with the validated `MongoContract` shape. Family-level call sites
72
+ * (family-instance methods, family-layer tests that don't reach into
73
+ * a target descriptor) instantiate this directly; targets with their
74
+ * own storage concretion (`target-mongo`'s `MongoTargetContractSerializer`)
75
+ * override `constructTargetContract` to wrap the storage shape.
76
+ */
77
+ declare class MongoContractSerializer extends MongoContractSerializerBase<MongoContract> {
78
+ protected constructTargetContract(validated: MongoContract): MongoContract;
79
+ }
80
+ //#endregion
81
+ //#region src/core/ir/mongo-schema-verifier-base.d.ts
82
+ /**
83
+ * Mongo family `SchemaVerifier` abstract base. Commits the Mongo family
84
+ * to namespace-keyed verification: the family-shared walk iterates
85
+ * `storage.namespaces` in sorted order and dispatches per-namespace
86
+ * through the protected `verifyNamespace` hook, then aggregates
87
+ * target-extension issues from `verifyTargetExtensions`.
88
+ *
89
+ * Per-element diff work (collection / index / validator comparisons)
90
+ * lives on the target inside `verifyNamespace`. The family's structural
91
+ * commitment is "verification is namespaced"; the target's commitment is
92
+ * "verification of a given namespace's collections is the existing
93
+ * diff/canonicalize pipeline". The split keeps target-mongo's
94
+ * introspection-side helpers (`contractToMongoSchemaIR`,
95
+ * `canonicalizeSchemasForVerification`, `diffMongoSchemas`) in the target
96
+ * layer where they belong, while the family base owns the iteration
97
+ * scaffolding that makes namespaces a first-class verifier concept.
98
+ *
99
+ * Target-specific issue kinds (Atlas-only, future RLS-equivalents)
100
+ * surface through `verifyTargetExtensions`; that hook returns the empty
101
+ * list when no extensions exist over the Mongo family alphabet.
102
+ */
103
+ declare abstract class MongoSchemaVerifierBase<TContract extends {
104
+ readonly storage: MongoStorage;
105
+ }, TSchema> implements SchemaVerifier<TContract, TSchema> {
106
+ verifySchema(options: SchemaVerifyOptions<TContract, TSchema>): SchemaVerifyResult;
107
+ protected verifyCommonMongoSchema(options: SchemaVerifyOptions<TContract, TSchema>): readonly SchemaIssue[];
108
+ /**
109
+ * Per-namespace verification hook. Receives the namespace metadata plus
110
+ * the full contract + schema pair; the target's implementation owns the
111
+ * per-collection diff using its existing introspection-side helpers.
112
+ * Slice the schema by namespace at the call site (or compute the full
113
+ * diff once and dispatch per namespace) — the family base does not
114
+ * prescribe the per-namespace shape.
115
+ */
116
+ protected abstract verifyNamespace(options: {
117
+ readonly contract: TContract;
118
+ readonly schema: TSchema;
119
+ readonly namespaceId: string;
120
+ readonly namespace: Namespace;
121
+ }): readonly SchemaIssue[];
122
+ /**
123
+ * Target-specific extensions — Atlas-only kinds, target-only
124
+ * namespace-mismatch issues that don't fit the family-shared walk.
125
+ * Returns the empty list when the target ships no extensions.
126
+ */
127
+ protected abstract verifyTargetExtensions(options: SchemaVerifyOptions<TContract, TSchema>): readonly SchemaIssue[];
128
+ }
129
+ //#endregion
130
+ export { MongoContractSerializer, MongoContractSerializerBase, MongoSchemaVerifierBase };
131
+ //# sourceMappingURL=ir.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ir.d.mts","names":[],"sources":["../src/core/ir/mongo-contract-serializer-base.ts","../src/core/ir/mongo-contract-serializer.ts","../src/core/ir/mongo-schema-verifier-base.ts"],"mappings":";;;;;;;;;AAiCA;;;;;;;;;;;;;;;;;;uBAAsB,2BAAA,uBACT,kBAAA,CAAmB,SAAA;EAE9B,mBAAA,CAAoB,IAAA,YAAgB,SAAA;EAKpC,iBAAA,CAAkB,QAAA,EAAU,SAAA,GAAY,UAAA;EAAxC;;;;;;;;;;;;;;;;EAAA,UAuBU,2BAAA,CAA4B,IAAA,YAAgB,aAAA;;;;ACnDxD;;;YDqFY,oBAAA,CAAqB,QAAA,EAAU,aAAA,GAAgB,aAAA;ECpFZ;;;;;;;;EAAA,mBD4G1B,uBAAA,CAAwB,SAAA,EAAW,aAAA,GAAgB,SAAA;AAAA;;;;;;;AAzFxE;;;;;;cCpBa,uBAAA,SAAgC,2BAAA,CAA4B,aAAA;EAAA,UAC7D,uBAAA,CAAwB,SAAA,EAAW,aAAA,GAAgB,aAAA;AAAA;;;;;;ADmB/D;;;;;;;;;;;;;;;;;;uBEHsB,uBAAA;EAAA,SACS,OAAA,EAAS,YAAA;AAAA,uBAE3B,cAAA,CAAe,SAAA,EAAW,OAAA;EAErC,YAAA,CAAa,OAAA,EAAS,mBAAA,CAAoB,SAAA,EAAW,OAAA,IAAW,kBAAA;EAAA,UAOtD,uBAAA,CACR,OAAA,EAAS,mBAAA,CAAoB,SAAA,EAAW,OAAA,aAC9B,WAAA;EFHM;;;;;;;;EAAA,mBE8BC,eAAA,CAAgB,OAAA;IAAA,SACxB,QAAA,EAAU,SAAA;IAAA,SACV,MAAA,EAAQ,OAAA;IAAA,SACR,WAAA;IAAA,SACA,SAAA,EAAW,SAAA;EAAA,aACT,WAAA;EF8CkE;;;;AC7GjF;ED6GiF,mBEvC5D,sBAAA,CACjB,OAAA,EAAS,mBAAA,CAAoB,SAAA,EAAW,OAAA,aAC9B,WAAA;AAAA"}
package/dist/ir.mjs ADDED
@@ -0,0 +1,54 @@
1
+ import { n as MongoContractSerializerBase, t as MongoContractSerializer } from "./mongo-contract-serializer-Co3EaTVj.mjs";
2
+ //#region src/core/ir/mongo-schema-verifier-base.ts
3
+ /**
4
+ * Mongo family `SchemaVerifier` abstract base. Commits the Mongo family
5
+ * to namespace-keyed verification: the family-shared walk iterates
6
+ * `storage.namespaces` in sorted order and dispatches per-namespace
7
+ * through the protected `verifyNamespace` hook, then aggregates
8
+ * target-extension issues from `verifyTargetExtensions`.
9
+ *
10
+ * Per-element diff work (collection / index / validator comparisons)
11
+ * lives on the target inside `verifyNamespace`. The family's structural
12
+ * commitment is "verification is namespaced"; the target's commitment is
13
+ * "verification of a given namespace's collections is the existing
14
+ * diff/canonicalize pipeline". The split keeps target-mongo's
15
+ * introspection-side helpers (`contractToMongoSchemaIR`,
16
+ * `canonicalizeSchemasForVerification`, `diffMongoSchemas`) in the target
17
+ * layer where they belong, while the family base owns the iteration
18
+ * scaffolding that makes namespaces a first-class verifier concept.
19
+ *
20
+ * Target-specific issue kinds (Atlas-only, future RLS-equivalents)
21
+ * surface through `verifyTargetExtensions`; that hook returns the empty
22
+ * list when no extensions exist over the Mongo family alphabet.
23
+ */
24
+ var MongoSchemaVerifierBase = class {
25
+ verifySchema(options) {
26
+ const issues = [];
27
+ issues.push(...this.verifyCommonMongoSchema(options));
28
+ issues.push(...this.verifyTargetExtensions(options));
29
+ return {
30
+ ok: issues.length === 0,
31
+ issues
32
+ };
33
+ }
34
+ verifyCommonMongoSchema(options) {
35
+ const issues = [];
36
+ const { namespaces } = options.contract.storage;
37
+ const namespaceIds = Object.keys(namespaces).sort();
38
+ for (const namespaceId of namespaceIds) {
39
+ const namespace = namespaces[namespaceId];
40
+ if (!namespace) continue;
41
+ issues.push(...this.verifyNamespace({
42
+ contract: options.contract,
43
+ schema: options.schema,
44
+ namespaceId,
45
+ namespace
46
+ }));
47
+ }
48
+ return issues;
49
+ }
50
+ };
51
+ //#endregion
52
+ export { MongoContractSerializer, MongoContractSerializerBase, MongoSchemaVerifierBase };
53
+
54
+ //# sourceMappingURL=ir.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ir.mjs","names":[],"sources":["../src/core/ir/mongo-schema-verifier-base.ts"],"sourcesContent":["import type {\n SchemaIssue,\n SchemaVerifier,\n SchemaVerifyOptions,\n SchemaVerifyResult,\n} from '@prisma-next/framework-components/control';\nimport type { Namespace } from '@prisma-next/framework-components/ir';\nimport type { MongoStorage } from '@prisma-next/mongo-contract';\n\n/**\n * Mongo family `SchemaVerifier` abstract base. Commits the Mongo family\n * to namespace-keyed verification: the family-shared walk iterates\n * `storage.namespaces` in sorted order and dispatches per-namespace\n * through the protected `verifyNamespace` hook, then aggregates\n * target-extension issues from `verifyTargetExtensions`.\n *\n * Per-element diff work (collection / index / validator comparisons)\n * lives on the target inside `verifyNamespace`. The family's structural\n * commitment is \"verification is namespaced\"; the target's commitment is\n * \"verification of a given namespace's collections is the existing\n * diff/canonicalize pipeline\". The split keeps target-mongo's\n * introspection-side helpers (`contractToMongoSchemaIR`,\n * `canonicalizeSchemasForVerification`, `diffMongoSchemas`) in the target\n * layer where they belong, while the family base owns the iteration\n * scaffolding that makes namespaces a first-class verifier concept.\n *\n * Target-specific issue kinds (Atlas-only, future RLS-equivalents)\n * surface through `verifyTargetExtensions`; that hook returns the empty\n * list when no extensions exist over the Mongo family alphabet.\n */\nexport abstract class MongoSchemaVerifierBase<\n TContract extends { readonly storage: MongoStorage },\n TSchema,\n> implements SchemaVerifier<TContract, TSchema>\n{\n verifySchema(options: SchemaVerifyOptions<TContract, TSchema>): SchemaVerifyResult {\n const issues: SchemaIssue[] = [];\n issues.push(...this.verifyCommonMongoSchema(options));\n issues.push(...this.verifyTargetExtensions(options));\n return { ok: issues.length === 0, issues };\n }\n\n protected verifyCommonMongoSchema(\n options: SchemaVerifyOptions<TContract, TSchema>,\n ): readonly SchemaIssue[] {\n const issues: SchemaIssue[] = [];\n const { namespaces } = options.contract.storage;\n const namespaceIds = Object.keys(namespaces).sort();\n for (const namespaceId of namespaceIds) {\n const namespace = namespaces[namespaceId];\n if (!namespace) continue;\n issues.push(\n ...this.verifyNamespace({\n contract: options.contract,\n schema: options.schema,\n namespaceId,\n namespace,\n }),\n );\n }\n return issues;\n }\n\n /**\n * Per-namespace verification hook. Receives the namespace metadata plus\n * the full contract + schema pair; the target's implementation owns the\n * per-collection diff using its existing introspection-side helpers.\n * Slice the schema by namespace at the call site (or compute the full\n * diff once and dispatch per namespace) — the family base does not\n * prescribe the per-namespace shape.\n */\n protected abstract verifyNamespace(options: {\n readonly contract: TContract;\n readonly schema: TSchema;\n readonly namespaceId: string;\n readonly namespace: Namespace;\n }): readonly SchemaIssue[];\n\n /**\n * Target-specific extensions — Atlas-only kinds, target-only\n * namespace-mismatch issues that don't fit the family-shared walk.\n * Returns the empty list when the target ships no extensions.\n */\n protected abstract verifyTargetExtensions(\n options: SchemaVerifyOptions<TContract, TSchema>,\n ): readonly SchemaIssue[];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA8BA,IAAsB,0BAAtB,MAIA;CACE,aAAa,SAAsE;EACjF,MAAM,SAAwB,EAAE;EAChC,OAAO,KAAK,GAAG,KAAK,wBAAwB,QAAQ,CAAC;EACrD,OAAO,KAAK,GAAG,KAAK,uBAAuB,QAAQ,CAAC;EACpD,OAAO;GAAE,IAAI,OAAO,WAAW;GAAG;GAAQ;;CAG5C,wBACE,SACwB;EACxB,MAAM,SAAwB,EAAE;EAChC,MAAM,EAAE,eAAe,QAAQ,SAAS;EACxC,MAAM,eAAe,OAAO,KAAK,WAAW,CAAC,MAAM;EACnD,KAAK,MAAM,eAAe,cAAc;GACtC,MAAM,YAAY,WAAW;GAC7B,IAAI,CAAC,WAAW;GAChB,OAAO,KACL,GAAG,KAAK,gBAAgB;IACtB,UAAU,QAAQ;IAClB,QAAQ,QAAQ;IAChB;IACA;IACD,CAAC,CACH;;EAEH,OAAO"}
@@ -0,0 +1,98 @@
1
+ import { validateContractDomain } from "@prisma-next/contract/validate-domain";
2
+ import { MongoCollection, MongoContractSchema, validateMongoStorage } from "@prisma-next/mongo-contract";
3
+ import { type } from "arktype";
4
+ //#region src/core/ir/mongo-contract-serializer-base.ts
5
+ /**
6
+ * Mongo family `ContractSerializer` abstract base. Owns the family-shared
7
+ * deserialization pipeline:
8
+ *
9
+ * 1. Structural validation against the Mongo contract arktype schema
10
+ * (`MongoContractSchema`).
11
+ * 2. Framework-shared domain validation (`validateContractDomain`).
12
+ * 3. Family-shared storage validation (`validateMongoStorage`).
13
+ *
14
+ * The validated value is handed to the target via the
15
+ * `constructTargetContract` hook, which wraps the plain-JSON shape in
16
+ * the family-layer `MongoStorage` class instance (carrying the
17
+ * target-supplied `namespaces` map). Targets that need to add
18
+ * structural checks beyond the family default can override
19
+ * `parseMongoContractStructure`.
20
+ *
21
+ * Default `serializeContract` is identity over the contract — Mongo
22
+ * target classes carry JSON-clean fields by construction, so the value
23
+ * can be `JSON.stringify`'d directly. Targets that need on-the-way-out
24
+ * canonicalization override `serializeContract`.
25
+ */
26
+ var MongoContractSerializerBase = class {
27
+ deserializeContract(json) {
28
+ const validated = this.parseMongoContractStructure(json);
29
+ return this.constructTargetContract(validated);
30
+ }
31
+ serializeContract(contract) {
32
+ return contract;
33
+ }
34
+ /**
35
+ * Family-shared structural validation: parse against the Mongo
36
+ * contract arktype schema, then run framework-shared domain + Mongo
37
+ * family storage checks, then hydrate the validated tree into Mongo
38
+ * Contract IR class instances. Targets can override to add
39
+ * target-specific structural checks; most targets accept the family
40
+ * default.
41
+ *
42
+ * The returned `MongoContract` carries class instances under
43
+ * `storage.collections` (each value is a `MongoCollection`, with
44
+ * nested `MongoIndex` / `MongoValidator` / `MongoCollectionOptions`
45
+ * constructed by the `MongoCollection` constructor). The rest of the
46
+ * contract envelope (models, valueObjects, capabilities, …) remains
47
+ * in plain-JSON form; those IR layers are handled by sibling
48
+ * subsystems and don't sit behind this SPI.
49
+ */
50
+ parseMongoContractStructure(json) {
51
+ const parsed = MongoContractSchema(json);
52
+ if (parsed instanceof type.errors) throw new Error(`Contract structural validation failed: ${parsed.summary}`);
53
+ const validatedShape = parsed;
54
+ const hydratedContract = this.hydrateMongoContract(validatedShape);
55
+ validateContractDomain(hydratedContract);
56
+ validateMongoStorage(hydratedContract);
57
+ return hydratedContract;
58
+ }
59
+ /**
60
+ * Walk a structurally-validated Mongo contract and convert
61
+ * `storage.collections` entries from plain data into
62
+ * `MongoCollection` IR-class instances. Idempotent: already-class
63
+ * instances pass through unchanged.
64
+ */
65
+ hydrateMongoContract(contract) {
66
+ const rawCollections = contract.storage.collections;
67
+ const hydrated = {};
68
+ for (const [name, raw] of Object.entries(rawCollections)) hydrated[name] = raw instanceof MongoCollection ? raw : new MongoCollection(raw);
69
+ return {
70
+ ...contract,
71
+ storage: {
72
+ ...contract.storage,
73
+ collections: hydrated
74
+ }
75
+ };
76
+ }
77
+ };
78
+ //#endregion
79
+ //#region src/core/ir/mongo-contract-serializer.ts
80
+ /**
81
+ * Default Mongo family `ContractSerializer` concretion. Inherits the
82
+ * Mongo-shared deserialization pipeline (structural validation +
83
+ * collection-level hydration) and falls through `constructTargetContract`
84
+ * with the validated `MongoContract` shape. Family-level call sites
85
+ * (family-instance methods, family-layer tests that don't reach into
86
+ * a target descriptor) instantiate this directly; targets with their
87
+ * own storage concretion (`target-mongo`'s `MongoTargetContractSerializer`)
88
+ * override `constructTargetContract` to wrap the storage shape.
89
+ */
90
+ var MongoContractSerializer = class extends MongoContractSerializerBase {
91
+ constructTargetContract(validated) {
92
+ return validated;
93
+ }
94
+ };
95
+ //#endregion
96
+ export { MongoContractSerializerBase as n, MongoContractSerializer as t };
97
+
98
+ //# sourceMappingURL=mongo-contract-serializer-Co3EaTVj.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mongo-contract-serializer-Co3EaTVj.mjs","names":["arktypeType"],"sources":["../src/core/ir/mongo-contract-serializer-base.ts","../src/core/ir/mongo-contract-serializer.ts"],"sourcesContent":["import { validateContractDomain } from '@prisma-next/contract/validate-domain';\nimport type { ContractSerializer } from '@prisma-next/framework-components/control';\nimport {\n MongoCollection,\n type MongoCollectionInput,\n type MongoContract,\n MongoContractSchema,\n validateMongoStorage,\n} from '@prisma-next/mongo-contract';\nimport type { JsonObject } from '@prisma-next/utils/json';\nimport { type as arktypeType } from 'arktype';\n\n/**\n * Mongo family `ContractSerializer` abstract base. Owns the family-shared\n * deserialization pipeline:\n *\n * 1. Structural validation against the Mongo contract arktype schema\n * (`MongoContractSchema`).\n * 2. Framework-shared domain validation (`validateContractDomain`).\n * 3. Family-shared storage validation (`validateMongoStorage`).\n *\n * The validated value is handed to the target via the\n * `constructTargetContract` hook, which wraps the plain-JSON shape in\n * the family-layer `MongoStorage` class instance (carrying the\n * target-supplied `namespaces` map). Targets that need to add\n * structural checks beyond the family default can override\n * `parseMongoContractStructure`.\n *\n * Default `serializeContract` is identity over the contract — Mongo\n * target classes carry JSON-clean fields by construction, so the value\n * can be `JSON.stringify`'d directly. Targets that need on-the-way-out\n * canonicalization override `serializeContract`.\n */\nexport abstract class MongoContractSerializerBase<TContract>\n implements ContractSerializer<TContract>\n{\n deserializeContract(json: unknown): TContract {\n const validated = this.parseMongoContractStructure(json);\n return this.constructTargetContract(validated);\n }\n\n serializeContract(contract: TContract): JsonObject {\n // Mongo contract class fields are JSON-clean by construction; the\n // cast asserts that. Targets that need to canonicalize on the way\n // out override this method.\n return contract as unknown as JsonObject;\n }\n\n /**\n * Family-shared structural validation: parse against the Mongo\n * contract arktype schema, then run framework-shared domain + Mongo\n * family storage checks, then hydrate the validated tree into Mongo\n * Contract IR class instances. Targets can override to add\n * target-specific structural checks; most targets accept the family\n * default.\n *\n * The returned `MongoContract` carries class instances under\n * `storage.collections` (each value is a `MongoCollection`, with\n * nested `MongoIndex` / `MongoValidator` / `MongoCollectionOptions`\n * constructed by the `MongoCollection` constructor). The rest of the\n * contract envelope (models, valueObjects, capabilities, …) remains\n * in plain-JSON form; those IR layers are handled by sibling\n * subsystems and don't sit behind this SPI.\n */\n protected parseMongoContractStructure(json: unknown): MongoContract {\n const parsed = MongoContractSchema(json);\n if (parsed instanceof arktypeType.errors) {\n throw new Error(`Contract structural validation failed: ${parsed.summary}`);\n }\n\n // arktype's `infer`d type for `MongoContractSchema` is structurally\n // equivalent to `MongoContract` (both describe the same on-disk JSON\n // envelope) but not nominally so: the arktype DSL produces a type whose\n // optional/readonly profile, narrowed string-literal positions, and\n // utility-type wrappings (`Type.infer`, `Out`, …) differ from the\n // hand-authored `MongoContract<S, M>` generic surface. The schema and\n // the type are kept in lockstep by the round-trip fixtures under\n // `test/validate.test.ts`. The hydration walk below additionally\n // re-shapes `storage.collections` from plain data into IR-class\n // instances, so the `MongoContract` returned here carries class\n // identity under `storage.collections.*` (and transitively under\n // `indexes` / `validator` / `options`).\n const validatedShape = parsed as unknown as MongoContract;\n\n const hydratedContract = this.hydrateMongoContract(validatedShape);\n\n validateContractDomain(hydratedContract);\n validateMongoStorage(hydratedContract);\n\n return hydratedContract;\n }\n\n /**\n * Walk a structurally-validated Mongo contract and convert\n * `storage.collections` entries from plain data into\n * `MongoCollection` IR-class instances. Idempotent: already-class\n * instances pass through unchanged.\n */\n protected hydrateMongoContract(contract: MongoContract): MongoContract {\n const rawCollections = contract.storage.collections;\n const hydrated: Record<string, MongoCollection> = {};\n for (const [name, raw] of Object.entries(rawCollections)) {\n hydrated[name] =\n raw instanceof MongoCollection ? raw : new MongoCollection(raw as MongoCollectionInput);\n }\n return {\n ...contract,\n storage: {\n ...contract.storage,\n collections: hydrated,\n },\n };\n }\n\n /**\n * Target-specific class construction from the validated structural\n * data. The target wraps the contract envelope in the family-layer\n * `MongoStorage` class instance, supplying the `namespaces` map\n * (target concretions like `MongoTargetUnspecifiedDatabase`). The\n * leaf collection / index shapes are already family-layer IR-class\n * instances after the hydration walk above.\n */\n protected abstract constructTargetContract(validated: MongoContract): TContract;\n}\n","import type { MongoContract } from '@prisma-next/mongo-contract';\nimport { MongoContractSerializerBase } from './mongo-contract-serializer-base';\n\n/**\n * Default Mongo family `ContractSerializer` concretion. Inherits the\n * Mongo-shared deserialization pipeline (structural validation +\n * collection-level hydration) and falls through `constructTargetContract`\n * with the validated `MongoContract` shape. Family-level call sites\n * (family-instance methods, family-layer tests that don't reach into\n * a target descriptor) instantiate this directly; targets with their\n * own storage concretion (`target-mongo`'s `MongoTargetContractSerializer`)\n * override `constructTargetContract` to wrap the storage shape.\n */\nexport class MongoContractSerializer extends MongoContractSerializerBase<MongoContract> {\n protected constructTargetContract(validated: MongoContract): MongoContract {\n return validated;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,IAAsB,8BAAtB,MAEA;CACE,oBAAoB,MAA0B;EAC5C,MAAM,YAAY,KAAK,4BAA4B,KAAK;EACxD,OAAO,KAAK,wBAAwB,UAAU;;CAGhD,kBAAkB,UAAiC;EAIjD,OAAO;;;;;;;;;;;;;;;;;;CAmBT,4BAAsC,MAA8B;EAClE,MAAM,SAAS,oBAAoB,KAAK;EACxC,IAAI,kBAAkBA,KAAY,QAChC,MAAM,IAAI,MAAM,0CAA0C,OAAO,UAAU;EAe7E,MAAM,iBAAiB;EAEvB,MAAM,mBAAmB,KAAK,qBAAqB,eAAe;EAElE,uBAAuB,iBAAiB;EACxC,qBAAqB,iBAAiB;EAEtC,OAAO;;;;;;;;CAST,qBAA+B,UAAwC;EACrE,MAAM,iBAAiB,SAAS,QAAQ;EACxC,MAAM,WAA4C,EAAE;EACpD,KAAK,MAAM,CAAC,MAAM,QAAQ,OAAO,QAAQ,eAAe,EACtD,SAAS,QACP,eAAe,kBAAkB,MAAM,IAAI,gBAAgB,IAA4B;EAE3F,OAAO;GACL,GAAG;GACH,SAAS;IACP,GAAG,SAAS;IACZ,aAAa;IACd;GACF;;;;;;;;;;;;;;;AClGL,IAAa,0BAAb,cAA6C,4BAA2C;CACtF,wBAAkC,WAAyC;EACzE,OAAO"}
@@ -1,2 +1,22 @@
1
- import { VerifyMongoSchemaOptions, verifyMongoSchema } from "@prisma-next/target-mongo/schema-verify";
2
- export { type VerifyMongoSchemaOptions, verifyMongoSchema };
1
+ import { MongoSchemaIR } from "@prisma-next/mongo-schema-ir";
2
+ import { OperationContext, VerifyDatabaseSchemaResult } from "@prisma-next/framework-components/control";
3
+ import { MongoContract } from "@prisma-next/mongo-contract";
4
+ import { TargetBoundComponentDescriptor } from "@prisma-next/framework-components/components";
5
+
6
+ //#region src/core/schema-verify/verify-mongo-schema.d.ts
7
+ interface VerifyMongoSchemaOptions {
8
+ readonly contract: MongoContract;
9
+ readonly schema: MongoSchemaIR;
10
+ readonly strict: boolean;
11
+ readonly context?: OperationContext;
12
+ /**
13
+ * Active framework components participating in this composition. Mongo
14
+ * verification does not currently consult them, but the parameter exists
15
+ * for parity with `verifySqlSchema` so callers can pass the same envelope.
16
+ */
17
+ readonly frameworkComponents: ReadonlyArray<TargetBoundComponentDescriptor<'mongo', string>>;
18
+ }
19
+ declare function verifyMongoSchema(options: VerifyMongoSchemaOptions): VerifyDatabaseSchemaResult;
20
+ //#endregion
21
+ export { type VerifyMongoSchemaOptions, verifyMongoSchema };
22
+ //# sourceMappingURL=schema-verify.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-verify.d.mts","names":[],"sources":["../src/core/schema-verify/verify-mongo-schema.ts"],"mappings":";;;;;;UAaiB,wBAAA;EAAA,SACN,QAAA,EAAU,aAAA;EAAA,SACV,MAAA,EAAQ,aAAA;EAAA,SACR,MAAA;EAAA,SACA,OAAA,GAAU,gBAAA;EAHA;;;;;EAAA,SASV,mBAAA,EAAqB,aAAA,CAAc,8BAAA;AAAA;AAAA,iBAG9B,iBAAA,CAAkB,OAAA,EAAS,wBAAA,GAA2B,0BAAA"}
@@ -1,2 +1,2 @@
1
- import { verifyMongoSchema } from "@prisma-next/target-mongo/schema-verify";
1
+ import { t as verifyMongoSchema } from "./verify-mongo-schema-BL7t9YTB.mjs";
2
2
  export { verifyMongoSchema };