@prisma/param-graph-builder 7.6.0 → 7.7.0-dev.2
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/dist/index.d.mts +110 -0
- package/dist/index.d.ts +110 -4
- package/dist/index.js +476 -7
- package/dist/index.mjs +469 -3
- package/package.json +3 -3
- package/dist/build-param-graph.js +0 -43
- package/dist/build-param-graph.mjs +0 -18
- package/dist/dmmf-traverser.js +0 -367
- package/dist/dmmf-traverser.mjs +0 -343
- package/dist/param-graph-builder.js +0 -139
- package/dist/param-graph-builder.mjs +0 -115
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import type * as DMMF from '@prisma/dmmf';
|
|
2
|
+
import type { InputEdgeData } from '@prisma/param-graph';
|
|
3
|
+
import type { OutputEdgeData } from '@prisma/param-graph';
|
|
4
|
+
import type { ParamGraphData } from '@prisma/param-graph';
|
|
5
|
+
import type { RootEntryData } from '@prisma/param-graph';
|
|
6
|
+
import type { SerializedParamGraph } from '@prisma/param-graph';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Builds and serializes a ParamGraph from DMMF schema.
|
|
10
|
+
*
|
|
11
|
+
* This is the primary API for generators - it returns the compact
|
|
12
|
+
* serialized format ready to be embedded in generated clients.
|
|
13
|
+
*
|
|
14
|
+
* @param dmmf - The DMMF document from the schema
|
|
15
|
+
* @returns The serialized param graph
|
|
16
|
+
*/
|
|
17
|
+
export declare function buildAndSerializeParamGraph(dmmf: DMMF.Document): SerializedParamGraph;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Builds a ParamGraphData from DMMF schema.
|
|
21
|
+
*
|
|
22
|
+
* @param dmmf - The DMMF document from the schema
|
|
23
|
+
* @returns The param graph data structure
|
|
24
|
+
*/
|
|
25
|
+
export declare function buildParamGraph(dmmf: DMMF.Document): ParamGraphData;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Traverses DMMF and populates a ParamGraphBuilder.
|
|
29
|
+
*/
|
|
30
|
+
export declare class DMMFTraverser {
|
|
31
|
+
#private;
|
|
32
|
+
constructor(builder: ParamGraphBuilder, dmmf: DMMF.Document);
|
|
33
|
+
/**
|
|
34
|
+
* Process all root operations from model mappings.
|
|
35
|
+
*/
|
|
36
|
+
processRoots(mappings: readonly DMMF.ModelMapping[]): void;
|
|
37
|
+
/**
|
|
38
|
+
* Builds an input node from schema arguments.
|
|
39
|
+
*/
|
|
40
|
+
buildInputNodeFromArgs(args: readonly DMMF.SchemaArg[]): NodeId | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Builds an input node for a named input type.
|
|
43
|
+
* Node allocation happens immediately, but field processing is deferred
|
|
44
|
+
* to avoid deep recursion.
|
|
45
|
+
*/
|
|
46
|
+
buildInputTypeNode(typeName: string): NodeId | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* Builds a union node for multiple input types.
|
|
49
|
+
* Node allocation happens immediately, but field processing is deferred
|
|
50
|
+
* to avoid deep recursion.
|
|
51
|
+
*/
|
|
52
|
+
buildUnionNode(typeNames: string[]): NodeId | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* Builds an output node for a named output type.
|
|
55
|
+
*/
|
|
56
|
+
buildOutputTypeNode(typeName: string): NodeId | undefined;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export declare type NodeId = number;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Builder class that accumulates graph data during construction.
|
|
63
|
+
*/
|
|
64
|
+
export declare class ParamGraphBuilder {
|
|
65
|
+
#private;
|
|
66
|
+
/**
|
|
67
|
+
* Interns a string into the string table, returning its index.
|
|
68
|
+
* Both field names and enum names go through this method.
|
|
69
|
+
*/
|
|
70
|
+
internString(str: string): number;
|
|
71
|
+
/**
|
|
72
|
+
* Allocates a new input node and returns its ID.
|
|
73
|
+
*/
|
|
74
|
+
allocateInputNode(): NodeId;
|
|
75
|
+
/**
|
|
76
|
+
* Sets edges on an input node.
|
|
77
|
+
*/
|
|
78
|
+
setInputNodeEdges(nodeId: NodeId, edges: Record<number, InputEdgeData>): void;
|
|
79
|
+
/**
|
|
80
|
+
* Allocates a new output node and returns its ID.
|
|
81
|
+
*/
|
|
82
|
+
allocateOutputNode(): NodeId;
|
|
83
|
+
/**
|
|
84
|
+
* Sets edges on an output node.
|
|
85
|
+
*/
|
|
86
|
+
setOutputNodeEdges(nodeId: NodeId, edges: Record<number, OutputEdgeData>): void;
|
|
87
|
+
/**
|
|
88
|
+
* Records a root entry for an operation.
|
|
89
|
+
*/
|
|
90
|
+
setRoot(key: string, entry: RootEntryData): void;
|
|
91
|
+
getInputTypeNode(typeName: string): NodeId | undefined;
|
|
92
|
+
setInputTypeNode(typeName: string, nodeId: NodeId | undefined): void;
|
|
93
|
+
hasInputTypeNode(typeName: string): boolean;
|
|
94
|
+
getUnionNode(key: string): NodeId | undefined;
|
|
95
|
+
setUnionNode(key: string, nodeId: NodeId | undefined): void;
|
|
96
|
+
hasUnionNode(key: string): boolean;
|
|
97
|
+
getOutputTypeNode(typeName: string): NodeId | undefined;
|
|
98
|
+
setOutputTypeNode(typeName: string, nodeId: NodeId | undefined): void;
|
|
99
|
+
hasOutputTypeNode(typeName: string): boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Builds the final ParamGraphData structure.
|
|
102
|
+
*/
|
|
103
|
+
build(): ParamGraphData;
|
|
104
|
+
/**
|
|
105
|
+
* Builds and serializes to the compact binary format.
|
|
106
|
+
*/
|
|
107
|
+
buildAndSerialize(): SerializedParamGraph;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export { }
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,110 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import type * as DMMF from '@prisma/dmmf';
|
|
2
|
+
import type { InputEdgeData } from '@prisma/param-graph';
|
|
3
|
+
import type { OutputEdgeData } from '@prisma/param-graph';
|
|
4
|
+
import type { ParamGraphData } from '@prisma/param-graph';
|
|
5
|
+
import type { RootEntryData } from '@prisma/param-graph';
|
|
6
|
+
import type { SerializedParamGraph } from '@prisma/param-graph';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Builds and serializes a ParamGraph from DMMF schema.
|
|
10
|
+
*
|
|
11
|
+
* This is the primary API for generators - it returns the compact
|
|
12
|
+
* serialized format ready to be embedded in generated clients.
|
|
13
|
+
*
|
|
14
|
+
* @param dmmf - The DMMF document from the schema
|
|
15
|
+
* @returns The serialized param graph
|
|
16
|
+
*/
|
|
17
|
+
export declare function buildAndSerializeParamGraph(dmmf: DMMF.Document): SerializedParamGraph;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Builds a ParamGraphData from DMMF schema.
|
|
21
|
+
*
|
|
22
|
+
* @param dmmf - The DMMF document from the schema
|
|
23
|
+
* @returns The param graph data structure
|
|
24
|
+
*/
|
|
25
|
+
export declare function buildParamGraph(dmmf: DMMF.Document): ParamGraphData;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Traverses DMMF and populates a ParamGraphBuilder.
|
|
29
|
+
*/
|
|
30
|
+
export declare class DMMFTraverser {
|
|
31
|
+
#private;
|
|
32
|
+
constructor(builder: ParamGraphBuilder, dmmf: DMMF.Document);
|
|
33
|
+
/**
|
|
34
|
+
* Process all root operations from model mappings.
|
|
35
|
+
*/
|
|
36
|
+
processRoots(mappings: readonly DMMF.ModelMapping[]): void;
|
|
37
|
+
/**
|
|
38
|
+
* Builds an input node from schema arguments.
|
|
39
|
+
*/
|
|
40
|
+
buildInputNodeFromArgs(args: readonly DMMF.SchemaArg[]): NodeId | undefined;
|
|
41
|
+
/**
|
|
42
|
+
* Builds an input node for a named input type.
|
|
43
|
+
* Node allocation happens immediately, but field processing is deferred
|
|
44
|
+
* to avoid deep recursion.
|
|
45
|
+
*/
|
|
46
|
+
buildInputTypeNode(typeName: string): NodeId | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* Builds a union node for multiple input types.
|
|
49
|
+
* Node allocation happens immediately, but field processing is deferred
|
|
50
|
+
* to avoid deep recursion.
|
|
51
|
+
*/
|
|
52
|
+
buildUnionNode(typeNames: string[]): NodeId | undefined;
|
|
53
|
+
/**
|
|
54
|
+
* Builds an output node for a named output type.
|
|
55
|
+
*/
|
|
56
|
+
buildOutputTypeNode(typeName: string): NodeId | undefined;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export declare type NodeId = number;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Builder class that accumulates graph data during construction.
|
|
63
|
+
*/
|
|
64
|
+
export declare class ParamGraphBuilder {
|
|
65
|
+
#private;
|
|
66
|
+
/**
|
|
67
|
+
* Interns a string into the string table, returning its index.
|
|
68
|
+
* Both field names and enum names go through this method.
|
|
69
|
+
*/
|
|
70
|
+
internString(str: string): number;
|
|
71
|
+
/**
|
|
72
|
+
* Allocates a new input node and returns its ID.
|
|
73
|
+
*/
|
|
74
|
+
allocateInputNode(): NodeId;
|
|
75
|
+
/**
|
|
76
|
+
* Sets edges on an input node.
|
|
77
|
+
*/
|
|
78
|
+
setInputNodeEdges(nodeId: NodeId, edges: Record<number, InputEdgeData>): void;
|
|
79
|
+
/**
|
|
80
|
+
* Allocates a new output node and returns its ID.
|
|
81
|
+
*/
|
|
82
|
+
allocateOutputNode(): NodeId;
|
|
83
|
+
/**
|
|
84
|
+
* Sets edges on an output node.
|
|
85
|
+
*/
|
|
86
|
+
setOutputNodeEdges(nodeId: NodeId, edges: Record<number, OutputEdgeData>): void;
|
|
87
|
+
/**
|
|
88
|
+
* Records a root entry for an operation.
|
|
89
|
+
*/
|
|
90
|
+
setRoot(key: string, entry: RootEntryData): void;
|
|
91
|
+
getInputTypeNode(typeName: string): NodeId | undefined;
|
|
92
|
+
setInputTypeNode(typeName: string, nodeId: NodeId | undefined): void;
|
|
93
|
+
hasInputTypeNode(typeName: string): boolean;
|
|
94
|
+
getUnionNode(key: string): NodeId | undefined;
|
|
95
|
+
setUnionNode(key: string, nodeId: NodeId | undefined): void;
|
|
96
|
+
hasUnionNode(key: string): boolean;
|
|
97
|
+
getOutputTypeNode(typeName: string): NodeId | undefined;
|
|
98
|
+
setOutputTypeNode(typeName: string, nodeId: NodeId | undefined): void;
|
|
99
|
+
hasOutputTypeNode(typeName: string): boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Builds the final ParamGraphData structure.
|
|
102
|
+
*/
|
|
103
|
+
build(): ParamGraphData;
|
|
104
|
+
/**
|
|
105
|
+
* Builds and serializes to the compact binary format.
|
|
106
|
+
*/
|
|
107
|
+
buildAndSerialize(): SerializedParamGraph;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export { }
|