@utaba/deep-memory-storage-cosmosdb 0.7.0 → 0.8.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/dist/index.js CHANGED
@@ -752,8 +752,8 @@ async function findEntities(conn, repositoryId, query) {
752
752
  import { DuplicateRelationshipError, matchesPropertyFilters } from "@utaba/deep-memory";
753
753
  async function createRelationship(conn, repositoryId, relationship) {
754
754
  const existing = await conn.submit(
755
- "g.E().has('id', relId).count()",
756
- { relId: relationship.id }
755
+ "g.E().has('repositoryId', rid).has('id', relId).count()",
756
+ { rid: repositoryId, relId: relationship.id }
757
757
  );
758
758
  if (Number(existing.items[0] ?? 0) > 0) {
759
759
  throw new DuplicateRelationshipError(relationship.id);
@@ -1286,7 +1286,7 @@ async function upsertRelationship(conn, repositoryId, rel) {
1286
1286
  propParts.push(`.property('${key}', ${paramName})`);
1287
1287
  }
1288
1288
  const createEdge = `g.V().has('repositoryId', rid).has('id', srcId).has('entityType').addE(edgeLabel).to(g.V().has('repositoryId', rid).has('id', tgtId).has('entityType')).property('id', relId)${propParts.join("")}`;
1289
- const query = `g.E().has('id', relId).fold().coalesce(unfold()${propParts.join("")}, ${createEdge})`;
1289
+ const query = `g.E().has('repositoryId', rid).has('id', relId).fold().coalesce(unfold()${propParts.join("")}, ${createEdge})`;
1290
1290
  await conn.submit(query, bindings);
1291
1291
  }
1292
1292