@prisma/param-graph 7.7.0-integration-feat-prisma-bootstrap.7 → 7.7.0-integration-feat-bootstrap-ux-fixes.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 +262 -0
- package/dist/index.d.ts +262 -7
- package/dist/index.js +464 -11
- package/dist/index.mjs +453 -3
- package/dist/param-graph.d.ts +6 -2
- package/package.json +1 -1
- package/dist/param-graph.js +0 -241
- package/dist/param-graph.mjs +0 -212
- package/dist/serialization.js +0 -276
- package/dist/serialization.mjs +0 -251
- package/dist/serialization.test.js +0 -169
- package/dist/serialization.test.mjs +0 -168
- package/dist/types.js +0 -16
- package/dist/types.mjs +0 -0
package/dist/param-graph.js
DELETED
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var param_graph_exports = {};
|
|
20
|
-
__export(param_graph_exports, {
|
|
21
|
-
EdgeFlag: () => EdgeFlag,
|
|
22
|
-
ParamGraph: () => ParamGraph,
|
|
23
|
-
ScalarMask: () => ScalarMask,
|
|
24
|
-
getScalarMask: () => getScalarMask,
|
|
25
|
-
hasFlag: () => hasFlag,
|
|
26
|
-
scalarTypeToMask: () => scalarTypeToMask
|
|
27
|
-
});
|
|
28
|
-
module.exports = __toCommonJS(param_graph_exports);
|
|
29
|
-
var import_serialization = require("./serialization");
|
|
30
|
-
class ParamGraph {
|
|
31
|
-
#data;
|
|
32
|
-
#stringIndex;
|
|
33
|
-
#enumLookup;
|
|
34
|
-
constructor(data, enumLookup) {
|
|
35
|
-
this.#data = data;
|
|
36
|
-
this.#enumLookup = enumLookup;
|
|
37
|
-
this.#stringIndex = /* @__PURE__ */ new Map();
|
|
38
|
-
for (let i = 0; i < data.strings.length; i++) {
|
|
39
|
-
this.#stringIndex.set(data.strings[i], i);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Creates a ParamGraph from serialized format.
|
|
44
|
-
* This is the primary factory method for runtime use.
|
|
45
|
-
*/
|
|
46
|
-
static deserialize(serialized, enumLookup) {
|
|
47
|
-
const data = (0, import_serialization.deserializeParamGraph)(serialized);
|
|
48
|
-
return new ParamGraph(data, enumLookup);
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Creates a ParamGraph from builder data.
|
|
52
|
-
* Used by the builder for testing and direct construction.
|
|
53
|
-
*/
|
|
54
|
-
static fromData(data, enumLookup) {
|
|
55
|
-
return new ParamGraph(data, enumLookup);
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Look up a root entry by "Model.action" or "action".
|
|
59
|
-
*/
|
|
60
|
-
root(key) {
|
|
61
|
-
const entry = this.#data.roots[key];
|
|
62
|
-
if (!entry) {
|
|
63
|
-
return void 0;
|
|
64
|
-
}
|
|
65
|
-
return {
|
|
66
|
-
argsNodeId: entry.argsNodeId,
|
|
67
|
-
outputNodeId: entry.outputNodeId
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Get an input node by ID.
|
|
72
|
-
*/
|
|
73
|
-
inputNode(id) {
|
|
74
|
-
if (id === void 0 || id < 0 || id >= this.#data.inputNodes.length) {
|
|
75
|
-
return void 0;
|
|
76
|
-
}
|
|
77
|
-
return { id };
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Get an output node by ID.
|
|
81
|
-
*/
|
|
82
|
-
outputNode(id) {
|
|
83
|
-
if (id === void 0 || id < 0 || id >= this.#data.outputNodes.length) {
|
|
84
|
-
return void 0;
|
|
85
|
-
}
|
|
86
|
-
return { id };
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Get an input edge for a field name within a node.
|
|
90
|
-
*/
|
|
91
|
-
inputEdge(node, fieldName) {
|
|
92
|
-
if (!node) {
|
|
93
|
-
return void 0;
|
|
94
|
-
}
|
|
95
|
-
const nodeData = this.#data.inputNodes[node.id];
|
|
96
|
-
if (!nodeData) {
|
|
97
|
-
return void 0;
|
|
98
|
-
}
|
|
99
|
-
const fieldIndex = this.#stringIndex.get(fieldName);
|
|
100
|
-
if (fieldIndex === void 0) {
|
|
101
|
-
return void 0;
|
|
102
|
-
}
|
|
103
|
-
const edge = nodeData.edges[fieldIndex];
|
|
104
|
-
if (!edge) {
|
|
105
|
-
return void 0;
|
|
106
|
-
}
|
|
107
|
-
return {
|
|
108
|
-
flags: edge.flags,
|
|
109
|
-
childNodeId: edge.childNodeId,
|
|
110
|
-
scalarMask: edge.scalarMask ?? 0,
|
|
111
|
-
enumNameIndex: edge.enumNameIndex
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Get an output edge for a field name within a node.
|
|
116
|
-
*/
|
|
117
|
-
outputEdge(node, fieldName) {
|
|
118
|
-
if (!node) {
|
|
119
|
-
return void 0;
|
|
120
|
-
}
|
|
121
|
-
const nodeData = this.#data.outputNodes[node.id];
|
|
122
|
-
if (!nodeData) {
|
|
123
|
-
return void 0;
|
|
124
|
-
}
|
|
125
|
-
const fieldIndex = this.#stringIndex.get(fieldName);
|
|
126
|
-
if (fieldIndex === void 0) {
|
|
127
|
-
return void 0;
|
|
128
|
-
}
|
|
129
|
-
const edge = nodeData.edges[fieldIndex];
|
|
130
|
-
if (!edge) {
|
|
131
|
-
return void 0;
|
|
132
|
-
}
|
|
133
|
-
return {
|
|
134
|
-
argsNodeId: edge.argsNodeId,
|
|
135
|
-
outputNodeId: edge.outputNodeId
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
/**
|
|
139
|
-
* Get enum values for an edge that references a user enum.
|
|
140
|
-
* Returns undefined if the edge doesn't reference an enum.
|
|
141
|
-
*/
|
|
142
|
-
enumValues(edge) {
|
|
143
|
-
if (edge?.enumNameIndex === void 0) {
|
|
144
|
-
return void 0;
|
|
145
|
-
}
|
|
146
|
-
const enumName = this.#data.strings[edge.enumNameIndex];
|
|
147
|
-
if (!enumName) {
|
|
148
|
-
return void 0;
|
|
149
|
-
}
|
|
150
|
-
return this.#enumLookup(enumName);
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* Get a string from the string table by index.
|
|
154
|
-
*/
|
|
155
|
-
getString(index) {
|
|
156
|
-
return this.#data.strings[index];
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
const EdgeFlag = {
|
|
160
|
-
/**
|
|
161
|
-
* Field may be parameterized as a scalar value.
|
|
162
|
-
* Check ScalarMask to validate the value type.
|
|
163
|
-
*/
|
|
164
|
-
ParamScalar: 1,
|
|
165
|
-
/**
|
|
166
|
-
* Field may be parameterized as an enum.
|
|
167
|
-
* Check enum ID to validate the value type.
|
|
168
|
-
*/
|
|
169
|
-
ParamEnum: 2,
|
|
170
|
-
/**
|
|
171
|
-
* Field accepts list-of-scalar values.
|
|
172
|
-
* Parameterize the whole list if all elements match ScalarMask.
|
|
173
|
-
*/
|
|
174
|
-
ParamListScalar: 4,
|
|
175
|
-
/**
|
|
176
|
-
* Field accepts list-of-enum values.
|
|
177
|
-
* Parameterize the whole list if all elements match enum ID.
|
|
178
|
-
*/
|
|
179
|
-
ParamListEnum: 8,
|
|
180
|
-
/**
|
|
181
|
-
* Field accepts list-of-object values.
|
|
182
|
-
* Recurse into each element using the child node.
|
|
183
|
-
*/
|
|
184
|
-
ListObject: 16,
|
|
185
|
-
/**
|
|
186
|
-
* Field accepts object values.
|
|
187
|
-
* Recurse into child input node.
|
|
188
|
-
*/
|
|
189
|
-
Object: 32
|
|
190
|
-
};
|
|
191
|
-
const ScalarMask = {
|
|
192
|
-
String: 1,
|
|
193
|
-
Int: 2,
|
|
194
|
-
BigInt: 4,
|
|
195
|
-
Float: 8,
|
|
196
|
-
Decimal: 16,
|
|
197
|
-
Boolean: 32,
|
|
198
|
-
DateTime: 64,
|
|
199
|
-
Json: 128,
|
|
200
|
-
Bytes: 256
|
|
201
|
-
};
|
|
202
|
-
function hasFlag(edge, flag) {
|
|
203
|
-
return (edge.flags & flag) !== 0;
|
|
204
|
-
}
|
|
205
|
-
function getScalarMask(edge) {
|
|
206
|
-
return edge.scalarMask;
|
|
207
|
-
}
|
|
208
|
-
function scalarTypeToMask(typeName) {
|
|
209
|
-
switch (typeName) {
|
|
210
|
-
case "String":
|
|
211
|
-
case "UUID":
|
|
212
|
-
return ScalarMask.String;
|
|
213
|
-
case "Int":
|
|
214
|
-
return ScalarMask.Int;
|
|
215
|
-
case "BigInt":
|
|
216
|
-
return ScalarMask.BigInt;
|
|
217
|
-
case "Float":
|
|
218
|
-
return ScalarMask.Float;
|
|
219
|
-
case "Decimal":
|
|
220
|
-
return ScalarMask.Decimal;
|
|
221
|
-
case "Boolean":
|
|
222
|
-
return ScalarMask.Boolean;
|
|
223
|
-
case "DateTime":
|
|
224
|
-
return ScalarMask.DateTime;
|
|
225
|
-
case "Json":
|
|
226
|
-
return ScalarMask.Json;
|
|
227
|
-
case "Bytes":
|
|
228
|
-
return ScalarMask.Bytes;
|
|
229
|
-
default:
|
|
230
|
-
return 0;
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
234
|
-
0 && (module.exports = {
|
|
235
|
-
EdgeFlag,
|
|
236
|
-
ParamGraph,
|
|
237
|
-
ScalarMask,
|
|
238
|
-
getScalarMask,
|
|
239
|
-
hasFlag,
|
|
240
|
-
scalarTypeToMask
|
|
241
|
-
});
|
package/dist/param-graph.mjs
DELETED
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
import { deserializeParamGraph } from "./serialization";
|
|
2
|
-
class ParamGraph {
|
|
3
|
-
#data;
|
|
4
|
-
#stringIndex;
|
|
5
|
-
#enumLookup;
|
|
6
|
-
constructor(data, enumLookup) {
|
|
7
|
-
this.#data = data;
|
|
8
|
-
this.#enumLookup = enumLookup;
|
|
9
|
-
this.#stringIndex = /* @__PURE__ */ new Map();
|
|
10
|
-
for (let i = 0; i < data.strings.length; i++) {
|
|
11
|
-
this.#stringIndex.set(data.strings[i], i);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Creates a ParamGraph from serialized format.
|
|
16
|
-
* This is the primary factory method for runtime use.
|
|
17
|
-
*/
|
|
18
|
-
static deserialize(serialized, enumLookup) {
|
|
19
|
-
const data = deserializeParamGraph(serialized);
|
|
20
|
-
return new ParamGraph(data, enumLookup);
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Creates a ParamGraph from builder data.
|
|
24
|
-
* Used by the builder for testing and direct construction.
|
|
25
|
-
*/
|
|
26
|
-
static fromData(data, enumLookup) {
|
|
27
|
-
return new ParamGraph(data, enumLookup);
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Look up a root entry by "Model.action" or "action".
|
|
31
|
-
*/
|
|
32
|
-
root(key) {
|
|
33
|
-
const entry = this.#data.roots[key];
|
|
34
|
-
if (!entry) {
|
|
35
|
-
return void 0;
|
|
36
|
-
}
|
|
37
|
-
return {
|
|
38
|
-
argsNodeId: entry.argsNodeId,
|
|
39
|
-
outputNodeId: entry.outputNodeId
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Get an input node by ID.
|
|
44
|
-
*/
|
|
45
|
-
inputNode(id) {
|
|
46
|
-
if (id === void 0 || id < 0 || id >= this.#data.inputNodes.length) {
|
|
47
|
-
return void 0;
|
|
48
|
-
}
|
|
49
|
-
return { id };
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Get an output node by ID.
|
|
53
|
-
*/
|
|
54
|
-
outputNode(id) {
|
|
55
|
-
if (id === void 0 || id < 0 || id >= this.#data.outputNodes.length) {
|
|
56
|
-
return void 0;
|
|
57
|
-
}
|
|
58
|
-
return { id };
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Get an input edge for a field name within a node.
|
|
62
|
-
*/
|
|
63
|
-
inputEdge(node, fieldName) {
|
|
64
|
-
if (!node) {
|
|
65
|
-
return void 0;
|
|
66
|
-
}
|
|
67
|
-
const nodeData = this.#data.inputNodes[node.id];
|
|
68
|
-
if (!nodeData) {
|
|
69
|
-
return void 0;
|
|
70
|
-
}
|
|
71
|
-
const fieldIndex = this.#stringIndex.get(fieldName);
|
|
72
|
-
if (fieldIndex === void 0) {
|
|
73
|
-
return void 0;
|
|
74
|
-
}
|
|
75
|
-
const edge = nodeData.edges[fieldIndex];
|
|
76
|
-
if (!edge) {
|
|
77
|
-
return void 0;
|
|
78
|
-
}
|
|
79
|
-
return {
|
|
80
|
-
flags: edge.flags,
|
|
81
|
-
childNodeId: edge.childNodeId,
|
|
82
|
-
scalarMask: edge.scalarMask ?? 0,
|
|
83
|
-
enumNameIndex: edge.enumNameIndex
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Get an output edge for a field name within a node.
|
|
88
|
-
*/
|
|
89
|
-
outputEdge(node, fieldName) {
|
|
90
|
-
if (!node) {
|
|
91
|
-
return void 0;
|
|
92
|
-
}
|
|
93
|
-
const nodeData = this.#data.outputNodes[node.id];
|
|
94
|
-
if (!nodeData) {
|
|
95
|
-
return void 0;
|
|
96
|
-
}
|
|
97
|
-
const fieldIndex = this.#stringIndex.get(fieldName);
|
|
98
|
-
if (fieldIndex === void 0) {
|
|
99
|
-
return void 0;
|
|
100
|
-
}
|
|
101
|
-
const edge = nodeData.edges[fieldIndex];
|
|
102
|
-
if (!edge) {
|
|
103
|
-
return void 0;
|
|
104
|
-
}
|
|
105
|
-
return {
|
|
106
|
-
argsNodeId: edge.argsNodeId,
|
|
107
|
-
outputNodeId: edge.outputNodeId
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Get enum values for an edge that references a user enum.
|
|
112
|
-
* Returns undefined if the edge doesn't reference an enum.
|
|
113
|
-
*/
|
|
114
|
-
enumValues(edge) {
|
|
115
|
-
if (edge?.enumNameIndex === void 0) {
|
|
116
|
-
return void 0;
|
|
117
|
-
}
|
|
118
|
-
const enumName = this.#data.strings[edge.enumNameIndex];
|
|
119
|
-
if (!enumName) {
|
|
120
|
-
return void 0;
|
|
121
|
-
}
|
|
122
|
-
return this.#enumLookup(enumName);
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Get a string from the string table by index.
|
|
126
|
-
*/
|
|
127
|
-
getString(index) {
|
|
128
|
-
return this.#data.strings[index];
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
const EdgeFlag = {
|
|
132
|
-
/**
|
|
133
|
-
* Field may be parameterized as a scalar value.
|
|
134
|
-
* Check ScalarMask to validate the value type.
|
|
135
|
-
*/
|
|
136
|
-
ParamScalar: 1,
|
|
137
|
-
/**
|
|
138
|
-
* Field may be parameterized as an enum.
|
|
139
|
-
* Check enum ID to validate the value type.
|
|
140
|
-
*/
|
|
141
|
-
ParamEnum: 2,
|
|
142
|
-
/**
|
|
143
|
-
* Field accepts list-of-scalar values.
|
|
144
|
-
* Parameterize the whole list if all elements match ScalarMask.
|
|
145
|
-
*/
|
|
146
|
-
ParamListScalar: 4,
|
|
147
|
-
/**
|
|
148
|
-
* Field accepts list-of-enum values.
|
|
149
|
-
* Parameterize the whole list if all elements match enum ID.
|
|
150
|
-
*/
|
|
151
|
-
ParamListEnum: 8,
|
|
152
|
-
/**
|
|
153
|
-
* Field accepts list-of-object values.
|
|
154
|
-
* Recurse into each element using the child node.
|
|
155
|
-
*/
|
|
156
|
-
ListObject: 16,
|
|
157
|
-
/**
|
|
158
|
-
* Field accepts object values.
|
|
159
|
-
* Recurse into child input node.
|
|
160
|
-
*/
|
|
161
|
-
Object: 32
|
|
162
|
-
};
|
|
163
|
-
const ScalarMask = {
|
|
164
|
-
String: 1,
|
|
165
|
-
Int: 2,
|
|
166
|
-
BigInt: 4,
|
|
167
|
-
Float: 8,
|
|
168
|
-
Decimal: 16,
|
|
169
|
-
Boolean: 32,
|
|
170
|
-
DateTime: 64,
|
|
171
|
-
Json: 128,
|
|
172
|
-
Bytes: 256
|
|
173
|
-
};
|
|
174
|
-
function hasFlag(edge, flag) {
|
|
175
|
-
return (edge.flags & flag) !== 0;
|
|
176
|
-
}
|
|
177
|
-
function getScalarMask(edge) {
|
|
178
|
-
return edge.scalarMask;
|
|
179
|
-
}
|
|
180
|
-
function scalarTypeToMask(typeName) {
|
|
181
|
-
switch (typeName) {
|
|
182
|
-
case "String":
|
|
183
|
-
case "UUID":
|
|
184
|
-
return ScalarMask.String;
|
|
185
|
-
case "Int":
|
|
186
|
-
return ScalarMask.Int;
|
|
187
|
-
case "BigInt":
|
|
188
|
-
return ScalarMask.BigInt;
|
|
189
|
-
case "Float":
|
|
190
|
-
return ScalarMask.Float;
|
|
191
|
-
case "Decimal":
|
|
192
|
-
return ScalarMask.Decimal;
|
|
193
|
-
case "Boolean":
|
|
194
|
-
return ScalarMask.Boolean;
|
|
195
|
-
case "DateTime":
|
|
196
|
-
return ScalarMask.DateTime;
|
|
197
|
-
case "Json":
|
|
198
|
-
return ScalarMask.Json;
|
|
199
|
-
case "Bytes":
|
|
200
|
-
return ScalarMask.Bytes;
|
|
201
|
-
default:
|
|
202
|
-
return 0;
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
export {
|
|
206
|
-
EdgeFlag,
|
|
207
|
-
ParamGraph,
|
|
208
|
-
ScalarMask,
|
|
209
|
-
getScalarMask,
|
|
210
|
-
hasFlag,
|
|
211
|
-
scalarTypeToMask
|
|
212
|
-
};
|