@utaba/deep-memory-storage-cosmosdb 0.8.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.cjs CHANGED
@@ -789,8 +789,8 @@ async function findEntities(conn, repositoryId, query) {
789
789
  var import_deep_memory3 = require("@utaba/deep-memory");
790
790
  async function createRelationship(conn, repositoryId, relationship) {
791
791
  const existing = await conn.submit(
792
- "g.E().has('id', relId).count()",
793
- { relId: relationship.id }
792
+ "g.E().has('repositoryId', rid).has('id', relId).count()",
793
+ { rid: repositoryId, relId: relationship.id }
794
794
  );
795
795
  if (Number(existing.items[0] ?? 0) > 0) {
796
796
  throw new import_deep_memory3.DuplicateRelationshipError(relationship.id);
@@ -1323,7 +1323,7 @@ async function upsertRelationship(conn, repositoryId, rel) {
1323
1323
  propParts.push(`.property('${key}', ${paramName})`);
1324
1324
  }
1325
1325
  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("")}`;
1326
- const query = `g.E().has('id', relId).fold().coalesce(unfold()${propParts.join("")}, ${createEdge})`;
1326
+ const query = `g.E().has('repositoryId', rid).has('id', relId).fold().coalesce(unfold()${propParts.join("")}, ${createEdge})`;
1327
1327
  await conn.submit(query, bindings);
1328
1328
  }
1329
1329