@prisma-next/family-sql 0.14.0-dev.39 → 0.14.0-dev.40
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.
- package/dist/contract-to-schema-ir-S-evq8E6.mjs +264 -0
- package/dist/contract-to-schema-ir-S-evq8E6.mjs.map +1 -0
- package/dist/{control-adapter-B2q9WN1V.d.mts → control-adapter-DHYFuOBy.d.mts} +14 -17
- package/dist/{control-adapter-B2q9WN1V.d.mts.map → control-adapter-DHYFuOBy.d.mts.map} +1 -1
- package/dist/control-adapter.d.mts +1 -1
- package/dist/control.d.mts +17 -2
- package/dist/control.d.mts.map +1 -1
- package/dist/control.mjs +42 -943
- package/dist/control.mjs.map +1 -1
- package/dist/{schema-verify.d.mts → diff.d.mts} +4 -4
- package/dist/diff.d.mts.map +1 -0
- package/dist/{verify-sql-schema-CEY7b78t.mjs → diff.mjs} +154 -244
- package/dist/diff.mjs.map +1 -0
- package/dist/migration.d.mts +1 -1
- package/dist/psl-infer.d.mts +80 -0
- package/dist/psl-infer.d.mts.map +1 -0
- package/dist/psl-infer.mjs +334 -0
- package/dist/psl-infer.mjs.map +1 -0
- package/dist/{verify-sql-schema-B8uEjw2s.d.mts → sql-schema-diff-6z36dZt6.d.mts} +43 -4
- package/dist/sql-schema-diff-6z36dZt6.d.mts.map +1 -0
- package/dist/{types-BxsFkHYv.d.mts → types-CkOIJXxU.d.mts} +83 -16
- package/dist/types-CkOIJXxU.d.mts.map +1 -0
- package/package.json +23 -22
- package/src/core/control-adapter.ts +12 -24
- package/src/core/control-instance.ts +113 -45
- package/src/core/{schema-verify/verify-sql-schema.ts → diff/sql-schema-diff.ts} +196 -8
- package/src/core/{schema-verify → diff}/verify-helpers.ts +12 -0
- package/src/core/migrations/contract-to-schema-ir.ts +48 -13
- package/src/core/migrations/field-event-planner.ts +3 -8
- package/src/core/migrations/schema-differ.ts +40 -0
- package/src/core/migrations/types.ts +43 -2
- package/src/core/psl-contract-infer/printer-config.ts +0 -6
- package/src/exports/control.ts +1 -0
- package/src/exports/diff.ts +18 -0
- package/src/exports/psl-infer.ts +36 -0
- package/dist/schema-verify.d.mts.map +0 -1
- package/dist/schema-verify.mjs +0 -2
- package/dist/types-BxsFkHYv.d.mts.map +0 -1
- package/dist/verify-sql-schema-B8uEjw2s.d.mts.map +0 -1
- package/dist/verify-sql-schema-CEY7b78t.mjs.map +0 -1
- package/src/core/psl-contract-infer/postgres-default-mapping.ts +0 -16
- package/src/core/psl-contract-infer/postgres-type-map.ts +0 -157
- package/src/core/psl-contract-infer/sql-schema-ir-to-psl-ast.ts +0 -795
- package/src/exports/schema-verify.ts +0 -18
- /package/src/core/{schema-verify → diff}/control-verify-emit.ts +0 -0
- /package/src/core/{schema-verify → diff}/verifier-disposition.ts +0 -0
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import { assertUniqueCodecOwner } from "@prisma-next/framework-components/control";
|
|
2
|
+
import { defaultIndexName } from "@prisma-next/sql-schema-ir/naming";
|
|
3
|
+
import { ifDefined } from "@prisma-next/utils/defined";
|
|
4
|
+
import { StorageTable, isStorageTypeInstance } from "@prisma-next/sql-contract/types";
|
|
5
|
+
//#region src/core/assembly.ts
|
|
6
|
+
function hasCodecControlHooks(descriptor) {
|
|
7
|
+
if (typeof descriptor !== "object" || descriptor === null) return false;
|
|
8
|
+
const hooks = descriptor.types?.codecTypes?.controlPlaneHooks;
|
|
9
|
+
return hooks !== null && hooks !== void 0 && typeof hooks === "object";
|
|
10
|
+
}
|
|
11
|
+
function extractCodecControlHooks(descriptors) {
|
|
12
|
+
const hooks = /* @__PURE__ */ new Map();
|
|
13
|
+
const owners = /* @__PURE__ */ new Map();
|
|
14
|
+
for (const descriptor of descriptors) {
|
|
15
|
+
if (typeof descriptor !== "object" || descriptor === null) continue;
|
|
16
|
+
if (!hasCodecControlHooks(descriptor)) continue;
|
|
17
|
+
const controlPlaneHooks = descriptor.types.codecTypes.controlPlaneHooks;
|
|
18
|
+
for (const [codecId, hook] of Object.entries(controlPlaneHooks)) {
|
|
19
|
+
assertUniqueCodecOwner({
|
|
20
|
+
codecId,
|
|
21
|
+
owners,
|
|
22
|
+
descriptorId: descriptor.id,
|
|
23
|
+
entityLabel: "control hooks",
|
|
24
|
+
entityOwnershipLabel: "owner"
|
|
25
|
+
});
|
|
26
|
+
hooks.set(codecId, hook);
|
|
27
|
+
owners.set(codecId, descriptor.id);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return hooks;
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/core/migrations/contract-to-schema-ir.ts
|
|
34
|
+
function convertColumn(name, column, storageTypes, expandNativeType, renderDefault) {
|
|
35
|
+
const resolved = resolveColumnTypeMetadata(column, storageTypes);
|
|
36
|
+
const baseNativeType = expandNativeType ? expandNativeType({
|
|
37
|
+
nativeType: resolved.nativeType,
|
|
38
|
+
codecId: resolved.codecId,
|
|
39
|
+
...ifDefined("typeParams", resolved.typeParams)
|
|
40
|
+
}) : resolved.nativeType;
|
|
41
|
+
return {
|
|
42
|
+
name,
|
|
43
|
+
nativeType: column.many ? `${baseNativeType}[]` : baseNativeType,
|
|
44
|
+
nullable: column.nullable,
|
|
45
|
+
...ifDefined("default", column.default != null && renderDefault ? renderDefault(column.default, column) : void 0)
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function resolveColumnTypeMetadata(column, storageTypes) {
|
|
49
|
+
if (!column.typeRef) return column;
|
|
50
|
+
const referenced = storageTypes[column.typeRef];
|
|
51
|
+
if (!referenced) throw new Error(`Column references storage type "${column.typeRef}" but it is not defined in storage.types.`);
|
|
52
|
+
if (isStorageTypeInstance(referenced)) return {
|
|
53
|
+
codecId: referenced.codecId,
|
|
54
|
+
nativeType: referenced.nativeType,
|
|
55
|
+
typeParams: referenced.typeParams
|
|
56
|
+
};
|
|
57
|
+
throw new Error(`Storage type "${column.typeRef}" has an unknown polymorphic kind; expected a codec-typed StorageTypeInstance.`);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Resolves a `ValueSetRef` to its permitted values from the contract storage.
|
|
61
|
+
*
|
|
62
|
+
* Throws when the referenced namespace or value-set is absent — this indicates
|
|
63
|
+
* the contract was built incorrectly (the check and the value-set must be
|
|
64
|
+
* co-emitted by the lowering step). Used by `convertCheck` (schema-IR
|
|
65
|
+
* projection), `verifyCheckConstraints` (verification), and
|
|
66
|
+
* `checkConstraintPlanCallStrategy` (migration planning) so all three agree on
|
|
67
|
+
* the resolved values and the error behavior on a missing reference.
|
|
68
|
+
*/
|
|
69
|
+
function allStrings(values) {
|
|
70
|
+
return values.every((value) => typeof value === "string");
|
|
71
|
+
}
|
|
72
|
+
function resolveValueSetValues(ref, storage, contextLabel) {
|
|
73
|
+
const ns = storage.namespaces[ref.namespaceId];
|
|
74
|
+
if (!ns) throw new Error(`resolveValueSetValues: namespace "${ref.namespaceId}" not found in storage (${contextLabel})`);
|
|
75
|
+
const valueSet = ns.entries.valueSet?.[ref.entityName];
|
|
76
|
+
if (!valueSet) throw new Error(`resolveValueSetValues: value-set "${ref.entityName}" not found in namespace "${ref.namespaceId}" (${contextLabel})`);
|
|
77
|
+
const values = valueSet.values;
|
|
78
|
+
if (!allStrings(values)) throw new Error(`resolveValueSetValues: value-set "${ref.entityName}" in namespace "${ref.namespaceId}" has a non-string value; numeric-enum CHECK constraints are not yet supported (${contextLabel})`);
|
|
79
|
+
return values;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Projects a `CheckConstraint` IR into an `SqlCheckConstraintIRInput` by
|
|
83
|
+
* resolving the permitted values from the storage value-set it references.
|
|
84
|
+
*
|
|
85
|
+
* The `CheckConstraint.valueSet` ref points to
|
|
86
|
+
* `storage.namespaces[namespaceId].entries.valueSet[name]`. The resolved
|
|
87
|
+
* values are lifted directly from `StorageValueSet.values` so verification
|
|
88
|
+
* compares value sets, not SQL predicate strings.
|
|
89
|
+
*
|
|
90
|
+
* Throws if the referenced namespace or value-set is absent — this
|
|
91
|
+
* indicates the contract was built incorrectly (the check and the
|
|
92
|
+
* value-set must be co-emitted by the lowering step).
|
|
93
|
+
*/
|
|
94
|
+
function convertCheck(check, storage) {
|
|
95
|
+
const permittedValues = resolveValueSetValues(check.valueSet, storage, `check "${check.name}"`);
|
|
96
|
+
return {
|
|
97
|
+
name: check.name,
|
|
98
|
+
column: check.column,
|
|
99
|
+
permittedValues
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
function convertUnique(unique) {
|
|
103
|
+
return {
|
|
104
|
+
columns: unique.columns,
|
|
105
|
+
...ifDefined("name", unique.name)
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
function convertIndex(index) {
|
|
109
|
+
return {
|
|
110
|
+
columns: index.columns,
|
|
111
|
+
unique: false,
|
|
112
|
+
...ifDefined("name", index.name)
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
function convertForeignKey(fk) {
|
|
116
|
+
return {
|
|
117
|
+
columns: fk.source.columns,
|
|
118
|
+
referencedTable: fk.target.tableName,
|
|
119
|
+
referencedSchema: fk.target.namespaceId,
|
|
120
|
+
referencedColumns: fk.target.columns,
|
|
121
|
+
...ifDefined("name", fk.name),
|
|
122
|
+
...ifDefined("onDelete", fk.onDelete),
|
|
123
|
+
...ifDefined("onUpdate", fk.onUpdate)
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
function convertTable(name, table, storageTypes, expandNativeType, renderDefault, storage) {
|
|
127
|
+
const columns = {};
|
|
128
|
+
for (const [colName, colDef] of Object.entries(table.columns)) columns[colName] = convertColumn(colName, colDef, storageTypes, expandNativeType, renderDefault);
|
|
129
|
+
const satisfiedIndexColumns = new Set([
|
|
130
|
+
...table.indexes.map((idx) => idx.columns.join(",")),
|
|
131
|
+
...table.uniques.map((unique) => unique.columns.join(",")),
|
|
132
|
+
...table.primaryKey ? [table.primaryKey.columns.join(",")] : []
|
|
133
|
+
]);
|
|
134
|
+
const fkBackingIndexes = [];
|
|
135
|
+
for (const fk of table.foreignKeys) {
|
|
136
|
+
if (fk.index === false) continue;
|
|
137
|
+
const key = fk.source.columns.join(",");
|
|
138
|
+
if (satisfiedIndexColumns.has(key)) continue;
|
|
139
|
+
fkBackingIndexes.push({
|
|
140
|
+
columns: fk.source.columns,
|
|
141
|
+
unique: false,
|
|
142
|
+
name: defaultIndexName(name, fk.source.columns)
|
|
143
|
+
});
|
|
144
|
+
satisfiedIndexColumns.add(key);
|
|
145
|
+
}
|
|
146
|
+
const checks = table.checks && table.checks.length > 0 ? table.checks.map((c) => convertCheck(c, storage)) : void 0;
|
|
147
|
+
return {
|
|
148
|
+
name,
|
|
149
|
+
columns,
|
|
150
|
+
...ifDefined("primaryKey", table.primaryKey),
|
|
151
|
+
foreignKeys: table.foreignKeys.filter((fk) => fk.constraint !== false).map(convertForeignKey),
|
|
152
|
+
uniques: table.uniques.map(convertUnique),
|
|
153
|
+
indexes: [...table.indexes.map(convertIndex), ...fkBackingIndexes],
|
|
154
|
+
...ifDefined("checks", checks)
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Detects destructive changes between two contract storages.
|
|
159
|
+
*
|
|
160
|
+
* The additive-only planner silently ignores removals (tables, columns).
|
|
161
|
+
* This function detects those removals so callers can report them as conflicts
|
|
162
|
+
* rather than silently producing an empty plan.
|
|
163
|
+
*
|
|
164
|
+
* Returns an empty array if no destructive changes are found.
|
|
165
|
+
*/
|
|
166
|
+
function detectDestructiveChanges(from, to) {
|
|
167
|
+
if (!from) return [];
|
|
168
|
+
const hasOwn = (value, key) => Object.hasOwn(value, key);
|
|
169
|
+
const conflicts = [];
|
|
170
|
+
const namespaceIds = [...new Set([...Object.keys(from.namespaces), ...Object.keys(to.namespaces)])].sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
171
|
+
for (const namespaceId of namespaceIds) {
|
|
172
|
+
const fromNs = from.namespaces[namespaceId];
|
|
173
|
+
const toNs = to.namespaces[namespaceId];
|
|
174
|
+
const fromTables = fromNs?.entries.table;
|
|
175
|
+
if (!fromTables) continue;
|
|
176
|
+
for (const tableName of Object.keys(fromTables)) {
|
|
177
|
+
const toTableRaw = toNs?.entries.table?.[tableName];
|
|
178
|
+
if (!StorageTable.is(toTableRaw)) {
|
|
179
|
+
conflicts.push({
|
|
180
|
+
kind: "tableRemoved",
|
|
181
|
+
summary: `Table "${tableName}" was removed`
|
|
182
|
+
});
|
|
183
|
+
continue;
|
|
184
|
+
}
|
|
185
|
+
const toTable = toTableRaw;
|
|
186
|
+
const fromTableRaw = fromTables[tableName];
|
|
187
|
+
if (!StorageTable.is(fromTableRaw)) continue;
|
|
188
|
+
const fromTable = fromTableRaw;
|
|
189
|
+
for (const columnName of Object.keys(fromTable.columns)) if (!hasOwn(toTable.columns, columnName)) conflicts.push({
|
|
190
|
+
kind: "columnRemoved",
|
|
191
|
+
summary: `Column "${tableName}"."${columnName}" was removed`
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
return conflicts;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Converts a `Contract` to `SqlSchemaIR`.
|
|
199
|
+
*
|
|
200
|
+
* Reads `contract.storage` for tables and `contract.storage.types` for type
|
|
201
|
+
* annotations. Storage-type annotations are written under
|
|
202
|
+
* `options.annotationNamespace`.
|
|
203
|
+
*
|
|
204
|
+
* Drops codec metadata (`codecId`, `typeRef`) since the schema IR only represents
|
|
205
|
+
* structural information. When `expandNativeType` is provided, parameterized types
|
|
206
|
+
* are expanded (e.g. `character` + `{ length: 36 }` → `character(36)`) so the
|
|
207
|
+
* resulting IR compares correctly against the "to" contract during planning.
|
|
208
|
+
*
|
|
209
|
+
* Returns an empty schema IR when `contract` is `null` (new project).
|
|
210
|
+
*/
|
|
211
|
+
/**
|
|
212
|
+
* Converts the tables of a single namespace into a `SqlSchemaIR`, keyed by
|
|
213
|
+
* table name within that namespace. Unlike {@link contractToSchemaIR}, which
|
|
214
|
+
* flattens every namespace's tables into one bare-keyed record (and throws on a
|
|
215
|
+
* cross-namespace name collision), this scopes the table iteration to one
|
|
216
|
+
* namespace so the same table name can exist in two schemas.
|
|
217
|
+
*
|
|
218
|
+
* The full `storage` is still passed to `convertTable`, so value-set / enum /
|
|
219
|
+
* type resolution that legitimately spans namespaces is unaffected. Foreign
|
|
220
|
+
* keys are built purely from the FK descriptor (`fk.target`), so cross-namespace
|
|
221
|
+
* FKs survive per-namespace conversion. The `annotations` block (storage-type
|
|
222
|
+
* derived) is omitted here — the per-namespace tree consumer reads only the
|
|
223
|
+
* per-table fields.
|
|
224
|
+
*/
|
|
225
|
+
function contractNamespaceToSchemaIR(storage, namespaceId, options) {
|
|
226
|
+
if (options.annotationNamespace.length === 0) throw new Error("annotationNamespace must be a non-empty string");
|
|
227
|
+
const namespace = storage.namespaces[namespaceId];
|
|
228
|
+
if (!namespace) return { tables: {} };
|
|
229
|
+
const storageTypes = { ...storage.types ?? {} };
|
|
230
|
+
const tables = {};
|
|
231
|
+
for (const [tableName, tableDefRaw] of Object.entries(namespace.entries.table ?? {})) {
|
|
232
|
+
StorageTable.assert(tableDefRaw, `namespaces.${namespaceId}.entries.table.${tableName}`);
|
|
233
|
+
tables[tableName] = convertTable(tableName, tableDefRaw, storageTypes, options.expandNativeType, options.renderDefault, storage);
|
|
234
|
+
}
|
|
235
|
+
return { tables };
|
|
236
|
+
}
|
|
237
|
+
function contractToSchemaIR(contract, options) {
|
|
238
|
+
if (options.annotationNamespace.length === 0) throw new Error("annotationNamespace must be a non-empty string");
|
|
239
|
+
if (!contract) return { tables: {} };
|
|
240
|
+
const storage = contract.storage;
|
|
241
|
+
const storageTypes = { ...storage.types ?? {} };
|
|
242
|
+
const tables = {};
|
|
243
|
+
for (const ns of Object.values(storage.namespaces)) for (const [tableName, tableDefRaw] of Object.entries(ns.entries.table ?? {})) {
|
|
244
|
+
StorageTable.assert(tableDefRaw, `namespaces.${ns.id}.entries.table.${tableName}`);
|
|
245
|
+
const tableDef = tableDefRaw;
|
|
246
|
+
if (tables[tableName] !== void 0) throw new Error(`contractToSchemaIR: duplicate SQL table name "${tableName}" across namespaces (ambiguous for flat SqlSchemaIR.tables).`);
|
|
247
|
+
tables[tableName] = convertTable(tableName, tableDef, storageTypes, options.expandNativeType, options.renderDefault, storage);
|
|
248
|
+
}
|
|
249
|
+
return {
|
|
250
|
+
tables,
|
|
251
|
+
...ifDefined("annotations", deriveAnnotations(storage, options.annotationNamespace, options.resolveEnumNamespaceSchema))
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
function deriveAnnotations(storage, annotationNamespace, _resolveEnumNamespaceSchema) {
|
|
255
|
+
const storageTypes = {};
|
|
256
|
+
for (const typeInstance of Object.values(storage.types ?? {})) if (isStorageTypeInstance(typeInstance)) storageTypes[typeInstance.nativeType] = typeInstance;
|
|
257
|
+
const envelope = { ...Object.keys(storageTypes).length > 0 ? { storageTypes } : {} };
|
|
258
|
+
if (Object.keys(envelope).length === 0) return void 0;
|
|
259
|
+
return { [annotationNamespace]: envelope };
|
|
260
|
+
}
|
|
261
|
+
//#endregion
|
|
262
|
+
export { extractCodecControlHooks as a, resolveValueSetValues as i, contractToSchemaIR as n, detectDestructiveChanges as r, contractNamespaceToSchemaIR as t };
|
|
263
|
+
|
|
264
|
+
//# sourceMappingURL=contract-to-schema-ir-S-evq8E6.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract-to-schema-ir-S-evq8E6.mjs","names":["d"],"sources":["../src/core/assembly.ts","../src/core/migrations/contract-to-schema-ir.ts"],"sourcesContent":["import type { TargetBoundComponentDescriptor } from '@prisma-next/framework-components/components';\nimport { assertUniqueCodecOwner } from '@prisma-next/framework-components/control';\nimport type { CodecControlHooks } from './migrations/types';\n\ntype CodecControlHooksMap = Record<string, CodecControlHooks>;\n\nfunction hasCodecControlHooks(descriptor: unknown): descriptor is {\n readonly id: string;\n readonly types: {\n readonly codecTypes: {\n readonly controlPlaneHooks: CodecControlHooksMap;\n };\n };\n} {\n if (typeof descriptor !== 'object' || descriptor === null) {\n return false;\n }\n const d = descriptor as { types?: { codecTypes?: { controlPlaneHooks?: unknown } } };\n const hooks = d.types?.codecTypes?.controlPlaneHooks;\n return hooks !== null && hooks !== undefined && typeof hooks === 'object';\n}\n\nexport function extractCodecControlHooks(\n descriptors: ReadonlyArray<TargetBoundComponentDescriptor<'sql', string>>,\n): Map<string, CodecControlHooks> {\n const hooks = new Map<string, CodecControlHooks>();\n const owners = new Map<string, string>();\n\n for (const descriptor of descriptors) {\n if (typeof descriptor !== 'object' || descriptor === null) {\n continue;\n }\n if (!hasCodecControlHooks(descriptor)) {\n continue;\n }\n const controlPlaneHooks = descriptor.types.codecTypes.controlPlaneHooks;\n for (const [codecId, hook] of Object.entries(controlPlaneHooks)) {\n assertUniqueCodecOwner({\n codecId,\n owners,\n descriptorId: descriptor.id,\n entityLabel: 'control hooks',\n entityOwnershipLabel: 'owner',\n });\n hooks.set(codecId, hook);\n owners.set(codecId, descriptor.id);\n }\n }\n\n return hooks;\n}\n","import type { ColumnDefault, Contract, JsonValue } from '@prisma-next/contract/types';\nimport type { MigrationPlannerConflict } from '@prisma-next/framework-components/control';\nimport {\n type CheckConstraint,\n type ForeignKey,\n type Index,\n isStorageTypeInstance,\n type SqlStorage,\n type StorageColumn,\n StorageTable,\n type StorageTypeInstance,\n type UniqueConstraint,\n} from '@prisma-next/sql-contract/types';\nimport { defaultIndexName } from '@prisma-next/sql-schema-ir/naming';\nimport type {\n SqlAnnotations,\n SqlCheckConstraintIRInput,\n SqlColumnIR,\n SqlForeignKeyIR,\n SqlIndexIR,\n SqlSchemaIR,\n SqlTableIR,\n SqlUniqueIR,\n} from '@prisma-next/sql-schema-ir/types';\nimport { ifDefined } from '@prisma-next/utils/defined';\n\n/**\n * Target-specific callback that expands a column's base `nativeType` and optional\n * `typeParams` into the fully-qualified type string used by the database\n * (e.g. `character` + `{ length: 36 }` → `character(36)`).\n *\n * This lives in the family layer as a callback rather than importing a concrete\n * implementation because each target (Postgres, MySQL, SQLite, …) has its own\n * parameterization syntax. The target wires its expander when calling\n * `contractToSchemaIR`, keeping the family layer target-agnostic.\n */\nexport type NativeTypeExpander = (input: {\n readonly nativeType: string;\n readonly codecId?: string;\n readonly typeParams?: Record<string, unknown>;\n}) => string;\n\n/**\n * Target-specific callback that renders a `ColumnDefault` into the raw SQL literal\n * string stored in `SqlColumnIR.default`.\n *\n * Default value serialization is target-specific (quoting, casting, type syntax vary\n * between Postgres, MySQL, SQLite, …). This callback follows the same IoC pattern as\n * `NativeTypeExpander`: the target provides its renderer when calling\n * `contractToSchemaIR`, keeping the family layer target-agnostic.\n */\nexport type DefaultRenderer = (def: ColumnDefault, column: StorageColumn) => string;\n\n/**\n * Target-supplied callback that resolves a contract namespace to the live\n * database schema its enums are stored under.\n *\n * The projected enum annotations are nested by schema\n * (`storageTypes[schema][nativeType]`) so two namespaces holding an enum with\n * the same native type resolve to distinct live-database types. Mapping a\n * namespace to its DDL schema is target-specific (Postgres schemas;\n * SQLite/MySQL differ), so the target injects it here rather than the family\n * importing a concrete `ddlSchemaName`. This keeps the family layer\n * target-agnostic while the projection nests under the same schema the\n * target's read side (`readExistingEnumValues`) looks up.\n */\nexport type EnumNamespaceSchemaResolver = (storage: SqlStorage, namespaceId: string) => string;\n\nfunction convertColumn(\n name: string,\n column: StorageColumn,\n storageTypes: ResolvedStorageTypes,\n expandNativeType: NativeTypeExpander | undefined,\n renderDefault: DefaultRenderer | undefined,\n): SqlColumnIR {\n // Resolve `typeRef` so columns that delegate their `nativeType`/`codecId`/\n // `typeParams` to a named `storage.types` entry expand the same way as\n // columns that inline those fields. Without this resolution, a\n // `typeRef`-based column like `post.embedding → Embedding1536` would\n // render as the bare `\"vector\"` (dropping the `length` parameter), while\n // `verify-sql-schema.ts`'s `renderExpectedNativeType` resolves the\n // typeRef and produces `\"vector(1536)\"` — making diffs on the same\n // contract falsely report a `type_mismatch`.\n const resolved = resolveColumnTypeMetadata(column, storageTypes);\n const baseNativeType = expandNativeType\n ? expandNativeType({\n nativeType: resolved.nativeType,\n codecId: resolved.codecId,\n ...ifDefined('typeParams', resolved.typeParams),\n })\n : resolved.nativeType;\n const nativeType = column.many ? `${baseNativeType}[]` : baseNativeType;\n return {\n name,\n nativeType,\n nullable: column.nullable,\n ...ifDefined(\n 'default',\n column.default != null && renderDefault ? renderDefault(column.default, column) : undefined,\n ),\n };\n}\n\ntype ResolvedStorageTypes = Readonly<Record<string, StorageTypeInstance>>;\n\nfunction resolveColumnTypeMetadata(\n column: StorageColumn,\n storageTypes: ResolvedStorageTypes,\n): Pick<StorageColumn, 'codecId' | 'nativeType' | 'typeParams'> {\n if (!column.typeRef) {\n return column;\n }\n const referenced = storageTypes[column.typeRef];\n if (!referenced) {\n throw new Error(\n `Column references storage type \"${column.typeRef}\" but it is not defined in storage.types.`,\n );\n }\n if (isStorageTypeInstance(referenced)) {\n return {\n codecId: referenced.codecId,\n nativeType: referenced.nativeType,\n typeParams: referenced.typeParams,\n };\n }\n throw new Error(\n `Storage type \"${column.typeRef}\" has an unknown polymorphic kind; expected a codec-typed StorageTypeInstance.`,\n );\n}\n\n/**\n * Resolves a `ValueSetRef` to its permitted values from the contract storage.\n *\n * Throws when the referenced namespace or value-set is absent — this indicates\n * the contract was built incorrectly (the check and the value-set must be\n * co-emitted by the lowering step). Used by `convertCheck` (schema-IR\n * projection), `verifyCheckConstraints` (verification), and\n * `checkConstraintPlanCallStrategy` (migration planning) so all three agree on\n * the resolved values and the error behavior on a missing reference.\n */\nfunction allStrings(values: readonly JsonValue[]): values is readonly string[] {\n return values.every((value) => typeof value === 'string');\n}\n\nexport function resolveValueSetValues(\n ref: { readonly namespaceId: string; readonly entityName: string },\n storage: SqlStorage,\n contextLabel: string,\n): readonly string[] {\n const ns = storage.namespaces[ref.namespaceId];\n if (!ns) {\n throw new Error(\n `resolveValueSetValues: namespace \"${ref.namespaceId}\" not found in storage (${contextLabel})`,\n );\n }\n const valueSet = ns.entries.valueSet?.[ref.entityName];\n if (!valueSet) {\n throw new Error(\n `resolveValueSetValues: value-set \"${ref.entityName}\" not found in namespace \"${ref.namespaceId}\" (${contextLabel})`,\n );\n }\n // Only TEXT enums ship a CHECK-constraint round-trip in this slice. A\n // non-string value-set is a numeric enum, whose CHECK rendering/verification\n // is future work; fail loudly rather than emit a wrong numeric-as-text check.\n const values = valueSet.values;\n if (!allStrings(values)) {\n throw new Error(\n `resolveValueSetValues: value-set \"${ref.entityName}\" in namespace \"${ref.namespaceId}\" has a non-string value; numeric-enum CHECK constraints are not yet supported (${contextLabel})`,\n );\n }\n return values;\n}\n\n/**\n * Projects a `CheckConstraint` IR into an `SqlCheckConstraintIRInput` by\n * resolving the permitted values from the storage value-set it references.\n *\n * The `CheckConstraint.valueSet` ref points to\n * `storage.namespaces[namespaceId].entries.valueSet[name]`. The resolved\n * values are lifted directly from `StorageValueSet.values` so verification\n * compares value sets, not SQL predicate strings.\n *\n * Throws if the referenced namespace or value-set is absent — this\n * indicates the contract was built incorrectly (the check and the\n * value-set must be co-emitted by the lowering step).\n */\nfunction convertCheck(check: CheckConstraint, storage: SqlStorage): SqlCheckConstraintIRInput {\n const permittedValues = resolveValueSetValues(check.valueSet, storage, `check \"${check.name}\"`);\n return {\n name: check.name,\n column: check.column,\n permittedValues,\n };\n}\n\nfunction convertUnique(unique: UniqueConstraint): SqlUniqueIR {\n return {\n columns: unique.columns,\n ...ifDefined('name', unique.name),\n };\n}\n\nfunction convertIndex(index: Index): SqlIndexIR {\n return {\n columns: index.columns,\n unique: false,\n ...ifDefined('name', index.name),\n };\n}\n\nfunction convertForeignKey(fk: ForeignKey): SqlForeignKeyIR {\n return {\n columns: fk.source.columns,\n referencedTable: fk.target.tableName,\n referencedSchema: fk.target.namespaceId,\n referencedColumns: fk.target.columns,\n ...ifDefined('name', fk.name),\n ...ifDefined('onDelete', fk.onDelete),\n ...ifDefined('onUpdate', fk.onUpdate),\n };\n}\n\nfunction convertTable(\n name: string,\n table: StorageTable,\n storageTypes: ResolvedStorageTypes,\n expandNativeType: NativeTypeExpander | undefined,\n renderDefault: DefaultRenderer | undefined,\n storage: SqlStorage,\n): SqlTableIR {\n const columns: Record<string, SqlColumnIR> = {};\n for (const [colName, colDef] of Object.entries(table.columns)) {\n columns[colName] = convertColumn(\n colName,\n colDef,\n storageTypes,\n expandNativeType,\n renderDefault,\n );\n }\n\n const satisfiedIndexColumns = new Set([\n ...table.indexes.map((idx) => idx.columns.join(',')),\n ...table.uniques.map((unique) => unique.columns.join(',')),\n ...(table.primaryKey ? [table.primaryKey.columns.join(',')] : []),\n ]);\n const fkBackingIndexes: SqlIndexIR[] = [];\n for (const fk of table.foreignKeys) {\n if (fk.index === false) continue;\n const key = fk.source.columns.join(',');\n if (satisfiedIndexColumns.has(key)) continue;\n fkBackingIndexes.push({\n columns: fk.source.columns,\n unique: false,\n name: defaultIndexName(name, fk.source.columns),\n });\n satisfiedIndexColumns.add(key);\n }\n\n const checks: SqlCheckConstraintIRInput[] | undefined =\n table.checks && table.checks.length > 0\n ? table.checks.map((c) => convertCheck(c, storage))\n : undefined;\n\n return {\n name,\n columns,\n ...ifDefined('primaryKey', table.primaryKey),\n foreignKeys: table.foreignKeys.filter((fk) => fk.constraint !== false).map(convertForeignKey),\n uniques: table.uniques.map(convertUnique),\n indexes: [...table.indexes.map(convertIndex), ...fkBackingIndexes],\n ...ifDefined('checks', checks),\n };\n}\n\n/**\n * Detects destructive changes between two contract storages.\n *\n * The additive-only planner silently ignores removals (tables, columns).\n * This function detects those removals so callers can report them as conflicts\n * rather than silently producing an empty plan.\n *\n * Returns an empty array if no destructive changes are found.\n */\nexport function detectDestructiveChanges(\n from: SqlStorage | null,\n to: SqlStorage,\n): readonly MigrationPlannerConflict[] {\n if (!from) return [];\n\n const hasOwn = (value: object, key: string): boolean => Object.hasOwn(value, key);\n\n const conflicts: MigrationPlannerConflict[] = [];\n\n const namespaceIds = [\n ...new Set([...Object.keys(from.namespaces), ...Object.keys(to.namespaces)]),\n ].sort((a, b) => (a < b ? -1 : a > b ? 1 : 0));\n\n for (const namespaceId of namespaceIds) {\n const fromNs = from.namespaces[namespaceId];\n const toNs = to.namespaces[namespaceId];\n const fromTables = fromNs?.entries.table;\n if (!fromTables) continue;\n\n for (const tableName of Object.keys(fromTables)) {\n const toTableRaw = toNs?.entries.table?.[tableName];\n if (!StorageTable.is(toTableRaw)) {\n conflicts.push({\n kind: 'tableRemoved',\n summary: `Table \"${tableName}\" was removed`,\n });\n continue;\n }\n const toTable = toTableRaw;\n\n const fromTableRaw = fromTables[tableName];\n if (!StorageTable.is(fromTableRaw)) continue;\n const fromTable = fromTableRaw;\n\n for (const columnName of Object.keys(fromTable.columns)) {\n if (!hasOwn(toTable.columns, columnName)) {\n conflicts.push({\n kind: 'columnRemoved',\n summary: `Column \"${tableName}\".\"${columnName}\" was removed`,\n });\n }\n }\n }\n }\n\n return conflicts;\n}\n\nexport interface ContractToSchemaIROptions {\n readonly annotationNamespace: string;\n readonly expandNativeType?: NativeTypeExpander;\n readonly renderDefault?: DefaultRenderer;\n /**\n * Target-supplied resolver mapping a namespace to the live database schema\n * its enums are stored under. When provided (Postgres), namespace-scoped\n * enums are nested by that schema in `enumTypes` so the projection matches\n * the target's `readExistingEnumValues` lookup. Targets without\n * schema-scoped enum storage (SQLite) omit it; enums are absent there.\n */\n readonly resolveEnumNamespaceSchema?: EnumNamespaceSchemaResolver;\n}\n\n/**\n * Converts a `Contract` to `SqlSchemaIR`.\n *\n * Reads `contract.storage` for tables and `contract.storage.types` for type\n * annotations. Storage-type annotations are written under\n * `options.annotationNamespace`.\n *\n * Drops codec metadata (`codecId`, `typeRef`) since the schema IR only represents\n * structural information. When `expandNativeType` is provided, parameterized types\n * are expanded (e.g. `character` + `{ length: 36 }` → `character(36)`) so the\n * resulting IR compares correctly against the \"to\" contract during planning.\n *\n * Returns an empty schema IR when `contract` is `null` (new project).\n */\n/**\n * Converts the tables of a single namespace into a `SqlSchemaIR`, keyed by\n * table name within that namespace. Unlike {@link contractToSchemaIR}, which\n * flattens every namespace's tables into one bare-keyed record (and throws on a\n * cross-namespace name collision), this scopes the table iteration to one\n * namespace so the same table name can exist in two schemas.\n *\n * The full `storage` is still passed to `convertTable`, so value-set / enum /\n * type resolution that legitimately spans namespaces is unaffected. Foreign\n * keys are built purely from the FK descriptor (`fk.target`), so cross-namespace\n * FKs survive per-namespace conversion. The `annotations` block (storage-type\n * derived) is omitted here — the per-namespace tree consumer reads only the\n * per-table fields.\n */\nexport function contractNamespaceToSchemaIR(\n storage: SqlStorage,\n namespaceId: string,\n options: ContractToSchemaIROptions,\n): SqlSchemaIR {\n if (options.annotationNamespace.length === 0) {\n throw new Error('annotationNamespace must be a non-empty string');\n }\n const namespace = storage.namespaces[namespaceId];\n if (!namespace) {\n return { tables: {} };\n }\n const storageTypes: ResolvedStorageTypes = { ...(storage.types ?? {}) };\n const tables: Record<string, SqlTableIR> = {};\n for (const [tableName, tableDefRaw] of Object.entries(namespace.entries.table ?? {})) {\n StorageTable.assert(tableDefRaw, `namespaces.${namespaceId}.entries.table.${tableName}`);\n tables[tableName] = convertTable(\n tableName,\n tableDefRaw,\n storageTypes,\n options.expandNativeType,\n options.renderDefault,\n storage,\n );\n }\n return { tables };\n}\n\nexport function contractToSchemaIR(\n contract: Contract<SqlStorage> | null,\n options: ContractToSchemaIROptions,\n): SqlSchemaIR {\n if (options.annotationNamespace.length === 0) {\n throw new Error('annotationNamespace must be a non-empty string');\n }\n\n if (!contract) {\n return { tables: {} };\n }\n\n const storage = contract.storage;\n const storageTypes: ResolvedStorageTypes = { ...(storage.types ?? {}) };\n const tables: Record<string, SqlTableIR> = {};\n for (const ns of Object.values(storage.namespaces)) {\n for (const [tableName, tableDefRaw] of Object.entries(ns.entries.table ?? {})) {\n StorageTable.assert(tableDefRaw, `namespaces.${ns.id}.entries.table.${tableName}`);\n const tableDef = tableDefRaw;\n if (tables[tableName] !== undefined) {\n throw new Error(\n `contractToSchemaIR: duplicate SQL table name \"${tableName}\" across namespaces (ambiguous for flat SqlSchemaIR.tables).`,\n );\n }\n tables[tableName] = convertTable(\n tableName,\n tableDef,\n storageTypes,\n options.expandNativeType,\n options.renderDefault,\n storage,\n );\n }\n }\n\n const annotations = deriveAnnotations(\n storage,\n options.annotationNamespace,\n options.resolveEnumNamespaceSchema,\n );\n\n return {\n tables,\n ...ifDefined('annotations', annotations),\n };\n}\n\nfunction deriveAnnotations(\n storage: SqlStorage,\n annotationNamespace: string,\n _resolveEnumNamespaceSchema: EnumNamespaceSchemaResolver | undefined,\n): SqlAnnotations | undefined {\n const storageTypes: Record<string, StorageTypeInstance> = {};\n\n for (const typeInstance of Object.values(storage.types ?? {})) {\n if (isStorageTypeInstance(typeInstance)) {\n storageTypes[typeInstance.nativeType] = typeInstance;\n }\n }\n\n const envelope = {\n ...(Object.keys(storageTypes).length > 0 ? { storageTypes } : {}),\n };\n if (Object.keys(envelope).length === 0) return undefined;\n return { [annotationNamespace]: envelope };\n}\n"],"mappings":";;;;;AAMA,SAAS,qBAAqB,YAO5B;CACA,IAAI,OAAO,eAAe,YAAY,eAAe,MACnD,OAAO;CAGT,MAAM,QAAQA,WAAE,OAAO,YAAY;CACnC,OAAO,UAAU,QAAQ,UAAU,KAAA,KAAa,OAAO,UAAU;AACnE;AAEA,SAAgB,yBACd,aACgC;CAChC,MAAM,wBAAQ,IAAI,IAA+B;CACjD,MAAM,yBAAS,IAAI,IAAoB;CAEvC,KAAK,MAAM,cAAc,aAAa;EACpC,IAAI,OAAO,eAAe,YAAY,eAAe,MACnD;EAEF,IAAI,CAAC,qBAAqB,UAAU,GAClC;EAEF,MAAM,oBAAoB,WAAW,MAAM,WAAW;EACtD,KAAK,MAAM,CAAC,SAAS,SAAS,OAAO,QAAQ,iBAAiB,GAAG;GAC/D,uBAAuB;IACrB;IACA;IACA,cAAc,WAAW;IACzB,aAAa;IACb,sBAAsB;GACxB,CAAC;GACD,MAAM,IAAI,SAAS,IAAI;GACvB,OAAO,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AAI,QAAQ,SAAS,CAAC,EAAG;CACtE,MAAM,SAAqC,CAAC;CAC5C,KAAK,MAAM,MAAM,OAAO,OAAO,QAAQ,UAAU,GAC/C,KAAK,MAAM,CAAC,WAAW,gBAAgB,OAAO,QAAQ,GAAG,QAAQ,SAAS,CAAC,CAAC,GAAG;EAC7E,aAAa,OAAO,aAAa,cAAc,GAAG,GAAG,iBAAiB,WAAW;EACjF,MAAM,WAAW;EACjB,IAAI,OAAO,eAAe,KAAA,GACxB,MAAM,IAAI,MACR,iDAAiD,UAAU,6DAC7D;EAEF,OAAO,aAAa,aAClB,WACA,UACA,cACA,QAAQ,kBACR,QAAQ,eACR,OACF;CACF;CASF,OAAO;EACL;EACA,GAAG,UAAU,eARK,kBAClB,SACA,QAAQ,qBACR,QAAQ,0BAK8B,CAAC;CACzC;AACF;AAEA,SAAS,kBACP,SACA,qBACA,6BAC4B;CAC5B,MAAM,eAAoD,CAAC;CAE3D,KAAK,MAAM,gBAAgB,OAAO,OAAO,QAAQ,SAAS,CAAC,CAAC,GAC1D,IAAI,sBAAsB,YAAY,GACpC,aAAa,aAAa,cAAc;CAI5C,MAAM,WAAW,EACf,GAAI,OAAO,KAAK,YAAY,CAAC,CAAC,SAAS,IAAI,EAAE,aAAa,IAAI,CAAC,EACjE;CACA,IAAI,OAAO,KAAK,QAAQ,CAAC,CAAC,WAAW,GAAG,OAAO,KAAA;CAC/C,OAAO,GAAG,sBAAsB,SAAS;AAC3C"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { n as NativeTypeNormalizer, t as DefaultNormalizer } from "./
|
|
2
|
-
import {
|
|
3
|
-
import { ControlAdapterInstance, ControlStack
|
|
4
|
-
import { SqlControlDriverInstance
|
|
1
|
+
import { n as NativeTypeNormalizer, t as DefaultNormalizer } from "./sql-schema-diff-6z36dZt6.mjs";
|
|
2
|
+
import { ContractMarkerRecord, LedgerEntryRecord } from "@prisma-next/contract/types";
|
|
3
|
+
import { ControlAdapterInstance, ControlStack } from "@prisma-next/framework-components/control";
|
|
4
|
+
import { SqlControlDriverInstance } from "@prisma-next/sql-contract/types";
|
|
5
5
|
import { AnyQueryAst, DdlNode, LoweredStatement, LowererContext, SqlExecuteRequest } from "@prisma-next/sql-relational-core/ast";
|
|
6
|
-
import {
|
|
6
|
+
import { SqlSchemaIRNode } from "@prisma-next/sql-schema-ir/types";
|
|
7
7
|
|
|
8
8
|
//#region src/core/control-adapter.d.ts
|
|
9
9
|
/**
|
|
@@ -110,18 +110,23 @@ interface SqlControlAdapter<TTarget extends string = string> extends ControlAdap
|
|
|
110
110
|
readonly operations: readonly unknown[];
|
|
111
111
|
}): Promise<void>;
|
|
112
112
|
/**
|
|
113
|
-
* Introspects a database schema and returns
|
|
113
|
+
* Introspects a database schema and returns the target's schema-IR node.
|
|
114
114
|
*
|
|
115
115
|
* This is a pure schema discovery operation that queries the database catalog
|
|
116
116
|
* and returns the schema structure without type mapping or contract enrichment.
|
|
117
117
|
* Type mapping and enrichment are handled separately by enrichment helpers.
|
|
118
118
|
*
|
|
119
|
+
* The return type is the family-base `SqlSchemaIRNode` so each target returns
|
|
120
|
+
* its own node shape: SQLite returns a flat `SqlSchemaIR`, Postgres returns a
|
|
121
|
+
* `PostgresDatabaseSchemaNode` tree root. Consumers `ensure` the concrete
|
|
122
|
+
* target type before walking it.
|
|
123
|
+
*
|
|
119
124
|
* @param driver - ControlDriverInstance instance for executing queries (target-specific)
|
|
120
125
|
* @param contract - Optional contract for contract-guided introspection (filtering, optimization)
|
|
121
126
|
* @param schema - Schema name to introspect (defaults to 'public')
|
|
122
|
-
* @returns Promise resolving to
|
|
127
|
+
* @returns Promise resolving to the live database schema node
|
|
123
128
|
*/
|
|
124
|
-
introspect(driver: SqlControlDriverInstance<TTarget>, contract?: unknown, schema?: string): Promise<
|
|
129
|
+
introspect(driver: SqlControlDriverInstance<TTarget>, contract?: unknown, schema?: string): Promise<SqlSchemaIRNode>;
|
|
125
130
|
/**
|
|
126
131
|
* Optional target-specific normalizer for raw database default expressions.
|
|
127
132
|
* When provided, schema defaults (raw strings) are normalized before comparison
|
|
@@ -134,14 +139,6 @@ interface SqlControlAdapter<TTarget extends string = string> extends ControlAdap
|
|
|
134
139
|
* before comparison with contract native types during schema verification.
|
|
135
140
|
*/
|
|
136
141
|
readonly normalizeNativeType?: NativeTypeNormalizer;
|
|
137
|
-
/**
|
|
138
|
-
* Optional hook for collecting target-specific diff issues during schema
|
|
139
|
-
* verification. Called after the relational SQL verification pass; returns
|
|
140
|
-
* generic `SchemaDiffIssue[]` (coordinate + outcome + message — no target
|
|
141
|
-
* naming) that are folded into `VerifyDatabaseSchemaResult.schema.schemaDiffIssues`
|
|
142
|
-
* and counted as failures when non-empty.
|
|
143
|
-
*/
|
|
144
|
-
collectSchemaDiffIssues?(contract: Contract<SqlStorage>, schema: SqlSchemaIR): readonly SchemaDiffIssue[];
|
|
145
142
|
/**
|
|
146
143
|
* Ordered DDL queries that bootstrap marker/ledger control tables for migration
|
|
147
144
|
* runners. Postgres includes `CREATE SCHEMA`; SQLite does not.
|
|
@@ -170,4 +167,4 @@ interface SqlControlAdapterDescriptor<TTarget extends string = string> {
|
|
|
170
167
|
}
|
|
171
168
|
//#endregion
|
|
172
169
|
export { SqlControlAdapterDescriptor as i, Lowerer as n, SqlControlAdapter as r, ExecuteRequestLowerer as t };
|
|
173
|
-
//# sourceMappingURL=control-adapter-
|
|
170
|
+
//# sourceMappingURL=control-adapter-DHYFuOBy.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control-adapter-
|
|
1
|
+
{"version":3,"file":"control-adapter-DHYFuOBy.d.mts","names":[],"sources":["../src/core/control-adapter.ts"],"mappings":";;;;;;;;;;AAuBA;;;;;UAAiB,OAAA;EACf,KAAA,CAAM,GAAA,EAAK,WAAA,GAAc,OAAA,EAAS,OAAA,EAAS,cAAA,YAA0B,gBAAA;AAAA;;;;;;;UAStD,qBAAA,SAA8B,OAAA;EAC7C,qBAAA,CACE,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,wBAAA,CAAyB,OAAA,GACjC,QAAA,YACA,MAAA,YACC,OAAA,CAAQ,eAAA;EAnET;;;;;EAAA,SA0EO,gBAAA,GAAmB,iBAAA;EAnEzB;;;;;EAAA,SA0EM,mBAAA,GAAsB,oBAAA;EA9D7B;;;;EAoEF,4BAAA,aAAyC,OAAA;EA9DtC;;;;EAoEH,0BAAA,aAAuC,OAAA;AAAA;;;;;;;UASxB,2BAAA;EA1DZ;;;;;;EAiEH,MAAA,CAAO,KAAA,EAAO,YAAA,QAAoB,OAAA,IAAW,iBAAA,CAAkB,OAAA;AAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as SqlControlAdapterDescriptor, n as Lowerer, r as SqlControlAdapter, t as ExecuteRequestLowerer } from "./control-adapter-
|
|
1
|
+
import { i as SqlControlAdapterDescriptor, n as Lowerer, r as SqlControlAdapter, t as ExecuteRequestLowerer } from "./control-adapter-DHYFuOBy.mjs";
|
|
2
2
|
export type { ExecuteRequestLowerer, Lowerer, SqlControlAdapter, SqlControlAdapterDescriptor };
|
package/dist/control.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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-
|
|
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";
|
|
2
2
|
import { ColumnDefault, Contract, ControlPolicy } from "@prisma-next/contract/types";
|
|
3
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
4
|
import { SqlStorage, StorageColumn } from "@prisma-next/sql-contract/types";
|
|
@@ -339,6 +339,21 @@ interface ContractToSchemaIROptions {
|
|
|
339
339
|
*
|
|
340
340
|
* Returns an empty schema IR when `contract` is `null` (new project).
|
|
341
341
|
*/
|
|
342
|
+
/**
|
|
343
|
+
* Converts the tables of a single namespace into a `SqlSchemaIR`, keyed by
|
|
344
|
+
* table name within that namespace. Unlike {@link contractToSchemaIR}, which
|
|
345
|
+
* flattens every namespace's tables into one bare-keyed record (and throws on a
|
|
346
|
+
* cross-namespace name collision), this scopes the table iteration to one
|
|
347
|
+
* namespace so the same table name can exist in two schemas.
|
|
348
|
+
*
|
|
349
|
+
* The full `storage` is still passed to `convertTable`, so value-set / enum /
|
|
350
|
+
* type resolution that legitimately spans namespaces is unaffected. Foreign
|
|
351
|
+
* keys are built purely from the FK descriptor (`fk.target`), so cross-namespace
|
|
352
|
+
* FKs survive per-namespace conversion. The `annotations` block (storage-type
|
|
353
|
+
* derived) is omitted here — the per-namespace tree consumer reads only the
|
|
354
|
+
* per-table fields.
|
|
355
|
+
*/
|
|
356
|
+
declare function contractNamespaceToSchemaIR(storage: SqlStorage, namespaceId: string, options: ContractToSchemaIROptions): SqlSchemaIR;
|
|
342
357
|
declare function contractToSchemaIR(contract: Contract<SqlStorage> | null, options: ContractToSchemaIROptions): SqlSchemaIR;
|
|
343
358
|
//#endregion
|
|
344
359
|
//#region src/core/migrations/control-policy.d.ts
|
|
@@ -564,5 +579,5 @@ declare function temporalAuthoringPresets<const CodecId extends string, const Na
|
|
|
564
579
|
//#region src/exports/control.d.ts
|
|
565
580
|
declare const _default: SqlFamilyDescriptor;
|
|
566
581
|
//#endregion
|
|
567
|
-
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, contractToSchemaIR, controlPolicyForCall, createMigrationPlan, _default as default, detectDestructiveChanges, extractCodecControlHooks, partitionCallsByControlPolicy, partitionIssuesByControlPolicy, planFieldEventOperations, plannerFailure, plannerSuccess, resolveValueSetValues, runnerFailure, runnerSuccess, temporalAuthoringPresets, timestampNowControlDescriptor };
|
|
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 };
|
|
568
583
|
//# sourceMappingURL=control.d.mts.map
|
package/dist/control.d.mts.map
CHANGED
|
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOT,MAAA,2BACE,KAAA,EAAO,YAAA,QAAoB,SAAA,IAC1B,wBAAA;AAAA;;;iBCNW,wBAAA,CACd,WAAA,EAAa,aAAA,CAAc,8BAAA,mBAC1B,GAAA,SAAY,iBAAA;;;;;;;;;ADbf;;;;
|
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOT,MAAA,2BACE,KAAA,EAAO,YAAA,QAAoB,SAAA,IAC1B,wBAAA;AAAA;;;iBCNW,wBAAA,CACd,WAAA,EAAa,aAAA,CAAc,8BAAA,mBAC1B,GAAA,SAAY,iBAAA;;;;;;;;;ADbf;;;;KEyBY,kBAAA,IAAsB,KAAA;EAAA,SACvB,UAAA;EAAA,SACA,OAAA;EAAA,SACA,UAAA,GAAa,MAAM;AAAA;;;;;;;;;;KAYlB,eAAA,IAAmB,GAAA,EAAK,aAAA,EAA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