@prisma-next/family-sql 0.14.0-dev.43 → 0.14.0-dev.45

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.
@@ -1,12 +1,121 @@
1
- import { A as SqlPlannerResult, C as SqlMigrationRunnerResult, D as SqlPlannerConflictKind, E as SqlPlannerConflict, M as StorageTypePlanResult, N as SqlControlFamilyInstance, O as SqlPlannerConflictLocation, S as SqlMigrationRunnerFailure, T as SqlPlanTargetDetails, _ as SqlMigrationPlannerPlanOptions, a as FieldEvent, b as SqlMigrationRunnerExecuteCallbacks, c as SqlControlAdapterDescriptor, d as SqlMigrationPlan, f as SqlMigrationPlanContractInfo, g as SqlMigrationPlanner, h as SqlMigrationPlanOperationTarget, i as ExpandNativeTypeInput, j as SqlPlannerSuccessResult, k as SqlPlannerFailureResult, l as SqlControlExtensionDescriptor, m as SqlMigrationPlanOperationStep, n as CodecControlHooks, o as FieldEventContext, p as SqlMigrationPlanOperation, r as CreateSqlMigrationPlanOptions, s as ResolveIdentityValueInput, t as AnyRecord, u as SqlControlTargetDescriptor, v as SqlMigrationRunner, w as SqlMigrationRunnerSuccessValue, x as SqlMigrationRunnerExecuteOptions, y as SqlMigrationRunnerErrorCode } from "./types-CkOIJXxU.mjs";
1
+ import { r as SqlControlAdapter } from "./control-adapter-DHYFuOBy.mjs";
2
+ import { A as SqlPlannerSuccessResult, C as SqlMigrationRunnerSuccessValue, D as SqlPlannerConflictLocation, E as SqlPlannerConflictKind, O as SqlPlannerFailureResult, S as SqlMigrationRunnerResult, T as SqlPlannerConflict, _ as SqlMigrationRunner, a as FieldEvent, b as SqlMigrationRunnerExecuteOptions, c as SqlControlAdapterDescriptor, d as SqlMigrationPlanContractInfo, f as SqlMigrationPlanOperation, g as SqlMigrationPlannerPlanOptions, h as SqlMigrationPlanner, i as ExpandNativeTypeInput, j as StorageTypePlanResult, k as SqlPlannerResult, l as SqlControlExtensionDescriptor, m as SqlMigrationPlanOperationTarget, n as CodecControlHooks, o as FieldEventContext, p as SqlMigrationPlanOperationStep, r as CreateSqlMigrationPlanOptions, s as ResolveIdentityValueInput, t as AnyRecord, u as SqlMigrationPlan, v as SqlMigrationRunnerErrorCode, w as SqlPlanTargetDetails, x as SqlMigrationRunnerFailure, y as SqlMigrationRunnerExecuteCallbacks } from "./types-DBxrwN1d.mjs";
2
3
  import { ColumnDefault, Contract, ControlPolicy } from "@prisma-next/contract/types";
3
- import { ControlFamilyDescriptor, ControlStack, MigrationOperationClass, MigrationOperationPolicy, MigrationOperationPolicy as MigrationOperationPolicy$1, MigrationPlan, MigrationPlanOperation, MigrationPlanner, MigrationPlannerConflict, MigrationPlannerConflict as MigrationPlannerConflict$1, MigrationPlannerResult, MutationDefaultGeneratorDescriptor, OpFactoryCall, TargetMigrationsCapability, assembleAuthoringContributions } from "@prisma-next/framework-components/control";
4
- import { SqlStorage, StorageColumn } from "@prisma-next/sql-contract/types";
4
+ import { ContractSerializer, ControlFamilyDescriptor, ControlFamilyInstance, ControlStack, MigratableTargetDescriptor, MigrationOperationClass, MigrationOperationPolicy, MigrationOperationPolicy as MigrationOperationPolicy$1, MigrationPlan, MigrationPlanOperation, MigrationPlanOperation as MigrationPlanOperation$1, MigrationPlanner, MigrationPlannerConflict, MigrationPlannerConflict as MigrationPlannerConflict$1, MigrationPlannerResult, MutationDefaultGeneratorDescriptor, OpFactoryCall, OperationPreview, OperationPreviewCapable, PslContractInferCapable, SchemaDiffer, SchemaVerifier, SchemaViewCapable, SignDatabaseResult, TargetMigrationsCapability, VerifyDatabaseResult, VerifyDatabaseSchemaResult, assembleAuthoringContributions } from "@prisma-next/framework-components/control";
5
+ import { SqlControlDriverInstance, SqlStorage, StorageColumn } from "@prisma-next/sql-contract/types";
5
6
  import { NotOk, Ok } from "@prisma-next/utils/result";
