@prisma-next/family-sql 0.5.0-dev.6 → 0.5.0-dev.60
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/README.md +2 -2
- package/dist/{authoring-type-constructors-BAR65pSK.mjs → authoring-type-constructors-D9b8AG6y.mjs} +13 -13
- package/dist/authoring-type-constructors-D9b8AG6y.mjs.map +1 -0
- package/dist/control-adapter.d.mts +12 -1
- package/dist/control-adapter.d.mts.map +1 -1
- package/dist/control.d.mts +97 -27
- package/dist/control.d.mts.map +1 -1
- package/dist/control.mjs +1030 -13
- package/dist/control.mjs.map +1 -1
- package/dist/migration.d.mts +22 -23
- package/dist/migration.d.mts.map +1 -1
- package/dist/migration.mjs +24 -22
- package/dist/migration.mjs.map +1 -1
- package/dist/pack.d.mts +35 -23
- package/dist/pack.mjs +1 -1
- package/dist/runtime.d.mts +19 -1
- package/dist/runtime.d.mts.map +1 -1
- package/dist/runtime.mjs +27 -1
- package/dist/runtime.mjs.map +1 -1
- package/dist/schema-verify.d.mts +2 -2
- package/dist/timestamp-now-generator-Bt4L3cfM.mjs +86 -0
- package/dist/timestamp-now-generator-Bt4L3cfM.mjs.map +1 -0
- package/dist/{types-C6K4mxDM.d.mts → types-DiBtjG6M.d.mts} +46 -22
- package/dist/types-DiBtjG6M.d.mts.map +1 -0
- package/dist/verify-BdES8wgQ.mjs +82 -0
- package/dist/verify-BdES8wgQ.mjs.map +1 -0
- package/dist/{verify-sql-schema-BBhkqEDo.d.mts → verify-sql-schema-DW8Agf1F.d.mts} +2 -2
- package/dist/{verify-sql-schema-BBhkqEDo.d.mts.map → verify-sql-schema-DW8Agf1F.d.mts.map} +1 -1
- package/dist/verify-sql-schema-Ovz7RXR5.mjs.map +1 -1
- package/dist/verify.d.mts +16 -20
- package/dist/verify.d.mts.map +1 -1
- package/dist/verify.mjs +2 -2
- package/package.json +19 -18
- package/src/core/authoring-field-presets.ts +35 -23
- package/src/core/control-adapter.ts +12 -0
- package/src/core/control-instance.ts +43 -15
- package/src/core/migrations/plan-helpers.ts +3 -0
- package/src/core/migrations/types.ts +38 -20
- package/src/core/operation-preview.ts +62 -0
- package/src/core/psl-contract-infer/default-mapping.ts +56 -0
- package/src/core/psl-contract-infer/name-transforms.ts +178 -0
- package/src/core/psl-contract-infer/postgres-default-mapping.ts +16 -0
- package/src/core/psl-contract-infer/postgres-type-map.ts +165 -0
- package/src/core/psl-contract-infer/printer-config.ts +55 -0
- package/src/core/psl-contract-infer/raw-default-parser.ts +91 -0
- package/src/core/psl-contract-infer/relation-inference.ts +196 -0
- package/src/core/psl-contract-infer/sql-schema-ir-to-psl-ast.ts +832 -0
- package/src/core/sql-migration.ts +25 -23
- package/src/core/timestamp-now-generator.ts +74 -0
- package/src/core/timestamp-now-runtime-generator.ts +24 -0
- package/src/core/verify.ts +46 -108
- package/src/exports/control.ts +4 -1
- package/src/exports/runtime.ts +2 -0
- package/src/exports/verify.ts +1 -1
- package/dist/authoring-type-constructors-BAR65pSK.mjs.map +0 -1
- package/dist/types-C6K4mxDM.d.mts.map +0 -1
- package/dist/verify-4GshvY4p.mjs +0 -122
- package/dist/verify-4GshvY4p.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -111,7 +111,7 @@ The descriptor is "pure data + factory" - it only provides the hook and factory
|
|
|
111
111
|
- **`src/core/control-descriptor.ts`**: `SqlFamilyDescriptor` class implementing `ControlFamilyDescriptor` interface (pure data + factory)
|
|
112
112
|
- **`src/core/control-instance.ts`**: `createSqlFamilyInstance` function that creates `SqlFamilyInstance` with domain action methods (`validateContract`, `verify`, `schemaVerify`, `introspect`, `toSchemaView`, `emitContract`). Contains `convertOperationManifest` function used internally by instance creation and test utilities in the same package.
|
|
113
113
|
- **`src/core/assembly.ts`**: Assembly helpers for extracting type imports, collecting codec-owned storage type control hooks, and composing mutation-default registries with duplicate detection.
|
|
114
|
-
- **`src/core/verify.ts`**: Verification helpers (`
|
|
114
|
+
- **`src/core/verify.ts`**: Verification helpers (`parseContractMarkerRow`, `collectSupportedCodecTypeIds`)
|
|
115
115
|
- **`src/core/control-adapter.ts`**: SQL control adapter interface (`SqlControlAdapter`) for control-plane operations
|
|
116
116
|
- **`src/core/migrations/`**: Migration IR helpers plus planner and runner SPI types (`MigrationPlanner`, `MigrationRunner`, `SqlControlTargetDescriptor`). Runners return `MigrationRunnerResult` which is a union of success/failure.
|
|
117
117
|
- **`src/core/migrations/contract-to-schema-ir.ts`**: `contractToSchemaIR(contract, { annotationNamespace, ... })` converts a contract to `SqlSchemaIR` for offline migration planning (used by `migration plan` to synthesize the "from" schema without a database connection). Also exports `detectDestructiveChanges(from, to)` which compares two `SqlStorage` values and returns a list of destructive changes (dropped tables, dropped columns) for migration policy enforcement.
|
|
@@ -135,7 +135,7 @@ The runner returns structured errors with the following codes:
|
|
|
135
135
|
- **`./control`**: Control plane entry point for CLI/config usage (exports `SqlFamilyDescriptor`)
|
|
136
136
|
- **`./control-adapter`**: SQL control adapter interface (`SqlControlAdapter`, `SqlControlAdapterDescriptor`) for target-specific adapters
|
|
137
137
|
- **`./runtime`**: Runtime plane identity exports only (family ID, types, descriptor identity). Does **not** export runtime creation helpers—use `instantiateExecutionStack` from `@prisma-next/framework-components/execution` and `createExecutionContext`, `createRuntime`, `createSqlExecutionStack` from `@prisma-next/sql-runtime`. See [ADR 152](../../../docs/architecture%20docs/adrs/ADR%20152%20-%20Execution%20Plane%20Descriptors%20and%20Instances.md).
|
|
138
|
-
- **`./verify`**:
|
|
138
|
+
- **`./verify`**: Marker row parsing helper (`parseContractMarkerRow`). Marker reads are owned by each `SqlControlAdapter` (e.g. `PostgresControlAdapter.readMarker`) so dialect-specific SQL stays target-local.
|
|
139
139
|
|
|
140
140
|
## Dependencies
|
|
141
141
|
|
package/dist/{authoring-type-constructors-BAR65pSK.mjs → authoring-type-constructors-D9b8AG6y.mjs}
RENAMED
|
@@ -81,10 +81,10 @@ const sqlFamilyAuthoringFieldPresets = {
|
|
|
81
81
|
codecId: CHARACTER_CODEC_ID,
|
|
82
82
|
nativeType: CHARACTER_NATIVE_TYPE,
|
|
83
83
|
typeParams: { length: 36 },
|
|
84
|
-
|
|
84
|
+
executionDefaults: { onCreate: {
|
|
85
85
|
kind: "generator",
|
|
86
86
|
id: "uuidv4"
|
|
87
|
-
},
|
|
87
|
+
} },
|
|
88
88
|
id: true
|
|
89
89
|
}
|
|
90
90
|
},
|
|
@@ -94,10 +94,10 @@ const sqlFamilyAuthoringFieldPresets = {
|
|
|
94
94
|
codecId: CHARACTER_CODEC_ID,
|
|
95
95
|
nativeType: CHARACTER_NATIVE_TYPE,
|
|
96
96
|
typeParams: { length: 36 },
|
|
97
|
-
|
|
97
|
+
executionDefaults: { onCreate: {
|
|
98
98
|
kind: "generator",
|
|
99
99
|
id: "uuidv7"
|
|
100
|
-
},
|
|
100
|
+
} },
|
|
101
101
|
id: true
|
|
102
102
|
}
|
|
103
103
|
},
|
|
@@ -107,10 +107,10 @@ const sqlFamilyAuthoringFieldPresets = {
|
|
|
107
107
|
codecId: CHARACTER_CODEC_ID,
|
|
108
108
|
nativeType: CHARACTER_NATIVE_TYPE,
|
|
109
109
|
typeParams: { length: 26 },
|
|
110
|
-
|
|
110
|
+
executionDefaults: { onCreate: {
|
|
111
111
|
kind: "generator",
|
|
112
112
|
id: "ulid"
|
|
113
|
-
},
|
|
113
|
+
} },
|
|
114
114
|
id: true
|
|
115
115
|
}
|
|
116
116
|
},
|
|
@@ -126,7 +126,7 @@ const sqlFamilyAuthoringFieldPresets = {
|
|
|
126
126
|
path: ["size"],
|
|
127
127
|
default: 21
|
|
128
128
|
} },
|
|
129
|
-
|
|
129
|
+
executionDefaults: { onCreate: {
|
|
130
130
|
kind: "generator",
|
|
131
131
|
id: "nanoid",
|
|
132
132
|
params: { size: {
|
|
@@ -134,7 +134,7 @@ const sqlFamilyAuthoringFieldPresets = {
|
|
|
134
134
|
index: 0,
|
|
135
135
|
path: ["size"]
|
|
136
136
|
} }
|
|
137
|
-
},
|
|
137
|
+
} },
|
|
138
138
|
id: true
|
|
139
139
|
}
|
|
140
140
|
},
|
|
@@ -144,10 +144,10 @@ const sqlFamilyAuthoringFieldPresets = {
|
|
|
144
144
|
codecId: CHARACTER_CODEC_ID,
|
|
145
145
|
nativeType: CHARACTER_NATIVE_TYPE,
|
|
146
146
|
typeParams: { length: 24 },
|
|
147
|
-
|
|
147
|
+
executionDefaults: { onCreate: {
|
|
148
148
|
kind: "generator",
|
|
149
149
|
id: "cuid2"
|
|
150
|
-
},
|
|
150
|
+
} },
|
|
151
151
|
id: true
|
|
152
152
|
}
|
|
153
153
|
},
|
|
@@ -157,10 +157,10 @@ const sqlFamilyAuthoringFieldPresets = {
|
|
|
157
157
|
codecId: CHARACTER_CODEC_ID,
|
|
158
158
|
nativeType: CHARACTER_NATIVE_TYPE,
|
|
159
159
|
typeParams: { length: 27 },
|
|
160
|
-
|
|
160
|
+
executionDefaults: { onCreate: {
|
|
161
161
|
kind: "generator",
|
|
162
162
|
id: "ksuid"
|
|
163
|
-
},
|
|
163
|
+
} },
|
|
164
164
|
id: true
|
|
165
165
|
}
|
|
166
166
|
}
|
|
@@ -190,4 +190,4 @@ const sqlFamilyAuthoringTypes = { sql: { String: {
|
|
|
190
190
|
|
|
191
191
|
//#endregion
|
|
192
192
|
export { sqlFamilyAuthoringFieldPresets as n, sqlFamilyAuthoringTypes as t };
|
|
193
|
-
//# sourceMappingURL=authoring-type-constructors-
|
|
193
|
+
//# sourceMappingURL=authoring-type-constructors-D9b8AG6y.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authoring-type-constructors-D9b8AG6y.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;EACV,EACF;CACF;AAED,MAAa,iCAAiC;CAC5C,MAAM;EACJ,MAAM;EACN,QAAQ;GACN,SAAS;GACT,YAAY;GACZ,YAAY,EACV,QAAQ,IACT;GACF;EACF;CACD,MAAM;EACJ,MAAM;EACN,QAAQ;GACN,SAAS;GACT,YAAY;GACZ,YAAY,EACV,QAAQ,IACT;GACF;EACF;CACD,QAAQ;EACN,MAAM;EACN,MAAM,CAAC,sBAAsB;EAC7B,QAAQ;GACN,SAAS;GACT,YAAY;GACZ,YAAY,EACV,QAAQ;IACN,MAAM;IACN,OAAO;IACP,MAAM,CAAC,OAAO;IACd,SAAS;IACV,EACF;GACF;EACF;CACD,OAAO;EACL,MAAM;EACN,QAAQ;GACN,SAAS;GACT,YAAY;GACZ,YAAY,EACV,QAAQ,IACT;GACF;EACF;CACD,OAAO;EACL,MAAM;EACN,QAAQ;GACN,SAAS;GACT,YAAY;GACZ,YAAY,EACV,QAAQ,IACT;GACF;EACF;CACD,IAAI;EACF,QAAQ;GACN,MAAM;GACN,QAAQ;IACN,SAAS;IACT,YAAY;IACZ,YAAY,EACV,QAAQ,IACT;IACD,mBAAmB,EACjB,UAAU;KACR,MAAM;KACN,IAAI;KACL,EACF;IACD,IAAI;IACL;GACF;EACD,QAAQ;GACN,MAAM;GACN,QAAQ;IACN,SAAS;IACT,YAAY;IACZ,YAAY,EACV,QAAQ,IACT;IACD,mBAAmB,EACjB,UAAU;KACR,MAAM;KACN,IAAI;KACL,EACF;IACD,IAAI;IACL;GACF;EACD,MAAM;GACJ,MAAM;GACN,QAAQ;IACN,SAAS;IACT,YAAY;IACZ,YAAY,EACV,QAAQ,IACT;IACD,mBAAmB,EACjB,UAAU;KACR,MAAM;KACN,IAAI;KACL,EACF;IACD,IAAI;IACL;GACF;EACD,QAAQ;GACN,MAAM;GACN,MAAM,CAAC,sBAAsB;GAC7B,QAAQ;IACN,SAAS;IACT,YAAY;IACZ,YAAY,EACV,QAAQ;KACN,MAAM;KACN,OAAO;KACP,MAAM,CAAC,OAAO;KACd,SAAS;KACV,EACF;IACD,mBAAmB,EACjB,UAAU;KACR,MAAM;KACN,IAAI;KACJ,QAAQ,EACN,MAAM;MACJ,MAAM;MACN,OAAO;MACP,MAAM,CAAC,OAAO;MACf,EACF;KACF,EACF;IACD,IAAI;IACL;GACF;EACD,OAAO;GACL,MAAM;GACN,QAAQ;IACN,SAAS;IACT,YAAY;IACZ,YAAY,EACV,QAAQ,IACT;IACD,mBAAmB,EACjB,UAAU;KACR,MAAM;KACN,IAAI;KACL,EACF;IACD,IAAI;IACL;GACF;EACD,OAAO;GACL,MAAM;GACN,QAAQ;IACN,SAAS;IACT,YAAY;IACZ,YAAY,EACV,QAAQ,IACT;IACD,mBAAmB,EACjB,UAAU;KACR,MAAM;KACN,IAAI;KACL,EACF;IACD,IAAI;IACL;GACF;EACF;CACF;;;;AC/MD,MAAa,0BAA0B,EACrC,KAAK,EACH,QAAQ;CACN,MAAM;CACN,MAAM,CAAC;EAAE,MAAM;EAAU,MAAM;EAAU,SAAS;EAAM,SAAS;EAAG,SAAS;EAAU,CAAC;CACxF,QAAQ;EACN,SAAS;EACT,YAAY;EACZ,YAAY,EACV,QAAQ;GAAE,MAAM;GAAO,OAAO;GAAG,EAClC;EACF;CACF,EACF,EACF"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { n as NativeTypeNormalizer, t as DefaultNormalizer } from "./verify-sql-schema-
|
|
1
|
+
import { n as NativeTypeNormalizer, t as DefaultNormalizer } from "./verify-sql-schema-DW8Agf1F.mjs";
|
|
2
2
|
import { ControlAdapterInstance, ControlDriverInstance, ControlStack } from "@prisma-next/framework-components/control";
|
|
3
|
+
import { ContractMarkerRecord } from "@prisma-next/contract/types";
|
|
3
4
|
import { AnyQueryAst, LoweredStatement, LowererContext } from "@prisma-next/sql-relational-core/ast";
|
|
4
5
|
import { SqlSchemaIR } from "@prisma-next/sql-schema-ir/types";
|
|
5
6
|
|
|
@@ -12,6 +13,16 @@ import { SqlSchemaIR } from "@prisma-next/sql-schema-ir/types";
|
|
|
12
13
|
* @template TTarget - The target ID (e.g., 'postgres', 'mysql')
|
|
13
14
|
*/
|
|
14
15
|
interface SqlControlAdapter<TTarget extends string = string> extends ControlAdapterInstance<'sql', TTarget> {
|
|
16
|
+
/**
|
|
17
|
+
* Reads the contract marker from the database, returning `null` if the marker
|
|
18
|
+
* table or its row is missing. Implementations are responsible for the
|
|
19
|
+
* dialect-specific existence probe (e.g. Postgres `information_schema.tables`
|
|
20
|
+
* vs SQLite `sqlite_master`) and parameter placeholders.
|
|
21
|
+
*
|
|
22
|
+
* @param driver - ControlDriverInstance for executing queries (target-specific)
|
|
23
|
+
* @returns Resolved marker record, or `null` if not yet stamped.
|
|
24
|
+
*/
|
|
25
|
+
readMarker(driver: ControlDriverInstance<'sql', TTarget>): Promise<ContractMarkerRecord | null>;
|
|
15
26
|
/**
|
|
16
27
|
* Introspects a database schema and returns a raw SqlSchemaIR.
|
|
17
28
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"control-adapter.d.mts","names":[],"sources":["../src/core/control-adapter.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"control-adapter.d.mts","names":[],"sources":["../src/core/control-adapter.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;AAoBA;;;;AAWqE,UAXpD,iBAWoD,CAAA,gBAAA,MAAA,GAAA,MAAA,CAAA,SAV3D,sBAU2D,CAAA,KAAA,EAV7B,OAU6B,CAAA,CAAA;EAAR;;;;;;;;;EA2CA,UAAA,CAAA,MAAA,EA3CxC,qBA2CwC,CAAA,KAAA,EA3CX,OA2CW,CAAA,CAAA,EA3CA,OA2CA,CA3CQ,oBA2CR,GAAA,IAAA,CAAA;EArDnD;;AA8DV;;;;;;;;;;qBArCY,6BAA6B,gDAGpC,QAAQ;;;;;;8BAOiB;;;;;;iCAOG;;;;;;;;;;aAWpB,sBAAsB,0BAA0B;;;;;;;;UAS5C;;;;;;;gBAOD,oBAAoB,WAAW,kBAAkB"}
|
package/dist/control.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
import { ControlFamilyDescriptor, ControlStack, MigrationOperationClass, MigrationOperationPolicy, MigrationOperationPolicy as MigrationOperationPolicy$1, MigrationPlan, MigrationPlanOperation, MigrationPlanner, MigrationPlannerConflict, MigrationPlannerConflict as MigrationPlannerConflict$1, MigrationPlannerResult, TargetMigrationsCapability, assembleAuthoringContributions } from "@prisma-next/framework-components/control";
|
|
1
|
+
import { A as SqlPlannerResult, C as SqlMigrationRunnerResult, D as SqlPlannerConflictKind, E as SqlPlannerConflict, F as SchemaVerifyOptions, I as SqlControlFamilyInstance, M as StorageTypePlanResult, N as collectInitDependencies, O as SqlPlannerConflictLocation, P as isDatabaseDependencyProvider, S as SqlMigrationRunnerFailure, T as SqlPlanTargetDetails, _ as SqlMigrationPlannerPlanOptions, a as CreateSqlMigrationPlanOptions, b as SqlMigrationRunnerExecuteCallbacks, c as SqlControlAdapterDescriptor, d as SqlMigrationPlan, f as SqlMigrationPlanContractInfo, g as SqlMigrationPlanner, h as SqlMigrationPlanOperationTarget, i as ComponentDatabaseDependency, j as SqlPlannerSuccessResult, k as SqlPlannerFailureResult, l as SqlControlExtensionDescriptor, m as SqlMigrationPlanOperationStep, n as CodecControlHooks, o as ExpandNativeTypeInput, p as SqlMigrationPlanOperation, r as ComponentDatabaseDependencies, s as ResolveIdentityValueInput, t as AnyRecord, u as SqlControlTargetDescriptor, v as SqlMigrationRunner, w as SqlMigrationRunnerSuccessValue, x as SqlMigrationRunnerExecuteOptions, y as SqlMigrationRunnerErrorCode } from "./types-DiBtjG6M.mjs";
|
|
2
|
+
import { ControlFamilyDescriptor, ControlStack, MigrationOperationClass, MigrationOperationPolicy, MigrationOperationPolicy as MigrationOperationPolicy$1, MigrationPlan, MigrationPlanOperation, MigrationPlanner, MigrationPlannerConflict, MigrationPlannerConflict as MigrationPlannerConflict$1, MigrationPlannerResult, MutationDefaultGeneratorDescriptor, TargetMigrationsCapability, assembleAuthoringContributions } from "@prisma-next/framework-components/control";
|
|
3
3
|
import { NotOk, Ok } from "@prisma-next/utils/result";
|
|
4
|
-
import { SqlSchemaIR } from "@prisma-next/sql-schema-ir/types";
|
|
5
4
|
import * as _prisma_next_contract_types0 from "@prisma-next/contract/types";
|
|
6
5
|
import { ColumnDefault, Contract } from "@prisma-next/contract/types";
|
|
6
|
+
import { SqlSchemaIR } from "@prisma-next/sql-schema-ir/types";
|
|
7
7
|
import { TargetBoundComponentDescriptor } from "@prisma-next/framework-components/components";
|
|
8
8
|
import { SqlStorage, StorageColumn } from "@prisma-next/sql-contract/types";
|
|
9
9
|
import * as _prisma_next_framework_components_emission0 from "@prisma-next/framework-components/emission";
|
|
@@ -20,6 +20,7 @@ declare class SqlFamilyDescriptor implements ControlFamilyDescriptor<'sql', SqlC
|
|
|
20
20
|
readonly validateStructure: (contract: _prisma_next_contract_types0.Contract) => void;
|
|
21
21
|
readonly generateStorageType: (contract: _prisma_next_contract_types0.Contract, storageHashTypeName: string) => string;
|
|
22
22
|
readonly generateModelStorageType: (_modelName: string, model: _prisma_next_contract_types0.ContractModel) => string;
|
|
23
|
+
readonly resolveFieldTypeParams: (_modelName: string, fieldName: string, model: _prisma_next_contract_types0.ContractModel, contract: _prisma_next_contract_types0.Contract) => Record<string, unknown> | undefined;
|
|
23
24
|
readonly getFamilyImports: () => string[];
|
|
24
25
|
readonly getFamilyTypeAliases: (options?: _prisma_next_framework_components_emission0.GenerateContractTypesOptions) => string;
|
|
25
26
|
readonly getTypeMapsExpression: () => string;
|
|
@@ -104,9 +105,11 @@ declare class SqlFamilyDescriptor implements ControlFamilyDescriptor<'sql', SqlC
|
|
|
104
105
|
readonly typeParams: {
|
|
105
106
|
readonly length: 36;
|
|
106
107
|
};
|
|
107
|
-
readonly
|
|
108
|
-
readonly
|
|
109
|
-
|
|
108
|
+
readonly executionDefaults: {
|
|
109
|
+
readonly onCreate: {
|
|
110
|
+
readonly kind: "generator";
|
|
111
|
+
readonly id: "uuidv4";
|
|
112
|
+
};
|
|
110
113
|
};
|
|
111
114
|
readonly id: true;
|
|
112
115
|
};
|
|
@@ -119,9 +122,11 @@ declare class SqlFamilyDescriptor implements ControlFamilyDescriptor<'sql', SqlC
|
|
|
119
122
|
readonly typeParams: {
|
|
120
123
|
readonly length: 36;
|
|
121
124
|
};
|
|
122
|
-
readonly
|
|
123
|
-
readonly
|
|
124
|
-
|
|
125
|
+
readonly executionDefaults: {
|
|
126
|
+
readonly onCreate: {
|
|
127
|
+
readonly kind: "generator";
|
|
128
|
+
readonly id: "uuidv7";
|
|
129
|
+
};
|
|
125
130
|
};
|
|
126
131
|
readonly id: true;
|
|
127
132
|
};
|
|
@@ -134,9 +139,11 @@ declare class SqlFamilyDescriptor implements ControlFamilyDescriptor<'sql', SqlC
|
|
|
134
139
|
readonly typeParams: {
|
|
135
140
|
readonly length: 26;
|
|
136
141
|
};
|
|
137
|
-
readonly
|
|
138
|
-
readonly
|
|
139
|
-
|
|
142
|
+
readonly executionDefaults: {
|
|
143
|
+
readonly onCreate: {
|
|
144
|
+
readonly kind: "generator";
|
|
145
|
+
readonly id: "ulid";
|
|
146
|
+
};
|
|
140
147
|
};
|
|
141
148
|
readonly id: true;
|
|
142
149
|
};
|
|
@@ -167,14 +174,16 @@ declare class SqlFamilyDescriptor implements ControlFamilyDescriptor<'sql', SqlC
|
|
|
167
174
|
readonly default: 21;
|
|
168
175
|
};
|
|
169
176
|
};
|
|
170
|
-
readonly
|
|
171
|
-
readonly
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
readonly
|
|
175
|
-
readonly
|
|
176
|
-
|
|
177
|
-
|
|
177
|
+
readonly executionDefaults: {
|
|
178
|
+
readonly onCreate: {
|
|
179
|
+
readonly kind: "generator";
|
|
180
|
+
readonly id: "nanoid";
|
|
181
|
+
readonly params: {
|
|
182
|
+
readonly size: {
|
|
183
|
+
readonly kind: "arg";
|
|
184
|
+
readonly index: 0;
|
|
185
|
+
readonly path: readonly ["size"];
|
|
186
|
+
};
|
|
178
187
|
};
|
|
179
188
|
};
|
|
180
189
|
};
|
|
@@ -189,9 +198,11 @@ declare class SqlFamilyDescriptor implements ControlFamilyDescriptor<'sql', SqlC
|
|
|
189
198
|
readonly typeParams: {
|
|
190
199
|
readonly length: 24;
|
|
191
200
|
};
|
|
192
|
-
readonly
|
|
193
|
-
readonly
|
|
194
|
-
|
|
201
|
+
readonly executionDefaults: {
|
|
202
|
+
readonly onCreate: {
|
|
203
|
+
readonly kind: "generator";
|
|
204
|
+
readonly id: "cuid2";
|
|
205
|
+
};
|
|
195
206
|
};
|
|
196
207
|
readonly id: true;
|
|
197
208
|
};
|
|
@@ -204,9 +215,11 @@ declare class SqlFamilyDescriptor implements ControlFamilyDescriptor<'sql', SqlC
|
|
|
204
215
|
readonly typeParams: {
|
|
205
216
|
readonly length: 27;
|
|
206
217
|
};
|
|
207
|
-
readonly
|
|
208
|
-
readonly
|
|
209
|
-
|
|
218
|
+
readonly executionDefaults: {
|
|
219
|
+
readonly onCreate: {
|
|
220
|
+
readonly kind: "generator";
|
|
221
|
+
readonly id: "ksuid";
|
|
222
|
+
};
|
|
210
223
|
};
|
|
211
224
|
readonly id: true;
|
|
212
225
|
};
|
|
@@ -328,8 +341,65 @@ declare function runnerFailure(code: SqlMigrationRunnerErrorCode, summary: strin
|
|
|
328
341
|
*/
|
|
329
342
|
declare const INIT_ADDITIVE_POLICY: MigrationOperationPolicy$1;
|
|
330
343
|
//#endregion
|
|
344
|
+
//#region src/core/timestamp-now-generator.d.ts
|
|
345
|
+
/**
|
|
346
|
+
* Builds the canonical control-plane descriptor for the wall-clock-now
|
|
347
|
+
* mutation default generator. The descriptor's `id` and `buildPhases`
|
|
348
|
+
* are target-agnostic so PSL `temporal.updatedAt()` and TS
|
|
349
|
+
* `field.temporal.updatedAt()` lower to byte-identical contracts.
|
|
350
|
+
*
|
|
351
|
+
* `applicableCodecIds` is omitted: `timestampNow` is preset-only (not
|
|
352
|
+
* reachable via `@default(timestampNow())` lowering), and the codec is
|
|
353
|
+
* co-registered by the preset descriptor itself, so the
|
|
354
|
+
* `@default(...)` compatibility check has no role to play here.
|
|
355
|
+
*/
|
|
356
|
+
declare function timestampNowControlDescriptor(): MutationDefaultGeneratorDescriptor;
|
|
357
|
+
/**
|
|
358
|
+
* Builds the canonical `temporal.{createdAt,updatedAt}` field-preset pair
|
|
359
|
+
* for a SQL target. `createdAt` lowers to a `now()` storage default;
|
|
360
|
+
* `updatedAt` lowers to the `timestampNow` execution generator on both
|
|
361
|
+
* `onCreate` and `onUpdate` (RD: "last modified time", non-null). Targets
|
|
362
|
+
* supply the codec/native-type pair that matches their timestamp column;
|
|
363
|
+
* everything else is shared so PSL `temporal.updatedAt()` and TS
|
|
364
|
+
* `field.temporal.updatedAt()` lower to byte-identical contracts across
|
|
365
|
+
* targets by construction.
|
|
366
|
+
*/
|
|
367
|
+
declare function temporalAuthoringPresets<const CodecId extends string, const NativeType extends string>(input: {
|
|
368
|
+
readonly codecId: CodecId;
|
|
369
|
+
readonly nativeType: NativeType;
|
|
370
|
+
}): {
|
|
371
|
+
readonly createdAt: {
|
|
372
|
+
readonly kind: "fieldPreset";
|
|
373
|
+
readonly output: {
|
|
374
|
+
readonly codecId: CodecId;
|
|
375
|
+
readonly nativeType: NativeType;
|
|
376
|
+
readonly default: {
|
|
377
|
+
readonly kind: "function";
|
|
378
|
+
readonly expression: "now()";
|
|
379
|
+
};
|
|
380
|
+
};
|
|
381
|
+
};
|
|
382
|
+
readonly updatedAt: {
|
|
383
|
+
readonly kind: "fieldPreset";
|
|
384
|
+
readonly output: {
|
|
385
|
+
readonly codecId: CodecId;
|
|
386
|
+
readonly nativeType: NativeType;
|
|
387
|
+
readonly executionDefaults: {
|
|
388
|
+
readonly onCreate: {
|
|
389
|
+
readonly kind: "generator";
|
|
390
|
+
readonly id: "timestampNow";
|
|
391
|
+
};
|
|
392
|
+
readonly onUpdate: {
|
|
393
|
+
readonly kind: "generator";
|
|
394
|
+
readonly id: "timestampNow";
|
|
395
|
+
};
|
|
396
|
+
};
|
|
397
|
+
};
|
|
398
|
+
};
|
|
399
|
+
};
|
|
400
|
+
//#endregion
|
|
331
401
|
//#region src/exports/control.d.ts
|
|
332
402
|
declare const _default: SqlFamilyDescriptor;
|
|
333
403
|
//#endregion
|
|
334
|
-
export { type
|
|
404
|
+
export { type CodecControlHooks, type ComponentDatabaseDependencies, type ComponentDatabaseDependency, type ContractToSchemaIROptions, type CreateSqlMigrationPlanOptions, type DefaultRenderer, type ExpandNativeTypeInput, INIT_ADDITIVE_POLICY, type MigrationOperationClass, type MigrationOperationPolicy, type MigrationPlan, type MigrationPlanOperation, type MigrationPlanner, type MigrationPlannerConflict, type MigrationPlannerResult, type NativeTypeExpander, type ResolveIdentityValueInput, type SchemaVerifyOptions, 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, collectInitDependencies, contractToSchemaIR, createMigrationPlan, _default as default, detectDestructiveChanges, extractCodecControlHooks, isDatabaseDependencyProvider, plannerFailure, plannerSuccess, runnerFailure, runnerSuccess, temporalAuthoringPresets, timestampNowControlDescriptor };
|
|
335
405
|
//# 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/plan-helpers.ts","../src/core/migrations/policies.ts","../src/exports/control.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;cASa,mBAAA,YACA,+BAA+B;;;;;;;uCAAwB,4BAAA,CAAA;;IADvD,SAAA,mBACX,EAAA,CAAA,QAAA,uCAAA,EAAA,mBAAA,EAAA,MAAA,EAAA,GAAA,MAAA;IAA0C,SAAA,wBAAA,EAAA,CAAA,UAAA,EAAA,MAAA,EAAA,KAAA,4CAAA,EAAA,GAAA,MAAA;IAAwB,SAAA,
|
|
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/plan-helpers.ts","../src/core/migrations/policies.ts","../src/core/timestamp-now-generator.ts","../src/exports/control.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;cASa,mBAAA,YACA,+BAA+B;;;;;;;uCAAwB,4BAAA,CAAA;;IADvD,SAAA,mBACX,EAAA,CAAA,QAAA,uCAAA,EAAA,mBAAA,EAAA,MAAA,EAAA,GAAA,MAAA;IAA0C,SAAA,wBAAA,EAAA,CAAA,UAAA,EAAA,MAAA,EAAA,KAAA,4CAAA,E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