@contextableai/openclaw-memory-rebac 0.1.1 → 0.1.2
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/spicedb.js +14 -3
- package/docker/graphiti/startup.py +5 -2
- package/package.json +1 -1
package/dist/spicedb.js
CHANGED
|
@@ -114,11 +114,22 @@ export class SpiceDbClient {
|
|
|
114
114
|
async bulkImportRelationships(tuples, batchSize = 1000) {
|
|
115
115
|
if (tuples.length === 0)
|
|
116
116
|
return 0;
|
|
117
|
-
// Try streaming bulk import first
|
|
117
|
+
// Try streaming bulk import first (uses CREATE semantics — rejects duplicates)
|
|
118
118
|
if (typeof this.promises.bulkImportRelationships === "function") {
|
|
119
|
-
|
|
119
|
+
try {
|
|
120
|
+
return await this.bulkImportViaStream(tuples, batchSize);
|
|
121
|
+
}
|
|
122
|
+
catch (err) {
|
|
123
|
+
// ALREADY_EXISTS means some relationships exist (e.g. partial previous run).
|
|
124
|
+
// Fall through to batched writeRelationships which uses TOUCH (idempotent).
|
|
125
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
126
|
+
if (msg.includes("ALREADY_EXISTS")) {
|
|
127
|
+
return this.bulkImportViaWrite(tuples, batchSize);
|
|
128
|
+
}
|
|
129
|
+
throw err;
|
|
130
|
+
}
|
|
120
131
|
}
|
|
121
|
-
// Fallback: batched writeRelationships
|
|
132
|
+
// Fallback: batched writeRelationships (uses TOUCH — idempotent)
|
|
122
133
|
return this.bulkImportViaWrite(tuples, batchSize);
|
|
123
134
|
}
|
|
124
135
|
bulkImportViaStream(tuples, batchSize) {
|
|
@@ -98,8 +98,11 @@ def patch():
|
|
|
98
98
|
"WHERE $episode_uuid IN r.episodes "
|
|
99
99
|
"RETURN DISTINCT r.uuid AS uuid"
|
|
100
100
|
)
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
# Use the raw Neo4j async driver directly to avoid differences
|
|
102
|
+
# in the Graphiti Neo4jDriver.execute_query() wrapper across versions.
|
|
103
|
+
raw_driver = singleton_client.driver.client
|
|
104
|
+
records, _, _ = await raw_driver.execute_query(
|
|
105
|
+
query, parameters_={"episode_uuid": episode_uuid}
|
|
103
106
|
)
|
|
104
107
|
return [{"uuid": r["uuid"]} for r in records]
|
|
105
108
|
|
package/package.json
CHANGED