@prisma-next/family-sql 0.15.0-dev.9 → 0.16.0-dev.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.
Files changed (43) hide show
  1. package/dist/{control-adapter-BQgad8Zc.d.mts → control-adapter-CW7FdxeS.d.mts} +1 -2
  2. package/dist/control-adapter-CW7FdxeS.d.mts.map +1 -0
  3. package/dist/control-adapter.d.mts +1 -1
  4. package/dist/control.d.mts +127 -5
  5. package/dist/control.d.mts.map +1 -1
  6. package/dist/control.mjs +11 -9
  7. package/dist/control.mjs.map +1 -1
  8. package/dist/diff.d.mts +3 -4
  9. package/dist/diff.d.mts.map +1 -1
  10. package/dist/diff.mjs +1 -1
  11. package/dist/ir.d.mts +0 -1
  12. package/dist/ir.d.mts.map +1 -1
  13. package/dist/migration.d.mts +1 -2
  14. package/dist/migration.d.mts.map +1 -1
  15. package/dist/pack.d.mts.map +1 -1
  16. package/dist/psl-infer.d.mts +2 -2
  17. package/dist/psl-infer.d.mts.map +1 -1
  18. package/dist/psl-infer.mjs +2 -3
  19. package/dist/psl-infer.mjs.map +1 -1
  20. package/dist/runtime.d.mts +0 -1
  21. package/dist/runtime.d.mts.map +1 -1
  22. package/dist/runtime.mjs +1 -1
  23. package/dist/{schema-differ-DnoopSXm.d.mts → schema-differ-C8OHo1V5.d.mts} +1 -2
  24. package/dist/schema-differ-C8OHo1V5.d.mts.map +1 -0
  25. package/dist/{schema-verify-3sOPsdn_.mjs → schema-verify-DY21bMwy.mjs} +2 -2
  26. package/dist/{schema-verify-3sOPsdn_.mjs.map → schema-verify-DY21bMwy.mjs.map} +1 -1
  27. package/dist/{timestamp-now-generator-CloimujU.mjs → timestamp-now-generator-DRXygu32.mjs} +88 -2
  28. package/dist/timestamp-now-generator-DRXygu32.mjs.map +1 -0
  29. package/dist/{types-BPv_y7iS.d.mts → types-6JMCRorL.d.mts} +3 -4
  30. package/dist/types-6JMCRorL.d.mts.map +1 -0
  31. package/dist/verify.d.mts +0 -1
  32. package/dist/verify.d.mts.map +1 -1
  33. package/package.json +25 -23
  34. package/src/core/diff/schema-verify.ts +1 -1
  35. package/src/core/migrations/contract-to-schema-ir.ts +29 -4
  36. package/src/core/migrations/types.ts +10 -10
  37. package/src/core/psl-contract-infer/name-transforms.ts +3 -13
  38. package/src/core/timestamp-now-generator.ts +88 -0
  39. package/src/exports/control.ts +3 -0
  40. package/dist/control-adapter-BQgad8Zc.d.mts.map +0 -1
  41. package/dist/schema-differ-DnoopSXm.d.mts.map +0 -1
  42. package/dist/timestamp-now-generator-CloimujU.mjs.map +0 -1
  43. package/dist/types-BPv_y7iS.d.mts.map +0 -1
