@littlebigbrain/client 0.8.1 → 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 +15 -0
- package/dist/client.d.ts +27 -3
- package/dist/client.js +162 -3
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/schema.d.ts +826 -107
- package/dist/transport.d.ts +9 -2
- package/dist/transport.js +9 -0
- package/dist/types.d.ts +4 -0
- package/package.json +1 -1
package/dist/transport.d.ts
CHANGED
|
@@ -17,10 +17,12 @@ export interface CallOptions {
|
|
|
17
17
|
export interface RequestOptions extends CallOptions {
|
|
18
18
|
query?: Query;
|
|
19
19
|
body?: unknown;
|
|
20
|
-
/** Pre-serialized request body (e.g. NDJSON). Takes precedence over `body`. */
|
|
21
|
-
rawBody?:
|
|
20
|
+
/** Pre-serialized or streaming request body (e.g. NDJSON). Takes precedence over `body`. */
|
|
21
|
+
rawBody?: unknown;
|
|
22
22
|
/** Overrides the default `application/json` content type (used with `rawBody`). */
|
|
23
23
|
contentType?: string;
|
|
24
|
+
/** Set for streaming request bodies so Node's fetch accepts them. */
|
|
25
|
+
duplex?: "half";
|
|
24
26
|
}
|
|
25
27
|
/** Thrown when the server responds with a non-2xx status. */
|
|
26
28
|
export declare class LbbError extends Error {
|
|
@@ -38,6 +40,11 @@ export declare class LbbError extends Error {
|
|
|
38
40
|
readonly endpointHint?: string;
|
|
39
41
|
constructor(status: number, body: string, error?: LbbErrorPayload | undefined);
|
|
40
42
|
}
|
|
43
|
+
/** Thrown before upload when a server does not advertise a required additive capability. */
|
|
44
|
+
export declare class LbbCapabilityError extends Error {
|
|
45
|
+
readonly capability: string;
|
|
46
|
+
constructor(capability: string);
|
|
47
|
+
}
|
|
41
48
|
export type QueryValue = string | number | boolean | undefined;
|
|
42
49
|
export type Query = Record<string, QueryValue>;
|
|
43
50
|
export declare function sleep(ms: number): Promise<void>;
|
package/dist/transport.js
CHANGED
|
@@ -28,6 +28,15 @@ export class LbbError extends Error {
|
|
|
28
28
|
this.endpointHint = endpointMigrationHint(this.code);
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
+
/** Thrown before upload when a server does not advertise a required additive capability. */
|
|
32
|
+
export class LbbCapabilityError extends Error {
|
|
33
|
+
capability;
|
|
34
|
+
constructor(capability) {
|
|
35
|
+
super(`Little Big Brain server does not advertise ${capability}; upgrade the server before using this SDK method`);
|
|
36
|
+
this.capability = capability;
|
|
37
|
+
this.name = "LbbCapabilityError";
|
|
38
|
+
}
|
|
39
|
+
}
|
|
31
40
|
function endpointMigrationHint(code) {
|
|
32
41
|
if (code === "stack_endpoint_required") {
|
|
33
42
|
return "Copy endpoint_url from the stack's Connect page and use it as baseUrl.";
|
package/dist/types.d.ts
CHANGED
|
@@ -40,6 +40,10 @@ export type EntityPropertiesLine = {
|
|
|
40
40
|
};
|
|
41
41
|
/** One bulk-import line: a triplet, or an entity-properties record. */
|
|
42
42
|
export type ImportLine = Schemas["TripletInput"] | EntityPropertiesLine;
|
|
43
|
+
/** One streamed durable-import item. Strings are treated as complete NDJSON lines. */
|
|
44
|
+
export type DurableImportLine = ImportLine | string | Uint8Array;
|
|
45
|
+
/** Sync or async source consumed one record/chunk at a time by `submitImport`. */
|
|
46
|
+
export type DurableImportSource = string | Iterable<DurableImportLine> | AsyncIterable<DurableImportLine>;
|
|
43
47
|
export interface RdfImportOptions {
|
|
44
48
|
format?: "ntriples" | "turtle" | "nquads" | "trig";
|
|
45
49
|
baseIri?: string;
|