memorysync-sdk 1.7.1 → 1.7.3
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 +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +34 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +34 -21
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -851,6 +851,15 @@ interface BulkAddResponse {
|
|
|
851
851
|
skipped: number;
|
|
852
852
|
rejected: number;
|
|
853
853
|
results: BulkAddItemResult[];
|
|
854
|
+
/**
|
|
855
|
+
* Items the server accepted without returning a per-item result.
|
|
856
|
+
*
|
|
857
|
+
* Normally `0`. It is the whole batch when the organization is over its plan
|
|
858
|
+
* limit: the route answers a bare success envelope and stores nothing, so
|
|
859
|
+
* there is no per-item detail to report. Counted separately from `created` on
|
|
860
|
+
* purpose — reporting these as created would be a guess, and a wrong one.
|
|
861
|
+
*/
|
|
862
|
+
unreported: number;
|
|
854
863
|
}
|
|
855
864
|
interface QueryFilters {
|
|
856
865
|
memoryType?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -851,6 +851,15 @@ interface BulkAddResponse {
|
|
|
851
851
|
skipped: number;
|
|
852
852
|
rejected: number;
|
|
853
853
|
results: BulkAddItemResult[];
|
|
854
|
+
/**
|
|
855
|
+
* Items the server accepted without returning a per-item result.
|
|
856
|
+
*
|
|
857
|
+
* Normally `0`. It is the whole batch when the organization is over its plan
|
|
858
|
+
* limit: the route answers a bare success envelope and stores nothing, so
|
|
859
|
+
* there is no per-item detail to report. Counted separately from `created` on
|
|
860
|
+
* purpose — reporting these as created would be a guess, and a wrong one.
|
|
861
|
+
*/
|
|
862
|
+
unreported: number;
|
|
854
863
|
}
|
|
855
864
|
interface QueryFilters {
|
|
856
865
|
memoryType?: string;
|
package/dist/index.js
CHANGED
|
@@ -576,7 +576,7 @@ var IntegrationsNamespace = class extends Namespace {
|
|
|
576
576
|
};
|
|
577
577
|
|
|
578
578
|
// src/control-plane.ts
|
|
579
|
-
var SDK_VERSION = "1.7.
|
|
579
|
+
var SDK_VERSION = "1.7.3";
|
|
580
580
|
function safeJson(text) {
|
|
581
581
|
try {
|
|
582
582
|
return JSON.parse(text);
|
|
@@ -1132,7 +1132,23 @@ var ControlPlaneClient = class {
|
|
|
1132
1132
|
};
|
|
1133
1133
|
|
|
1134
1134
|
// src/index.ts
|
|
1135
|
-
|
|
1135
|
+
function asSkipped(raw, defaultReason) {
|
|
1136
|
+
if (!raw || typeof raw !== "object") return null;
|
|
1137
|
+
if (raw.status === "skipped") {
|
|
1138
|
+
return {
|
|
1139
|
+
status: "skipped",
|
|
1140
|
+
reason: raw.reason ?? defaultReason,
|
|
1141
|
+
memoryIds: raw.memory_ids ?? [],
|
|
1142
|
+
candidatesExtracted: raw.candidates_extracted ?? 0,
|
|
1143
|
+
candidatesStored: raw.candidates_stored ?? 0
|
|
1144
|
+
};
|
|
1145
|
+
}
|
|
1146
|
+
if (raw.status === "ok" && raw.id === void 0) {
|
|
1147
|
+
return { status: "skipped", reason: "quota_exhausted", memoryIds: [], candidatesExtracted: 0, candidatesStored: 0 };
|
|
1148
|
+
}
|
|
1149
|
+
return null;
|
|
1150
|
+
}
|
|
1151
|
+
var SDK_VERSION2 = "1.7.3";
|
|
1136
1152
|
function camelToSnakeKey(key) {
|
|
1137
1153
|
return key.replace(/([A-Z])/g, "_$1").toLowerCase();
|
|
1138
1154
|
}
|
|
@@ -1303,15 +1319,8 @@ var MemorySyncClient = class {
|
|
|
1303
1319
|
body,
|
|
1304
1320
|
endUserOverride: req.endUserId
|
|
1305
1321
|
});
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
status: "skipped",
|
|
1309
|
-
reason: raw.reason ?? "no_high_value_content",
|
|
1310
|
-
memoryIds: raw.memory_ids ?? [],
|
|
1311
|
-
candidatesExtracted: raw.candidates_extracted ?? 0,
|
|
1312
|
-
candidatesStored: raw.candidates_stored ?? 0
|
|
1313
|
-
};
|
|
1314
|
-
}
|
|
1322
|
+
const notStored = asSkipped(raw, "no_high_value_content");
|
|
1323
|
+
if (notStored) return notStored;
|
|
1315
1324
|
return snakeToCamelMemory(raw);
|
|
1316
1325
|
}
|
|
1317
1326
|
async bulkAdd(items, opts = {}) {
|
|
@@ -1331,12 +1340,23 @@ var MemorySyncClient = class {
|
|
|
1331
1340
|
deduplicate: opts.deduplicate ?? true
|
|
1332
1341
|
};
|
|
1333
1342
|
const raw = await this.request("POST", "/memory/bulk-add", { body });
|
|
1343
|
+
if (!Array.isArray(raw.results)) {
|
|
1344
|
+
return {
|
|
1345
|
+
total: items.length,
|
|
1346
|
+
created: 0,
|
|
1347
|
+
skipped: 0,
|
|
1348
|
+
rejected: 0,
|
|
1349
|
+
results: [],
|
|
1350
|
+
unreported: items.length
|
|
1351
|
+
};
|
|
1352
|
+
}
|
|
1334
1353
|
return {
|
|
1335
1354
|
total: raw.total,
|
|
1336
1355
|
created: raw.created,
|
|
1337
1356
|
skipped: raw.skipped,
|
|
1338
1357
|
rejected: raw.rejected,
|
|
1339
|
-
|
|
1358
|
+
unreported: 0,
|
|
1359
|
+
results: raw.results.map((r) => ({
|
|
1340
1360
|
index: r.index,
|
|
1341
1361
|
status: r.status,
|
|
1342
1362
|
memoryIds: r.memory_ids ?? [],
|
|
@@ -1533,15 +1553,8 @@ var MemorySyncClient = class {
|
|
|
1533
1553
|
form,
|
|
1534
1554
|
endUserOverride: req.endUserId
|
|
1535
1555
|
});
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
status: "skipped",
|
|
1539
|
-
reason: raw.reason ?? "no_extractable_text",
|
|
1540
|
-
memoryIds: raw.memory_ids ?? [],
|
|
1541
|
-
candidatesExtracted: raw.candidates_extracted ?? 0,
|
|
1542
|
-
candidatesStored: raw.candidates_stored ?? 0
|
|
1543
|
-
};
|
|
1544
|
-
}
|
|
1556
|
+
const notStored = asSkipped(raw, "no_extractable_text");
|
|
1557
|
+
if (notStored) return notStored;
|
|
1545
1558
|
return snakeToCamelMemory(raw);
|
|
1546
1559
|
}
|
|
1547
1560
|
// ── Bulk edit ──────────────────────────────────────────────────────
|