@mnmal-ai/substrate 1.0.0-alpha.2 → 1.0.0-alpha.20
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 +64 -14
- package/dist/boot-store-BaDqbBS-.js +4062 -0
- package/dist/{runtime-metrics-DwpDJ8vz.d.ts → bridge-BhiJKwfF.d.ts} +2 -87
- package/dist/cli-RRFphMtQ.js +3366 -0
- package/dist/client.browser.js +2485 -0
- package/dist/client.d.ts +273 -135
- package/dist/client.js +6 -6
- 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-CYOaWZ8l.d.ts} +44 -4
- package/dist/{fake-DUVtKVSE.js → fake-DdXtb-m8.js} +0 -1
- package/dist/{index-D7mSOFlM.d.ts → index-ZKeYFHDD.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/pg-edges-store-C-IRv-O9.js +443 -0
- package/dist/{plugin-QuJN9pG_.js → plugin-MSbSZ6Al.js} +132 -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 +5 -4
- package/dist/recall.config.schema.json +6 -0
- package/dist/recall.d.ts +35 -6
- package/dist/recall.js +2 -3
- package/dist/{repl-C52wyfMs.js → repl-Ob5OyQqj.js} +65 -33
- package/dist/{row-ByLFE2Wx.d.ts → row-CfsHSEfB.d.ts} +92 -12
- package/dist/run-B438GGJK.js +2435 -0
- package/dist/{plugin-t2g2wX0b.d.ts → schema-laGLMvMC.d.ts} +1287 -63
- package/dist/script-A9dxMRZA.js +143 -0
- package/dist/script-runner.js +77 -0
- package/dist/sdk.d.ts +227 -38
- package/dist/sdk.js +5 -110
- package/dist/semver-D_zdq0hi.js +17 -0
- package/dist/{src-DMzc3HfW.js → src-BNdhH_Hx.js} +745 -851
- package/dist/{src-CG7giuHr.js → src-BSL2yyVy.js} +779 -75
- package/dist/{src-BLgbLq2k.js → src-B_kHkbsr.js} +780 -330
- package/dist/{src-DWm0iA88.js → src-De9j33jv.js} +188 -87
- package/dist/src-DkxrpQOz.js +7709 -0
- package/dist/{row-DZ0Fnpc6.js → src-DmiUWOLp.js} +2 -1
- package/dist/{src-CHp3QyqB.js → src-S84ef4e3.js} +9177 -3377
- package/dist/substrate-admin.js +17 -782
- package/dist/substrate.js +4 -5487
- package/dist/testing.d.ts +730 -53
- package/dist/testing.js +20 -163
- package/dist/{ws-C72iVS5T.d.ts → ws-BT8kL1IF.d.ts} +4 -5
- package/package.json +26 -26
- package/dist/dataset-BQ8egGl5.js +0 -1535
- package/dist/schema-g4FQLr0V.d.ts +0 -433
- package/dist/src-CXKnqeTW.js +0 -2339
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
//#region ../../packages/substrate-client/src/script.ts
|
|
2
|
+
const DEFAULT_MAX_WRITES = 50;
|
|
3
|
+
const DEFAULT_MAX_PAGES = 200;
|
|
4
|
+
/** Counts the frames in a mutate payload: an array under an op-key is one frame per element. */
|
|
5
|
+
function frameCount(frame) {
|
|
6
|
+
return Object.values(frame).reduce((n, v) => n + (Array.isArray(v) ? v.length : 1), 0);
|
|
7
|
+
}
|
|
8
|
+
function assertKeys(frame, env, verb) {
|
|
9
|
+
const missing = Object.keys(frame).filter((k) => !(k in env.data));
|
|
10
|
+
if (missing.length > 0 || verb === "mutate" && (env.errors?.length ?? 0) > 0) {
|
|
11
|
+
const errs = (env.errors ?? []).map((e) => `${e.code ?? "error"}: ${e.message}`).join("; ");
|
|
12
|
+
throw new Error(`${verb} refused${missing.length > 0 ? ` for ${missing.join(", ")}` : ""}${errs !== "" ? ` (${errs})` : ""}`);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Runs `script` against a guarded context and reports everything it did,
|
|
17
|
+
* including the mutations applied before any failure.
|
|
18
|
+
*/
|
|
19
|
+
async function runScript(script, opts) {
|
|
20
|
+
const { client, kid, mode = "read", args = {}, maxWrites = 50, maxPages = DEFAULT_MAX_PAGES } = opts;
|
|
21
|
+
const log = opts.log ?? ((line) => console.error(line));
|
|
22
|
+
const mutations = [];
|
|
23
|
+
const warnings = [];
|
|
24
|
+
const stats = {
|
|
25
|
+
queries: 0,
|
|
26
|
+
writes: 0,
|
|
27
|
+
ms: 0
|
|
28
|
+
};
|
|
29
|
+
const started = Date.now();
|
|
30
|
+
const query = async (frame) => {
|
|
31
|
+
stats.queries++;
|
|
32
|
+
const env = await client.query(frame);
|
|
33
|
+
assertKeys(frame, env, "query");
|
|
34
|
+
for (const [key, page] of Object.entries(env._pagination ?? {})) if (page.hasMore) warnings.push(`${key}: result truncated (hasMore); use queryAll for a complete read`);
|
|
35
|
+
return env;
|
|
36
|
+
};
|
|
37
|
+
const ctx = {
|
|
38
|
+
kid,
|
|
39
|
+
mode,
|
|
40
|
+
args: Object.freeze({ ...args }),
|
|
41
|
+
query,
|
|
42
|
+
async queryAll(key, frame) {
|
|
43
|
+
const rows = [];
|
|
44
|
+
let cursor;
|
|
45
|
+
for (let page = 0; page < maxPages; page++) {
|
|
46
|
+
const params = {
|
|
47
|
+
...frame.params,
|
|
48
|
+
...cursor !== void 0 ? { cursor } : {}
|
|
49
|
+
};
|
|
50
|
+
stats.queries++;
|
|
51
|
+
const env = await client.query({ [key]: {
|
|
52
|
+
...frame,
|
|
53
|
+
params
|
|
54
|
+
} });
|
|
55
|
+
assertKeys({ [key]: frame }, env, "query");
|
|
56
|
+
const data = env.data[key];
|
|
57
|
+
rows.push(...Array.isArray(data) ? data : [data]);
|
|
58
|
+
const p = env._pagination?.[key];
|
|
59
|
+
if (p?.hasMore !== true) return rows;
|
|
60
|
+
if (p.nextCursor === void 0) throw new Error(`${key}: hasMore with no nextCursor`);
|
|
61
|
+
cursor = p.nextCursor;
|
|
62
|
+
}
|
|
63
|
+
throw new Error(`${key}: still hasMore after ${maxPages} pages`);
|
|
64
|
+
},
|
|
65
|
+
async recall({ query: to, row, ...params }) {
|
|
66
|
+
const fields = row === void 0 ? {} : { fields: {
|
|
67
|
+
id: true,
|
|
68
|
+
namespace: true,
|
|
69
|
+
type: true,
|
|
70
|
+
score: true,
|
|
71
|
+
kind: true,
|
|
72
|
+
expandedFrom: true,
|
|
73
|
+
row
|
|
74
|
+
} };
|
|
75
|
+
return (await query({ "recall/Hit": {
|
|
76
|
+
params: {
|
|
77
|
+
to,
|
|
78
|
+
...params
|
|
79
|
+
},
|
|
80
|
+
...fields
|
|
81
|
+
} })).data["recall/Hit"];
|
|
82
|
+
},
|
|
83
|
+
async schema(namespace, type) {
|
|
84
|
+
const all = await client.federatedSchema();
|
|
85
|
+
if (namespace === void 0) return all;
|
|
86
|
+
const ns = all[namespace];
|
|
87
|
+
if (ns === void 0) throw new Error(`schema: unknown namespace '${namespace}'`);
|
|
88
|
+
if (type === void 0) return ns;
|
|
89
|
+
const t = ns.types[type];
|
|
90
|
+
if (t === void 0) throw new Error(`schema: unknown type '${namespace}/${type}'`);
|
|
91
|
+
return t;
|
|
92
|
+
},
|
|
93
|
+
async mutate(frame) {
|
|
94
|
+
if (mode === "read") throw new Error("mutate refused: read mode (run in dry-run or write mode)");
|
|
95
|
+
if (mode === "dry-run") {
|
|
96
|
+
mutations.push({
|
|
97
|
+
frame,
|
|
98
|
+
applied: false
|
|
99
|
+
});
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
const n = frameCount(frame);
|
|
103
|
+
if (stats.writes + n > maxWrites) throw new Error(`mutate refused: ${stats.writes + n} frames would exceed --max-writes ${maxWrites}`);
|
|
104
|
+
const env = await client.mutate(frame);
|
|
105
|
+
const applied = Object.keys(frame).some((k) => k in env.data);
|
|
106
|
+
if (applied) stats.writes += n;
|
|
107
|
+
mutations.push({
|
|
108
|
+
frame,
|
|
109
|
+
applied,
|
|
110
|
+
...env.errors !== void 0 ? { errors: env.errors } : {}
|
|
111
|
+
});
|
|
112
|
+
assertKeys(frame, env, "mutate");
|
|
113
|
+
return env;
|
|
114
|
+
},
|
|
115
|
+
log: (...args) => log(args.map((a) => typeof a === "string" ? a : JSON.stringify(a)).join(" "))
|
|
116
|
+
};
|
|
117
|
+
const report = (extra) => {
|
|
118
|
+
stats.ms = Date.now() - started;
|
|
119
|
+
return {
|
|
120
|
+
...extra,
|
|
121
|
+
kid,
|
|
122
|
+
mode,
|
|
123
|
+
args,
|
|
124
|
+
mutations,
|
|
125
|
+
warnings,
|
|
126
|
+
stats
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
try {
|
|
130
|
+
return report({
|
|
131
|
+
ok: true,
|
|
132
|
+
result: await script(ctx)
|
|
133
|
+
});
|
|
134
|
+
} catch (err) {
|
|
135
|
+
return report({
|
|
136
|
+
ok: false,
|
|
137
|
+
error: err instanceof Error ? err.message : String(err)
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
//#endregion
|
|
143
|
+
export { runScript as n, DEFAULT_MAX_WRITES as t };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { pathToFileURL } from "node:url";
|
|
2
|
+
|
|
3
|
+
//#region src/mcp/script-runner.ts
|
|
4
|
+
/**
|
|
5
|
+
* Child entry for a sandboxed `run`: imports the script and hands its default
|
|
6
|
+
* export a ScriptContext whose every call goes to the parent over IPC. The
|
|
7
|
+
* child runs under `--permission` with no fs beyond this file and the script,
|
|
8
|
+
* no network, no child processes and no workers, so the store, reached through
|
|
9
|
+
* the parent, is all a script can touch.
|
|
10
|
+
*
|
|
11
|
+
* Imports node builtins only: any other import would need fs access the
|
|
12
|
+
* sandbox does not grant.
|
|
13
|
+
*/
|
|
14
|
+
const send = (m) => {
|
|
15
|
+
process.send?.(m);
|
|
16
|
+
};
|
|
17
|
+
const pending = /* @__PURE__ */ new Map();
|
|
18
|
+
let seq = 0;
|
|
19
|
+
function call(op, ...input) {
|
|
20
|
+
const id = ++seq;
|
|
21
|
+
return new Promise((resolve, reject) => {
|
|
22
|
+
pending.set(id, {
|
|
23
|
+
resolve,
|
|
24
|
+
reject
|
|
25
|
+
});
|
|
26
|
+
send({
|
|
27
|
+
type: "call",
|
|
28
|
+
id,
|
|
29
|
+
op,
|
|
30
|
+
input
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
process.on("message", (m) => {
|
|
35
|
+
if (m.type === "reply") {
|
|
36
|
+
const p = pending.get(m.id);
|
|
37
|
+
pending.delete(m.id);
|
|
38
|
+
if (m.ok) p?.resolve(m.value);
|
|
39
|
+
else p?.reject(new Error(m.error));
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
if (m.type === "start") start(m);
|
|
43
|
+
});
|
|
44
|
+
async function start(m) {
|
|
45
|
+
const s = Object.freeze({
|
|
46
|
+
kid: m.kid,
|
|
47
|
+
mode: m.mode,
|
|
48
|
+
args: Object.freeze({ ...m.args }),
|
|
49
|
+
query: (frame) => call("query", frame),
|
|
50
|
+
queryAll: (key, frame) => call("queryAll", key, frame),
|
|
51
|
+
recall: (input) => call("recall", input),
|
|
52
|
+
schema: (namespace, type) => call("schema", namespace, type),
|
|
53
|
+
mutate: (frame) => call("mutate", frame),
|
|
54
|
+
log: (...args) => {
|
|
55
|
+
call("log", ...args);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
try {
|
|
59
|
+
const mod = await import(pathToFileURL(m.script).href);
|
|
60
|
+
if (typeof mod.default !== "function") throw new Error("the script must default-export a function (s) => result");
|
|
61
|
+
const result = await mod.default(s);
|
|
62
|
+
send({
|
|
63
|
+
type: "done",
|
|
64
|
+
ok: true,
|
|
65
|
+
result
|
|
66
|
+
});
|
|
67
|
+
} catch (err) {
|
|
68
|
+
send({
|
|
69
|
+
type: "done",
|
|
70
|
+
ok: false,
|
|
71
|
+
error: err instanceof Error ? err.message : String(err)
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
//#endregion
|
|
77
|
+
export { };
|
package/dist/sdk.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { C as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { a as
|
|
5
|
-
import { a as
|
|
6
|
-
import { $ as NlJudgeStep, 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, Q as NlJudgeChoice, R as makeAuthorizationProvider, S as expandFlat, T as grantIsUniform, U as AdminCredential, V as describeGrant, W as AdminEnv, X as NlEvidence, Y as NlAskResult, Z as NlJudgeAction, _ as newlyGrantedPairs, a as denyAll, at as NlPackType, b as capabilitiesFor, c as requireIdentity, ct as NlParsedData, d as KeyUpdateRefusal, dt as NlValueAlias, et as NlJudgedStatus, f as checkRevocable, ft as NlWireEvent, g as newlyGranted, gt as Query, h as grantEntriesConfer, ht as NLVocabularyHint, i as allowVerbs, it as NlPackField, j as not, k as encodeList, l as requireNamespace, lt as NlServedPack, m as grantCovers, mt as NLResult, n as row, nt as NlNamespaceRulings, o as denyVerbs, ot as NlPackValueRef, p as checkUpdatable, pt as NLBase, q as resolveDefaultKidPath, r as allowAll, rt as NlOutcome, s as requireCapability, st as NlParseStatus, t as applyRowFilters, tt as NlNamespacePack, u as KeyMutationRefusal, ut as NlTrailEvent, v as revokedAtIso, w as grantEntryError, x as encodeGrant, y as Grant, z as makeTokenProvider } from "./row-ByLFE2Wx.js";
|
|
1
|
+
import { $ as VirtualMutationDef, $t as WalkAgg, A as KernelLifecycleContext, An as OnMissing, At as DatasetRegistry, B as NamespaceTypeDef, Bn as WriteRow, Bt as IndexPlan, C as EmbedSourceContext, Cn as CanDeleteResult, Ct as RowFilterObligation, D as FilterOperatorDef, Dn as EdgeWriteInput, Dt as ConditionalUpdateResult, E as EngineInput, En as EdgeRef, Et as AggFn, F as KernelRouteClaim, Fn as IdentityKind, Ft as FilterCapabilities, G as Registry, Gt as ReadParams, H as PluginRouteContext, Ht as OrderByClause, I as McpToolRegistration, In as ROW_METADATA_FIELDS, It as FilterWriteLimits, J as RegistryEntryInput, Jt as StorageReport, K as RegistryBase, Kt as ReadResult, L as NamespaceConfig, Ln as Row, Lt as FilterWriteOptions, M as KernelMigrationContext, Mn as CLIENT_SUPPLIED_SERVER_FIELD, Mt as DropResult, N as KernelNamespaceContribution, Nn as ClientSuppliedServerFieldError, Nt as FieldKind, O as FrameEntry, On as EdgesStore, Ot as DEFAULT_FILTER_WRITE_LIMITS, P as KernelPlugin, Pn as Id, Pt as FieldPredicate, Q as ScheduledTaskContext, Qt as UpdateFieldRef, R as NamespaceDefinition, Rn as RowMetadata, Rt as FilterWriteResult, S as DropParticipant, Sn as FunctionSig, St as ResolverReturn, T as EngineHandle, Tn as EdgePatch, Tt as WriteEvent, U as PostWriteHook, Ut as PoolStats, V as PluginLifecycleContext, Vn as assertNoRepeatedIds, Vt as NestedSelection, W as QualifiedFrame, Wt as PromotionEvent, X as RegistryEntryResolver, Xt as TypeIndexState, Y as RegistryEntryKind, Yt as TxScopeHandles, Z as ScheduledTask, Zt as TypeStorageReport, _ as naturalOrderOf, _n as EXPR_AGGREGATES, _t as PolicyDecision, a as FieldDefCrossRef, an as WriteOptions, at as RequestObserver, b as CommittedWritesHook, bn as Expr, bt as Resolver, c as FieldDefStruct, cn as ResolveObservation, ct as SubstrateRequest, d as OrderedBy, dn as RuntimeErrors, dt as TlsConfig, en as WalkAggOperand, et as VirtualTypeDef, f as PackEnvelope, fn as RuntimeMetrics, ft as AfterTxWork, g as isColumnField, gn as DATE_UNITS, gt as Policy, h as TypeSchema, hn as ArgType, ht as Obligation, i as FieldDef, in as WhereClause, it as RequestObservation, j as KernelMigration, jn as ActorIdentity, jt as DeleteResult, k as IndexDecl, kn as OnDelete, kt as Dataset, l as FieldInput, ln as ResolverStat, lt as SubstrateResponse, m as Schema, mn as TypeStats, mt as Identity, n as Dropped, nn as WalkNode, nt as HttpMethod, o as FieldDefList, on as WriteResult, ot as RuntimeOp, p as PlanClause, pn as SlowRequest, pt as AutoCrudVerb, q as RegistryEntry, qt as RefOperand, r as EnvelopeShape, rn as WalkPick, rt as PluginRouter, s as FieldDefScalar, sn as ProcessStat, st as StartOpts, t as DEFAULT_ORDERED_BY, tn as WalkAggPredicate, tt as HttpHandler, u as MutationSchema, un as RuntimeErrorEntry, ut as SubstrateServer, v as BatchResolver, vn as EXPR_FUNCTIONS, vt as PolicyProbeContext, w as EncodeContext, wn as Edge, wt as TypedResolver, x as CoordinatorPlugin, xn as ExprType, xt as ResolverArgs, y as CommittedWriteBatch, yn as EXPR_LIMITS, yt as RequestContext, z as NamespaceInstallContext, zn as RowMetadataField, zt as FrameAgg } from "./schema-laGLMvMC.js";
|
|
2
|
+
import { i as BridgeFrame, n as BridgeCredential, r as BridgeCredentialStore, t as BridgeClient } from "./bridge-BhiJKwfF.js";
|
|
3
|
+
import { C as isBatchElementError, S as isAuthCause, T as isRestrictViolation, _ as WALKS_NEED_PARTITIONED, a as NamespaceMismatch, b as WALK_UNSUPPORTED_REF, c as ROW_POLICY_BLOCKS_WALK, d as RestrictViolation, f as STORE_BUSY, g as WALKS_IN_SUBSCRIPTION, h as WALKS_IN_MUTATION, i as MissingReferentError, l as ReservedField, m as VALUE_OUT_OF_RANGE, n as BridgeUnreachableError, o as QUERY_TIMEOUT, p as UnsupportedFilterError, r as FILTER_TOO_BROAD, s as REGEX_BUDGET_EXCEEDED, t as BatchElementError, u as ResolverFrameError, v as WALKS_UNSUPPORTED_STORE, w as isResolverFrameError, x as filterTooBroad, y as WALK_BUDGET_EXCEEDED } from "./errors-CYOaWZ8l.js";
|
|
4
|
+
import { a as WsResponseFrame, c as ResolveTarget, d as TargetState, f as IdempotencyStore, i as WsRequestFrame, l as SweepDeps, n as WS_REASON_SERVER_RESTART, o as WsResponseKind, r as WS_REASON_SUBSCRIPTION_OVERLOADED, s as BridgeRegistry, t as WS_CODE_SUBSCRIPTION_UNSUPPORTED_FRAME, u as SweepState } from "./ws-BT8kL1IF.js";
|
|
5
|
+
import { $ as NlJudgeAction, 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 NlAggregate, K as resolveDefaultKeyPath, L as isEncryptedKey, M as or, N as ADMIN_CAPABILITIES, O as decodeList, P as DEFAULT_CAPABILITIES, Q as NlFieldPhrase, R as makeAuthorizationProvider, S as expandFlat, T as grantIsUniform, U as AdminCredential, V as describeGrant, W as AdminEnv, X as NlAskResult, Y as NlAskRequest, Z as NlEvidence, _ as newlyGrantedPairs, _t as NLVocabularyHint, a as denyAll, at as NlOutcome, b as capabilitiesFor, c as requireIdentity, ct as NlPackValueRef, d as KeyUpdateRefusal, dt as NlServedPack, et as NlJudgeChoice, f as checkRevocable, ft as NlTrailEvent, g as newlyGranted, gt as NLResult, h as grantEntriesConfer, ht as NLBase, i as allowVerbs, it as NlNamespaceRulings, j as not, k as encodeList, l as requireNamespace, lt as NlParseStatus, m as grantCovers, mt as NlWireEvent, n as row, nt as NlJudgedStatus, o as denyVerbs, ot as NlPackField, p as checkUpdatable, pt as NlValueAlias, q as resolveDefaultKidPath, r as allowAll, rt as NlNamespacePack, s as requireCapability, st as NlPackType, t as applyRowFilters, tt as NlJudgeStep, u as KeyMutationRefusal, ut as NlParsedData, v as revokedAtIso, vt as Query, w as grantEntryError, x as encodeGrant, y as Grant, z as makeTokenProvider } from "./row-CfsHSEfB.js";
|
|
7
6
|
//#region ../../packages/substrate-types/src/assert-never.d.ts
|
|
8
7
|
/**
|
|
9
8
|
* Exhaustiveness guard for the `default:` arm of a `switch` over a
|
|
@@ -104,6 +103,43 @@ export declare function confersAnywhere(resolved: IdentityGrant | null, capabili
|
|
|
104
103
|
/** Every capability conferred anywhere — the union, for error messages only. */
|
|
105
104
|
export declare function allCapabilities(resolved: IdentityGrant | null): string[];
|
|
106
105
|
//#endregion
|
|
106
|
+
//#region ../../packages/substrate-types/src/int64.d.ts
|
|
107
|
+
/**
|
|
108
|
+
* An `int64` operand or write value as a bigint: a bigint, a safe-integer
|
|
109
|
+
* number, or a canonical decimal string, within the int64 range. Anything else
|
|
110
|
+
* (a float, a number past 2^53, `'007'`, `'1e3'`, an out-of-range value) is
|
|
111
|
+
* `undefined`.
|
|
112
|
+
*/
|
|
113
|
+
export declare function parseInt64(v: unknown): bigint | undefined;
|
|
114
|
+
/** Whether `v` is an `int16` value: an integer number within the int16 range. */
|
|
115
|
+
export declare function isInt16(v: unknown): v is number;
|
|
116
|
+
/** Whether `v` is an `int32` value: an integer number within the int32 range. */
|
|
117
|
+
export declare function isInt32(v: unknown): v is number;
|
|
118
|
+
/**
|
|
119
|
+
* `JSON.stringify` that writes a bigint as a decimal string, so an `int64`
|
|
120
|
+
* keeps every digit on the JSON wire. The plain call runs first, so a value
|
|
121
|
+
* with no bigint pays nothing for the replacer.
|
|
122
|
+
*/
|
|
123
|
+
export declare function stringifyJson(value: unknown): string;
|
|
124
|
+
/**
|
|
125
|
+
* Like {@link stringifyJson}, but a bigint is written as an exact JSON number
|
|
126
|
+
* (`9223372036854775807`, not a string), for a jsonb body that `substrate_num`
|
|
127
|
+
* reads back as the number it is.
|
|
128
|
+
*/
|
|
129
|
+
export declare function stringifyJsonExact(value: unknown): string;
|
|
130
|
+
//#endregion
|
|
131
|
+
//#region ../../packages/substrate-types/src/iso-timestamp.d.ts
|
|
132
|
+
/**
|
|
133
|
+
* `v` as `YYYY-MM-DDTHH:MM:SS[.ffffff](Z|±HH:MM)`, or `undefined` when it is
|
|
134
|
+
* outside the grammar or names a day that does not exist (Feb 30, year 0000).
|
|
135
|
+
* No offset is read as UTC, and a date alone as its midnight UTC.
|
|
136
|
+
*/
|
|
137
|
+
export declare function normalizeIsoTimestamp(v: string): string | undefined;
|
|
138
|
+
/** Is `v` a timestamp every dataset reads to the same instant? */
|
|
139
|
+
export declare function isIsoTimestamp(v: string): boolean;
|
|
140
|
+
/** Does `v` have the grammar's shape but name a day that does not exist (Feb 30, month 13, year 0000)? */
|
|
141
|
+
export declare function isImpossibleIsoTimestamp(v: string): boolean;
|
|
142
|
+
//#endregion
|
|
107
143
|
//#region ../../packages/substrate-types/src/keyed-mutex.d.ts
|
|
108
144
|
/**
|
|
109
145
|
* A process-local mutual-exclusion lock per string key.
|
|
@@ -138,13 +174,24 @@ export declare const METADATA_AUTHOR_FIELDS: {
|
|
|
138
174
|
readonly kind: 'updatedByKind';
|
|
139
175
|
};
|
|
140
176
|
};
|
|
177
|
+
/**
|
|
178
|
+
* The far side of a walk hop (`{ in }` / `{ out }`): its fields and its own
|
|
179
|
+
* hops, or undefined when the hop does not resolve (the validator refuses it).
|
|
180
|
+
*/
|
|
181
|
+
export type MetadataHop = (node: Record<string, unknown>) => {
|
|
182
|
+
fields: Record<string, FieldDef>;
|
|
183
|
+
hop: MetadataHop;
|
|
184
|
+
} | undefined;
|
|
185
|
+
/** A `_walk` / `_agg` node with its `where` rewritten against the far type. */
|
|
186
|
+
export declare function normaliseWalkNode(node: unknown, hop: MetadataHop | undefined): unknown;
|
|
141
187
|
/**
|
|
142
188
|
* Rewrites every metadata spelling in a `where` clause onto the canonical
|
|
143
|
-
* columns, through AND / OR / NOT
|
|
144
|
-
*
|
|
145
|
-
*
|
|
189
|
+
* columns, through AND / OR / NOT and, given `hop`, into each `_walk` / `_agg`
|
|
190
|
+
* against its far type. A name the type declares as a field of its own is
|
|
191
|
+
* left alone, and so is anything that is not a metadata spelling, for the
|
|
192
|
+
* validator to judge.
|
|
146
193
|
*/
|
|
147
|
-
export declare function normaliseMetadataWhere(where: unknown, fieldDefs: Record<string, FieldDef
|
|
194
|
+
export declare function normaliseMetadataWhere(where: unknown, fieldDefs: Record<string, FieldDef>, hop?: MetadataHop): unknown;
|
|
148
195
|
/** Rewrites metadata spellings in an `orderBy` list; an author name sorts by its id. */
|
|
149
196
|
export declare function normaliseMetadataOrderBy(orderBy: unknown, fieldDefs: Record<string, FieldDef>): unknown;
|
|
150
197
|
//#endregion
|
|
@@ -337,6 +384,43 @@ interface TypeInput {
|
|
|
337
384
|
lexical?: {
|
|
338
385
|
source: (row: Row) => string | null | undefined | Promise<string | null | undefined>;
|
|
339
386
|
};
|
|
387
|
+
/**
|
|
388
|
+
* Composite and unique indexes, built by the engine with the filter
|
|
389
|
+
* compiler's own expressions. Keys and predicate fields must be declared
|
|
390
|
+
* scalar (not json) or crossRef fields. See `IndexDecl`.
|
|
391
|
+
*/
|
|
392
|
+
indexes?: IndexDecl[];
|
|
393
|
+
/**
|
|
394
|
+
* The type's natural order: what a read with no `orderBy` returns. Exactly
|
|
395
|
+
* one key, a declared date or number field or a metadata column
|
|
396
|
+
* (`createdAt`, `updatedAt`, or `seq` on a visible-order type). Absent
|
|
397
|
+
* means newest first by `createdAt`.
|
|
398
|
+
*/
|
|
399
|
+
orderedBy?: OrderedBy;
|
|
400
|
+
/**
|
|
401
|
+
* `'visible'`: each inserted row gets `_metadata.seq`, strictly increasing
|
|
402
|
+
* per type in commit order, so a reader paging by `seq` never sees a higher
|
|
403
|
+
* seq before a lower one becomes visible. An upsert of an existing row keeps
|
|
404
|
+
* its seq. `seq` is filterable, sortable, and valid in `orderedBy`.
|
|
405
|
+
*
|
|
406
|
+
* Cost: writes to the type are serialised. Each insert holds a per-type
|
|
407
|
+
* transaction lock from seq assignment to commit, so one writer's open
|
|
408
|
+
* transaction blocks every other writer of the type until it ends. Other
|
|
409
|
+
* types are unaffected and pay nothing.
|
|
410
|
+
*
|
|
411
|
+
* Two transactions that write two visible-order types in opposite orders
|
|
412
|
+
* can deadlock; Postgres aborts one with 40P01. Write them in a consistent
|
|
413
|
+
* order.
|
|
414
|
+
*
|
|
415
|
+
* Making an existing type visible assigns no seq to its old rows: they keep
|
|
416
|
+
* a null seq and sort after every new row.
|
|
417
|
+
*/
|
|
418
|
+
ordering?: 'visible';
|
|
419
|
+
/**
|
|
420
|
+
* Expected size. `large` lets the index advisor recommend for this type
|
|
421
|
+
* from its profile's lower `minRowsLargeHint` rather than `minRows`.
|
|
422
|
+
*/
|
|
423
|
+
expectedSize?: 'small' | 'large';
|
|
340
424
|
}
|
|
341
425
|
interface DefineNamespaceOptions {
|
|
342
426
|
/**
|
|
@@ -349,31 +433,20 @@ interface DefineNamespaceOptions {
|
|
|
349
433
|
* consumer (`nl` for substrate-nl's rulings). Must be JSON-serialisable.
|
|
350
434
|
*/
|
|
351
435
|
annotations?: Record<string, unknown>;
|
|
352
|
-
/**
|
|
436
|
+
/**
|
|
437
|
+
* @deprecated Ignored: every declared scalar is a column of its type's
|
|
438
|
+
* table already. See `NamespaceDefinition.promotedColumns`.
|
|
439
|
+
*/
|
|
353
440
|
promotedColumns?: NamespaceDefinition['promotedColumns'];
|
|
354
441
|
}
|
|
355
442
|
export declare function defineNamespace(namespace: string, types: Record<string, TypeInput>, opts?: DefineNamespaceOptions): NamespaceDefinition;
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
interface CreateResolverOptions {
|
|
359
|
-
/** Type field definitions. Used to detect readonly fields and drive shortId allocation. */
|
|
360
|
-
fields?: Record<string, FieldDef>;
|
|
361
|
-
}
|
|
362
|
-
export declare function createResolver<T extends Row = Row>(typeName: string, dataset: Dataset, options?: CreateResolverOptions): TypedResolver<T>;
|
|
363
|
-
//#endregion
|
|
364
|
-
//#region ../../packages/substrate-sdk/src/autocrud/autocrud-delete.d.ts
|
|
443
|
+
/** Throws unless every key is a btree-indexable declared field or `createdAt`/`updatedAt`, and every predicate field a declared one. */
|
|
444
|
+
export declare function assertIndexDecl(typeName: string, fields: Record<string, FieldDef>, decl: IndexDecl): void;
|
|
365
445
|
/**
|
|
366
|
-
*
|
|
367
|
-
*
|
|
368
|
-
* gymnastics — the autoCRUD registration path wants the common `Row | Row[]`
|
|
369
|
-
* return type.
|
|
446
|
+
* Throws unless `orderedBy` is one key, on a date or number field or a metadata
|
|
447
|
+
* column; `seq` only on a type declared `ordering: 'visible'`.
|
|
370
448
|
*/
|
|
371
|
-
|
|
372
|
-
id: Id;
|
|
373
|
-
deleted: boolean;
|
|
374
|
-
[field: string]: unknown;
|
|
375
|
-
}
|
|
376
|
-
export declare function deleteResolver(typeName: string, dataset: Dataset, edges: EdgesStore): TypedResolver<DeleteResolverResult>;
|
|
449
|
+
export declare function assertOrderedBy(typeName: string, def: Pick<TypeInput, 'fields' | 'orderedBy' | 'ordering'>): void;
|
|
377
450
|
//#endregion
|
|
378
451
|
//#region ../../packages/substrate-sdk/src/autocrud/autocrud-get.d.ts
|
|
379
452
|
export declare function getResolver<T extends Row = Row>(typeName: string, dataset: Dataset): TypedResolver<T | null>;
|
|
@@ -391,7 +464,8 @@ interface PurgeResolverResult {
|
|
|
391
464
|
purged: boolean;
|
|
392
465
|
[field: string]: unknown;
|
|
393
466
|
}
|
|
394
|
-
|
|
467
|
+
/** With `policy`, a row its row filters hide is left in place and answers `purged: false`. */
|
|
468
|
+
export declare function purgeResolver(typeName: string, dataset: Dataset, policy?: Policy): TypedResolver<PurgeResolverResult>;
|
|
395
469
|
//#endregion
|
|
396
470
|
//#region ../../packages/substrate-sdk/src/autocrud/autocrud-update.d.ts
|
|
397
471
|
interface UpdateResolverOptions {
|
|
@@ -412,21 +486,106 @@ interface UpdateResolverOptions {
|
|
|
412
486
|
* checks; this owns the metadata idiom so it stays single-sourced.
|
|
413
487
|
*/
|
|
414
488
|
export declare function applyUpdatePatch(ds: Dataset, typeName: string, rowId: Id, patchFields: Record<string, unknown>, ctx: RequestContext, onWrite?: ResolverArgs['onWrite']): Promise<Row | null>;
|
|
415
|
-
|
|
489
|
+
//#endregion
|
|
490
|
+
//#region ../../packages/substrate-sdk/src/autocrud/autocrud-delete.d.ts
|
|
491
|
+
/**
|
|
492
|
+
* Delete resolver return shape. Carries the row's string index signature so
|
|
493
|
+
* it slots into `Row` (which has `[field: string]: unknown`) without cast
|
|
494
|
+
* gymnastics — the autoCRUD registration path wants the common `Row | Row[]`
|
|
495
|
+
* return type.
|
|
496
|
+
*/
|
|
497
|
+
interface DeleteResolverResult {
|
|
498
|
+
id: Id;
|
|
499
|
+
deleted: boolean;
|
|
500
|
+
[field: string]: unknown;
|
|
501
|
+
}
|
|
502
|
+
//#endregion
|
|
503
|
+
//#region ../../packages/substrate-sdk/src/autocrud/batch.d.ts
|
|
504
|
+
interface BatchResolverOptions {
|
|
505
|
+
/** The type's field definitions: validation, crossRefs and shortId allocation. */
|
|
506
|
+
fields?: Record<string, FieldDef>;
|
|
507
|
+
/** Update and delete: a row the policy's row filters hide answers as missing. */
|
|
508
|
+
policy?: Policy;
|
|
509
|
+
/** Create and update: runs per written row once the transaction commits. */
|
|
510
|
+
postWrite?: PostWriteHook;
|
|
511
|
+
}
|
|
512
|
+
/** `create<T>` without crossRef edges: the batch resolver with `edges: null`, one element. */
|
|
513
|
+
export declare function createResolver<T extends Row = Row>(typeName: string, dataset: Dataset, options?: Pick<BatchResolverOptions, 'fields'>): TypedResolver<T>;
|
|
514
|
+
/** `update<T>`: the batch resolver with one element. */
|
|
515
|
+
export declare function updateResolver<T extends Row = Row>(typeName: string, dataset: Dataset, edges: EdgesStore, options?: Pick<BatchResolverOptions, 'fields'>): TypedResolver<T | null>;
|
|
516
|
+
/** `delete<T>`: the batch resolver with one element. */
|
|
517
|
+
export declare function deleteResolver(typeName: string, dataset: Dataset, edges: EdgesStore, options?: Pick<BatchResolverOptions, 'policy'>): TypedResolver<DeleteResolverResult>;
|
|
518
|
+
//#endregion
|
|
519
|
+
//#region ../../packages/substrate-sdk/src/autocrud/filter-writes.d.ts
|
|
520
|
+
/**
|
|
521
|
+
* `count` is every row changed. `ids` are the changed ids in ascending order,
|
|
522
|
+
* compared as strings code unit by code unit, cut to the first `idsCap`; so
|
|
523
|
+
* the same rows give the same ids on every path and dataset, whatever order
|
|
524
|
+
* the store returned them in. `idsTruncated` says whether more changed.
|
|
525
|
+
*/
|
|
526
|
+
interface FilterWriteMutationResult {
|
|
527
|
+
count: number;
|
|
528
|
+
ids: Id[];
|
|
529
|
+
idsTruncated: boolean;
|
|
530
|
+
}
|
|
531
|
+
interface FilterWriteResolverOptions extends BatchResolverOptions {
|
|
532
|
+
/**
|
|
533
|
+
* Whether the type's single-row counterpart (`update<T>` for updateMany,
|
|
534
|
+
* `delete<T>` for deleteMany) is still autoCRUD's own entry. When a plugin
|
|
535
|
+
* replaced it with custom logic, writing by filter would bypass that, so the
|
|
536
|
+
* resolver refuses. Absent: served.
|
|
537
|
+
*/
|
|
538
|
+
ownsSingleRowWrite?: () => boolean;
|
|
539
|
+
}
|
|
540
|
+
/** `updateMany<T>`: `set` merged into every live row `where` matches. */
|
|
541
|
+
export declare function updateManyResolver(typeName: string, dataset: Dataset, edges: EdgesStore, opts?: FilterWriteResolverOptions): TypedResolver<FilterWriteMutationResult>;
|
|
542
|
+
/** `deleteMany<T>`: tombstones every live row `where` matches, behind the restrict gate. */
|
|
543
|
+
export declare function deleteManyResolver(typeName: string, dataset: Dataset, edges: EdgesStore, opts?: Pick<FilterWriteResolverOptions, 'policy' | 'ownsSingleRowWrite'>): TypedResolver<FilterWriteMutationResult>;
|
|
416
544
|
//#endregion
|
|
417
545
|
//#region ../../packages/substrate-sdk/src/autocrud/index.d.ts
|
|
546
|
+
/**
|
|
547
|
+
* The narrow surface `installAutoCrud` needs from a registry. The core
|
|
548
|
+
* `Registry` class satisfies this structurally.
|
|
549
|
+
*
|
|
550
|
+
* Resolver signature matches the core `Resolver` type exactly — typed against
|
|
551
|
+
* `(ctx, args) => Promise<Row | Row[] | null>` so autocrud's `get` can surface
|
|
552
|
+
* null without sentinel gymnastics.
|
|
553
|
+
*/
|
|
418
554
|
export type AutoCrudResolver = (ctx: RequestContext, args: ResolverArgs) => Promise<Row | Row[] | ReadResult | null>;
|
|
419
555
|
export interface AutoCrudRegistry {
|
|
420
556
|
register(typeName: string, input: {
|
|
421
557
|
resolver: AutoCrudResolver;
|
|
558
|
+
/** Set-wise resolver for a mutate array of this mutation. */
|
|
559
|
+
batch?: BatchResolver;
|
|
422
560
|
policy?: Policy;
|
|
423
561
|
fields?: Record<string, FieldDef>;
|
|
424
562
|
kind?: 'type' | 'mutation';
|
|
425
563
|
params?: Record<string, FieldDef>;
|
|
426
564
|
returns?: FieldDef;
|
|
565
|
+
orderedBy?: OrderedBy;
|
|
566
|
+
indexes?: IndexDecl[];
|
|
567
|
+
expectedSize?: 'small' | 'large';
|
|
427
568
|
/** Semantic autoCRUD verb threaded to policies via ctx.verb. */
|
|
428
569
|
verb?: AutoCrudVerb;
|
|
570
|
+
/** The type a by-filter mutation writes; the engine validates its `where`. */
|
|
571
|
+
filterTarget?: string;
|
|
429
572
|
}): void;
|
|
573
|
+
/** When present, lets `installAutoCrud` refuse a type whose keys collide with another's. */
|
|
574
|
+
get?(typeName: string): {
|
|
575
|
+
kind?: string;
|
|
576
|
+
resolver: object;
|
|
577
|
+
} | undefined;
|
|
578
|
+
}
|
|
579
|
+
/**
|
|
580
|
+
* A namespace declares both `X` and `ManyX`: `X`'s `updateManyX` /
|
|
581
|
+
* `deleteManyX` are `ManyX`'s `update<T>` / `delete<T>` keys.
|
|
582
|
+
*/
|
|
583
|
+
export declare class AutoCrudNameCollisionError extends Error {
|
|
584
|
+
readonly namespace: string;
|
|
585
|
+
readonly type: string;
|
|
586
|
+
readonly other: string;
|
|
587
|
+
readonly name = "AutoCrudNameCollisionError";
|
|
588
|
+
constructor(namespace: string, type: string, other: string);
|
|
430
589
|
}
|
|
431
590
|
export interface InstallAutoCrudOptions {
|
|
432
591
|
/** Field definitions for the type — passed through to the registry entry. */
|
|
@@ -452,6 +611,12 @@ export interface InstallAutoCrudOptions {
|
|
|
452
611
|
* Delete resolver does NOT invoke this hook.
|
|
453
612
|
*/
|
|
454
613
|
postWrite?: PostWriteHook;
|
|
614
|
+
/** The type's natural order — published on the type entry's schema. */
|
|
615
|
+
orderedBy?: OrderedBy;
|
|
616
|
+
/** Declared indexes, kept on the type entry for storage to build (proposed types). */
|
|
617
|
+
indexes?: IndexDecl[];
|
|
618
|
+
/** Size hint, kept on the type entry for the index advisor (proposed types). */
|
|
619
|
+
expectedSize?: 'small' | 'large';
|
|
455
620
|
}
|
|
456
621
|
export interface CreateResolverWithEdgesOptions {
|
|
457
622
|
/** Field definitions for the type — crossRef entries drive edge emission. */
|
|
@@ -484,6 +649,12 @@ export declare function installAutoCrud(registry: AutoCrudRegistry, typeName: st
|
|
|
484
649
|
//#endregion
|
|
485
650
|
//#region ../../packages/substrate-sdk/src/autocrud/reserved.d.ts
|
|
486
651
|
export declare const RESERVED_AUTOCRUD_FIELDS: Record<string, FieldDef>;
|
|
652
|
+
/** Is `def` a descriptor autoCRUD injected, rather than a body field of the same name? */
|
|
653
|
+
export declare function isReservedAutoCrudField(def: FieldDef): boolean;
|
|
654
|
+
/** The server metadata names a body field may not take: expressions, where and orderBy read them as metadata. */
|
|
655
|
+
export declare const RESERVED_METADATA_FIELD_NAMES: readonly string[];
|
|
656
|
+
/** Why a field of this name cannot be declared, or undefined when it can. */
|
|
657
|
+
export declare function reservedMetadataFieldMessage(name: string): string | undefined;
|
|
487
658
|
/** Reserved field names — useful for validation loops. */
|
|
488
659
|
export declare const RESERVED_AUTOCRUD_FIELD_NAMES: string[];
|
|
489
660
|
//#endregion
|
|
@@ -575,6 +746,12 @@ export declare function queryOne<T>(engine: EngineHandle, namespace: string, typ
|
|
|
575
746
|
//#endregion
|
|
576
747
|
//#region ../../packages/substrate-sdk/src/field.d.ts
|
|
577
748
|
interface ScalarFieldOptions {
|
|
749
|
+
/**
|
|
750
|
+
* `true` builds a btree for this field. Leave it unset for no index: the
|
|
751
|
+
* field still filters and sorts, by scanning. `false` also means no index,
|
|
752
|
+
* and marks the field as not a search handle (long-form prose), so NL
|
|
753
|
+
* leaves it out.
|
|
754
|
+
*/
|
|
578
755
|
indexed?: boolean;
|
|
579
756
|
nullable?: boolean;
|
|
580
757
|
/**
|
|
@@ -632,9 +809,9 @@ interface StructFieldOptions {
|
|
|
632
809
|
}
|
|
633
810
|
interface ListFieldOptions {
|
|
634
811
|
/**
|
|
635
|
-
*
|
|
636
|
-
*
|
|
637
|
-
*
|
|
812
|
+
* Back the list field's `has` (element-membership) filter with a GIN, which
|
|
813
|
+
* the substrate binary derives as a tracked migration at boot — no per-field
|
|
814
|
+
* migration to author. Without it `has` still works, by scanning.
|
|
638
815
|
* Default false. See `FieldDefList.indexed`.
|
|
639
816
|
*/
|
|
640
817
|
indexed?: boolean;
|
|
@@ -661,6 +838,19 @@ interface JsonFieldOptions {
|
|
|
661
838
|
export declare const field: {
|
|
662
839
|
string(opts?: ScalarFieldOptions): FieldDefScalar;
|
|
663
840
|
number(opts?: ScalarFieldOptions): FieldDefScalar;
|
|
841
|
+
/**
|
|
842
|
+
* Integers: pick the narrowest kind whose range holds every value the field
|
|
843
|
+
* will EVER take, because a kind cannot change once rows exist (moving means
|
|
844
|
+
* a new field and a backfill). All three filter, sort and sum as exact
|
|
845
|
+
* integers; they differ in storage width.
|
|
846
|
+
* int16 -32768 to 32767, 2 bytes: small codes, flags, ages, percentages.
|
|
847
|
+
* int32 about ±2.1 billion, 4 bytes: counts, durations, ids within one source.
|
|
848
|
+
* int64 about ±9.2e18, 8 bytes, a decimal string on the wire past 2^53: totals, epoch-ms, external ids.
|
|
849
|
+
* Use `number` for fractional values. When unsure, take the next width up.
|
|
850
|
+
*/
|
|
851
|
+
int16(opts?: ScalarFieldOptions): FieldDefScalar;
|
|
852
|
+
int32(opts?: ScalarFieldOptions): FieldDefScalar;
|
|
853
|
+
int64(opts?: ScalarFieldOptions): FieldDefScalar;
|
|
664
854
|
boolean(opts?: ScalarFieldOptions): FieldDefScalar;
|
|
665
855
|
date(opts?: DateFieldOptions): FieldDefScalar;
|
|
666
856
|
enum(values: readonly string[], opts?: ScalarFieldOptions): FieldDefScalar;
|
|
@@ -679,8 +869,7 @@ export declare const field: {
|
|
|
679
869
|
* JSON body. Value round-trips unchanged. Filter a value INSIDE it with a
|
|
680
870
|
* path predicate — `{ values: { path: ['year'], gt: 1990 } }` — which is
|
|
681
871
|
* type-strict. `eq` / `in` / `has` are index-served only with
|
|
682
|
-
* `{ indexed: true }`; everything else scans the type's rows
|
|
683
|
-
* `_allowTableScan`. No ordering. When inner keys are known at schema time,
|
|
872
|
+
* `{ indexed: true }`; everything else scans the type's rows. No ordering. When inner keys are known at schema time,
|
|
684
873
|
* `field.struct` is still the better fit: declared, indexed, orderable.
|
|
685
874
|
*/
|
|
686
875
|
json(opts?: JsonFieldOptions): FieldDefScalar;
|
|
@@ -697,4 +886,4 @@ export declare function resolveEntityId(dataset: Dataset, type: string, input: I
|
|
|
697
886
|
*/
|
|
698
887
|
export declare function resolveEntityRow(dataset: Dataset, type: string, input: Id): Promise<Row | null>;
|
|
699
888
|
//#endregion
|
|
700
|
-
export { ADMIN_CAPABILITIES, ActorIdentity, type AdminCredential, type AdminEnv, AfterTxWork, AutoCrudVerb, BridgeClient, BridgeCredential, BridgeCredentialStore, BridgeFrame, BridgeRegistry, BridgeUnreachableError, CLIENT_SUPPLIED_SERVER_FIELD, CanDeleteResult, ClientSuppliedServerFieldError, ConditionalUpdateResult, CoordinatorPlugin, type CrossRefFieldOptions, DEFAULT_CAPABILITIES, Dataset, DatasetRegistry, type DateFieldOptions, type DefineNamespaceOptions, DeleteResult, type DeleteRowArgs, type DeleteRowResult, DropParticipant, DropResult, Edge, EdgePatch, EdgeRef, EdgeWriteInput, EdgesStore, EmbedSourceContext, EncodeContext, EngineHandle, EngineInput, EnvelopeShape, FieldDef, FieldDefCrossRef, FieldDefList, FieldDefScalar, FieldDefStruct, FieldInput, FieldKind, FieldPredicate, FilterCapabilities, FilterOperatorDef, FrameEntry, type Grant, HttpHandler, HttpMethod, Id, IdempotencyStore, Identity, IdentityKind, type JsonFieldOptions, KernelLifecycleContext, KernelMigration, KernelMigrationContext, KernelNamespaceContribution, KernelPlugin, KernelRouteClaim, type KeyMutationRefusal, type KeyUpdateRefusal, type ListFieldOptions, McpToolRegistration, MissingReferentError, MutationSchema, NLBase, NLResult, NLVocabularyHint, NamespaceConfig, NamespaceDefinition, NamespaceInstallContext, NamespaceMismatch, NamespaceTypeDef, NlAskRequest, NlAskResult, NlEvidence, NlJudgeAction, NlJudgeChoice, NlJudgeStep, NlJudgedStatus, NlNamespacePack, NlNamespaceRulings, NlOutcome, NlPackField, NlPackType, NlPackValueRef, NlParseStatus, NlParsedData, NlServedPack, NlTrailEvent, NlValueAlias, NlWireEvent, Obligation, OnDelete, OnMissing, OrderByClause, PackEnvelope, PluginLifecycleContext, PluginRouteContext, PluginRouter, Policy, PolicyDecision, PolicyProbeContext, PostWriteHook, ProcessStat, QualifiedFrame, Query, ROW_METADATA_FIELDS, ReadParams, ReadResult, Registry, RegistryBase, RegistryEntry, RegistryEntryInput, RegistryEntryKind, RegistryEntryResolver, RequestContext, RequestObservation, RequestObserver, ReservedField, ResolveObservation, ResolveTarget, Resolver, ResolverArgs, ResolverFrameError, ResolverReturn, ResolverStat, RestrictViolation, Row, RowFilterObligation, RowMetadata, RowMetadataField, RuntimeErrorEntry, RuntimeErrors, RuntimeMetrics, RuntimeOp, SYSTEM_NAMESPACE, type ScalarFieldOptions, ScheduledTask, ScheduledTaskContext, Schema, SlowRequest, StartOpts, type StructFieldOptions, SubstrateRequest, SubstrateResponse, SubstrateServer, SweepDeps, SweepState, TargetState, TlsConfig, type TokenProviderOpts, TxScopeHandles, type TypeInput, TypeSchema, TypedResolver, UnsupportedFilterError, UpdateFieldRef, type UpdateResolverOptions, VirtualMutationDef, VirtualTypeDef, WS_CODE_SUBSCRIPTION_UNSUPPORTED_FRAME, WS_REASON_SERVER_RESTART, WS_REASON_SUBSCRIPTION_OVERLOADED, WhereClause, WriteEvent, WriteOptions, WriteResult,
|
|
889
|
+
export { ADMIN_CAPABILITIES, ActorIdentity, type AdminCredential, type AdminEnv, AfterTxWork, AggFn, ArgType, AutoCrudVerb, BatchElementError, BatchResolver, BridgeClient, BridgeCredential, BridgeCredentialStore, BridgeFrame, BridgeRegistry, BridgeUnreachableError, CLIENT_SUPPLIED_SERVER_FIELD, CanDeleteResult, ClientSuppliedServerFieldError, CommittedWriteBatch, CommittedWritesHook, ConditionalUpdateResult, CoordinatorPlugin, type CrossRefFieldOptions, DATE_UNITS, DEFAULT_CAPABILITIES, DEFAULT_FILTER_WRITE_LIMITS, DEFAULT_ORDERED_BY, Dataset, DatasetRegistry, type DateFieldOptions, type DefineNamespaceOptions, DeleteResult, type DeleteRowArgs, type DeleteRowResult, DropParticipant, DropResult, Dropped, EXPR_AGGREGATES, EXPR_FUNCTIONS, EXPR_LIMITS, Edge, EdgePatch, EdgeRef, EdgeWriteInput, EdgesStore, EmbedSourceContext, EncodeContext, EngineHandle, EngineInput, EnvelopeShape, Expr, ExprType, FILTER_TOO_BROAD, FieldDef, FieldDefCrossRef, FieldDefList, FieldDefScalar, FieldDefStruct, FieldInput, FieldKind, FieldPredicate, FilterCapabilities, FilterOperatorDef, FilterWriteLimits, type FilterWriteMutationResult, FilterWriteOptions, FilterWriteResult, FrameAgg, FrameEntry, FunctionSig, type Grant, HttpHandler, HttpMethod, Id, IdempotencyStore, Identity, IdentityKind, IndexDecl, IndexPlan, type JsonFieldOptions, KernelLifecycleContext, KernelMigration, KernelMigrationContext, KernelNamespaceContribution, KernelPlugin, KernelRouteClaim, type KeyMutationRefusal, type KeyUpdateRefusal, type ListFieldOptions, McpToolRegistration, MissingReferentError, MutationSchema, NLBase, NLResult, NLVocabularyHint, NamespaceConfig, NamespaceDefinition, NamespaceInstallContext, NamespaceMismatch, NamespaceTypeDef, NestedSelection, NlAggregate, NlAskRequest, NlAskResult, NlEvidence, NlFieldPhrase, NlJudgeAction, NlJudgeChoice, NlJudgeStep, NlJudgedStatus, NlNamespacePack, NlNamespaceRulings, NlOutcome, NlPackField, NlPackType, NlPackValueRef, NlParseStatus, NlParsedData, NlServedPack, NlTrailEvent, NlValueAlias, NlWireEvent, Obligation, OnDelete, OnMissing, OrderByClause, OrderedBy, PackEnvelope, PlanClause, PluginLifecycleContext, PluginRouteContext, PluginRouter, Policy, PolicyDecision, PolicyProbeContext, PoolStats, PostWriteHook, ProcessStat, PromotionEvent, QUERY_TIMEOUT, QualifiedFrame, Query, REGEX_BUDGET_EXCEEDED, ROW_METADATA_FIELDS, ROW_POLICY_BLOCKS_WALK, ReadParams, ReadResult, RefOperand, Registry, RegistryBase, RegistryEntry, RegistryEntryInput, RegistryEntryKind, RegistryEntryResolver, RequestContext, RequestObservation, RequestObserver, ReservedField, ResolveObservation, ResolveTarget, Resolver, ResolverArgs, ResolverFrameError, ResolverReturn, ResolverStat, RestrictViolation, Row, RowFilterObligation, RowMetadata, RowMetadataField, RuntimeErrorEntry, RuntimeErrors, RuntimeMetrics, RuntimeOp, STORE_BUSY, SYSTEM_NAMESPACE, type ScalarFieldOptions, ScheduledTask, ScheduledTaskContext, Schema, SlowRequest, StartOpts, StorageReport, type StructFieldOptions, SubstrateRequest, SubstrateResponse, SubstrateServer, SweepDeps, SweepState, TargetState, TlsConfig, type TokenProviderOpts, TxScopeHandles, TypeIndexState, type TypeInput, TypeSchema, TypeStats, TypeStorageReport, TypedResolver, UnsupportedFilterError, UpdateFieldRef, type UpdateResolverOptions, VALUE_OUT_OF_RANGE, VirtualMutationDef, VirtualTypeDef, WALKS_IN_MUTATION, WALKS_IN_SUBSCRIPTION, WALKS_NEED_PARTITIONED, WALKS_UNSUPPORTED_STORE, WALK_BUDGET_EXCEEDED, WALK_UNSUPPORTED_REF, WS_CODE_SUBSCRIPTION_UNSUPPORTED_FRAME, WS_REASON_SERVER_RESTART, WS_REASON_SUBSCRIPTION_OVERLOADED, WalkAgg, WalkAggOperand, WalkAggPredicate, WalkNode, WalkPick, WhereClause, WriteEvent, WriteOptions, WriteResult, WriteRow, WsRequestFrame, WsResponseFrame, WsResponseKind, adminClaimCapabilities, allowAll, allowVerbs, and, applyRowFilters, assertNoRepeatedIds, capabilitiesFor, checkRevocable, checkUpdatable, decodeList, denyAll, denyVerbs, describeGrant, encodeGrant, encodeList, expandFlat, filterTooBroad, flattenGrant, grantCovers, grantEntriesConfer, grantEntryError, grantIsUniform, intersectGrants, isActiveAdminKeyRow, isAuthCause, isBatchElementError, isColumnField, isEncryptedKey, isResolverFrameError, isRestrictViolation, makeAuthorizationProvider, makeTokenProvider, naturalOrderOf, newlyGranted, newlyGrantedPairs, not, or, parseGrantEntries, requireCapability, requireIdentity, requireNamespace, resolveAdminCredential, resolveDefaultKeyPath, resolveDefaultKidPath, revokedAtIso, row };
|