import type { PropertyDefinition } from '../schema/types'; /** * Coerce a JS write value bound for an `Int`/`BigInt`-typed schema field * into a Neo4j Integer so the stored property is a Long, not a Double. * * The driver packs EVERY JS `number` as a Bolt FLOAT64 (packstream: * `typeof x === 'number'` → `packFloat`) — `disableLosslessIntegers` * only affects the read direction. Reads convert Integer → number * (ResultMapper), so without write-side coercion the round-trip is * asymmetric: every OGM-written Int property lands as a Double. Once a * field holds a mixed Long/Double population, Long-typed consumers break * (e.g. `apoc.coll.sortMulti` throws `java.lang.Double cannot be cast to * class java.lang.Long`). * * Non-integral numbers and non-integer strings for Int/BigInt fields * throw instead of truncating or storing a String property, matching the * v1.14 contract of rejecting inputs that would be silently corrupted. * Values the coercion doesn't own — null/undefined, driver Integer * instances, fields of any other scalar type, or fields absent from the * schema — pass through untouched. */ export declare function coerceWriteValue(value: unknown, propDef: PropertyDefinition | undefined): unknown; /** * Wrap a write RHS expression (`$param`, or an UNWIND item reference) in * the field's Cypher constructor — temporal (`datetime()`, ...) for * ISO-string inputs, `point()` for plain point maps — so the stored * property is the native type the schema declares. Reads convert native * values to plain JS (ResultMapper); this is the write half of the same * round-trip symmetry issue #5 fixed for integers. * * Driver-native values (temporal instances, Point instances) bind raw. * List fields wrap element-wise via a list comprehension, following the * constructor's element rule (see WriteConstructor.arrayMode). */ export declare function wrapWriteExpr(expr: string, value: unknown, propDef: PropertyDefinition | undefined): string; /** * Constructor wrapping for UNWIND item references (`item.prop`, * `connItem.edge.prop`), where ONE Cypher expression serves EVERY item in * the batch: the wrap decision must hold for all items' values for the * key. A column mixing constructor inputs with driver-native values * throws — a single expression cannot be correct for both. */ export declare function wrapListItemExpr(expr: string, values: unknown[], propDef: PropertyDefinition | undefined): string; /** * Wrap a WHERE parameter reference for a constructor-typed field. With * properties stored natively, comparing them to a raw string/map param is * a cross-type comparison — Neo4j evaluates it to NULL and silently * drops the row. `suffix` is the operator suffix (`''` for plain * equality); only comparison-shaped operators wrap, and `_IN`/`_NOT_IN` * wrap their list param element-wise. */ export declare function wrapWhereParam(paramRef: string, value: unknown, propDef: PropertyDefinition | undefined, suffix: string): string; /** * Materialize a parsed `@default` into a driver-ready bound value. The * parser stores every default as a string (`'true'`, `'5'`, `'WELCOME'`); * conversion is by declared scalar type, and Int/BigInt defaults route * through the same Integer coercion as user input. Temporal defaults stay * ISO strings here — they get their constructor wrapper at the binding * site like any other temporal write. */ export declare function resolveDefaultWriteValue(propDef: PropertyDefinition): unknown; //# sourceMappingURL=write-coercion.d.ts.map