@prisma-next/family-sql 0.12.0-dev.6 → 0.12.0-dev.61

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 (55) hide show
  1. package/dist/{authoring-type-constructors-F4JpCJl7.mjs → authoring-type-constructors-D4lQ-qpj.mjs} +1 -1
  2. package/dist/{authoring-type-constructors-F4JpCJl7.mjs.map → authoring-type-constructors-D4lQ-qpj.mjs.map} +1 -1
  3. package/dist/control-adapter-76pzcIFV.d.mts +172 -0
  4. package/dist/control-adapter-76pzcIFV.d.mts.map +1 -0
  5. package/dist/control-adapter.d.mts +2 -109
  6. package/dist/control.d.mts +118 -4
  7. package/dist/control.d.mts.map +1 -1
  8. package/dist/control.mjs +305 -44
  9. package/dist/control.mjs.map +1 -1
  10. package/dist/ir.d.mts +4 -5
  11. package/dist/ir.d.mts.map +1 -1
  12. package/dist/ir.mjs +1 -1
  13. package/dist/migration.d.mts +1 -1
  14. package/dist/migration.d.mts.map +1 -1
  15. package/dist/pack.mjs +1 -1
  16. package/dist/runtime.d.mts +4 -2
  17. package/dist/runtime.d.mts.map +1 -1
  18. package/dist/runtime.mjs +4 -2
  19. package/dist/runtime.mjs.map +1 -1
  20. package/dist/schema-verify.d.mts +2 -1
  21. package/dist/schema-verify.d.mts.map +1 -1
  22. package/dist/schema-verify.mjs +1 -1
  23. package/dist/{sql-contract-serializer-8axtK4lg.mjs → sql-contract-serializer-CY7qnms7.mjs} +18 -36
  24. package/dist/sql-contract-serializer-CY7qnms7.mjs.map +1 -0
  25. package/dist/{timestamp-now-generator-BkjCQIde.mjs → timestamp-now-generator-CloimujU.mjs} +1 -1
  26. package/dist/{timestamp-now-generator-BkjCQIde.mjs.map → timestamp-now-generator-CloimujU.mjs.map} +1 -1
  27. package/dist/{types-CeeCStqw.d.mts → types-CRpx_fk5.d.mts} +69 -15
  28. package/dist/types-CRpx_fk5.d.mts.map +1 -0
  29. package/dist/{verify-Crewz6hG.mjs → verify-C-G0obRm.mjs} +1 -1
  30. package/dist/{verify-Crewz6hG.mjs.map → verify-C-G0obRm.mjs.map} +1 -1
  31. package/dist/{verify-sql-schema-CN7pPoTC.d.mts → verify-sql-schema-DcMaT5Zj.d.mts} +1 -1
  32. package/dist/{verify-sql-schema-CN7pPoTC.d.mts.map → verify-sql-schema-DcMaT5Zj.d.mts.map} +1 -1
  33. package/dist/{verify-sql-schema-CYLsGCFO.mjs → verify-sql-schema-d3P9NA_8.mjs} +400 -317
  34. package/dist/verify-sql-schema-d3P9NA_8.mjs.map +1 -0
  35. package/dist/verify.mjs +1 -1
  36. package/package.json +23 -23
  37. package/src/core/control-adapter.ts +105 -7
  38. package/src/core/control-instance.ts +260 -66
  39. package/src/core/default-namespace.ts +9 -0
  40. package/src/core/ir/sql-contract-serializer-base.ts +72 -56
  41. package/src/core/migrations/contract-to-schema-ir.ts +13 -9
  42. package/src/core/migrations/control-policy.ts +322 -0
  43. package/src/core/migrations/field-event-planner.ts +2 -2
  44. package/src/core/migrations/plan-helpers.ts +16 -0
  45. package/src/core/migrations/types.ts +16 -6
  46. package/src/core/schema-verify/control-verify-emit.ts +46 -0
  47. package/src/core/schema-verify/verifier-disposition.ts +53 -0
  48. package/src/core/schema-verify/verify-helpers.ts +151 -110
  49. package/src/core/schema-verify/verify-sql-schema.ts +281 -178
  50. package/src/exports/control.ts +6 -0
  51. package/src/exports/runtime.ts +7 -0
  52. package/dist/control-adapter.d.mts.map +0 -1
  53. package/dist/sql-contract-serializer-8axtK4lg.mjs.map +0 -1
  54. package/dist/types-CeeCStqw.d.mts.map +0 -1
  55. package/dist/verify-sql-schema-CYLsGCFO.mjs.map +0 -1
