memorysync-sdk 1.7.2 → 1.8.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.d.mts +30 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.js +36 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +36 -21
- package/dist/index.mjs.map +1 -1
- package/package.json +60 -60
package/dist/index.mjs
CHANGED
|
@@ -532,7 +532,7 @@ var IntegrationsNamespace = class extends Namespace {
|
|
|
532
532
|
};
|
|
533
533
|
|
|
534
534
|
// src/control-plane.ts
|
|
535
|
-
var SDK_VERSION = "1.
|
|
535
|
+
var SDK_VERSION = "1.8.0";
|
|
536
536
|
function safeJson(text) {
|
|
537
537
|
try {
|
|
538
538
|
return JSON.parse(text);
|
|
@@ -1088,7 +1088,23 @@ var ControlPlaneClient = class {
|
|
|
1088
1088
|
};
|
|
1089
1089
|
|
|
1090
1090
|
// src/index.ts
|
|
1091
|
-
|
|
1091
|
+
function asSkipped(raw, defaultReason) {
|
|
1092
|
+
if (!raw || typeof raw !== "object") return null;
|
|
1093
|
+
if (raw.status === "skipped") {
|
|
1094
|
+
return {
|
|
1095
|
+
status: "skipped",
|
|
1096
|
+
reason: raw.reason ?? defaultReason,
|
|
1097
|
+
memoryIds: raw.memory_ids ?? [],
|
|
1098
|
+
candidatesExtracted: raw.candidates_extracted ?? 0,
|
|
1099
|
+
candidatesStored: raw.candidates_stored ?? 0
|
|
1100
|
+
};
|
|
1101
|
+
}
|
|
1102
|
+
if (raw.status === "ok" && raw.id === void 0) {
|
|
1103
|
+
return { status: "skipped", reason: "quota_exhausted", memoryIds: [], candidatesExtracted: 0, candidatesStored: 0 };
|
|
1104
|
+
}
|
|
1105
|
+
return null;
|
|
1106
|
+
}
|
|
1107
|
+
var SDK_VERSION2 = "1.8.0";
|
|
1092
1108
|
function camelToSnakeKey(key) {
|
|
1093
1109
|
return key.replace(/([A-Z])/g, "_$1").toLowerCase();
|
|
1094
1110
|
}
|
|
@@ -1255,19 +1271,13 @@ var MemorySyncClient = class {
|
|
|
1255
1271
|
if (req.sessionId !== void 0) body.session_id = req.sessionId;
|
|
1256
1272
|
if (req.metadata !== void 0) body.metadata = req.metadata;
|
|
1257
1273
|
if (req.endUserId !== void 0) body.end_user_id = req.endUserId;
|
|
1274
|
+
if (req.clientRef !== void 0) body.client_ref = req.clientRef;
|
|
1258
1275
|
const raw = await this.request("POST", "/memory/add", {
|
|
1259
1276
|
body,
|
|
1260
1277
|
endUserOverride: req.endUserId
|
|
1261
1278
|
});
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
status: "skipped",
|
|
1265
|
-
reason: raw.reason ?? "no_high_value_content",
|
|
1266
|
-
memoryIds: raw.memory_ids ?? [],
|
|
1267
|
-
candidatesExtracted: raw.candidates_extracted ?? 0,
|
|
1268
|
-
candidatesStored: raw.candidates_stored ?? 0
|
|
1269
|
-
};
|
|
1270
|
-
}
|
|
1279
|
+
const notStored = asSkipped(raw, "no_high_value_content");
|
|
1280
|
+
if (notStored) return notStored;
|
|
1271
1281
|
return snakeToCamelMemory(raw);
|
|
1272
1282
|
}
|
|
1273
1283
|
async bulkAdd(items, opts = {}) {
|
|
@@ -1282,17 +1292,29 @@ var MemorySyncClient = class {
|
|
|
1282
1292
|
if (i.metadata !== void 0) o.metadata = i.metadata;
|
|
1283
1293
|
if (i.importance !== void 0) o.importance = i.importance;
|
|
1284
1294
|
if (i.endUserId !== void 0) o.end_user_id = i.endUserId;
|
|
1295
|
+
if (i.clientRef !== void 0) o.client_ref = i.clientRef;
|
|
1285
1296
|
return o;
|
|
1286
1297
|
}),
|
|
1287
1298
|
deduplicate: opts.deduplicate ?? true
|
|
1288
1299
|
};
|
|
1289
1300
|
const raw = await this.request("POST", "/memory/bulk-add", { body });
|
|
1301
|
+
if (!Array.isArray(raw.results)) {
|
|
1302
|
+
return {
|
|
1303
|
+
total: items.length,
|
|
1304
|
+
created: 0,
|
|
1305
|
+
skipped: 0,
|
|
1306
|
+
rejected: 0,
|
|
1307
|
+
results: [],
|
|
1308
|
+
unreported: items.length
|
|
1309
|
+
};
|
|
1310
|
+
}
|
|
1290
1311
|
return {
|
|
1291
1312
|
total: raw.total,
|
|
1292
1313
|
created: raw.created,
|
|
1293
1314
|
skipped: raw.skipped,
|
|
1294
1315
|
rejected: raw.rejected,
|
|
1295
|
-
|
|
1316
|
+
unreported: 0,
|
|
1317
|
+
results: raw.results.map((r) => ({
|
|
1296
1318
|
index: r.index,
|
|
1297
1319
|
status: r.status,
|
|
1298
1320
|
memoryIds: r.memory_ids ?? [],
|
|
@@ -1489,15 +1511,8 @@ var MemorySyncClient = class {
|
|
|
1489
1511
|
form,
|
|
1490
1512
|
endUserOverride: req.endUserId
|
|
1491
1513
|
});
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
status: "skipped",
|
|
1495
|
-
reason: raw.reason ?? "no_extractable_text",
|
|
1496
|
-
memoryIds: raw.memory_ids ?? [],
|
|
1497
|
-
candidatesExtracted: raw.candidates_extracted ?? 0,
|
|
1498
|
-
candidatesStored: raw.candidates_stored ?? 0
|
|
1499
|
-
};
|
|
1500
|
-
}
|
|
1514
|
+
const notStored = asSkipped(raw, "no_extractable_text");
|
|
1515
|
+
if (notStored) return notStored;
|
|
1501
1516
|
return snakeToCamelMemory(raw);
|
|
1502
1517
|
}
|
|
1503
1518
|
// ── Bulk edit ──────────────────────────────────────────────────────
|