@prisma-next/family-sql 0.5.0-dev.9 → 0.5.1
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 -3
- package/dist/{authoring-type-constructors-BAR65pSK.mjs → authoring-type-constructors-F4JpCJl7.mjs} +14 -15
- package/dist/authoring-type-constructors-F4JpCJl7.mjs.map +1 -0
- package/dist/control-adapter.d.mts +26 -2
- package/dist/control-adapter.d.mts.map +1 -1
- package/dist/control-adapter.mjs +1 -1
- package/dist/control.d.mts +125 -45
- package/dist/control.d.mts.map +1 -1
- package/dist/control.mjs +1174 -54
- package/dist/control.mjs.map +1 -1
- package/dist/migration.d.mts +22 -24
- package/dist/migration.d.mts.map +1 -1
- package/dist/migration.mjs +25 -24
- package/dist/migration.mjs.map +1 -1
- package/dist/pack.d.mts +35 -23
- package/dist/pack.d.mts.map +1 -1
- package/dist/pack.mjs +3 -5
- package/dist/pack.mjs.map +1 -1
- package/dist/runtime.d.mts +19 -2
- package/dist/runtime.d.mts.map +1 -1
- package/dist/runtime.mjs +26 -4
- package/dist/runtime.mjs.map +1 -1
- package/dist/schema-verify.d.mts +4 -15
- package/dist/schema-verify.d.mts.map +1 -1
- package/dist/schema-verify.mjs +2 -3
- package/dist/test-utils.d.mts +2 -2
- package/dist/test-utils.mjs +2 -3
- package/dist/timestamp-now-generator-BWp8S2sa.mjs +86 -0
- package/dist/timestamp-now-generator-BWp8S2sa.mjs.map +1 -0
- package/dist/types-mhjAPuMn.d.mts +470 -0
- package/dist/types-mhjAPuMn.d.mts.map +1 -0
- package/dist/verify-pRYxnpiG.mjs +81 -0
- package/dist/verify-pRYxnpiG.mjs.map +1 -0
- package/dist/{verify-sql-schema-Ovz7RXR5.mjs → verify-sql-schema-1tDh3x5x.mjs} +18 -72
- package/dist/verify-sql-schema-1tDh3x5x.mjs.map +1 -0
- package/dist/{verify-sql-schema-BBhkqEDo.d.mts → verify-sql-schema-CPHiuYHR.d.mts} +2 -3
- package/dist/verify-sql-schema-CPHiuYHR.d.mts.map +1 -0
- package/dist/verify.d.mts +16 -21
- package/dist/verify.d.mts.map +1 -1
- package/dist/verify.mjs +2 -3
- package/package.json +23 -21
- package/src/core/authoring-field-presets.ts +35 -23
- package/src/core/control-adapter.ts +32 -0
- package/src/core/control-descriptor.ts +2 -1
- package/src/core/control-instance.ts +117 -30
- package/src/core/migrations/contract-to-schema-ir.ts +4 -29
- package/src/core/migrations/field-event-planner.ts +194 -0
- package/src/core/migrations/plan-helpers.ts +4 -0
- package/src/core/migrations/types.ts +207 -59
- 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/schema-verify/verify-helpers.ts +47 -70
- package/src/core/schema-verify/verify-sql-schema.ts +1 -6
- 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 +11 -4
- package/src/exports/runtime.ts +2 -0
- package/src/exports/schema-verify.ts +0 -1
- package/src/exports/test-utils.ts +0 -1
- package/src/exports/verify.ts +1 -1
- package/dist/authoring-type-constructors-BAR65pSK.mjs.map +0 -1
- package/dist/types-C6K4mxDM.d.mts +0 -301
- 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/dist/verify-sql-schema-BBhkqEDo.d.mts.map +0 -1
- package/dist/verify-sql-schema-Ovz7RXR5.mjs.map +0 -1
package/dist/migration.mjs
CHANGED
|
@@ -1,35 +1,36 @@
|
|
|
1
|
+
import { deriveProvidedInvariants } from "@prisma-next/migration-tools/invariants";
|
|
1
2
|
import { Migration } from "@prisma-next/migration-tools/migration";
|
|
2
|
-
|
|
3
3
|
//#region src/core/sql-migration.ts
|
|
4
4
|
/**
|
|
5
5
|
* Family-owned base class for SQL migrations.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* on `SqlMigrationPlanOperation`. The type parameter is narrowed to
|
|
10
|
-
* `SqlPlanTargetDetails` so every target-specific shape must at minimum
|
|
11
|
-
* identify the object being targeted (schema + name); concrete targets
|
|
12
|
-
* extend the shape with their own fields.
|
|
13
|
-
*
|
|
14
|
-
* Each concrete target-side subclass (e.g. Postgres's
|
|
15
|
-
* `TypeScriptRenderablePostgresMigration`) fixes `targetId` to its own
|
|
16
|
-
* target-id string literal, since SQL can't hardcode a single `targetId`:
|
|
17
|
-
* `targetId` is a target-level identity, not a family-level one, and
|
|
18
|
-
* belongs on the subclass.
|
|
7
|
+
* Generic in `TDetails` (family plan target details, e.g. Postgres vs SQLite)
|
|
8
|
+
* and in `TTargetId` (the literal target identifier, e.g. `'postgres'`).
|
|
19
9
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
10
|
+
* Adapters (Postgres, SQLite, …) extend this with a concrete `TDetails` and
|
|
11
|
+
* a fixed `TTargetId` literal, so the public `Migration<TOp>` base sees the
|
|
12
|
+
* fully concrete operation shape. Target-free code in SQL family / tooling
|
|
13
|
+
* parameterises over `TDetails` (and usually `TTargetId = string`).
|
|
24
14
|
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* — so subclasses can return a mix of schema operations (e.g. `setNotNull`,
|
|
28
|
-
* `addColumn`) and data-transform operations (e.g. `dataTransform`). Mirrors
|
|
29
|
-
* `MongoMigration`'s parameterization on `AnyMongoMigrationOperation`.
|
|
15
|
+
* Keeps target-free contract/runtime features in the family layer while
|
|
16
|
+
* letting adapters own target shape.
|
|
30
17
|
*/
|
|
31
|
-
var SqlMigration = class extends Migration {
|
|
32
|
-
|
|
18
|
+
var SqlMigration = class extends Migration {
|
|
19
|
+
/**
|
|
20
|
+
* Sorted, deduplicated invariant ids declared by this migration's
|
|
21
|
+
* data-transform ops. Derived from `this.operations` so the field remains
|
|
22
|
+
* consistent with the operation list — planner-built plans (`db init`,
|
|
23
|
+
* `db update`) yield `[]` because they emit no data-transform ops.
|
|
24
|
+
*
|
|
25
|
+
* Required by `SqlMigrationPlan.providedInvariants` (tightened from
|
|
26
|
+
* optional at the SQL-family layer); the framework-level
|
|
27
|
+
* `MigrationPlan.providedInvariants?` stays optional.
|
|
28
|
+
*/
|
|
29
|
+
get providedInvariants() {
|
|
30
|
+
return deriveProvidedInvariants(this.operations);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
33
|
//#endregion
|
|
34
34
|
export { SqlMigration as Migration };
|
|
35
|
+
|
|
35
36
|
//# sourceMappingURL=migration.mjs.map
|
package/dist/migration.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migration.mjs","names":[],"sources":["../src/core/sql-migration.ts"],"sourcesContent":["import { Migration } from '@prisma-next/migration-tools/migration';\nimport type {
|
|
1
|
+
{"version":3,"file":"migration.mjs","names":[],"sources":["../src/core/sql-migration.ts"],"sourcesContent":["import { deriveProvidedInvariants } from '@prisma-next/migration-tools/invariants';\nimport { Migration } from '@prisma-next/migration-tools/migration';\nimport type { SqlMigrationPlanOperation, SqlPlanTargetDetails } from './migrations/types';\n\n/**\n * Family-owned base class for SQL migrations.\n *\n * Generic in `TDetails` (family plan target details, e.g. Postgres vs SQLite)\n * and in `TTargetId` (the literal target identifier, e.g. `'postgres'`).\n *\n * Adapters (Postgres, SQLite, …) extend this with a concrete `TDetails` and\n * a fixed `TTargetId` literal, so the public `Migration<TOp>` base sees the\n * fully concrete operation shape. Target-free code in SQL family / tooling\n * parameterises over `TDetails` (and usually `TTargetId = string`).\n *\n * Keeps target-free contract/runtime features in the family layer while\n * letting adapters own target shape.\n */\nexport abstract class SqlMigration<\n TDetails extends SqlPlanTargetDetails,\n TTargetId extends string = string,\n> extends Migration<SqlMigrationPlanOperation<TDetails>, 'sql', TTargetId> {\n /**\n * Sorted, deduplicated invariant ids declared by this migration's\n * data-transform ops. Derived from `this.operations` so the field remains\n * consistent with the operation list — planner-built plans (`db init`,\n * `db update`) yield `[]` because they emit no data-transform ops.\n *\n * Required by `SqlMigrationPlan.providedInvariants` (tightened from\n * optional at the SQL-family layer); the framework-level\n * `MigrationPlan.providedInvariants?` stays optional.\n */\n get providedInvariants(): readonly string[] {\n return deriveProvidedInvariants(this.operations);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAkBA,IAAsB,eAAtB,cAGU,UAAiE;;;;;;;;;;;CAWzE,IAAI,qBAAwC;EAC1C,OAAO,yBAAyB,KAAK,WAAW"}
|
package/dist/pack.d.mts
CHANGED
|
@@ -83,9 +83,11 @@ declare const sqlFamilyPack: {
|
|
|
83
83
|
readonly typeParams: {
|
|
84
84
|
readonly length: 36;
|
|
85
85
|
};
|
|
86
|
-
readonly
|
|
87
|
-
readonly
|
|
88
|
-
|
|
86
|
+
readonly executionDefaults: {
|
|
87
|
+
readonly onCreate: {
|
|
88
|
+
readonly kind: "generator";
|
|
89
|
+
readonly id: "uuidv4";
|
|
90
|
+
};
|
|
89
91
|
};
|
|
90
92
|
readonly id: true;
|
|
91
93
|
};
|
|
@@ -98,9 +100,11 @@ declare const sqlFamilyPack: {
|
|
|
98
100
|
readonly typeParams: {
|
|
99
101
|
readonly length: 36;
|
|
100
102
|
};
|
|
101
|
-
readonly
|
|
102
|
-
readonly
|
|
103
|
-
|
|
103
|
+
readonly executionDefaults: {
|
|
104
|
+
readonly onCreate: {
|
|
105
|
+
readonly kind: "generator";
|
|
106
|
+
readonly id: "uuidv7";
|
|
107
|
+
};
|
|
104
108
|
};
|
|
105
109
|
readonly id: true;
|
|
106
110
|
};
|
|
@@ -113,9 +117,11 @@ declare const sqlFamilyPack: {
|
|
|
113
117
|
readonly typeParams: {
|
|
114
118
|
readonly length: 26;
|
|
115
119
|
};
|
|
116
|
-
readonly
|
|
117
|
-
readonly
|
|
118
|
-
|
|
120
|
+
readonly executionDefaults: {
|
|
121
|
+
readonly onCreate: {
|
|
122
|
+
readonly kind: "generator";
|
|
123
|
+
readonly id: "ulid";
|
|
124
|
+
};
|
|
119
125
|
};
|
|
120
126
|
readonly id: true;
|
|
121
127
|
};
|
|
@@ -146,14 +152,16 @@ declare const sqlFamilyPack: {
|
|
|
146
152
|
readonly default: 21;
|
|
147
153
|
};
|
|
148
154
|
};
|
|
149
|
-
readonly
|
|
150
|
-
readonly
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
readonly
|
|
154
|
-
readonly
|
|
155
|
-
|
|
156
|
-
|
|
155
|
+
readonly executionDefaults: {
|
|
156
|
+
readonly onCreate: {
|
|
157
|
+
readonly kind: "generator";
|
|
158
|
+
readonly id: "nanoid";
|
|
159
|
+
readonly params: {
|
|
160
|
+
readonly size: {
|
|
161
|
+
readonly kind: "arg";
|
|
162
|
+
readonly index: 0;
|
|
163
|
+
readonly path: readonly ["size"];
|
|
164
|
+
};
|
|
157
165
|
};
|
|
158
166
|
};
|
|
159
167
|
};
|
|
@@ -168,9 +176,11 @@ declare const sqlFamilyPack: {
|
|
|
168
176
|
readonly typeParams: {
|
|
169
177
|
readonly length: 24;
|
|
170
178
|
};
|
|
171
|
-
readonly
|
|
172
|
-
readonly
|
|
173
|
-
|
|
179
|
+
readonly executionDefaults: {
|
|
180
|
+
readonly onCreate: {
|
|
181
|
+
readonly kind: "generator";
|
|
182
|
+
readonly id: "cuid2";
|
|
183
|
+
};
|
|
174
184
|
};
|
|
175
185
|
readonly id: true;
|
|
176
186
|
};
|
|
@@ -183,9 +193,11 @@ declare const sqlFamilyPack: {
|
|
|
183
193
|
readonly typeParams: {
|
|
184
194
|
readonly length: 27;
|
|
185
195
|
};
|
|
186
|
-
readonly
|
|
187
|
-
readonly
|
|
188
|
-
|
|
196
|
+
readonly executionDefaults: {
|
|
197
|
+
readonly onCreate: {
|
|
198
|
+
readonly kind: "generator";
|
|
199
|
+
readonly id: "ksuid";
|
|
200
|
+
};
|
|
189
201
|
};
|
|
190
202
|
readonly id: true;
|
|
191
203
|
};
|
package/dist/pack.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pack.d.mts","names":[],"sources":["../src/exports/pack.ts"],"
|
|
1
|
+
{"version":3,"file":"pack.d.mts","names":[],"sources":["../src/exports/pack.ts"],"mappings":";cAIM,aAAA;EAAA"}
|
package/dist/pack.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { n as sqlFamilyAuthoringFieldPresets, t as sqlFamilyAuthoringTypes } from "./authoring-type-constructors-
|
|
2
|
-
|
|
1
|
+
import { n as sqlFamilyAuthoringFieldPresets, t as sqlFamilyAuthoringTypes } from "./authoring-type-constructors-F4JpCJl7.mjs";
|
|
3
2
|
//#region src/exports/pack.ts
|
|
4
3
|
const sqlFamilyPack = {
|
|
5
4
|
kind: "family",
|
|
@@ -11,8 +10,7 @@ const sqlFamilyPack = {
|
|
|
11
10
|
type: sqlFamilyAuthoringTypes
|
|
12
11
|
}
|
|
13
12
|
};
|
|
14
|
-
var pack_default = sqlFamilyPack;
|
|
15
|
-
|
|
16
13
|
//#endregion
|
|
17
|
-
export {
|
|
14
|
+
export { sqlFamilyPack as default };
|
|
15
|
+
|
|
18
16
|
//# sourceMappingURL=pack.mjs.map
|
package/dist/pack.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pack.mjs","names":[],"sources":["../src/exports/pack.ts"],"sourcesContent":["import type { FamilyPackRef } from '@prisma-next/framework-components/components';\nimport { sqlFamilyAuthoringFieldPresets } from '../core/authoring-field-presets';\nimport { sqlFamilyAuthoringTypes } from '../core/authoring-type-constructors';\n\nconst sqlFamilyPack = {\n kind: 'family',\n id: 'sql',\n familyId: 'sql',\n version: '0.0.1',\n authoring: {\n field: sqlFamilyAuthoringFieldPresets,\n type: sqlFamilyAuthoringTypes,\n },\n} as const satisfies FamilyPackRef<'sql'>;\n\nexport default sqlFamilyPack;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"pack.mjs","names":[],"sources":["../src/exports/pack.ts"],"sourcesContent":["import type { FamilyPackRef } from '@prisma-next/framework-components/components';\nimport { sqlFamilyAuthoringFieldPresets } from '../core/authoring-field-presets';\nimport { sqlFamilyAuthoringTypes } from '../core/authoring-type-constructors';\n\nconst sqlFamilyPack = {\n kind: 'family',\n id: 'sql',\n familyId: 'sql',\n version: '0.0.1',\n authoring: {\n field: sqlFamilyAuthoringFieldPresets,\n type: sqlFamilyAuthoringTypes,\n },\n} as const satisfies FamilyPackRef<'sql'>;\n\nexport default sqlFamilyPack;\n"],"mappings":";;AAIA,MAAM,gBAAgB;CACpB,MAAM;CACN,IAAI;CACJ,UAAU;CACV,SAAS;CACT,WAAW;EACT,OAAO;EACP,MAAM;EACP;CACF"}
|
package/dist/runtime.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { RuntimeMutationDefaultGenerator } from "@prisma-next/sql-runtime";
|
|
1
2
|
import { RuntimeFamilyDescriptor, RuntimeFamilyInstance } from "@prisma-next/framework-components/execution";
|
|
2
3
|
|
|
3
4
|
//#region src/core/runtime-instance.d.ts
|
|
4
|
-
|
|
5
5
|
/**
|
|
6
6
|
* SQL execution-plane family instance interface.
|
|
7
7
|
*
|
|
@@ -23,5 +23,22 @@ interface SqlRuntimeFamilyInstance extends RuntimeFamilyInstance<'sql'> {}
|
|
|
23
23
|
*/
|
|
24
24
|
declare const sqlRuntimeFamilyDescriptor: RuntimeFamilyDescriptor<'sql', SqlRuntimeFamilyInstance>;
|
|
25
25
|
//#endregion
|
|
26
|
-
|
|
26
|
+
//#region src/core/timestamp-now-runtime-generator.d.ts
|
|
27
|
+
/**
|
|
28
|
+
* Builds the canonical runtime-plane generator for the wall-clock-now
|
|
29
|
+
* mutation default. Returns `new Date()`; semantics are target-agnostic
|
|
30
|
+
* so all SQL targets share this single implementation.
|
|
31
|
+
*
|
|
32
|
+
* Declares `stability: 'query'` so a single ORM bulk operation
|
|
33
|
+
* (e.g. `createAll([...])`) shares one timestamp across every row and
|
|
34
|
+
* every timestamp-defaulted column. Matches Prisma 6's `@updatedAt`
|
|
35
|
+
* semantics: one `new Date()` per lowered mutation, not per row.
|
|
36
|
+
*
|
|
37
|
+
* Lives in a runtime-plane-only module so the control-plane
|
|
38
|
+
* `timestamp-now-generator.ts` (descriptor + authoring presets) stays
|
|
39
|
+
* free of `@prisma-next/sql-runtime` imports.
|
|
40
|
+
*/
|
|
41
|
+
declare function timestampNowRuntimeGenerator(): RuntimeMutationDefaultGenerator;
|
|
42
|
+
//#endregion
|
|
43
|
+
export { sqlRuntimeFamilyDescriptor as default, timestampNowRuntimeGenerator };
|
|
27
44
|
//# sourceMappingURL=runtime.d.mts.map
|
package/dist/runtime.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.mts","names":[],"sources":["../src/core/runtime-instance.ts","../src/core/runtime-descriptor.ts"
|
|
1
|
+
{"version":3,"file":"runtime.d.mts","names":[],"sources":["../src/core/runtime-instance.ts","../src/core/runtime-descriptor.ts","../src/core/timestamp-now-runtime-generator.ts"],"mappings":";;;;;;;AAUA;;;;;UAAiB,wBAAA,SAAiC,qBAAA;;;;;AAAlD;;;;;;cCCa,0BAAA,EAA4B,uBAAA,QAA+B,wBAAA;;;;;;ADDxE;;;;;;;;ACCA;;;iBCMgB,4BAAA,CAAA,GAAgC,+BAAA"}
|
package/dist/runtime.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { t as TIMESTAMP_NOW_GENERATOR_ID } from "./timestamp-now-generator-BWp8S2sa.mjs";
|
|
1
2
|
//#region src/core/runtime-instance.ts
|
|
2
3
|
/**
|
|
3
4
|
* Creates a SQL execution-plane family instance.
|
|
@@ -7,7 +8,6 @@
|
|
|
7
8
|
function createSqlRuntimeFamilyInstance() {
|
|
8
9
|
return { familyId: "sql" };
|
|
9
10
|
}
|
|
10
|
-
|
|
11
11
|
//#endregion
|
|
12
12
|
//#region src/core/runtime-descriptor.ts
|
|
13
13
|
/**
|
|
@@ -28,11 +28,33 @@ const sqlRuntimeFamilyDescriptor = {
|
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
30
|
Object.freeze(sqlRuntimeFamilyDescriptor);
|
|
31
|
-
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region src/core/timestamp-now-runtime-generator.ts
|
|
33
|
+
/**
|
|
34
|
+
* Builds the canonical runtime-plane generator for the wall-clock-now
|
|
35
|
+
* mutation default. Returns `new Date()`; semantics are target-agnostic
|
|
36
|
+
* so all SQL targets share this single implementation.
|
|
37
|
+
*
|
|
38
|
+
* Declares `stability: 'query'` so a single ORM bulk operation
|
|
39
|
+
* (e.g. `createAll([...])`) shares one timestamp across every row and
|
|
40
|
+
* every timestamp-defaulted column. Matches Prisma 6's `@updatedAt`
|
|
41
|
+
* semantics: one `new Date()` per lowered mutation, not per row.
|
|
42
|
+
*
|
|
43
|
+
* Lives in a runtime-plane-only module so the control-plane
|
|
44
|
+
* `timestamp-now-generator.ts` (descriptor + authoring presets) stays
|
|
45
|
+
* free of `@prisma-next/sql-runtime` imports.
|
|
46
|
+
*/
|
|
47
|
+
function timestampNowRuntimeGenerator() {
|
|
48
|
+
return {
|
|
49
|
+
id: TIMESTAMP_NOW_GENERATOR_ID,
|
|
50
|
+
generate: () => /* @__PURE__ */ new Date(),
|
|
51
|
+
stability: "query"
|
|
52
|
+
};
|
|
53
|
+
}
|
|
32
54
|
//#endregion
|
|
33
55
|
//#region src/exports/runtime.ts
|
|
34
56
|
var runtime_default = sqlRuntimeFamilyDescriptor;
|
|
35
|
-
|
|
36
57
|
//#endregion
|
|
37
|
-
export { runtime_default as default };
|
|
58
|
+
export { runtime_default as default, timestampNowRuntimeGenerator };
|
|
59
|
+
|
|
38
60
|
//# sourceMappingURL=runtime.mjs.map
|
package/dist/runtime.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.mjs","names":[
|
|
1
|
+
{"version":3,"file":"runtime.mjs","names":[],"sources":["../src/core/runtime-instance.ts","../src/core/runtime-descriptor.ts","../src/core/timestamp-now-runtime-generator.ts","../src/exports/runtime.ts"],"sourcesContent":["import type { RuntimeFamilyInstance } from '@prisma-next/framework-components/execution';\n\n/**\n * SQL execution-plane family instance interface.\n *\n * Note: this is currently named `SqlRuntimeFamilyInstance` because the execution plane\n * framework types are still using the `Runtime*` naming (`RuntimeFamilyInstance`, etc.).\n *\n * This will be renamed to `SqlExecutionFamilyInstance` as part of `TML-1842`.\n */\nexport interface SqlRuntimeFamilyInstance extends RuntimeFamilyInstance<'sql'> {}\n\n/**\n * Creates a SQL execution-plane family instance.\n *\n * This will be renamed to `createSqlExecutionFamilyInstance()` as part of `TML-1842`.\n */\nexport function createSqlRuntimeFamilyInstance(): SqlRuntimeFamilyInstance {\n return {\n familyId: 'sql' as const,\n };\n}\n","import type { RuntimeFamilyDescriptor } from '@prisma-next/framework-components/execution';\nimport { createSqlRuntimeFamilyInstance, type SqlRuntimeFamilyInstance } from './runtime-instance';\n\n/**\n * SQL execution-plane family descriptor.\n *\n * Note: this is currently named `sqlRuntimeFamilyDescriptor` because the execution plane\n * framework types are still using the `Runtime*` naming (`RuntimeFamilyDescriptor`, etc.).\n *\n * This will be renamed to `sqlExecutionFamilyDescriptor` as part of `TML-1842`.\n */\nexport const sqlRuntimeFamilyDescriptor: RuntimeFamilyDescriptor<'sql', SqlRuntimeFamilyInstance> =\n {\n kind: 'family',\n id: 'sql',\n familyId: 'sql',\n version: '0.0.1',\n create() {\n return createSqlRuntimeFamilyInstance();\n },\n };\n\nObject.freeze(sqlRuntimeFamilyDescriptor);\n","import type { RuntimeMutationDefaultGenerator } from '@prisma-next/sql-runtime';\nimport { TIMESTAMP_NOW_GENERATOR_ID } from './timestamp-now-generator';\n\n/**\n * Builds the canonical runtime-plane generator for the wall-clock-now\n * mutation default. Returns `new Date()`; semantics are target-agnostic\n * so all SQL targets share this single implementation.\n *\n * Declares `stability: 'query'` so a single ORM bulk operation\n * (e.g. `createAll([...])`) shares one timestamp across every row and\n * every timestamp-defaulted column. Matches Prisma 6's `@updatedAt`\n * semantics: one `new Date()` per lowered mutation, not per row.\n *\n * Lives in a runtime-plane-only module so the control-plane\n * `timestamp-now-generator.ts` (descriptor + authoring presets) stays\n * free of `@prisma-next/sql-runtime` imports.\n */\nexport function timestampNowRuntimeGenerator(): RuntimeMutationDefaultGenerator {\n return {\n id: TIMESTAMP_NOW_GENERATOR_ID,\n generate: () => new Date(),\n stability: 'query',\n };\n}\n","import { sqlRuntimeFamilyDescriptor } from '../core/runtime-descriptor';\n\nexport { timestampNowRuntimeGenerator } from '../core/timestamp-now-runtime-generator';\n\nexport default sqlRuntimeFamilyDescriptor;\n"],"mappings":";;;;;;;AAiBA,SAAgB,iCAA2D;CACzE,OAAO,EACL,UAAU,OACX;;;;;;;;;;;;ACTH,MAAa,6BACX;CACE,MAAM;CACN,IAAI;CACJ,UAAU;CACV,SAAS;CACT,SAAS;EACP,OAAO,gCAAgC;;CAE1C;AAEH,OAAO,OAAO,2BAA2B;;;;;;;;;;;;;;;;;ACLzC,SAAgB,+BAAgE;CAC9E,OAAO;EACL,IAAI;EACJ,gCAAgB,IAAI,MAAM;EAC1B,WAAW;EACZ;;;;AClBH,IAAA,kBAAe"}
|
package/dist/schema-verify.d.mts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import { i as verifySqlSchema, n as NativeTypeNormalizer, r as VerifySqlSchemaOptions } from "./verify-sql-schema-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { SqlIndexIR, SqlSchemaIR, SqlUniqueIR } from "@prisma-next/sql-schema-ir/types";
|
|
5
|
-
|
|
1
|
+
import { i as verifySqlSchema, n as NativeTypeNormalizer, r as VerifySqlSchemaOptions } from "./verify-sql-schema-CPHiuYHR.mjs";
|
|
2
|
+
import { SchemaIssue } from "@prisma-next/framework-components/control";
|
|
3
|
+
import { SqlIndexIR, SqlUniqueIR } from "@prisma-next/sql-schema-ir/types";
|
|
6
4
|
//#region src/core/schema-verify/verify-helpers.d.ts
|
|
7
|
-
|
|
8
5
|
/**
|
|
9
6
|
* Compares two arrays of strings for equality (order-sensitive).
|
|
10
7
|
*/
|
|
@@ -35,14 +32,6 @@ declare function isUniqueConstraintSatisfied(uniques: readonly SqlUniqueIR[], in
|
|
|
35
32
|
* @returns true if the requirement is satisfied
|
|
36
33
|
*/
|
|
37
34
|
declare function isIndexSatisfied(indexes: readonly SqlIndexIR[], uniques: readonly SqlUniqueIR[], columns: readonly string[]): boolean;
|
|
38
|
-
/**
|
|
39
|
-
* Verifies database dependencies are installed using component-owned verification hooks.
|
|
40
|
-
* Checks whether each dependency is satisfied by verifying its id is present in
|
|
41
|
-
* schema.dependencies (populated from introspection).
|
|
42
|
-
*
|
|
43
|
-
* Returns verification nodes for the tree.
|
|
44
|
-
*/
|
|
45
|
-
declare function verifyDatabaseDependencies(dependencies: ReadonlyArray<ComponentDatabaseDependency<unknown>>, schema: SqlSchemaIR, issues: SchemaIssue[]): SchemaVerificationNode[];
|
|
46
35
|
//#endregion
|
|
47
|
-
export { type NativeTypeNormalizer, type VerifySqlSchemaOptions, arraysEqual, isIndexSatisfied, isUniqueConstraintSatisfied,
|
|
36
|
+
export { type NativeTypeNormalizer, type VerifySqlSchemaOptions, arraysEqual, isIndexSatisfied, isUniqueConstraintSatisfied, verifySqlSchema };
|
|
48
37
|
//# sourceMappingURL=schema-verify.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-verify.d.mts","names":[],"sources":["../src/core/schema-verify/verify-helpers.ts"],"
|
|
1
|
+
{"version":3,"file":"schema-verify.d.mts","names":[],"sources":["../src/core/schema-verify/verify-helpers.ts"],"mappings":";;;;;;;iBAqDgB,WAAA,CAAY,CAAA,qBAAsB,CAAA;AA+BlD;;;;;;;;;;;AA0BA;AA1BA,iBAAgB,2BAAA,CACd,OAAA,WAAkB,WAAA,IAClB,OAAA,WAAkB,UAAA,IAClB,OAAA;;;;;;;;;;;;;iBAuBc,gBAAA,CACd,OAAA,WAAkB,UAAA,IAClB,OAAA,WAAkB,WAAA,IAClB,OAAA"}
|
package/dist/schema-verify.mjs
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export { arraysEqual, isIndexSatisfied, isUniqueConstraintSatisfied, verifyDatabaseDependencies, verifySqlSchema };
|
|
1
|
+
import { i as isUniqueConstraintSatisfied, n as arraysEqual, r as isIndexSatisfied, t as verifySqlSchema } from "./verify-sql-schema-1tDh3x5x.mjs";
|
|
2
|
+
export { arraysEqual, isIndexSatisfied, isUniqueConstraintSatisfied, verifySqlSchema };
|
package/dist/test-utils.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { extractCodecTypeImports, extractComponentIds,
|
|
2
|
-
export { extractCodecTypeImports, extractComponentIds,
|
|
1
|
+
import { extractCodecTypeImports, extractComponentIds, extractQueryOperationTypeImports } from "@prisma-next/framework-components/control";
|
|
2
|
+
export { extractCodecTypeImports, extractComponentIds, extractQueryOperationTypeImports };
|
package/dist/test-utils.mjs
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import { extractCodecTypeImports, extractComponentIds,
|
|
2
|
-
|
|
3
|
-
export { extractCodecTypeImports, extractComponentIds, extractOperationTypeImports, extractQueryOperationTypeImports };
|
|
1
|
+
import { extractCodecTypeImports, extractComponentIds, extractQueryOperationTypeImports } from "@prisma-next/framework-components/control";
|
|
2
|
+
export { extractCodecTypeImports, extractComponentIds, extractQueryOperationTypeImports };
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
//#region src/core/timestamp-now-generator.ts
|
|
2
|
+
/**
|
|
3
|
+
* Canonical id for the wall-clock-now mutation default generator.
|
|
4
|
+
*
|
|
5
|
+
* Owned by `family-sql` because that's where the generator lives. The
|
|
6
|
+
* id flows out from here to (1) the control-plane descriptor and the
|
|
7
|
+
* temporal field-preset pair below, (2) the runtime-plane sibling
|
|
8
|
+
* `timestamp-now-runtime-generator.ts`, and (3) authoring surfaces
|
|
9
|
+
* (PSL `temporal.updatedAt()`, TS `field.temporal.updatedAt()`) via
|
|
10
|
+
* the descriptor flow. Co-locating the constant with its only owner
|
|
11
|
+
* keeps the framework layer free of concrete generator ids.
|
|
12
|
+
*/
|
|
13
|
+
const TIMESTAMP_NOW_GENERATOR_ID = "timestampNow";
|
|
14
|
+
/**
|
|
15
|
+
* Builds the canonical control-plane descriptor for the wall-clock-now
|
|
16
|
+
* mutation default generator. The descriptor's `id` and `buildPhases`
|
|
17
|
+
* are target-agnostic so PSL `temporal.updatedAt()` and TS
|
|
18
|
+
* `field.temporal.updatedAt()` lower to byte-identical contracts.
|
|
19
|
+
*
|
|
20
|
+
* `applicableCodecIds` is omitted: `timestampNow` is preset-only (not
|
|
21
|
+
* reachable via `@default(timestampNow())` lowering), and the codec is
|
|
22
|
+
* co-registered by the preset descriptor itself, so the
|
|
23
|
+
* `@default(...)` compatibility check has no role to play here.
|
|
24
|
+
*/
|
|
25
|
+
function timestampNowControlDescriptor() {
|
|
26
|
+
return {
|
|
27
|
+
id: TIMESTAMP_NOW_GENERATOR_ID,
|
|
28
|
+
buildPhases: () => ({
|
|
29
|
+
onCreate: {
|
|
30
|
+
kind: "generator",
|
|
31
|
+
id: TIMESTAMP_NOW_GENERATOR_ID
|
|
32
|
+
},
|
|
33
|
+
onUpdate: {
|
|
34
|
+
kind: "generator",
|
|
35
|
+
id: TIMESTAMP_NOW_GENERATOR_ID
|
|
36
|
+
}
|
|
37
|
+
})
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Builds the canonical `temporal.{createdAt,updatedAt}` field-preset pair
|
|
42
|
+
* for a SQL target. `createdAt` lowers to a `now()` storage default;
|
|
43
|
+
* `updatedAt` lowers to the `timestampNow` execution generator on both
|
|
44
|
+
* `onCreate` and `onUpdate` (RD: "last modified time", non-null). Targets
|
|
45
|
+
* supply the codec/native-type pair that matches their timestamp column;
|
|
46
|
+
* everything else is shared so PSL `temporal.updatedAt()` and TS
|
|
47
|
+
* `field.temporal.updatedAt()` lower to byte-identical contracts across
|
|
48
|
+
* targets by construction.
|
|
49
|
+
*/
|
|
50
|
+
function temporalAuthoringPresets(input) {
|
|
51
|
+
const { codecId, nativeType } = input;
|
|
52
|
+
return {
|
|
53
|
+
createdAt: {
|
|
54
|
+
kind: "fieldPreset",
|
|
55
|
+
output: {
|
|
56
|
+
codecId,
|
|
57
|
+
nativeType,
|
|
58
|
+
default: {
|
|
59
|
+
kind: "function",
|
|
60
|
+
expression: "now()"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
updatedAt: {
|
|
65
|
+
kind: "fieldPreset",
|
|
66
|
+
output: {
|
|
67
|
+
codecId,
|
|
68
|
+
nativeType,
|
|
69
|
+
executionDefaults: {
|
|
70
|
+
onCreate: {
|
|
71
|
+
kind: "generator",
|
|
72
|
+
id: TIMESTAMP_NOW_GENERATOR_ID
|
|
73
|
+
},
|
|
74
|
+
onUpdate: {
|
|
75
|
+
kind: "generator",
|
|
76
|
+
id: TIMESTAMP_NOW_GENERATOR_ID
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
//#endregion
|
|
84
|
+
export { temporalAuthoringPresets as n, timestampNowControlDescriptor as r, TIMESTAMP_NOW_GENERATOR_ID as t };
|
|
85
|
+
|
|
86
|
+
//# sourceMappingURL=timestamp-now-generator-BWp8S2sa.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timestamp-now-generator-BWp8S2sa.mjs","names":[],"sources":["../src/core/timestamp-now-generator.ts"],"sourcesContent":["import type { AuthoringFieldPresetDescriptor } from '@prisma-next/framework-components/authoring';\nimport type { MutationDefaultGeneratorDescriptor } from '@prisma-next/framework-components/control';\n\n/**\n * Canonical id for the wall-clock-now mutation default generator.\n *\n * Owned by `family-sql` because that's where the generator lives. The\n * id flows out from here to (1) the control-plane descriptor and the\n * temporal field-preset pair below, (2) the runtime-plane sibling\n * `timestamp-now-runtime-generator.ts`, and (3) authoring surfaces\n * (PSL `temporal.updatedAt()`, TS `field.temporal.updatedAt()`) via\n * the descriptor flow. Co-locating the constant with its only owner\n * keeps the framework layer free of concrete generator ids.\n */\nexport const TIMESTAMP_NOW_GENERATOR_ID = 'timestampNow' as const;\n\n/**\n * Builds the canonical control-plane descriptor for the wall-clock-now\n * mutation default generator. The descriptor's `id` and `buildPhases`\n * are target-agnostic so PSL `temporal.updatedAt()` and TS\n * `field.temporal.updatedAt()` lower to byte-identical contracts.\n *\n * `applicableCodecIds` is omitted: `timestampNow` is preset-only (not\n * reachable via `@default(timestampNow())` lowering), and the codec is\n * co-registered by the preset descriptor itself, so the\n * `@default(...)` compatibility check has no role to play here.\n */\nexport function timestampNowControlDescriptor(): MutationDefaultGeneratorDescriptor {\n return {\n id: TIMESTAMP_NOW_GENERATOR_ID,\n buildPhases: () => ({\n onCreate: { kind: 'generator', id: TIMESTAMP_NOW_GENERATOR_ID },\n onUpdate: { kind: 'generator', id: TIMESTAMP_NOW_GENERATOR_ID },\n }),\n };\n}\n\n/**\n * Builds the canonical `temporal.{createdAt,updatedAt}` field-preset pair\n * for a SQL target. `createdAt` lowers to a `now()` storage default;\n * `updatedAt` lowers to the `timestampNow` execution generator on both\n * `onCreate` and `onUpdate` (RD: \"last modified time\", non-null). Targets\n * supply the codec/native-type pair that matches their timestamp column;\n * everything else is shared so PSL `temporal.updatedAt()` and TS\n * `field.temporal.updatedAt()` lower to byte-identical contracts across\n * targets by construction.\n */\nexport function temporalAuthoringPresets<\n const CodecId extends string,\n const NativeType extends string,\n>(input: { readonly codecId: CodecId; readonly nativeType: NativeType }) {\n const { codecId, nativeType } = input;\n return {\n createdAt: {\n kind: 'fieldPreset',\n output: {\n codecId,\n nativeType,\n default: { kind: 'function', expression: 'now()' },\n },\n },\n updatedAt: {\n kind: 'fieldPreset',\n output: {\n codecId,\n nativeType,\n executionDefaults: {\n onCreate: { kind: 'generator', id: TIMESTAMP_NOW_GENERATOR_ID },\n onUpdate: { kind: 'generator', id: TIMESTAMP_NOW_GENERATOR_ID },\n },\n },\n },\n } as const satisfies Record<string, AuthoringFieldPresetDescriptor>;\n}\n"],"mappings":";;;;;;;;;;;;AAcA,MAAa,6BAA6B;;;;;;;;;;;;AAa1C,SAAgB,gCAAoE;CAClF,OAAO;EACL,IAAI;EACJ,oBAAoB;GAClB,UAAU;IAAE,MAAM;IAAa,IAAI;IAA4B;GAC/D,UAAU;IAAE,MAAM;IAAa,IAAI;IAA4B;GAChE;EACF;;;;;;;;;;;;AAaH,SAAgB,yBAGd,OAAuE;CACvE,MAAM,EAAE,SAAS,eAAe;CAChC,OAAO;EACL,WAAW;GACT,MAAM;GACN,QAAQ;IACN;IACA;IACA,SAAS;KAAE,MAAM;KAAY,YAAY;KAAS;IACnD;GACF;EACD,WAAW;GACT,MAAM;GACN,QAAQ;IACN;IACA;IACA,mBAAmB;KACjB,UAAU;MAAE,MAAM;MAAa,IAAI;MAA4B;KAC/D,UAAU;MAAE,MAAM;MAAa,IAAI;MAA4B;KAChE;IACF;GACF;EACF"}
|