@mnmal-ai/substrate 1.0.0-alpha.9 → 1.0.0-beta.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 +31 -13
- package/dist/boot-store-BMQUbHKv.js +4086 -0
- package/dist/{runtime-metrics-DwpDJ8vz.d.ts → bridge-DnToJedN.d.ts} +2 -87
- package/dist/cli-DModIbnN.js +3390 -0
- package/dist/client.browser.js +2507 -0
- package/dist/client.d.ts +222 -171
- package/dist/client.js +6 -7
- package/dist/cluster-worker.js +0 -1
- package/dist/{content-type-C7T28xNb.js → content-type-wLljot5M.js} +0 -1
- package/dist/{env-utils-CGNazUNt.js → env-utils-s25Z1YSA.js} +0 -1
- package/dist/{errors-D4vKuwz8.d.ts → errors-Cmkp1qxf.d.ts} +44 -4
- package/dist/{fake-DUVtKVSE.js → fake-DdXtb-m8.js} +0 -1
- package/dist/{index-D7mSOFlM.d.ts → index-BI4KqFiR.d.ts} +7 -11
- package/dist/msgpackr-Dq18g6Ds.js +16 -0
- package/dist/node-version-BtK_Nq6z.js +32 -0
- package/dist/pack.d.ts +75 -11
- package/dist/pack.js +4 -4
- package/dist/{plugin-DpncES1p.js → plugin-CEOhrEme.js} +78 -8
- package/dist/proposals-bootstrap.js +6 -5
- package/dist/proposals.config.schema.json +5 -0
- package/dist/proposals.d.ts +17 -5
- package/dist/proposals.default-config.json +2 -1
- package/dist/proposals.js +2 -3
- package/dist/recall-bootstrap.js +3 -4
- package/dist/recall.d.ts +11 -12
- package/dist/recall.js +2 -3
- package/dist/{repl-DeKzfvNV.js → repl-BvDZy-Ut.js} +52 -26
- package/dist/{row-SRhura12.d.ts → row-D0If4qif.d.ts} +91 -13
- package/dist/run-BT123RV1.js +2443 -0
- package/dist/{plugin-t2g2wX0b.d.ts → schema-aIkY8sR3.d.ts} +1293 -63
- package/dist/{script-C6DSa_Na.js → script-ByQ9pzhC.js} +54 -26
- package/dist/script-runner.js +78 -0
- package/dist/sdk.d.ts +236 -38
- package/dist/sdk.js +5 -110
- package/dist/semver-D_zdq0hi.js +17 -0
- package/dist/src-BMD2OE--.js +8289 -0
- package/dist/{src-BLgbLq2k.js → src-B_kHkbsr.js} +780 -330
- package/dist/{src-DjIuRjzF.js → src-CKSJ13p8.js} +10231 -4237
- package/dist/{src-C12EA0w9.js → src-CW7eRDss.js} +179 -96
- package/dist/{row-DZ0Fnpc6.js → src-DmiUWOLp.js} +2 -1
- package/dist/{src-DCy7Iy2l.js → src-DmjwFMu8.js} +900 -77
- package/dist/{src-DiNTSaFk.js → src-FXO5JPyk.js} +686 -856
- package/dist/substrate-admin.js +17 -782
- package/dist/substrate.js +4 -5302
- package/dist/testing.d.ts +473 -96
- package/dist/testing.js +19 -165
- package/dist/{ws-C72iVS5T.d.ts → ws-DW8ng02H.d.ts} +4 -5
- package/package.json +26 -26
- package/dist/dataset-CqrqTYPz.js +0 -1535
- package/dist/pg-edges-store-KH_FQCxx.js +0 -381
- package/dist/schema-g4FQLr0V.d.ts +0 -433
- package/dist/src-BD27zeGF.js +0 -2339
package/dist/client.d.ts
CHANGED
|
@@ -1,9 +1,122 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as
|
|
3
|
-
import {
|
|
4
|
-
import { A as and, B as SYSTEM_NAMESPACE, C as flattenGrant, D as parseGrantEntries, E as intersectGrants, F as TokenProviderOpts, G as resolveAdminCredential, H as isActiveAdminKeyRow, I as adminClaimCapabilities, J as NlAskRequest, K as resolveDefaultKeyPath, L as isEncryptedKey, M as or, N as ADMIN_CAPABILITIES, O as decodeList, P as DEFAULT_CAPABILITIES, R as makeAuthorizationProvider, S as expandFlat, T as grantIsUniform, U as AdminCredential, V as describeGrant, W as AdminEnv, Y as NlAskResult, _ as newlyGrantedPairs, a as denyAll, b as capabilitiesFor, c as requireIdentity, d as KeyUpdateRefusal, f as checkRevocable, ft as NlWireEvent, g as newlyGranted, h as grantEntriesConfer, i as allowVerbs, j as not, k as encodeList, l as requireNamespace, lt as NlServedPack, m as grantCovers, n as row, o as denyVerbs, p as checkUpdatable, q as resolveDefaultKidPath, r as allowAll, rt as NlOutcome, s as requireCapability, t as applyRowFilters, u as KeyMutationRefusal, ut as NlTrailEvent, v as revokedAtIso, w as grantEntryError, x as encodeGrant, y as Grant, z as makeTokenProvider } from "./row-SRhura12.js";
|
|
5
|
-
import { s as SchemaDriftError } from "./index-D7mSOFlM.js";
|
|
1
|
+
import { Ln as Row, W as QualifiedFrame, dn as RuntimeErrors, f as PackEnvelope, fn as RuntimeMetrics, ln as ResolverStat, m as Schema, pn as SlowRequest, sn as ProcessStat, un as RuntimeErrorEntry } from "./schema-aIkY8sR3.js";
|
|
2
|
+
import { A as and, B as SYSTEM_NAMESPACE, C as flattenGrant, D as parseGrantEntries, E as intersectGrants, F as TokenProviderOpts, G as resolveAdminCredential, H as isActiveAdminKeyRow, I as adminClaimCapabilities, K as resolveDefaultKeyPath, L as isEncryptedKey, M as or, N as ADMIN_CAPABILITIES, O as decodeList, P as DEFAULT_CAPABILITIES, R as makeAuthorizationProvider, S as expandFlat, T as grantIsUniform, U as AdminCredential, V as describeGrant, W as AdminEnv, X as NlAskResult, Y as NlAskRequest, _ as newlyGrantedPairs, a as denyAll, at as NlOutcome, b as capabilitiesFor, c as requireIdentity, d as KeyUpdateRefusal, dt as NlServedPack, f as checkRevocable, ft as NlTrailEvent, g as newlyGranted, h as grantEntriesConfer, i as allowVerbs, j as not, k as encodeList, l as requireNamespace, m as grantCovers, mt as NlWireEvent, n as row, o as denyVerbs, p as checkUpdatable, q as resolveDefaultKidPath, r as allowAll, s as requireCapability, t as applyRowFilters, u as KeyMutationRefusal, v as revokedAtIso, w as grantEntryError, x as encodeGrant, y as Grant, z as makeTokenProvider } from "./row-D0If4qif.js";
|
|
3
|
+
import { o as SchemaDriftError } from "./index-BI4KqFiR.js";
|
|
6
4
|
import { Signal } from "@preact/signals-core";
|
|
5
|
+
//#region ../../packages/substrate-client/src/transport/h2-fetch.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* A fetch-shaped function over `node:http2`: the transport seam's HTTP/2
|
|
8
|
+
* adapter for Node and Bun (Todo #1850, Decision #625).
|
|
9
|
+
*
|
|
10
|
+
* One `ClientHttp2Session` per origin, opened on first use and shared by every
|
|
11
|
+
* request to it; concurrent first calls share the pending connect. A session is
|
|
12
|
+
* dropped on GOAWAY, close or error, and the next request opens a new one. An
|
|
13
|
+
* idle session is unref'd, so a short-lived process exits without `close()`.
|
|
14
|
+
* `http:` origins use HTTP/2 with prior knowledge (h2c); `https:` origins verify
|
|
15
|
+
* the server against `ca`, or the process's default trust (which includes
|
|
16
|
+
* NODE_EXTRA_CA_CERTS). Certificate checks are never turned off.
|
|
17
|
+
*
|
|
18
|
+
* Imports node builtins only.
|
|
19
|
+
*/
|
|
20
|
+
type FetchLike = (input: string, init?: RequestInit) => Promise<Response>;
|
|
21
|
+
interface H2FetchOptions {
|
|
22
|
+
/** PEM of a CA to trust for `https:` origins, beside the default trust. */
|
|
23
|
+
ca?: string | Uint8Array;
|
|
24
|
+
/** Give up on opening a session after this long. Default 10 000 ms. */
|
|
25
|
+
connectTimeoutMs?: number;
|
|
26
|
+
}
|
|
27
|
+
type H2Fetch = FetchLike & {
|
|
28
|
+
close(): Promise<void>;
|
|
29
|
+
};
|
|
30
|
+
export declare function createH2Fetch(opts?: H2FetchOptions): H2Fetch;
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region ../../packages/substrate-client/src/admin/diagnose.d.ts
|
|
33
|
+
/**
|
|
34
|
+
* `ok` — asked and answered yes. `no` — asked and answered no. `skip` — NOT
|
|
35
|
+
* ASKED, because a precondition failed.
|
|
36
|
+
*/
|
|
37
|
+
type DoctorStatus = 'ok' | 'no' | 'skip';
|
|
38
|
+
interface DoctorCheck {
|
|
39
|
+
/** Stable short label, safe to grep for in a support thread. */
|
|
40
|
+
readonly name: string;
|
|
41
|
+
readonly status: DoctorStatus;
|
|
42
|
+
/** What was measured, in the terms the operator typed. */
|
|
43
|
+
readonly detail: string;
|
|
44
|
+
/** Present on `no` — the next command, not a restatement of the failure. */
|
|
45
|
+
readonly fix?: string;
|
|
46
|
+
/** The HTTP status that decided this verdict, when a response decided it. Match on this,
|
|
47
|
+
* never on `detail`, which is prose for an operator and free to change. */
|
|
48
|
+
readonly httpStatus?: number;
|
|
49
|
+
}
|
|
50
|
+
interface DoctorReport {
|
|
51
|
+
readonly checks: readonly DoctorCheck[];
|
|
52
|
+
/** 0 when nothing answered `no`. Skips do not fail the run; they are visible. */
|
|
53
|
+
readonly exitCode: number;
|
|
54
|
+
}
|
|
55
|
+
interface DirectoryReconciliation {
|
|
56
|
+
/** Inactive directory row, live signing credential — the dangerous direction. */
|
|
57
|
+
readonly retiredWithLiveKey: readonly string[];
|
|
58
|
+
/** Live credential, no directory row, not admin-exempt. */
|
|
59
|
+
readonly liveKeyWithoutRow: readonly string[];
|
|
60
|
+
/** Active directory row with a live credential that is not admin-capable. */
|
|
61
|
+
readonly agentKids: readonly string[];
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Reconciles live Key rows against AgentIdentity rows, returning retired
|
|
65
|
+
* identities that still hold a live key and live keys with no directory row.
|
|
66
|
+
*
|
|
67
|
+
* Admin keys are exempt from the second list by CAPABILITY, never by kid: the
|
|
68
|
+
* bootstrap root of trust has no directory row by design.
|
|
69
|
+
*
|
|
70
|
+
* A row whose `active` is absent counts as ACTIVE — only an explicit `false`
|
|
71
|
+
* deactivates. Rows predating the field must not read as decommissioned.
|
|
72
|
+
* A key row with no string kid is unmatchable and ignored (doctor is not a
|
|
73
|
+
* corruption scanner).
|
|
74
|
+
*/
|
|
75
|
+
export declare function reconcileIdentities(keys: readonly Row[], identities: readonly Row[], adminCapability: string): DirectoryReconciliation;
|
|
76
|
+
/**
|
|
77
|
+
* What diagnose measured, as data. A field is ABSENT when the check that measures it did not
|
|
78
|
+
* run — absent never means empty, so a reader cannot take "not looked" for "none found".
|
|
79
|
+
*/
|
|
80
|
+
interface DiagnoseFacts {
|
|
81
|
+
readonly adminKids?: readonly string[];
|
|
82
|
+
readonly liveKeyCount?: number;
|
|
83
|
+
readonly retiredWithLiveKey?: readonly string[];
|
|
84
|
+
readonly liveKeyWithoutRow?: readonly string[];
|
|
85
|
+
readonly agentKids?: readonly string[];
|
|
86
|
+
}
|
|
87
|
+
/** The identity the server resolved, when the identity check passed; else null. */
|
|
88
|
+
interface DiagnoseResult extends DoctorReport {
|
|
89
|
+
readonly identity: string | null;
|
|
90
|
+
readonly facts: DiagnoseFacts;
|
|
91
|
+
}
|
|
92
|
+
type DiagnoseCredential = {
|
|
93
|
+
readonly authorization: () => string;
|
|
94
|
+
readonly label: string;
|
|
95
|
+
} |
|
|
96
|
+
/** `fix` replaces the default advice, which names the admin env: a caller diagnosing some
|
|
97
|
+
* other identity knows what that identity needs. */
|
|
98
|
+
{
|
|
99
|
+
readonly error: string;
|
|
100
|
+
readonly fix?: string;
|
|
101
|
+
};
|
|
102
|
+
interface DiagnoseOpts {
|
|
103
|
+
readonly baseUrl: string;
|
|
104
|
+
readonly credential: DiagnoseCredential;
|
|
105
|
+
/** Default 'admin'. */
|
|
106
|
+
readonly adminCapability?: string;
|
|
107
|
+
/** Default true. False: the admin-only checks are skipped as not asked, not failed. */
|
|
108
|
+
readonly expectAdmin?: boolean;
|
|
109
|
+
readonly fetch?: FetchLike;
|
|
110
|
+
}
|
|
111
|
+
/** Every check `diagnose` can emit, in dependency order: what a caller marks NOT ASKED when it
|
|
112
|
+
* cannot run diagnose at all (the CLI's direct-to-postgres target). */
|
|
113
|
+
export declare const DIAGNOSE_CHECKS: readonly string[];
|
|
114
|
+
/**
|
|
115
|
+
* Runs every check against `opts.baseUrl`, in dependency order. A failure
|
|
116
|
+
* short-circuits its dependants into explicit skips.
|
|
117
|
+
*/
|
|
118
|
+
export declare function diagnose(opts: DiagnoseOpts): Promise<DiagnoseResult>;
|
|
119
|
+
//#endregion
|
|
7
120
|
//#region ../../packages/substrate-client/src/admin/surgery.d.ts
|
|
8
121
|
type AdminDropCascade = 'refuse' | 'delete';
|
|
9
122
|
interface AdminDropNamespaceInput {
|
|
@@ -188,6 +301,8 @@ interface AdminKeyRow {
|
|
|
188
301
|
readonly namespaces: string;
|
|
189
302
|
readonly capabilities: string;
|
|
190
303
|
readonly createdAt: string;
|
|
304
|
+
/** Present only on a `filter: 'all'` read: the revocation time, or null on a live key. */
|
|
305
|
+
readonly revokedAt?: string | null;
|
|
191
306
|
}
|
|
192
307
|
interface AdminGrantChange {
|
|
193
308
|
readonly kid: string;
|
|
@@ -259,9 +374,13 @@ interface AdminInviteResult {
|
|
|
259
374
|
readonly capabilities: string[];
|
|
260
375
|
}
|
|
261
376
|
interface AdminApi extends SurgeryApi {
|
|
262
|
-
/**
|
|
377
|
+
/**
|
|
378
|
+
* GET /substrate/v1/_system/keys, paged to completion: a truncated key table is never silent.
|
|
379
|
+
* `filter: 'all'` includes revoked keys, each row carrying `revokedAt`; the default is live keys only.
|
|
380
|
+
*/
|
|
263
381
|
keys(opts?: {
|
|
264
382
|
signal?: AbortSignal;
|
|
383
|
+
filter?: 'active' | 'all';
|
|
265
384
|
}): Promise<AdminKeyRow[]>;
|
|
266
385
|
/** PATCH of a key's grant. REPLACES both lists (namespaces and capabilities) with `change`'s; nothing is merged with what the key held. */
|
|
267
386
|
update(change: AdminGrantChange, opts?: {
|
|
@@ -278,94 +397,6 @@ interface AdminApi extends SurgeryApi {
|
|
|
278
397
|
}): Promise<AdminInviteResult>;
|
|
279
398
|
}
|
|
280
399
|
//#endregion
|
|
281
|
-
//#region ../../packages/substrate-client/src/admin/diagnose.d.ts
|
|
282
|
-
/**
|
|
283
|
-
* `ok` — asked and answered yes. `no` — asked and answered no. `skip` — NOT
|
|
284
|
-
* ASKED, because a precondition failed.
|
|
285
|
-
*/
|
|
286
|
-
type DoctorStatus = 'ok' | 'no' | 'skip';
|
|
287
|
-
interface DoctorCheck {
|
|
288
|
-
/** Stable short label, safe to grep for in a support thread. */
|
|
289
|
-
readonly name: string;
|
|
290
|
-
readonly status: DoctorStatus;
|
|
291
|
-
/** What was measured, in the terms the operator typed. */
|
|
292
|
-
readonly detail: string;
|
|
293
|
-
/** Present on `no` — the next command, not a restatement of the failure. */
|
|
294
|
-
readonly fix?: string;
|
|
295
|
-
/** The HTTP status that decided this verdict, when a response decided it. Match on this,
|
|
296
|
-
* never on `detail`, which is prose for an operator and free to change. */
|
|
297
|
-
readonly httpStatus?: number;
|
|
298
|
-
}
|
|
299
|
-
interface DoctorReport {
|
|
300
|
-
readonly checks: readonly DoctorCheck[];
|
|
301
|
-
/** 0 when nothing answered `no`. Skips do not fail the run; they are visible. */
|
|
302
|
-
readonly exitCode: number;
|
|
303
|
-
}
|
|
304
|
-
interface DirectoryReconciliation {
|
|
305
|
-
/** Inactive directory row, live signing credential — the dangerous direction. */
|
|
306
|
-
readonly retiredWithLiveKey: readonly string[];
|
|
307
|
-
/** Live credential, no directory row, not admin-exempt. */
|
|
308
|
-
readonly liveKeyWithoutRow: readonly string[];
|
|
309
|
-
/** Active directory row with a live credential that is not admin-capable. */
|
|
310
|
-
readonly agentKids: readonly string[];
|
|
311
|
-
}
|
|
312
|
-
/**
|
|
313
|
-
* Reconciles live Key rows against AgentIdentity rows, returning retired
|
|
314
|
-
* identities that still hold a live key and live keys with no directory row.
|
|
315
|
-
*
|
|
316
|
-
* Admin keys are exempt from the second list by CAPABILITY, never by kid: the
|
|
317
|
-
* bootstrap root of trust has no directory row by design.
|
|
318
|
-
*
|
|
319
|
-
* A row whose `active` is absent counts as ACTIVE — only an explicit `false`
|
|
320
|
-
* deactivates. Rows predating the field must not read as decommissioned.
|
|
321
|
-
* A key row with no string kid is unmatchable and ignored (doctor is not a
|
|
322
|
-
* corruption scanner).
|
|
323
|
-
*/
|
|
324
|
-
export declare function reconcileIdentities(keys: readonly Row[], identities: readonly Row[], adminCapability: string): DirectoryReconciliation;
|
|
325
|
-
/**
|
|
326
|
-
* What diagnose measured, as data. A field is ABSENT when the check that measures it did not
|
|
327
|
-
* run — absent never means empty, so a reader cannot take "not looked" for "none found".
|
|
328
|
-
*/
|
|
329
|
-
interface DiagnoseFacts {
|
|
330
|
-
readonly adminKids?: readonly string[];
|
|
331
|
-
readonly liveKeyCount?: number;
|
|
332
|
-
readonly retiredWithLiveKey?: readonly string[];
|
|
333
|
-
readonly liveKeyWithoutRow?: readonly string[];
|
|
334
|
-
readonly agentKids?: readonly string[];
|
|
335
|
-
}
|
|
336
|
-
/** The identity the server resolved, when the identity check passed; else null. */
|
|
337
|
-
interface DiagnoseResult extends DoctorReport {
|
|
338
|
-
readonly identity: string | null;
|
|
339
|
-
readonly facts: DiagnoseFacts;
|
|
340
|
-
}
|
|
341
|
-
type DiagnoseCredential = {
|
|
342
|
-
readonly authorization: () => string;
|
|
343
|
-
readonly label: string;
|
|
344
|
-
} |
|
|
345
|
-
/** `fix` replaces the default advice, which names the admin env: a caller diagnosing some
|
|
346
|
-
* other identity knows what that identity needs. */
|
|
347
|
-
{
|
|
348
|
-
readonly error: string;
|
|
349
|
-
readonly fix?: string;
|
|
350
|
-
};
|
|
351
|
-
interface DiagnoseOpts {
|
|
352
|
-
readonly baseUrl: string;
|
|
353
|
-
readonly credential: DiagnoseCredential;
|
|
354
|
-
/** Default 'admin'. */
|
|
355
|
-
readonly adminCapability?: string;
|
|
356
|
-
/** Default true. False: the admin-only checks are skipped as not asked, not failed. */
|
|
357
|
-
readonly expectAdmin?: boolean;
|
|
358
|
-
readonly fetch?: typeof fetch;
|
|
359
|
-
}
|
|
360
|
-
/** Every check `diagnose` can emit, in dependency order: what a caller marks NOT ASKED when it
|
|
361
|
-
* cannot run diagnose at all (the CLI's direct-to-postgres target). */
|
|
362
|
-
export declare const DIAGNOSE_CHECKS: readonly string[];
|
|
363
|
-
/**
|
|
364
|
-
* Runs every check against `opts.baseUrl`, in dependency order. A failure
|
|
365
|
-
* short-circuits its dependants into explicit skips.
|
|
366
|
-
*/
|
|
367
|
-
export declare function diagnose(opts: DiagnoseOpts): Promise<DiagnoseResult>;
|
|
368
|
-
//#endregion
|
|
369
400
|
//#region ../../packages/substrate-client/src/admin/onboard.d.ts
|
|
370
401
|
type OnboardStepStatus = 'done' | 'todo' | 'blocked' | 'skipped';
|
|
371
402
|
type OnboardAction = {
|
|
@@ -436,8 +467,8 @@ interface Diagnostic {
|
|
|
436
467
|
* substrate's explanation.
|
|
437
468
|
*
|
|
438
469
|
* Results are still correct — a substrate refuses a predicate it cannot
|
|
439
|
-
* honour. What is lost is the
|
|
440
|
-
*
|
|
470
|
+
* honour. What is lost is the engine's operator and operand check, so a
|
|
471
|
+
* malformed filter fails later and less clearly, or not at all.
|
|
441
472
|
*/
|
|
442
473
|
filterValidationSkipped?: string;
|
|
443
474
|
/**
|
|
@@ -474,18 +505,7 @@ export declare function collectDiagnostics(envDiagnostics: EnvelopeDiagnostics |
|
|
|
474
505
|
*/
|
|
475
506
|
export declare function createDefaultDiagnosticsSink(): DiagnosticsSink;
|
|
476
507
|
//#endregion
|
|
477
|
-
//#region ../../packages/substrate-client/src/transport/
|
|
478
|
-
type WsEncoding = 'json' | 'pack';
|
|
479
|
-
/**
|
|
480
|
-
* Minimal constructor shape for an injectable WebSocket implementation.
|
|
481
|
-
* Must be node-ws-compatible when headers are needed: `(url, protocols?,
|
|
482
|
-
* { headers })`. The WHATWG/browser constructor matches the first two
|
|
483
|
-
* parameters and simply cannot receive headers.
|
|
484
|
-
*/
|
|
485
|
-
type WebSocketImpl = new (url: string, protocols?: string | string[], options?: {
|
|
486
|
-
headers?: Record<string, string>;
|
|
487
|
-
}) => unknown;
|
|
488
|
-
/** Bounded auto-resubscribe policy for overload teardowns (contract class 1). */
|
|
508
|
+
//#region ../../packages/substrate-client/src/transport/frame-event.d.ts
|
|
489
509
|
interface WsOverloadResubscribeOpts {
|
|
490
510
|
/** Master switch. Default true. `false` restores terminal-on-overload. */
|
|
491
511
|
enabled?: boolean;
|
|
@@ -606,35 +626,30 @@ interface SubstrateClientOptions {
|
|
|
606
626
|
* Sync providers are accepted so `@mnmal-ai/substrate-policy`'s synchronous
|
|
607
627
|
* `makeTokenProvider` is usable directly; the transports `await` either way.
|
|
608
628
|
*/
|
|
609
|
-
getToken?: () => string | Promise<string>;
|
|
610
|
-
fetch?:
|
|
629
|
+
getToken?: () => string | undefined | Promise<string | undefined>;
|
|
630
|
+
fetch?: FetchLike;
|
|
611
631
|
reconnect?: {
|
|
612
632
|
baseDelayMs?: number;
|
|
613
633
|
maxDelayMs?: number;
|
|
614
634
|
jitter?: number;
|
|
615
635
|
};
|
|
616
636
|
/**
|
|
617
|
-
* Wire encoding
|
|
618
|
-
*
|
|
619
|
-
*
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
*
|
|
637
|
+
* Wire encoding of subscribe and stream bodies: length-prefixed JSON frames,
|
|
638
|
+
* or substrate-pack frames decoded back to named rows with the cached
|
|
639
|
+
* federated schema. Default `json`; `CallOpts.wire` overrides it per call.
|
|
640
|
+
*/
|
|
641
|
+
streamWire?: 'json' | 'pack';
|
|
642
|
+
/**
|
|
643
|
+
* Drop and re-subscribe a frame stream that sends nothing, heartbeats
|
|
644
|
+
* included, for this many milliseconds: a connection that died without
|
|
645
|
+
* closing. Default 65 000, a little over three server heartbeats. `0` disables.
|
|
624
646
|
*/
|
|
625
|
-
|
|
647
|
+
streamIdleMs?: number;
|
|
626
648
|
/**
|
|
627
649
|
* Auto-resubscribe policy for `subscription_overloaded` teardowns. Default:
|
|
628
650
|
* enabled with 3 attempts. See the README "Terminal-aware resubscribe" section.
|
|
629
651
|
*/
|
|
630
652
|
overloadResubscribe?: WsOverloadResubscribeOpts;
|
|
631
|
-
/**
|
|
632
|
-
* Explicit WebSocket implementation for the subscribe/stream surface. Must
|
|
633
|
-
* be node-ws-compatible (`new (url, protocols?, { headers })`) so the
|
|
634
|
-
* bearer can ride the upgrade. Defaults to node-ws under Node and the
|
|
635
|
-
* global WebSocket elsewhere — see WsTransportOpts.webSocket.
|
|
636
|
-
*/
|
|
637
|
-
webSocket?: WebSocketImpl;
|
|
638
653
|
/**
|
|
639
654
|
* Sink for non-fatal envelope diagnostics (`_diagnostics`) on query/mutate
|
|
640
655
|
* responses: projection keys the type does not declare, a where-clause that
|
|
@@ -654,15 +669,17 @@ interface CallOpts {
|
|
|
654
669
|
export declare class SubstrateClient {
|
|
655
670
|
#private;
|
|
656
671
|
constructor(opts: SubstrateClientOptions);
|
|
657
|
-
/** Natural-language ask (
|
|
672
|
+
/** Natural-language ask (frame stream or JSON) and the served namespace pack. Requires the substrate-nl plugin. */
|
|
658
673
|
get nl(): NlApi;
|
|
659
674
|
/** The admin-gated routes. Needs an identity whose grant confers `admin`. */
|
|
660
675
|
get admin(): AdminApi;
|
|
661
676
|
federatedSchema(): Promise<Record<string, Schema>>;
|
|
662
677
|
query(frame: QualifiedFrame, opts?: CallOpts): Promise<PackEnvelope>;
|
|
663
678
|
mutate(frame: QualifiedFrame, opts?: CallOpts): Promise<PackEnvelope>;
|
|
664
|
-
|
|
665
|
-
|
|
679
|
+
/** A live query: a snapshot, then deltas. `opts.wire` and `opts.signal` apply. */
|
|
680
|
+
subscribe(frame: QualifiedFrame, opts?: CallOpts): AsyncIterable<SubscribeEvent>;
|
|
681
|
+
/** A one-shot streamed resolver: chunks, then `end`. `opts.wire` and `opts.signal` apply. */
|
|
682
|
+
stream(frame: QualifiedFrame, opts?: CallOpts): AsyncIterable<SubscribeEvent>;
|
|
666
683
|
/**
|
|
667
684
|
* Live typed-row view over a single-key subscription. Subscribes under the
|
|
668
685
|
* hood, folds snapshot/add/update/remove into the current row-set, and yields
|
|
@@ -672,7 +689,7 @@ export declare class SubstrateClient {
|
|
|
672
689
|
*
|
|
673
690
|
* Completes when the subscription ends; throws on an error frame — the same
|
|
674
691
|
* contract as `subscribe`. Breaking the consuming `for await` cancels the
|
|
675
|
-
* underlying
|
|
692
|
+
* underlying subscription. Reconnect / overload-resubscribe are handled by
|
|
676
693
|
* `subscribe`; each fresh snapshot atomically replaces the row-set.
|
|
677
694
|
*
|
|
678
695
|
* Single-qualified-key only: multi-key frames throw; use `subscribe` for
|
|
@@ -742,39 +759,6 @@ export declare class SubscribeError extends Error {
|
|
|
742
759
|
constructor(message: string, code: string);
|
|
743
760
|
}
|
|
744
761
|
//#endregion
|
|
745
|
-
//#region ../../packages/substrate-client/src/from-env.d.ts
|
|
746
|
-
/**
|
|
747
|
-
* The capabilities a client asks for, from `SUBSTRATE_AGENT_CAPABILITIES` (csv),
|
|
748
|
-
* defaulting to `substrate-policy`'s default.
|
|
749
|
-
*
|
|
750
|
-
* Not `ADMIN_CAPABILITIES`: a dataset-registry key intersects the claim, but a
|
|
751
|
-
* file-registry key takes it verbatim, so a wider default would promote every
|
|
752
|
-
* agent on such a deployment to admin.
|
|
753
|
-
*/
|
|
754
|
-
export declare function resolveAgentCapabilities(env: NodeJS.ProcessEnv): ReadonlyArray<string>;
|
|
755
|
-
interface ClientFromEnvOptions extends Omit<SubstrateClientOptions, 'endpoint' | 'token' | 'getToken'> {
|
|
756
|
-
env?: NodeJS.ProcessEnv;
|
|
757
|
-
/** Allow an unsigned client when no signing key is configured. Default false. */
|
|
758
|
-
allowAnonymous?: boolean;
|
|
759
|
-
}
|
|
760
|
-
interface ClientFromEnv {
|
|
761
|
-
client: SubstrateClient;
|
|
762
|
-
endpoint: string;
|
|
763
|
-
/** The signing kid, or null for an anonymous client. */
|
|
764
|
-
kid: string | null;
|
|
765
|
-
}
|
|
766
|
-
/**
|
|
767
|
-
* Builds a client from `SUBSTRATE_URL` and `SUBSTRATE_AGENT_KEY_ID` +
|
|
768
|
-
* `SUBSTRATE_AGENT_KEY_PATH`, signing every request as that kid.
|
|
769
|
-
*
|
|
770
|
-
* Redirects are refused and the token's audience is the endpoint's origin.
|
|
771
|
-
*
|
|
772
|
-
* @throws Error when `SUBSTRATE_URL` is unset or unsafe for a credential, when
|
|
773
|
-
* only one of the key pair is set, when the key cannot be read, or when no
|
|
774
|
-
* key is set and `allowAnonymous` is not.
|
|
775
|
-
*/
|
|
776
|
-
export declare function createClientFromEnv(opts?: ClientFromEnvOptions): ClientFromEnv;
|
|
777
|
-
//#endregion
|
|
778
762
|
//#region ../../packages/substrate-client/src/script.d.ts
|
|
779
763
|
/**
|
|
780
764
|
* `read` refuses every mutation, `dry-run` records mutations without sending
|
|
@@ -799,15 +783,38 @@ interface ScriptRecallInput {
|
|
|
799
783
|
/** `true` for the whole row, or the fields to return beside `id`. Omit for the handle fields. */
|
|
800
784
|
row?: true | Record<string, true>;
|
|
801
785
|
}
|
|
802
|
-
|
|
786
|
+
/**
|
|
787
|
+
* A recall hit's `row`. Without `row` in the request it is `id` plus whichever
|
|
788
|
+
* handle fields the row has (recall's HANDLE_FIELDS); `row: { body: true }` or
|
|
789
|
+
* `row: true` adds `body` and the other fields asked for.
|
|
790
|
+
*/
|
|
791
|
+
interface RecallHitRow {
|
|
792
|
+
id: string;
|
|
793
|
+
name?: string;
|
|
794
|
+
title?: string;
|
|
795
|
+
topic?: string;
|
|
796
|
+
synopsis?: string;
|
|
797
|
+
description?: string;
|
|
798
|
+
/** Present only when the request asked for it and the type has one. */
|
|
799
|
+
body?: string;
|
|
800
|
+
[field: string]: unknown;
|
|
801
|
+
}
|
|
802
|
+
/** One `recall/Hit` row, as the recall frame returns it. */
|
|
803
|
+
interface RecallHit {
|
|
804
|
+
/** The hit row's id, the same as `row.id`. */
|
|
803
805
|
id: string;
|
|
804
806
|
namespace: string;
|
|
805
807
|
type: string;
|
|
806
808
|
score: number;
|
|
807
809
|
kind: 'seed' | 'expansion';
|
|
810
|
+
/** Set on an expansion hit. */
|
|
808
811
|
expandedFrom?: unknown;
|
|
809
|
-
row
|
|
812
|
+
/** Returned when the request named no `row` fields. */
|
|
813
|
+
salience?: number;
|
|
814
|
+
blendedScore?: number;
|
|
815
|
+
row: RecallHitRow;
|
|
810
816
|
}
|
|
817
|
+
type ScriptRecallHit = RecallHit;
|
|
811
818
|
/** What a script's default export receives. */
|
|
812
819
|
interface ScriptContext {
|
|
813
820
|
readonly kid: string | null;
|
|
@@ -824,8 +831,20 @@ interface ScriptContext {
|
|
|
824
831
|
params?: Record<string, unknown>;
|
|
825
832
|
fields?: unknown;
|
|
826
833
|
}): Promise<Record<string, unknown>[]>;
|
|
834
|
+
/**
|
|
835
|
+
* The rows with these shortIds, through `where: { shortId: { eq | in } }`.
|
|
836
|
+
* One number gives one row; an array gives the rows in input order. Throws
|
|
837
|
+
* naming every shortId with no row. `fields` gains `shortId` when given.
|
|
838
|
+
*/
|
|
839
|
+
byShortId(key: string, n: number, fields?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
840
|
+
byShortId(key: string, n: readonly number[], fields?: Record<string, unknown>): Promise<Record<string, unknown>[]>;
|
|
827
841
|
/** Recall hits, best first, through the `recall/Hit` frame. */
|
|
828
842
|
recall(input: ScriptRecallInput): Promise<ScriptRecallHit[]>;
|
|
843
|
+
/**
|
|
844
|
+
* The federated schema, one namespace's schema, or one type's. Throws naming
|
|
845
|
+
* an unknown namespace or type.
|
|
846
|
+
*/
|
|
847
|
+
schema(namespace?: string, type?: string): Promise<unknown>;
|
|
829
848
|
/**
|
|
830
849
|
* One mutate payload (one transaction). Returns null in `dry-run`, and throws
|
|
831
850
|
* in `read`, past `maxWrites`, or when the server refuses any frame.
|
|
@@ -885,21 +904,53 @@ export declare function reduceSubscribeRows<T>(current: T[], qualifiedKey: strin
|
|
|
885
904
|
* A delta that does not change the set (e.g. an `update` whose row has no id) is
|
|
886
905
|
* not re-yielded. Cancellation: breaking the consuming `for await` (or calling
|
|
887
906
|
* `.return()`) propagates to the source iterable's `return()` through the inner
|
|
888
|
-
* `for await`, cancelling the underlying
|
|
907
|
+
* `for await`, cancelling the underlying subscription.
|
|
889
908
|
*/
|
|
890
909
|
export declare function watchRows<T>(events: AsyncIterable<SubscribeEvent>, qualifiedKey: string): AsyncGenerator<T[]>;
|
|
891
910
|
//#endregion
|
|
892
911
|
//#region ../../packages/substrate-client/src/token-target.d.ts
|
|
893
|
-
/**
|
|
894
|
-
* Where a freshly minted credential may be sent: an https origin, or plain
|
|
895
|
-
* http only to a loopback host, where nothing on the network can read it.
|
|
896
|
-
*/
|
|
897
912
|
/**
|
|
898
913
|
* @returns the origin of `baseUrl`, which a token for it names as its `aud`.
|
|
899
914
|
* @throws Error when `baseUrl` is not a URL, or is plain http to a non-loopback host.
|
|
900
915
|
*/
|
|
901
916
|
export declare function tokenAudience(baseUrl: string): string;
|
|
902
917
|
/** `fetchImpl` with redirects refused: a redirect would carry the credential to wherever it points. */
|
|
903
|
-
export declare function noRedirectFetch(fetchImpl?:
|
|
918
|
+
export declare function noRedirectFetch(fetchImpl?: FetchLike): FetchLike;
|
|
919
|
+
//#endregion
|
|
920
|
+
//#region ../../packages/substrate-client/src/transport/default-fetch.d.ts
|
|
921
|
+
export declare const substrateFetch: FetchLike;
|
|
922
|
+
//#endregion
|
|
923
|
+
//#region ../../packages/substrate-client/src/from-env.d.ts
|
|
924
|
+
/**
|
|
925
|
+
* The capabilities a client asks for, from `SUBSTRATE_AGENT_CAPABILITIES` (csv),
|
|
926
|
+
* defaulting to `substrate-policy`'s default.
|
|
927
|
+
*
|
|
928
|
+
* Not `ADMIN_CAPABILITIES`: a dataset-registry key intersects the claim, but a
|
|
929
|
+
* file-registry key takes it verbatim, so a wider default would promote every
|
|
930
|
+
* agent on such a deployment to admin.
|
|
931
|
+
*/
|
|
932
|
+
export declare function resolveAgentCapabilities(env: NodeJS.ProcessEnv): ReadonlyArray<string>;
|
|
933
|
+
interface ClientFromEnvOptions extends Omit<SubstrateClientOptions, 'endpoint' | 'token' | 'getToken'> {
|
|
934
|
+
env?: NodeJS.ProcessEnv;
|
|
935
|
+
/** Allow an unsigned client when no signing key is configured. Default false. */
|
|
936
|
+
allowAnonymous?: boolean;
|
|
937
|
+
}
|
|
938
|
+
interface ClientFromEnv {
|
|
939
|
+
client: SubstrateClient;
|
|
940
|
+
endpoint: string;
|
|
941
|
+
/** The signing kid, or null for an anonymous client. */
|
|
942
|
+
kid: string | null;
|
|
943
|
+
}
|
|
944
|
+
/**
|
|
945
|
+
* Builds a client from `SUBSTRATE_URL` and `SUBSTRATE_AGENT_KEY_ID` +
|
|
946
|
+
* `SUBSTRATE_AGENT_KEY_PATH`, signing every request as that kid.
|
|
947
|
+
*
|
|
948
|
+
* Redirects are refused and the token's audience is the endpoint's origin.
|
|
949
|
+
*
|
|
950
|
+
* @throws Error when `SUBSTRATE_URL` is unset or unsafe for a credential, when
|
|
951
|
+
* only one of the key pair is set, when the key cannot be read, or when no
|
|
952
|
+
* key is set and `allowAnonymous` is not.
|
|
953
|
+
*/
|
|
954
|
+
export declare function createClientFromEnv(opts?: ClientFromEnvOptions): ClientFromEnv;
|
|
904
955
|
//#endregion
|
|
905
|
-
export { ADMIN_CAPABILITIES, type AdminApi, type AdminBackfillChunk, type AdminBackfillInput, type AdminBackfillSummary, type AdminCredential, type AdminDropCascade, type AdminDropNamespaceInput, type AdminDropResult, type AdminDropTypeInput, type AdminEmbedStats, type AdminEnv, type AdminGrantChange, type AdminInviteInput, type AdminInviteResult, type AdminKeyAlgorithm, type AdminKeyRow, type AdminNormaliseInput, type AdminNormaliseResult, type AdminRegisterInput, type AdminRegisterResult, type AdminReindexInput, type AdminReindexPage, type AdminRevokeResult, type AdminUpdateResult, type CallOpts, type ClientFromEnv, type ClientFromEnvOptions, DEFAULT_CAPABILITIES, type DiagnoseCredential, type DiagnoseFacts, type DiagnoseOpts, type DiagnoseResult, type Diagnostic, type DiagnosticsSink, type DirectoryReconciliation, type DoctorCheck, type DoctorReport, type DoctorStatus, type Grant, type KeyMutationRefusal, type KeyUpdateRefusal, type NlApi, type NlAskRequest, type NlAskResult, type NlOutcome, type NlServedPack, type NlTrailEvent, type NlWireEvent, type OnboardAction, type OnboardStep, type OnboardStepStatus, type PlanOnboardingOpts, type ProcessStat, type QualifiedFrame, type ResolverStat, type RunScriptOptions, type RuntimeErrorEntry, type RuntimeErrors, type RuntimeMetrics, SYSTEM_NAMESPACE, SchemaDriftError, type ScriptContext, type ScriptMode, type ScriptMutation, type ScriptRecallHit, type ScriptRecallInput, type ScriptReport, type SlowRequest, type SubscribeEvent, type SubstrateClientOptions, type SurgeryApi, type TokenProviderOpts, type
|
|
956
|
+
export { ADMIN_CAPABILITIES, type AdminApi, type AdminBackfillChunk, type AdminBackfillInput, type AdminBackfillSummary, type AdminCredential, type AdminDropCascade, type AdminDropNamespaceInput, type AdminDropResult, type AdminDropTypeInput, type AdminEmbedStats, type AdminEnv, type AdminGrantChange, type AdminInviteInput, type AdminInviteResult, type AdminKeyAlgorithm, type AdminKeyRow, type AdminNormaliseInput, type AdminNormaliseResult, type AdminRegisterInput, type AdminRegisterResult, type AdminReindexInput, type AdminReindexPage, type AdminRevokeResult, type AdminUpdateResult, type CallOpts, type ClientFromEnv, type ClientFromEnvOptions, DEFAULT_CAPABILITIES, type DiagnoseCredential, type DiagnoseFacts, type DiagnoseOpts, type DiagnoseResult, type Diagnostic, type DiagnosticsSink, type DirectoryReconciliation, type DoctorCheck, type DoctorReport, type DoctorStatus, type FetchLike, type Grant, type H2Fetch, type H2FetchOptions, type KeyMutationRefusal, type KeyUpdateRefusal, type NlApi, type NlAskRequest, type NlAskResult, type NlOutcome, type NlServedPack, type NlTrailEvent, type NlWireEvent, type OnboardAction, type OnboardStep, type OnboardStepStatus, type PlanOnboardingOpts, type ProcessStat, type QualifiedFrame, type RecallHit, type RecallHitRow, type ResolverStat, type RunScriptOptions, type RuntimeErrorEntry, type RuntimeErrors, type RuntimeMetrics, SYSTEM_NAMESPACE, SchemaDriftError, type ScriptContext, type ScriptMode, type ScriptMutation, type ScriptRecallHit, type ScriptRecallInput, type ScriptReport, type SlowRequest, type SubscribeEvent, type SubstrateClientOptions, type SurgeryApi, type TokenProviderOpts, type WsOverloadResubscribeOpts, adminClaimCapabilities, allowAll, allowVerbs, and, applyRowFilters, capabilitiesFor, checkRevocable, checkUpdatable, decodeList, denyAll, denyVerbs, describeGrant, encodeGrant, encodeList, expandFlat, flattenGrant, grantCovers, grantEntriesConfer, grantEntryError, grantIsUniform, intersectGrants, isActiveAdminKeyRow, isEncryptedKey, makeAuthorizationProvider, makeTokenProvider, newlyGranted, newlyGrantedPairs, not, or, parseGrantEntries, requireCapability, requireIdentity, requireNamespace, resolveAdminCredential, resolveDefaultKeyPath, resolveDefaultKidPath, revokedAtIso, row };
|
package/dist/client.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as
|
|
3
|
-
import {
|
|
4
|
-
import { g as
|
|
5
|
-
import {
|
|
6
|
-
import { n as runScript, t as DEFAULT_MAX_WRITES } from "./script-C6DSa_Na.js";
|
|
1
|
+
import { a as adminClaimCapabilities, c as makeTokenProvider, d as resolveDefaultKidPath, i as DEFAULT_CAPABILITIES, l as resolveAdminCredential, o as isEncryptedKey, r as ADMIN_CAPABILITIES, s as makeAuthorizationProvider, u as resolveDefaultKeyPath } from "./env-utils-s25Z1YSA.js";
|
|
2
|
+
import { A as expandFlat, C as not, D as isActiveAdminKeyRow, E as describeGrant, F as parseGrantEntries, I as decodeList, L as encodeList, M as grantEntryError, N as grantIsUniform, O as capabilitiesFor, P as intersectGrants, S as and, T as SYSTEM_NAMESPACE, _ as grantCovers, a as denyAll, b as newlyGrantedPairs, c as requireIdentity, g as checkUpdatable, h as checkRevocable, i as allowVerbs, j as flattenGrant, k as encodeGrant, l as requireNamespace, n as row, o as denyVerbs, r as allowAll, s as requireCapability, t as applyRowFilters, v as grantEntriesConfer, w as or, x as revokedAtIso, y as newlyGranted } from "./src-DmiUWOLp.js";
|
|
3
|
+
import { x as SchemaDriftError } from "./src-B_kHkbsr.js";
|
|
4
|
+
import { C as diagnose, E as createH2Fetch, S as DIAGNOSE_CHECKS, T as substrateFetch, _ as SKIPPABLE_STEPS, a as SubstrateClient, b as planOnboarding, c as reduceSubscribeRows, d as NetworkError, f as SubscribeError, g as ONBOARD_STEPS, h as CURRENT_MARK, i as tokenAudience, l as watchRows, m as BACKFILL_CHUNK, n as resolveAgentCapabilities, o as collectDiagnostics, p as AdminBackfillError, r as noRedirectFetch, s as createDefaultDiagnosticsSink, t as createClientFromEnv, u as AuthError, v as STEP_MARKS, w as reconcileIdentities, x as requiredOutstanding, y as currentStep } from "./src-FXO5JPyk.js";
|
|
5
|
+
import { n as runScript, t as DEFAULT_MAX_WRITES } from "./script-ByQ9pzhC.js";
|
|
7
6
|
|
|
8
|
-
export { ADMIN_CAPABILITIES, AdminBackfillError, AuthError, BACKFILL_CHUNK, CURRENT_MARK, DEFAULT_CAPABILITIES, DEFAULT_MAX_WRITES, DIAGNOSE_CHECKS, NetworkError, ONBOARD_STEPS, SKIPPABLE_STEPS, STEP_MARKS, SYSTEM_NAMESPACE, SchemaDriftError, SubscribeError, SubstrateClient, adminClaimCapabilities, allowAll, allowVerbs, and, applyRowFilters, capabilitiesFor, checkRevocable, checkUpdatable, collectDiagnostics, createClientFromEnv, createDefaultDiagnosticsSink, currentStep, decodeList, denyAll, denyVerbs, describeGrant, diagnose, encodeGrant, encodeList, expandFlat, flattenGrant, grantCovers, grantEntriesConfer, grantEntryError, grantIsUniform, intersectGrants, isActiveAdminKeyRow, isEncryptedKey, makeAuthorizationProvider, makeTokenProvider, newlyGranted, newlyGrantedPairs, noRedirectFetch, not, or, parseGrantEntries, planOnboarding, reconcileIdentities, reduceSubscribeRows, requireCapability, requireIdentity, requireNamespace, requiredOutstanding, resolveAdminCredential, resolveAgentCapabilities, resolveDefaultKeyPath, resolveDefaultKidPath, revokedAtIso, row, runScript, tokenAudience, watchRows };
|
|
7
|
+
export { ADMIN_CAPABILITIES, AdminBackfillError, AuthError, BACKFILL_CHUNK, CURRENT_MARK, DEFAULT_CAPABILITIES, DEFAULT_MAX_WRITES, DIAGNOSE_CHECKS, NetworkError, ONBOARD_STEPS, SKIPPABLE_STEPS, STEP_MARKS, SYSTEM_NAMESPACE, SchemaDriftError, SubscribeError, SubstrateClient, adminClaimCapabilities, allowAll, allowVerbs, and, applyRowFilters, capabilitiesFor, checkRevocable, checkUpdatable, collectDiagnostics, createClientFromEnv, createDefaultDiagnosticsSink, createH2Fetch, currentStep, decodeList, denyAll, denyVerbs, describeGrant, diagnose, encodeGrant, encodeList, expandFlat, flattenGrant, grantCovers, grantEntriesConfer, grantEntryError, grantIsUniform, intersectGrants, isActiveAdminKeyRow, isEncryptedKey, makeAuthorizationProvider, makeTokenProvider, newlyGranted, newlyGrantedPairs, noRedirectFetch, not, or, parseGrantEntries, planOnboarding, reconcileIdentities, reduceSubscribeRows, requireCapability, requireIdentity, requireNamespace, requiredOutstanding, resolveAdminCredential, resolveAgentCapabilities, resolveDefaultKeyPath, resolveDefaultKidPath, revokedAtIso, row, runScript, substrateFetch, tokenAudience, watchRows };
|
package/dist/cluster-worker.js
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { En as EdgeRef, wn as Edge } from "./schema-aIkY8sR3.js";
|
|
2
2
|
//#region ../../packages/substrate-types/src/errors.d.ts
|
|
3
|
+
/** A by-filter write matched more rows than `SUBSTRATE_FILTER_WRITE_MAX_MATCH`; nothing changed. */
|
|
4
|
+
declare const FILTER_TOO_BROAD = "filter_too_broad";
|
|
5
|
+
/** Refusal codes for the typed-edge-walk grammar. */
|
|
6
|
+
declare const WALKS_NEED_PARTITIONED = "walks_need_partitioned";
|
|
7
|
+
declare const WALKS_IN_SUBSCRIPTION = "walks_in_subscription";
|
|
8
|
+
declare const WALKS_IN_MUTATION = "walks_in_mutation";
|
|
9
|
+
declare const ROW_POLICY_BLOCKS_WALK = "row_policy_blocks_walk";
|
|
10
|
+
declare const WALK_BUDGET_EXCEEDED = "walk_budget_exceeded";
|
|
11
|
+
declare const WALKS_UNSUPPORTED_STORE = "walks_unsupported_store";
|
|
12
|
+
/** A read cancelled by the store's statement timeout; `details: { timeoutMs }`. */
|
|
13
|
+
declare const QUERY_TIMEOUT = "query_timeout";
|
|
14
|
+
/** No store connection came free within the wait limit, so the request never started; retry later. */
|
|
15
|
+
declare const STORE_BUSY = "store_busy";
|
|
16
|
+
/** An aggregate or expression whose value leaves its type's range (an int64 sum past 2^63-1); the same code on every engine. */
|
|
17
|
+
declare const VALUE_OUT_OF_RANGE = "value_out_of_range";
|
|
18
|
+
/** A regex call on the memory evaluator that would take more steps than its budget; `details: { budget }`. */
|
|
19
|
+
declare const REGEX_BUDGET_EXCEEDED = "regex_budget_exceeded";
|
|
20
|
+
/**
|
|
21
|
+
* A walk construct refused where it cannot be answered: inside a struct, over
|
|
22
|
+
* a list or struct-nested crossRef, under a reused field name, on a virtual
|
|
23
|
+
* type, or on a read path that does not evaluate walks.
|
|
24
|
+
*/
|
|
25
|
+
declare const WALK_UNSUPPORTED_REF = "walk_unsupported_ref";
|
|
3
26
|
/**
|
|
4
27
|
* Throwable by a resolver to surface a structured per-frame error with a
|
|
5
28
|
* caller-chosen `code` instead of the generic `resolver_error`. The engine's
|
|
@@ -29,6 +52,8 @@ declare class ResolverFrameError extends Error {
|
|
|
29
52
|
readonly details?: Record<string, unknown>;
|
|
30
53
|
constructor(code: string, message: string, details?: Record<string, unknown>);
|
|
31
54
|
}
|
|
55
|
+
/** `filter_too_broad`: a by-filter write on `<namespace>/<type>` matched more than `maxMatch` rows. */
|
|
56
|
+
declare function filterTooBroad(namespace: string, type: string, maxMatch: number): ResolverFrameError;
|
|
32
57
|
/**
|
|
33
58
|
* Thrown by a write-path resolver when a crossRef declaring `onMissing: 'reject'`
|
|
34
59
|
* references a target that does not exist (or has been tombstoned). Extends
|
|
@@ -78,11 +103,12 @@ declare class NamespaceMismatch extends Error {
|
|
|
78
103
|
}
|
|
79
104
|
/**
|
|
80
105
|
* Thrown by `Dataset.updateField` when the caller targets a reserved
|
|
81
|
-
* field name (e.g. `_deletedAt`)
|
|
106
|
+
* field name (e.g. `_deletedAt`), and by any other write path that refuses
|
|
107
|
+
* one; `how` names that path in the message. Spec §4.5.
|
|
82
108
|
*/
|
|
83
109
|
declare class ReservedField extends Error {
|
|
84
110
|
readonly name = "ReservedField";
|
|
85
|
-
constructor(field: string);
|
|
111
|
+
constructor(field: string, how?: string);
|
|
86
112
|
}
|
|
87
113
|
/**
|
|
88
114
|
* The `(auth)` tag `HttpBridgeClient` appends to a 401/403 cause. Single
|
|
@@ -105,6 +131,20 @@ declare class BridgeUnreachableError extends Error {
|
|
|
105
131
|
readonly cause: unknown;
|
|
106
132
|
constructor(bridgeName: string, baseUrl: string, cause: unknown);
|
|
107
133
|
}
|
|
134
|
+
/**
|
|
135
|
+
* Thrown by a `BatchResolver` to refuse element `index` of its args list. The
|
|
136
|
+
* engine rolls back the whole array and reports `cause` as the per-element
|
|
137
|
+
* resolver would have: a `ResolverFrameError` or `RestrictViolation` keeps
|
|
138
|
+
* its code at `[key]`, and `batched_frame_rolled_back` names the element.
|
|
139
|
+
*/
|
|
140
|
+
declare class BatchElementError extends Error {
|
|
141
|
+
readonly index: number;
|
|
142
|
+
readonly cause: unknown;
|
|
143
|
+
readonly name = "BatchElementError";
|
|
144
|
+
constructor(index: number, cause: unknown);
|
|
145
|
+
}
|
|
146
|
+
/** Recognise a {@link BatchElementError} across module-realm boundaries. */
|
|
147
|
+
declare function isBatchElementError(err: unknown): err is BatchElementError;
|
|
108
148
|
/**
|
|
109
149
|
* Recognise a {@link ResolverFrameError} across module-realm boundaries.
|
|
110
150
|
*
|
|
@@ -127,4 +167,4 @@ declare function isResolverFrameError(err: unknown): err is ResolverFrameError;
|
|
|
127
167
|
*/
|
|
128
168
|
declare function isRestrictViolation(err: unknown): err is RestrictViolation;
|
|
129
169
|
//#endregion
|
|
130
|
-
export {
|
|
170
|
+
export { isBatchElementError as C, isAuthCause as S, isRestrictViolation as T, WALKS_NEED_PARTITIONED as _, NamespaceMismatch as a, WALK_UNSUPPORTED_REF as b, ROW_POLICY_BLOCKS_WALK as c, RestrictViolation as d, STORE_BUSY as f, WALKS_IN_SUBSCRIPTION as g, WALKS_IN_MUTATION as h, MissingReferentError as i, ReservedField as l, VALUE_OUT_OF_RANGE as m, BridgeUnreachableError as n, QUERY_TIMEOUT as o, UnsupportedFilterError as p, FILTER_TOO_BROAD as r, REGEX_BUDGET_EXCEEDED as s, BatchElementError as t, ResolverFrameError as u, WALKS_UNSUPPORTED_STORE as v, isResolverFrameError as w, filterTooBroad as x, WALK_BUDGET_EXCEEDED as y };
|