@prisma-next/family-sql 0.12.0-dev.16 → 0.12.0-dev.18

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 (29) hide show
  1. package/dist/{control-adapter-BUxGX6zz.d.mts → control-adapter-8tV9WgWK.d.mts} +11 -2
  2. package/dist/control-adapter-8tV9WgWK.d.mts.map +1 -0
  3. package/dist/control-adapter.d.mts +1 -1
  4. package/dist/control.d.mts +31 -3
  5. package/dist/control.d.mts.map +1 -1
  6. package/dist/control.mjs +44 -2
  7. package/dist/control.mjs.map +1 -1
  8. package/dist/migration.d.mts +1 -1
  9. package/dist/schema-verify.d.mts +2 -1
  10. package/dist/schema-verify.d.mts.map +1 -1
  11. package/dist/schema-verify.mjs +1 -1
  12. package/dist/{types-UK6xRk8i.d.mts → types-BQiqw6kR.d.mts} +3 -3
  13. package/dist/{types-UK6xRk8i.d.mts.map → types-BQiqw6kR.d.mts.map} +1 -1
  14. package/dist/{verify-sql-schema-CYLsGCFO.mjs → verify-sql-schema-CXW_D9dW.mjs} +403 -310
  15. package/dist/verify-sql-schema-CXW_D9dW.mjs.map +1 -0
  16. package/dist/{verify-sql-schema-CN7pPoTC.d.mts → verify-sql-schema-Cj3c2t5Z.d.mts} +8 -2
  17. package/dist/verify-sql-schema-Cj3c2t5Z.d.mts.map +1 -0
  18. package/package.json +21 -21
  19. package/src/core/control-adapter.ts +15 -1
  20. package/src/core/control-instance.ts +1 -0
  21. package/src/core/migrations/control-policy.ts +89 -0
  22. package/src/core/schema-verify/control-verify-emit.ts +46 -0
  23. package/src/core/schema-verify/verifier-disposition.ts +53 -0
  24. package/src/core/schema-verify/verify-helpers.ts +151 -110
  25. package/src/core/schema-verify/verify-sql-schema.ts +291 -155
  26. package/src/exports/control.ts +2 -0
  27. package/dist/control-adapter-BUxGX6zz.d.mts.map +0 -1
  28. package/dist/verify-sql-schema-CN7pPoTC.d.mts.map +0 -1
  29. package/dist/verify-sql-schema-CYLsGCFO.mjs.map +0 -1
@@ -1,4 +1,4 @@
1
- import { n as NativeTypeNormalizer, t as DefaultNormalizer } from "./verify-sql-schema-CN7pPoTC.mjs";
1
+ import { n as DefaultNormalizer, r as NativeTypeNormalizer, t as ColumnsCompatible } from "./verify-sql-schema-Cj3c2t5Z.mjs";
2
2
  import { ControlAdapterInstance, ControlDriverInstance, ControlStack } from "@prisma-next/framework-components/control";
3
3
  import { PostgresEnumStorageEntry, SqlStorage } from "@prisma-next/sql-contract/types";
4
4
  import { Contract, ContractMarkerRecord, LedgerEntryRecord } from "@prisma-next/contract/types";
@@ -68,6 +68,15 @@ interface SqlControlAdapter<TTarget extends string = string> extends ControlAdap
68
68
  * before comparison with contract native types during schema verification.
69
69
  */
70
70
  readonly normalizeNativeType?: NativeTypeNormalizer;
