@littlebigbrain/client 0.15.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 +28 -2
- package/dist/client.js +37 -7
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/namespaces.d.ts +79 -4
- package/dist/namespaces.js +128 -12
- package/dist/schema.d.ts +12935 -5784
- package/dist/types.d.ts +13 -0
- package/dist/types.js +20 -2
- package/dist/workflows.d.ts +207 -0
- package/dist/workflows.js +518 -0
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { WorkflowNamespace } from "./workflows.js";
|
|
1
2
|
import type { DurableImportSource, ImportLine, LbbClientOptions, ListResponse, RawLbbResponse, ReadConsistencyOptions, RdfImportDocument, RdfImportManyResult, RdfImportOptions, Schemas, SearchConsistency, SparqlResults } from "./types.js";
|
|
2
3
|
import { type RequestOptions } from "./transport.js";
|
|
3
4
|
import { EntityNamespace, GraphNamespace, OntologyNamespace, QueryNamespace, SchemaNamespace, SearchNamespace, EvalsNamespace, EmbeddingsNamespace } from "./namespaces.js";
|
|
@@ -35,6 +36,7 @@ export declare class LbbClient {
|
|
|
35
36
|
readonly query: QueryNamespace;
|
|
36
37
|
readonly evals: EvalsNamespace;
|
|
37
38
|
readonly embeddings: EmbeddingsNamespace;
|
|
39
|
+
readonly workflows: WorkflowNamespace;
|
|
38
40
|
constructor(options: LbbClientOptions);
|
|
39
41
|
graph(name: string, opts?: {
|
|
40
42
|
stack?: string;
|
|
@@ -387,8 +389,6 @@ export declare class LbbClient {
|
|
|
387
389
|
* migration is needed — and a request that changes nothing is a no-op.
|
|
388
390
|
*/
|
|
389
391
|
evolveOntology(body: Schemas["OntologyEvolveRequest"]): Promise<Schemas["OntologyEvolveResponse"]>;
|
|
390
|
-
/** Suggest ontology additions from the current graph without mutating it. */
|
|
391
|
-
induceOntology(body: Schemas["OntologyInduceRequest"]): Promise<Schemas["OntologyInduceResponse"]>;
|
|
392
392
|
/** Fold the WAL tail into snapshot segments. */
|
|
393
393
|
compact(opts?: {
|
|
394
394
|
minTailCommits?: number;
|
|
@@ -402,9 +402,23 @@ export declare class LbbClient {
|
|
|
402
402
|
}): Promise<Schemas["GraphMetadataResponse"]>;
|
|
403
403
|
/** Automatic publication lifecycle, available before the first generation exists. */
|
|
404
404
|
publicationStatus(): Promise<Schemas["PublicationStatusResponse"]>;
|
|
405
|
+
/** Background work on the graph: publication, compaction, query
|
|
406
|
+
* statistics, validation, embeddings, and imports, exports, forks and
|
|
407
|
+
* index upgrades. One call reads at most 30 objects, so a status view can
|
|
408
|
+
* poll it every few seconds. Needs the server capability
|
|
409
|
+
* `graph_activity_v1`. */
|
|
410
|
+
activity(): Promise<Schemas["GraphActivityResponse"]>;
|
|
405
411
|
/** The managed models the platform uses per role (embedding, judge,
|
|
406
412
|
* rewriter): the operator's catalog, or the compiled defaults. */
|
|
407
413
|
managedModels(): Promise<Schemas["ManagedModelsResponse"]>;
|
|
414
|
+
/** What each managed model did for the stack in one month (`yyyy-mm`,
|
|
415
|
+
* UTC; the current month by default): totals, by day and by graph per
|
|
416
|
+
* feature (`index`, `search`, `fit`, `judge`, `training`) and model, the
|
|
417
|
+
* months with activity, and the model each feature uses now. A stack
|
|
418
|
+
* read: the graph scope is not used. */
|
|
419
|
+
modelActivity(opts?: {
|
|
420
|
+
month?: string;
|
|
421
|
+
}): Promise<Schemas["ModelActivityResponse"]>;
|
|
408
422
|
/** Wait until background reconciliation folds `targetSeq` into the RDF base. */
|
|
409
423
|
waitForPublished(targetSeq: number, opts?: {
|
|
410
424
|
timeoutMs?: number;
|
|
@@ -412,6 +426,18 @@ export declare class LbbClient {
|
|
|
412
426
|
}): Promise<Schemas["PublicationStatusResponse"]>;
|
|
413
427
|
/** Graph counts and type/relation buckets. Carries `consistency`/`min_indexed_seq` on the URL. */
|
|
414
428
|
summary(opts?: ReadConsistencyOptions): Promise<Schemas["GraphSummaryResponse"]>;
|
|
429
|
+
/**
|
|
430
|
+
* The SPARQL planner's statistics for the published generation latest reads
|
|
431
|
+
* use: per-predicate triple and distinct counts (by triple count, paged by
|
|
432
|
+
* `cursor`/`limit`, 200 by default and 500 at most), key-histogram,
|
|
433
|
+
* pair-count and trigram sidecars, and value-order index coverage. Read from
|
|
434
|
+
* the generation's manifest and sidecar metadata; nothing scans the graph.
|
|
435
|
+
* A graph with no published generation answers `served_at_seq: null`.
|
|
436
|
+
*/
|
|
437
|
+
plannerStats(opts?: {
|
|
438
|
+
cursor?: string;
|
|
439
|
+
limit?: number;
|
|
440
|
+
}): Promise<Schemas["PlannerStatsResponse"]>;
|
|
415
441
|
/** Pinned published read root and its query/conformance lag against one coherent head. */
|
|
416
442
|
readSnapshot(): Promise<Schemas["PublishedReadStatusResponse"]>;
|
|
417
443
|
/**
|
package/dist/client.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { WorkflowNamespace } from "./workflows.js";
|
|
2
|
+
import { parseSparqlResults, profileBody } from "./types.js";
|
|
2
3
|
import { bodyMarksTerminal, errorCodeFromBody, fullJitterBackoffMs, parseLbbError, parseResponseJson, retriesNetworkFailure, retriesStatus, retryAllowed, retryableStatus, retryDelayMs, sleep, } from "./transport.js";
|
|
3
4
|
import { LbbCapabilityError } from "./transport.js";
|
|
4
5
|
import { EntityNamespace, GraphNamespace, OntologyNamespace, QueryNamespace, SchemaNamespace, SearchNamespace, EvalsNamespace, EmbeddingsNamespace, } from "./namespaces.js";
|
|
@@ -111,6 +112,7 @@ export class LbbClient {
|
|
|
111
112
|
query;
|
|
112
113
|
evals;
|
|
113
114
|
embeddings;
|
|
115
|
+
workflows;
|
|
114
116
|
constructor(options) {
|
|
115
117
|
const baseUrl = options.baseUrl?.trim();
|
|
116
118
|
if (!baseUrl) {
|
|
@@ -154,6 +156,7 @@ export class LbbClient {
|
|
|
154
156
|
this.query = new QueryNamespace(this);
|
|
155
157
|
this.evals = new EvalsNamespace(this);
|
|
156
158
|
this.embeddings = new EmbeddingsNamespace(this);
|
|
159
|
+
this.workflows = new WorkflowNamespace(this);
|
|
157
160
|
}
|
|
158
161
|
graph(name, opts = {}) {
|
|
159
162
|
return new GraphNamespace(this.withScope({
|
|
@@ -855,7 +858,7 @@ export class LbbClient {
|
|
|
855
858
|
*/
|
|
856
859
|
sparql(body, opts) {
|
|
857
860
|
return this.request("POST", "/v1/query/sparql", {
|
|
858
|
-
body: this.mergeReadConsistency(body, opts),
|
|
861
|
+
body: profileBody(this.mergeReadConsistency(body, opts)),
|
|
859
862
|
});
|
|
860
863
|
}
|
|
861
864
|
/**
|
|
@@ -872,7 +875,7 @@ export class LbbClient {
|
|
|
872
875
|
*/
|
|
873
876
|
sparqlText(body, opts) {
|
|
874
877
|
return this.request("POST", "/v1/query/sparql-text", {
|
|
875
|
-
body,
|
|
878
|
+
body: profileBody(body),
|
|
876
879
|
query: this.readConsistencyQuery(opts),
|
|
877
880
|
retry: "rate_limited",
|
|
878
881
|
});
|
|
@@ -944,10 +947,6 @@ export class LbbClient {
|
|
|
944
947
|
evolveOntology(body) {
|
|
945
948
|
return this.request("POST", "/v1/ontology/evolve", { body });
|
|
946
949
|
}
|
|
947
|
-
/** Suggest ontology additions from the current graph without mutating it. */
|
|
948
|
-
induceOntology(body) {
|
|
949
|
-
return this.request("POST", "/v1/ontology/induce", { body, retry: true });
|
|
950
|
-
}
|
|
951
950
|
/** Fold the WAL tail into snapshot segments. */
|
|
952
951
|
compact(opts = {}) {
|
|
953
952
|
return this.request("POST", "/v1/graph/compact", {
|
|
@@ -974,11 +973,29 @@ export class LbbClient {
|
|
|
974
973
|
publicationStatus() {
|
|
975
974
|
return this.request("GET", "/v1/graph/publication-status");
|
|
976
975
|
}
|
|
976
|
+
/** Background work on the graph: publication, compaction, query
|
|
977
|
+
* statistics, validation, embeddings, and imports, exports, forks and
|
|
978
|
+
* index upgrades. One call reads at most 30 objects, so a status view can
|
|
979
|
+
* poll it every few seconds. Needs the server capability
|
|
980
|
+
* `graph_activity_v1`. */
|
|
981
|
+
activity() {
|
|
982
|
+
return this.request("GET", "/v1/graph/activity");
|
|
983
|
+
}
|
|
977
984
|
/** The managed models the platform uses per role (embedding, judge,
|
|
978
985
|
* rewriter): the operator's catalog, or the compiled defaults. */
|
|
979
986
|
managedModels() {
|
|
980
987
|
return this.request("GET", "/v1/managed-models");
|
|
981
988
|
}
|
|
989
|
+
/** What each managed model did for the stack in one month (`yyyy-mm`,
|
|
990
|
+
* UTC; the current month by default): totals, by day and by graph per
|
|
991
|
+
* feature (`index`, `search`, `fit`, `judge`, `training`) and model, the
|
|
992
|
+
* months with activity, and the model each feature uses now. A stack
|
|
993
|
+
* read: the graph scope is not used. */
|
|
994
|
+
modelActivity(opts = {}) {
|
|
995
|
+
return this.request("GET", "/v1/models/activity", {
|
|
996
|
+
query: { month: opts.month },
|
|
997
|
+
});
|
|
998
|
+
}
|
|
982
999
|
/** Wait until background reconciliation folds `targetSeq` into the RDF base. */
|
|
983
1000
|
async waitForPublished(targetSeq, opts = {}) {
|
|
984
1001
|
if (!Number.isSafeInteger(targetSeq) || targetSeq < 0) {
|
|
@@ -1015,6 +1032,19 @@ export class LbbClient {
|
|
|
1015
1032
|
query: this.readConsistencyQuery(opts),
|
|
1016
1033
|
});
|
|
1017
1034
|
}
|
|
1035
|
+
/**
|
|
1036
|
+
* The SPARQL planner's statistics for the published generation latest reads
|
|
1037
|
+
* use: per-predicate triple and distinct counts (by triple count, paged by
|
|
1038
|
+
* `cursor`/`limit`, 200 by default and 500 at most), key-histogram,
|
|
1039
|
+
* pair-count and trigram sidecars, and value-order index coverage. Read from
|
|
1040
|
+
* the generation's manifest and sidecar metadata; nothing scans the graph.
|
|
1041
|
+
* A graph with no published generation answers `served_at_seq: null`.
|
|
1042
|
+
*/
|
|
1043
|
+
plannerStats(opts = {}) {
|
|
1044
|
+
return this.request("GET", "/v1/graph/planner-stats", {
|
|
1045
|
+
query: { cursor: opts.cursor, limit: opts.limit },
|
|
1046
|
+
});
|
|
1047
|
+
}
|
|
1018
1048
|
/** Pinned published read root and its query/conformance lag against one coherent head. */
|
|
1019
1049
|
readSnapshot() {
|
|
1020
1050
|
return this.request("GET", "/v1/graph/read-snapshot");
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export { LbbCapabilityError, LbbClient, LbbError, parseSparqlResults, } from "./client.js";
|
|
2
2
|
export type { DurableImportLine, DurableImportSource, LbbClientOptions, CallOptions, RequestOptions, LbbRequestEvent, LbbResponseEvent, FetchLike, ReadConsistencyOptions, SearchConsistency, Schemas, SparqlResults, SparqlResultsJson, SparqlTerm, CommitRequest, CommitResponse, Entity, EntitySelector, GraphMetadata, GraphSummary, SchemaView, Snapshot, } from "./client.js";
|
|
3
3
|
export type { components, paths, operations } from "./schema.js";
|
|
4
|
+
export { workflow, WorkflowWorker, WorkflowHandle, WorkflowNamespace, WorkflowError, } from "./workflows.js";
|
|
5
|
+
export type { WorkflowContext, WorkflowStepOptions, WorkflowStepContext, WorkflowSignalResult, WorkflowDefinition, WorkflowResult, } from "./workflows.js";
|
package/dist/index.js
CHANGED
package/dist/namespaces.d.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
|
+
import type { WorkflowNamespace } from "./workflows.js";
|
|
1
2
|
import type { LbbClient } from "./client.js";
|
|
2
3
|
import type { CallOptions } from "./transport.js";
|
|
3
4
|
import { type EntityAttributeFilterOptions, type ImportLine, type ReadConsistencyOptions, type RdfImportDocument, type RdfImportManyResult, type RdfImportOptions, type Schemas } from "./types.js";
|
|
5
|
+
/** Ask the server to return its measurements for one query. */
|
|
6
|
+
export interface ProfileOption {
|
|
7
|
+
/** Same as `profile: true` in the request body. */
|
|
8
|
+
profile?: boolean;
|
|
9
|
+
}
|
|
4
10
|
export declare class GraphNamespace {
|
|
5
11
|
private readonly client;
|
|
6
12
|
readonly facts: FactsNamespace;
|
|
@@ -11,9 +17,20 @@ export declare class GraphNamespace {
|
|
|
11
17
|
readonly search: SearchNamespace;
|
|
12
18
|
readonly evals: EvalsNamespace;
|
|
13
19
|
readonly embeddings: EmbeddingsNamespace;
|
|
20
|
+
readonly workflows: WorkflowNamespace;
|
|
14
21
|
constructor(client: LbbClient);
|
|
15
22
|
/** Publication lifecycle for this graph, including pre-first-publish state. */
|
|
16
23
|
publicationStatus(): Promise<Schemas["PublicationStatusResponse"]>;
|
|
24
|
+
/** Background work on this graph. See {@link LbbClient.activity}. */
|
|
25
|
+
activity(): Promise<Schemas["GraphActivityResponse"]>;
|
|
26
|
+
/**
|
|
27
|
+
* The SPARQL planner's statistics for the published generation latest reads
|
|
28
|
+
* use. See {@link LbbClient.plannerStats}.
|
|
29
|
+
*/
|
|
30
|
+
plannerStats(opts?: {
|
|
31
|
+
cursor?: string;
|
|
32
|
+
limit?: number;
|
|
33
|
+
}): Promise<Schemas["PlannerStatsResponse"]>;
|
|
17
34
|
/** Wait until this graph has an exact generation covering `targetSeq`. */
|
|
18
35
|
waitForPublished(targetSeq: number, opts?: {
|
|
19
36
|
timeoutMs?: number;
|
|
@@ -163,14 +180,67 @@ export declare class SchemaNamespace {
|
|
|
163
180
|
dryRun?: boolean;
|
|
164
181
|
}): Promise<Schemas["SchemaPublishResponse"]>;
|
|
165
182
|
}
|
|
183
|
+
/** Filters for {@link OntologySuggestionsNamespace.list}. */
|
|
184
|
+
export interface OntologySuggestionListOptions extends CallOptions {
|
|
185
|
+
status?: Schemas["OntologyChangeSuggestionStatus"];
|
|
186
|
+
originKind?: Schemas["SuggestionOriginKind"];
|
|
187
|
+
/** Producer id, for example an integration connection id. */
|
|
188
|
+
originId?: string;
|
|
189
|
+
/** Class, property or relation name. */
|
|
190
|
+
anchor?: string;
|
|
191
|
+
key?: string;
|
|
192
|
+
/** Default 100, maximum 500. */
|
|
193
|
+
limit?: number;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Ontology change suggestions: durable proposals from integrations,
|
|
197
|
+
* agents and people. People accept or dismiss them; accepting
|
|
198
|
+
* applies the change to the current ontology.
|
|
199
|
+
*/
|
|
200
|
+
export declare class OntologySuggestionsNamespace {
|
|
201
|
+
private readonly client;
|
|
202
|
+
constructor(client: LbbClient);
|
|
203
|
+
/** Newest update first, with counts per status over the whole graph. */
|
|
204
|
+
list(options?: OntologySuggestionListOptions): Promise<Schemas["OntologyChangeSuggestionList"]>;
|
|
205
|
+
/** One suggestion with its evidence, impact and discussion. */
|
|
206
|
+
get(suggestionId: string, opts?: CallOptions): Promise<Schemas["OntologyChangeSuggestion"]>;
|
|
207
|
+
/**
|
|
208
|
+
* File a suggestion, or update the one with the same `key`. The server
|
|
209
|
+
* dry-runs the change and never changes the ontology here, so a retry is
|
|
210
|
+
* safe.
|
|
211
|
+
*/
|
|
212
|
+
create(body: Schemas["OntologyChangeSuggestionCreateRequest"], opts?: CallOptions): Promise<Schemas["OntologyChangeSuggestion"]>;
|
|
213
|
+
/** Dry-run the change against the current ontology and store the impact. */
|
|
214
|
+
validate(suggestionId: string, opts?: CallOptions): Promise<Schemas["OntologyChangeSuggestion"]>;
|
|
215
|
+
/**
|
|
216
|
+
* Apply the change to the current ontology. Pass `change` to accept an
|
|
217
|
+
* edited change. Accepting twice returns the accepted suggestion.
|
|
218
|
+
*/
|
|
219
|
+
accept(suggestionId: string, body?: Schemas["OntologyChangeSuggestionAcceptRequest"], opts?: CallOptions): Promise<Schemas["OntologyChangeSuggestion"]>;
|
|
220
|
+
/** Decline with a reason. The ontology does not change. */
|
|
221
|
+
dismiss(suggestionId: string, body: Schemas["OntologyChangeSuggestionDecisionRequest"], opts?: CallOptions): Promise<Schemas["OntologyChangeSuggestion"]>;
|
|
222
|
+
/** Withdraw as the producer, for example when the source field is gone. */
|
|
223
|
+
supersede(suggestionId: string, body: Schemas["OntologyChangeSuggestionDecisionRequest"], opts?: CallOptions): Promise<Schemas["OntologyChangeSuggestion"]>;
|
|
224
|
+
/** Add a comment to the discussion. */
|
|
225
|
+
comment(suggestionId: string, body: Schemas["OntologyChangeSuggestionCommentRequest"], opts?: CallOptions): Promise<Schemas["OntologyChangeSuggestion"]>;
|
|
226
|
+
}
|
|
166
227
|
/** Ontology discovery and lifecycle operations. */
|
|
167
228
|
export declare class OntologyNamespace {
|
|
168
229
|
private readonly client;
|
|
230
|
+
/** Reviewable change suggestions from every producer. */
|
|
231
|
+
readonly suggestions: OntologySuggestionsNamespace;
|
|
169
232
|
constructor(client: LbbClient);
|
|
170
233
|
view(options?: {
|
|
171
234
|
counts?: boolean;
|
|
172
235
|
} & CallOptions): Promise<Schemas["OntologyView"]>;
|
|
173
|
-
|
|
236
|
+
/**
|
|
237
|
+
* Read the published SHACL conformance report. `limit` bounds the returned
|
|
238
|
+
* `results` (server default 200, maximum 2,000); `result_count` and
|
|
239
|
+
* `conforms` stay exact, and `truncated` says the window is partial.
|
|
240
|
+
*/
|
|
241
|
+
conformance(opts?: CallOptions & Pick<ReadConsistencyOptions, "consistency"> & {
|
|
242
|
+
limit?: number;
|
|
243
|
+
}): Promise<Schemas["SchemaAuditReport"]>;
|
|
174
244
|
search(body: Schemas["OntologySearchRequest"], opts?: CallOptions): Promise<Schemas["OntologySearchResponse"]>;
|
|
175
245
|
resolve(body: Schemas["OntologyResolveRequest"], opts?: CallOptions): Promise<Schemas["OntologyResolveResponse"]>;
|
|
176
246
|
/**
|
|
@@ -181,13 +251,18 @@ export declare class OntologyNamespace {
|
|
|
181
251
|
evolve(body: Schemas["OntologyEvolveRequest"], opts?: CallOptions & {
|
|
182
252
|
dryRun?: boolean;
|
|
183
253
|
}): Promise<Schemas["OntologyEvolveResponse"]>;
|
|
184
|
-
induce(body: Schemas["OntologyInduceRequest"], opts?: CallOptions): Promise<Schemas["OntologyInduceResponse"]>;
|
|
185
254
|
}
|
|
186
255
|
/** Structured and SPARQL-text query operations. */
|
|
187
256
|
export declare class QueryNamespace {
|
|
188
257
|
private readonly client;
|
|
189
258
|
constructor(client: LbbClient);
|
|
190
259
|
structured(body: Schemas["SparqlSelectRequest"], opts?: CallOptions & ReadConsistencyOptions): Promise<Schemas["SparqlSelectResponse"]>;
|
|
191
|
-
|
|
192
|
-
|
|
260
|
+
/**
|
|
261
|
+
* Run a SPARQL text query and parse its rows. `profile: true` (in `opts` or
|
|
262
|
+
* the body) returns the server's measurements in `profile`; a profiled
|
|
263
|
+
* request never uses the result cache.
|
|
264
|
+
*/
|
|
265
|
+
sparql(body: Schemas["SparqlTextRequest"], opts?: CallOptions & ReadConsistencyOptions & ProfileOption): Promise<import("./types.js").SparqlResults>;
|
|
266
|
+
/** As {@link sparql}, returning the raw response with its `results` string. */
|
|
267
|
+
sparqlRaw(body: Schemas["SparqlTextRequest"], opts?: CallOptions & ReadConsistencyOptions & ProfileOption): Promise<Schemas["SparqlTextResponse"]>;
|
|
193
268
|
}
|
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);
|
|
@@ -371,11 +387,105 @@ export class SchemaNamespace {
|
|
|
371
387
|
});
|
|
372
388
|
}
|
|
373
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
|
+
}
|
|
374
481
|
/** Ontology discovery and lifecycle operations. */
|
|
375
482
|
export class OntologyNamespace {
|
|
376
483
|
client;
|
|
484
|
+
/** Reviewable change suggestions from every producer. */
|
|
485
|
+
suggestions;
|
|
377
486
|
constructor(client) {
|
|
378
487
|
this.client = client;
|
|
488
|
+
this.suggestions = new OntologySuggestionsNamespace(client);
|
|
379
489
|
}
|
|
380
490
|
view(options = {}) {
|
|
381
491
|
const { counts, ...request } = options;
|
|
@@ -384,11 +494,18 @@ export class OntologyNamespace {
|
|
|
384
494
|
query: counts ? { counts: true } : undefined,
|
|
385
495
|
});
|
|
386
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
|
+
*/
|
|
387
502
|
conformance(opts = {}) {
|
|
503
|
+
const { limit, ...rest } = opts;
|
|
388
504
|
return this.client.request("GET", "/v1/ontology/conformance", {
|
|
389
|
-
...
|
|
505
|
+
...rest,
|
|
390
506
|
query: {
|
|
391
507
|
consistency: opts.consistency ?? this.client.defaultConsistency,
|
|
508
|
+
...(limit !== undefined ? { limit } : {}),
|
|
392
509
|
},
|
|
393
510
|
});
|
|
394
511
|
}
|
|
@@ -423,13 +540,6 @@ export class OntologyNamespace {
|
|
|
423
540
|
body,
|
|
424
541
|
});
|
|
425
542
|
}
|
|
426
|
-
induce(body, opts = {}) {
|
|
427
|
-
return this.client.request("POST", "/v1/ontology/induce", {
|
|
428
|
-
...opts,
|
|
429
|
-
retry: opts.retry ?? true,
|
|
430
|
-
body,
|
|
431
|
-
});
|
|
432
|
-
}
|
|
433
543
|
}
|
|
434
544
|
/** Structured and SPARQL-text query operations. */
|
|
435
545
|
export class QueryNamespace {
|
|
@@ -441,15 +551,20 @@ export class QueryNamespace {
|
|
|
441
551
|
return this.client.request("POST", "/v1/query/sparql", {
|
|
442
552
|
...opts,
|
|
443
553
|
retry: opts.retry ?? true,
|
|
444
|
-
body: withReadConsistency(this.client, body, opts),
|
|
554
|
+
body: profileBody(withReadConsistency(this.client, body, opts)),
|
|
445
555
|
});
|
|
446
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
|
+
*/
|
|
447
562
|
async sparql(body, opts = {}) {
|
|
448
563
|
// The text dialect carries consistency/floor on the URL, not the body.
|
|
449
564
|
const response = await this.client.request("POST", "/v1/query/sparql-text", {
|
|
450
565
|
...opts,
|
|
451
566
|
retry: opts.retry ?? true,
|
|
452
|
-
body,
|
|
567
|
+
body: withProfile(body, opts),
|
|
453
568
|
query: {
|
|
454
569
|
consistency: opts.consistency ?? this.client.defaultConsistency,
|
|
455
570
|
min_indexed_seq: opts.minIndexedSeq,
|
|
@@ -457,11 +572,12 @@ export class QueryNamespace {
|
|
|
457
572
|
});
|
|
458
573
|
return parseSparqlResults(response);
|
|
459
574
|
}
|
|
575
|
+
/** As {@link sparql}, returning the raw response with its `results` string. */
|
|
460
576
|
sparqlRaw(body, opts = {}) {
|
|
461
577
|
return this.client.request("POST", "/v1/query/sparql-text", {
|
|
462
578
|
...opts,
|
|
463
579
|
retry: opts.retry ?? true,
|
|
464
|
-
body,
|
|
580
|
+
body: withProfile(body, opts),
|
|
465
581
|
query: {
|
|
466
582
|
consistency: opts.consistency ?? this.client.defaultConsistency,
|
|
467
583
|
min_indexed_seq: opts.minIndexedSeq,
|