@prisma-next/family-sql 0.5.0-dev.51 → 0.5.0-dev.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{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 +1 -1
- package/dist/control.d.mts +95 -26
- package/dist/control.d.mts.map +1 -1
- package/dist/control.mjs +3 -2
- package/dist/control.mjs.map +1 -1
- package/dist/migration.d.mts +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-UI3K69S6.d.mts → types-DiBtjG6M.d.mts} +1 -1
- package/dist/{types-UI3K69S6.d.mts.map → types-DiBtjG6M.d.mts.map} +1 -1
- package/dist/{verify-sql-schema-_EoNcGIq.d.mts → verify-sql-schema-DW8Agf1F.d.mts} +1 -1
- package/dist/{verify-sql-schema-_EoNcGIq.d.mts.map → verify-sql-schema-DW8Agf1F.d.mts.map} +1 -1
- package/package.json +18 -18
- package/src/core/authoring-field-presets.ts +35 -23
- package/src/core/timestamp-now-generator.ts +74 -0
- package/src/core/timestamp-now-runtime-generator.ts +24 -0
- package/src/exports/control.ts +4 -0
- package/src/exports/runtime.ts +2 -0
- package/dist/authoring-type-constructors-BAR65pSK.mjs.map +0 -1
package/dist/migration.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { T as SqlPlanTargetDetails, p as SqlMigrationPlanOperation } from "./types-
|
|
1
|
+
import { T as SqlPlanTargetDetails, p as SqlMigrationPlanOperation } from "./types-DiBtjG6M.mjs";
|
|
2
2
|
import { Migration } from "@prisma-next/migration-tools/migration";
|
|
3
3
|
|
|
4
4
|
//#region src/core/sql-migration.d.ts
|
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.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as sqlFamilyAuthoringFieldPresets, t as sqlFamilyAuthoringTypes } from "./authoring-type-constructors-
|
|
1
|
+
import { n as sqlFamilyAuthoringFieldPresets, t as sqlFamilyAuthoringTypes } from "./authoring-type-constructors-D9b8AG6y.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/exports/pack.ts
|
|
4
4
|
const sqlFamilyPack = {
|
package/dist/runtime.d.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
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
|
|
@@ -23,5 +24,22 @@ interface SqlRuntimeFamilyInstance extends RuntimeFamilyInstance<'sql'> {}
|
|
|
23
24
|
*/
|
|
24
25
|
declare const sqlRuntimeFamilyDescriptor: RuntimeFamilyDescriptor<'sql', SqlRuntimeFamilyInstance>;
|
|
25
26
|
//#endregion
|
|
26
|
-
|
|
27
|
+
//#region src/core/timestamp-now-runtime-generator.d.ts
|
|
28
|
+
/**
|
|
29
|
+
* Builds the canonical runtime-plane generator for the wall-clock-now
|
|
30
|
+
* mutation default. Returns `new Date()`; semantics are target-agnostic
|
|
31
|
+
* so all SQL targets share this single implementation.
|
|
32
|
+
*
|
|
33
|
+
* Declares `stability: 'query'` so a single ORM bulk operation
|
|
34
|
+
* (e.g. `createAll([...])`) shares one timestamp across every row and
|
|
35
|
+
* every timestamp-defaulted column. Matches Prisma 6's `@updatedAt`
|
|
36
|
+
* semantics: one `new Date()` per lowered mutation, not per row.
|
|
37
|
+
*
|
|
38
|
+
* Lives in a runtime-plane-only module so the control-plane
|
|
39
|
+
* `timestamp-now-generator.ts` (descriptor + authoring presets) stays
|
|
40
|
+
* free of `@prisma-next/sql-runtime` imports.
|
|
41
|
+
*/
|
|
42
|
+
declare function timestampNowRuntimeGenerator(): RuntimeMutationDefaultGenerator;
|
|
43
|
+
//#endregion
|
|
44
|
+
export { sqlRuntimeFamilyDescriptor as default, timestampNowRuntimeGenerator };
|
|
27
45
|
//# 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"],"sourcesContent":[],"mappings":"
|
|
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"],"sourcesContent":[],"mappings":";;;;;;;;AAUA;;;;ACCA;UDDiB,wBAAA,SAAiC;;;;;AAAlD;;;;ACCA;;cAAa,4BAA4B,+BAA+B;;;;;;ADDxE;;;;ACCA;;;;ACMA;;;iBAAgB,4BAAA,CAAA,GAAgC"}
|
package/dist/runtime.mjs
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { t as TIMESTAMP_NOW_GENERATOR_ID } from "./timestamp-now-generator-Bt4L3cfM.mjs";
|
|
2
|
+
|
|
1
3
|
//#region src/core/runtime-instance.ts
|
|
2
4
|
/**
|
|
3
5
|
* Creates a SQL execution-plane family instance.
|
|
@@ -29,10 +31,34 @@ const sqlRuntimeFamilyDescriptor = {
|
|
|
29
31
|
};
|
|
30
32
|
Object.freeze(sqlRuntimeFamilyDescriptor);
|
|
31
33
|
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region src/core/timestamp-now-runtime-generator.ts
|
|
36
|
+
/**
|
|
37
|
+
* Builds the canonical runtime-plane generator for the wall-clock-now
|
|
38
|
+
* mutation default. Returns `new Date()`; semantics are target-agnostic
|
|
39
|
+
* so all SQL targets share this single implementation.
|
|
40
|
+
*
|
|
41
|
+
* Declares `stability: 'query'` so a single ORM bulk operation
|
|
42
|
+
* (e.g. `createAll([...])`) shares one timestamp across every row and
|
|
43
|
+
* every timestamp-defaulted column. Matches Prisma 6's `@updatedAt`
|
|
44
|
+
* semantics: one `new Date()` per lowered mutation, not per row.
|
|
45
|
+
*
|
|
46
|
+
* Lives in a runtime-plane-only module so the control-plane
|
|
47
|
+
* `timestamp-now-generator.ts` (descriptor + authoring presets) stays
|
|
48
|
+
* free of `@prisma-next/sql-runtime` imports.
|
|
49
|
+
*/
|
|
50
|
+
function timestampNowRuntimeGenerator() {
|
|
51
|
+
return {
|
|
52
|
+
id: TIMESTAMP_NOW_GENERATOR_ID,
|
|
53
|
+
generate: () => /* @__PURE__ */ new Date(),
|
|
54
|
+
stability: "query"
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
32
58
|
//#endregion
|
|
33
59
|
//#region src/exports/runtime.ts
|
|
34
60
|
var runtime_default = sqlRuntimeFamilyDescriptor;
|
|
35
61
|
|
|
36
62
|
//#endregion
|
|
37
|
-
export { runtime_default as default };
|
|
63
|
+
export { runtime_default as default, timestampNowRuntimeGenerator };
|
|
38
64
|
//# sourceMappingURL=runtime.mjs.map
|
package/dist/runtime.mjs.map
CHANGED
|
@@ -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":"
|
|
1
|
+
{"version":3,"file":"runtime.mjs","names":["sqlRuntimeFamilyDescriptor: RuntimeFamilyDescriptor<'sql', SqlRuntimeFamilyInstance>"],"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;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;;;;;;;;;;;;;;;;;;ACLzC,SAAgB,+BAAgE;AAC9E,QAAO;EACL,IAAI;EACJ,gCAAgB,IAAI,MAAM;EAC1B,WAAW;EACZ;;;;;AClBH,sBAAe"}
|
package/dist/schema-verify.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as verifySqlSchema, n as NativeTypeNormalizer, r as VerifySqlSchemaOptions } from "./verify-sql-schema-
|
|
2
|
-
import { i as ComponentDatabaseDependency } from "./types-
|
|
1
|
+
import { i as verifySqlSchema, n as NativeTypeNormalizer, r as VerifySqlSchemaOptions } from "./verify-sql-schema-DW8Agf1F.mjs";
|
|
2
|
+
import { i as ComponentDatabaseDependency } from "./types-DiBtjG6M.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
5
|
|
|
@@ -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
|
+
|
|
84
|
+
//#endregion
|
|
85
|
+
export { temporalAuthoringPresets as n, timestampNowControlDescriptor as r, TIMESTAMP_NOW_GENERATOR_ID as t };
|
|
86
|
+
//# sourceMappingURL=timestamp-now-generator-Bt4L3cfM.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timestamp-now-generator-Bt4L3cfM.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;AAClF,QAAO;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;AAChC,QAAO;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"}
|
|
@@ -322,4 +322,4 @@ interface CreateSqlMigrationPlanOptions<TTargetDetails> {
|
|
|
322
322
|
}
|
|
323
323
|
//#endregion
|
|
324
324
|
export { SqlPlannerResult as A, SqlMigrationRunnerResult as C, SqlPlannerConflictKind as D, SqlPlannerConflict as E, SchemaVerifyOptions as F, SqlControlFamilyInstance as I, StorageTypePlanResult as M, collectInitDependencies as N, SqlPlannerConflictLocation as O, isDatabaseDependencyProvider as P, SqlMigrationRunnerFailure as S, SqlPlanTargetDetails as T, SqlMigrationPlannerPlanOptions as _, CreateSqlMigrationPlanOptions as a, SqlMigrationRunnerExecuteCallbacks as b, SqlControlAdapterDescriptor as c, SqlMigrationPlan as d, SqlMigrationPlanContractInfo as f, SqlMigrationPlanner as g, SqlMigrationPlanOperationTarget as h, ComponentDatabaseDependency as i, SqlPlannerSuccessResult as j, SqlPlannerFailureResult as k, SqlControlExtensionDescriptor as l, SqlMigrationPlanOperationStep as m, CodecControlHooks as n, ExpandNativeTypeInput as o, SqlMigrationPlanOperation as p, ComponentDatabaseDependencies as r, ResolveIdentityValueInput as s, AnyRecord as t, SqlControlTargetDescriptor as u, SqlMigrationRunner as v, SqlMigrationRunnerSuccessValue as w, SqlMigrationRunnerExecuteOptions as x, SqlMigrationRunnerErrorCode as y };
|
|
325
|
-
//# sourceMappingURL=types-
|
|
325
|
+
//# sourceMappingURL=types-DiBtjG6M.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types-
|
|
1
|
+
{"version":3,"file":"types-DiBtjG6M.d.mts","names":[],"sources":["../src/core/control-instance.ts","../src/core/migrations/types.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;UAgKU,eAAA;;;;;AA3HsE;AA2HvD,KAOpB,uBAAA,GAA0B,GAAH,CAAA,MAAA,EAAe,eAAA,CAAZ;AAAG,UAExB,sBAAA,CAAsB;EACW,SAAA,gBAAA,EAAd,aAAc,CAAA,eAAA,CAAA;EAAd,SAAA,oBAAA,EACI,aADJ,CACkB,eADlB,CAAA;EACkB,SAAA,YAAA,EACtB,aADsB,CAAA,MAAA,CAAA;EAAd,SAAA,oBAAA,EAEA,uBAFA;;AAEA,UAGhB,mBAAA,CAHgB;EAAuB,SAAA,MAAA,EAIrC,qBAJqC,CAAA,KAAA,EAAA,MAAA,CAAA;EAGvC,SAAA,QAAA,EAAA,OAAmB;EACjB,SAAA,MAAA,EAAA,OAAA;EAGE,SAAA,OAAA,CAAA,EAAA,gBAAA;EAKyB;;;AAG9C;EACuC,SAAA,mBAAA,EAJP,aAIO,CAJO,8BAIP,CAAA,KAAA,EAAA,MAAA,CAAA,CAAA;;AAEX,UAHX,wBAAA,SACP,qBAEkB,CAAA,KAAA,EAFW,WAEX,CAAA,EADxB,iBACwB,CADN,WACM,CAAA,EAAxB,uBAAwB,CAAA,WAAA,CAAA,EACxB,uBADwB,EAExB,sBAFwB,CAAA;EAGe,gBAAA,CAAA,YAAA,EAAA,OAAA,CAAA,EAAA,QAAA;EAGtB,MAAA,CAAA,OAAA,EAAA;IAKP,SAAA,MAAA,EALO,qBAKP,CAAA,KAAA,EAAA,MAAA,CAAA;IAAR,SAAA,QAAA,EAAA,OAAA;IAEkB,SAAA,gBAAA,EAAA,MAAA;IAA8B,SAAA,YAAA,EAAA,MAAA;IAAR,SAAA,UAAA,CAAA,EAAA,MAAA;EAGzB,CAAA,CAAA,EALf,OAKe,CALP,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A;UAUK,yBAAA,SAAkC;iBAClC;kBACC;;UAGD,8BAAA,SAAuC;KAE5C,wBAAA,GAA2B,OACrC,gCACA;UAGe;mBAEJ,iCAAiC,kBACzC,QAAQ;;UAGI,6EACP,kCAAkC,WAAW;mCACpB,cAAc;wBACzB,2BAA2B,oBAAoB;uBAChD,2BAA2B,mBAAmB;;UAGpD;;oBAEG;wBACI;gCACQ,0BAA0B;;;;;;;kBAOxC"}
|
|
@@ -64,4 +64,4 @@ interface VerifySqlSchemaOptions {
|
|
|
64
64
|
declare function verifySqlSchema(options: VerifySqlSchemaOptions): VerifyDatabaseSchemaResult;
|
|
65
65
|
//#endregion
|
|
66
66
|
export { verifySqlSchema as i, NativeTypeNormalizer as n, VerifySqlSchemaOptions as r, DefaultNormalizer as t };
|
|
67
|
-
//# sourceMappingURL=verify-sql-schema-
|
|
67
|
+
//# sourceMappingURL=verify-sql-schema-DW8Agf1F.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify-sql-schema-
|
|
1
|
+
{"version":3,"file":"verify-sql-schema-DW8Agf1F.d.mts","names":[],"sources":["../src/core/schema-verify/verify-sql-schema.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;AAqEgC,KA9BpB,iBAAA,GA8BoB,CAAA,UAAA,EAAA,MAAA,EAAA,UAAA,EAAA,MAAA,EAAA,GA3B3B,aA2B2B,GAAA,SAAA;;;;AAyBhC;;KA7CY,oBAAA;;;;UAKK,sBAAA;;qBAEI,SAAS;;mBAEX;;;;qBAIE;;iCAEY;;;;;;;gCAKD,cAAc;;;;;;8BAMhB;;;;;;iCAMG;;;;;;;;;;;;iBAajB,eAAA,UAAyB,yBAAyB"}
|
package/package.json
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma-next/family-sql",
|
|
3
|
-
"version": "0.5.0-dev.
|
|
3
|
+
"version": "0.5.0-dev.52",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"description": "SQL family descriptor for Prisma Next",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"arktype": "^2.0.0",
|
|
9
|
-
"@prisma-next/contract": "0.5.0-dev.
|
|
10
|
-
"@prisma-next/emitter": "0.5.0-dev.
|
|
11
|
-
"@prisma-next/
|
|
12
|
-
"@prisma-next/
|
|
13
|
-
"@prisma-next/
|
|
14
|
-
"@prisma-next/sql-contract": "0.5.0-dev.
|
|
15
|
-
"@prisma-next/sql-operations": "0.5.0-dev.
|
|
16
|
-
"@prisma-next/
|
|
17
|
-
"@prisma-next/sql-
|
|
18
|
-
"@prisma-next/sql-
|
|
19
|
-
"@prisma-next/sql-
|
|
20
|
-
"@prisma-next/
|
|
21
|
-
"@prisma-next/
|
|
9
|
+
"@prisma-next/contract": "0.5.0-dev.52",
|
|
10
|
+
"@prisma-next/emitter": "0.5.0-dev.52",
|
|
11
|
+
"@prisma-next/framework-components": "0.5.0-dev.52",
|
|
12
|
+
"@prisma-next/sql-contract": "0.5.0-dev.52",
|
|
13
|
+
"@prisma-next/migration-tools": "0.5.0-dev.52",
|
|
14
|
+
"@prisma-next/sql-contract-emitter": "0.5.0-dev.52",
|
|
15
|
+
"@prisma-next/sql-operations": "0.5.0-dev.52",
|
|
16
|
+
"@prisma-next/operations": "0.5.0-dev.52",
|
|
17
|
+
"@prisma-next/sql-contract-ts": "0.5.0-dev.52",
|
|
18
|
+
"@prisma-next/sql-relational-core": "0.5.0-dev.52",
|
|
19
|
+
"@prisma-next/sql-runtime": "0.5.0-dev.52",
|
|
20
|
+
"@prisma-next/utils": "0.5.0-dev.52",
|
|
21
|
+
"@prisma-next/sql-schema-ir": "0.5.0-dev.52"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"tsdown": "0.18.4",
|
|
25
25
|
"typescript": "5.9.3",
|
|
26
26
|
"vitest": "4.0.17",
|
|
27
|
-
"@prisma-next/driver-postgres": "0.5.0-dev.
|
|
28
|
-
"@prisma-next/
|
|
29
|
-
"@prisma-next/psl
|
|
30
|
-
"@prisma-next/psl-printer": "0.5.0-dev.
|
|
27
|
+
"@prisma-next/driver-postgres": "0.5.0-dev.52",
|
|
28
|
+
"@prisma-next/psl-parser": "0.5.0-dev.52",
|
|
29
|
+
"@prisma-next/sql-contract-psl": "0.5.0-dev.52",
|
|
30
|
+
"@prisma-next/psl-printer": "0.5.0-dev.52",
|
|
31
31
|
"@prisma-next/test-utils": "0.0.1",
|
|
32
32
|
"@prisma-next/tsdown": "0.0.0",
|
|
33
33
|
"@prisma-next/tsconfig": "0.0.0"
|
|
@@ -99,9 +99,11 @@ export const sqlFamilyAuthoringFieldPresets = {
|
|
|
99
99
|
typeParams: {
|
|
100
100
|
length: 36,
|
|
101
101
|
},
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
102
|
+
executionDefaults: {
|
|
103
|
+
onCreate: {
|
|
104
|
+
kind: 'generator',
|
|
105
|
+
id: 'uuidv4',
|
|
106
|
+
},
|
|
105
107
|
},
|
|
106
108
|
id: true,
|
|
107
109
|
},
|
|
@@ -114,9 +116,11 @@ export const sqlFamilyAuthoringFieldPresets = {
|
|
|
114
116
|
typeParams: {
|
|
115
117
|
length: 36,
|
|
116
118
|
},
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
119
|
+
executionDefaults: {
|
|
120
|
+
onCreate: {
|
|
121
|
+
kind: 'generator',
|
|
122
|
+
id: 'uuidv7',
|
|
123
|
+
},
|
|
120
124
|
},
|
|
121
125
|
id: true,
|
|
122
126
|
},
|
|
@@ -129,9 +133,11 @@ export const sqlFamilyAuthoringFieldPresets = {
|
|
|
129
133
|
typeParams: {
|
|
130
134
|
length: 26,
|
|
131
135
|
},
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
136
|
+
executionDefaults: {
|
|
137
|
+
onCreate: {
|
|
138
|
+
kind: 'generator',
|
|
139
|
+
id: 'ulid',
|
|
140
|
+
},
|
|
135
141
|
},
|
|
136
142
|
id: true,
|
|
137
143
|
},
|
|
@@ -150,14 +156,16 @@ export const sqlFamilyAuthoringFieldPresets = {
|
|
|
150
156
|
default: 21,
|
|
151
157
|
},
|
|
152
158
|
},
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
159
|
+
executionDefaults: {
|
|
160
|
+
onCreate: {
|
|
161
|
+
kind: 'generator',
|
|
162
|
+
id: 'nanoid',
|
|
163
|
+
params: {
|
|
164
|
+
size: {
|
|
165
|
+
kind: 'arg',
|
|
166
|
+
index: 0,
|
|
167
|
+
path: ['size'],
|
|
168
|
+
},
|
|
161
169
|
},
|
|
162
170
|
},
|
|
163
171
|
},
|
|
@@ -172,9 +180,11 @@ export const sqlFamilyAuthoringFieldPresets = {
|
|
|
172
180
|
typeParams: {
|
|
173
181
|
length: 24,
|
|
174
182
|
},
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
183
|
+
executionDefaults: {
|
|
184
|
+
onCreate: {
|
|
185
|
+
kind: 'generator',
|
|
186
|
+
id: 'cuid2',
|
|
187
|
+
},
|
|
178
188
|
},
|
|
179
189
|
id: true,
|
|
180
190
|
},
|
|
@@ -187,9 +197,11 @@ export const sqlFamilyAuthoringFieldPresets = {
|
|
|
187
197
|
typeParams: {
|
|
188
198
|
length: 27,
|
|
189
199
|
},
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
200
|
+
executionDefaults: {
|
|
201
|
+
onCreate: {
|
|
202
|
+
kind: 'generator',
|
|
203
|
+
id: 'ksuid',
|
|
204
|
+
},
|
|
193
205
|
},
|
|
194
206
|
id: true,
|
|
195
207
|
},
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { AuthoringFieldPresetDescriptor } from '@prisma-next/framework-components/authoring';
|
|
2
|
+
import type { MutationDefaultGeneratorDescriptor } from '@prisma-next/framework-components/control';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Canonical id for the wall-clock-now mutation default generator.
|
|
6
|
+
*
|
|
7
|
+
* Owned by `family-sql` because that's where the generator lives. The
|
|
8
|
+
* id flows out from here to (1) the control-plane descriptor and the
|
|
9
|
+
* temporal field-preset pair below, (2) the runtime-plane sibling
|
|
10
|
+
* `timestamp-now-runtime-generator.ts`, and (3) authoring surfaces
|
|
11
|
+
* (PSL `temporal.updatedAt()`, TS `field.temporal.updatedAt()`) via
|
|
12
|
+
* the descriptor flow. Co-locating the constant with its only owner
|
|
13
|
+
* keeps the framework layer free of concrete generator ids.
|
|
14
|
+
*/
|
|
15
|
+
export const TIMESTAMP_NOW_GENERATOR_ID = 'timestampNow' as const;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Builds the canonical control-plane descriptor for the wall-clock-now
|
|
19
|
+
* mutation default generator. The descriptor's `id` and `buildPhases`
|
|
20
|
+
* are target-agnostic so PSL `temporal.updatedAt()` and TS
|
|
21
|
+
* `field.temporal.updatedAt()` lower to byte-identical contracts.
|
|
22
|
+
*
|
|
23
|
+
* `applicableCodecIds` is omitted: `timestampNow` is preset-only (not
|
|
24
|
+
* reachable via `@default(timestampNow())` lowering), and the codec is
|
|
25
|
+
* co-registered by the preset descriptor itself, so the
|
|
26
|
+
* `@default(...)` compatibility check has no role to play here.
|
|
27
|
+
*/
|
|
28
|
+
export function timestampNowControlDescriptor(): MutationDefaultGeneratorDescriptor {
|
|
29
|
+
return {
|
|
30
|
+
id: TIMESTAMP_NOW_GENERATOR_ID,
|
|
31
|
+
buildPhases: () => ({
|
|
32
|
+
onCreate: { kind: 'generator', id: TIMESTAMP_NOW_GENERATOR_ID },
|
|
33
|
+
onUpdate: { kind: 'generator', id: TIMESTAMP_NOW_GENERATOR_ID },
|
|
34
|
+
}),
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Builds the canonical `temporal.{createdAt,updatedAt}` field-preset pair
|
|
40
|
+
* for a SQL target. `createdAt` lowers to a `now()` storage default;
|
|
41
|
+
* `updatedAt` lowers to the `timestampNow` execution generator on both
|
|
42
|
+
* `onCreate` and `onUpdate` (RD: "last modified time", non-null). Targets
|
|
43
|
+
* supply the codec/native-type pair that matches their timestamp column;
|
|
44
|
+
* everything else is shared so PSL `temporal.updatedAt()` and TS
|
|
45
|
+
* `field.temporal.updatedAt()` lower to byte-identical contracts across
|
|
46
|
+
* targets by construction.
|
|
47
|
+
*/
|
|
48
|
+
export function temporalAuthoringPresets<
|
|
49
|
+
const CodecId extends string,
|
|
50
|
+
const NativeType extends string,
|
|
51
|
+
>(input: { readonly codecId: CodecId; readonly nativeType: NativeType }) {
|
|
52
|
+
const { codecId, nativeType } = input;
|
|
53
|
+
return {
|
|
54
|
+
createdAt: {
|
|
55
|
+
kind: 'fieldPreset',
|
|
56
|
+
output: {
|
|
57
|
+
codecId,
|
|
58
|
+
nativeType,
|
|
59
|
+
default: { kind: 'function', expression: 'now()' },
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
updatedAt: {
|
|
63
|
+
kind: 'fieldPreset',
|
|
64
|
+
output: {
|
|
65
|
+
codecId,
|
|
66
|
+
nativeType,
|
|
67
|
+
executionDefaults: {
|
|
68
|
+
onCreate: { kind: 'generator', id: TIMESTAMP_NOW_GENERATOR_ID },
|
|
69
|
+
onUpdate: { kind: 'generator', id: TIMESTAMP_NOW_GENERATOR_ID },
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
} as const satisfies Record<string, AuthoringFieldPresetDescriptor>;
|
|
74
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { RuntimeMutationDefaultGenerator } from '@prisma-next/sql-runtime';
|
|
2
|
+
import { TIMESTAMP_NOW_GENERATOR_ID } from './timestamp-now-generator';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Builds the canonical runtime-plane generator for the wall-clock-now
|
|
6
|
+
* mutation default. Returns `new Date()`; semantics are target-agnostic
|
|
7
|
+
* so all SQL targets share this single implementation.
|
|
8
|
+
*
|
|
9
|
+
* Declares `stability: 'query'` so a single ORM bulk operation
|
|
10
|
+
* (e.g. `createAll([...])`) shares one timestamp across every row and
|
|
11
|
+
* every timestamp-defaulted column. Matches Prisma 6's `@updatedAt`
|
|
12
|
+
* semantics: one `new Date()` per lowered mutation, not per row.
|
|
13
|
+
*
|
|
14
|
+
* Lives in a runtime-plane-only module so the control-plane
|
|
15
|
+
* `timestamp-now-generator.ts` (descriptor + authoring presets) stays
|
|
16
|
+
* free of `@prisma-next/sql-runtime` imports.
|
|
17
|
+
*/
|
|
18
|
+
export function timestampNowRuntimeGenerator(): RuntimeMutationDefaultGenerator {
|
|
19
|
+
return {
|
|
20
|
+
id: TIMESTAMP_NOW_GENERATOR_ID,
|
|
21
|
+
generate: () => new Date(),
|
|
22
|
+
stability: 'query',
|
|
23
|
+
};
|
|
24
|
+
}
|
package/src/exports/control.ts
CHANGED
|
@@ -66,5 +66,9 @@ export type {
|
|
|
66
66
|
StorageTypePlanResult,
|
|
67
67
|
} from '../core/migrations/types';
|
|
68
68
|
export { collectInitDependencies, isDatabaseDependencyProvider } from '../core/migrations/types';
|
|
69
|
+
export {
|
|
70
|
+
temporalAuthoringPresets,
|
|
71
|
+
timestampNowControlDescriptor,
|
|
72
|
+
} from '../core/timestamp-now-generator';
|
|
69
73
|
|
|
70
74
|
export default new SqlFamilyDescriptor();
|