grafeo-ogm 2.1.0 → 2.2.0
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/CHANGELOG.md +71 -0
- package/README.md +49 -0
- package/dist/cjs/compilers/mutation.compiler.d.ts.map +1 -1
- package/dist/cjs/compilers/mutation.compiler.js +23 -23
- package/dist/cjs/compilers/mutation.compiler.js.map +1 -1
- package/dist/cjs/compilers/where.compiler.d.ts +83 -6
- package/dist/cjs/compilers/where.compiler.d.ts.map +1 -1
- package/dist/cjs/compilers/where.compiler.js +156 -76
- package/dist/cjs/compilers/where.compiler.js.map +1 -1
- package/dist/cjs/execution/executor.d.ts +11 -1
- package/dist/cjs/execution/executor.d.ts.map +1 -1
- package/dist/cjs/execution/executor.js +6 -3
- package/dist/cjs/execution/executor.js.map +1 -1
- package/dist/cjs/index.d.ts +2 -2
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/model.d.ts +38 -1
- package/dist/cjs/model.d.ts.map +1 -1
- package/dist/cjs/model.js +120 -2
- package/dist/cjs/model.js.map +1 -1
- package/dist/cjs/ogm.d.ts.map +1 -1
- package/dist/cjs/ogm.js +1 -0
- package/dist/cjs/ogm.js.map +1 -1
- package/dist/cjs/policy/explain.d.ts +59 -0
- package/dist/cjs/policy/explain.d.ts.map +1 -0
- package/dist/cjs/policy/explain.js +175 -0
- package/dist/cjs/policy/explain.js.map +1 -0
- package/dist/cjs/policy/resolver.d.ts +26 -2
- package/dist/cjs/policy/resolver.d.ts.map +1 -1
- package/dist/cjs/policy/resolver.js +103 -33
- package/dist/cjs/policy/resolver.js.map +1 -1
- package/dist/cjs/policy/types.d.ts +87 -0
- package/dist/cjs/policy/types.d.ts.map +1 -1
- package/dist/cjs/utils/write-coercion.d.ts +20 -19
- package/dist/cjs/utils/write-coercion.d.ts.map +1 -1
- package/dist/cjs/utils/write-coercion.js +120 -50
- package/dist/cjs/utils/write-coercion.js.map +1 -1
- package/dist/esm/compilers/mutation.compiler.d.ts.map +1 -1
- package/dist/esm/compilers/mutation.compiler.js +24 -24
- package/dist/esm/compilers/mutation.compiler.js.map +1 -1
- package/dist/esm/compilers/where.compiler.d.ts +83 -6
- package/dist/esm/compilers/where.compiler.d.ts.map +1 -1
- package/dist/esm/compilers/where.compiler.js +156 -77
- package/dist/esm/compilers/where.compiler.js.map +1 -1
- package/dist/esm/execution/executor.d.ts +11 -1
- package/dist/esm/execution/executor.d.ts.map +1 -1
- package/dist/esm/execution/executor.js +6 -3
- package/dist/esm/execution/executor.js.map +1 -1
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/model.d.ts +38 -1
- package/dist/esm/model.d.ts.map +1 -1
- package/dist/esm/model.js +121 -3
- package/dist/esm/model.js.map +1 -1
- package/dist/esm/ogm.d.ts.map +1 -1
- package/dist/esm/ogm.js +1 -0
- package/dist/esm/ogm.js.map +1 -1
- package/dist/esm/policy/explain.d.ts +59 -0
- package/dist/esm/policy/explain.d.ts.map +1 -0
- package/dist/esm/policy/explain.js +169 -0
- package/dist/esm/policy/explain.js.map +1 -0
- package/dist/esm/policy/resolver.d.ts +26 -2
- package/dist/esm/policy/resolver.d.ts.map +1 -1
- package/dist/esm/policy/resolver.js +102 -33
- package/dist/esm/policy/resolver.js.map +1 -1
- package/dist/esm/policy/types.d.ts +87 -0
- package/dist/esm/policy/types.d.ts.map +1 -1
- package/dist/esm/utils/write-coercion.d.ts +20 -19
- package/dist/esm/utils/write-coercion.d.ts.map +1 -1
- package/dist/esm/utils/write-coercion.js +118 -48
- package/dist/esm/utils/write-coercion.js.map +1 -1
- package/package.json +1 -1
|
@@ -22,33 +22,34 @@ import type { PropertyDefinition } from '../schema/types';
|
|
|
22
22
|
export declare function coerceWriteValue(value: unknown, propDef: PropertyDefinition | undefined): unknown;
|
|
23
23
|
/**
|
|
24
24
|
* Wrap a write RHS expression (`$param`, or an UNWIND item reference) in
|
|
25
|
-
* the field's
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
25
|
+
* the field's Cypher constructor — temporal (`datetime()`, ...) for
|
|
26
|
+
* ISO-string inputs, `point()` for plain point maps — so the stored
|
|
27
|
+
* property is the native type the schema declares. Reads convert native
|
|
28
|
+
* values to plain JS (ResultMapper); this is the write half of the same
|
|
29
|
+
* round-trip symmetry issue #5 fixed for integers.
|
|
29
30
|
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
31
|
+
* Driver-native values (temporal instances, Point instances) bind raw.
|
|
32
|
+
* List fields wrap element-wise via a list comprehension, following the
|
|
33
|
+
* constructor's element rule (see WriteConstructor.arrayMode).
|
|
33
34
|
*/
|
|
34
|
-
export declare function
|
|
35
|
+
export declare function wrapWriteExpr(expr: string, value: unknown, propDef: PropertyDefinition | undefined): string;
|
|
35
36
|
/**
|
|
36
|
-
*
|
|
37
|
+
* Constructor wrapping for UNWIND item references (`item.prop`,
|
|
37
38
|
* `connItem.edge.prop`), where ONE Cypher expression serves EVERY item in
|
|
38
39
|
* the batch: the wrap decision must hold for all items' values for the
|
|
39
|
-
* key. A
|
|
40
|
-
* cannot be correct for both
|
|
40
|
+
* key. A column mixing constructor inputs with driver-native values
|
|
41
|
+
* throws — a single expression cannot be correct for both.
|
|
41
42
|
*/
|
|
42
|
-
export declare function
|
|
43
|
+
export declare function wrapListItemExpr(expr: string, values: unknown[], propDef: PropertyDefinition | undefined): string;
|
|
43
44
|
/**
|
|
44
|
-
* Wrap a WHERE parameter reference for a
|
|
45
|
-
* stored
|
|
46
|
-
* cross-type comparison — Neo4j evaluates it to NULL and silently
|
|
47
|
-
* the row. `suffix` is the operator suffix (`''` for plain
|
|
48
|
-
* only comparison-shaped operators wrap, and `_IN`/`_NOT_IN`
|
|
49
|
-
* list param element-wise.
|
|
45
|
+
* Wrap a WHERE parameter reference for a constructor-typed field. With
|
|
46
|
+
* properties stored natively, comparing them to a raw string/map param is
|
|
47
|
+
* a cross-type comparison — Neo4j evaluates it to NULL and silently
|
|
48
|
+
* drops the row. `suffix` is the operator suffix (`''` for plain
|
|
49
|
+
* equality); only comparison-shaped operators wrap, and `_IN`/`_NOT_IN`
|
|
50
|
+
* wrap their list param element-wise.
|
|
50
51
|
*/
|
|
51
|
-
export declare function
|
|
52
|
+
export declare function wrapWhereParam(paramRef: string, value: unknown, propDef: PropertyDefinition | undefined, suffix: string): string;
|
|
52
53
|
/**
|
|
53
54
|
* Materialize a parsed `@default` into a driver-ready bound value. The
|
|
54
55
|
* parser stores every default as a string (`'true'`, `'5'`, `'WELCOME'`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write-coercion.d.ts","sourceRoot":"","sources":["../../../src/utils/write-coercion.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"write-coercion.d.ts","sourceRoot":"","sources":["../../../src/utils/write-coercion.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAkI1D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,kBAAkB,GAAG,SAAS,GACtC,OAAO,CAWT;AAqCD;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,kBAAkB,GAAG,SAAS,GACtC,MAAM,CAWR;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,OAAO,EAAE,EACjB,OAAO,EAAE,kBAAkB,GAAG,SAAS,GACtC,MAAM,CAwBR;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,kBAAkB,GAAG,SAAS,EACvC,MAAM,EAAE,MAAM,GACb,MAAM,CAYR;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAc7E"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.coerceWriteValue = coerceWriteValue;
|
|
4
|
-
exports.
|
|
5
|
-
exports.
|
|
6
|
-
exports.
|
|
4
|
+
exports.wrapWriteExpr = wrapWriteExpr;
|
|
5
|
+
exports.wrapListItemExpr = wrapListItemExpr;
|
|
6
|
+
exports.wrapWhereParam = wrapWhereParam;
|
|
7
7
|
exports.resolveDefaultWriteValue = resolveDefaultWriteValue;
|
|
8
8
|
const neo4j_driver_1 = require("neo4j-driver");
|
|
9
9
|
const errors_1 = require("../errors");
|
|
@@ -27,14 +27,22 @@ const TEMPORAL_CONSTRUCTORS = {
|
|
|
27
27
|
LocalTime: 'localtime',
|
|
28
28
|
Duration: 'duration',
|
|
29
29
|
};
|
|
30
|
+
/**
|
|
31
|
+
* Spatial scalar types → Cypher's `point()` constructor. Reads flatten a
|
|
32
|
+
* native Point into a plain `{ x, y[, z], srid }` object (ResultMapper),
|
|
33
|
+
* and `point()` accepts exactly that map back — `srid` key included — so
|
|
34
|
+
* wrapping makes the read → write round-trip exact. Without the wrapper
|
|
35
|
+
* the plain object is bound as a map property value, which Neo4j rejects
|
|
36
|
+
* at runtime ("Property values can only be of primitive types...").
|
|
37
|
+
*/
|
|
38
|
+
const POINT_SCALAR_TYPES = new Set(['Point', 'CartesianPoint']);
|
|
30
39
|
/**
|
|
31
40
|
* Where-operator suffixes whose parameter is compared against the field
|
|
32
|
-
* value (`''` = plain equality) and therefore needs the same
|
|
33
|
-
*
|
|
34
|
-
* `
|
|
35
|
-
* strings by definition.
|
|
41
|
+
* value (`''` = plain equality) and therefore needs the same constructor
|
|
42
|
+
* treatment as writes. String operators (`_CONTAINS`, `_STARTS_WITH`,
|
|
43
|
+
* `_MATCHES`, ...) are excluded — their params are strings by definition.
|
|
36
44
|
*/
|
|
37
|
-
const
|
|
45
|
+
const COMPARABLE_SUFFIXES = new Set([
|
|
38
46
|
'',
|
|
39
47
|
'_NOT',
|
|
40
48
|
'_GT',
|
|
@@ -44,6 +52,56 @@ const TEMPORAL_COMPARABLE_SUFFIXES = new Set([
|
|
|
44
52
|
'_IN',
|
|
45
53
|
'_NOT_IN',
|
|
46
54
|
]);
|
|
55
|
+
function isTemporalStringInput(value) {
|
|
56
|
+
return typeof value === 'string';
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* A plain object shaped like `point()` input: cartesian (`x`/`y`) or
|
|
60
|
+
* geographic (`longitude`/`latitude`), optionally with `z`/`height` and
|
|
61
|
+
* `srid`/`crs`. Driver Point instances are NOT inputs — they pack
|
|
62
|
+
* natively and `point()` would reject them.
|
|
63
|
+
*/
|
|
64
|
+
function isPointWriteInput(value) {
|
|
65
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value))
|
|
66
|
+
return false;
|
|
67
|
+
if ((0, neo4j_driver_1.isPoint)(value) || (0, neo4j_driver_1.isInt)(value))
|
|
68
|
+
return false;
|
|
69
|
+
const candidate = value;
|
|
70
|
+
const cartesian = typeof candidate.x === 'number' && typeof candidate.y === 'number';
|
|
71
|
+
const geographic = typeof candidate.longitude === 'number' &&
|
|
72
|
+
typeof candidate.latitude === 'number';
|
|
73
|
+
return cartesian || geographic;
|
|
74
|
+
}
|
|
75
|
+
function resolveWriteConstructor(propDef) {
|
|
76
|
+
const temporal = TEMPORAL_CONSTRUCTORS[propDef.type];
|
|
77
|
+
if (temporal !== undefined)
|
|
78
|
+
return { fn: temporal, wraps: isTemporalStringInput, arrayMode: 'any' };
|
|
79
|
+
if (POINT_SCALAR_TYPES.has(propDef.type))
|
|
80
|
+
return { fn: 'point', wraps: isPointWriteInput, arrayMode: 'all' };
|
|
81
|
+
return undefined;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Decide whether a list of element values should be wrapped element-wise.
|
|
85
|
+
* `'any'` mode wraps as soon as one element is constructor input; `'all'`
|
|
86
|
+
* mode requires uniformity and throws on a mix, because the constructor
|
|
87
|
+
* cannot be applied to the already-native elements.
|
|
88
|
+
*/
|
|
89
|
+
function decideElementsWrap(elements, ctor, propDef) {
|
|
90
|
+
const defined = elements.filter((el) => el !== null && el !== undefined);
|
|
91
|
+
if (defined.length === 0)
|
|
92
|
+
return false;
|
|
93
|
+
const matches = defined.filter((el) => ctor.wraps(el)).length;
|
|
94
|
+
if (matches === 0)
|
|
95
|
+
return false;
|
|
96
|
+
if (ctor.arrayMode === 'any')
|
|
97
|
+
return true;
|
|
98
|
+
if (matches !== defined.length)
|
|
99
|
+
throw new errors_1.OGMError(`Mixed input representations for ${propDef.type} field "${propDef.name}": ` +
|
|
100
|
+
`some values are plain ${ctor.fn}() inputs, others are driver-native values. ` +
|
|
101
|
+
`${ctor.fn}() cannot be applied to an already-native value, so every value ` +
|
|
102
|
+
`must use the same representation.`);
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
47
105
|
/**
|
|
48
106
|
* Coerce a JS write value bound for an `Int`/`BigInt`-typed schema field
|
|
49
107
|
* into a Neo4j Integer so the stored property is a Long, not a Double.
|
|
@@ -108,83 +166,95 @@ function coerceIntegerElement(value, propDef) {
|
|
|
108
166
|
}
|
|
109
167
|
/**
|
|
110
168
|
* Wrap a write RHS expression (`$param`, or an UNWIND item reference) in
|
|
111
|
-
* the field's
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
169
|
+
* the field's Cypher constructor — temporal (`datetime()`, ...) for
|
|
170
|
+
* ISO-string inputs, `point()` for plain point maps — so the stored
|
|
171
|
+
* property is the native type the schema declares. Reads convert native
|
|
172
|
+
* values to plain JS (ResultMapper); this is the write half of the same
|
|
173
|
+
* round-trip symmetry issue #5 fixed for integers.
|
|
115
174
|
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
175
|
+
* Driver-native values (temporal instances, Point instances) bind raw.
|
|
176
|
+
* List fields wrap element-wise via a list comprehension, following the
|
|
177
|
+
* constructor's element rule (see WriteConstructor.arrayMode).
|
|
119
178
|
*/
|
|
120
|
-
function
|
|
179
|
+
function wrapWriteExpr(expr, value, propDef) {
|
|
121
180
|
if (propDef === undefined)
|
|
122
181
|
return expr;
|
|
123
|
-
const ctor =
|
|
182
|
+
const ctor = resolveWriteConstructor(propDef);
|
|
124
183
|
if (ctor === undefined)
|
|
125
184
|
return expr;
|
|
126
185
|
if (propDef.isArray) {
|
|
127
|
-
if (!Array.isArray(value)
|
|
186
|
+
if (!Array.isArray(value))
|
|
187
|
+
return expr;
|
|
188
|
+
if (!decideElementsWrap(value, ctor, propDef))
|
|
128
189
|
return expr;
|
|
129
|
-
return `[wc_t IN ${expr} | ${ctor}(wc_t)]`;
|
|
190
|
+
return `[wc_t IN ${expr} | ${ctor.fn}(wc_t)]`;
|
|
130
191
|
}
|
|
131
|
-
if (
|
|
192
|
+
if (!ctor.wraps(value))
|
|
132
193
|
return expr;
|
|
133
|
-
return `${ctor}(${expr})`;
|
|
194
|
+
return `${ctor.fn}(${expr})`;
|
|
134
195
|
}
|
|
135
196
|
/**
|
|
136
|
-
*
|
|
197
|
+
* Constructor wrapping for UNWIND item references (`item.prop`,
|
|
137
198
|
* `connItem.edge.prop`), where ONE Cypher expression serves EVERY item in
|
|
138
199
|
* the batch: the wrap decision must hold for all items' values for the
|
|
139
|
-
* key. A
|
|
140
|
-
* cannot be correct for both
|
|
200
|
+
* key. A column mixing constructor inputs with driver-native values
|
|
201
|
+
* throws — a single expression cannot be correct for both.
|
|
141
202
|
*/
|
|
142
|
-
function
|
|
203
|
+
function wrapListItemExpr(expr, values, propDef) {
|
|
143
204
|
if (propDef === undefined)
|
|
144
205
|
return expr;
|
|
145
|
-
const ctor =
|
|
206
|
+
const ctor = resolveWriteConstructor(propDef);
|
|
146
207
|
if (ctor === undefined)
|
|
147
208
|
return expr;
|
|
209
|
+
if (propDef.isArray) {
|
|
210
|
+
const flattened = values
|
|
211
|
+
.filter((v) => Array.isArray(v))
|
|
212
|
+
.flat();
|
|
213
|
+
if (flattened.length === 0)
|
|
214
|
+
return expr;
|
|
215
|
+
if (!decideElementsWrap(flattened, ctor, propDef))
|
|
216
|
+
return expr;
|
|
217
|
+
return `[wc_t IN ${expr} | ${ctor.fn}(wc_t)]`;
|
|
218
|
+
}
|
|
148
219
|
const defined = values.filter((v) => v !== null && v !== undefined);
|
|
149
220
|
if (defined.length === 0)
|
|
150
221
|
return expr;
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
return anyString ? `[wc_t IN ${expr} | ${ctor}(wc_t)]` : expr;
|
|
154
|
-
}
|
|
155
|
-
const stringCount = defined.filter((v) => typeof v === 'string').length;
|
|
156
|
-
if (stringCount === 0)
|
|
222
|
+
const matches = defined.filter((v) => ctor.wraps(v)).length;
|
|
223
|
+
if (matches === 0)
|
|
157
224
|
return expr;
|
|
158
|
-
if (
|
|
159
|
-
throw new errors_1.OGMError(`Mixed input types for ${propDef.type} field "${propDef.name}": some items pass
|
|
160
|
-
`
|
|
161
|
-
`per field, so every item must use the same
|
|
162
|
-
|
|
225
|
+
if (matches !== defined.length)
|
|
226
|
+
throw new errors_1.OGMError(`Mixed input types for ${propDef.type} field "${propDef.name}": some items pass ` +
|
|
227
|
+
`plain ${ctor.fn}() inputs, others pass driver-native values. Batched writes ` +
|
|
228
|
+
`share one Cypher expression per field, so every item must use the same ` +
|
|
229
|
+
`representation.`);
|
|
230
|
+
return `${ctor.fn}(${expr})`;
|
|
163
231
|
}
|
|
164
232
|
/**
|
|
165
|
-
* Wrap a WHERE parameter reference for a
|
|
166
|
-
* stored
|
|
167
|
-
* cross-type comparison — Neo4j evaluates it to NULL and silently
|
|
168
|
-
* the row. `suffix` is the operator suffix (`''` for plain
|
|
169
|
-
* only comparison-shaped operators wrap, and `_IN`/`_NOT_IN`
|
|
170
|
-
* list param element-wise.
|
|
233
|
+
* Wrap a WHERE parameter reference for a constructor-typed field. With
|
|
234
|
+
* properties stored natively, comparing them to a raw string/map param is
|
|
235
|
+
* a cross-type comparison — Neo4j evaluates it to NULL and silently
|
|
236
|
+
* drops the row. `suffix` is the operator suffix (`''` for plain
|
|
237
|
+
* equality); only comparison-shaped operators wrap, and `_IN`/`_NOT_IN`
|
|
238
|
+
* wrap their list param element-wise.
|
|
171
239
|
*/
|
|
172
|
-
function
|
|
240
|
+
function wrapWhereParam(paramRef, value, propDef, suffix) {
|
|
173
241
|
if (propDef === undefined)
|
|
174
242
|
return paramRef;
|
|
175
|
-
const ctor =
|
|
243
|
+
const ctor = resolveWriteConstructor(propDef);
|
|
176
244
|
if (ctor === undefined)
|
|
177
245
|
return paramRef;
|
|
178
|
-
if (!
|
|
246
|
+
if (!COMPARABLE_SUFFIXES.has(suffix))
|
|
179
247
|
return paramRef;
|
|
180
248
|
if (suffix === '_IN' || suffix === '_NOT_IN') {
|
|
181
|
-
if (!Array.isArray(value)
|
|
249
|
+
if (!Array.isArray(value))
|
|
250
|
+
return paramRef;
|
|
251
|
+
if (!decideElementsWrap(value, ctor, propDef))
|
|
182
252
|
return paramRef;
|
|
183
|
-
return `[wc_t IN ${paramRef} | ${ctor}(wc_t)]`;
|
|
253
|
+
return `[wc_t IN ${paramRef} | ${ctor.fn}(wc_t)]`;
|
|
184
254
|
}
|
|
185
|
-
if (
|
|
255
|
+
if (!ctor.wraps(value))
|
|
186
256
|
return paramRef;
|
|
187
|
-
return `${ctor}(${paramRef})`;
|
|
257
|
+
return `${ctor.fn}(${paramRef})`;
|
|
188
258
|
}
|
|
189
259
|
/**
|
|
190
260
|
* Materialize a parsed `@default` into a driver-ready bound value. The
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write-coercion.js","sourceRoot":"","sources":["../../../src/utils/write-coercion.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"write-coercion.js","sourceRoot":"","sources":["../../../src/utils/write-coercion.ts"],"names":[],"mappings":";;AAwJA,4CAcC;AAiDD,sCAeC;AASD,4CA4BC;AAUD,wCAiBC;AAUD,4DAcC;AA9TD,+CAAmD;AACnD,sCAAqC;AAGrC;;GAEG;AACH,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;AAExD;;;;;;;GAOG;AACH,MAAM,qBAAqB,GAA2B;IACpD,QAAQ,EAAE,UAAU;IACpB,aAAa,EAAE,eAAe;IAC9B,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,SAAS,EAAE,WAAW;IACtB,QAAQ,EAAE,UAAU;CACrB,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC;AAEhE;;;;;GAKG;AACH,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC;IAClC,EAAE;IACF,MAAM;IACN,KAAK;IACL,MAAM;IACN,KAAK;IACL,MAAM;IACN,KAAK;IACL,SAAS;CACV,CAAC,CAAC;AAqBH,SAAS,qBAAqB,CAAC,KAAc;IAC3C,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC;AACnC,CAAC;AAED;;;;;GAKG;AACH,SAAS,iBAAiB,CAAC,KAAc;IACvC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QACrE,OAAO,KAAK,CAAC;IACf,IAAI,IAAA,sBAAO,EAAC,KAAK,CAAC,IAAI,IAAA,oBAAK,EAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACjD,MAAM,SAAS,GAAG,KAAgC,CAAC;IACnD,MAAM,SAAS,GACb,OAAO,SAAS,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Ac;IA0JjB;;;;;OAKG;IACH,OAAO,CAAC,cAAc;IAUtB,OAAO,CAAC,qBAAqB;IA2C7B,OAAO,CAAC,wBAAwB;IAgFhC;;;OAGG;IACH,OAAO,CAAC,iCAAiC;IAgNzC,OAAO,CAAC,aAAa;IAqRrB,OAAO,CAAC,gBAAgB;IAuFxB;;;;OAIG;IACH,OAAO,CAAC,sBAAsB;IAoD9B;;;OAGG;IACH,OAAO,CAAC,wBAAwB;IAyehC;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAcvC;IAEF;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAY3B;;;;;;;;OAQG;IACH,OAAO,CAAC,wBAAwB;IAwEhC;;;;;OAKG;IACH,OAAO,CAAC,8BAA8B;IAoGtC,qFAAqF;IACrF,OAAO,CAAC,gBAAgB,CAAK;IAE7B;;;OAGG;IACH,OAAO,CAAC,0BAA0B;IA+ElC,OAAO,CAAC,sBAAsB;IAS9B;;;OAGG;IACH,OAAO,CAAC,kCAAkC;IAoC1C,OAAO,CAAC,6BAA6B;IAkCrC,OAAO,CAAC,qBAAqB;CAQ9B"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OGMError } from '../errors';
|
|
2
2
|
import { buildRelPattern, getTargetLabelString, resolveTargetDef, } from '../schema/utils';
|
|
3
3
|
import { assertSafeIdentifier, assertSafeLabel, assertSafePropertyName, escapeIdentifier, mergeParams, } from '../utils/validation';
|
|
4
|
-
import { coerceWriteValue, resolveDefaultWriteValue,
|
|
4
|
+
import { coerceWriteValue, resolveDefaultWriteValue, wrapListItemExpr, wrapWhereParam, wrapWriteExpr, } from '../utils/write-coercion';
|
|
5
5
|
import { WhereCompiler } from './where.compiler';
|
|
6
6
|
/**
|
|
7
7
|
* Relationship filter suffixes that require EXISTS subquery patterns.
|
|
@@ -182,7 +182,7 @@ export class MutationCompiler {
|
|
|
182
182
|
assertSafePropertyName(key, 'update property');
|
|
183
183
|
const propDef = nodeDef.properties.get(key);
|
|
184
184
|
const paramName = `update_${key}`;
|
|
185
|
-
const valueExpr =
|
|
185
|
+
const valueExpr = wrapWriteExpr(`$${paramName}`, value, propDef);
|
|
186
186
|
setClauses.push(`n.${escapeIdentifier(key)} = ${valueExpr}`);
|
|
187
187
|
params[paramName] = coerceWriteValue(value, propDef);
|
|
188
188
|
}
|
|
@@ -264,7 +264,7 @@ export class MutationCompiler {
|
|
|
264
264
|
assertSafePropertyName(key, 'merge key');
|
|
265
265
|
const propDef = nodeDef.properties.get(key);
|
|
266
266
|
const paramName = `merge_${key}`;
|
|
267
|
-
const valueExpr =
|
|
267
|
+
const valueExpr = wrapWriteExpr(`$${paramName}`, value, propDef);
|
|
268
268
|
mergeProps.push(`${escapeIdentifier(key)}: ${valueExpr}`);
|
|
269
269
|
mergeKeyNames.push(key);
|
|
270
270
|
params[paramName] = coerceWriteValue(value, propDef);
|
|
@@ -305,7 +305,7 @@ export class MutationCompiler {
|
|
|
305
305
|
assertSafePropertyName(key, 'create property');
|
|
306
306
|
const propDef = nodeDef.properties.get(key);
|
|
307
307
|
const paramName = `onCreate_${key}`;
|
|
308
|
-
const valueExpr =
|
|
308
|
+
const valueExpr = wrapWriteExpr(`$${paramName}`, value, propDef);
|
|
309
309
|
createSets.push(`n.${escapeIdentifier(key)} = ${valueExpr}`);
|
|
310
310
|
params[paramName] = coerceWriteValue(value, propDef);
|
|
311
311
|
}
|
|
@@ -323,7 +323,7 @@ export class MutationCompiler {
|
|
|
323
323
|
continue;
|
|
324
324
|
const paramName = `onCreate_${propDef.name}`;
|
|
325
325
|
const bound = resolveDefaultWriteValue(propDef);
|
|
326
|
-
const valueExpr =
|
|
326
|
+
const valueExpr = wrapWriteExpr(`$${paramName}`, bound, propDef);
|
|
327
327
|
createSets.push(`n.${escapeIdentifier(propDef.name)} = ${valueExpr}`);
|
|
328
328
|
params[paramName] = bound;
|
|
329
329
|
}
|
|
@@ -339,7 +339,7 @@ export class MutationCompiler {
|
|
|
339
339
|
assertSafePropertyName(key, 'update property');
|
|
340
340
|
const propDef = nodeDef.properties.get(key);
|
|
341
341
|
const paramName = `onMatch_${key}`;
|
|
342
|
-
const valueExpr =
|
|
342
|
+
const valueExpr = wrapWriteExpr(`$${paramName}`, value, propDef);
|
|
343
343
|
updateSets.push(`n.${escapeIdentifier(key)} = ${valueExpr}`);
|
|
344
344
|
params[paramName] = coerceWriteValue(value, propDef);
|
|
345
345
|
}
|
|
@@ -447,20 +447,20 @@ export class MutationCompiler {
|
|
|
447
447
|
throw new OGMError('createMany with skipDuplicates requires at least one @id or @unique field in data');
|
|
448
448
|
// MERGE on unique key(s)
|
|
449
449
|
const mergeProps = mergeKeys
|
|
450
|
-
.map((k) => `${escapeIdentifier(k)}: ${
|
|
450
|
+
.map((k) => `${escapeIdentifier(k)}: ${wrapListItemExpr(`item.${escapeIdentifier(k)}`, data.map((d) => d[k]), nodeDef.properties.get(k))}`)
|
|
451
451
|
.join(', ');
|
|
452
452
|
lines.push(`MERGE (n:${labelStr} { ${mergeProps} })`);
|
|
453
453
|
// ON CREATE SET — remaining fields + generated IDs
|
|
454
454
|
const onCreateSets = [];
|
|
455
455
|
for (const key of scalarKeys)
|
|
456
456
|
if (!mergeKeys.includes(key))
|
|
457
|
-
onCreateSets.push(`n.${escapeIdentifier(key)} = ${
|
|
457
|
+
onCreateSets.push(`n.${escapeIdentifier(key)} = ${wrapListItemExpr(`item.${escapeIdentifier(key)}`, data.map((d) => d[key]), nodeDef.properties.get(key))}`);
|
|
458
458
|
for (const field of generatedFields)
|
|
459
459
|
onCreateSets.push(`n.${escapeIdentifier(field)} = randomUUID()`);
|
|
460
460
|
for (const propDef of defaultedProps) {
|
|
461
461
|
const paramName = `default_${propDef.name}`;
|
|
462
462
|
const bound = resolveDefaultWriteValue(propDef);
|
|
463
|
-
onCreateSets.push(`n.${escapeIdentifier(propDef.name)} = ${
|
|
463
|
+
onCreateSets.push(`n.${escapeIdentifier(propDef.name)} = ${wrapWriteExpr(`$${paramName}`, bound, propDef)}`);
|
|
464
464
|
params[paramName] = bound;
|
|
465
465
|
}
|
|
466
466
|
if (onCreateSets.length > 0)
|
|
@@ -472,11 +472,11 @@ export class MutationCompiler {
|
|
|
472
472
|
for (const field of generatedFields)
|
|
473
473
|
propParts.push(`${escapeIdentifier(field)}: randomUUID()`);
|
|
474
474
|
for (const key of scalarKeys)
|
|
475
|
-
propParts.push(`${escapeIdentifier(key)}: ${
|
|
475
|
+
propParts.push(`${escapeIdentifier(key)}: ${wrapListItemExpr(`item.${escapeIdentifier(key)}`, data.map((d) => d[key]), nodeDef.properties.get(key))}`);
|
|
476
476
|
for (const propDef of defaultedProps) {
|
|
477
477
|
const paramName = `default_${propDef.name}`;
|
|
478
478
|
const bound = resolveDefaultWriteValue(propDef);
|
|
479
|
-
propParts.push(`${escapeIdentifier(propDef.name)}: ${
|
|
479
|
+
propParts.push(`${escapeIdentifier(propDef.name)}: ${wrapWriteExpr(`$${paramName}`, bound, propDef)}`);
|
|
480
480
|
params[paramName] = bound;
|
|
481
481
|
}
|
|
482
482
|
lines.push(`CREATE (n:${labelStr} { ${propParts.join(', ')} })`);
|
|
@@ -519,7 +519,7 @@ export class MutationCompiler {
|
|
|
519
519
|
assertSafePropertyName(key, 'create property');
|
|
520
520
|
const propDef = nodeDef.properties.get(key);
|
|
521
521
|
const paramName = `${prefix}_${key}`;
|
|
522
|
-
const valueExpr =
|
|
522
|
+
const valueExpr = wrapWriteExpr(`$${paramName}`, value, propDef);
|
|
523
523
|
parts.push(`${escapeIdentifier(key)}: ${valueExpr}`);
|
|
524
524
|
propParams[paramName] = coerceWriteValue(value, propDef);
|
|
525
525
|
}
|
|
@@ -536,7 +536,7 @@ export class MutationCompiler {
|
|
|
536
536
|
continue;
|
|
537
537
|
const paramName = `${prefix}_${propDef.name}`;
|
|
538
538
|
const bound = resolveDefaultWriteValue(propDef);
|
|
539
|
-
const valueExpr =
|
|
539
|
+
const valueExpr = wrapWriteExpr(`$${paramName}`, bound, propDef);
|
|
540
540
|
parts.push(`${escapeIdentifier(propDef.name)}: ${valueExpr}`);
|
|
541
541
|
propParams[paramName] = bound;
|
|
542
542
|
}
|
|
@@ -645,7 +645,7 @@ export class MutationCompiler {
|
|
|
645
645
|
assertSafePropertyName(prop, 'edge property');
|
|
646
646
|
const edgePropDef = this.getEdgePropDef(relDef, prop);
|
|
647
647
|
const paramName = `${prefix}_create${ci}_edge_${prop}`;
|
|
648
|
-
setItems.push(`${relVar}.${escapeIdentifier(prop)} = ${
|
|
648
|
+
setItems.push(`${relVar}.${escapeIdentifier(prop)} = ${wrapWriteExpr(`$${paramName}`, val, edgePropDef)}`);
|
|
649
649
|
params[paramName] = coerceWriteValue(val, edgePropDef);
|
|
650
650
|
}
|
|
651
651
|
if (setItems.length > 0)
|
|
@@ -698,7 +698,7 @@ export class MutationCompiler {
|
|
|
698
698
|
assertSafePropertyName(prop, 'edge property');
|
|
699
699
|
const edgePropDef = this.getEdgePropDef(relDef, prop);
|
|
700
700
|
const paramName = `${prefix}_conn${ci}_edge_${prop}`;
|
|
701
|
-
setItems.push(`r_conn_${startCounter + counter - 1}.${escapeIdentifier(prop)} = ${
|
|
701
|
+
setItems.push(`r_conn_${startCounter + counter - 1}.${escapeIdentifier(prop)} = ${wrapWriteExpr(`$${paramName}`, val, edgePropDef)}`);
|
|
702
702
|
params[paramName] = coerceWriteValue(val, edgePropDef);
|
|
703
703
|
}
|
|
704
704
|
if (setItems.length > 0)
|
|
@@ -770,7 +770,7 @@ export class MutationCompiler {
|
|
|
770
770
|
assertSafePropertyName(prop, 'edge property');
|
|
771
771
|
const edgePropDef = this.getEdgePropDef(relDef, prop);
|
|
772
772
|
const paramName = `connect_${fieldName}_${ci}_edge_${prop}`;
|
|
773
|
-
setItems.push(`${relVar}.${escapeIdentifier(prop)} = ${
|
|
773
|
+
setItems.push(`${relVar}.${escapeIdentifier(prop)} = ${wrapWriteExpr(`$${paramName}`, val, edgePropDef)}`);
|
|
774
774
|
params[paramName] = coerceWriteValue(val, edgePropDef);
|
|
775
775
|
}
|
|
776
776
|
if (setItems.length > 0)
|
|
@@ -848,7 +848,7 @@ export class MutationCompiler {
|
|
|
848
848
|
// Replace MERGE line with one that has a variable
|
|
849
849
|
lines[lines.length - 1] = `MERGE ${mergeWithVar}`;
|
|
850
850
|
// r.prop is relationship property (escape), connItem.edge.prop is parameter map (no escape)
|
|
851
|
-
const setItems = edgeProps.map((p) => `r.${escapeIdentifier(p)} = ${
|
|
851
|
+
const setItems = edgeProps.map((p) => `r.${escapeIdentifier(p)} = ${wrapListItemExpr(`connItem.edge.${p}`, spec.map((it) => it.edge?.[p]), this.getEdgePropDef(relDef, p))}`);
|
|
852
852
|
lines.push(`SET ${setItems.join(', ')}`);
|
|
853
853
|
}
|
|
854
854
|
}
|
|
@@ -881,7 +881,7 @@ export class MutationCompiler {
|
|
|
881
881
|
continue;
|
|
882
882
|
const edgePropDef = this.getEdgePropDef(relDef, prop);
|
|
883
883
|
const paramName = `connect_${fieldName}_edge_${prop}`;
|
|
884
|
-
setItems.push(`r.${escapeIdentifier(prop)} = ${
|
|
884
|
+
setItems.push(`r.${escapeIdentifier(prop)} = ${wrapWriteExpr(`$${paramName}`, val, edgePropDef)}`);
|
|
885
885
|
params[paramName] = coerceWriteValue(val, edgePropDef);
|
|
886
886
|
}
|
|
887
887
|
if (setItems.length > 0)
|
|
@@ -1197,7 +1197,7 @@ export class MutationCompiler {
|
|
|
1197
1197
|
assertSafePropertyName(prop, 'edge property');
|
|
1198
1198
|
const edgePropDef = this.getEdgePropDef(relDef, prop);
|
|
1199
1199
|
const paramName = `${itemPrefix}_conn${ci}_edge_${prop}`;
|
|
1200
|
-
setItems.push(`r_conn_${key}_${ci}.${escapeIdentifier(prop)} = ${
|
|
1200
|
+
setItems.push(`r_conn_${key}_${ci}.${escapeIdentifier(prop)} = ${wrapWriteExpr(`$${paramName}`, val, edgePropDef)}`);
|
|
1201
1201
|
params[paramName] = coerceWriteValue(val, edgePropDef);
|
|
1202
1202
|
}
|
|
1203
1203
|
if (setItems.length > 0)
|
|
@@ -1236,7 +1236,7 @@ export class MutationCompiler {
|
|
|
1236
1236
|
assertSafePropertyName(prop, 'nested update property');
|
|
1237
1237
|
const nodePropDef = targetNodeDef.properties.get(prop);
|
|
1238
1238
|
const paramName = `${itemPrefix}_set_${prop}`;
|
|
1239
|
-
setClauses.push(`${updateVar}.${escapeIdentifier(prop)} = ${
|
|
1239
|
+
setClauses.push(`${updateVar}.${escapeIdentifier(prop)} = ${wrapWriteExpr(`$${paramName}`, val, nodePropDef)}`);
|
|
1240
1240
|
setParams[paramName] = coerceWriteValue(val, nodePropDef);
|
|
1241
1241
|
}
|
|
1242
1242
|
// Pre-compute SET clauses for edge (relationship) properties
|
|
@@ -1249,7 +1249,7 @@ export class MutationCompiler {
|
|
|
1249
1249
|
assertSafePropertyName(prop, 'edge update property');
|
|
1250
1250
|
const edgePropDef = this.getEdgePropDef(relDef, prop);
|
|
1251
1251
|
const paramName = `${itemPrefix}_edge_${prop}`;
|
|
1252
|
-
edgeClauses.push(`${relVar}.${escapeIdentifier(prop)} = ${
|
|
1252
|
+
edgeClauses.push(`${relVar}.${escapeIdentifier(prop)} = ${wrapWriteExpr(`$${paramName}`, val, edgePropDef)}`);
|
|
1253
1253
|
edgeParams[paramName] = coerceWriteValue(val, edgePropDef);
|
|
1254
1254
|
}
|
|
1255
1255
|
// Pre-compute nested relationship operations
|
|
@@ -1336,7 +1336,7 @@ export class MutationCompiler {
|
|
|
1336
1336
|
assertSafePropertyName(baseProp, 'where property');
|
|
1337
1337
|
const paramName = `${prefix}_NOT_${notProp}`;
|
|
1338
1338
|
const escapedProp = escapeIdentifier(baseProp);
|
|
1339
|
-
const paramRef =
|
|
1339
|
+
const paramRef = wrapWhereParam(`$${paramName}`, notVal, targetNodeDef?.properties.get(baseProp), notProp.slice(baseProp.length));
|
|
1340
1340
|
let expr;
|
|
1341
1341
|
if (template === '%v = $%p')
|
|
1342
1342
|
// Simple equality → negate to <>
|
|
@@ -1362,7 +1362,7 @@ export class MutationCompiler {
|
|
|
1362
1362
|
const { baseProp, template } = this.parseOperatorSuffix(prop);
|
|
1363
1363
|
assertSafePropertyName(baseProp, 'where property');
|
|
1364
1364
|
const paramName = `${prefix}_${prop}`;
|
|
1365
|
-
const paramRef =
|
|
1365
|
+
const paramRef = wrapWhereParam(`$${paramName}`, val, targetNodeDef?.properties.get(baseProp), prop.slice(baseProp.length));
|
|
1366
1366
|
conditions.push(template
|
|
1367
1367
|
.replace('%v', `${targetVar}.${escapeIdentifier(baseProp)}`)
|
|
1368
1368
|
.replace('$%p', paramRef));
|
|
@@ -1543,7 +1543,7 @@ export class MutationCompiler {
|
|
|
1543
1543
|
// Note: itemVar map access is NOT escaped (parameter map keys, not Cypher identifiers)
|
|
1544
1544
|
// Temporal wrap keys off the FIRST item's value type — the UNWIND
|
|
1545
1545
|
// fast path already requires shape-homogeneous items.
|
|
1546
|
-
const valueRef =
|
|
1546
|
+
const valueRef = wrapWhereParam(`${itemVar}.where.node.${key}`, nodeWhere[key], targetNodeDef?.properties.get(baseProp), key.slice(baseProp.length));
|
|
1547
1547
|
conditions.push(template
|
|
1548
1548
|
.replace('%v', `${targetVar}.${escapeIdentifier(baseProp)}`)
|
|
1549
1549
|
.replace('$%p', valueRef));
|