@littlebigbrain/client 0.9.0 → 0.9.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/README.md +2 -1
- package/dist/client.js +18 -4
- package/dist/schema.d.ts +24 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -90,7 +90,8 @@ console.log(completed.state, completed.committed_commit_seq);
|
|
|
90
90
|
|
|
91
91
|
`records()` may be an iterable or async iterable. Success means every grouped
|
|
92
92
|
commit is durable and final publication was enqueued; it does not mean indexes
|
|
93
|
-
have already reached `committed_commit_seq`.
|
|
93
|
+
have already reached `committed_commit_seq`. An empty iterable is rejected
|
|
94
|
+
locally before an import POST is sent.
|
|
94
95
|
|
|
95
96
|
**Time-travel read.** Pin any search to a past instant — results reflect the graph as it was then:
|
|
96
97
|
|
package/dist/client.js
CHANGED
|
@@ -29,14 +29,27 @@ function durableImportIterator(source) {
|
|
|
29
29
|
},
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
function durableImportBody(source) {
|
|
32
|
+
async function durableImportBody(source) {
|
|
33
33
|
const iterator = durableImportIterator(source);
|
|
34
|
+
const first = await iterator.next();
|
|
35
|
+
if (first.done) {
|
|
36
|
+
await iterator.return?.();
|
|
37
|
+
throw new TypeError("submitImport requires at least one NDJSON record or byte chunk");
|
|
38
|
+
}
|
|
39
|
+
let firstPending = true;
|
|
40
|
+
const next = async () => {
|
|
41
|
+
if (firstPending) {
|
|
42
|
+
firstPending = false;
|
|
43
|
+
return { done: false, value: first.value };
|
|
44
|
+
}
|
|
45
|
+
return iterator.next();
|
|
46
|
+
};
|
|
34
47
|
const Stream = globalThis.ReadableStream;
|
|
35
48
|
if (Stream) {
|
|
36
49
|
return new Stream({
|
|
37
50
|
async pull(controller) {
|
|
38
51
|
try {
|
|
39
|
-
const item = await
|
|
52
|
+
const item = await next();
|
|
40
53
|
if (item.done) {
|
|
41
54
|
controller.close();
|
|
42
55
|
}
|
|
@@ -57,7 +70,7 @@ function durableImportBody(source) {
|
|
|
57
70
|
async *[Symbol.asyncIterator]() {
|
|
58
71
|
try {
|
|
59
72
|
for (;;) {
|
|
60
|
-
const item = await
|
|
73
|
+
const item = await next();
|
|
61
74
|
if (item.done)
|
|
62
75
|
return;
|
|
63
76
|
yield durableImportBytes(item.value);
|
|
@@ -467,8 +480,9 @@ export class LbbClient {
|
|
|
467
480
|
throw new TypeError("submitImport requires a non-empty idempotencyKey");
|
|
468
481
|
}
|
|
469
482
|
await this.requireCapability("durable_import_jobs_v1");
|
|
483
|
+
const rawBody = await durableImportBody(lines);
|
|
470
484
|
return this.request("POST", "/v1/graph/import-jobs", {
|
|
471
|
-
rawBody
|
|
485
|
+
rawBody,
|
|
472
486
|
contentType: "application/x-ndjson",
|
|
473
487
|
duplex: "half",
|
|
474
488
|
query: {
|
package/dist/schema.d.ts
CHANGED
|
@@ -3243,12 +3243,30 @@ export interface components {
|
|
|
3243
3243
|
* structured server logs.
|
|
3244
3244
|
*/
|
|
3245
3245
|
GraphImportJobFailure: {
|
|
3246
|
+
/**
|
|
3247
|
+
* Format: int32
|
|
3248
|
+
* @description Delivery attempts consumed when the job became terminal.
|
|
3249
|
+
*/
|
|
3250
|
+
attempts: number;
|
|
3246
3251
|
code: string;
|
|
3252
|
+
/**
|
|
3253
|
+
* @description Stable opaque correlation id for server-side logs. It is intentionally
|
|
3254
|
+
* not an object key, worker id, or graph identity.
|
|
3255
|
+
*/
|
|
3256
|
+
diagnostic_id: string;
|
|
3247
3257
|
message: string;
|
|
3248
3258
|
retryable: boolean;
|
|
3259
|
+
/** @description Last durable low-cardinality stage reached by the worker. */
|
|
3260
|
+
stage: components["schemas"]["GraphImportJobStage"];
|
|
3249
3261
|
};
|
|
3250
3262
|
/** @description Bounded progress persisted by an import worker after every grouped commit. */
|
|
3251
3263
|
GraphImportJobProgress: {
|
|
3264
|
+
/** Format: int64 */
|
|
3265
|
+
active_group_bytes?: number;
|
|
3266
|
+
/** Format: int64 */
|
|
3267
|
+
active_group_index?: number | null;
|
|
3268
|
+
/** Format: int64 */
|
|
3269
|
+
active_group_records?: number;
|
|
3252
3270
|
/** Format: int64 */
|
|
3253
3271
|
bytes_processed: number;
|
|
3254
3272
|
committed_commit_seq?: null | components["schemas"]["CommitSeq"];
|
|
@@ -3263,11 +3281,17 @@ export interface components {
|
|
|
3263
3281
|
observations: number;
|
|
3264
3282
|
/** Format: int64 */
|
|
3265
3283
|
properties: number;
|
|
3284
|
+
stage?: components["schemas"]["GraphImportJobStage"];
|
|
3266
3285
|
/** Format: int64 */
|
|
3267
3286
|
triplets: number;
|
|
3268
3287
|
/** Format: int64 */
|
|
3269
3288
|
upload_bytes: number;
|
|
3270
3289
|
};
|
|
3290
|
+
/**
|
|
3291
|
+
* @description Low-cardinality execution stage exposed while a durable import is active.
|
|
3292
|
+
* @enum {string}
|
|
3293
|
+
*/
|
|
3294
|
+
GraphImportJobStage: "queued" | "reading_payload" | "committing_group" | "persisting_checkpoint" | "enqueueing_publication" | "completed";
|
|
3271
3295
|
/**
|
|
3272
3296
|
* @description Lifecycle of a durable NDJSON import submitted through
|
|
3273
3297
|
* `POST /v1/graph/import-jobs`.
|