@@ -189,4 +189,4 @@ const sqlFamilyAuthoringTypes = { sql: { String: {
189
189
  //#endregion
190
190
  export { sqlFamilyAuthoringFieldPresets as n, sqlFamilyAuthoringTypes as t };
191
191
 
192
- //# sourceMappingURL=authoring-type-constructors-F4JpCJl7.mjs.map
192
+ //# sourceMappingURL=authoring-type-constructors-D4lQ-qpj.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"authoring-type-constructors-F4JpCJl7.mjs","names":[],"sources":["../src/core/authoring-field-presets.ts","../src/core/authoring-type-constructors.ts"],"sourcesContent":["import type { AuthoringFieldNamespace } from '@prisma-next/framework-components/authoring';\n\n/**\n * Family-level SQL authoring field presets.\n *\n * Only presets whose codec IDs align with the ID generator metadata live here\n * (see `@prisma-next/ids`). These presets are target-agnostic because the\n * generator metadata fixes their codec/native-type to `sql/char@1`\n * (`character`) regardless of target, and the PSL interpreter lets the\n * generator override the scalar descriptor.\n *\n * Scalar presets that map to target-specific codecs (e.g. `text`, `int`,\n * `boolean`, `dateTime`) are contributed by the target pack (see\n * `postgresAuthoringFieldPresets` in `@prisma-next/target-postgres`) so the\n * TS callback surface and the PSL scalar surface lower to byte-identical\n * contracts for the active target.\n */\n\nconst CHARACTER_CODEC_ID = 'sql/char@1';\nconst CHARACTER_NATIVE_TYPE = 'character';\n\nconst nanoidOptionsArgument = {\n kind: 'object',\n optional: true,\n properties: {\n size: {\n kind: 'number',\n optional: true,\n integer: true,\n minimum: 2,\n maximum: 255,\n },\n },\n} as const;\n\nexport const sqlFamilyAuthoringFieldPresets = {\n uuid: {\n kind: 'fieldPreset',\n output: {\n codecId: CHARACTER_CODEC_ID,\n nativeType: CHARACTER_NATIVE_TYPE,\n typeParams: {\n length: 36,\n },\n },\n },\n ulid: {\n kind: 'fieldPreset',\n output: {\n codecId: CHARACTER_CODEC_ID,\n nativeType: CHARACTER_NATIVE_TYPE,\n typeParams: {\n length: 26,\n },\n },\n },\n nanoid: {\n kind: 'fieldPreset',\n args: [nanoidOptionsArgument],\n output: {\n codecId: CHARACTER_CODEC_ID,\n nativeType: CHARACTER_NATIVE_TYPE,\n typeParams: {\n length: {\n kind: 'arg',\n index: 0,\n path: ['size'],\n default: 21,\n },\n },\n },\n },\n cuid2: {\n kind: 'fieldPreset',\n output: {\n codecId: CHARACTER_CODEC_ID,\n nativeType: CHARACTER_NATIVE_TYPE,\n typeParams: {\n length: 24,\n },\n },\n },\n ksuid: {\n kind: 'fieldPreset',\n output: {\n codecId: CHARACTER_CODEC_ID,\n nativeType: CHARACTER_NATIVE_TYPE,\n typeParams: {\n length: 27,\n },\n },\n },\n id: {\n uuidv4: {\n kind: 'fieldPreset',\n output: {\n codecId: CHARACTER_CODEC_ID,\n nativeType: CHARACTER_NATIVE_TYPE,\n typeParams: {\n length: 36,\n },\n executionDefaults: {\n onCreate: {\n kind: 'generator',\n id: 'uuidv4',\n },\n },\n id: true,\n },\n },\n uuidv7: {\n kind: 'fieldPreset',\n output: {\n codecId: CHARACTER_CODEC_ID,\n nativeType: CHARACTER_NATIVE_TYPE,\n typeParams: {\n length: 36,\n },\n executionDefaults: {\n onCreate: {\n kind: 'generator',\n id: 'uuidv7',\n },\n },\n id: true,\n },\n },\n ulid: {\n kind: 'fieldPreset',\n output: {\n codecId: CHARACTER_CODEC_ID,\n nativeType: CHARACTER_NATIVE_TYPE,\n typeParams: {\n length: 26,\n },\n executionDefaults: {\n onCreate: {\n kind: 'generator',\n id: 'ulid',\n },\n },\n id: true,\n },\n },\n nanoid: {\n kind: 'fieldPreset',\n args: [nanoidOptionsArgument],\n output: {\n codecId: CHARACTER_CODEC_ID,\n nativeType: CHARACTER_NATIVE_TYPE,\n typeParams: {\n length: {\n kind: 'arg',\n index: 0,\n path: ['size'],\n default: 21,\n },\n },\n executionDefaults: {\n onCreate: {\n kind: 'generator',\n id: 'nanoid',\n params: {\n size: {\n kind: 'arg',\n index: 0,\n path: ['size'],\n },\n },\n },\n },\n id: true,\n },\n },\n cuid2: {\n kind: 'fieldPreset',\n output: {\n codecId: CHARACTER_CODEC_ID,\n nativeType: CHARACTER_NATIVE_TYPE,\n typeParams: {\n length: 24,\n },\n executionDefaults: {\n onCreate: {\n kind: 'generator',\n id: 'cuid2',\n },\n },\n id: true,\n },\n },\n ksuid: {\n kind: 'fieldPreset',\n output: {\n codecId: CHARACTER_CODEC_ID,\n nativeType: CHARACTER_NATIVE_TYPE,\n typeParams: {\n length: 27,\n },\n executionDefaults: {\n onCreate: {\n kind: 'generator',\n id: 'ksuid',\n },\n },\n id: true,\n },\n },\n },\n} as const satisfies AuthoringFieldNamespace;\n","import type { AuthoringTypeNamespace } from '@prisma-next/framework-components/authoring';\n\nexport const sqlFamilyAuthoringTypes = {\n sql: {\n String: {\n kind: 'typeConstructor',\n args: [{ kind: 'number', name: 'length', integer: true, minimum: 1, maximum: 10485760 }],\n output: {\n codecId: 'sql/varchar@1',\n nativeType: 'character varying',\n typeParams: {\n length: { kind: 'arg', index: 0 },\n },\n },\n },\n },\n} as const satisfies AuthoringTypeNamespace;\n"],"mappings":";;;;;;;;;;;;;;;;AAkBA,MAAM,qBAAqB;AAC3B,MAAM,wBAAwB;AAE9B,MAAM,wBAAwB;CAC5B,MAAM;CACN,UAAU;CACV,YAAY,EACV,MAAM;EACJ,MAAM;EACN,UAAU;EACV,SAAS;EACT,SAAS;EACT,SAAS;CACX,EACF;AACF;AAEA,MAAa,iCAAiC;CAC5C,MAAM;EACJ,MAAM;EACN,QAAQ;GACN,SAAS;GACT,YAAY;GACZ,YAAY,EACV,QAAQ,GACV;EACF;CACF;CACA,MAAM;EACJ,MAAM;EACN,QAAQ;GACN,SAAS;GACT,YAAY;GACZ,YAAY,EACV,QAAQ,GACV;EACF;CACF;CACA,QAAQ;EACN,MAAM;EACN,MAAM,CAAC,qBAAqB;EAC5B,QAAQ;GACN,SAAS;GACT,YAAY;GACZ,YAAY,EACV,QAAQ;IACN,MAAM;IACN,OAAO;IACP,MAAM,CAAC,MAAM;IACb,SAAS;GACX,EACF;EACF;CACF;CACA,OAAO;EACL,MAAM;EACN,QAAQ;GACN,SAAS;GACT,YAAY;GACZ,YAAY,EACV,QAAQ,GACV;EACF;CACF;CACA,OAAO;EACL,MAAM;EACN,QAAQ;GACN,SAAS;GACT,YAAY;GACZ,YAAY,EACV,QAAQ,GACV;EACF;CACF;CACA,IAAI;EACF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;EAAU,MAAM;EAAU,SAAS;EAAM,SAAS;EAAG,SAAS;CAAS,CAAC;CACvF,QAAQ;EACN,SAAS;EACT,YAAY;EACZ,YAAY,EACV,QAAQ;GAAE,MAAM;GAAO,OAAO;EAAE,EAClC;CACF;AACF,EACF,EACF"}
1
+ {"version":3,"file":"authoring-type-constructors-D4lQ-qpj.mjs","names":[],"sources":["../src/core/authoring-field-presets.ts","../src/core/authoring-type-constructors.ts"],"sourcesContent":["import type { AuthoringFieldNamespace } from '@prisma-next/framework-components/authoring';\n\n/**\n * Family-level SQL authoring field presets.\n *\n * Only presets whose codec IDs align with the ID generator metadata live here\n * (see `@prisma-next/ids`). These presets are target-agnostic because the\n * generator metadata fixes their codec/native-type to `sql/char@1`\n * (`character`) regardless of target, and the PSL interpreter lets the\n * generator override the scalar descriptor.\n *\n * Scalar presets that map to target-specific codecs (e.g. `text`, `int`,\n * `boolean`, `dateTime`) are contributed by the target pack (see\n * `postgresAuthoringFieldPresets` in `@prisma-next/target-postgres`) so the\n * TS callback surface and the PSL scalar surface lower to byte-identical\n * contracts for the active target.\n */\n\nconst CHARACTER_CODEC_ID = 'sql/char@1';\nconst CHARACTER_NATIVE_TYPE = 'character';\n\nconst nanoidOptionsArgument = {\n kind: 'object',\n optional: true,\n properties: {\n size: {\n kind: 'number',\n optional: true,\n integer: true,\n minimum: 2,\n maximum: 255,\n },\n },\n} as const;\n\nexport const sqlFamilyAuthoringFieldPresets = {\n uuid: {\n kind: 'fieldPreset',\n output: {\n codecId: CHARACTER_CODEC_ID,\n nativeType: CHARACTER_NATIVE_TYPE,\n typeParams: {\n length: 36,\n },\n },\n },\n ulid: {\n kind: 'fieldPreset',\n output: {\n codecId: CHARACTER_CODEC_ID,\n nativeType: CHARACTER_NATIVE_TYPE,\n typeParams: {\n length: 26,\n },\n },\n },\n nanoid: {\n kind: 'fieldPreset',\n args: [nanoidOptionsArgument],\n output: {\n codecId: CHARACTER_CODEC_ID,\n nativeType: CHARACTER_NATIVE_TYPE,\n typeParams: {\n length: {\n kind: 'arg',\n index: 0,\n path: ['size'],\n default: 21,\n },\n },\n },\n },\n cuid2: {\n kind: 'fieldPreset',\n output: {\n codecId: CHARACTER_CODEC_ID,\n nativeType: CHARACTER_NATIVE_TYPE,\n typeParams: {\n length: 24,\n },\n },\n },\n ksuid: {\n kind: 'fieldPreset',\n output: {\n codecId: CHARACTER_CODEC_ID,\n nativeType: CHARACTER_NATIVE_TYPE,\n typeParams: {\n length: 27,\n },\n },\n },\n id: {\n uuidv4: {\n kind: 'fieldPreset',\n output: {\n codecId: CHARACTER_CODEC_ID,\n nativeType: CHARACTER_NATIVE_TYPE,\n typeParams: {\n length: 36,\n },\n executionDefaults: {\n onCreate: {\n kind: 'generator',\n id: 'uuidv4',\n },\n },\n id: true,\n },\n },\n uuidv7: {\n kind: 'fieldPreset',\n output: {\n codecId: CHARACTER_CODEC_ID,\n nativeType: CHARACTER_NATIVE_TYPE,\n typeParams: {\n length: 36,\n },\n executionDefaults: {\n onCreate: {\n kind: 'generator',\n id: 'uuidv7',\n },\n },\n id: true,\n },\n },\n ulid: {\n kind: 'fieldPreset',\n output: {\n codecId: CHARACTER_CODEC_ID,\n nativeType: CHARACTER_NATIVE_TYPE,\n typeParams: {\n length: 26,\n },\n executionDefaults: {\n onCreate: {\n kind: 'generator',\n id: 'ulid',\n },\n },\n id: true,\n },\n },\n nanoid: {\n kind: 'fieldPreset',\n args: [nanoidOptionsArgument],\n output: {\n codecId: CHARACTER_CODEC_ID,\n nativeType: CHARACTER_NATIVE_TYPE,\n typeParams: {\n length: {\n kind: 'arg',\n index: 0,\n path: ['size'],\n default: 21,\n },\n },\n executionDefaults: {\n onCreate: {\n kind: 'generator',\n id: 'nanoid',\n params: {\n size: {\n kind: 'arg',\n index: 0,\n path: ['size'],\n },\n },\n },\n },\n id: true,\n },\n },\n cuid2: {\n kind: 'fieldPreset',\n output: {\n codecId: CHARACTER_CODEC_ID,\n nativeType: CHARACTER_NATIVE_TYPE,\n typeParams: {\n length: 24,\n },\n executionDefaults: {\n onCreate: {\n kind: 'generator',\n id: 'cuid2',\n },\n },\n id: true,\n },\n },\n ksuid: {\n kind: 'fieldPreset',\n output: {\n codecId: CHARACTER_CODEC_ID,\n nativeType: CHARACTER_NATIVE_TYPE,\n typeParams: {\n length: 27,\n },\n executionDefaults: {\n onCreate: {\n kind: 'generator',\n id: 'ksuid',\n },\n },\n id: true,\n },\n },\n },\n} as const satisfies AuthoringFieldNamespace;\n","import type { AuthoringTypeNamespace } from '@prisma-next/framework-components/authoring';\n\nexport const sqlFamilyAuthoringTypes = {\n sql: {\n String: {\n kind: 'typeConstructor',\n args: [{ kind: 'number', name: 'length', integer: true, minimum: 1, maximum: 10485760 }],\n output: {\n codecId: 'sql/varchar@1',\n nativeType: 'character varying',\n typeParams: {\n length: { kind: 'arg', index: 0 },\n },\n },\n },\n },\n} as const satisfies AuthoringTypeNamespace;\n"],"mappings":";;;;;;;;;;;;;;;;AAkBA,MAAM,qBAAqB;AAC3B,MAAM,wBAAwB;AAE9B,MAAM,wBAAwB;CAC5B,MAAM;CACN,UAAU;CACV,YAAY,EACV,MAAM;EACJ,MAAM;EACN,UAAU;EACV,SAAS;EACT,SAAS;EACT,SAAS;CACX,EACF;AACF;AAEA,MAAa,iCAAiC;CAC5C,MAAM;EACJ,MAAM;EACN,QAAQ;GACN,SAAS;GACT,YAAY;GACZ,YAAY,EACV,QAAQ,GACV;EACF;CACF;CACA,MAAM;EACJ,MAAM;EACN,QAAQ;GACN,SAAS;GACT,YAAY;GACZ,YAAY,EACV,QAAQ,GACV;EACF;CACF;CACA,QAAQ;EACN,MAAM;EACN,MAAM,CAAC,qBAAqB;EAC5B,QAAQ;GACN,SAAS;GACT,YAAY;GACZ,YAAY,EACV,QAAQ;IACN,MAAM;IACN,OAAO;IACP,MAAM,CAAC,MAAM;IACb,SAAS;GACX,EACF;EACF;CACF;CACA,OAAO;EACL,MAAM;EACN,QAAQ;GACN,SAAS;GACT,YAAY;GACZ,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AM;KACN,IAAI;IACN,EACF;IACA,IAAI;GACN;EACF;CACF;AACF;;;AC/MA,MAAa,0BAA0B,EACrC,KAAK,EACH,QAAQ;CACN,MAAM;CACN,MAAM,CAAC;EAAE,MAAM;EAAU,MAAM;EAAU,SAAS;EAAM,SAAS;EAAG,SAAS;CAAS,CAAC;CACvF,QAAQ;EACN,SAAS;EACT,YAAY;EACZ,YAAY,EACV,QAAQ;GAAE,MAAM;GAAO,OAAO;EAAE,EAClC;CACF;AACF,EACF,EACF"}
@@ -0,0 +1,172 @@
1
+ import { n as NativeTypeNormalizer, t as DefaultNormalizer } from "./verify-sql-schema-DcMaT5Zj.mjs";
2
+ import { ControlAdapterInstance, ControlStack } from "@prisma-next/framework-components/control";
3
+ import { PostgresEnumStorageEntry, SqlControlDriverInstance, SqlStorage } from "@prisma-next/sql-contract/types";
4
+ import { Contract, ContractMarkerRecord, LedgerEntryRecord } from "@prisma-next/contract/types";
5
+ import { AnyQueryAst, DdlNode, LoweredStatement, LowererContext } from "@prisma-next/sql-relational-core/ast";
6
+ import { SqlSchemaIR } from "@prisma-next/sql-schema-ir/types";
7
+
8
+ //#region src/core/control-adapter.d.ts
9
+ /**
10
+ * SQL control adapter interface for control-plane operations.
11
+ * Implemented by target-specific adapters (e.g., Postgres, MySQL).
12
+ *
13
+ * @template TTarget - The target ID (e.g., 'postgres', 'mysql')
14
+ */
15
+ interface SqlControlAdapter<TTarget extends string = string> extends ControlAdapterInstance<'sql', TTarget> {
16
+ /**
17
+ * Reads the contract marker for `space` from the database, returning
18
+ * `null` if no marker row exists for that space (or if the marker
19
+ * table itself is missing). Implementations are responsible for the
20
+ * dialect-specific existence probe (e.g. Postgres
21
+ * `information_schema.tables` vs SQLite `sqlite_master`) and parameter
22
+ * placeholders.
23
+ *
24
+ * `space` is required so callers cannot accidentally fall through to
25
+ * the app's marker row when reading per-extension markers.
26
+ *
27
+ * @param driver - ControlDriverInstance for executing queries (target-specific)
28
+ * @param space - Contract space id whose marker row to read (e.g. `'app'`)
29
+ * @returns Resolved marker record, or `null` if not yet stamped.
30
+ */
31
+ readMarker(driver: SqlControlDriverInstance<TTarget>, space: string): Promise<ContractMarkerRecord | null>;
32
+ /**
33
+ * Reads every marker row from `prisma_contract.marker` (one per
34
+ * contract space) and returns them keyed by `space`. Used by the
35
+ * per-space verifier to detect marker-vs-on-disk drift and orphan
36
+ * marker rows. Returns an empty map when the marker table does not
37
+ * yet exist (fresh database / never-signed project).
38
+ */
39
+ readAllMarkers(driver: SqlControlDriverInstance<TTarget>): Promise<ReadonlyMap<string, ContractMarkerRecord>>;
40
+ /**
41
+ * Reads the per-migration ledger journal in apply order. When `space` is
42
+ * omitted, returns rows for every space.
43
+ */
44
+ readLedger(driver: SqlControlDriverInstance<TTarget>, space?: string): Promise<readonly LedgerEntryRecord[]>;
45
+ /**
46
+ * Inserts the initial marker row for `space` (`INSERT` only). Fails when a
47
+ * row for that space already exists. Used by `sign()` so concurrent first-time
48
+ * stamps cannot silently overwrite each other. `updated_at` is DB-side
49
+ * (`now()` / `datetime('now')`). Mirrors `MongoControlAdapter.initMarker`.
50
+ */
51
+ insertMarker(driver: SqlControlDriverInstance<TTarget>, space: string, destination: {
52
+ readonly storageHash: string;
53
+ readonly profileHash: string;
54
+ readonly invariants?: readonly string[];
55
+ }): Promise<void>;
56
+ /**
57
+ * Writes the initial marker row for `space` as an upsert (`INSERT … ON
58
+ * CONFLICT (space) DO UPDATE SET …`), so re-stamping a space overwrites the
59
+ * existing row rather than failing. `updated_at` is stamped with a DB-side
60
+ * time expression (`now()` / `datetime('now')`), never an app-side clock.
61
+ */
62
+ initMarker(driver: SqlControlDriverInstance<TTarget>, space: string, destination: {
63
+ readonly storageHash: string;
64
+ readonly profileHash: string;
65
+ readonly invariants?: readonly string[];
66
+ }): Promise<void>;
67
+ /**
68
+ * Atomically advances the marker row for `space` (compare-and-swap on
69
+ * `core_hash = expectedFrom`). Returns `true` when the swap matched a row,
70
+ * `false` when another process advanced the marker first. `destination.invariants`
71
+ * is written verbatim when supplied (the union/dedupe policy lives upstream)
72
+ * and left untouched when omitted. Mirrors `MongoControlAdapter.updateMarker`.
73
+ */
74
+ updateMarker(driver: SqlControlDriverInstance<TTarget>, space: string, expectedFrom: string, destination: {
75
+ readonly storageHash: string;
76
+ readonly profileHash: string;
77
+ readonly invariants?: readonly string[];
78
+ }): Promise<boolean>;
79
+ /**
80
+ * Appends a ledger entry for `space`. Mirrors `MongoControlAdapter.writeLedgerEntry`.
81
+ * The SQL ledger table keys rows by an autoincrement id and partitions reads
82
+ * by `space`, so `entry.edgeId` carries no dedicated column; `from` / `to`
83
+ * land in `origin_core_hash` / `destination_core_hash`.
84
+ */
85
+ writeLedgerEntry(driver: SqlControlDriverInstance<TTarget>, space: string, entry: {
86
+ readonly edgeId: string;
87
+ readonly from: string;
88
+ readonly to: string;
89
+ readonly migrationName: string;
90
+ readonly migrationHash: string;
91
+ readonly operations: readonly unknown[];
92
+ }): Promise<void>;
93
+ /**
94
+ * Introspects a database schema and returns a raw SqlSchemaIR.
95
+ *
96
+ * This is a pure schema discovery operation that queries the database catalog
97
+ * and returns the schema structure without type mapping or contract enrichment.
98
+ * Type mapping and enrichment are handled separately by enrichment helpers.
99
+ *
100
+ * @param driver - ControlDriverInstance instance for executing queries (target-specific)
101
+ * @param contract - Optional contract for contract-guided introspection (filtering, optimization)
102
+ * @param schema - Schema name to introspect (defaults to 'public')
103
+ * @returns Promise resolving to SqlSchemaIR representing the live database schema
104
+ */
105
+ introspect(driver: SqlControlDriverInstance<TTarget>, contract?: unknown, schema?: string): Promise<SqlSchemaIR>;
106
+ /**
107
+ * Optional target-specific normalizer for raw database default expressions.
108
+ * When provided, schema defaults (raw strings) are normalized before comparison
109
+ * with contract defaults (ColumnDefault objects) during schema verification.
110
+ */
111
+ readonly normalizeDefault?: DefaultNormalizer;
112
+ /**
113
+ * Optional target-specific normalizer for schema native type names.
114
+ * When provided, schema native types (from introspection) are normalized
115
+ * before comparison with contract native types during schema verification.
116
+ */
117
+ readonly normalizeNativeType?: NativeTypeNormalizer;
118
+ /**
119
+ * Optional bridging adapter for resolving the existing values of a
120
+ * native enum type from the introspected schema IR. Targets supply
121
+ * this so the family-level schema verifier can walk
122
+ * `PostgresEnumStorageEntry` entries natively without needing to
123
+ * know the target-specific `schema.annotations` shape
124
+ * (e.g. `schema.annotations.pg.storageTypes`).
125
+ */
126
+ readonly resolveExistingEnumValues?: (schema: SqlSchemaIR, enumType: PostgresEnumStorageEntry, namespaceId: string) => readonly string[] | null;
127
+ /**
128
+ * Optional contract-scoped factory for {@link resolveExistingEnumValues}.
129
+ * Targets that need the contract storage to resolve namespace → DDL schema
130
+ * supply this; the family control instance prefers it over the bare adapter
131
+ * hook when present.
132
+ */
133
+ readonly resolveExistingEnumValuesForContract?: (contract: Contract<SqlStorage>) => (schema: SqlSchemaIR, enumType: PostgresEnumStorageEntry, namespaceId: string) => readonly string[] | null;
134
+ /**
135
+ * Ordered DDL queries that bootstrap marker/ledger control tables for migration
136
+ * runners. Postgres includes `CREATE SCHEMA`; SQLite does not.
137
+ */
138
+ bootstrapControlTableQueries(): readonly DdlNode[];
139
+ /**
140
+ * Ordered DDL queries that bootstrap the marker table (and Postgres schema) for
141
+ * `sign` — excludes the ledger table.
142
+ */
143
+ bootstrapSignMarkerQueries(): readonly DdlNode[];
144
+ /**
145
+ * Lower a SQL query AST into a target-flavored `{ sql, params }` payload.
146
+ *
147
+ * Migration tooling (e.g. the `dataTransform` operation) needs to materialize
148
+ * SQL at emit/plan time without instantiating the runtime adapter. The control
149
+ * adapter's `lower` is byte-equivalent to the runtime adapter's `lower` for the
150
+ * same AST and contract, ensuring planned SQL matches what the runtime would
151
+ * emit.
152
+ */
153
+ lower(ast: AnyQueryAst | DdlNode, context: LowererContext<unknown>): LoweredStatement;
154
+ }
155
+ /**
156
+ * SQL control adapter descriptor interface.
157
+ * Provides a factory method to create control adapter instances.
158
+ *
159
+ * @template TTarget - The target ID (e.g., 'postgres', 'mysql')
160
+ */
161
+ interface SqlControlAdapterDescriptor<TTarget extends string = string> {
162
+ /**
163
+ * Creates a SQL control adapter instance for control-plane operations.
164
+ *
165
+ * Receives the assembled `ControlStack` so adapters can read aggregated
166
+ * metadata (codec lookup, extension contributions) when materializing.
167
+ */
168
+ create(stack: ControlStack<'sql', TTarget>): SqlControlAdapter<TTarget>;
169
+ }
170
+ //#endregion
171
+ export { SqlControlAdapterDescriptor as n, SqlControlAdapter as t };
172
+ //# sourceMappingURL=control-adapter-76pzcIFV.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"control-adapter-76pzcIFV.d.mts","names":[],"sources":["../src/core/control-adapter.ts"],"mappings":";;;;;;;;;;AA6BA;;;;UAAiB,iBAAA,0CACP,sBAAA,QAA8B,OAAA;EAiB5B;;;;;;;;;;;;;;;EADV,UAAA,CACE,MAAA,EAAQ,wBAAA,CAAyB,OAAA,GACjC,KAAA,WACC,OAAA,CAAQ,oBAAA;EA6CD;;;;;;;EApCV,cAAA,CACE,MAAA,EAAQ,wBAAA,CAAyB,OAAA,IAChC,OAAA,CAAQ,WAAA,SAAoB,oBAAA;EA6FI;;;;EAvFnC,UAAA,CACE,MAAA,EAAQ,wBAAA,CAAyB,OAAA,GACjC,KAAA,YACC,OAAA,UAAiB,iBAAA;EAqGW;;;;;;EA7F/B,YAAA,CACE,MAAA,EAAQ,wBAAA,CAAyB,OAAA,GACjC,KAAA,UACA,WAAA;IAAA,SACW,WAAA;IAAA,SACA,WAAA;IAAA,SACA,UAAA;EAAA,IAEV,OAAA;EAuIwC;;;;;;EA/H3C,UAAA,CACE,MAAA,EAAQ,wBAAA,CAAyB,OAAA,GACjC,KAAA,UACA,WAAA;IAAA,SACW,WAAA;IAAA,SACA,WAAA;IAAA,SACA,UAAA;EAAA,IAEV,OAAA;EAtDD;;;;;;;EA+DF,YAAA,CACE,MAAA,EAAQ,wBAAA,CAAyB,OAAA,GACjC,KAAA,UACA,YAAA,UACA,WAAA;IAAA,SACW,WAAA;IAAA,SACA,WAAA;IAAA,SACA,UAAA;EAAA,IAEV,OAAA;EApDO;;;;;;EA4DV,gBAAA,CACE,MAAA,EAAQ,wBAAA,CAAyB,OAAA,GACjC,KAAA,UACA,KAAA;IAAA,SACW,MAAA;IAAA,SACA,IAAA;IAAA,SACA,EAAA;IAAA,SACA,aAAA;IAAA,SACA,aAAA;IAAA,SACA,UAAA;EAAA,IAEV,OAAA;EA1DD;;;;;;;;;;;;EAwEF,UAAA,CACE,MAAA,EAAQ,wBAAA,CAAyB,OAAA,GACjC,QAAA,YACA,MAAA,YACC,OAAA,CAAQ,WAAA;EA7CD;;;;;EAAA,SAoDD,gBAAA,GAAmB,iBAAA;EA/Cf;;;;;EAAA,SAsDJ,mBAAA,GAAsB,oBAAA;EA1CI;;;;;;;;EAAA,SAoD1B,yBAAA,IACP,MAAA,EAAQ,WAAA,EACR,QAAA,EAAU,wBAAA,EACV,WAAA;EArDA;;;;;;EAAA,SA6DO,oCAAA,IACP,QAAA,EAAU,QAAA,CAAS,UAAA,OAEnB,MAAA,EAAQ,WAAA,EACR,QAAA,EAAU,wBAAA,EACV,WAAA;EAzCA;;;;EAgDF,4BAAA,aAAyC,OAAA;EAjChC;;;;EAuCT,0BAAA,aAAuC,OAAA;EA3B3B;;;;;;;;;EAsCZ,KAAA,CAAM,GAAA,EAAK,WAAA,GAAc,OAAA,EAAS,OAAA,EAAS,cAAA,YAA0B,gBAAA;AAAA;;;;;;;UAStD,2BAAA;EATU;;;;;;EAgBzB,MAAA,CAAO,KAAA,EAAO,YAAA,QAAoB,OAAA,IAAW,iBAAA,CAAkB,OAAA;AAAA"}
@@ -1,109 +1,2 @@
1
- import { n as NativeTypeNormalizer, t as DefaultNormalizer } from "./verify-sql-schema-CN7pPoTC.mjs";
2
- import { ControlAdapterInstance, ControlDriverInstance, ControlStack } from "@prisma-next/framework-components/control";
3
- import { PostgresEnumStorageEntry, SqlStorage } from "@prisma-next/sql-contract/types";
4
- import { Contract, ContractMarkerRecord } from "@prisma-next/contract/types";
5
- import { AnyQueryAst, LoweredStatement, LowererContext } from "@prisma-next/sql-relational-core/ast";
6
- import { SqlSchemaIR } from "@prisma-next/sql-schema-ir/types";
7
-
8
- //#region src/core/control-adapter.d.ts
9
- /**
10
- * SQL control adapter interface for control-plane operations.
11
- * Implemented by target-specific adapters (e.g., Postgres, MySQL).
12
- *
13
- * @template TTarget - The target ID (e.g., 'postgres', 'mysql')
14
- */
15
- interface SqlControlAdapter<TTarget extends string = string> extends ControlAdapterInstance<'sql', TTarget> {
16
- /**
17
- * Reads the contract marker for `space` from the database, returning
18
- * `null` if no marker row exists for that space (or if the marker
19
- * table itself is missing). Implementations are responsible for the
20
- * dialect-specific existence probe (e.g. Postgres
21
- * `information_schema.tables` vs SQLite `sqlite_master`) and parameter
22
- * placeholders.
23
- *
24
- * `space` is required so callers cannot accidentally fall through to
25
- * the app's marker row when reading per-extension markers.
26
- *
27
- * @param driver - ControlDriverInstance for executing queries (target-specific)
28
- * @param space - Contract space id whose marker row to read (e.g. `'app'`)
29
- * @returns Resolved marker record, or `null` if not yet stamped.
30
- */
31
- readMarker(driver: ControlDriverInstance<'sql', TTarget>, space: string): Promise<ContractMarkerRecord | null>;
32
- /**
33
- * Reads every marker row from `prisma_contract.marker` (one per
34
- * contract space) and returns them keyed by `space`. Used by the
35
- * per-space verifier to detect marker-vs-on-disk drift and orphan
36
- * marker rows. Returns an empty map when the marker table does not
37
- * yet exist (fresh database / never-signed project).
38
- */
39
- readAllMarkers(driver: ControlDriverInstance<'sql', TTarget>): Promise<ReadonlyMap<string, ContractMarkerRecord>>;
40
- /**
41
- * Introspects a database schema and returns a raw SqlSchemaIR.
42
- *
43
- * This is a pure schema discovery operation that queries the database catalog
44
- * and returns the schema structure without type mapping or contract enrichment.
45
- * Type mapping and enrichment are handled separately by enrichment helpers.
46
- *
47
- * @param driver - ControlDriverInstance instance for executing queries (target-specific)
48
- * @param contract - Optional contract for contract-guided introspection (filtering, optimization)
49
- * @param schema - Schema name to introspect (defaults to 'public')
50
- * @returns Promise resolving to SqlSchemaIR representing the live database schema
51
- */
52
- introspect(driver: ControlDriverInstance<'sql', TTarget>, contract?: unknown, schema?: string): Promise<SqlSchemaIR>;
53
- /**
54
- * Optional target-specific normalizer for raw database default expressions.
55
- * When provided, schema defaults (raw strings) are normalized before comparison
56
- * with contract defaults (ColumnDefault objects) during schema verification.
57
- */
58
- readonly normalizeDefault?: DefaultNormalizer;
59
- /**
60
- * Optional target-specific normalizer for schema native type names.
61
- * When provided, schema native types (from introspection) are normalized
62
- * before comparison with contract native types during schema verification.
63
- */
64
- readonly normalizeNativeType?: NativeTypeNormalizer;
65
- /**
66
- * Optional bridging adapter for resolving the existing values of a
67
- * native enum type from the introspected schema IR. Targets supply
68
- * this so the family-level schema verifier can walk
69
- * `PostgresEnumStorageEntry` entries natively without needing to
70
- * know the target-specific `schema.annotations` shape
71
- * (e.g. `schema.annotations.pg.storageTypes`).
72
- */
73
- readonly resolveExistingEnumValues?: (schema: SqlSchemaIR, enumType: PostgresEnumStorageEntry, namespaceId: string) => readonly string[] | null;
74
- /**
75
- * Optional contract-scoped factory for {@link resolveExistingEnumValues}.
76
- * Targets that need the contract storage to resolve namespace → DDL schema
77
- * supply this; the family control instance prefers it over the bare adapter
78
- * hook when present.
79
- */
80
- readonly resolveExistingEnumValuesForContract?: (contract: Contract<SqlStorage>) => (schema: SqlSchemaIR, enumType: PostgresEnumStorageEntry, namespaceId: string) => readonly string[] | null;
81
- /**
82
- * Lower a SQL query AST into a target-flavored `{ sql, params }` payload.
83
- *
84
- * Migration tooling (e.g. the `dataTransform` operation) needs to materialize
85
- * SQL at emit/plan time without instantiating the runtime adapter. The control
86
- * adapter's `lower` is byte-equivalent to the runtime adapter's `lower` for the
87
- * same AST and contract, ensuring planned SQL matches what the runtime would
88
- * emit.
89
- */
90
- lower(ast: AnyQueryAst, context: LowererContext<unknown>): LoweredStatement;
91
- }
92
- /**
93
- * SQL control adapter descriptor interface.
94
- * Provides a factory method to create control adapter instances.
95
- *
96
- * @template TTarget - The target ID (e.g., 'postgres', 'mysql')
97
- */
98
- interface SqlControlAdapterDescriptor<TTarget extends string = string> {
99
- /**
100
- * Creates a SQL control adapter instance for control-plane operations.
101
- *
102
- * Receives the assembled `ControlStack` so adapters can read aggregated
103
- * metadata (codec lookup, extension contributions) when materializing.
104
- */
105
- create(stack: ControlStack<'sql', TTarget>): SqlControlAdapter<TTarget>;
106
- }
107
- //#endregion
108
- export { type SqlControlAdapter, type SqlControlAdapterDescriptor };
109
- //# sourceMappingURL=control-adapter.d.mts.map
1
+ import { n as SqlControlAdapterDescriptor, t as SqlControlAdapter } from "./control-adapter-76pzcIFV.mjs";
2
+ export type { SqlControlAdapter, 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-CeeCStqw.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-CRpx_fk5.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,120 @@ 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
+ /**
351
+ * The control policy that governs a single call. The `external` default is an
352
+ * un-overridable namespace floor: when the contract default is `external`, no
353
+ * per-object `managed` override can escalate DDL above the floor, so the
354
+ * policy is forced to `external` regardless of the node's own declaration.
355
+ * Every other default defers to the node's effective control policy.
356
+ */
357
+ declare function controlPolicyForCall(subject: ControlPolicySubject | undefined, defaultControlPolicy: ControlPolicy | undefined): ControlPolicy;
358
+ /**
359
+ * Partition the calls produced for a single set of subjects into those the
360
+ * effective control policy permits (`kept`) and a list of
361
+ * {@link SqlPlannerConflict} warnings describing the suppressed calls.
362
+ *
363
+ * **Prefer {@link partitionIssuesByControlPolicy}** for the schema-issue
364
+ * pipeline: it filters subjects out of the planner's *input* so the planner
365
+ * never has to reason about un-modeled state on `external`/`observed`
366
+ * subjects. This call-level helper remains for paths that bypass the issue
367
+ * pipeline — currently the codec-emitted field-event ops, which originate
368
+ * from declared contract fields rather than from introspected schema state
369
+ * and therefore cannot trip the diff engine.
370
+ */
371
+ declare function partitionCallsByControlPolicy<TCall>(options: {
372
+ readonly calls: readonly TCall[];
373
+ readonly contract: Contract<SqlStorage>;
374
+ readonly resolveControlPolicySubject: (call: TCall) => ControlPolicySubject | undefined;
375
+ readonly resolveFactoryName: (call: TCall) => string;
376
+ readonly formatSubjectLabel?: (factoryName: string, subject: ControlPolicySubject | undefined) => string;
377
+ }): {
378
+ readonly kept: readonly TCall[];
379
+ readonly warnings: readonly SqlPlannerConflict[];
380
+ };
381
+ /**
382
+ * Partition a list of schema-issue-shaped inputs by the effective control
383
+ * policy of each issue's subject *before* the planner is invoked.
384
+ *
385
+ * `plannable` is the list of issues whose subject's effective policy permits
386
+ * the planner to act on them (`managed`, or `tolerated` for whole-object
387
+ * creation issues only). Issues for `external`/`observed` subjects, and
388
+ * non-creation issues for `tolerated` subjects, are dropped from the planner's
389
+ * input entirely — they never enter introspection-driven planning, never feed
390
+ * the diff engine, and never produce DDL calls that would have to be
391
+ * post-filtered. This sidesteps a class of failure where the diff engine
392
+ * cannot reason about the live shape of a subject the user marked as
393
+ * out-of-scope (`external`).
394
+ *
395
+ * `warnings` is one {@link SqlPlannerConflict} per suppressed subject (not per
396
+ * suppressed issue). `factoryName` is inferred from the subject's issue mix:
397
+ * if any of the subject's issues is whole-object creation, the warning takes
398
+ * the corresponding creation factoryName (e.g. `createTable`,
399
+ * `createEnumType`, `createSchema`); otherwise it falls back to
400
+ * `defaultModificationFactoryName(subject)` — a synthetic label that names
401
+ * the *kind* of mutation that would have run, since no concrete DDL call was
402
+ * generated.
403
+ *
404
+ * Unresolved-subject issues (`resolveControlPolicySubject` returns
405
+ * `undefined`) emit one warning each; they cannot be deduplicated because
406
+ * they carry no subject coordinate.
407
+ */
408
+ declare function partitionIssuesByControlPolicy<TIssue>(options: {
409
+ readonly issues: readonly TIssue[];
410
+ readonly contract: Contract<SqlStorage>;
411
+ /**
412
+ * Resolve the subject targeted by this issue (or `undefined` to fail-closed:
413
+ * any policy stricter than `managed` drops the issue).
414
+ */
415
+ readonly resolveControlPolicySubject: (issue: TIssue) => ControlPolicySubject | undefined;
416
+ /**
417
+ * Resolve a creation factoryName for this issue if it represents the
418
+ * absence of the whole top-level object (e.g. `'createTable'` for a
419
+ * missing-table issue). When the issue describes a modification to an
420
+ * existing object, return `undefined`. Both decisions feed off this signal:
421
+ *
422
+ * 1. Under `tolerated`, only issues whose `resolveCreationFactoryName`
423
+ * returns a value flow into the planner (create-if-absent).
424
+ * 2. Subjects that have at least one creation-flavoured issue use the
425
+ * resolved creation factoryName for their suppression warning;
426
+ * otherwise they fall back to `defaultModificationFactoryName`.
427
+ */
428
+ readonly resolveCreationFactoryName: (issue: TIssue) => string | undefined;
429
+ /**
430
+ * Default modification factoryName for a suppressed subject whose issues
431
+ * are all non-creation (the subject exists but has a different shape).
432
+ * Defaults to `'alterTable'` / `'alterType'` / `'alterSchema'` based on the
433
+ * subject's populated coordinates.
434
+ */
435
+ readonly defaultModificationFactoryName?: (subject: ControlPolicySubject) => string;
436
+ readonly formatSubjectLabel?: (factoryName: string, subject: ControlPolicySubject | undefined) => string;
437
+ }): {
438
+ readonly plannable: readonly TIssue[];
439
+ readonly warnings: readonly SqlPlannerConflict[];
440
+ };
441
+ //#endregion
328
442
  //#region src/core/migrations/field-event-planner.d.ts
329
443
  interface PlanFieldEventOperationsOptions {
330
444
  /**
@@ -351,7 +465,7 @@ declare function planFieldEventOperations(options: PlanFieldEventOperationsOptio
351
465
  //#endregion
352
466
  //#region src/core/migrations/plan-helpers.d.ts
353
467
  declare function createMigrationPlan<TTargetDetails>(options: CreateSqlMigrationPlanOptions<TTargetDetails>): SqlMigrationPlan<TTargetDetails>;
354
- declare function plannerSuccess<TTargetDetails>(plan: SqlMigrationPlan<TTargetDetails>): SqlPlannerSuccessResult<TTargetDetails>;
468
+ declare function plannerSuccess<TTargetDetails>(plan: SqlMigrationPlan<TTargetDetails>, warnings?: readonly SqlPlannerConflict[]): SqlPlannerSuccessResult<TTargetDetails>;
355
469
  declare function plannerFailure(conflicts: readonly SqlPlannerConflict[]): SqlPlannerFailureResult;
356
470
  /**
357
471
  * Creates a successful migration runner result.
@@ -434,5 +548,5 @@ declare function temporalAuthoringPresets<const CodecId extends string, const Na
434
548
  //#region src/exports/control.d.ts
435
549
  declare const _default: SqlFamilyDescriptor;
436
550
  //#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 };
551
+ 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, controlPolicyForCall, createMigrationPlan, _default as default, detectDestructiveChanges, extractCodecControlHooks, partitionCallsByControlPolicy, partitionIssuesByControlPolicy, planFieldEventOperations, plannerFailure, plannerSuccess, runnerFailure, runnerSuccess, temporalAuthoringPresets, timestampNowControlDescriptor };
438
552
  //# 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;;;;;;;;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A,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","../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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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