@rushdb/javascript-sdk 2.9.0 → 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 CHANGED
@@ -88,7 +88,7 @@ const memories = await db.ai.search({
88
88
  // Push nested JSON — relationships created automatically
89
89
  await db.records.importJson({
90
90
  label: 'COMPANY',
91
- payload: {
91
+ data: {
92
92
  name: 'Acme Corp',
93
93
  DEPARTMENT: [
94
94
  {
@@ -3,9 +3,9 @@ import type { BooleanExpression, DatetimeExpression, LogicalGrouping, NullExpres
3
3
  import type { Schema } from './schema.js';
4
4
  import type { AnyObject, MaybeArray, RequireAtLeastOne } from './utils.js';
5
5
  /**
6
- * Variable-length traversal depth for `$relation.hops`.
6
+ * Variable-length traversal depth for `$relation.hops` and `$cycle.hops`.
7
7
  * A number matches exactly that many hops; `{ min?, max? }` matches a range
8
- * (`min` defaults to 1, or 2 inside a `$cycle` block). Omitting `max` requests
8
+ * (`min` defaults to 1, or 2 for `$cycle`). Omitting `max` requests
9
9
  * unbounded traversal, which is only allowed on self-hosted deployments and
10
10
  * projects with a custom Neo4j instance.
11
11
  */
@@ -20,16 +20,20 @@ export type TraversalHops = number | {
20
20
  export type TraversalRelationOptions = RelationOptions & {
21
21
  hops?: TraversalHops;
22
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
+ };
23
33
  export type Related<M extends Record<string, Model['schema']> = Models> = keyof M extends never ? AnyObject : {
24
34
  [Key in keyof M]?: {
25
35
  $alias?: string;
26
36
  $relation?: TraversalRelationOptions | string;
27
- /**
28
- * Matches records sitting on a closed path (cycle/ring) back to the
29
- * parent record. Requires `$relation` with `hops` (`min` ≥ 2); accepts
30
- * no other keys — a cycle has no separate endpoint to filter or alias.
31
- */
32
- $cycle?: boolean;
33
37
  } & Where<M[Key]>;
34
38
  };
35
39
  export type LogicalExpressionValue<T = PropertyExpression & Related> = AndExpression<T> | NorExpression<T> | NotExpression<T> | OrExpression<T> | T | XorExpression<T>;
@@ -58,7 +62,13 @@ export type Expression<S extends Schema = Schema> = IdExpression | (S extends Sc
58
62
  } : {
59
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>;
60
64
  });
61
- export type Where<S extends Schema = Schema> = ((Expression<S> & Related) & LogicalGrouping<Expression<S> & Related>) | LogicalGrouping<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
+ }>;
62
72
  export type OrderDirection = 'asc' | 'desc';
63
73
  export type Order<S extends Schema = Schema> = OrderDirection | Partial<Record<keyof S, OrderDirection>>;
64
74
  /**
package/package.json CHANGED
@@ -38,7 +38,7 @@
38
38
  "rush-db"
39
39
  ],
40
40
  "license": "Apache-2.0",
41
- "version": "2.9.0",
41
+ "version": "2.9.1",
42
42
  "type": "module",
43
43
  "files": [
44
44
  "dist"