6
- import { SqlSchemaIR } from "@prisma-next/sql-schema-ir/types";
7
+ import { AnyQueryAst, DdlNode, LowererContext, SqlExecuteRequest } from "@prisma-next/sql-relational-core/ast";
8
+ import { SqlSchemaIR, SqlSchemaIRNode } from "@prisma-next/sql-schema-ir/types";
7
9
  import { TargetBoundComponentDescriptor } from "@prisma-next/framework-components/components";
8
- import { EmissionSpi } from "@prisma-next/framework-components/emission";
10
+ import { EmissionSpi, TypesImportSpec } from "@prisma-next/framework-components/emission";
11
+ import { PslDocumentAst } from "@prisma-next/framework-components/psl-ast";
12
+ import { SqlOperationDescriptors } from "@prisma-next/sql-operations";
9
13
 
14
+ //#region src/core/control-instance.d.ts
15
+ interface SqlTypeMetadata {
16
+ readonly typeId: string;
17
+ readonly familyId: 'sql';
18
+ readonly targetId: string;
19
+ readonly nativeType?: string;
20
+ }
21
+ type SqlTypeMetadataRegistry = Map<string, SqlTypeMetadata>;
22
+ interface SqlFamilyInstanceState {
23
+ readonly codecTypeImports: ReadonlyArray<TypesImportSpec>;
24
+ readonly extensionIds: ReadonlyArray<string>;
25
+ readonly typeMetadataRegistry: SqlTypeMetadataRegistry;
26
+ }
27
+ interface SqlControlFamilyInstance extends ControlFamilyInstance<'sql', SqlSchemaIRNode>, SchemaViewCapable<SqlSchemaIRNode>, PslContractInferCapable<SqlSchemaIRNode>, OperationPreviewCapable, SqlFamilyInstanceState {
28
+ /**
29
+ * The family seam-of-record for on-disk contract reads. Structurally
30
+ * validates the JSON envelope, then hydrates IR-class instances via
31
+ * the per-target ContractSerializer. The single named entry point
32
+ * every CLI on-disk read crosses (TML-2536) — `as Contract` casts
33
+ * in production package sources are a serializer-bypass smell guarded
34
+ * by `pnpm lint:no-contract-cast`.
35
+ */
36
+ deserializeContract(contractJson: unknown): Contract;
37
+ verify(options: {
38
+ readonly driver: SqlControlDriverInstance<string>;
39
+ readonly contract: unknown;
40
+ readonly expectedTargetId: string;
41
+ readonly contractPath: string;
42
+ readonly configPath?: string;
43
+ }): Promise<VerifyDatabaseResult>;
44
+ /**
45
+ * Verify a contract against an already-introspected schema.
46
+ *
47
+ * Callers that need to verify against the live database compose
48
+ * `introspect({ driver })` + `verifySchema({ contract, schema, ... })`.
49
+ * The aggregate verifier hands in the full introspected schema and scopes
50
+ * the returned result to each member's contract space afterwards — so
51
+ * sibling-space tables never survive as `extras`.
52
+ */
53
+ verifySchema(options: {
54
+ readonly contract: unknown;
55
+ readonly schema: SqlSchemaIRNode;
56
+ readonly strict: boolean;
57
+ readonly frameworkComponents: ReadonlyArray<TargetBoundComponentDescriptor<'sql', string>>;
58
+ }): VerifyDatabaseSchemaResult;
59
+ sign(options: {
60
+ readonly driver: SqlControlDriverInstance<string>;
61
+ readonly contract: unknown;
62
+ readonly contractPath: string;
63
+ readonly configPath?: string;
64
+ }): Promise<SignDatabaseResult>;
65
+ introspect(options: {
66
+ readonly driver: SqlControlDriverInstance<string>;
67
+ readonly contract?: unknown;
68
+ }): Promise<SqlSchemaIRNode>;
69
+ inferPslContract(schemaIR: SqlSchemaIRNode): PslDocumentAst;
70
+ lowerAst(ast: AnyQueryAst | DdlNode, context: LowererContext<unknown>): Promise<SqlExecuteRequest>;
71
+ /**
72
+ * Inserts the initial marker row for `space` (upsert on `space`).
73
+ * Delegates to the target control adapter's write SPI; see
74
+ * `SqlControlAdapter.initMarker`.
75
+ */
76
+ initMarker(options: {
77
+ readonly driver: SqlControlDriverInstance<string>;
78
+ readonly space: string;
79
+ readonly destination: {
80
+ readonly storageHash: string;
81
+ readonly profileHash: string;
82
+ readonly invariants?: readonly string[];
83
+ };
84
+ }): Promise<void>;
85
+ /**
86
+ * Compare-and-swap advance of the marker row for `space`. Returns `true`
87
+ * when the swap matched a row; see `SqlControlAdapter.updateMarker`.
88
+ */
89
+ updateMarker(options: {
90
+ readonly driver: SqlControlDriverInstance<string>;
91
+ readonly space: string;
92
+ readonly expectedFrom: string;
93
+ readonly destination: {
94
+ readonly storageHash: string;
95
+ readonly profileHash: string;
96
+ readonly invariants?: readonly string[];
97
+ };
98
+ }): Promise<boolean>;
99
+ /**
100
+ * Appends a ledger entry for `space`; see
101
+ * `SqlControlAdapter.writeLedgerEntry`.
102
+ */
103
+ writeLedgerEntry(options: {
104
+ readonly driver: SqlControlDriverInstance<string>;
105
+ readonly space: string;
106
+ readonly entry: {
107
+ readonly edgeId: string;
108
+ readonly from: string;
109
+ readonly to: string;
110
+ readonly migrationName: string;
111
+ readonly migrationHash: string;
112
+ readonly operations: readonly unknown[];
113
+ };
114
+ }): Promise<void>;
115
+ bootstrapControlTableQueries(): readonly DdlNode[];
116
+ toOperationPreview(operations: readonly MigrationPlanOperation$1[]): OperationPreview;
117
+ }
118
+ //#endregion
10
119
  //#region src/core/control-descriptor.d.ts