71
+ /**
72
+ * Optional target-supplied compatible-shape relation for column native types.
73
+ * When provided, schema verification uses it under the `external` control
74
+ * policy to decide whether a declared column type is compatible with the
75
+ * live type (instead of exact equality). Threading the same relation the
76
+ * migration planner/runner use keeps runtime verify and migration verify in
77
+ * agreement; when omitted, verification falls back to exact equality.
78
+ */
79
+ readonly columnsCompatible?: ColumnsCompatible;
71
80
  /**
72
81
  * Optional bridging adapter for resolving the existing values of a
73
82
  * native enum type from the introspected schema IR. Targets supply
@@ -122,4 +131,4 @@ interface SqlControlAdapterDescriptor<TTarget extends string = string> {
122
131
  }
123
132
  //#endregion
124
133
  export { SqlControlAdapterDescriptor as n, SqlControlAdapter as t };
125
- //# sourceMappingURL=control-adapter-BUxGX6zz.d.mts.map
134
+ //# sourceMappingURL=control-adapter-8tV9WgWK.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"control-adapter-8tV9WgWK.d.mts","names":[],"sources":["../src/core/control-adapter.ts"],"mappings":";;;;;;;;;;AA8BA;;;;UAAiB,iBAAA,0CACP,sBAAA,QAA8B,OAAA;EAiB5B;;;;;;;;;;;;;;;EADV,UAAA,CACE,MAAA,EAAQ,qBAAA,QAA6B,OAAA,GACrC,KAAA,WACC,OAAA,CAAQ,oBAAA;EA8CiB;;;;;;;EArC5B,cAAA,CACE,MAAA,EAAQ,qBAAA,QAA6B,OAAA,IACpC,OAAA,CAAQ,WAAA,SAAoB,oBAAA;EA6EnB;;;;;EAtEZ,UAAA,CACE,MAAA,EAAQ,qBAAA,QAA6B,OAAA,GACrC,KAAA,WACC,OAAA,UAAiB,iBAAA;EA4FiD;;;;;;;;;;;;EA9ErE,UAAA,CACE,MAAA,EAAQ,qBAAA,QAA6B,OAAA,GACrC,QAAA,YACA,MAAA,YACC,OAAA,CAAQ,WAAA;EAvCA;;;;;EAAA,SA8CF,gBAAA,GAAmB,iBAAA;EAnCjB;;;;;EAAA,SA0CF,mBAAA,GAAsB,oBAAA;EAjC7B;;;;;;;;EAAA,SA2CO,iBAAA,GAAoB,iBAAA;EAxB1B;;;;;;;;EAAA,SAkCM,yBAAA,IACP,MAAA,EAAQ,WAAA,EACR,QAAA,EAAU,wBAAA,EACV,WAAA;EAFQ;;;;;;EAAA,SAUD,oCAAA,IACP,QAAA,EAAU,QAAA,CAAS,UAAA,OAEnB,MAAA,EAAQ,WAAA,EACR,QAAA,EAAU,wBAAA,EACV,WAAA;EAJmB;;;;EAWrB,4BAAA,aAAyC,OAAA;EARvC;;;;EAcF,0BAAA,aAAuC,OAAA;EAAA;;;;;;;;;EAWvC,KAAA,CAAM,GAAA,EAAK,WAAA,GAAc,OAAA,EAAS,OAAA,EAAS,cAAA,YAA0B,gBAAA;AAAA;;;;;;;UAStD,2BAAA;EAO+C;;;;;;EAA9D,MAAA,CAAO,KAAA,EAAO,YAAA,QAAoB,OAAA,IAAW,iBAAA,CAAkB,OAAA;AAAA"}
@@ -1,2 +1,2 @@
1
- import { n as SqlControlAdapterDescriptor, t as SqlControlAdapter } from "./control-adapter-BUxGX6zz.mjs";
1
+ import { n as SqlControlAdapterDescriptor, t as SqlControlAdapter } from "./control-adapter-8tV9WgWK.mjs";
2
2
  export { type SqlControlAdapter, type SqlControlAdapterDescriptor };
@@ -1,8 +1,8 @@
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-UK6xRk8i.mjs";
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-BQiqw6kR.mjs";
2
2
  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";
3
3
  import { SqlStorage, StorageColumn } from "@prisma-next/sql-contract/types";
4
+ import { ColumnDefault, Contract, ControlPolicy } from "@prisma-next/contract/types";
4
5
  import { NotOk, Ok } from "@prisma-next/utils/result";
5
- import { ColumnDefault, Contract } from "@prisma-next/contract/types";
6
6
  import { SqlSchemaIR } from "@prisma-next/sql-schema-ir/types";
7
7
  import { TargetBoundComponentDescriptor } from "@prisma-next/framework-components/components";
8
8
  import { EmissionSpi } from "@prisma-next/framework-components/emission";
@@ -325,6 +325,34 @@ interface ContractToSchemaIROptions {
325
325
  */
