@prisma-next/sql-contract-psl 0.14.0-dev.1 → 0.14.0-dev.11
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 +11 -7
- package/dist/index.d.mts +7 -3
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{interpreter-B0BsCLKT.mjs → interpreter-CygvamTk.mjs} +435 -232
- package/dist/interpreter-CygvamTk.mjs.map +1 -0
- package/dist/provider.d.mts.map +1 -1
- package/dist/provider.mjs +22 -7
- package/dist/provider.mjs.map +1 -1
- package/package.json +12 -12
- package/src/interpreter.ts +151 -323
- package/src/provider.ts +38 -9
- package/src/psl-attribute-parsing.ts +18 -14
- package/src/psl-authoring-arguments.ts +2 -2
- package/src/psl-column-resolution.ts +17 -15
- package/src/psl-field-resolution.ts +28 -20
- package/src/psl-named-type-resolution.ts +250 -0
- package/src/psl-relation-resolution.ts +250 -11
- package/dist/interpreter-B0BsCLKT.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ This keeps core/CLI source-agnostic while giving PSL-first SQL users a one-line
|
|
|
13
13
|
|
|
14
14
|
## Responsibilities
|
|
15
15
|
|
|
16
|
-
- Interpret `
|
|
16
|
+
- Interpret a PSL `SymbolTable` into SQL `Contract`
|
|
17
17
|
- Interpret generic PSL attributes into SQL contract semantics (`@id`, `@unique`, `@default`, `@relation`, `@map`, `@@map`, `@@control`)
|
|
18
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
|
|
19
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)?`)
|
|
@@ -39,7 +39,7 @@ Determinism note:
|
|
|
39
39
|
|
|
40
40
|
The **pure interpreter entrypoint** specifically excludes:
|
|
41
41
|
- File I/O (`schema.prisma` reading)
|
|
42
|
-
- PSL parsing (`
|
|
42
|
+
- PSL parsing (`parse` + `buildSymbolTable`)
|
|
43
43
|
- Artifact emission (`contract.json`, `contract.d.ts`) and hashing
|
|
44
44
|
- CLI or ControlClient orchestration
|
|
45
45
|
|
|
@@ -82,9 +82,9 @@ Contract-level default (specifier options bag):
|
|
|
82
82
|
## Public API
|
|
83
83
|
|
|
84
84
|
- `@prisma-next/sql-contract-psl`
|
|
85
|
-
- `interpretPslDocumentToSqlContract({
|
|
85
|
+
- `interpretPslDocumentToSqlContract({ symbolTable, sourceFile, sourceId, target, scalarTypeDescriptors, composedExtensionContracts, seedDiagnostics?, authoringContributions?, controlMutationDefaults?, composedExtensionPacks? })` — build `symbolTable`/`sourceFile` via `parse(schema)` + `buildSymbolTable(...)` from `@prisma-next/psl-parser`.
|
|
86
86
|
- `@prisma-next/sql-contract-psl/provider`
|
|
87
|
-
- `prismaContract(schemaPath, { output?, target, defaultControlPolicy?, scalarTypeDescriptors, authoringContributions?, controlMutationDefaults?, composedExtensionPacks? })`
|
|
87
|
+
- `prismaContract(schemaPath, { output?, target, defaultControlPolicy?, scalarTypeDescriptors, composedExtensionContracts?, authoringContributions?, controlMutationDefaults?, composedExtensionPacks? })`
|
|
88
88
|
- Provider input is fully preassembled by composition layers (for example `@prisma-next/family-sql/control` helpers).
|
|
89
89
|
|
|
90
90
|
## Dependencies
|
|
@@ -104,9 +104,13 @@ Contract-level default (specifier options bag):
|
|
|
104
104
|
flowchart LR
|
|
105
105
|
config[prisma-next.config.ts] --> providerHelper[@prisma-next/sql-contract-psl/provider]
|
|
106
106
|
providerHelper --> fsRead[read schema.prisma]
|
|
107
|
-
fsRead -->
|
|
108
|
-
|
|
109
|
-
parsed -->
|
|
107
|
+
fsRead --> parse[parse]
|
|
108
|
+
parse --> parsed[DocumentAst + SourceFile + parser diagnostics]
|
|
109
|
+
parsed --> symbols[buildSymbolTable]
|
|
110
|
+
providerHelper --> descriptors[pslBlockDescriptors]
|
|
111
|
+
descriptors --> symbols
|
|
112
|
+
symbols --> symbolTable[SymbolTable + symbol-table diagnostics]
|
|
113
|
+
symbolTable --> interpreter[@prisma-next/sql-contract-psl]
|
|
110
114
|
interpreter --> irResult[Result_Contract_Diagnostics]
|
|
111
115
|
irResult --> emit[Framework emit pipeline]
|
|
112
116
|
```
|
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Contract } from "@prisma-next/contract/types";
|
|
2
2
|
import { AuthoringContributions } from "@prisma-next/framework-components/authoring";
|
|
3
|
+
import { SymbolTable } from "@prisma-next/psl-parser";
|
|
3
4
|
import { Result } from "@prisma-next/utils/result";
|
|
4
|
-
import {
|
|
5
|
+
import { SourceFile } from "@prisma-next/psl-parser/syntax";
|
|
5
6
|
import { ControlMutationDefaults, ControlMutationDefaults as ControlMutationDefaults$1, DefaultFunctionLoweringContext, DefaultFunctionLoweringHandler, DefaultFunctionRegistry, DefaultFunctionRegistryEntry, MutationDefaultGeneratorDescriptor } from "@prisma-next/framework-components/control";
|
|
6
|
-
import { ContractSourceDiagnostics } from "@prisma-next/config/config-types";
|
|
7
|
+
import { ContractSourceDiagnostic, ContractSourceDiagnostics } from "@prisma-next/config/config-types";
|
|
7
8
|
import { CodecLookup } from "@prisma-next/framework-components/codec";
|
|
8
9
|
import { ExtensionPackRef, TargetPackRef } from "@prisma-next/framework-components/components";
|
|
9
10
|
import { Namespace } from "@prisma-next/framework-components/ir";
|
|
@@ -19,7 +20,9 @@ type ColumnDescriptor = {
|
|
|
19
20
|
//#endregion
|
|
20
21
|
//#region src/interpreter.d.ts
|
|
21
22
|
interface InterpretPslDocumentToSqlContractInput {
|
|
22
|
-
readonly
|
|
23
|
+
readonly symbolTable: SymbolTable;
|
|
24
|
+
readonly sourceFile: SourceFile;
|
|
25
|
+
readonly sourceId: string;
|
|
23
26
|
readonly target: TargetPackRef<'sql', string>;
|
|
24
27
|
readonly scalarTypeDescriptors: ReadonlyMap<string, ColumnDescriptor>;
|
|
25
28
|
readonly composedExtensionPacks?: readonly string[];
|
|
@@ -47,6 +50,7 @@ interface InterpretPslDocumentToSqlContractInput {
|
|
|
47
50
|
*/
|
|
48
51
|
readonly createNamespace?: (input: SqlNamespaceTablesInput) => Namespace;
|
|
49
52
|
readonly codecLookup?: CodecLookup;
|
|
53
|
+
readonly seedDiagnostics?: readonly ContractSourceDiagnostic[];
|
|
50
54
|
}
|
|
51
55
|
declare function interpretPslDocumentToSqlContract(input: InterpretPslDocumentToSqlContractInput): Result<Contract, ContractSourceDiagnostics>;
|
|
52
56
|
//#endregion
|
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"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/psl-column-resolution.ts","../src/interpreter.ts"],"mappings":";;;;;;;;;;;;;KA2CY,gBAAA;EAAA,SACD,OAAA;EAAA,SACA,UAAA;EAAA,SACA,OAAA;EAAA,SACA,UAAA,GAAa,MAAM;AAAA;;;UCuDb,sCAAA;EAAA,SACN,WAAA,EAAa,WAAA;EAAA,SACb,UAAA,EAAY,UAAA;EAAA,SACZ,QAAA;EAAA,SACA,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;EDhEN;AAAA;;;;ACuD9B;;;;EDvD8B,SC0EnB,0BAAA,EAA4B,WAAA,SAAoB,QAAA;EAfxC;;;;;;;;;EAAA,SAyBR,eAAA,IAAmB,KAAA,EAAO,uBAAA,KAA4B,SAAA;EAAA,SACtD,WAAA,GAAc,WAAA;EAAA,SACd,eAAA,YAA2B,wBAAA;AAAA;AAAA,iBAq9CtB,iCAAA,CACd,KAAA,EAAO,sCAAA,GACN,MAAA,CAAO,QAAA,EAAU,yBAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as interpretPslDocumentToSqlContract } from "./interpreter-
|
|
1
|
+
import { t as interpretPslDocumentToSqlContract } from "./interpreter-CygvamTk.mjs";
|
|
2
2
|
export { interpretPslDocumentToSqlContract };
|