11
120
  declare class SqlFamilyDescriptor implements ControlFamilyDescriptor<'sql', SqlControlFamilyInstance> {
12
121
  readonly kind: "family";
@@ -258,6 +367,99 @@ declare class SqlFamilyDescriptor implements ControlFamilyDescriptor<'sql', SqlC
258
367
  //#region src/core/assembly.d.ts
259
368
  declare function extractCodecControlHooks(descriptors: ReadonlyArray<TargetBoundComponentDescriptor<'sql', string>>): Map<string, CodecControlHooks>;
260
369
  //#endregion
370
+ //#region src/core/migrations/schema-differ.d.ts
371
+ /**
372
+ * Inputs to a SQL target's schema-differ (`diffDatabaseSchema` /
373
+ * `verifyDatabaseSchema` on the descriptor): the contract (the expected side
374
+ * derives from it), the introspected actual schema node, and the resolution
375
+ * context the relational diff needs.
376
+ */
377
+ interface DiffDatabaseSchemaInput {
378
+ readonly contract: Contract<SqlStorage>;
379
+ readonly schema: SqlSchemaIRNode;
380
+ readonly strict: boolean;
381
+ readonly typeMetadataRegistry: ReadonlyMap<string, {
382
+ readonly nativeType?: string;
383
+ }>;
384
+ readonly frameworkComponents: ReadonlyArray<TargetBoundComponentDescriptor<'sql', string>>;
385
+ }
386
+ /**
387
+ * The `SchemaDiffer` a SQL target implements: the black-box comparison of the
388
+ * contract's expected schema against the introspected actual schema, projected
389
+ * to the two issue lists. How it computes them is private to the target.
390
+ */
391
+ type SqlDiffDatabaseSchema = SchemaDiffer<DiffDatabaseSchemaInput>['diff'];
392
+ /**
393
+ * The same combined comparison as {@link SqlDiffDatabaseSchema}, wrapped in the
394
+ * verify envelope (`ok`/`summary`/`code`/`target`/`timings`) plus the
395
+ * pass/warn/fail tree the CLI renders. Verify calls this instead of the diff so
396
+ * the relational walk that produces the tree runs once per verify, not once for
397
+ * the diff and again for the tree.
398
+ */
399
+ type SqlVerifyDatabaseSchema = (input: DiffDatabaseSchemaInput) => VerifyDatabaseSchemaResult;
400
+ //#endregion
401
+ //#region src/core/control-target-descriptor.d.ts
402
+ /**
403
+ * One stack extension pack's already-assembled contract, paired with the
404
+ * `spaceId` its extension descriptor was registered under. `contract infer`
405
+ * needs both: the contract to know which elements the pack describes and to
406
+ * resolve the domain model a cross-space foreign key targets, the `spaceId`
407
+ * to qualify the emitted relation type (`<spaceId>:<namespace>.<Model>`).
408
+ * Neither the contract JSON nor the framework's `ContractSpace` wrapper
409
+ * self-declares its owning space id — it is only known from the extension
410
+ * descriptor that carries the `ContractSpace`.
411
+ */
412
+ interface SqlDescribedContractSpace {
413
+ readonly spaceId: string;
414
+ readonly contract: Contract<SqlStorage>;
415
+ }
416
+ interface SqlControlTargetDescriptor<TTargetId extends string, TTargetDetails, TContract extends Contract<SqlStorage> = Contract<SqlStorage>> extends MigratableTargetDescriptor<'sql', TTargetId, SqlControlFamilyInstance> {
417
+ readonly queryOperations?: () => SqlOperationDescriptors;
418
+ /**
419
+ * JSON ⇄ class boundary for the SQL target's contract. The descriptor
420
+ * composes a concrete `SqlContractSerializerBase` subclass; the rest
421
+ * of the control stack reaches `descriptor.contractSerializer` rather
422
+ * than importing a per-target deserialization function.
423
+ */
424
+ readonly contractSerializer: ContractSerializer<TContract>;
425
+ /**
426
+ * Per-target schema verifier walking the contract against
427
+ * `SqlSchemaIR`. The descriptor composes a concrete
428
+ * `SqlSchemaVerifierBase` subclass; the family-shared walk lives on
429
+ * the base, the target-specific dispatch on the subclass.
430
+ */
431
+ readonly schemaVerifier: SchemaVerifier<TContract, SqlSchemaIR>;
432
+ /**
433
+ * Database→PSL inference for `contract infer`. Target logic (owns the dialect
434
+ * maps), so it lives on the descriptor. Optional: targets without `contract
435
+ * infer` (Mongo) omit it, and the family instance throws when it is absent.
436
+ * `describedContracts` carries the stack's extension packs' already-assembled
437
+ * contracts (each paired with its `spaceId`) so the inferrer can omit elements
438
+ * they already describe, and can qualify a cross-space relation with the
439
+ * owning pack's space id.
440
+ */
441
+ readonly inferPslContract?: (schema: SqlSchemaIRNode, describedContracts?: readonly SqlDescribedContractSpace[]) => PslDocumentAst;
442
+ /**
443
+ * The single combined database-schema diff of two derived representations —
444
+ * the target's black-box comparison. Every SQL target provides it (Postgres
445
+ * returns relational + policy issues; SQLite returns relational only). It is
446
+ * schema logic on the target, not database I/O, so it lives here rather than
447
+ * on the control adapter. How it computes the two issue sets is private.
448
+ * See {@link SqlDiffDatabaseSchema} / {@link SqlVerifyDatabaseSchema}.
449
+ */
450
+ readonly diffDatabaseSchema: SqlDiffDatabaseSchema;
451
+ /**
452
+ * The same combined comparison as {@link diffDatabaseSchema}, wrapped in the
453
+ * verify envelope (`ok`/`summary`/`code`/`target`/`timings`) plus the
454
+ * pass/warn/fail tree the CLI renders. Verify calls this instead of
455
+ * `diffDatabaseSchema` so the relational walk that produces the tree runs
456
+ * once per verify, not once for the diff and again for the tree.
457
+ */
458
+ readonly verifyDatabaseSchema: SqlVerifyDatabaseSchema;
459
+ createPlanner(adapter: SqlControlAdapter<TTargetId>): SqlMigrationPlanner<TTargetDetails>;
460
+ createRunner(family: SqlControlFamilyInstance): SqlMigrationRunner<TTargetDetails>;
461
+ }
462
+ //#endregion
261
463
  //#region src/core/migrations/contract-to-schema-ir.d.ts
262
464
  /**
263
465
  * Target-specific callback that expands a column's base `nativeType` and optional
@@ -579,5 +781,5 @@ declare function temporalAuthoringPresets<const CodecId extends string, const Na
579
781
  //#region src/exports/control.d.ts
580
782
  declare const _default: SqlFamilyDescriptor;
581
783
  //#endregion
582
- export { type CodecControlHooks, type ContractToSchemaIROptions, type ControlPolicySubject, type CreateSqlMigrationPlanOptions, type DefaultRenderer, type EnumNamespaceSchemaResolver, type ExpandNativeTypeInput, type FieldEvent, type FieldEventContext, INIT_ADDITIVE_POLICY, type MigrationOperationClass, type MigrationOperationPolicy, type MigrationPlan, type MigrationPlanOperation, type MigrationPlanner, type MigrationPlannerConflict, type MigrationPlannerResult, type NativeTypeExpander, type PlanFieldEventOperationsOptions, type ResolveIdentityValueInput, type SqlControlAdapterDescriptor, type SqlControlExtensionDescriptor, type SqlControlFamilyInstance, type SqlControlTargetDescriptor, type SqlMigrationPlan, type SqlMigrationPlanContractInfo, type SqlMigrationPlanOperation, type SqlMigrationPlanOperationStep, type SqlMigrationPlanOperationTarget, type SqlMigrationPlanner, type SqlMigrationPlannerPlanOptions, type SqlMigrationRunner, type SqlMigrationRunnerErrorCode, type SqlMigrationRunnerExecuteCallbacks, type SqlMigrationRunnerExecuteOptions, type SqlMigrationRunnerFailure, type SqlMigrationRunnerResult, type SqlMigrationRunnerSuccessValue, type SqlPlanTargetDetails, type SqlPlannerConflict, type SqlPlannerConflictKind, type SqlPlannerConflictLocation, type SqlPlannerFailureResult, type SqlPlannerResult, type SqlPlannerSuccessResult, type StorageTypePlanResult, type TargetMigrationsCapability, assembleAuthoringContributions, contractNamespaceToSchemaIR, contractToSchemaIR, controlPolicyForCall, createMigrationPlan, _default as default, detectDestructiveChanges, extractCodecControlHooks, partitionCallsByControlPolicy, partitionIssuesByControlPolicy, planFieldEventOperations, plannerFailure, plannerSuccess, resolveValueSetValues, runnerFailure, runnerSuccess, temporalAuthoringPresets, timestampNowControlDescriptor };
784
+ export { type CodecControlHooks, type ContractToSchemaIROptions, type ControlPolicySubject, type CreateSqlMigrationPlanOptions, type DefaultRenderer, type EnumNamespaceSchemaResolver, type ExpandNativeTypeInput, type FieldEvent, type FieldEventContext, INIT_ADDITIVE_POLICY, type MigrationOperationClass, type MigrationOperationPolicy, type MigrationPlan, type MigrationPlanOperation, type MigrationPlanner, type MigrationPlannerConflict, type MigrationPlannerResult, type NativeTypeExpander, type PlanFieldEventOperationsOptions, type ResolveIdentityValueInput, type SqlControlAdapterDescriptor, type SqlControlExtensionDescriptor, type SqlControlFamilyInstance, type SqlControlTargetDescriptor, type SqlDescribedContractSpace, type SqlMigrationPlan, type SqlMigrationPlanContractInfo, type SqlMigrationPlanOperation, type SqlMigrationPlanOperationStep, type SqlMigrationPlanOperationTarget, type SqlMigrationPlanner, type SqlMigrationPlannerPlanOptions, type SqlMigrationRunner, type SqlMigrationRunnerErrorCode, type SqlMigrationRunnerExecuteCallbacks, type SqlMigrationRunnerExecuteOptions, type SqlMigrationRunnerFailure, type SqlMigrationRunnerResult, type SqlMigrationRunnerSuccessValue, type SqlPlanTargetDetails, type SqlPlannerConflict, type SqlPlannerConflictKind, type SqlPlannerConflictLocation, type SqlPlannerFailureResult, type SqlPlannerResult, type SqlPlannerSuccessResult, type StorageTypePlanResult, type TargetMigrationsCapability, assembleAuthoringContributions, contractNamespaceToSchemaIR, contractToSchemaIR, controlPolicyForCall, createMigrationPlan, _default as default, detectDestructiveChanges, extractCodecControlHooks, partitionCallsByControlPolicy, partitionIssuesByControlPolicy, planFieldEventOperations, plannerFailure, plannerSuccess, resolveValueSetValues, runnerFailure, runnerSuccess, temporalAuthoringPresets, timestampNowControlDescriptor };
583
785
  //# sourceMappingURL=control.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"control.d.mts","names":[],"sources":["../src/core/control-descriptor.ts","../src/core/assembly.ts","../src/core/migrations/contract-to-schema-ir.ts","../src/core/migrations/control-policy.ts","../src/core/migrations/field-event-planner.ts","../src/core/migrations/plan-helpers.ts","../src/core/migrations/policies.ts","../src/core/timestamp-now-generator.ts","../src/exports/control.ts"],"mappings":";;;;;;;;;;cAWa,mBAAA,YACA,uBAAA,QAA+B,wBAAA;EAAA,SAEjC,IAAA;EAAA,SACA,EAAA;EAAA,SACA,QAAA;EAAA,SACA,OAAA;EAAA,SACA,QAAA,EAAU,WAAA;EAAA,SACV,SAAA;IAAA;;;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ACd,OAAA,EAAS,+BAAA,YACC,aAAa;;;iBCgCT,mBAAA,iBACd,OAAA,EAAS,6BAAA,CAA8B,cAAA,IACtC,gBAAA,CAAiB,cAAA;AAAA,iBAcJ,cAAA,iBACd,IAAA,EAAM,gBAAA,CAAiB,cAAA,GACvB,QAAA,YAAoB,kBAAA,KACnB,uBAAA,CAAwB,cAAA;AAAA,iBAsBX,cAAA,CAAe,SAAA,WAAoB,kBAAA,KAAuB,uBAAuB;;;;iBAoBjF,aAAA,CAAc,KAAA;EAC5B,iBAAA;EACA,kBAAA;AAAA,IACE,EAAE,CAAC,8BAAA;;;;iBAYS,aAAA,CACd,IAAA,EAAM,2BAAA,EACN,OAAA,UACA,OAAA;EAAY,GAAA;EAAc,IAAA,GAAO,SAAA;AAAA,IAChC,KAAA,CAAM,yBAAA;;;;;;cC1KI,oBAAA,EAAsB,0BAEjC;;;;;;;;;;;;;;iBCoBc,6BAAA,IAAiC,kCAAkC;;;;;;;;;;;iBAqBnE,wBAAA,gEAGd,KAAA;EAAA,SAAkB,OAAA,EAAS,OAAA;EAAA,SAAkB,UAAA,EAAY,UAAA;AAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cC8BlB,QAAA"}
1
+ {"version":3,"file":"control.d.mts","names":[],"sources":["../src/core/control-instance.ts","../src/core/control-descriptor.ts","../src/core/assembly.ts","../src/core/migrations/schema-differ.ts","../src/core/control-target-descriptor.ts","../src/core/migrations/contract-to-schema-ir.ts","../src/core/migrations/control-policy.ts","../src/core/migrations/field-event-planner.ts","../src/core/migrations/plan-helpers.ts","../src/core/migrations/policies.ts","../src/core/timestamp-now-generator.ts","../src/exports/control.ts"],"mappings":";;;;;;;;;;;;;;UAqLU,eAAA;EAAA,SACC,MAAA;EAAA,SACA,QAAA;EAAA,SACA,QAAA;EAAA,SACA,UAAA;AAAA;AAAA,KAGN,uBAAA,GAA0B,GAAG,SAAS,eAAA;AAAA,UAEjC,sBAAA;EAAA,SACC,gBAAA,EAA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;iBU9JL,6BAAA,IAAiC,kCAAkC;;;;AViKzB;AAAA;;;;;;iBU5I1C,wBAAA,gEAGd,KAAA;EAAA,SAAkB,OAAA,EAAS,OAAA;EAAA,SAAkB,UAAA,EAAY,UAAA;AAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cCiClB,QAAA"}
package/dist/control.mjs CHANGED
@@ -210,6 +210,10 @@ function createSqlFamilyInstance(stack) {
210
210
  const getControlAdapter = () => controlAdapter ??= adapter.create(stack);
211
211
  const targetSerializer = target.contractSerializer;
212
212
  const targetInferPslContract = blindCast(target).inferPslContract;
213
+ const describedContracts = extensions.flatMap((extension) => extension.contractSpace ? [{
214
+ spaceId: extension.id,
215
+ contract: extension.contractSpace.contractJson
216
+ }] : []);
213
217
  const verifyDatabaseSchema = blindCast(target).verifyDatabaseSchema;
214
218
  if (!verifyDatabaseSchema) throw new Error(`SQL target "${target.targetId}" is missing the required verifyDatabaseSchema descriptor operation`);
215
219
  const deserializeWithTargetSerializer = (contractOrJson) => {
@@ -442,7 +446,7 @@ function createSqlFamilyInstance(stack) {
442
446
  },
443
447
  inferPslContract(schemaIR) {
444
448
  if (!targetInferPslContract) throw new Error(`Target "${target.targetId}" does not support contract infer (no inferPslContract on its descriptor).`);
445
- return targetInferPslContract(schemaIR);
449
+ return targetInferPslContract(schemaIR, describedContracts);
446
450
  },
447
451
  lowerAst(ast, context) {
448
452
  return getControlAdapter().lowerToExecuteRequest(ast, context);