memorysync-sdk 1.8.0 → 1.9.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 +40 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.js +59 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +59 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
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.9.0";
|
|
536
536
|
function safeJson(text) {
|
|
537
537
|
try {
|
|
538
538
|
return JSON.parse(text);
|
|
@@ -1104,7 +1104,7 @@ function asSkipped(raw, defaultReason) {
|
|
|
1104
1104
|
}
|
|
1105
1105
|
return null;
|
|
1106
1106
|
}
|
|
1107
|
-
var SDK_VERSION2 = "1.
|
|
1107
|
+
var SDK_VERSION2 = "1.9.0";
|
|
1108
1108
|
function camelToSnakeKey(key) {
|
|
1109
1109
|
return key.replace(/([A-Z])/g, "_$1").toLowerCase();
|
|
1110
1110
|
}
|
|
@@ -1322,6 +1322,63 @@ var MemorySyncClient = class {
|
|
|
1322
1322
|
}))
|
|
1323
1323
|
};
|
|
1324
1324
|
}
|
|
1325
|
+
// ── Bulk import ────────────────────────────────────────────────────
|
|
1326
|
+
/**
|
|
1327
|
+
* Upload a payload and get an import job back, without waiting for it.
|
|
1328
|
+
*
|
|
1329
|
+
* `bulkAdd` accepts fifty records per call because each one runs the extraction
|
|
1330
|
+
* pipeline. For a migration out of another system, upload the whole file here
|
|
1331
|
+
* and poll {@link getImport}.
|
|
1332
|
+
*
|
|
1333
|
+
* `resume` requires `clientRef` on every record and is what makes re-running the
|
|
1334
|
+
* same file safe: records a previous run already stored come back counted as
|
|
1335
|
+
* `alreadyImported` rather than stored again.
|
|
1336
|
+
*
|
|
1337
|
+
* The payload is JSONL, or JSON when `filename` ends in `.json`. The extension
|
|
1338
|
+
* is how the server picks the reader, so it is required.
|
|
1339
|
+
*/
|
|
1340
|
+
async createImport(req) {
|
|
1341
|
+
if (!req.filename?.trim()) {
|
|
1342
|
+
throw new ValidationError("filename is required so the server can pick a reader");
|
|
1343
|
+
}
|
|
1344
|
+
const form = new FormData();
|
|
1345
|
+
form.set("resume", req.resume ? "true" : "false");
|
|
1346
|
+
form.set("continue_on_error", req.continueOnError ? "true" : "false");
|
|
1347
|
+
if (req.endUserId !== void 0) form.set("end_user_id", req.endUserId);
|
|
1348
|
+
const blob = req.file instanceof Blob ? req.file : new Blob([req.file], { type: "application/octet-stream" });
|
|
1349
|
+
form.set("file", blob, req.filename);
|
|
1350
|
+
return this.request("POST", "/imports", {
|
|
1351
|
+
form,
|
|
1352
|
+
endUserOverride: req.endUserId
|
|
1353
|
+
});
|
|
1354
|
+
}
|
|
1355
|
+
/**
|
|
1356
|
+
* One import job's status, progress and per-outcome counters.
|
|
1357
|
+
*
|
|
1358
|
+
* `progress_percentage` stays below 100 until the job is genuinely finished, so
|
|
1359
|
+
* reaching 100 means done.
|
|
1360
|
+
*/
|
|
1361
|
+
async getImport(jobId) {
|
|
1362
|
+
if (!jobId?.trim()) throw new ValidationError("jobId is required");
|
|
1363
|
+
return this.request("GET", `/imports/${encodeURIComponent(jobId)}`);
|
|
1364
|
+
}
|
|
1365
|
+
/** Recent import jobs, newest first. */
|
|
1366
|
+
async listImports(opts = {}) {
|
|
1367
|
+
return this.request("GET", "/imports", { query: opts });
|
|
1368
|
+
}
|
|
1369
|
+
/**
|
|
1370
|
+
* Ask the worker to stop between batches.
|
|
1371
|
+
*
|
|
1372
|
+
* Records already imported stay imported, and the counters report how far it
|
|
1373
|
+
* reached. Cancelling a finished job is a no-op rather than an error.
|
|
1374
|
+
*/
|
|
1375
|
+
async cancelImport(jobId) {
|
|
1376
|
+
if (!jobId?.trim()) throw new ValidationError("jobId is required");
|
|
1377
|
+
return this.request(
|
|
1378
|
+
"POST",
|
|
1379
|
+
`/imports/${encodeURIComponent(jobId)}/cancel`
|
|
1380
|
+
);
|
|
1381
|
+
}
|
|
1325
1382
|
async query(req) {
|
|
1326
1383
|
const body = { query: req.query };
|
|
1327
1384
|
if (req.k !== void 0) body.k = req.k;
|