@mnmal-ai/substrate 1.0.0-alpha.11 → 1.0.0-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -5
- package/dist/{boot-store-C5vNZJ3i.js → boot-store-0BPtJ8ne.js} +167 -71
- package/dist/{bridge-COu0Tg_h.d.ts → bridge-DQyQ6Qhn.d.ts} +1 -1
- package/dist/{cli-BrwW4tjO.js → cli-BvQqNFVn.js} +14 -11
- package/dist/client.d.ts +3 -3
- package/dist/client.js +3 -3
- package/dist/{errors-BOllGhVx.d.ts → errors-xP9Mo7Q1.d.ts} +25 -4
- package/dist/{index-Cp74OcmS.d.ts → index-baF5A5jU.d.ts} +1 -1
- package/dist/pack.d.ts +2 -2
- package/dist/pack.js +1 -1
- package/dist/{pg-edges-store-BLsbcXkk.js → pg-edges-store-B4FSN9yp.js} +72 -9
- package/dist/{plugin-DIYm2cZE.js → plugin-BLm5IRdX.js} +2 -2
- package/dist/proposals-bootstrap.js +2 -2
- package/dist/proposals.d.ts +2 -2
- package/dist/proposals.js +1 -1
- package/dist/recall-bootstrap.js +2 -2
- package/dist/recall.d.ts +10 -10
- package/dist/recall.js +2 -2
- package/dist/{repl-B8gy0YM7.js → repl-Dw2Fb7C1.js} +25 -25
- package/dist/{row-DwaDU4b-.d.ts → row-Dtj3KrPH.d.ts} +9 -2
- package/dist/{run-B18qtGKc.js → run-CgDw2c3X.js} +520 -141
- package/dist/{schema-CijHRfuk.d.ts → schema-oXfQyo0s.d.ts} +272 -27
- package/dist/sdk.d.ts +93 -29
- package/dist/sdk.js +4 -4
- package/dist/{src-D041j6GS.js → src-Bew_JvTo.js} +32 -16
- package/dist/{src-DpPdw2oL.js → src-Bi3NhEsT.js} +1 -1
- package/dist/{src-DptNGNYQ.js → src-BjWVYYoo.js} +175 -91
- package/dist/{src-DK7VEQT6.js → src-C4t1Gy-m.js} +2477 -830
- package/dist/{src-Br6aDUti.js → src-CHND7-Pm.js} +2 -2
- package/dist/src-CSe2tJDf.js +6940 -0
- package/dist/{src-Dbvuel6w.js → src-DWqzrm3O.js} +18 -1
- package/dist/substrate-admin.js +1 -1
- package/dist/substrate.js +1 -1
- package/dist/testing.d.ts +233 -92
- package/dist/testing.js +6 -23
- package/dist/{ws-DC8OhMaV.d.ts → ws-Dx3A2B4U.d.ts} +2 -2
- package/package.json +19 -20
- package/dist/src-gz4I1F29.js +0 -5097
package/dist/sdk.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import { i as BridgeFrame, n as BridgeCredential, r as BridgeCredentialStore, t as BridgeClient } from "./bridge-
|
|
3
|
-
import {
|
|
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-
|
|
5
|
-
import { $ as NlJudgeChoice, 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 NlJudgeAction, 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 NlFieldPhrase, _ as newlyGrantedPairs, _t as Query, a as denyAll, at as NlPackField, b as capabilitiesFor, c as requireIdentity, ct as NlParseStatus, d as KeyUpdateRefusal, dt as NlTrailEvent, et as NlJudgeStep, f as checkRevocable, ft as NlValueAlias, g as newlyGranted, gt as NLVocabularyHint, h as grantEntriesConfer, ht as NLResult, i as allowVerbs, it as NlOutcome, j as not, k as encodeList, l as requireNamespace, lt as NlParsedData, m as grantCovers, mt as NLBase, n as row, nt as NlNamespacePack, o as denyVerbs, ot as NlPackType, p as checkUpdatable, pt as NlWireEvent, q as resolveDefaultKidPath, r as allowAll, rt as NlNamespaceRulings, s as requireCapability, st as NlPackValueRef, t as applyRowFilters, tt as NlJudgedStatus, u as KeyMutationRefusal, ut as NlServedPack, v as revokedAtIso, w as grantEntryError, x as encodeGrant, y as Grant, z as makeTokenProvider } from "./row-
|
|
1
|
+
import { $ as VirtualMutationDef, $t as TypeIndexState, A as KernelLifecycleContext, An as IdentityKind, At as ConditionalUpdateResult, B as NamespaceTypeDef, Bt as FilterWriteLimits, C as EmbedSourceContext, Cn as EdgesStore, Ct as ResolverArgs, D as FilterOperatorDef, Dn as CLIENT_SUPPLIED_SERVER_FIELD, Dt as WriteEvent, E as EngineInput, En as ActorIdentity, Et as TypedResolver, F as KernelRouteClaim, Fn as WriteRow, Ft as DeriveSpec, G as Registry, Gt as NestedSelection, H as PluginRouteContext, Ht as FilterWriteResult, I as McpToolRegistration, In as assertNoRepeatedIds, It as DropResult, J as RegistryEntryInput, Jt as ReadParams, K as RegistryBase, Kt as OrderByClause, L as NamespaceConfig, Lt as FieldKind, M as KernelMigrationContext, Mn as Row, Mt as Dataset, N as KernelNamespaceContribution, Nn as RowMetadata, Nt as DatasetRegistry, O as FrameEntry, On as ClientSuppliedServerFieldError, Ot as AggFn, P as KernelPlugin, Pn as RowMetadataField, Pt as DeleteResult, Q as ScheduledTaskContext, Qt as TxScopeHandles, R as NamespaceDefinition, Rt as FieldPredicate, S as DropParticipant, Sn as EdgeWriteInput, St as Resolver, T as EngineHandle, Tn as OnMissing, Tt as RowFilterObligation, U as PostWriteHook, Ut as FrameAgg, V as PluginLifecycleContext, Vt as FilterWriteOptions, W as QualifiedFrame, Wt as IndexPlan, X as RegistryEntryResolver, Xt as RefOperand, Y as RegistryEntryKind, Yt as ReadResult, Z as ScheduledTask, Zt as StorageReport, _ as naturalOrderOf, _n as TypeStats, _t as Obligation, a as FieldDefCrossRef, an as WalkNode, at as RequestObserver, b as CommittedWritesHook, bn as EdgePatch, bt as PolicyProbeContext, c as FieldDefStruct, cn as WriteOptions, ct as SubstrateRequest, d as OrderedBy, dn as ResolveObservation, dt as TlsConfig, en as TypeStorageReport, et as VirtualTypeDef, f as PackEnvelope, fn as ResolverStat, ft as WsConnection, g as isColumnField, gn as SlowRequest, gt as Identity, h as TypeSchema, hn as RuntimeMetrics, ht as AutoCrudVerb, i as FieldDef, in as WalkAggPredicate, it as RequestObservation, j as KernelMigration, jn as ROW_METADATA_FIELDS, jt as DEFAULT_FILTER_WRITE_LIMITS, k as IndexDecl, kn as Id, kt as BucketSpec, l as FieldInput, ln as WriteResult, lt as SubstrateResponse, m as Schema, mn as RuntimeErrors, mt as AfterTxWork, n as Dropped, nn as WalkAgg, nt as HttpMethod, o as FieldDefList, on as WalkPick, ot as RuntimeOp, p as PlanClause, pn as RuntimeErrorEntry, pt as WsHandler, q as RegistryEntry, qt as PromotionEvent, r as EnvelopeShape, rn as WalkAggOperand, rt as PluginRouter, s as FieldDefScalar, sn as WhereClause, st as StartOpts, t as DEFAULT_ORDERED_BY, tn as UpdateFieldRef, tt as HttpHandler, u as MutationSchema, un as ProcessStat, ut as SubstrateServer, v as BatchResolver, vn as CanDeleteResult, vt as Policy, w as EncodeContext, wn as OnDelete, wt as ResolverReturn, x as CoordinatorPlugin, xn as EdgeRef, xt as RequestContext, y as CommittedWriteBatch, yn as Edge, yt as PolicyDecision, z as NamespaceInstallContext, zt as FilterCapabilities } from "./schema-oXfQyo0s.js";
|
|
2
|
+
import { i as BridgeFrame, n as BridgeCredential, r as BridgeCredentialStore, t as BridgeClient } from "./bridge-DQyQ6Qhn.js";
|
|
3
|
+
import { S as isRestrictViolation, _ as WALK_UNSUPPORTED_REF, a as NamespaceMismatch, b as isBatchElementError, c as ReservedField, d as UnsupportedFilterError, f as WALKS_IN_MUTATION, g as WALK_BUDGET_EXCEEDED, h as WALKS_UNSUPPORTED_STORE, i as MissingReferentError, l as ResolverFrameError, m as WALKS_NEED_PARTITIONED, n as BridgeUnreachableError, o as QUERY_TIMEOUT, p as WALKS_IN_SUBSCRIPTION, r as FILTER_TOO_BROAD, s as ROW_POLICY_BLOCKS_WALK, t as BatchElementError, u as RestrictViolation, v as filterTooBroad, x as isResolverFrameError, y as isAuthCause } from "./errors-xP9Mo7Q1.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-Dx3A2B4U.js";
|
|
5
|
+
import { $ as NlJudgeChoice, 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 NlJudgeAction, 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 NlFieldPhrase, _ as newlyGrantedPairs, _t as Query, a as denyAll, at as NlPackField, b as capabilitiesFor, c as requireIdentity, ct as NlParseStatus, d as KeyUpdateRefusal, dt as NlTrailEvent, et as NlJudgeStep, f as checkRevocable, ft as NlValueAlias, g as newlyGranted, gt as NLVocabularyHint, h as grantEntriesConfer, ht as NLResult, i as allowVerbs, it as NlOutcome, j as not, k as encodeList, l as requireNamespace, lt as NlParsedData, m as grantCovers, mt as NLBase, n as row, nt as NlNamespacePack, o as denyVerbs, ot as NlPackType, p as checkUpdatable, pt as NlWireEvent, q as resolveDefaultKidPath, r as allowAll, rt as NlNamespaceRulings, s as requireCapability, st as NlPackValueRef, t as applyRowFilters, tt as NlJudgedStatus, u as KeyMutationRefusal, ut as NlServedPack, v as revokedAtIso, w as grantEntryError, x as encodeGrant, y as Grant, z as makeTokenProvider } from "./row-Dtj3KrPH.js";
|
|
6
6
|
//#region ../../packages/substrate-types/src/assert-never.d.ts
|
|
7
7
|
/**
|
|
8
8
|
* Exhaustiveness guard for the `default:` arm of a `switch` over a
|
|
@@ -408,7 +408,10 @@ interface DefineNamespaceOptions {
|
|
|
408
408
|
* consumer (`nl` for substrate-nl's rulings). Must be JSON-serialisable.
|
|
409
409
|
*/
|
|
410
410
|
annotations?: Record<string, unknown>;
|
|
411
|
-
/**
|
|
411
|
+
/**
|
|
412
|
+
* @deprecated Ignored: every declared scalar is a column of its type's
|
|
413
|
+
* table already. See `NamespaceDefinition.promotedColumns`.
|
|
414
|
+
*/
|
|
412
415
|
promotedColumns?: NamespaceDefinition['promotedColumns'];
|
|
413
416
|
}
|
|
414
417
|
export declare function defineNamespace(namespace: string, types: Record<string, TypeInput>, opts?: DefineNamespaceOptions): NamespaceDefinition;
|
|
@@ -420,27 +423,6 @@ export declare function assertIndexDecl(typeName: string, fields: Record<string,
|
|
|
420
423
|
*/
|
|
421
424
|
export declare function assertOrderedBy(typeName: string, def: Pick<TypeInput, 'fields' | 'orderedBy' | 'ordering'>): void;
|
|
422
425
|
//#endregion
|
|
423
|
-
//#region ../../packages/substrate-sdk/src/autocrud/autocrud-create.d.ts
|
|
424
|
-
interface CreateResolverOptions {
|
|
425
|
-
/** Type field definitions. Used to detect readonly fields and drive shortId allocation. */
|
|
426
|
-
fields?: Record<string, FieldDef>;
|
|
427
|
-
}
|
|
428
|
-
export declare function createResolver<T extends Row = Row>(typeName: string, dataset: Dataset, options?: CreateResolverOptions): TypedResolver<T>;
|
|
429
|
-
//#endregion
|
|
430
|
-
//#region ../../packages/substrate-sdk/src/autocrud/autocrud-delete.d.ts
|
|
431
|
-
/**
|
|
432
|
-
* Delete resolver return shape. Carries the row's string index signature so
|
|
433
|
-
* it slots into `Row` (which has `[field: string]: unknown`) without cast
|
|
434
|
-
* gymnastics — the autoCRUD registration path wants the common `Row | Row[]`
|
|
435
|
-
* return type.
|
|
436
|
-
*/
|
|
437
|
-
interface DeleteResolverResult {
|
|
438
|
-
id: Id;
|
|
439
|
-
deleted: boolean;
|
|
440
|
-
[field: string]: unknown;
|
|
441
|
-
}
|
|
442
|
-
export declare function deleteResolver(typeName: string, dataset: Dataset, edges: EdgesStore): TypedResolver<DeleteResolverResult>;
|
|
443
|
-
//#endregion
|
|
444
426
|
//#region ../../packages/substrate-sdk/src/autocrud/autocrud-get.d.ts
|
|
445
427
|
export declare function getResolver<T extends Row = Row>(typeName: string, dataset: Dataset): TypedResolver<T | null>;
|
|
446
428
|
//#endregion
|
|
@@ -478,13 +460,77 @@ interface UpdateResolverOptions {
|
|
|
478
460
|
* checks; this owns the metadata idiom so it stays single-sourced.
|
|
479
461
|
*/
|
|
480
462
|
export declare function applyUpdatePatch(ds: Dataset, typeName: string, rowId: Id, patchFields: Record<string, unknown>, ctx: RequestContext, onWrite?: ResolverArgs['onWrite']): Promise<Row | null>;
|
|
481
|
-
|
|
463
|
+
//#endregion
|
|
464
|
+
//#region ../../packages/substrate-sdk/src/autocrud/autocrud-delete.d.ts
|
|
465
|
+
/**
|
|
466
|
+
* Delete resolver return shape. Carries the row's string index signature so
|
|
467
|
+
* it slots into `Row` (which has `[field: string]: unknown`) without cast
|
|
468
|
+
* gymnastics — the autoCRUD registration path wants the common `Row | Row[]`
|
|
469
|
+
* return type.
|
|
470
|
+
*/
|
|
471
|
+
interface DeleteResolverResult {
|
|
472
|
+
id: Id;
|
|
473
|
+
deleted: boolean;
|
|
474
|
+
[field: string]: unknown;
|
|
475
|
+
}
|
|
476
|
+
//#endregion
|
|
477
|
+
//#region ../../packages/substrate-sdk/src/autocrud/batch.d.ts
|
|
478
|
+
interface BatchResolverOptions {
|
|
479
|
+
/** The type's field definitions: validation, crossRefs and shortId allocation. */
|
|
480
|
+
fields?: Record<string, FieldDef>;
|
|
481
|
+
/** Update and delete: a row the policy's row filters hide answers as missing. */
|
|
482
|
+
policy?: Policy;
|
|
483
|
+
/** Create and update: runs per written row once the transaction commits. */
|
|
484
|
+
postWrite?: PostWriteHook;
|
|
485
|
+
}
|
|
486
|
+
/** `create<T>` without crossRef edges: the batch resolver with `edges: null`, one element. */
|
|
487
|
+
export declare function createResolver<T extends Row = Row>(typeName: string, dataset: Dataset, options?: Pick<BatchResolverOptions, 'fields'>): TypedResolver<T>;
|
|
488
|
+
/** `update<T>`: the batch resolver with one element. */
|
|
489
|
+
export declare function updateResolver<T extends Row = Row>(typeName: string, dataset: Dataset, edges: EdgesStore, options?: Pick<BatchResolverOptions, 'fields'>): TypedResolver<T | null>;
|
|
490
|
+
/** `delete<T>`: the batch resolver with one element. */
|
|
491
|
+
export declare function deleteResolver(typeName: string, dataset: Dataset, edges: EdgesStore): TypedResolver<DeleteResolverResult>;
|
|
492
|
+
//#endregion
|
|
493
|
+
//#region ../../packages/substrate-sdk/src/autocrud/filter-writes.d.ts
|
|
494
|
+
/**
|
|
495
|
+
* `count` is every row changed. `ids` are the changed ids in ascending order,
|
|
496
|
+
* compared as strings code unit by code unit, cut to the first `idsCap`; so
|
|
497
|
+
* the same rows give the same ids on every path and dataset, whatever order
|
|
498
|
+
* the store returned them in. `idsTruncated` says whether more changed.
|
|
499
|
+
*/
|
|
500
|
+
interface FilterWriteMutationResult {
|
|
501
|
+
count: number;
|
|
502
|
+
ids: Id[];
|
|
503
|
+
idsTruncated: boolean;
|
|
504
|
+
}
|
|
505
|
+
interface FilterWriteResolverOptions extends BatchResolverOptions {
|
|
506
|
+
/**
|
|
507
|
+
* Whether the type's single-row counterpart (`update<T>` for updateMany,
|
|
508
|
+
* `delete<T>` for deleteMany) is still autoCRUD's own entry. When a plugin
|
|
509
|
+
* replaced it with custom logic, writing by filter would bypass that, so the
|
|
510
|
+
* resolver refuses. Absent: served.
|
|
511
|
+
*/
|
|
512
|
+
ownsSingleRowWrite?: () => boolean;
|
|
513
|
+
}
|
|
514
|
+
/** `updateMany<T>`: `set` merged into every live row `where` matches. */
|
|
515
|
+
export declare function updateManyResolver(typeName: string, dataset: Dataset, edges: EdgesStore, opts?: FilterWriteResolverOptions): TypedResolver<FilterWriteMutationResult>;
|
|
516
|
+
/** `deleteMany<T>`: tombstones every live row `where` matches, behind the restrict gate. */
|
|
517
|
+
export declare function deleteManyResolver(typeName: string, dataset: Dataset, edges: EdgesStore, opts?: Pick<FilterWriteResolverOptions, 'policy' | 'ownsSingleRowWrite'>): TypedResolver<FilterWriteMutationResult>;
|
|
482
518
|
//#endregion
|
|
483
519
|
//#region ../../packages/substrate-sdk/src/autocrud/index.d.ts
|
|
520
|
+
/**
|
|
521
|
+
* The narrow surface `installAutoCrud` needs from a registry. The core
|
|
522
|
+
* `Registry` class satisfies this structurally.
|
|
523
|
+
*
|
|
524
|
+
* Resolver signature matches the core `Resolver` type exactly — typed against
|
|
525
|
+
* `(ctx, args) => Promise<Row | Row[] | null>` so autocrud's `get` can surface
|
|
526
|
+
* null without sentinel gymnastics.
|
|
527
|
+
*/
|
|
484
528
|
export type AutoCrudResolver = (ctx: RequestContext, args: ResolverArgs) => Promise<Row | Row[] | ReadResult | null>;
|
|
485
529
|
export interface AutoCrudRegistry {
|
|
486
530
|
register(typeName: string, input: {
|
|
487
531
|
resolver: AutoCrudResolver;
|
|
532
|
+
/** Set-wise resolver for a mutate array of this mutation. */
|
|
533
|
+
batch?: BatchResolver;
|
|
488
534
|
policy?: Policy;
|
|
489
535
|
fields?: Record<string, FieldDef>;
|
|
490
536
|
kind?: 'type' | 'mutation';
|
|
@@ -495,7 +541,25 @@ export interface AutoCrudRegistry {
|
|
|
495
541
|
expectedSize?: 'small' | 'large';
|
|
496
542
|
/** Semantic autoCRUD verb threaded to policies via ctx.verb. */
|
|
497
543
|
verb?: AutoCrudVerb;
|
|
544
|
+
/** The type a by-filter mutation writes; the engine validates its `where`. */
|
|
545
|
+
filterTarget?: string;
|
|
498
546
|
}): void;
|
|
547
|
+
/** When present, lets `installAutoCrud` refuse a type whose keys collide with another's. */
|
|
548
|
+
get?(typeName: string): {
|
|
549
|
+
kind?: string;
|
|
550
|
+
resolver: object;
|
|
551
|
+
} | undefined;
|
|
552
|
+
}
|
|
553
|
+
/**
|
|
554
|
+
* A namespace declares both `X` and `ManyX`: `X`'s `updateManyX` /
|
|
555
|
+
* `deleteManyX` are `ManyX`'s `update<T>` / `delete<T>` keys.
|
|
556
|
+
*/
|
|
557
|
+
export declare class AutoCrudNameCollisionError extends Error {
|
|
558
|
+
readonly namespace: string;
|
|
559
|
+
readonly type: string;
|
|
560
|
+
readonly other: string;
|
|
561
|
+
readonly name = "AutoCrudNameCollisionError";
|
|
562
|
+
constructor(namespace: string, type: string, other: string);
|
|
499
563
|
}
|
|
500
564
|
export interface InstallAutoCrudOptions {
|
|
501
565
|
/** Field definitions for the type — passed through to the registry entry. */
|
|
@@ -779,4 +843,4 @@ export declare function resolveEntityId(dataset: Dataset, type: string, input: I
|
|
|
779
843
|
*/
|
|
780
844
|
export declare function resolveEntityRow(dataset: Dataset, type: string, input: Id): Promise<Row | null>;
|
|
781
845
|
//#endregion
|
|
782
|
-
export { ADMIN_CAPABILITIES, ActorIdentity, type AdminCredential, type AdminEnv, AfterTxWork, AggFn, AutoCrudVerb, BridgeClient, BridgeCredential, BridgeCredentialStore, BridgeFrame, BridgeRegistry, BridgeUnreachableError, BucketSpec, CLIENT_SUPPLIED_SERVER_FIELD, CanDeleteResult, ClientSuppliedServerFieldError, ConditionalUpdateResult, CoordinatorPlugin, type CrossRefFieldOptions, DEFAULT_CAPABILITIES, DEFAULT_ORDERED_BY, Dataset, DatasetRegistry, type DateFieldOptions, type DefineNamespaceOptions, DeleteResult, type DeleteRowArgs, type DeleteRowResult, DeriveSpec, DropParticipant, DropResult, Dropped, Edge, EdgePatch, EdgeRef, EdgeWriteInput, EdgesStore, EmbedSourceContext, EncodeContext, EngineHandle, EngineInput, EnvelopeShape, FieldDef, FieldDefCrossRef, FieldDefList, FieldDefScalar, FieldDefStruct, FieldInput, FieldKind, FieldPredicate, FilterCapabilities, FilterOperatorDef, FrameAgg, FrameEntry, 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, 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, PostWriteHook, ProcessStat, QualifiedFrame, Query, 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, 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, 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, WsConnection, WsHandler, WsRequestFrame, WsResponseFrame, WsResponseKind, adminClaimCapabilities, allowAll, allowVerbs, and, applyRowFilters, assertNoRepeatedIds, capabilitiesFor, checkRevocable, checkUpdatable, decodeList, denyAll, denyVerbs, describeGrant, encodeGrant, encodeList, expandFlat, flattenGrant, grantCovers, grantEntriesConfer, grantEntryError, grantIsUniform, intersectGrants, isActiveAdminKeyRow, isAuthCause, isEncryptedKey, isResolverFrameError, isRestrictViolation, makeAuthorizationProvider, makeTokenProvider, naturalOrderOf, newlyGranted, newlyGrantedPairs, not, or, parseGrantEntries, requireCapability, requireIdentity, requireNamespace, resolveAdminCredential, resolveDefaultKeyPath, resolveDefaultKidPath, revokedAtIso, row };
|
|
846
|
+
export { ADMIN_CAPABILITIES, ActorIdentity, type AdminCredential, type AdminEnv, AfterTxWork, AggFn, AutoCrudVerb, BatchElementError, BatchResolver, BridgeClient, BridgeCredential, BridgeCredentialStore, BridgeFrame, BridgeRegistry, BridgeUnreachableError, BucketSpec, CLIENT_SUPPLIED_SERVER_FIELD, CanDeleteResult, ClientSuppliedServerFieldError, CommittedWriteBatch, CommittedWritesHook, ConditionalUpdateResult, CoordinatorPlugin, type CrossRefFieldOptions, DEFAULT_CAPABILITIES, DEFAULT_FILTER_WRITE_LIMITS, DEFAULT_ORDERED_BY, Dataset, DatasetRegistry, type DateFieldOptions, type DefineNamespaceOptions, DeleteResult, type DeleteRowArgs, type DeleteRowResult, DeriveSpec, DropParticipant, DropResult, Dropped, Edge, EdgePatch, EdgeRef, EdgeWriteInput, EdgesStore, EmbedSourceContext, EncodeContext, EngineHandle, EngineInput, EnvelopeShape, FILTER_TOO_BROAD, FieldDef, FieldDefCrossRef, FieldDefList, FieldDefScalar, FieldDefStruct, FieldInput, FieldKind, FieldPredicate, FilterCapabilities, FilterOperatorDef, FilterWriteLimits, type FilterWriteMutationResult, FilterWriteOptions, FilterWriteResult, FrameAgg, FrameEntry, 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, 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, PostWriteHook, ProcessStat, PromotionEvent, QUERY_TIMEOUT, QualifiedFrame, Query, 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, 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, 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, WsConnection, WsHandler, 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 };
|
package/dist/sdk.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __binCreateRequire } from 'node:module'; const require = __binCreateRequire(import.meta.url);
|
|
2
|
-
import { $t as
|
|
2
|
+
import { $t as BatchElementError, A as field, At as parseJsonBody, B as applyUpdatePatch, Bt as vocabImplication, C as makeCtx, Cn as assertNoRepeatedIds, D as RESERVED_AUTOCRUD_FIELDS, E as selectAll, En as defineBootstrap, Et as JSON_HEADERS, F as deleteManyResolver, Ft as WS_REASON_SUBSCRIPTION_OVERLOADED, G as UnattributedWriteError, Gt as normaliseMetadataWhere, H as purgeResolver, Ht as METADATA_AUTHOR_FIELDS, I as updateManyResolver, It as canonicalVocabValue, J as resolveEntityRow, Jt as isImpossibleIsoTimestamp, K as resolveIdentity, Kt as normaliseWalkNode, L as createResolver, Lt as normaliseVocabValues, M as autoCrudOptionsOf, N as createResolverWithEdges, Nt as WS_CODE_SUBSCRIPTION_UNSUPPORTED_FRAME, O as RESERVED_AUTOCRUD_FIELD_NAMES, Ot as error400, P as installAutoCrud, Pt as WS_REASON_SERVER_RESTART, Qt as validateHardDeleteEnv, R as deleteResolver, Rt as normaliseVocabWhere, S as EngineQueryError, Sn as ROW_METADATA_FIELDS, T as queryOne, Tn as BootstrapConfigError, U as listResolver, Ut as METADATA_FILTER_FIELDS, V as deleteRow, Vt as RegistryBase, W as getResolver, Wt as normaliseMetadataOrderBy, Xt as normalizeIsoTimestamp, Yt as isIsoTimestamp, Zt as assertHardDeleteAllowed, _n as isAuthCause, an as ROW_POLICY_BLOCKS_WALK, b as assertOrderedBy, bn as isRestrictViolation, cn as RestrictViolation, dn as WALKS_IN_SUBSCRIPTION, en as BridgeUnreachableError, fn as WALKS_NEED_PARTITIONED, gn as filterTooBroad, hn as WALK_UNSUPPORTED_REF, in as QUERY_TIMEOUT, j as AutoCrudNameCollisionError, k as isReservedAutoCrudField, kt as jsonResponse, ln as UnsupportedFilterError, mn as WALK_BUDGET_EXCEEDED, nn as MissingReferentError, on as ReservedField, pn as WALKS_UNSUPPORTED_STORE, q as resolveEntityId, qt as createKeyedMutex, rn as NamespaceMismatch, sn as ResolverFrameError, tn as FILTER_TOO_BROAD, un as WALKS_IN_MUTATION, vn as isBatchElementError, w as queryAll, wn as canonicalize, x as defineNamespace, xn as CLIENT_SUPPLIED_SERVER_FIELD, y as assertIndexDecl, yn as isResolverFrameError, z as updateResolver, zt as storedVocabSpellings } from "./src-C4t1Gy-m.js";
|
|
3
3
|
import { a as adminClaimCapabilities, c as makeTokenProvider, d as resolveDefaultKidPath, i as DEFAULT_CAPABILITIES, l as resolveAdminCredential, n as trimTrailingSlashes, o as isEncryptedKey, r as ADMIN_CAPABILITIES, s as makeAuthorizationProvider, t as parsePositiveInt, u as resolveDefaultKeyPath } from "./env-utils-CGNazUNt.js";
|
|
4
|
-
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, d as confersAnywhere, f as coversNamespace, g as checkUpdatable, h as checkRevocable, i as allowVerbs, j as flattenGrant, k as encodeGrant, l as requireNamespace, m as grantedIn, n as row, o as denyVerbs, p as grantOf, r as allowAll, s as requireCapability, t as applyRowFilters, u as allCapabilities, v as grantEntriesConfer, w as or, x as revokedAtIso, y as newlyGranted } from "./src-
|
|
5
|
-
import { C as
|
|
4
|
+
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, d as confersAnywhere, f as coversNamespace, g as checkUpdatable, h as checkRevocable, i as allowVerbs, j as flattenGrant, k as encodeGrant, l as requireNamespace, m as grantedIn, n as row, o as denyVerbs, p as grantOf, r as allowAll, s as requireCapability, t as applyRowFilters, u as allCapabilities, v as grantEntriesConfer, w as or, x as revokedAtIso, y as newlyGranted } from "./src-Bi3NhEsT.js";
|
|
5
|
+
import { C as formatQualifiedKey, E as assertNever, S as naturalOrderOf, T as DEFAULT_FILTER_WRITE_LIMITS, b as DEFAULT_ORDERED_BY, w as parseQualifiedKey, x as isColumnField } from "./src-DWqzrm3O.js";
|
|
6
6
|
|
|
7
|
-
export { ADMIN_CAPABILITIES, BootstrapConfigError, BridgeUnreachableError, CLIENT_SUPPLIED_SERVER_FIELD, DEFAULT_CAPABILITIES, DEFAULT_ORDERED_BY, EngineQueryError, JSON_HEADERS, METADATA_AUTHOR_FIELDS, METADATA_FILTER_FIELDS, MissingReferentError, NamespaceMismatch, RESERVED_AUTOCRUD_FIELDS, RESERVED_AUTOCRUD_FIELD_NAMES, ROW_METADATA_FIELDS, ROW_POLICY_BLOCKS_WALK, RegistryBase, ReservedField, ResolverFrameError, RestrictViolation, SYSTEM_NAMESPACE, UnattributedWriteError, UnsupportedFilterError, 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, adminClaimCapabilities, allCapabilities, allowAll, allowVerbs, and, applyRowFilters, applyUpdatePatch, assertHardDeleteAllowed, assertIndexDecl, assertNever, assertNoRepeatedIds, assertOrderedBy, autoCrudOptionsOf, canonicalVocabValue, canonicalize, capabilitiesFor, checkRevocable, checkUpdatable, confersAnywhere, coversNamespace, createKeyedMutex, createResolver, createResolverWithEdges, decodeList, defineBootstrap, defineNamespace, deleteResolver, deleteRow, denyAll, denyVerbs, describeGrant, encodeGrant, encodeList, error400, expandFlat, field, flattenGrant, formatQualifiedKey, getResolver, grantCovers, grantEntriesConfer, grantEntryError, grantIsUniform, grantOf, grantedIn, installAutoCrud, intersectGrants, isActiveAdminKeyRow, isAuthCause, isEncryptedKey, isImpossibleIsoTimestamp, isIsoTimestamp, isReservedAutoCrudField, isResolverFrameError, isRestrictViolation, jsonResponse, listResolver, makeAuthorizationProvider, makeCtx, makeTokenProvider, naturalOrderOf, newlyGranted, newlyGrantedPairs, normaliseMetadataOrderBy, normaliseMetadataWhere, normaliseVocabValues, normaliseVocabWhere, normaliseWalkNode, normalizeIsoTimestamp, not, or, parseGrantEntries, parseJsonBody, parsePositiveInt, parseQualifiedKey, purgeResolver, queryAll, queryOne, requireCapability, requireIdentity, requireNamespace, resolveAdminCredential, resolveDefaultKeyPath, resolveDefaultKidPath, resolveEntityId, resolveEntityRow, resolveIdentity, revokedAtIso, row, selectAll, storedVocabSpellings, trimTrailingSlashes, updateResolver, validateHardDeleteEnv, vocabImplication };
|
|
7
|
+
export { ADMIN_CAPABILITIES, AutoCrudNameCollisionError, BatchElementError, BootstrapConfigError, BridgeUnreachableError, CLIENT_SUPPLIED_SERVER_FIELD, DEFAULT_CAPABILITIES, DEFAULT_FILTER_WRITE_LIMITS, DEFAULT_ORDERED_BY, EngineQueryError, FILTER_TOO_BROAD, JSON_HEADERS, METADATA_AUTHOR_FIELDS, METADATA_FILTER_FIELDS, MissingReferentError, NamespaceMismatch, QUERY_TIMEOUT, RESERVED_AUTOCRUD_FIELDS, RESERVED_AUTOCRUD_FIELD_NAMES, ROW_METADATA_FIELDS, ROW_POLICY_BLOCKS_WALK, RegistryBase, ReservedField, ResolverFrameError, RestrictViolation, SYSTEM_NAMESPACE, UnattributedWriteError, UnsupportedFilterError, 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, adminClaimCapabilities, allCapabilities, allowAll, allowVerbs, and, applyRowFilters, applyUpdatePatch, assertHardDeleteAllowed, assertIndexDecl, assertNever, assertNoRepeatedIds, assertOrderedBy, autoCrudOptionsOf, canonicalVocabValue, canonicalize, capabilitiesFor, checkRevocable, checkUpdatable, confersAnywhere, coversNamespace, createKeyedMutex, createResolver, createResolverWithEdges, decodeList, defineBootstrap, defineNamespace, deleteManyResolver, deleteResolver, deleteRow, denyAll, denyVerbs, describeGrant, encodeGrant, encodeList, error400, expandFlat, field, filterTooBroad, flattenGrant, formatQualifiedKey, getResolver, grantCovers, grantEntriesConfer, grantEntryError, grantIsUniform, grantOf, grantedIn, installAutoCrud, intersectGrants, isActiveAdminKeyRow, isAuthCause, isBatchElementError, isColumnField, isEncryptedKey, isImpossibleIsoTimestamp, isIsoTimestamp, isReservedAutoCrudField, isResolverFrameError, isRestrictViolation, jsonResponse, listResolver, makeAuthorizationProvider, makeCtx, makeTokenProvider, naturalOrderOf, newlyGranted, newlyGrantedPairs, normaliseMetadataOrderBy, normaliseMetadataWhere, normaliseVocabValues, normaliseVocabWhere, normaliseWalkNode, normalizeIsoTimestamp, not, or, parseGrantEntries, parseJsonBody, parsePositiveInt, parseQualifiedKey, purgeResolver, queryAll, queryOne, requireCapability, requireIdentity, requireNamespace, resolveAdminCredential, resolveDefaultKeyPath, resolveDefaultKidPath, resolveEntityId, resolveEntityRow, resolveIdentity, revokedAtIso, row, selectAll, storedVocabSpellings, trimTrailingSlashes, updateManyResolver, updateResolver, validateHardDeleteEnv, vocabImplication };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __binCreateRequire } from 'node:module'; const require = __binCreateRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
import { s as requireCapability } from "./src-
|
|
4
|
-
import "./src-
|
|
2
|
+
import { A as field, D as RESERVED_AUTOCRUD_FIELDS, Et as JSON_HEADERS, K as resolveIdentity, M as autoCrudOptionsOf, O as RESERVED_AUTOCRUD_FIELD_NAMES, P as installAutoCrud, Z as publishSchema, b as assertOrderedBy, d as uuidFromName, f as emitFieldEvents, l as planServesShape, p as migrateFieldValues, sn as ResolverFrameError, wn as canonicalize$1, x as defineNamespace, y as assertIndexDecl } from "./src-C4t1Gy-m.js";
|
|
3
|
+
import { s as requireCapability } from "./src-Bi3NhEsT.js";
|
|
4
|
+
import "./src-DWqzrm3O.js";
|
|
5
5
|
import { randomUUID } from "node:crypto";
|
|
6
6
|
|
|
7
7
|
//#region ../../plugins/substrate-proposals/src/capability.ts
|
|
@@ -503,7 +503,8 @@ function reinstallType(registry, typeName, dataset, edges, patch) {
|
|
|
503
503
|
if (!existing) throw new Error(`type '${typeName}' not registered`);
|
|
504
504
|
const replaceWriter = {
|
|
505
505
|
register: (key, input) => registry.replace(key, input),
|
|
506
|
-
replace: registry.replace.bind(registry)
|
|
506
|
+
replace: registry.replace.bind(registry),
|
|
507
|
+
get: registry.get.bind(registry)
|
|
507
508
|
};
|
|
508
509
|
const prior = autoCrudOptionsOf(existing.resolver) ?? {
|
|
509
510
|
policy: existing.policy,
|
|
@@ -650,11 +651,23 @@ const pendingStorage = /* @__PURE__ */ new Set();
|
|
|
650
651
|
async function storageSettled() {
|
|
651
652
|
await Promise.all([...pendingStorage]);
|
|
652
653
|
}
|
|
653
|
-
function prepareStorage(dataset, type, scope) {
|
|
654
|
+
function prepareStorage(dataset, type, handle, scope) {
|
|
654
655
|
if (scope?.signal.aborted === true) return;
|
|
655
656
|
const work = (async () => {
|
|
656
657
|
try {
|
|
657
|
-
await dataset.ensureTypeStorage?.(type,
|
|
658
|
+
const pending = (await dataset.ensureTypeStorage?.(type, {
|
|
659
|
+
newFields: "pending",
|
|
660
|
+
...scope ? { signal: scope.signal } : {}
|
|
661
|
+
}))?.pending ?? [];
|
|
662
|
+
if (handle !== void 0 && pending.length > 0) await emitFieldEvents(handle, pending.map((field) => ({
|
|
663
|
+
kind: "field_pending",
|
|
664
|
+
namespace: dataset.namespace,
|
|
665
|
+
type,
|
|
666
|
+
field,
|
|
667
|
+
attempts: 0
|
|
668
|
+
}))).catch((err) => {
|
|
669
|
+
process.stderr.write(`[substrate-proposals] field_pending for ${dataset.namespace}/${type} not audited: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
670
|
+
});
|
|
658
671
|
} catch (err) {
|
|
659
672
|
process.stderr.write(`[substrate-proposals] storage for ${dataset.namespace}/${type} not prepared: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
660
673
|
}
|
|
@@ -674,15 +687,18 @@ function prepareStorage(dataset, type, scope) {
|
|
|
674
687
|
* bound and must not hold the caller's response; rows written meanwhile land
|
|
675
688
|
* in the DEFAULT partition and are moved. A failure is logged and never
|
|
676
689
|
* undoes the committed proposal; the next boot or proposal retries.
|
|
677
|
-
*
|
|
690
|
+
* A field added to a type that already has a table is recorded `pending`, and
|
|
691
|
+
* one `field_pending` `_system/AuditEvent` per such field is written and
|
|
692
|
+
* announced through `handle` (F11, F12). {@link storageSettled} awaits it;
|
|
693
|
+
* `scope`'s signal aborts it.
|
|
678
694
|
*/
|
|
679
|
-
function ensureStorageAfterCommit(afterTx, dataset, type, scope) {
|
|
695
|
+
function ensureStorageAfterCommit(afterTx, dataset, type, handle, scope) {
|
|
680
696
|
if (afterTx === void 0) {
|
|
681
|
-
prepareStorage(dataset, type, scope);
|
|
697
|
+
prepareStorage(dataset, type, handle, scope);
|
|
682
698
|
return;
|
|
683
699
|
}
|
|
684
700
|
afterTx(async ({ committed }) => {
|
|
685
|
-
if (committed) prepareStorage(dataset, type, scope);
|
|
701
|
+
if (committed) prepareStorage(dataset, type, handle, scope);
|
|
686
702
|
});
|
|
687
703
|
}
|
|
688
704
|
|
|
@@ -919,7 +935,7 @@ async function applyProposalFromNotification(args) {
|
|
|
919
935
|
changed = true;
|
|
920
936
|
}
|
|
921
937
|
changed = replayTypeIndexOptions(args.registryStore, args.namespace, row) || changed;
|
|
922
|
-
if (changed) ensureStorageAfterCommit(void 0, binding.dataset, typeName, args.registryStore.storage);
|
|
938
|
+
if (changed) ensureStorageAfterCommit(void 0, binding.dataset, typeName, binding.engine, args.registryStore.storage);
|
|
923
939
|
return;
|
|
924
940
|
}
|
|
925
941
|
const fieldHit = await binding.dataset.read("FieldProposal", { id: args.proposalId });
|
|
@@ -938,7 +954,7 @@ async function applyProposalFromNotification(args) {
|
|
|
938
954
|
dataset: binding.dataset,
|
|
939
955
|
edges: binding.edges
|
|
940
956
|
});
|
|
941
|
-
ensureStorageAfterCommit(void 0, binding.dataset, row.targetType, args.registryStore.storage);
|
|
957
|
+
ensureStorageAfterCommit(void 0, binding.dataset, row.targetType, binding.engine, args.registryStore.storage);
|
|
942
958
|
}
|
|
943
959
|
}
|
|
944
960
|
}
|
|
@@ -1035,7 +1051,7 @@ async function reconcileNamespace(args) {
|
|
|
1035
1051
|
} catch (err) {
|
|
1036
1052
|
args.onSkip?.(row, err);
|
|
1037
1053
|
}
|
|
1038
|
-
for (const type of prepare) ensureStorageAfterCommit(void 0, binding.dataset, type, args.registryStore.storage);
|
|
1054
|
+
for (const type of prepare) ensureStorageAfterCommit(void 0, binding.dataset, type, binding.engine, args.registryStore.storage);
|
|
1039
1055
|
}
|
|
1040
1056
|
/**
|
|
1041
1057
|
* Shared install path for a hot-added namespace. Three call sites use this:
|
|
@@ -1626,7 +1642,7 @@ async function proposeFieldLocked(deps, ctx, args, input) {
|
|
|
1626
1642
|
await args.dataset.write("FieldProposal", [appliedRow]);
|
|
1627
1643
|
}
|
|
1628
1644
|
await notifyAfterCommit(args, () => deps.pubsub.notify(deps.channelFor(deps.namespace), String(newId)));
|
|
1629
|
-
ensureStorageAfterCommit(args.afterTx, deps.dataset, targetType, deps.registryStore.storage);
|
|
1645
|
+
ensureStorageAfterCommit(args.afterTx, deps.dataset, targetType, engine, deps.registryStore.storage);
|
|
1630
1646
|
if (migration === null) return appliedRow;
|
|
1631
1647
|
const { ids: _written, ...summary } = migration;
|
|
1632
1648
|
return {
|
|
@@ -1964,7 +1980,7 @@ async function changeProposedType(call) {
|
|
|
1964
1980
|
await call.claim("accepted");
|
|
1965
1981
|
await call.audit(detail);
|
|
1966
1982
|
await storeTypeIndexOptions(call, binding, proposal, next);
|
|
1967
|
-
ensureStorageAfterCommit(args.afterTx, binding.dataset, type, deps.registryStore.storage);
|
|
1983
|
+
ensureStorageAfterCommit(args.afterTx, binding.dataset, type, binding.engine, deps.registryStore.storage);
|
|
1968
1984
|
}
|
|
1969
1985
|
|
|
1970
1986
|
//#endregion
|
|
@@ -2150,7 +2166,7 @@ async function proposeTypeLocked(deps, ctx, args, input) {
|
|
|
2150
2166
|
await args.dataset.write("TypeProposal", [appliedRow]);
|
|
2151
2167
|
}
|
|
2152
2168
|
await notifyAfterCommit(args, () => deps.pubsub.notify(deps.channelFor(deps.namespace), String(newId)));
|
|
2153
|
-
ensureStorageAfterCommit(args.afterTx, deps.dataset, typeName, deps.registryStore.storage);
|
|
2169
|
+
ensureStorageAfterCommit(args.afterTx, deps.dataset, typeName, engine, deps.registryStore.storage);
|
|
2154
2170
|
return appliedRow;
|
|
2155
2171
|
}
|
|
2156
2172
|
|