@prisma-next/family-sql 0.5.0-dev.9 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/README.md +2 -2
  2. package/dist/{authoring-type-constructors-BAR65pSK.mjs → authoring-type-constructors-F4JpCJl7.mjs} +14 -15
  3. package/dist/authoring-type-constructors-F4JpCJl7.mjs.map +1 -0
  4. package/dist/control-adapter.d.mts +26 -2
  5. package/dist/control-adapter.d.mts.map +1 -1
  6. package/dist/control-adapter.mjs +1 -1
  7. package/dist/control.d.mts +122 -40
  8. package/dist/control.d.mts.map +1 -1
  9. package/dist/control.mjs +1169 -24
  10. package/dist/control.mjs.map +1 -1
  11. package/dist/migration.d.mts +22 -24
  12. package/dist/migration.d.mts.map +1 -1
  13. package/dist/migration.mjs +25 -24
  14. package/dist/migration.mjs.map +1 -1
  15. package/dist/pack.d.mts +35 -23
  16. package/dist/pack.d.mts.map +1 -1
  17. package/dist/pack.mjs +3 -5
  18. package/dist/pack.mjs.map +1 -1
  19. package/dist/runtime.d.mts +19 -2
  20. package/dist/runtime.d.mts.map +1 -1
  21. package/dist/runtime.mjs +26 -4
  22. package/dist/runtime.mjs.map +1 -1
  23. package/dist/schema-verify.d.mts +2 -4
  24. package/dist/schema-verify.d.mts.map +1 -1
  25. package/dist/schema-verify.mjs +2 -3
  26. package/dist/test-utils.d.mts +2 -2
  27. package/dist/test-utils.mjs +2 -3
  28. package/dist/timestamp-now-generator-BWp8S2sa.mjs +86 -0
  29. package/dist/timestamp-now-generator-BWp8S2sa.mjs.map +1 -0
  30. package/dist/{types-C6K4mxDM.d.mts → types-BQBbcXg3.d.mts} +206 -28
  31. package/dist/types-BQBbcXg3.d.mts.map +1 -0
  32. package/dist/verify-pRYxnpiG.mjs +81 -0
  33. package/dist/verify-pRYxnpiG.mjs.map +1 -0
  34. package/dist/{verify-sql-schema-BBhkqEDo.d.mts → verify-sql-schema-CPHiuYHR.d.mts} +2 -3
  35. package/dist/verify-sql-schema-CPHiuYHR.d.mts.map +1 -0
  36. package/dist/{verify-sql-schema-Ovz7RXR5.mjs → verify-sql-schema-r1-2apHI.mjs} +18 -9
  37. package/dist/verify-sql-schema-r1-2apHI.mjs.map +1 -0
  38. package/dist/verify.d.mts +16 -21
  39. package/dist/verify.d.mts.map +1 -1
  40. package/dist/verify.mjs +2 -3
  41. package/package.json +23 -21
  42. package/src/core/authoring-field-presets.ts +35 -23
  43. package/src/core/control-adapter.ts +32 -0
  44. package/src/core/control-descriptor.ts +2 -1
  45. package/src/core/control-instance.ts +116 -18
  46. package/src/core/migrations/field-event-planner.ts +192 -0
  47. package/src/core/migrations/plan-helpers.ts +4 -0
  48. package/src/core/migrations/types.ts +200 -25
  49. package/src/core/operation-preview.ts +62 -0
  50. package/src/core/psl-contract-infer/default-mapping.ts +56 -0
  51. package/src/core/psl-contract-infer/name-transforms.ts +178 -0
  52. package/src/core/psl-contract-infer/postgres-default-mapping.ts +16 -0
  53. package/src/core/psl-contract-infer/postgres-type-map.ts +165 -0
  54. package/src/core/psl-contract-infer/printer-config.ts +55 -0
  55. package/src/core/psl-contract-infer/raw-default-parser.ts +91 -0
  56. package/src/core/psl-contract-infer/relation-inference.ts +196 -0
  57. package/src/core/psl-contract-infer/sql-schema-ir-to-psl-ast.ts +832 -0
  58. package/src/core/schema-verify/verify-helpers.ts +46 -6
  59. package/src/core/sql-migration.ts +25 -23
  60. package/src/core/timestamp-now-generator.ts +74 -0
  61. package/src/core/timestamp-now-runtime-generator.ts +24 -0
  62. package/src/core/verify.ts +46 -108
  63. package/src/exports/control.ts +11 -1
  64. package/src/exports/runtime.ts +2 -0
  65. package/src/exports/test-utils.ts +0 -1
  66. package/src/exports/verify.ts +1 -1
  67. package/dist/authoring-type-constructors-BAR65pSK.mjs.map +0 -1
  68. package/dist/types-C6K4mxDM.d.mts.map +0 -1
  69. package/dist/verify-4GshvY4p.mjs +0 -122
  70. package/dist/verify-4GshvY4p.mjs.map +0 -1
  71. package/dist/verify-sql-schema-BBhkqEDo.d.mts.map +0 -1
  72. package/dist/verify-sql-schema-Ovz7RXR5.mjs.map +0 -1
