@prisma-next/sql-contract-psl 0.5.0-dev.7 → 0.5.0-dev.70

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -15,6 +15,7 @@ This keeps core/CLI source-agnostic while giving PSL-first SQL users a one-line
15
15
 
16
16
  - Interpret `ParsePslDocumentResult` into SQL `Contract`
17
17
  - Interpret generic PSL attributes into SQL contract semantics (`@id`, `@unique`, `@default`, `@relation`, `@map`, `@@map`)
18
+ - Interpret SQL timestamp semantics: `DateTime @default(now())` (or the equivalent `temporal.createdAt()` field-preset call) as a storage default, and `temporal.updatedAt()` as an execution mutation default
18
19
  - Lower shared constructor expressions in both `types {}` blocks and inline field positions (for example `ShortName = sql.String(length: 35)` and `embedding pgvector.Vector(length: 1536)?`)
19
20
  - Lower supported default functions through composed registry inputs
20
21
  - Support selected Postgres native-type attributes on named types for brownfield round-trips (`@db.Char`, `@db.VarChar`, `@db.Numeric`, `@db.Uuid`, `@db.SmallInt`, `@db.Real`, `@db.Timestamp`, `@db.Timestamptz`, `@db.Date`, `@db.Time`, `@db.Timetz`, `@db.Json`)
@@ -42,7 +43,7 @@ The **pure interpreter entrypoint** specifically excludes:
42
43
  - Artifact emission (`contract.json`, `contract.d.ts`) and hashing
43
44
  - CLI or ControlClient orchestration
44
45
 
45
- Current scope is SQL/Postgres-first: callers pass Postgres-oriented scalar descriptors and target context in v1.
46
+ Current scope is SQL target-specific: callers pass scalar descriptors and target context assembled for the active SQL target.
46
47
 
47
48
  Unsupported PSL constructs in v1 (strict errors):
48
49
 
@@ -63,6 +64,13 @@ Supported `@default(...)` surface in v1 when composed contributors provide handl
63
64
  - Explicitly unsupported in v1: `cuid()` (diagnostic suggests `cuid(2)`)
64
65
  - `dbgenerated("...")` preserves the parsed PSL string-literal contents as-is (escaped sequences are not normalized in v1).
65
66
 
67
+ Supported timestamp authoring surface:
68
+
69
+ - `createdAt DateTime @default(now())` and `createdAt temporal.createdAt()` both lower to the target storage default and do not create an execution mutation default.
70
+ - `updatedAt temporal.updatedAt()` lowers to `timestampNow` on create and on non-empty update mutations. This is application-side because update-time semantics are mutation-aware, not a database trigger.
71
+ - The Prisma-flavored `@updatedAt` attribute is not supported; references produce `PSL_UNSUPPORTED_FIELD_ATTRIBUTE` with a migration hint pointing at `temporal.updatedAt()`. The hint is suppressed when the field already declares any `temporal.*` preset.
72
+ - `@createdAt` is not supported as a PSL alias.
73
+
66
74
  ## Public API
67
75
 
68
76
  - `@prisma-next/sql-contract-psl`
package/dist/index.d.mts CHANGED
@@ -11,16 +11,16 @@ type ColumnDescriptor = {
11
11
  readonly codecId: string;
12
12
  readonly nativeType: string;
13
13
  readonly typeRef?: string;
14
- readonly typeParams?: Record<string, unknown>;
14
+ readonly typeParams?: Record<string, unknown> | undefined;
15
15
  };
16
16
  //#endregion
17
17
  //#region src/interpreter.d.ts
18
18
  interface InterpretPslDocumentToSqlContractInput {
19
19
  readonly document: ParsePslDocumentResult;
20
- readonly target: TargetPackRef<'sql', 'postgres'>;
20
+ readonly target: TargetPackRef<'sql', string>;
21
21
  readonly scalarTypeDescriptors: ReadonlyMap<string, ColumnDescriptor>;
22
22
  readonly composedExtensionPacks?: readonly string[];
23
- readonly composedExtensionPackRefs?: readonly ExtensionPackRef<'sql', 'postgres'>[];
23
+ readonly composedExtensionPackRefs?: readonly ExtensionPackRef<'sql', string>[];
24
24
  readonly controlMutationDefaults?: ControlMutationDefaults$1;
25
25
  readonly authoringContributions?: AuthoringContributions;
26
26
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/psl-column-resolution.ts","../src/interpreter.ts"],"sourcesContent":[],"mappings":";;;;;;;;;KAmCY,gBAAA;;;;EAAA,SAAA,UAAgB,CAAA,EAIJ,MAJI,CAAA,MAIJ,EAAM,OAAA,CAAA;;;;UCsCb,sCAAA;ED1CL,SAAA,QAAA,EC2CS,sBDvCS;mBCwCX;kCACe,oBAAoB;;EAHrC,SAAA,yBAAA,CAAA,EAAA,SAK+B,gBALO,CAAA,KAAA,EAAA,UAAA,CAAA,EAAA;EAClC,SAAA,uBAAA,CAAA,EAKgB,yBALhB;EACF,SAAA,sBAAA,CAAA,EAKiB,sBALjB;;AACe,iBAu/BlB,iCAAA,CAv/BkB,KAAA,EAw/BzB,sCAx/ByB,CAAA,EAy/B/B,MAz/B+B,CAy/BxB,QAz/BwB,EAy/Bd,yBAz/Bc,CAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/psl-column-resolution.ts","../src/interpreter.ts"],"mappings":";;;;;;;;;KAuCY,gBAAA;EAAA,SACD,OAAA;EAAA,SACA,UAAA;EAAA,SACA,OAAA;EAAA,SACA,UAAA,GAAa,MAAA;AAAA;;;UCoCP,sCAAA;EAAA,SACN,QAAA,EAAU,sBAAA;EAAA,SACV,MAAA,EAAQ,aAAA;EAAA,SACR,qBAAA,EAAuB,WAAA,SAAoB,gBAAA;EAAA,SAC3C,sBAAA;EAAA,SACA,yBAAA,YAAqC,gBAAA;EAAA,SACrC,uBAAA,GAA0B,yBAAA;EAAA,SAC1B,sBAAA,GAAyB,sBAAA;AAAA;AAAA,iBAqlCpB,iCAAA,CACd,KAAA,EAAO,sCAAA,GACN,MAAA,CAAO,QAAA,EAAU,yBAAA"}
package/dist/index.mjs CHANGED
@@ -1,3 +1,2 @@
1
- import { t as interpretPslDocumentToSqlContract } from "./interpreter-iFCRN9nb.mjs";
2
-
3
- export { interpretPslDocumentToSqlContract };
1
+ import { t as interpretPslDocumentToSqlContract } from "./interpreter-C9EP3HJr.mjs";
2
+ export { interpretPslDocumentToSqlContract };