@littlebigbrain/client 0.14.0 → 0.16.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/client.d.ts +46 -43
- package/dist/client.js +62 -71
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/namespaces.d.ts +79 -18
- package/dist/namespaces.js +128 -22
- package/dist/schema.d.ts +11634 -6173
- package/dist/transport.d.ts +17 -2
- package/dist/transport.js +14 -0
- package/dist/types.d.ts +21 -1
- package/dist/types.js +21 -2
- package/dist/workflows.d.ts +207 -0
- package/dist/workflows.js +518 -0
- package/package.json +1 -1
package/dist/namespaces.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { attributeFilter, firstPatternVariable, parseSparqlResults, } from "./types.js";
|
|
1
|
+
import { attributeFilter, firstPatternVariable, parseSparqlResults, profileBody, } from "./types.js";
|
|
2
2
|
// SPARQL is the query language. Search by meaning is `embeddings.search`
|
|
3
3
|
// (`POST /v1/search`); the older search, embedding, decode, groundability,
|
|
4
4
|
// and analytics operations were removed with their routes.
|
|
@@ -16,6 +16,9 @@ function withReadConsistency(client, body, opts) {
|
|
|
16
16
|
}
|
|
17
17
|
return merged;
|
|
18
18
|
}
|
|
19
|
+
function withProfile(body, opts) {
|
|
20
|
+
return profileBody(body, opts.profile);
|
|
21
|
+
}
|
|
19
22
|
export class GraphNamespace {
|
|
20
23
|
client;
|
|
21
24
|
facts;
|
|
@@ -26,6 +29,7 @@ export class GraphNamespace {
|
|
|
26
29
|
search;
|
|
27
30
|
evals;
|
|
28
31
|
embeddings;
|
|
32
|
+
workflows;
|
|
29
33
|
constructor(client) {
|
|
30
34
|
this.client = client;
|
|
31
35
|
this.facts = new FactsNamespace(client);
|
|
@@ -36,11 +40,23 @@ export class GraphNamespace {
|
|
|
36
40
|
this.search = client.search;
|
|
37
41
|
this.evals = client.evals;
|
|
38
42
|
this.embeddings = client.embeddings;
|
|
43
|
+
this.workflows = client.workflows;
|
|
39
44
|
}
|
|
40
45
|
/** Publication lifecycle for this graph, including pre-first-publish state. */
|
|
41
46
|
publicationStatus() {
|
|
42
47
|
return this.client.publicationStatus();
|
|
43
48
|
}
|
|
49
|
+
/** Background work on this graph. See {@link LbbClient.activity}. */
|
|
50
|
+
activity() {
|
|
51
|
+
return this.client.activity();
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The SPARQL planner's statistics for the published generation latest reads
|
|
55
|
+
* use. See {@link LbbClient.plannerStats}.
|
|
56
|
+
*/
|
|
57
|
+
plannerStats(opts = {}) {
|
|
58
|
+
return this.client.plannerStats(opts);
|
|
59
|
+
}
|
|
44
60
|
/** Wait until this graph has an exact generation covering `targetSeq`. */
|
|
45
61
|
waitForPublished(targetSeq, opts = {}) {
|
|
46
62
|
return this.client.waitForPublished(targetSeq, opts);
|
|
@@ -155,16 +171,6 @@ export class EntityNamespace {
|
|
|
155
171
|
constructor(client) {
|
|
156
172
|
this.client = client;
|
|
157
173
|
}
|
|
158
|
-
/**
|
|
159
|
-
* Return the exact type cardinality and a bounded deterministic sample from
|
|
160
|
-
* the Base family pinned by the published generation.
|
|
161
|
-
*/
|
|
162
|
-
sample(opts) {
|
|
163
|
-
return this.client.entityTypeSample(opts);
|
|
164
|
-
}
|
|
165
|
-
get(opts) {
|
|
166
|
-
return this.client.entityMetadata(opts);
|
|
167
|
-
}
|
|
168
174
|
detail(opts) {
|
|
169
175
|
return this.client.entityDetail(opts);
|
|
170
176
|
}
|
|
@@ -381,11 +387,105 @@ export class SchemaNamespace {
|
|
|
381
387
|
});
|
|
382
388
|
}
|
|
383
389
|
}
|
|
390
|
+
/**
|
|
391
|
+
* Ontology change suggestions: durable proposals from integrations,
|
|
392
|
+
* agents and people. People accept or dismiss them; accepting
|
|
393
|
+
* applies the change to the current ontology.
|
|
394
|
+
*/
|
|
395
|
+
export class OntologySuggestionsNamespace {
|
|
396
|
+
client;
|
|
397
|
+
constructor(client) {
|
|
398
|
+
this.client = client;
|
|
399
|
+
}
|
|
400
|
+
/** Newest update first, with counts per status over the whole graph. */
|
|
401
|
+
list(options = {}) {
|
|
402
|
+
const { status, originKind, originId, anchor, key, limit, ...opts } = options;
|
|
403
|
+
return this.client.request("GET", "/v1/ontology/suggestions", {
|
|
404
|
+
...opts,
|
|
405
|
+
query: {
|
|
406
|
+
status,
|
|
407
|
+
origin_kind: originKind,
|
|
408
|
+
origin_id: originId,
|
|
409
|
+
anchor,
|
|
410
|
+
key,
|
|
411
|
+
limit,
|
|
412
|
+
},
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
/** One suggestion with its evidence, impact and discussion. */
|
|
416
|
+
get(suggestionId, opts = {}) {
|
|
417
|
+
return this.client.request("GET", "/v1/ontology/suggestions/detail", {
|
|
418
|
+
...opts,
|
|
419
|
+
query: { suggestion_id: suggestionId },
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* File a suggestion, or update the one with the same `key`. The server
|
|
424
|
+
* dry-runs the change and never changes the ontology here, so a retry is
|
|
425
|
+
* safe.
|
|
426
|
+
*/
|
|
427
|
+
create(body, opts = {}) {
|
|
428
|
+
return this.client.request("POST", "/v1/ontology/suggestions", {
|
|
429
|
+
...opts,
|
|
430
|
+
retry: opts.retry ?? true,
|
|
431
|
+
body,
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
/** Dry-run the change against the current ontology and store the impact. */
|
|
435
|
+
validate(suggestionId, opts = {}) {
|
|
436
|
+
return this.client.request("POST", "/v1/ontology/suggestions/validate", {
|
|
437
|
+
...opts,
|
|
438
|
+
retry: opts.retry ?? true,
|
|
439
|
+
query: { suggestion_id: suggestionId },
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* Apply the change to the current ontology. Pass `change` to accept an
|
|
444
|
+
* edited change. Accepting twice returns the accepted suggestion.
|
|
445
|
+
*/
|
|
446
|
+
accept(suggestionId, body = {}, opts = {}) {
|
|
447
|
+
return this.client.request("POST", "/v1/ontology/suggestions/accept", {
|
|
448
|
+
...opts,
|
|
449
|
+
retry: opts.retry ?? true,
|
|
450
|
+
query: { suggestion_id: suggestionId },
|
|
451
|
+
body,
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
/** Decline with a reason. The ontology does not change. */
|
|
455
|
+
dismiss(suggestionId, body, opts = {}) {
|
|
456
|
+
return this.client.request("POST", "/v1/ontology/suggestions/dismiss", {
|
|
457
|
+
...opts,
|
|
458
|
+
retry: opts.retry ?? true,
|
|
459
|
+
query: { suggestion_id: suggestionId },
|
|
460
|
+
body,
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
/** Withdraw as the producer, for example when the source field is gone. */
|
|
464
|
+
supersede(suggestionId, body, opts = {}) {
|
|
465
|
+
return this.client.request("POST", "/v1/ontology/suggestions/supersede", {
|
|
466
|
+
...opts,
|
|
467
|
+
retry: opts.retry ?? true,
|
|
468
|
+
query: { suggestion_id: suggestionId },
|
|
469
|
+
body,
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
/** Add a comment to the discussion. */
|
|
473
|
+
comment(suggestionId, body, opts = {}) {
|
|
474
|
+
return this.client.request("POST", "/v1/ontology/suggestions/comment", {
|
|
475
|
+
...opts,
|
|
476
|
+
query: { suggestion_id: suggestionId },
|
|
477
|
+
body,
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
}
|
|
384
481
|
/** Ontology discovery and lifecycle operations. */
|
|
385
482
|
export class OntologyNamespace {
|
|
386
483
|
client;
|
|
484
|
+
/** Reviewable change suggestions from every producer. */
|
|
485
|
+
suggestions;
|
|
387
486
|
constructor(client) {
|
|
388
487
|
this.client = client;
|
|
488
|
+
this.suggestions = new OntologySuggestionsNamespace(client);
|
|
389
489
|
}
|
|
390
490
|
view(options = {}) {
|
|
391
491
|
const { counts, ...request } = options;
|
|
@@ -394,11 +494,18 @@ export class OntologyNamespace {
|
|
|
394
494
|
query: counts ? { counts: true } : undefined,
|
|
395
495
|
});
|
|
396
496
|
}
|
|
497
|
+
/**
|
|
498
|
+
* Read the published SHACL conformance report. `limit` bounds the returned
|
|
499
|
+
* `results` (server default 200, maximum 2,000); `result_count` and
|
|
500
|
+
* `conforms` stay exact, and `truncated` says the window is partial.
|
|
501
|
+
*/
|
|
397
502
|
conformance(opts = {}) {
|
|
503
|
+
const { limit, ...rest } = opts;
|
|
398
504
|
return this.client.request("GET", "/v1/ontology/conformance", {
|
|
399
|
-
...
|
|
505
|
+
...rest,
|
|
400
506
|
query: {
|
|
401
507
|
consistency: opts.consistency ?? this.client.defaultConsistency,
|
|
508
|
+
...(limit !== undefined ? { limit } : {}),
|
|
402
509
|
},
|
|
403
510
|
});
|
|
404
511
|
}
|
|
@@ -433,13 +540,6 @@ export class OntologyNamespace {
|
|
|
433
540
|
body,
|
|
434
541
|
});
|
|
435
542
|
}
|
|
436
|
-
induce(body, opts = {}) {
|
|
437
|
-
return this.client.request("POST", "/v1/ontology/induce", {
|
|
438
|
-
...opts,
|
|
439
|
-
retry: opts.retry ?? true,
|
|
440
|
-
body,
|
|
441
|
-
});
|
|
442
|
-
}
|
|
443
543
|
}
|
|
444
544
|
/** Structured and SPARQL-text query operations. */
|
|
445
545
|
export class QueryNamespace {
|
|
@@ -451,15 +551,20 @@ export class QueryNamespace {
|
|
|
451
551
|
return this.client.request("POST", "/v1/query/sparql", {
|
|
452
552
|
...opts,
|
|
453
553
|
retry: opts.retry ?? true,
|
|
454
|
-
body: withReadConsistency(this.client, body, opts),
|
|
554
|
+
body: profileBody(withReadConsistency(this.client, body, opts)),
|
|
455
555
|
});
|
|
456
556
|
}
|
|
557
|
+
/**
|
|
558
|
+
* Run a SPARQL text query and parse its rows. `profile: true` (in `opts` or
|
|
559
|
+
* the body) returns the server's measurements in `profile`; a profiled
|
|
560
|
+
* request never uses the result cache.
|
|
561
|
+
*/
|
|
457
562
|
async sparql(body, opts = {}) {
|
|
458
563
|
// The text dialect carries consistency/floor on the URL, not the body.
|
|
459
564
|
const response = await this.client.request("POST", "/v1/query/sparql-text", {
|
|
460
565
|
...opts,
|
|
461
566
|
retry: opts.retry ?? true,
|
|
462
|
-
body,
|
|
567
|
+
body: withProfile(body, opts),
|
|
463
568
|
query: {
|
|
464
569
|
consistency: opts.consistency ?? this.client.defaultConsistency,
|
|
465
570
|
min_indexed_seq: opts.minIndexedSeq,
|
|
@@ -467,11 +572,12 @@ export class QueryNamespace {
|
|
|
467
572
|
});
|
|
468
573
|
return parseSparqlResults(response);
|
|
469
574
|
}
|
|
575
|
+
/** As {@link sparql}, returning the raw response with its `results` string. */
|
|
470
576
|
sparqlRaw(body, opts = {}) {
|
|
471
577
|
return this.client.request("POST", "/v1/query/sparql-text", {
|
|
472
578
|
...opts,
|
|
473
579
|
retry: opts.retry ?? true,
|
|
474
|
-
body,
|
|
580
|
+
body: withProfile(body, opts),
|
|
475
581
|
query: {
|
|
476
582
|
consistency: opts.consistency ?? this.client.defaultConsistency,
|
|
477
583
|
min_indexed_seq: opts.minIndexedSeq,
|