@prisma-next/sql-contract-psl 0.5.0-dev.8 → 0.5.0-dev.81
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 +9 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -3
- package/dist/{interpreter-iFCRN9nb.mjs → interpreter-C9MPo8FK.mjs} +358 -76
- package/dist/interpreter-C9MPo8FK.mjs.map +1 -0
- package/dist/provider.d.mts +2 -2
- package/dist/provider.d.mts.map +1 -1
- package/dist/provider.mjs +3 -6
- package/dist/provider.mjs.map +1 -1
- package/package.json +13 -12
- package/src/interpreter.ts +128 -28
- package/src/provider.ts +3 -5
- package/src/psl-attribute-parsing.ts +14 -5
- package/src/psl-authoring-arguments.ts +6 -0
- package/src/psl-column-resolution.ts +228 -37
- package/src/psl-field-resolution.ts +138 -17
- package/src/psl-relation-resolution.ts +3 -0
- package/dist/interpreter-iFCRN9nb.mjs.map +0 -1
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
|
|
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',
|
|
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',
|
|
23
|
+
readonly composedExtensionPackRefs?: readonly ExtensionPackRef<'sql', string>[];
|
|
24
24
|
readonly controlMutationDefaults?: ControlMutationDefaults$1;
|
|
25
25
|
readonly authoringContributions?: AuthoringContributions;
|
|
26
26
|
}
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/psl-column-resolution.ts","../src/interpreter.ts"],"
|
|
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-
|
|
2
|
-
|
|
3
|
-
export { interpretPslDocumentToSqlContract };
|
|
1
|
+
import { t as interpretPslDocumentToSqlContract } from "./interpreter-C9MPo8FK.mjs";
|
|
2
|
+
export { interpretPslDocumentToSqlContract };
|