@prisma-next/sql-contract-psl 0.3.0-dev.128 → 0.3.0-dev.146
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 +5 -6
- package/dist/index.d.mts +12 -7
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/{interpreter-D7gLmaHz.mjs → interpreter-qjtea3zY.mjs} +1238 -824
- package/dist/interpreter-qjtea3zY.mjs.map +1 -0
- package/dist/provider.d.mts +4 -1
- package/dist/provider.d.mts.map +1 -1
- package/dist/provider.mjs +5 -3
- package/dist/provider.mjs.map +1 -1
- package/package.json +11 -8
- package/src/exports/index.ts +2 -2
- package/src/interpreter.ts +978 -1731
- package/src/provider.ts +11 -3
- package/src/psl-attribute-parsing.ts +303 -0
- package/src/psl-column-resolution.ts +404 -0
- package/src/psl-field-resolution.ts +312 -0
- package/src/psl-relation-resolution.ts +362 -0
- package/dist/interpreter-D7gLmaHz.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -6,20 +6,20 @@ PSL-first SQL contract interpretation for Prisma Next.
|
|
|
6
6
|
|
|
7
7
|
`@prisma-next/sql-contract-psl` provides two entrypoints:
|
|
8
8
|
|
|
9
|
-
- **Pure interpreter** (`@prisma-next/sql-contract-psl`): parsed PSL document -> SQL `
|
|
9
|
+
- **Pure interpreter** (`@prisma-next/sql-contract-psl`): parsed PSL document -> SQL `Contract`
|
|
10
10
|
- **Provider helper** (`@prisma-next/sql-contract-psl/provider`): read file -> parse -> interpret -> `ContractConfig`
|
|
11
11
|
|
|
12
12
|
This keeps core/CLI source-agnostic while giving PSL-first SQL users a one-line config helper.
|
|
13
13
|
|
|
14
14
|
## Responsibilities
|
|
15
15
|
|
|
16
|
-
- Interpret `ParsePslDocumentResult` into SQL `
|
|
16
|
+
- Interpret `ParsePslDocumentResult` into SQL `Contract`
|
|
17
17
|
- Interpret generic PSL attributes into SQL contract semantics (`@id`, `@unique`, `@default`, `@relation`, `@map`, `@@map`)
|
|
18
18
|
- Lower supported default functions through composed registry inputs
|
|
19
19
|
- 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`)
|
|
20
20
|
- Support pgvector parity mapping from PSL attributes to existing TS-representable descriptor shape (`codecId`, `nativeType`, `typeParams`)
|
|
21
21
|
- Map PSL relation action tokens to SQL contract referential actions and emit diagnostics for unsupported values
|
|
22
|
-
- Emit deterministic relation metadata in `models.<Model>.relations`
|
|
22
|
+
- Emit deterministic relation metadata in `models.<Model>.relations`
|
|
23
23
|
- Enforce extension composition for supported namespaced attributes (for example `@pgvector.column(...)`)
|
|
24
24
|
- Validate generator applicability by declared `codecId` support on composed generator descriptors
|
|
25
25
|
- Consume target-bound scalar descriptors and mutation-default registries assembled by composition layers
|
|
@@ -66,7 +66,7 @@ Supported `@default(...)` surface in v1 when composed contributors provide handl
|
|
|
66
66
|
## Public API
|
|
67
67
|
|
|
68
68
|
- `@prisma-next/sql-contract-psl`
|
|
69
|
-
- `
|
|
69
|
+
- `interpretPslDocumentToSqlContract({ document, target, scalarTypeDescriptors, controlMutationDefaults?, composedExtensionPacks? })`
|
|
70
70
|
- `@prisma-next/sql-contract-psl/provider`
|
|
71
71
|
- `prismaContract(schemaPath, { output?, target, scalarTypeDescriptors, controlMutationDefaults?, composedExtensionPacks? })`
|
|
72
72
|
- Provider input is fully preassembled by composition layers (for example `@prisma-next/family-sql/control` helpers).
|
|
@@ -76,7 +76,6 @@ Supported `@default(...)` surface in v1 when composed contributors provide handl
|
|
|
76
76
|
- **Depends on**
|
|
77
77
|
- `@prisma-next/psl-parser` for parser + parser result types
|
|
78
78
|
- `@prisma-next/sql-contract-ts` for SQL authoring builder composition
|
|
79
|
-
- `@prisma-next/core-control-plane` for contract source diagnostics types
|
|
80
79
|
- `pathe` for provider path resolution
|
|
81
80
|
- `@prisma-next/contract` and `@prisma-next/utils`
|
|
82
81
|
- **Used by**
|
|
@@ -92,7 +91,7 @@ flowchart LR
|
|
|
92
91
|
fsRead --> parser[@prisma-next/psl-parser]
|
|
93
92
|
parser --> parsed[ParsePslDocumentResult]
|
|
94
93
|
parsed --> interpreter[@prisma-next/sql-contract-psl]
|
|
95
|
-
interpreter --> irResult[
|
|
94
|
+
interpreter --> irResult[Result_Contract_Diagnostics]
|
|
96
95
|
irResult --> emit[Framework emit pipeline]
|
|
97
96
|
```
|
|
98
97
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,25 +1,30 @@
|
|
|
1
1
|
import { a as DefaultFunctionRegistryEntry, i as DefaultFunctionRegistry, n as DefaultFunctionLoweringContext, o as MutationDefaultGeneratorDescriptor, r as DefaultFunctionLoweringHandler, t as ControlMutationDefaults } from "./default-function-registry-DUMRIhJH.mjs";
|
|
2
|
+
import { AuthoringContributions } from "@prisma-next/framework-components/authoring";
|
|
2
3
|
import { Result } from "@prisma-next/utils/result";
|
|
3
4
|
import { ParsePslDocumentResult } from "@prisma-next/psl-parser";
|
|
4
|
-
import { ContractSourceDiagnostics } from "@prisma-next/config/config-types";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { ContractSourceDiagnostic, ContractSourceDiagnostics } from "@prisma-next/config/config-types";
|
|
6
|
+
import { ColumnDefault, Contract, ExecutionMutationDefaultValue } from "@prisma-next/contract/types";
|
|
7
|
+
import { ExtensionPackRef, TargetPackRef } from "@prisma-next/framework-components/components";
|
|
7
8
|
|
|
8
|
-
//#region src/
|
|
9
|
+
//#region src/psl-column-resolution.d.ts
|
|
9
10
|
type ColumnDescriptor = {
|
|
10
11
|
readonly codecId: string;
|
|
11
12
|
readonly nativeType: string;
|
|
12
13
|
readonly typeRef?: string;
|
|
13
14
|
readonly typeParams?: Record<string, unknown>;
|
|
14
15
|
};
|
|
15
|
-
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region src/interpreter.d.ts
|
|
18
|
+
interface InterpretPslDocumentToSqlContractInput {
|
|
16
19
|
readonly document: ParsePslDocumentResult;
|
|
17
20
|
readonly target: TargetPackRef<'sql', 'postgres'>;
|
|
18
21
|
readonly scalarTypeDescriptors: ReadonlyMap<string, ColumnDescriptor>;
|
|
19
22
|
readonly composedExtensionPacks?: readonly string[];
|
|
23
|
+
readonly composedExtensionPackRefs?: readonly ExtensionPackRef<'sql', 'postgres'>[];
|
|
20
24
|
readonly controlMutationDefaults?: ControlMutationDefaults;
|
|
25
|
+
readonly authoringContributions?: AuthoringContributions;
|
|
21
26
|
}
|
|
22
|
-
declare function
|
|
27
|
+
declare function interpretPslDocumentToSqlContract(input: InterpretPslDocumentToSqlContractInput): Result<Contract, ContractSourceDiagnostics>;
|
|
23
28
|
//#endregion
|
|
24
|
-
export { type ControlMutationDefaults, type DefaultFunctionLoweringContext, type DefaultFunctionLoweringHandler, type DefaultFunctionRegistry, type DefaultFunctionRegistryEntry, type
|
|
29
|
+
export { type ControlMutationDefaults, type DefaultFunctionLoweringContext, type DefaultFunctionLoweringHandler, type DefaultFunctionRegistry, type DefaultFunctionRegistryEntry, type InterpretPslDocumentToSqlContractInput, type MutationDefaultGeneratorDescriptor, interpretPslDocumentToSqlContract };
|
|
25
30
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/interpreter.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/psl-column-resolution.ts","../src/interpreter.ts"],"sourcesContent":[],"mappings":";;;;;;;;;KA2BY,gBAAA;;;;EAAA,SAAA,UAAgB,CAAA,EAIJ,MAJI,CAAA,MAIJ,EAAA,OAAM,CAAA;;;;UC4Cb,sCAAA;EDhDL,SAAA,QAAA,ECiDS,sBD7CS;mBC8CX;kCACe,oBAAoB;;EAHrC,SAAA,yBAAA,CAAA,EAAA,SAK+B,gBALO,CAAA,KAAA,EAAA,UAAA,CAAA,EAAA;EAClC,SAAA,uBAAA,CAAA,EAKgB,uBALhB;EACF,SAAA,sBAAA,CAAA,EAKiB,sBALjB;;AACe,iBAm4BlB,iCAAA,CAn4BkB,KAAA,EAo4BzB,sCAp4ByB,CAAA,EAq4B/B,MAr4B+B,CAq4BxB,QAr4BwB,EAq4Bd,yBAr4Bc,CAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { t as
|
|
1
|
+
import { t as interpretPslDocumentToSqlContract } from "./interpreter-qjtea3zY.mjs";
|
|
2
2
|
|
|
3
|
-
export {
|
|
3
|
+
export { interpretPslDocumentToSqlContract };
|