package/package.json CHANGED
@@ -1,35 +1,37 @@
1
1
  {
2
2
  "name": "@prisma-next/family-sql",
3
- "version": "0.15.0-dev.9",
3
+ "version": "0.16.0-dev.1",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "description": "SQL family descriptor for Prisma Next",
8
8
  "dependencies": {
9
- "@prisma-next/contract": "0.15.0-dev.9",
10
- "@prisma-next/emitter": "0.15.0-dev.9",
11
- "@prisma-next/framework-components": "0.15.0-dev.9",
12
- "@prisma-next/migration-tools": "0.15.0-dev.9",
13
- "@prisma-next/operations": "0.15.0-dev.9",
14
- "@prisma-next/sql-contract": "0.15.0-dev.9",
15
- "@prisma-next/sql-contract-emitter": "0.15.0-dev.9",
16
- "@prisma-next/sql-contract-ts": "0.15.0-dev.9",
17
- "@prisma-next/sql-operations": "0.15.0-dev.9",
18
- "@prisma-next/sql-relational-core": "0.15.0-dev.9",
19
- "@prisma-next/sql-runtime": "0.15.0-dev.9",
20
- "@prisma-next/sql-schema-ir": "0.15.0-dev.9",
21
- "@prisma-next/utils": "0.15.0-dev.9",
22
- "arktype": "^2.2.2"
9
+ "@prisma-next/contract": "0.16.0-dev.1",
10
+ "@prisma-next/emitter": "0.16.0-dev.1",
11
+ "@prisma-next/framework-components": "0.16.0-dev.1",
12
+ "@prisma-next/migration-tools": "0.16.0-dev.1",
13
+ "@prisma-next/operations": "0.16.0-dev.1",
14
+ "@prisma-next/sql-contract": "0.16.0-dev.1",
15
+ "@prisma-next/sql-contract-emitter": "0.16.0-dev.1",
16
+ "@prisma-next/sql-contract-ts": "0.16.0-dev.1",
17
+ "@prisma-next/sql-operations": "0.16.0-dev.1",
18
+ "@prisma-next/sql-relational-core": "0.16.0-dev.1",
19
+ "@prisma-next/sql-runtime": "0.16.0-dev.1",
20
+ "@prisma-next/sql-schema-ir": "0.16.0-dev.1",
21
+ "@prisma-next/utils": "0.16.0-dev.1",
22
+ "arktype": "^2.2.2",
23
+ "pluralize": "^8.0.0"
23
24
  },
24
25
  "devDependencies": {
25
- "@prisma-next/driver-postgres": "0.15.0-dev.9",
26
- "@prisma-next/psl-parser": "0.15.0-dev.9",
27
- "@prisma-next/psl-printer": "0.15.0-dev.9",
28
- "@prisma-next/sql-contract-psl": "0.15.0-dev.9",
29
- "@prisma-next/test-utils": "0.15.0-dev.9",
30
- "@prisma-next/tsconfig": "0.15.0-dev.9",
31
- "@prisma-next/tsdown": "0.15.0-dev.9",
32
- "tsdown": "0.22.3",
26
+ "@prisma-next/driver-postgres": "0.16.0-dev.1",
27
+ "@prisma-next/psl-parser": "0.16.0-dev.1",
28
+ "@prisma-next/psl-printer": "0.16.0-dev.1",
29
+ "@prisma-next/sql-contract-psl": "0.16.0-dev.1",
30
+ "@prisma-next/test-utils": "0.16.0-dev.1",
31
+ "@prisma-next/tsconfig": "0.16.0-dev.1",
32
+ "@prisma-next/tsdown": "0.16.0-dev.1",
33
+ "@types/pluralize": "^0.0.33",
34
+ "tsdown": "0.22.8",
33
35
  "typescript": "5.9.3",
34
36
  "vitest": "4.1.10"
35
37
  },
@@ -300,7 +300,7 @@ export function verifySqlSchemaByDiff(
300
300
  : undefined;
301
301
  return {
302
302
  ok,
303
- ...(ok ? {} : { code: 'PN-SCHEMA-0001' }),
303
+ ...(ok ? {} : { code: 'CONTRACT.SCHEMA_VERIFICATION_FAILED' }),
304
304
  summary: ok
305
305
  ? 'Database schema satisfies contract'
306
306
  : `Database schema does not satisfy contract (${failCount} failure${failCount === 1 ? '' : 's'})`,
@@ -56,6 +56,17 @@ export type NativeTypeExpander = (input: {
56
56
  */
57
57
  export type DefaultRenderer = (def: ColumnDefault, column: StorageColumn) => string;
58
58
 
59
+ /**
60
+ * Target-supplied hook (same IoC seam as `NativeTypeExpander`/`DefaultRenderer`)
61
+ * that normalizes a contract-declared `ColumnDefault` into the resolved shape
62
+ * the target's introspection parses from the live database — e.g. a
63
+ * `dbgenerated("'{}'::jsonb")` function call and the literal Postgres reports
64
+ * are the same value in different shapes, and `resolvedDefaultsEqual`
65
+ * compares `kind` before content. When omitted, the contract's raw default
66
+ * is the resolved default unchanged.
67
+ */
68
+ export type DefaultResolver = (def: ColumnDefault, resolvedNativeType: string) => ColumnDefault;
69
+
59
70
  /**
60
71
  * Target-supplied callback that resolves a contract namespace to the live
61
72
  * database schema its enums are stored under.
@@ -77,6 +88,7 @@ function convertColumn(
77
88
  storageTypes: ResolvedStorageTypes,
78
89
  expandNativeType: NativeTypeExpander | undefined,
79
90
  renderDefault: DefaultRenderer | undefined,
91
+ resolveDefault: DefaultResolver | undefined,
80
92
  ): SqlColumnIRInput {
81
93
  // Resolve `typeRef` so columns that delegate their `nativeType`/`codecId`/
82
94
  // `typeParams` to a named `storage.types` entry expand the same way as
@@ -107,6 +119,11 @@ function convertColumn(
107
119
  // agree on as the comparable "expanded" type.
108
120
  const nativeType = baseNativeType;
109
121
  const resolvedNativeType = column.many ? `${baseNativeType}[]` : baseNativeType;
122
+ const rawColumnDefault = column.default ?? undefined;
123
+ const resolvedColumnDefault =
124
+ rawColumnDefault !== undefined && resolveDefault
125
+ ? resolveDefault(rawColumnDefault, resolvedNativeType)
126
+ : rawColumnDefault;
110
127
  return {
111
128
  name,
112
129
  nativeType,
@@ -117,11 +134,14 @@ function convertColumn(
117
134
  column.default != null && renderDefault ? renderDefault(column.default, column) : undefined,
118
135
  ),
119
136
  // Contract-derived columns are resolved by construction: the computed
120
- // full native type doubles as the resolved value, and the contract's
121
- // structured default is the resolved default (the introspected side
122
- // stamps its normalizer's parse of the raw expression).
137
+ // full native type doubles as the resolved value. The contract's raw
138
+ // structured default becomes the resolved default after passing through
139
+ // the target's `resolveDefault` hook (when supplied), so a default the
140
+ // target's introspection side would normalize differently (e.g. a
141
+ // `dbgenerated(...)` function call that is actually a literal) compares
142
+ // equal instead of drifting on `kind` alone.
123
143
  resolvedNativeType,
124
- ...ifDefined('resolvedDefault', column.default ?? undefined),
144
+ ...ifDefined('resolvedDefault', resolvedColumnDefault),
125
145
  // The column's codec identity, carried the same way the query AST
126
146
  // carries `CodecRef` (TML-2456) — the migration planner's op-builders
127
147
  // resolve DDL rendering from this at plan time (Decision 5), instead of
@@ -339,6 +359,7 @@ function convertTable(
339
359
  storageTypes: ResolvedStorageTypes,
340
360
  expandNativeType: NativeTypeExpander | undefined,
341
361
  renderDefault: DefaultRenderer | undefined,
362
+ resolveDefault: DefaultResolver | undefined,
342
363
  storage: SqlStorage,
343
364
  ): SqlTableIR {
344
365
  const columns: Record<string, SqlColumnIRInput> = {};
@@ -349,6 +370,7 @@ function convertTable(
349
370
  storageTypes,
350
371
  expandNativeType,
351
372
  renderDefault,
373
+ resolveDefault,
352
374
  );
353
375
  }
354
376
 
@@ -444,6 +466,7 @@ export interface ContractToSchemaIROptions {
444
466
  readonly annotationNamespace: string;
445
467
  readonly expandNativeType?: NativeTypeExpander;
446
468
  readonly renderDefault?: DefaultRenderer;
469
+ readonly resolveDefault?: DefaultResolver;
447
470
  /**
448
471
  * Target-supplied resolver mapping a namespace to the live database schema
449
472
  * its enums are stored under. When provided (Postgres), namespace-scoped
@@ -504,6 +527,7 @@ export function contractNamespaceToSchemaIR(
504
527
  storageTypes,
505
528
  options.expandNativeType,
506
529
  options.renderDefault,
530
+ options.resolveDefault,
507
531
  storage,
508
532
  );
509
533
  }
@@ -540,6 +564,7 @@ export function contractToSchemaIR(
540
564
  storageTypes,
541
565
  options.expandNativeType,
542
566
  options.renderDefault,
567
+ options.resolveDefault,
543
568
  storage,
544
569
  );
545
570
  }
@@ -419,16 +419,16 @@ export interface SqlMigrationRunnerExecuteOptions<TTargetDetails> {
419
419
  }
420
420
 
421
421
  export type SqlMigrationRunnerErrorCode =
422
- | 'DESTINATION_CONTRACT_MISMATCH'
423
- | 'LEGACY_MARKER_SHAPE'
424
- | 'MARKER_ORIGIN_MISMATCH'
425
- | 'MARKER_CAS_FAILURE'
426
- | 'POLICY_VIOLATION'
427
- | 'PRECHECK_FAILED'
428
- | 'POSTCHECK_FAILED'
429
- | 'SCHEMA_VERIFY_FAILED'
430
- | 'FOREIGN_KEY_VIOLATION'
431
- | 'EXECUTION_FAILED';
422
+ | 'MIGRATION.DESTINATION_CONTRACT_MISMATCH'
423
+ | 'MIGRATION.LEGACY_MARKER_SHAPE'
424
+ | 'MIGRATION.MARKER_ORIGIN_MISMATCH'
425
+ | 'MIGRATION.MARKER_CAS_FAILURE'
426
+ | 'MIGRATION.POLICY_VIOLATION'
427
+ | 'MIGRATION.PRECHECK_FAILED'
428
+ | 'MIGRATION.POSTCHECK_FAILED'
429
+ | 'MIGRATION.SCHEMA_VERIFY_FAILED'
430
+ | 'MIGRATION.FOREIGN_KEY_VIOLATION'
431
+ | 'MIGRATION.EXECUTION_FAILED';
432
432
 
433
433
  export interface SqlMigrationRunnerFailure extends MigrationRunnerFailure {
434
434
  readonly code: SqlMigrationRunnerErrorCode;
@@ -1,3 +1,5 @@
1
+ import pluralizeLib from 'pluralize';
2
+
1
3
  const PSL_RESERVED_WORDS = new Set(['model', 'enum', 'types', 'type', 'generator', 'datasource']);
2
4
 
3
5
  const IDENTIFIER_PART_PATTERN = /[A-Za-z0-9]+/g;
@@ -143,19 +145,7 @@ export function toEnumMemberName(value: string): string {
143
145
  }
144
146
 
145
147
  export function pluralize(word: string): string {
146
- if (
147
- word.endsWith('s') ||
148
- word.endsWith('x') ||
149
- word.endsWith('z') ||
150
- word.endsWith('ch') ||
151
- word.endsWith('sh')
152
- ) {
153
- return `${word}es`;
154
- }
155
- if (word.endsWith('y') && !/[aeiou]y$/i.test(word)) {
156
- return `${word.slice(0, -1)}ies`;
157
- }
158
- return `${word}s`;
148
+ return pluralizeLib.plural(word);
159
149
  }
160
150
 
161
151
  export function deriveRelationFieldName(
@@ -73,3 +73,91 @@ export function temporalAuthoringPresets<
73
73
  },
74
74
  } as const satisfies Record<string, AuthoringFieldPresetDescriptor>;
75
75
  }
76
+
77
+ const TEMPORAL_PRECISION_ARG = {
78
+ name: 'precision',
79
+ kind: 'number',
80
+ optional: true,
81
+ integer: true,
82
+ minimum: 0,
83
+ } as const;
84
+
85
+ const TEMPORAL_ON_CREATE_ARG = {
86
+ name: 'onCreate',
87
+ kind: 'option',
88
+ values: ['now'],
89
+ optional: true,
90
+ } as const;
91
+
92
+ const TEMPORAL_ON_UPDATE_ARG = {
93
+ name: 'onUpdate',
94
+ kind: 'option',
95
+ values: ['now'],
96
+ optional: true,
97
+ } as const;
98
+
99
+ /**
100
+ * Selects the `timestampNow` generator descriptor for the preset's `now`
101
+ * token. The token is preset vocabulary; the generator id never appears in a
102
+ * user's spelling (ADR 169 — `timestampNow` is preset-only).
103
+ */
104
+ function temporalPhaseTemplate<const Index extends number>(index: Index) {
105
+ return {
106
+ kind: 'select',
107
+ index,
108
+ cases: { now: { kind: 'generator', id: TIMESTAMP_NOW_GENERATOR_ID } },
109
+ } as const;
110
+ }
111
+
112
+ /**
113
+ * Builds a `temporal.<codec>` field preset for a codec that takes a precision
114
+ * parameter (`pg/timestamp@1`, `pg/timestamptz@1`). Arguments change field
115
+ * properties only — never the codec, which the caller fixes here.
116
+ *
117
+ * All three arguments are optional: omitting `precision` omits `typeParams`
118
+ * entirely, and omitting a phase omits that phase (both omitted omits
119
+ * `executionDefaults`).
120
+ */
121
+ /* @__NO_SIDE_EFFECTS__ */
122
+ export function temporalCodecPresetWithPrecision<
123
+ const CodecId extends string,
124
+ const NativeType extends string,
125
+ >(input: { readonly codecId: CodecId; readonly nativeType: NativeType }) {
126
+ return {
127
+ kind: 'fieldPreset',
128
+ args: [TEMPORAL_PRECISION_ARG, TEMPORAL_ON_CREATE_ARG, TEMPORAL_ON_UPDATE_ARG],
129
+ output: {
130
+ codecId: input.codecId,
131
+ nativeType: input.nativeType,
132
+ typeParams: { precision: { kind: 'arg', index: 0 } },
133
+ executionDefaults: {
134
+ onCreate: temporalPhaseTemplate(1),
135
+ onUpdate: temporalPhaseTemplate(2),
136
+ },
137
+ },
138
+ } as const satisfies AuthoringFieldPresetDescriptor;
139
+ }
140
+
141
+ /**
142
+ * Builds a `temporal.<codec>` field preset for a codec with no type
143
+ * parameters (`sqlite/datetime@1`). As with the precision-bearing variant,
144
+ * both phase arguments are optional and omitting one omits that phase.
145
+ */
146
+ /* @__NO_SIDE_EFFECTS__ */
147
+ export function temporalCodecPreset<
148
+ const CodecId extends string,
149
+ const NativeType extends string,
150
+ >(input: { readonly codecId: CodecId; readonly nativeType: NativeType }) {
151
+ return {
152
+ kind: 'fieldPreset',
153
+ args: [TEMPORAL_ON_CREATE_ARG, TEMPORAL_ON_UPDATE_ARG],
154
+ output: {
155
+ codecId: input.codecId,
156
+ nativeType: input.nativeType,
157
+ executionDefaults: {
158
+ onCreate: temporalPhaseTemplate(0),
159
+ onUpdate: temporalPhaseTemplate(1),
160
+ },
161
+ },
162
+ } as const satisfies AuthoringFieldPresetDescriptor;
163
+ }
@@ -21,6 +21,7 @@ export type {
21
21
  export type {
22
22
  ContractToSchemaIROptions,
23
23
  DefaultRenderer,
24
+ DefaultResolver,
24
25
  EnumNamespaceSchemaResolver,
25
26
  NativeTypeExpander,
26
27
  } from '../core/migrations/contract-to-schema-ir';
@@ -87,6 +88,8 @@ export type {
87
88
  } from '../core/migrations/types';
88
89
  export {
89
90
  temporalAuthoringPresets,
91
+ temporalCodecPreset,
92
+ temporalCodecPresetWithPrecision,
90
93
  timestampNowControlDescriptor,
91
94
  } from '../core/timestamp-now-generator';
92
95
 
@@ -1 +0,0 @@
1
- {"version":3,"file":"control-adapter-BQgad8Zc.d.mts","names":[],"sources":["../src/core/diff/sql-schema-diff.ts","../src/core/control-adapter.ts"],"mappings":";;;;;;;;;;;KAeY,iBAAA,IACV,UAAA,UACA,UAAA,aACG,aAAa;;AAAA;AAOlB;;;KAAY,oBAAA,IAAwB,UAAkB;AAAA;AAKtD;;AALsD,iBAKtC,WAAA,CAAY,CAAA,qBAAsB,CAAoB;;;;AAftE;;;;;;UCQiB,OAAA;EACf,KAAA,CAAM,GAAA,EAAK,WAAA,GAAc,OAAA,EAAS,OAAA,EAAS,cAAA,YAA0B,gBAAA;AAAA;ADCvE;;;;AAAsD;AAKtD;AALA,UCQiB,qBAAA,SAA8B,OAAA;EAC7C,qBAAA,CACE,GAAA,EAAK,WAAA,GAAc,OAAA,EACnB,OAAA,GAAU,cAAA,YACT,OAAA,CAAQ,iBAAA;AAAA;ADPyD;;;;ACPtE;;ADOsE,UCgBrD,iBAAA,0CACP,sBAAA,QAA8B,OAAA,GACpC,qBAAA;EAxBS;;;;;;;;;;;;;;AAA0E;EAwCrF,UAAA,CACE,MAAA,EAAQ,wBAAA,CAAyB,OAAA,GACjC,KAAA,WACC,OAAA,CAAQ,oBAAA;EAlC0B;;;;;;;EA2CrC,cAAA,CACE,MAAA,EAAQ,wBAAA,CAAyB,OAAA,IAChC,OAAA,CAAQ,WAAA,SAAoB,oBAAA;EA7CqB;;;;EAmDpD,UAAA,CACE,MAAA,EAAQ,wBAAA,CAAyB,OAAA,GACjC,KAAA,YACC,OAAA,UAAiB,iBAAA;EApDC;;;;;;EA4DrB,YAAA,CACE,MAAA,EAAQ,wBAAA,CAAyB,OAAA,GACjC,KAAA,UACA,WAAA;IAAA,SACW,WAAA;IAAA,SACA,WAAA;IAAA,SACA,UAAA;EAAA,IAEV,OAAA;EAxDmC;;;;;;EAgEtC,UAAA,CACE,MAAA,EAAQ,wBAAA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AAyB,MAAA,EAAQ,eAAA;EAAA;AAAA;AAAA,UAG3C,kBAAA;EAAA,SACN,QAAA,EAAU,QAAA,CAAS,UAAA;EAAA,SACnB,MAAA,EAAQ,eAAA;EAAA,SACR,mBAAA,EAAqB,aAAA,CAAc,8BAAA;AAAA;AAAA,KAGlC,eAAA,IAAmB,KAAA,EAAO,kBAAA,KAAuB,mBAAmB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"timestamp-now-generator-CloimujU.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 */\n/* @__NO_SIDE_EFFECTS__ */\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;GAA2B;GAC9D,UAAU;IAAE,MAAM;IAAa,IAAI;GAA2B;EAChE;CACF;AACF;;;;;;;;;;;;AAaA,SAAgB,yBAGd,OAAuE;CACvE,MAAM,EAAE,SAAS,eAAe;CAChC,OAAO;EACL,WAAW;GACT,MAAM;GACN,QAAQ;IACN;IACA;IACA,SAAS;KAAE,MAAM;KAAY,YAAY;IAAQ;GACnD;EACF;EACA,WAAW;GACT,MAAM;GACN,QAAQ;IACN;IACA;IACA,mBAAmB;KACjB,UAAU;MAAE,MAAM;MAAa,IAAI;KAA2B;KAC9D,UAAU;MAAE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