@nicia-ai/typegraph 0.15.0 → 0.16.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/dist/index.cjs CHANGED
@@ -2313,7 +2313,7 @@ function buildStandardEmbeddingsCte(input) {
2313
2313
  const { ctx, graphId, vectorPredicate } = input;
2314
2314
  const { dialect } = ctx;
2315
2315
  const { field: field2, metric, minScore, queryEmbedding } = vectorPredicate;
2316
- const fieldPath = field2.jsonPointer ? field2.jsonPointer : field2.path.length > 1 && field2.path[0] === "props" ? `/${field2.path.slice(1).join("/")}` : `/${field2.path.join("/")}`;
2316
+ const fieldPath = field2.jsonPointer ?? (field2.path.length > 1 && field2.path[0] === "props" ? `/${field2.path.slice(1).join("/")}` : `/${field2.path.join("/")}`);
2317
2317
  const distanceExpr = dialect.vectorDistance(
2318
2318
  drizzleOrm.sql.raw("embedding"),
2319
2319
  queryEmbedding,
@@ -9593,7 +9593,7 @@ function createNodeCollectionsProxy(graph, graphId, registry, backend, operation
9593
9593
  const collectionCache = /* @__PURE__ */ new Map();
9594
9594
  return new Proxy({}, {
9595
9595
  get: (_, kind) => {
9596
- if (!(kind in graph.nodes)) {
9596
+ if (!Object.hasOwn(graph.nodes, kind)) {
9597
9597
  throw new chunk44SXEVF4_cjs.KindNotFoundError(kind, "node");
9598
9598
  }
9599
9599
  const cached = collectionCache.get(kind);
@@ -9615,7 +9615,7 @@ function createEdgeCollectionsProxy(graph, graphId, registry, backend, operation
9615
9615
  const collectionCache = /* @__PURE__ */ new Map();
9616
9616
  return new Proxy({}, {
9617
9617
  get: (_, kind) => {
9618
- if (!(kind in graph.edges)) {
9618
+ if (!Object.hasOwn(graph.edges, kind)) {
9619
9619
  throw new chunk44SXEVF4_cjs.KindNotFoundError(kind, "edge");
9620
9620
  }
9621
9621
  const cached = collectionCache.get(kind);
@@ -11705,6 +11705,30 @@ var Store = class {
11705
11705
  }
11706
11706
  return this.#edgeCollections;
11707
11707
  }
11708
+ // === Dynamic Collection Access ===
11709
+ /**
11710
+ * Returns the node collection for the given kind, or undefined if the kind
11711
+ * is not registered in this graph.
11712
+ *
11713
+ * Use this for runtime string-keyed access when the kind is not known at
11714
+ * compile time (e.g., iterating all kinds, resolving from edge metadata,
11715
+ * dynamic admin UIs).
11716
+ */
11717
+ getNodeCollection(kind) {
11718
+ if (!Object.hasOwn(this.#graph.nodes, kind)) return void 0;
11719
+ return this.nodes[kind];
11720
+ }
11721
+ /**
11722
+ * Returns the edge collection for the given kind, or undefined if the kind
11723
+ * is not registered in this graph.
11724
+ *
11725
+ * Use this for runtime string-keyed access when the kind is not known at
11726
+ * compile time.
11727
+ */
11728
+ getEdgeCollection(kind) {
11729
+ if (!Object.hasOwn(this.#graph.edges, kind)) return void 0;
11730
+ return this.edges[kind];
11731
+ }
11708
11732
  /**
11709
11733
  * Node operations bound to this store instance.
11710
11734
  */