@littlebigbrain/client 0.6.0 → 0.7.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/README.md +62 -73
- package/dist/client.d.ts +52 -7
- package/dist/client.js +70 -9
- package/dist/index.d.ts +1 -1
- package/dist/namespaces.d.ts +9 -0
- package/dist/namespaces.js +8 -0
- package/dist/schema.d.ts +734 -88
- package/dist/transport.d.ts +2 -0
- package/dist/transport.js +12 -0
- package/dist/types.d.ts +1 -77
- package/package.json +1 -1
package/dist/transport.d.ts
CHANGED
|
@@ -34,6 +34,8 @@ export declare class LbbError extends Error {
|
|
|
34
34
|
readonly docUrl?: string | null;
|
|
35
35
|
readonly retryable?: boolean;
|
|
36
36
|
readonly retryAfterSeconds?: number;
|
|
37
|
+
/** Actionable guidance for composite stack-endpoint routing errors. */
|
|
38
|
+
readonly endpointHint?: string;
|
|
37
39
|
constructor(status: number, body: string, error?: LbbErrorPayload | undefined);
|
|
38
40
|
}
|
|
39
41
|
export type QueryValue = string | number | boolean | undefined;
|
package/dist/transport.js
CHANGED
|
@@ -10,6 +10,8 @@ export class LbbError extends Error {
|
|
|
10
10
|
docUrl;
|
|
11
11
|
retryable;
|
|
12
12
|
retryAfterSeconds;
|
|
13
|
+
/** Actionable guidance for composite stack-endpoint routing errors. */
|
|
14
|
+
endpointHint;
|
|
13
15
|
constructor(status, body, error) {
|
|
14
16
|
super(error?.message ?? `Little Big Brain ${status}: ${body}`);
|
|
15
17
|
this.status = status;
|
|
@@ -23,8 +25,18 @@ export class LbbError extends Error {
|
|
|
23
25
|
this.docUrl = error?.doc_url;
|
|
24
26
|
this.retryable = error?.retryable;
|
|
25
27
|
this.retryAfterSeconds = error?.retry_after_seconds;
|
|
28
|
+
this.endpointHint = endpointMigrationHint(this.code);
|
|
26
29
|
}
|
|
27
30
|
}
|
|
31
|
+
function endpointMigrationHint(code) {
|
|
32
|
+
if (code === "stack_endpoint_required") {
|
|
33
|
+
return "Copy endpoint_url from the stack's Connect page and use it as baseUrl.";
|
|
34
|
+
}
|
|
35
|
+
if (code === "stack_endpoint_mismatch") {
|
|
36
|
+
return "Use the endpoint_url and API key from the same stack.";
|
|
37
|
+
}
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
28
40
|
export function sleep(ms) {
|
|
29
41
|
if (ms <= 0)
|
|
30
42
|
return Promise.resolve();
|
package/dist/types.d.ts
CHANGED
|
@@ -153,7 +153,7 @@ export declare function parseSparqlResults(response: Schemas["SparqlTextResponse
|
|
|
153
153
|
export declare function firstPatternVariable(patterns: Schemas["AnalyticTriplePattern"][]): string;
|
|
154
154
|
export declare function attributeFilter(filter: AttributeFilter, defaultVar: string): Schemas["SparqlFilter"];
|
|
155
155
|
export interface LbbClientOptions {
|
|
156
|
-
/**
|
|
156
|
+
/** Hosted stack endpoint, e.g. `https://7k3m9q2x--production.db.eu.littlebigbrain.com`. */
|
|
157
157
|
baseUrl: string;
|
|
158
158
|
/** Stack API key (`lbb_sk_test_…` / `lbb_sk_live_…`) or single-mode token. */
|
|
159
159
|
apiKey?: string;
|
|
@@ -223,82 +223,6 @@ export interface LbbRetryEvent {
|
|
|
223
223
|
/** Inclusive wall-clock elapsed (ms) across attempts and waits so far. */
|
|
224
224
|
elapsedMs: number;
|
|
225
225
|
}
|
|
226
|
-
export type LbbStackActivityWindow = "1h" | "4h" | "12h" | "24h";
|
|
227
|
-
export interface LbbStackActivityResponse {
|
|
228
|
-
ok: true;
|
|
229
|
-
stack: {
|
|
230
|
-
slug: string;
|
|
231
|
-
name?: string;
|
|
232
|
-
};
|
|
233
|
-
window: {
|
|
234
|
-
range: LbbStackActivityWindow;
|
|
235
|
-
from_micros: number;
|
|
236
|
-
to_micros: number;
|
|
237
|
-
bucket_seconds: number;
|
|
238
|
-
freshness_seconds: number;
|
|
239
|
-
};
|
|
240
|
-
totals: {
|
|
241
|
-
requests: number;
|
|
242
|
-
errors: number;
|
|
243
|
-
p50_latency_ms: number;
|
|
244
|
-
p95_latency_ms: number;
|
|
245
|
-
p99_latency_ms: number;
|
|
246
|
-
storage_read_ops: number;
|
|
247
|
-
storage_read_bytes: number;
|
|
248
|
-
storage_write_ops: number;
|
|
249
|
-
storage_write_bytes: number;
|
|
250
|
-
index_read_ops: number;
|
|
251
|
-
index_read_bytes: number;
|
|
252
|
-
};
|
|
253
|
-
details: {
|
|
254
|
-
total_bucket_count: number;
|
|
255
|
-
active_bucket_count: number;
|
|
256
|
-
error_rate: number;
|
|
257
|
-
storage_total_ops: number;
|
|
258
|
-
storage_total_bytes: number;
|
|
259
|
-
non_index_storage_read_ops: number;
|
|
260
|
-
non_index_storage_read_bytes: number;
|
|
261
|
-
index_read_share: number;
|
|
262
|
-
first_activity_bucket_start_micros?: number;
|
|
263
|
-
last_activity_bucket_start_micros?: number;
|
|
264
|
-
};
|
|
265
|
-
series: Array<{
|
|
266
|
-
bucket_start_micros: number;
|
|
267
|
-
requests: number;
|
|
268
|
-
errors: number;
|
|
269
|
-
p50_latency_ms: number;
|
|
270
|
-
p95_latency_ms: number;
|
|
271
|
-
p99_latency_ms: number;
|
|
272
|
-
storage_read_ops: number;
|
|
273
|
-
storage_read_bytes: number;
|
|
274
|
-
storage_write_ops: number;
|
|
275
|
-
storage_write_bytes: number;
|
|
276
|
-
index_read_ops: number;
|
|
277
|
-
index_read_bytes: number;
|
|
278
|
-
}>;
|
|
279
|
-
routes: Array<{
|
|
280
|
-
family: string;
|
|
281
|
-
requests: number;
|
|
282
|
-
errors: number;
|
|
283
|
-
error_rate: number;
|
|
284
|
-
request_share: number;
|
|
285
|
-
p50_latency_ms: number;
|
|
286
|
-
p95_latency_ms: number;
|
|
287
|
-
p99_latency_ms: number;
|
|
288
|
-
}>;
|
|
289
|
-
storage: Array<{
|
|
290
|
-
family: string;
|
|
291
|
-
read_ops: number;
|
|
292
|
-
read_bytes: number;
|
|
293
|
-
write_ops: number;
|
|
294
|
-
write_bytes: number;
|
|
295
|
-
total_ops: number;
|
|
296
|
-
total_bytes: number;
|
|
297
|
-
op_share: number;
|
|
298
|
-
byte_share: number;
|
|
299
|
-
}>;
|
|
300
|
-
partial: boolean;
|
|
301
|
-
}
|
|
302
226
|
export interface LbbErrorPayload {
|
|
303
227
|
type?: string;
|
|
304
228
|
code?: string;
|