@littlebigbrain/client 0.12.0 → 0.13.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 +12 -10
- package/dist/client.d.ts +25 -24
- package/dist/client.js +69 -62
- package/dist/namespaces.d.ts +17 -8
- package/dist/namespaces.js +14 -0
- package/dist/schema.d.ts +542 -45
- package/dist/types.d.ts +13 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -68,19 +68,19 @@ const accepted = await lbb.submitImport(records(), {
|
|
|
68
68
|
});
|
|
69
69
|
const completed = await lbb.waitForImportJob(accepted.job_id);
|
|
70
70
|
console.log(completed.state, completed.committed_commit_seq);
|
|
71
|
-
if (completed.committed_commit_seq != null) {
|
|
72
|
-
await lbb.waitForIndexLineage(completed.committed_commit_seq);
|
|
73
|
-
}
|
|
74
71
|
```
|
|
75
72
|
|
|
76
73
|
`records()` may be an iterable or async iterable. Success means every grouped
|
|
77
|
-
commit is durable and
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
`index_caught_up=false` metadata until its own deadline, including on an
|
|
81
|
-
RDF-only deployment. An empty iterable is rejected locally before an import
|
|
74
|
+
commit is durable and immediately queryable by a strong SPARQL read. The same
|
|
75
|
+
commits advance the graph's coalesced RDF reconciliation fence; waiting for base
|
|
76
|
+
compaction is optional. An empty iterable is rejected locally before an import
|
|
82
77
|
POST is sent.
|
|
83
78
|
|
|
79
|
+
For several RDF documents, `facts.importRdfMany(...)` automatically defers
|
|
80
|
+
intermediate reconciliation and triggers it on the last document. Call
|
|
81
|
+
`graph.waitForPublished(result.finalSequence)` only when the caller needs the
|
|
82
|
+
immutable base itself to cover the import; strong reads need no waiter.
|
|
83
|
+
|
|
84
84
|
**Time-travel read.** Pin a SPARQL read to a past instant — results reflect the graph as it was then:
|
|
85
85
|
|
|
86
86
|
```ts
|
|
@@ -101,8 +101,10 @@ const { rows } = await lbb.sparqlRows({
|
|
|
101
101
|
## Errors & retries
|
|
102
102
|
|
|
103
103
|
Methods return parsed JSON and throw `LbbError` (with `status`, `code`, `message`, `param`, `requestId`, `docUrl`) on any non-2xx response. Safe reads and idempotency-keyed writes retry `429`/`5xx` and network failures with full-jitter backoff, bounded by a retry budget (`retryBudgetMs`, default 60s) rather than a fixed count, and honor `Retry-After` — a terminal error the server marks non-retryable surfaces immediately. Use `rawRequest()` for response headers, request id, and retry/timing metadata.
|
|
104
|
-
`
|
|
105
|
-
|
|
104
|
+
`waitForPublished(...)` is an optional, deadline-bounded maintenance poller for
|
|
105
|
+
workflows that want the immutable RDF base itself to cover a commit. Strong
|
|
106
|
+
SPARQL does not need it: acknowledged commits are queryable immediately from
|
|
107
|
+
the branch head's base-plus-delta lineage.
|
|
106
108
|
|
|
107
109
|
## More
|
|
108
110
|
|
package/dist/client.d.ts
CHANGED
|
@@ -1,20 +1,11 @@
|
|
|
1
|
-
import type { DurableImportSource, ImportLine, LbbClientOptions, ListResponse, RawLbbResponse, ReadConsistencyOptions, RdfImportOptions, Schemas, SearchConsistency, SparqlResults } from "./types.js";
|
|
1
|
+
import type { DurableImportSource, ImportLine, LbbClientOptions, ListResponse, RawLbbResponse, ReadConsistencyOptions, RdfImportDocument, RdfImportManyResult, RdfImportOptions, Schemas, SearchConsistency, SparqlResults } from "./types.js";
|
|
2
2
|
import { type CallOptions, type RequestOptions } from "./transport.js";
|
|
3
3
|
import { EntityNamespace, GraphNamespace, OntologyNamespace, QueryNamespace, SchemaNamespace, SearchNamespace } from "./namespaces.js";
|
|
4
4
|
export { parseSparqlResults } from "./types.js";
|
|
5
|
-
export type { AttributeFilter, AttributeFilterOp, AttributeFilterValue, EntityAttributeFilterOptions, EntityPropertiesLine, DurableImportLine, DurableImportSource, FetchLike, FlatProperties, ImportLine, LbbClientOptions, LbbRequestEvent, LbbResponseEvent, LbbRetryEvent, LbbErrorPayload, ListResponse, RawLbbResponse, ReadConsistencyOptions, RdfImportOptions, Schemas, SearchConsistency, SparqlResults, SparqlResultsJson, SparqlTerm, CommitRequest, CommitResponse, Entity, EntitySelector, GraphMetadata, GraphSummary, SchemaView, Snapshot, } from "./types.js";
|
|
5
|
+
export type { AttributeFilter, AttributeFilterOp, AttributeFilterValue, EntityAttributeFilterOptions, EntityPropertiesLine, DurableImportLine, DurableImportSource, FetchLike, FlatProperties, ImportLine, LbbClientOptions, LbbRequestEvent, LbbResponseEvent, LbbRetryEvent, LbbErrorPayload, ListResponse, RawLbbResponse, ReadConsistencyOptions, RdfImportDocument, RdfImportManyResult, RdfImportOptions, Schemas, SearchConsistency, SparqlResults, SparqlResultsJson, SparqlTerm, CommitRequest, CommitResponse, Entity, EntitySelector, GraphMetadata, GraphSummary, SchemaView, Snapshot, } from "./types.js";
|
|
6
6
|
export { LbbCapabilityError, LbbError } from "./transport.js";
|
|
7
7
|
export type { CallOptions, Query, QueryValue, RequestOptions, } from "./transport.js";
|
|
8
8
|
export { EntityNamespace, FactsNamespace, GraphNamespace, OntologyNamespace, QueryNamespace, SchemaNamespace, SearchNamespace, } from "./namespaces.js";
|
|
9
|
-
export interface IndexLineageObservation {
|
|
10
|
-
metadata: Schemas["GraphMetadataResponse"];
|
|
11
|
-
lineage: Schemas["IndexLineage"];
|
|
12
|
-
buildCommit?: string;
|
|
13
|
-
replica?: string;
|
|
14
|
-
requestId?: string;
|
|
15
|
-
attempts: number;
|
|
16
|
-
elapsedMs: number;
|
|
17
|
-
}
|
|
18
9
|
/**
|
|
19
10
|
* A typed HTTP client for a little big brain graph server. One instance is scoped to a
|
|
20
11
|
* single graph/branch; construct another for a different scope. All methods
|
|
@@ -137,6 +128,8 @@ export declare class LbbClient {
|
|
|
137
128
|
* properties on the subject Resource.
|
|
138
129
|
*/
|
|
139
130
|
importRdf(rdf: string, opts?: RdfImportOptions): Promise<Schemas["GraphRdfImportResponse"]>;
|
|
131
|
+
/** Import several RDF documents as truth-only chunks, then advance one final publication fence. */
|
|
132
|
+
importRdfMany(documents: readonly RdfImportDocument[], opts?: RdfImportOptions): Promise<RdfImportManyResult>;
|
|
140
133
|
/**
|
|
141
134
|
* Retract specific edges and/or every edge touching given entities. Appends
|
|
142
135
|
* superseding retract events rather than deleting — history stays visible in an
|
|
@@ -368,14 +361,18 @@ export declare class LbbClient {
|
|
|
368
361
|
asOf?: string;
|
|
369
362
|
}): Promise<Schemas["EntityMetadataResponse"]>;
|
|
370
363
|
/**
|
|
371
|
-
*
|
|
372
|
-
*
|
|
373
|
-
*
|
|
364
|
+
* Read projected attributes and current relationships from one RDF snapshot.
|
|
365
|
+
* Inspect `unavailable_sections` before interpreting legacy provenance arrays.
|
|
366
|
+
* Use strong consistency for read-after-write, or a retained commit sequence.
|
|
374
367
|
*/
|
|
375
368
|
entityDetail(opts: {
|
|
376
369
|
id?: string;
|
|
377
370
|
type?: string;
|
|
378
371
|
name?: string;
|
|
372
|
+
key?: string;
|
|
373
|
+
consistency?: "strong" | "eventual";
|
|
374
|
+
edges?: number;
|
|
375
|
+
/** @deprecated Valid-time reads are unsupported; use asOfCommitSeq. */
|
|
379
376
|
asOf?: string;
|
|
380
377
|
asOfCommitSeq?: number;
|
|
381
378
|
}): Promise<Schemas["EntityDetailResponse"]>;
|
|
@@ -405,7 +402,7 @@ export declare class LbbClient {
|
|
|
405
402
|
* `groups[].keys`.
|
|
406
403
|
*/
|
|
407
404
|
sparql(body: Schemas["SparqlSelectRequest"], opts?: ReadConsistencyOptions): Promise<Schemas["SparqlSelectResponse"]>;
|
|
408
|
-
/** SPARQL 1.1 query from text (SELECT/ASK) over the live graph; `results` is SPARQL 1.1 Query Results JSON. The text dialect carries `consistency`/`min_indexed_seq` on the URL. */
|
|
405
|
+
/** SPARQL 1.1 query from text (SELECT/ASK) over the live graph; `results` is SPARQL 1.1 Query Results JSON. The text dialect carries `consistency`/`min_indexed_seq` on the URL; a floor with no explicit consistency implies a strong base-plus-delta read. */
|
|
409
406
|
sparqlText(body: Schemas["SparqlTextRequest"], opts?: ReadConsistencyOptions): Promise<Schemas["SparqlTextResponse"]>;
|
|
410
407
|
/**
|
|
411
408
|
* Run a SPARQL 1.1 text query and return parsed results — the ergonomic
|
|
@@ -468,21 +465,25 @@ export declare class LbbClient {
|
|
|
468
465
|
metadata(opts?: {
|
|
469
466
|
includeIndexes?: boolean;
|
|
470
467
|
}): Promise<Schemas["GraphMetadataResponse"]>;
|
|
471
|
-
/**
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
* deployment; `metadata.index_caught_up` is the generation-level readiness
|
|
476
|
-
* signal used by bulk loaders.
|
|
477
|
-
*/
|
|
478
|
-
waitForIndexLineage(targetSeq: number, opts?: {
|
|
468
|
+
/** Automatic publication lifecycle, available before the first generation exists. */
|
|
469
|
+
publicationStatus(): Promise<Schemas["PublicationStatusResponse"]>;
|
|
470
|
+
/** Wait until background reconciliation folds `targetSeq` into the RDF base. */
|
|
471
|
+
waitForPublished(targetSeq: number, opts?: {
|
|
479
472
|
timeoutMs?: number;
|
|
480
473
|
pollIntervalMs?: number;
|
|
481
|
-
}): Promise<
|
|
474
|
+
}): Promise<Schemas["PublicationStatusResponse"]>;
|
|
482
475
|
/** Graph counts and type/relation buckets. Carries `consistency`/`min_indexed_seq` on the URL. */
|
|
483
476
|
summary(opts?: ReadConsistencyOptions): Promise<Schemas["GraphSummaryResponse"]>;
|
|
484
477
|
/** Pinned published read root and its query/conformance lag against one coherent head. */
|
|
485
478
|
readSnapshot(): Promise<Schemas["PublishedReadStatusResponse"]>;
|
|
479
|
+
/**
|
|
480
|
+
* Compact observed RDF schema attached to the immutable published base:
|
|
481
|
+
* class populations, resource- and literal-valued predicate counts, and
|
|
482
|
+
* bounded OWL/RDFS statements. `literal_predicate_counts` is `null` when
|
|
483
|
+
* the stored summary artifact predates the field; the next full summary
|
|
484
|
+
* rebuild fills it.
|
|
485
|
+
*/
|
|
486
|
+
schemaSummary(): Promise<Schemas["RdfSchemaSummaryResponse"]>;
|
|
486
487
|
/** List the graphs (and branches) under the scoped tenant. */
|
|
487
488
|
listGraphs(): Promise<Schemas["GraphListResponse"]>;
|
|
488
489
|
}
|
package/dist/client.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { parseSparqlResults } from "./types.js";
|
|
2
2
|
import { bodyMarksTerminal, errorCodeFromBody, fullJitterBackoffMs, parseLbbError, parseResponseJson, retryAllowed, retryableStatus, retryDelayMs, sleep, } from "./transport.js";
|
|
3
|
-
import { LbbCapabilityError
|
|
3
|
+
import { LbbCapabilityError } from "./transport.js";
|
|
4
4
|
import { EntityNamespace, GraphNamespace, OntologyNamespace, QueryNamespace, SchemaNamespace, SearchNamespace, } from "./namespaces.js";
|
|
5
5
|
export { parseSparqlResults } from "./types.js";
|
|
6
6
|
export { LbbCapabilityError, LbbError } from "./transport.js";
|
|
@@ -563,6 +563,30 @@ export class LbbClient {
|
|
|
563
563
|
idempotencyKey: opts.idempotencyKey ?? this.idempotencyKey("import-rdf"),
|
|
564
564
|
});
|
|
565
565
|
}
|
|
566
|
+
/** Import several RDF documents as truth-only chunks, then advance one final publication fence. */
|
|
567
|
+
async importRdfMany(documents, opts = {}) {
|
|
568
|
+
if (documents.length === 0) {
|
|
569
|
+
throw new RangeError("importRdfMany requires at least one document");
|
|
570
|
+
}
|
|
571
|
+
const imports = [];
|
|
572
|
+
for (const [index, document] of documents.entries()) {
|
|
573
|
+
const merged = { ...opts, ...document.options };
|
|
574
|
+
const idempotencyKey = merged.idempotencyKey
|
|
575
|
+
? `${merged.idempotencyKey}:${index + 1}`
|
|
576
|
+
: undefined;
|
|
577
|
+
imports.push(await this.importRdf(document.rdf, {
|
|
578
|
+
...merged,
|
|
579
|
+
idempotencyKey,
|
|
580
|
+
build: index === documents.length - 1,
|
|
581
|
+
}));
|
|
582
|
+
}
|
|
583
|
+
const final = imports[imports.length - 1];
|
|
584
|
+
return {
|
|
585
|
+
imports,
|
|
586
|
+
finalSequence: final?.committed_commit_seq ?? undefined,
|
|
587
|
+
publication: final?.published_generation,
|
|
588
|
+
};
|
|
589
|
+
}
|
|
566
590
|
/**
|
|
567
591
|
* Retract specific edges and/or every edge touching given entities. Appends
|
|
568
592
|
* superseding retract events rather than deleting — history stays visible in an
|
|
@@ -876,9 +900,9 @@ export class LbbClient {
|
|
|
876
900
|
});
|
|
877
901
|
}
|
|
878
902
|
/**
|
|
879
|
-
*
|
|
880
|
-
*
|
|
881
|
-
*
|
|
903
|
+
* Read projected attributes and current relationships from one RDF snapshot.
|
|
904
|
+
* Inspect `unavailable_sections` before interpreting legacy provenance arrays.
|
|
905
|
+
* Use strong consistency for read-after-write, or a retained commit sequence.
|
|
882
906
|
*/
|
|
883
907
|
entityDetail(opts) {
|
|
884
908
|
return this.request("GET", "/v1/graph/entity", {
|
|
@@ -886,6 +910,9 @@ export class LbbClient {
|
|
|
886
910
|
id: opts.id,
|
|
887
911
|
type: opts.type,
|
|
888
912
|
name: opts.name,
|
|
913
|
+
key: opts.key,
|
|
914
|
+
consistency: opts.consistency,
|
|
915
|
+
edges: opts.edges,
|
|
889
916
|
as_of: opts.asOf,
|
|
890
917
|
as_of_commit_seq: opts.asOfCommitSeq,
|
|
891
918
|
},
|
|
@@ -940,7 +967,7 @@ export class LbbClient {
|
|
|
940
967
|
body: this.mergeReadConsistency(body, opts),
|
|
941
968
|
});
|
|
942
969
|
}
|
|
943
|
-
/** SPARQL 1.1 query from text (SELECT/ASK) over the live graph; `results` is SPARQL 1.1 Query Results JSON. The text dialect carries `consistency`/`min_indexed_seq` on the URL. */
|
|
970
|
+
/** SPARQL 1.1 query from text (SELECT/ASK) over the live graph; `results` is SPARQL 1.1 Query Results JSON. The text dialect carries `consistency`/`min_indexed_seq` on the URL; a floor with no explicit consistency implies a strong base-plus-delta read. */
|
|
944
971
|
sparqlText(body, opts) {
|
|
945
972
|
return this.request("POST", "/v1/query/sparql-text", {
|
|
946
973
|
body,
|
|
@@ -1038,68 +1065,38 @@ export class LbbClient {
|
|
|
1038
1065
|
},
|
|
1039
1066
|
});
|
|
1040
1067
|
}
|
|
1041
|
-
/**
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1068
|
+
/** Automatic publication lifecycle, available before the first generation exists. */
|
|
1069
|
+
publicationStatus() {
|
|
1070
|
+
return this.request("GET", "/v1/graph/publication-status");
|
|
1071
|
+
}
|
|
1072
|
+
/** Wait until background reconciliation folds `targetSeq` into the RDF base. */
|
|
1073
|
+
async waitForPublished(targetSeq, opts = {}) {
|
|
1074
|
+
if (!Number.isSafeInteger(targetSeq) || targetSeq < 0) {
|
|
1075
|
+
throw new RangeError("targetSeq must be a non-negative safe integer");
|
|
1076
|
+
}
|
|
1077
|
+
const timeoutMs = opts.timeoutMs ?? 30_000;
|
|
1078
|
+
const pollIntervalMs = opts.pollIntervalMs ?? 250;
|
|
1079
|
+
if (!Number.isFinite(timeoutMs) || timeoutMs < 0) {
|
|
1080
|
+
throw new RangeError("timeoutMs must be a non-negative number");
|
|
1081
|
+
}
|
|
1082
|
+
if (!Number.isFinite(pollIntervalMs) || pollIntervalMs < 0) {
|
|
1083
|
+
throw new RangeError("pollIntervalMs must be a non-negative number");
|
|
1084
|
+
}
|
|
1085
|
+
const deadline = Date.now() + timeoutMs;
|
|
1050
1086
|
let last;
|
|
1051
1087
|
while (true) {
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
// legitimately take longer than that secondary cap.
|
|
1056
|
-
last = await this.rawRequest("GET", "/v1/graph/metadata", {
|
|
1057
|
-
maxRetries: 0,
|
|
1058
|
-
});
|
|
1088
|
+
last = await this.publicationStatus();
|
|
1089
|
+
if (last.state === "blocked") {
|
|
1090
|
+
throw new Error(`publication blocked at ${last.current_stage ?? "unknown stage"}: ${last.retry.message}`);
|
|
1059
1091
|
}
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
retryableStatus(error.status) &&
|
|
1063
|
-
error.retryable !== false;
|
|
1064
|
-
const retryableTransportError = error instanceof Error && !(error instanceof LbbError);
|
|
1065
|
-
if (!retryableHttpError && !retryableTransportError)
|
|
1066
|
-
throw error;
|
|
1067
|
-
const now = Date.now();
|
|
1068
|
-
if (now >= deadline) {
|
|
1069
|
-
throw new Error(`index lineage did not reach ${targetSeq} before timeout (last_error=${error.message})`, { cause: error });
|
|
1070
|
-
}
|
|
1071
|
-
const retryAfterMs = error instanceof LbbError
|
|
1072
|
-
? (error.retryAfterSeconds ?? 0) * 1_000
|
|
1073
|
-
: 0;
|
|
1074
|
-
await sleep(Math.min(Math.max(opts.pollIntervalMs ?? 250, retryAfterMs), deadline - now));
|
|
1075
|
-
continue;
|
|
1076
|
-
}
|
|
1077
|
-
const lineage = last.data.index_lineage;
|
|
1078
|
-
const servedAt = last.data.snapshot.served_at_seq;
|
|
1079
|
-
if (lineage != null &&
|
|
1080
|
-
servedAt != null &&
|
|
1081
|
-
servedAt >= targetSeq &&
|
|
1082
|
-
(last.data.index_caught_up === true ||
|
|
1083
|
-
(lineage.bm25_indexed_commit_seq != null &&
|
|
1084
|
-
lineage.bm25_indexed_commit_seq >= targetSeq &&
|
|
1085
|
-
lineage.ann_indexed_commit_seq != null &&
|
|
1086
|
-
lineage.ann_indexed_commit_seq >= targetSeq))) {
|
|
1087
|
-
return {
|
|
1088
|
-
metadata: last.data,
|
|
1089
|
-
lineage,
|
|
1090
|
-
buildCommit: last.headers?.get("lbb-build-commit") ?? undefined,
|
|
1091
|
-
replica: last.headers?.get("lbb-replica") ?? undefined,
|
|
1092
|
-
requestId: last.requestId,
|
|
1093
|
-
attempts: last.attempts,
|
|
1094
|
-
elapsedMs: last.elapsedMs,
|
|
1095
|
-
};
|
|
1092
|
+
if (last.state === "current" && last.published_seq >= targetSeq) {
|
|
1093
|
+
return last;
|
|
1096
1094
|
}
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
throw new Error(`index lineage did not reach ${targetSeq} before timeout (build=${build}, replica=${replica}, last=${JSON.stringify(last.data.index_lineage)})`);
|
|
1095
|
+
const now = Date.now();
|
|
1096
|
+
if (now >= deadline) {
|
|
1097
|
+
throw new Error(`publication did not reach ${targetSeq} before timeout (state=${last.state}, head=${last.head_seq}, target=${last.target_seq}, published=${last.published_seq}, stage=${last.current_stage ?? "unknown"})`);
|
|
1101
1098
|
}
|
|
1102
|
-
await sleep(
|
|
1099
|
+
await sleep(Math.min(Math.max(pollIntervalMs, last.retry.retry_after_ms), deadline - now));
|
|
1103
1100
|
}
|
|
1104
1101
|
}
|
|
1105
1102
|
/** Graph counts and type/relation buckets. Carries `consistency`/`min_indexed_seq` on the URL. */
|
|
@@ -1112,6 +1109,16 @@ export class LbbClient {
|
|
|
1112
1109
|
readSnapshot() {
|
|
1113
1110
|
return this.request("GET", "/v1/graph/read-snapshot");
|
|
1114
1111
|
}
|
|
1112
|
+
/**
|
|
1113
|
+
* Compact observed RDF schema attached to the immutable published base:
|
|
1114
|
+
* class populations, resource- and literal-valued predicate counts, and
|
|
1115
|
+
* bounded OWL/RDFS statements. `literal_predicate_counts` is `null` when
|
|
1116
|
+
* the stored summary artifact predates the field; the next full summary
|
|
1117
|
+
* rebuild fills it.
|
|
1118
|
+
*/
|
|
1119
|
+
schemaSummary() {
|
|
1120
|
+
return this.request("GET", "/v1/graph/schema-summary");
|
|
1121
|
+
}
|
|
1115
1122
|
/** List the graphs (and branches) under the scoped tenant. */
|
|
1116
1123
|
listGraphs() {
|
|
1117
1124
|
return this.request("GET", "/v1/graphs");
|
package/dist/namespaces.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { LbbClient } from "./client.js";
|
|
2
2
|
import type { CallOptions } from "./transport.js";
|
|
3
|
-
import { type EntityAttributeFilterOptions, type ImportLine, type ReadConsistencyOptions, type RdfImportOptions, type Schemas } from "./types.js";
|
|
3
|
+
import { type EntityAttributeFilterOptions, type ImportLine, type ReadConsistencyOptions, type RdfImportDocument, type RdfImportManyResult, type RdfImportOptions, type Schemas } from "./types.js";
|
|
4
4
|
export declare class GraphNamespace {
|
|
5
5
|
private readonly client;
|
|
6
6
|
readonly facts: FactsNamespace;
|
|
@@ -11,6 +11,13 @@ export declare class GraphNamespace {
|
|
|
11
11
|
readonly search: SearchNamespace;
|
|
12
12
|
constructor(client: LbbClient);
|
|
13
13
|
branch(name: string): GraphNamespace;
|
|
14
|
+
/** Publication lifecycle for this graph/branch, including pre-first-publish state. */
|
|
15
|
+
publicationStatus(): Promise<Schemas["PublicationStatusResponse"]>;
|
|
16
|
+
/** Wait until this graph/branch has an exact generation covering `targetSeq`. */
|
|
17
|
+
waitForPublished(targetSeq: number, opts?: {
|
|
18
|
+
timeoutMs?: number;
|
|
19
|
+
pollIntervalMs?: number;
|
|
20
|
+
}): Promise<Schemas["PublicationStatusResponse"]>;
|
|
14
21
|
create(opts?: CallOptions): Promise<Schemas["CreateGraphResponse"]>;
|
|
15
22
|
delete(opts: {
|
|
16
23
|
confirm: string;
|
|
@@ -39,6 +46,8 @@ export declare class FactsNamespace {
|
|
|
39
46
|
* predicates and literal term details are preserved as edge metadata.
|
|
40
47
|
*/
|
|
41
48
|
importRdf(rdf: string, opts?: CallOptions & RdfImportOptions): Promise<Schemas["GraphRdfImportResponse"]>;
|
|
49
|
+
/** Import several RDF documents and enqueue publication only for the final commit. */
|
|
50
|
+
importRdfMany(documents: readonly RdfImportDocument[], opts?: RdfImportOptions): Promise<RdfImportManyResult>;
|
|
42
51
|
}
|
|
43
52
|
/**
|
|
44
53
|
* Relevance-label storage. The query surfaces this namespace once fronted were
|
|
@@ -68,11 +77,7 @@ export declare class EntityNamespace {
|
|
|
68
77
|
name?: string;
|
|
69
78
|
asOf?: string;
|
|
70
79
|
}): Promise<Schemas["EntityMetadataResponse"]>;
|
|
71
|
-
detail(opts:
|
|
72
|
-
id?: string;
|
|
73
|
-
type?: string;
|
|
74
|
-
name?: string;
|
|
75
|
-
}): Promise<Schemas["EntityDetailResponse"]>;
|
|
80
|
+
detail(opts: Parameters<LbbClient["entityDetail"]>[0]): Promise<Schemas["EntityDetailResponse"]>;
|
|
76
81
|
/**
|
|
77
82
|
* Filter entities already bound by relation patterns using typed attributes,
|
|
78
83
|
* without writing RDF property IRIs by hand. This is a convenience wrapper over
|
|
@@ -88,7 +93,9 @@ export declare class SchemaNamespace {
|
|
|
88
93
|
/** Read active metadata without running request-time validation. */
|
|
89
94
|
view(opts?: CallOptions): Promise<Schemas["SchemaBundleView"]>;
|
|
90
95
|
/** Atomically publish a bundle; conformance is produced asynchronously. */
|
|
91
|
-
publish(body: Schemas["SchemaPublishRequest"], opts?: CallOptions
|
|
96
|
+
publish(body: Schemas["SchemaPublishRequest"], opts?: CallOptions & {
|
|
97
|
+
dryRun?: boolean;
|
|
98
|
+
}): Promise<Schemas["SchemaPublishResponse"]>;
|
|
92
99
|
}
|
|
93
100
|
/** Ontology discovery and lifecycle operations. */
|
|
94
101
|
export declare class OntologyNamespace {
|
|
@@ -105,7 +112,9 @@ export declare class OntologyNamespace {
|
|
|
105
112
|
* does not exist yet. Safe to repeat. See {@link LbbClient.ontologyDefine}.
|
|
106
113
|
*/
|
|
107
114
|
define(body: Schemas["OntologyDefineRequest"], opts?: CallOptions): Promise<Schemas["OntologyDefineResponse"]>;
|
|
108
|
-
evolve(body: Schemas["OntologyEvolveRequest"], opts?: CallOptions
|
|
115
|
+
evolve(body: Schemas["OntologyEvolveRequest"], opts?: CallOptions & {
|
|
116
|
+
dryRun?: boolean;
|
|
117
|
+
}): Promise<Schemas["OntologyEvolveResponse"]>;
|
|
109
118
|
induce(body: Schemas["OntologyInduceRequest"], opts?: CallOptions): Promise<Schemas["OntologyInduceResponse"]>;
|
|
110
119
|
}
|
|
111
120
|
/** Structured and SPARQL-text query operations. */
|
package/dist/namespaces.js
CHANGED
|
@@ -35,6 +35,14 @@ export class GraphNamespace {
|
|
|
35
35
|
branch(name) {
|
|
36
36
|
return new GraphNamespace(this.client.withScope({ branch: name }));
|
|
37
37
|
}
|
|
38
|
+
/** Publication lifecycle for this graph/branch, including pre-first-publish state. */
|
|
39
|
+
publicationStatus() {
|
|
40
|
+
return this.client.publicationStatus();
|
|
41
|
+
}
|
|
42
|
+
/** Wait until this graph/branch has an exact generation covering `targetSeq`. */
|
|
43
|
+
waitForPublished(targetSeq, opts = {}) {
|
|
44
|
+
return this.client.waitForPublished(targetSeq, opts);
|
|
45
|
+
}
|
|
38
46
|
create(opts = {}) {
|
|
39
47
|
return this.client.request("POST", "/v1/graph/create", opts);
|
|
40
48
|
}
|
|
@@ -120,6 +128,10 @@ export class FactsNamespace {
|
|
|
120
128
|
},
|
|
121
129
|
});
|
|
122
130
|
}
|
|
131
|
+
/** Import several RDF documents and enqueue publication only for the final commit. */
|
|
132
|
+
importRdfMany(documents, opts = {}) {
|
|
133
|
+
return this.client.importRdfMany(documents, opts);
|
|
134
|
+
}
|
|
123
135
|
}
|
|
124
136
|
/**
|
|
125
137
|
* Relevance-label storage. The query surfaces this namespace once fronted were
|
|
@@ -201,6 +213,7 @@ export class SchemaNamespace {
|
|
|
201
213
|
publish(body, opts = {}) {
|
|
202
214
|
return this.client.request("POST", "/v1/schema/publish", {
|
|
203
215
|
...opts,
|
|
216
|
+
query: { dry_run: opts.dryRun },
|
|
204
217
|
idempotencyKey: opts.idempotencyKey ?? this.client.idempotencyKey("schema-publish"),
|
|
205
218
|
body,
|
|
206
219
|
});
|
|
@@ -254,6 +267,7 @@ export class OntologyNamespace {
|
|
|
254
267
|
evolve(body, opts = {}) {
|
|
255
268
|
return this.client.request("POST", "/v1/ontology/evolve", {
|
|
256
269
|
...opts,
|
|
270
|
+
query: { dry_run: opts.dryRun },
|
|
257
271
|
body,
|
|
258
272
|
});
|
|
259
273
|
}
|