@@ -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
- * Parameterized on the target-details shape because SQL-family targets
8
- * (Postgres, MySQL, SQLite, …) each carry their own `target.details` payload
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
- * `familyId` is intentionally not declared here. The SQL family has no
21
- * family-scoped runtime identity today consumers reach the family via
22
- * target descriptors rather than by family-id lookup, so adding one would
23
- * be purely decorative. Introducing it later is a non-breaking superset.
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
- * The operation type parameter is `AnySqlMigrationOperation<TDetails>` the
26
- * union of DDL-shaped `SqlMigrationPlanOperation` and `DataTransformOperation`
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
@@ -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 { AnySqlMigrationOperation, SqlPlanTargetDetails } from './migrations/types';\n\n/**\n * Family-owned base class for SQL migrations.\n *\n * Parameterized on the target-details shape because SQL-family targets\n * (Postgres, MySQL, SQLite, …) each carry their own `target.details` payload\n * on `SqlMigrationPlanOperation`. The type parameter is narrowed to\n * `SqlPlanTargetDetails` so every target-specific shape must at minimum\n * identify the object being targeted (schema + name); concrete targets\n * extend the shape with their own fields.\n *\n * Each concrete target-side subclass (e.g. Postgres's\n * `TypeScriptRenderablePostgresMigration`) fixes `targetId` to its own\n * target-id string literal, since SQL can't hardcode a single `targetId`:\n * `targetId` is a target-level identity, not a family-level one, and\n * belongs on the subclass.\n *\n * `familyId` is intentionally not declared here. The SQL family has no\n * family-scoped runtime identity today consumers reach the family via\n * target descriptors rather than by family-id lookup, so adding one would\n * be purely decorative. Introducing it later is a non-breaking superset.\n *\n * The operation type parameter is `AnySqlMigrationOperation<TDetails>` the\n * union of DDL-shaped `SqlMigrationPlanOperation` and `DataTransformOperation`\n * — so subclasses can return a mix of schema operations (e.g. `setNotNull`,\n * `addColumn`) and data-transform operations (e.g. `dataTransform`). Mirrors\n * `MongoMigration`'s parameterization on `AnyMongoMigrationOperation`.\n */\nexport abstract class SqlMigration<\n TDetails extends SqlPlanTargetDetails,\n TTargetId extends string = string,\n> extends Migration<AnySqlMigrationOperation<TDetails>, 'sql', TTargetId> {}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,IAAsB,eAAtB,cAGU,UAAgE"}
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 executionDefault: {
87
- readonly kind: "generator";
88
- readonly id: "uuidv4";
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 executionDefault: {
102
- readonly kind: "generator";
103
- readonly id: "uuidv7";
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 executionDefault: {
117
- readonly kind: "generator";
118
- readonly id: "ulid";
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 executionDefault: {
150
- readonly kind: "generator";
151
- readonly id: "nanoid";
152
- readonly params: {
153
- readonly size: {
154
- readonly kind: "arg";
155
- readonly index: 0;
156
- readonly path: readonly ["size"];
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 executionDefault: {
172
- readonly kind: "generator";
173
- readonly id: "cuid2";
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 executionDefault: {
187
- readonly kind: "generator";
188
- readonly id: "ksuid";
196
+ readonly executionDefaults: {
197
+ readonly onCreate: {
198
+ readonly kind: "generator";
199
+ readonly id: "ksuid";
200
+ };
189
201
  };
190
202
  readonly id: true;
191
203
  };
@@ -1 +1 @@
1
- {"version":3,"file":"pack.d.mts","names":[],"sources":["../src/exports/pack.ts"],"sourcesContent":[],"mappings":";cAIM;EAAA,SAAA,IAAA,EAAA,QASmC"}
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-BAR65pSK.mjs";
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 { pack_default as default };
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":";;;AAIA,MAAM,gBAAgB;CACpB,MAAM;CACN,IAAI;CACJ,UAAU;CACV,SAAS;CACT,WAAW;EACT,OAAO;EACP,MAAM;EACP;CACF;AAED,mBAAe"}
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"}
@@ -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
- export { sqlRuntimeFamilyDescriptor as default };
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
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.d.mts","names":[],"sources":["../src/core/runtime-instance.ts","../src/core/runtime-descriptor.ts"],"sourcesContent":[],"mappings":";;;;;;AAUA;;;;ACCA;;UDDiB,wBAAA,SAAiC;;;;AAAlD;;;;ACCA;;;cAAa,4BAA4B,+BAA+B"}
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
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.mjs","names":["sqlRuntimeFamilyDescriptor: RuntimeFamilyDescriptor<'sql', SqlRuntimeFamilyInstance>"],"sources":["../src/core/runtime-instance.ts","../src/core/runtime-descriptor.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 { sqlRuntimeFamilyDescriptor } from '../core/runtime-descriptor';\n\nexport default sqlRuntimeFamilyDescriptor;\n"],"mappings":";;;;;;AAiBA,SAAgB,iCAA2D;AACzE,QAAO,EACL,UAAU,OACX;;;;;;;;;;;;;ACTH,MAAaA,6BACX;CACE,MAAM;CACN,IAAI;CACJ,UAAU;CACV,SAAS;CACT,SAAS;AACP,SAAO,gCAAgC;;CAE1C;AAEH,OAAO,OAAO,2BAA2B;;;;ACpBzC,sBAAe"}
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"}
@@ -1,10 +1,8 @@
1
- import { i as verifySqlSchema, n as NativeTypeNormalizer, r as VerifySqlSchemaOptions } from "./verify-sql-schema-BBhkqEDo.mjs";
2
- import { a as ComponentDatabaseDependency } from "./types-C6K4mxDM.mjs";
1
+ import { i as verifySqlSchema, n as NativeTypeNormalizer, r as VerifySqlSchemaOptions } from "./verify-sql-schema-CPHiuYHR.mjs";
2
+ import { i as ComponentDatabaseDependency } from "./types-BQBbcXg3.mjs";
3
3
  import { SchemaIssue, SchemaVerificationNode } from "@prisma-next/framework-components/control";
4
4
  import { SqlIndexIR, SqlSchemaIR, SqlUniqueIR } from "@prisma-next/sql-schema-ir/types";
5
-
6
5
  //#region src/core/schema-verify/verify-helpers.d.ts
7
-
8
6
  /**
9
7
  * Compares two arrays of strings for equality (order-sensitive).
10
8
  */
@@ -1 +1 @@
1
- {"version":3,"file":"schema-verify.d.mts","names":[],"sources":["../src/core/schema-verify/verify-helpers.ts"],"sourcesContent":[],"mappings":";;;;;;;AAmFA;AA6YA;;AACgB,iBAvcA,WAAA,CAucA,CAAA,EAAA,SAAA,MAAA,EAAA,EAAA,CAAA,EAAA,SAAA,MAAA,EAAA,CAAA,EAAA,OAAA;;;;;;;;;;;;;iBAxaA,2BAAA,mBACI,iCACA;;;;;;;;;;;;;iBAwBJ,gBAAA,mBACI,gCACA;;;;;;;;iBA2YJ,0BAAA,eACA,cAAc,+CACpB,qBACA,gBACP"}
1
+ {"version":3,"file":"schema-verify.d.mts","names":[],"sources":["../src/core/schema-verify/verify-helpers.ts"],"mappings":";;;;;;;;iBA2DgB,WAAA,CAAY,CAAA,qBAAsB,CAAA;AA+BlD;;;;;;;;;;;AA0BA;AA1BA,iBAAgB,2BAAA,CACd,OAAA,WAAkB,WAAA,IAClB,OAAA,WAAkB,UAAA,IAClB,OAAA;;;;;;;;;;AA2aF;;;iBApZgB,gBAAA,CACd,OAAA,WAAkB,UAAA,IAClB,OAAA,WAAkB,WAAA,IAClB,OAAA;;;;;;;;iBAiZc,0BAAA,CACd,YAAA,EAAc,aAAA,CAAc,2BAAA,YAC5B,MAAA,EAAQ,WAAA,EACR,MAAA,EAAQ,WAAA,KACP,sBAAA"}
@@ -1,3 +1,2 @@
1
- import { a as verifyDatabaseDependencies, i as isUniqueConstraintSatisfied, n as arraysEqual, r as isIndexSatisfied, t as verifySqlSchema } from "./verify-sql-schema-Ovz7RXR5.mjs";
2
-
3
- export { arraysEqual, isIndexSatisfied, isUniqueConstraintSatisfied, verifyDatabaseDependencies, verifySqlSchema };
1
+ import { a as verifyDatabaseDependencies, i as isUniqueConstraintSatisfied, n as arraysEqual, r as isIndexSatisfied, t as verifySqlSchema } from "./verify-sql-schema-r1-2apHI.mjs";
2
+ export { arraysEqual, isIndexSatisfied, isUniqueConstraintSatisfied, verifyDatabaseDependencies, verifySqlSchema };
@@ -1,2 +1,2 @@
1
- import { extractCodecTypeImports, extractComponentIds, extractOperationTypeImports, extractQueryOperationTypeImports } from "@prisma-next/framework-components/control";
2
- export { extractCodecTypeImports, extractComponentIds, extractOperationTypeImports, extractQueryOperationTypeImports };
1
+ import { extractCodecTypeImports, extractComponentIds, extractQueryOperationTypeImports } from "@prisma-next/framework-components/control";
2
+ export { extractCodecTypeImports, extractComponentIds, extractQueryOperationTypeImports };
@@ -1,3 +1,2 @@
1
- import { extractCodecTypeImports, extractComponentIds, extractOperationTypeImports, extractQueryOperationTypeImports } from "@prisma-next/framework-components/control";
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"}