326
326
  declare function contractToSchemaIR(contract: Contract<SqlStorage> | null, options: ContractToSchemaIROptions): SqlSchemaIR;
327
327
  //#endregion
328
+ //#region src/core/migrations/control-policy.d.ts
329
+ /**
330
+ * The target object a control policy governs for a single planner call,
331
+ * resolved from the target's own IR. `undefined` means the call's target
332
+ * object could not be positively established — a fail-closed signal: any
333
+ * policy stricter than `managed` drops such a call rather than emitting it.
334
+ */
335
+ interface ControlPolicySubject {
336
+ readonly namespaceId: string;
337
+ readonly explicitNodeControlPolicy?: ControlPolicy;
338
+ readonly table?: string;
339
+ readonly column?: string;
340
+ readonly typeName?: string;
341
+ /**
342
+ * Whether the call creates a whole, previously-absent top-level storage
343
+ * object (e.g. a table or an enum/type), as opposed to modifying an
344
+ * existing object. This is the only thing `tolerated` permits: it is a
345
+ * create-if-absent policy, so an op that touches an existing object — add
346
+ * column, add index/constraint, alter, drop — is never allowed under it.
347
+ */
348
+ readonly createsNewObject: boolean;
349
+ }
350
+ declare function filterCallsByControlPolicy<TCall>(options: {
351
+ readonly calls: readonly TCall[];
352
+ readonly contract: Contract<SqlStorage>;
353
+ readonly resolveControlPolicySubject: (call: TCall) => ControlPolicySubject | undefined;
354
+ }): readonly TCall[];
355
+ //#endregion
328
356
  //#region src/core/migrations/field-event-planner.d.ts
