@rushdb/javascript-sdk 2.8.1 → 2.9.1
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 +1 -1
- package/dist/types/query.d.ts +36 -2
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/types/query.d.ts
CHANGED
|
@@ -2,10 +2,38 @@ import type { Model, RelationOptions } from '../sdk/index.js';
|
|
|
2
2
|
import type { BooleanExpression, DatetimeExpression, LogicalGrouping, NullExpression, NumberExpression, PropertyExpression, PropertyExpressionByType, StringExpression } from './expressions.js';
|
|
3
3
|
import type { Schema } from './schema.js';
|
|
4
4
|
import type { AnyObject, MaybeArray, RequireAtLeastOne } from './utils.js';
|
|
5
|
+
/**
|
|
6
|
+
* Variable-length traversal depth for `$relation.hops` and `$cycle.hops`.
|
|
7
|
+
* A number matches exactly that many hops; `{ min?, max? }` matches a range
|
|
8
|
+
* (`min` defaults to 1, or 2 for `$cycle`). Omitting `max` requests
|
|
9
|
+
* unbounded traversal, which is only allowed on self-hosted deployments and
|
|
10
|
+
* projects with a custom Neo4j instance.
|
|
11
|
+
*/
|
|
12
|
+
export type TraversalHops = number | {
|
|
13
|
+
min?: number;
|
|
14
|
+
max?: number;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Relationship constraints for a traversal block in `where`.
|
|
18
|
+
* Extends {@link RelationOptions} with variable-length traversal support.
|
|
19
|
+
*/
|
|
20
|
+
export type TraversalRelationOptions = RelationOptions & {
|
|
21
|
+
hops?: TraversalHops;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Record-level cycle predicate: matches records sitting on a closed path
|
|
25
|
+
* (cycle/ring) back to themselves over the described edges. The value is the
|
|
26
|
+
* traversal spec itself — `hops` is mandatory (`min` ≥ 2, defaults to 2);
|
|
27
|
+
* intermediate node labels are unconstrained. A cycle has no separate endpoint
|
|
28
|
+
* to filter or alias.
|
|
29
|
+
*/
|
|
30
|
+
export type CycleExpression = RelationOptions & {
|
|
31
|
+
hops: TraversalHops;
|
|
32
|
+
};
|
|
5
33
|
export type Related<M extends Record<string, Model['schema']> = Models> = keyof M extends never ? AnyObject : {
|
|
6
34
|
[Key in keyof M]?: {
|
|
7
35
|
$alias?: string;
|
|
8
|
-
$relation?:
|
|
36
|
+
$relation?: TraversalRelationOptions | string;
|
|
9
37
|
} & Where<M[Key]>;
|
|
10
38
|
};
|
|
11
39
|
export type LogicalExpressionValue<T = PropertyExpression & Related> = AndExpression<T> | NorExpression<T> | NotExpression<T> | OrExpression<T> | T | XorExpression<T>;
|
|
@@ -34,7 +62,13 @@ export type Expression<S extends Schema = Schema> = IdExpression | (S extends Sc
|
|
|
34
62
|
} : {
|
|
35
63
|
[Key in keyof S]?: S[Key] extends MaybeArray<number> ? MaybeLogicalExpression<NumberExpression> : S[Key] extends MaybeArray<boolean> ? MaybeLogicalExpression<BooleanExpression> : S[Key] extends MaybeArray<string> ? MaybeLogicalExpression<DatetimeExpression> | MaybeLogicalExpression<StringExpression> : S[Key] extends MaybeArray<null> ? MaybeLogicalExpression<NullExpression> : LogicalExpression | Partial<PropertyExpression>;
|
|
36
64
|
});
|
|
37
|
-
export type Where<S extends Schema = Schema> = ((Expression<S> & Related
|
|
65
|
+
export type Where<S extends Schema = Schema> = ((Expression<S> & Related & {
|
|
66
|
+
$cycle?: CycleExpression;
|
|
67
|
+
}) & LogicalGrouping<Expression<S> & Related & {
|
|
68
|
+
$cycle?: CycleExpression;
|
|
69
|
+
}>) | LogicalGrouping<Expression<S> & Related & {
|
|
70
|
+
$cycle?: CycleExpression;
|
|
71
|
+
}>;
|
|
38
72
|
export type OrderDirection = 'asc' | 'desc';
|
|
39
73
|
export type Order<S extends Schema = Schema> = OrderDirection | Partial<Record<keyof S, OrderDirection>>;
|
|
40
74
|
/**
|