329
357
  interface PlanFieldEventOperationsOptions {
330
358
  /**
@@ -434,5 +462,5 @@ declare function temporalAuthoringPresets<const CodecId extends string, const Na
434
462
  //#region src/exports/control.d.ts
435
463
  declare const _default: SqlFamilyDescriptor;
436
464
  //#endregion
437
- export { type CodecControlHooks, type ContractToSchemaIROptions, type CreateSqlMigrationPlanOptions, type DefaultRenderer, type EnumStorageKeyResolver, 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, contractToSchemaIR, createMigrationPlan, _default as default, detectDestructiveChanges, extractCodecControlHooks, planFieldEventOperations, plannerFailure, plannerSuccess, runnerFailure, runnerSuccess, temporalAuthoringPresets, timestampNowControlDescriptor };
465
+ export { type CodecControlHooks, type ContractToSchemaIROptions, type ControlPolicySubject, type CreateSqlMigrationPlanOptions, type DefaultRenderer, type EnumStorageKeyResolver, 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, contractToSchemaIR, createMigrationPlan, _default as default, detectDestructiveChanges, extractCodecControlHooks, filterCallsByControlPolicy, planFieldEventOperations, plannerFailure, plannerSuccess, runnerFailure, runnerSuccess, temporalAuthoringPresets, timestampNowControlDescriptor };
438
466
  //# 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/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":";;;;;;;;;;cAUa,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKT,MAAA,0BAAA,CACE,KAAA,EAAO,YAAA,QAAoB,SAAA,IAC1B,wBAAA;AAAA;;;iBCHW,wBAAA,CACd,WAAA,EAAa,aAAA,CAAc,8BAAA,mBAC1B,GAAA,SAAY,iBAAA;;;;;;;;;ADdf;;;;KE4BY,kBAAA,IAAsB,KAAA;EAAA,SACvB,UAAA;EAAA,SACA,OAAA;EAAA,SACA,UAAA,GAAa,MAAM;AAAA;;;;;;;;;;KAYlB,eAAA,IAAmB,GAAA,EAAK,aAAA,EAAe,MAAA,EAAQ,aAAa;;;;;;;;;;;;;;;KAgB5D,sBAAA,IACV,OAAA,EAAS,UAAU,EACnB,WAAA,UACA,UAAA;;;;;;;;;;iBAmKc,wBAAA,CACd,IAAA,EAAM,UAAA,SACN,EAAA,EAAI,UAAA,YACM,0BAAA;AAAA,UA8CK,yBAAA;EAAA,SACN,mBAAA;EAAA,SACA,gBAAA,GAAmB,kBAAA;EAAA,SACnB,aAAA,GAAgB,eAAA;;;;;;;;WAQhB,qBAAA,GAAwB,sBAAA;AAAA;;;;;;;;;;;;;;;iBAiBnB,kBAAA,CACd,QAAA,EAAU,QAAA,CAAS,UAAA,UACnB,OAAA,EAAS,yBAAA,GACR,WAAA;;;UC9Rc,+BAAA;EHZI;;;;EAAA,SGiBV,aAAA,EAAe,QAAA,CAAS,UAAA;;;;WAIxB,WAAA,EAAa,QAAA,CAAS,UAAA;;;;;;;;;;WAUtB,UAAA,EAAY,WAAA,SAAoB,iBAAA;AAAA;AAAA,iBAa3B,wBAAA,CACd,OAAA,EAAS,+BAAA,YACC,aAAa;;;iBCgCT,mBAAA,gBAAA,CACd,OAAA,EAAS,6BAAA,CAA8B,cAAA,IACtC,gBAAA,CAAiB,cAAA;AAAA,iBAcJ,cAAA,gBAAA,CACd,IAAA,EAAM,gBAAA,CAAiB,cAAA,IACtB,uBAAA,CAAwB,cAAA;AAAA,iBAOX,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;;;;;;cC1JI,oBAAA,EAAsB,0BAEjC;;;;;;;;;;;;;;iBCoBc,6BAAA,CAAA,GAAiC,kCAAkC;;;;;;;;;;;iBAqBnE,wBAAA,+DAAA,CAGd,KAAA;EAAA,SAAkB,OAAA,EAAS,OAAA;EAAA,SAAkB,UAAA,EAAY,UAAA;AAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cCsBlB,QAAA"}
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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,UAAA,EAAY,UAAA;AAAA;EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cCwBlB,QAAA"}
package/dist/control.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { n as sqlFamilyAuthoringFieldPresets, t as sqlFamilyAuthoringTypes } from "./authoring-type-constructors-F4JpCJl7.mjs";
2
2
  import { t as SqlContractSerializer } from "./sql-contract-serializer-8axtK4lg.mjs";
3
- import { a as extractCodecControlHooks, t as verifySqlSchema } from "./verify-sql-schema-CYLsGCFO.mjs";
3
+ import { a as extractCodecControlHooks, t as verifySqlSchema } from "./verify-sql-schema-CXW_D9dW.mjs";
4
4
  import { t as collectSupportedCodecTypeIds } from "./verify-Crewz6hG.mjs";
5
5
  import { n as temporalAuthoringPresets, r as timestampNowControlDescriptor } from "./timestamp-now-generator-BkjCQIde.mjs";
6
6
  import { sqlEmission } from "@prisma-next/sql-contract-emitter";
@@ -13,6 +13,7 @@ import { ifDefined } from "@prisma-next/utils/defined";
13
13
  import { UNBOUND_NAMESPACE_ID } from "@prisma-next/framework-components/ir";
14
14
  import { StorageTable, isPostgresEnumStorageEntry, isStorageTypeInstance, toStorageTypeInstance } from "@prisma-next/sql-contract/types";
15
15
  import { UNSPECIFIED_PSL_NAMESPACE_ID } from "@prisma-next/framework-components/psl-ast";
16
+ import { effectiveControlPolicy } from "@prisma-next/contract/types";
16
17
  import { notOk, ok } from "@prisma-next/utils/result";
17
18
  //#region src/core/operation-preview.ts
18
19
  function isDdlStatement(sqlStatement) {
@@ -1216,6 +1217,7 @@ function createSqlFamilyInstance(stack) {
1216
1217
  frameworkComponents: options.frameworkComponents,
1217
1218
  ...ifDefined("normalizeDefault", controlAdapter.normalizeDefault),
1218
1219
  ...ifDefined("normalizeNativeType", controlAdapter.normalizeNativeType),
1220
+ ...ifDefined("columnsCompatible", controlAdapter.columnsCompatible),
1219
1221
  ...ifDefined("resolveExistingEnumValues", resolveExistingEnumValues)
1220
1222
  });
1221
1223
  },
@@ -1622,6 +1624,46 @@ function deriveAnnotations(storage, annotationNamespace, resolveEnumStorageKey)
1622
1624
  return { [annotationNamespace]: { storageTypes } };
1623
1625
  }
1624
1626
  //#endregion
1627
+ //#region src/core/migrations/control-policy.ts
1628
+ /**
1629
+ * The control policy that governs a single call. The `external` default is an
1630
+ * un-overridable namespace floor: when the contract default is `external`, no
1631
+ * per-object `managed` override can escalate DDL above the floor, so the
1632
+ * policy is forced to `external` regardless of the node's own declaration.
1633
+ * Every other default defers to the node's effective control policy.
1634
+ */
1635
+ function controlPolicyForCall(subject, defaultControl) {
1636
+ if (defaultControl === "external") return "external";
1637
+ return effectiveControlPolicy(subject?.explicitNodeControlPolicy, defaultControl);
1638
+ }
1639
+ /**
1640
+ * Whether a call is allowed to emit under a given control policy.
1641
+ *
1642
+ * - `managed` — full lifecycle, every op allowed.
1643
+ * - `tolerated` — create-if-absent only: allowed iff the call creates a whole
1644
+ * new top-level object (and its subject was positively resolved). Anything
1645
+ * that modifies an existing object, and anything whose subject could not be
1646
+ * resolved, is suppressed.
1647
+ * - `external` / `observed` — no DDL at all.
1648
+ */
1649
+ function callAllowedUnderControlPolicy(policy, subject) {
1650
+ switch (policy) {
1651
+ case "managed": return true;
1652
+ case "tolerated": return subject?.createsNewObject === true;
1653
+ case "external":
1654
+ case "observed": return false;
1655
+ }
1656
+ }
1657
+ function filterCallsByControlPolicy(options) {
1658
+ const defaultControl = options.contract.defaultControl;
1659
+ const kept = [];
1660
+ for (const call of options.calls) {
1661
+ const subject = options.resolveControlPolicySubject(call);
1662
+ if (callAllowedUnderControlPolicy(controlPolicyForCall(subject, defaultControl), subject)) kept.push(call);
1663
+ }
1664
+ return Object.freeze(kept);
1665
+ }
1666
+ //#endregion
1625
1667
  //#region src/core/migrations/field-event-planner.ts
1626
1668
  function planFieldEventOperations(options) {
1627
1669
  const priorContract = options.priorContract;
@@ -1850,6 +1892,6 @@ const INIT_ADDITIVE_POLICY = Object.freeze({ allowedOperationClasses: Object.fre
1850
1892
  //#region src/exports/control.ts
1851
1893
  var control_default = new SqlFamilyDescriptor();
1852
1894
  //#endregion
1853
- export { INIT_ADDITIVE_POLICY, assembleAuthoringContributions, contractToSchemaIR, createMigrationPlan, control_default as default, detectDestructiveChanges, extractCodecControlHooks, planFieldEventOperations, plannerFailure, plannerSuccess, runnerFailure, runnerSuccess, temporalAuthoringPresets, timestampNowControlDescriptor };
1895
+ export { INIT_ADDITIVE_POLICY, assembleAuthoringContributions, contractToSchemaIR, createMigrationPlan, control_default as default, detectDestructiveChanges, extractCodecControlHooks, filterCallsByControlPolicy, planFieldEventOperations, plannerFailure, plannerSuccess, runnerFailure, runnerSuccess, temporalAuthoringPresets, timestampNowControlDescriptor };
1854
1896
 
1855
1897
  //# sourceMappingURL=control.mjs.map