@powerhousedao/reactor 6.2.3-dev.1 → 6.2.3-dev.10

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/dist/entry.js CHANGED
@@ -1,6 +1,6 @@
1
- import { o as instrumentPgPool } from "./drive-container-types-yZrksiJR.js";
1
+ import { o as instrumentPgPool } from "./drive-container-types-CE7dxz0_.js";
2
2
  import { n as errorToInfo, t as createForwardingLogger } from "./forwarding-logger-BBkMSxuJ.js";
3
- import { n as defaultLoadFactory, t as buildWorkerExecutor } from "./build-worker-executor-DnU3ZU4H.js";
3
+ import { n as defaultLoadFactory, t as buildWorkerExecutor } from "./build-worker-executor-_x-U7e_A.js";
4
4
  import { ConsoleLogger } from "document-model";
5
5
  import { isMainThread, parentPort } from "node:worker_threads";
6
6
  //#region src/executor/worker/run-worker.ts
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Action, AuthRequest, AuthSubject, CreateDocumentActionInput, DocumentModelModule, ISigner, Operation, OperationContext, OperationWithContext, OperationWithContext as OperationWithContext$1, PHAuthState, PHDocument, PHDocumentState, SignatureVerificationHandler, UpgradeDocumentActionInput, UpgradeManifest, UpgradeReducer, UpgradeTransition, actions as documentActions } from "@powerhousedao/shared/document-model";
1
+ import { Action, AuthRequest, AuthSubject, CreateDocumentActionInput, DocumentModelModule, ISigner, Operation, OperationContext, OperationOutcome, OperationWithContext, OperationWithContext as OperationWithContext$1, PHAuthState, PHDocument, PHDocumentState, SignatureVerificationHandler, UpgradeDocumentActionInput, UpgradeManifest, UpgradeReducer, UpgradeTransition, actions as documentActions } from "@powerhousedao/shared/document-model";
2
2
  import { DocumentDriveDocument, DriveInput, FolderNode, Node } from "@powerhousedao/shared/document-drive";
3
3
  import { ILogger } from "document-model";
4
4
  import * as kysely from "kysely";
@@ -205,6 +205,27 @@ type BatchMeta = {
205
205
  * Always includes batch fields; callers may add additional properties.
206
206
  */
207
207
  type JobMeta = BatchMeta & Record<string, unknown>;
208
+ /**
209
+ * What became of one action the caller submitted, at the position the
210
+ * operation carrying it was written to.
211
+ */
212
+ type SubmittedActionResult = {
213
+ actionId: string;
214
+ scope: string; /** The index the operation occupies in its scope. */
215
+ index: number;
216
+ } & OperationOutcome;
217
+ /**
218
+ * The outcome of every action a job was given.
219
+ *
220
+ * A reducer error or a denial does not fail the job: the operation is still
221
+ * written at its index, the rest of the batch still applies, and the job still
222
+ * reaches READ_READY. This is the only place a caller can see that one of its
223
+ * actions was rejected.
224
+ */
225
+ type JobResultSummary = {
226
+ /** One entry per submitted action that produced an operation, in write order. */actions: SubmittedActionResult[]; /** False when any submitted action hit a reducer error or was denied. */
227
+ allApplied: boolean;
228
+ };
208
229
  /**
209
230
  * Describes the current state of a job.
210
231
  */
@@ -216,7 +237,12 @@ type JobInfo = {
216
237
  completedAtUtcIso?: string;
217
238
  error?: ErrorInfo$1;
218
239
  errorHistory?: ErrorInfo$1[];
219
- result?: any;
240
+ /**
241
+ * What the job produced for its caller, from the moment its operations are
242
+ * durable. Undefined until then, and on jobs that carry no submitted
243
+ * actions.
244
+ */
245
+ result?: JobResultSummary;
220
246
  /**
221
247
  * A token for coordinating reads, only valid once a job reaches COMPLETED.
222
248
  */
@@ -1553,6 +1579,13 @@ type JobWriteReadyEvent = {
1553
1579
  jobId: string;
1554
1580
  operations: OperationWithContext$1[];
1555
1581
  jobMeta: JobMeta;
1582
+ /**
1583
+ * The ids of the actions the caller submitted with this job. `operations`
1584
+ * can also carry operations the job merely moved into a new position, so a
1585
+ * consumer reporting back to the caller needs this to tell the two apart.
1586
+ * Absent on jobs that carry no submitted actions.
1587
+ */
1588
+ submittedActionIds?: string[];
1556
1589
  /**
1557
1590
  * Maps documentId to the collection IDs it belongs to.
1558
1591
  * Used by SyncManager to route operations only to remotes
@@ -2056,6 +2089,36 @@ interface IReactorClient {
2056
2089
  * @returns The source documents and paging cursor
2057
2090
  */
2058
2091
  getIncomingRelationships(targetIdentifier: string, relationshipType: string, view?: ViewFilter, paging?: PagingOptions, signal?: AbortSignal): Promise<PagedResults<PHDocument>>;
2092
+ /**
2093
+ * Retrieves the outgoing relationship edges of a source document.
2094
+ *
2095
+ * Unlike {@link IReactorClient.getOutgoingRelationships}, which returns the
2096
+ * documents at the far end, this returns the edges themselves, carrying the
2097
+ * metadata and timestamps recorded against each relationship.
2098
+ *
2099
+ * @param sourceIdentifier - Required, this is either a document "id" field or a "slug"
2100
+ * @param relationshipType - Optional relationship type to filter by
2101
+ * @param view - Optional filter containing branch and scopes information
2102
+ * @param paging - Optional pagination options
2103
+ * @param signal - Optional abort signal to cancel the request
2104
+ * @returns The matching relationship edges and paging cursor
2105
+ */
2106
+ getOutgoingRelationshipEdges(sourceIdentifier: string, relationshipType?: string, view?: ViewFilter, paging?: PagingOptions, signal?: AbortSignal): Promise<PagedResults<DocumentRelationship>>;
2107
+ /**
2108
+ * Retrieves the incoming relationship edges of a target document.
2109
+ *
2110
+ * Unlike {@link IReactorClient.getIncomingRelationships}, which returns the
2111
+ * documents at the far end, this returns the edges themselves, carrying the
2112
+ * metadata and timestamps recorded against each relationship.
2113
+ *
2114
+ * @param targetIdentifier - Required, this is either a document "id" field or a "slug"
2115
+ * @param relationshipType - Optional relationship type to filter by
2116
+ * @param view - Optional filter containing branch and scopes information
2117
+ * @param paging - Optional pagination options
2118
+ * @param signal - Optional abort signal to cancel the request
2119
+ * @returns The matching relationship edges and paging cursor
2120
+ */
2121
+ getIncomingRelationshipEdges(targetIdentifier: string, relationshipType?: string, view?: ViewFilter, paging?: PagingOptions, signal?: AbortSignal): Promise<PagedResults<DocumentRelationship>>;
2059
2122
  /**
2060
2123
  * Filters documents by criteria and returns a list of them
2061
2124
  *
@@ -2231,14 +2294,31 @@ interface IReactorClient {
2231
2294
  /**
2232
2295
  * Adds a relationship between two documents and waits for completion.
2233
2296
  *
2297
+ * Adding a relationship that already exists is a no-op, metadata included.
2298
+ * Use {@link IReactorClient.updateRelationship} to change an existing edge.
2299
+ *
2234
2300
  * @param sourceIdentifier - Source document id or slug
2235
2301
  * @param targetIdentifier - Target document id or slug
2236
2302
  * @param relationshipType - Relationship type identifier
2303
+ * @param metadata - Optional metadata to attach to the relationship
2237
2304
  * @param branch - Optional branch to add the relationship to, defaults to "main"
2238
2305
  * @param signal - Optional abort signal to cancel the request
2239
2306
  * @returns The updated source document
2240
2307
  */
2241
- addRelationship(sourceIdentifier: string, targetIdentifier: string, relationshipType: string, branch?: string, signal?: AbortSignal): Promise<PHDocument>;
2308
+ addRelationship(sourceIdentifier: string, targetIdentifier: string, relationshipType: string, metadata?: Record<string, unknown>, branch?: string, signal?: AbortSignal): Promise<PHDocument>;
2309
+ /**
2310
+ * Replaces the metadata of an existing relationship and waits for completion.
2311
+ * The relationship's createdAt is preserved.
2312
+ *
2313
+ * @param sourceIdentifier - Source document id or slug
2314
+ * @param targetIdentifier - Target document id or slug
2315
+ * @param relationshipType - Relationship type identifier
2316
+ * @param metadata - The metadata to store; null clears it
2317
+ * @param branch - Optional branch holding the relationship, defaults to "main"
2318
+ * @param signal - Optional abort signal to cancel the request
2319
+ * @returns The updated source document
2320
+ */
2321
+ updateRelationship(sourceIdentifier: string, targetIdentifier: string, relationshipType: string, metadata: Record<string, unknown> | null, branch?: string, signal?: AbortSignal): Promise<PHDocument>;
2242
2322
  /**
2243
2323
  * Removes a relationship between two documents and waits for completion.
2244
2324
  *
@@ -3836,6 +3916,38 @@ declare class ReactorClient implements IReactorClient {
3836
3916
  * Retrieves incoming relationships of a given type to a target document.
3837
3917
  */
3838
3918
  getIncomingRelationships(targetIdentifier: string, relationshipType: string, view?: ViewFilter, paging?: PagingOptions, signal?: AbortSignal): Promise<PagedResults<PHDocument>>;
3919
+ /**
3920
+ * Retrieves the outgoing relationship edges of a source document, carrying the
3921
+ * metadata and timestamps the far-end documents do not.
3922
+ */
3923
+ getOutgoingRelationshipEdges(sourceIdentifier: string, relationshipType?: string, view?: ViewFilter, paging?: PagingOptions, signal?: AbortSignal): Promise<PagedResults<DocumentRelationship>>;
3924
+ /**
3925
+ * Retrieves the incoming relationship edges of a target document, carrying the
3926
+ * metadata and timestamps the far-end documents do not.
3927
+ */
3928
+ getIncomingRelationshipEdges(targetIdentifier: string, relationshipType?: string, view?: ViewFilter, paging?: PagingOptions, signal?: AbortSignal): Promise<PagedResults<DocumentRelationship>>;
3929
+ /**
3930
+ * Drops the edges whose far-end document the subject may read no domain scope
3931
+ * of. An edge is withheld whole rather than stripped of its metadata: the
3932
+ * document-shaped relationship reads already answer with the far end stripped
3933
+ * to the scopes the gate allows, so the far end's existence is disclosed
3934
+ * either way, but an edge's metadata is content about the pair that the far
3935
+ * end's own reads would refuse. An edge to a far end stripped to nothing
3936
+ * therefore carries content past a refusal, and there is no useful shell to
3937
+ * hand back in its place.
3938
+ *
3939
+ * `nextCursor` and `options` are left as the underlying stream reported them,
3940
+ * because a caller must feed them back to resume from the right position. A
3941
+ * gated page can therefore be shorter than the limit it asked for.
3942
+ */
3943
+ private gateEdges;
3944
+ /**
3945
+ * One relationship edge, or undefined when it does not exist. A point lookup:
3946
+ * the pair is filtered in SQL rather than scanned out of the source's edge
3947
+ * list, which on a drive with thousands of children is the difference between
3948
+ * one query and dozens.
3949
+ */
3950
+ private readRelationshipEdge;
3839
3951
  /**
3840
3952
  * Filters documents by criteria and returns a list of them
3841
3953
  */
@@ -3923,7 +4035,11 @@ declare class ReactorClient implements IReactorClient {
3923
4035
  /**
3924
4036
  * Adds multiple documents as children to another and waits for completion
3925
4037
  */
3926
- addRelationship(sourceIdentifier: string, targetIdentifier: string, relationshipType: string, branch?: string, signal?: AbortSignal): Promise<PHDocument>;
4038
+ addRelationship(sourceIdentifier: string, targetIdentifier: string, relationshipType: string, metadata?: Record<string, unknown>, branch?: string, signal?: AbortSignal): Promise<PHDocument>;
4039
+ /**
4040
+ * Replaces the metadata of an existing relationship and waits for completion.
4041
+ */
4042
+ updateRelationship(sourceIdentifier: string, targetIdentifier: string, relationshipType: string, metadata: Record<string, unknown> | null, branch?: string, signal?: AbortSignal): Promise<PHDocument>;
3927
4043
  /**
3928
4044
  * Removes a relationship between two documents and waits for completion.
3929
4045
  */
@@ -4450,8 +4566,29 @@ declare const DRIVE_AUTH_ERROR_MESSAGES: {
4450
4566
  readonly forbidden: "Forbidden: insufficient permissions";
4451
4567
  readonly authenticationRequired: "Forbidden: authentication required";
4452
4568
  };
4569
+ /**
4570
+ * A non-GraphQL HTTP failure against a drive endpoint.
4571
+ *
4572
+ * Drive discovery (`GET <base>/d/:drive`) is REST, not GraphQL, so its
4573
+ * failures cannot be a `GraphQLRequestError` without the name lying about
4574
+ * what was called. It carries the status for the same reason that one does:
4575
+ * `isDriveAuthError` is what decides whether a failure prompts a login, and a
4576
+ * bare `Error` tells it nothing.
4577
+ */
4578
+ declare class DriveRequestError extends Error {
4579
+ readonly statusCode: number | undefined;
4580
+ constructor(message: string, statusCode?: number);
4581
+ }
4453
4582
  /** True when the remote rejected the caller as unauthenticated/unauthorized:
4454
- * an HTTP 401/403, or a Forbidden/Unauthorized GraphQL error. */
4583
+ * an HTTP 401/403, or a Forbidden/Unauthorized GraphQL error.
4584
+ *
4585
+ * 403 and 401 only — NOT 404. The drive info endpoint answers a drive the
4586
+ * caller may not read with the same 404 it gives a drive that does not exist,
4587
+ * so that an unauthorized caller cannot enumerate drives by probing slugs.
4588
+ * That is deliberate, and it costs exactly this: a protected drive is
4589
+ * indistinguishable from a typo, and prompting for a login on every 404 would
4590
+ * fire on every mistyped URL. See the `WWW-Authenticate` note on the endpoint
4591
+ * for the signal that would let a client tell the two apart. */
4455
4592
  declare function isDriveAuthError(error: unknown): boolean;
4456
4593
  declare class PollingChannelError extends Error {
4457
4594
  constructor(message: string);
@@ -4637,6 +4774,23 @@ interface IChannel {
4637
4774
  * not poll (e.g. push-only response channels) should treat this as a no-op.
4638
4775
  */
4639
4776
  triggerPull(): void;
4777
+ /**
4778
+ * Records that this channel's holder just interacted with it.
4779
+ *
4780
+ * Only a served channel has a holder to hear from; a channel that polls a
4781
+ * remote itself should treat this as a no-op, as with triggerPull.
4782
+ */
4783
+ notePoll(): void;
4784
+ /**
4785
+ * When this channel's holder last interacted with it, if it has one.
4786
+ *
4787
+ * A channel that polls a remote itself reports undefined: the only liveness
4788
+ * it knows is the remote's, which says nothing about whether anyone still
4789
+ * wants what this replica holds for it. Reporting a timestamp is the
4790
+ * channel's own claim that it serves a holder, and is what makes it
4791
+ * eligible to be removed when that holder goes silent.
4792
+ */
4793
+ lastHolderPollUtcMs(): number | undefined;
4640
4794
  }
4641
4795
  /**
4642
4796
  * Factory for creating channel instances.
@@ -4919,6 +5073,30 @@ interface IReactor {
4919
5073
  * @returns The list of source document ids
4920
5074
  */
4921
5075
  getIncomingRelationships(targetId: string, relationshipType: string, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<string[]>;
5076
+ /**
5077
+ * Retrieves outgoing relationship edges from a source document, carrying the
5078
+ * metadata and timestamps the document ids alone do not.
5079
+ *
5080
+ * @param sourceId - The source document id
5081
+ * @param relationshipType - Optional relationship type to filter by
5082
+ * @param paging - Optional pagination options
5083
+ * @param consistencyToken - Optional token for read-after-write consistency
5084
+ * @param signal - Optional abort signal to cancel the request
5085
+ * @returns The matching relationship edges
5086
+ */
5087
+ getOutgoingRelationshipEdges(sourceId: string, relationshipType?: string, paging?: PagingOptions, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<PagedResults<DocumentRelationship>>;
5088
+ /**
5089
+ * Retrieves incoming relationship edges to a target document, carrying the
5090
+ * metadata and timestamps the document ids alone do not.
5091
+ *
5092
+ * @param targetId - The target document id
5093
+ * @param relationshipType - Optional relationship type to filter by
5094
+ * @param paging - Optional pagination options
5095
+ * @param consistencyToken - Optional token for read-after-write consistency
5096
+ * @param signal - Optional abort signal to cancel the request
5097
+ * @returns The matching relationship edges
5098
+ */
5099
+ getIncomingRelationshipEdges(targetId: string, relationshipType?: string, paging?: PagingOptions, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<PagedResults<DocumentRelationship>>;
4922
5100
  /**
4923
5101
  * Retrieves the operations for a document
4924
5102
  *
@@ -5020,15 +5198,32 @@ interface IReactor {
5020
5198
  /**
5021
5199
  * Adds a relationship between two documents.
5022
5200
  *
5201
+ * Adding a relationship that already exists is a no-op, metadata included.
5202
+ * Use {@link IReactor.updateRelationship} to change an existing edge.
5203
+ *
5023
5204
  * @param sourceId - Source document id
5024
5205
  * @param targetId - Target document id
5025
5206
  * @param relationshipType - Relationship type identifier
5207
+ * @param metadata - Optional metadata to attach to the relationship
5026
5208
  * @param branch - Branch to add the relationship to, defaults to "main"
5027
5209
  * @param signer - Optional signer to sign the actions
5028
5210
  * @param signal - Optional abort signal to cancel the request
5029
5211
  * @returns The job id and status
5030
5212
  */
5031
- addRelationship(sourceId: string, targetId: string, relationshipType: string, branch?: string, signer?: ISigner, signal?: AbortSignal): Promise<JobInfo>;
5213
+ addRelationship(sourceId: string, targetId: string, relationshipType: string, metadata?: Record<string, unknown>, branch?: string, signer?: ISigner, signal?: AbortSignal): Promise<JobInfo>;
5214
+ /**
5215
+ * Replaces the metadata of an existing relationship, preserving its createdAt.
5216
+ *
5217
+ * @param sourceId - Source document id
5218
+ * @param targetId - Target document id
5219
+ * @param relationshipType - Relationship type identifier
5220
+ * @param metadata - The metadata to store; null clears it
5221
+ * @param branch - Branch holding the relationship, defaults to "main"
5222
+ * @param signer - Optional signer to sign the actions
5223
+ * @param signal - Optional abort signal to cancel the request
5224
+ * @returns The job id and status
5225
+ */
5226
+ updateRelationship(sourceId: string, targetId: string, relationshipType: string, metadata: Record<string, unknown> | null, branch?: string, signer?: ISigner, signal?: AbortSignal): Promise<JobInfo>;
5032
5227
  /**
5033
5228
  * Removes a relationship between two documents.
5034
5229
  *
@@ -5091,6 +5286,20 @@ interface ReactorModule {
5091
5286
  * direct access to internal components for advanced use cases, testing, or
5092
5287
  * integration scenarios.
5093
5288
  */
5289
+ /**
5290
+ * A component that failed to build or catch up, and was started anyway.
5291
+ *
5292
+ * The reactor does not take itself down for one of these: a read model that
5293
+ * cannot reach its database should not stop the writes. But it does serve
5294
+ * reads that are silently incomplete, so the failure is recorded rather than
5295
+ * only logged -- a host can refuse readiness on a non-empty list instead of
5296
+ * reporting healthy while answering from an index that stopped at boot.
5297
+ */
5298
+ interface DegradedComponent {
5299
+ /** Names the component that failed, e.g. `read model 0 (attachments)`. */
5300
+ component: string;
5301
+ error: Error;
5302
+ }
5094
5303
  interface InProcessReactorModule extends ReactorModule {
5095
5304
  /**
5096
5305
  * The enforcement flags this reactor resolved, as plain booleans. Held on the
@@ -5129,6 +5338,11 @@ interface InProcessReactorModule extends ReactorModule {
5129
5338
  * record per-pool acquire-wait and stat metrics.
5130
5339
  */
5131
5340
  pools: PoolInstrumentation[];
5341
+ /**
5342
+ * Components that failed to initialize and were started degraded. Empty on
5343
+ * a clean boot. See {@link DegradedComponent}.
5344
+ */
5345
+ degradedComponents: DegradedComponent[];
5132
5346
  }
5133
5347
  /**
5134
5348
  * Base reactor client contract — the client plus its reactor module. Satisfied
@@ -5679,6 +5893,7 @@ declare class SyncBuilder {
5679
5893
  withMaxDeadLettersPerRemote(limit: number): this;
5680
5894
  withMaxInboxBatchSize(limit: number): this;
5681
5895
  withMaxHeldOperationsPerRemote(limit: number): this;
5896
+ withStaleRemotePollWindowMs(windowMs: number): this;
5682
5897
  build(reactor: IReactor, logger: ILogger, operationIndex: IOperationIndex, eventBus: IEventBus, db: Kysely<Database$1>, driveContainerTypes: ReadonlySet<string>): ISyncManager;
5683
5898
  buildModule(reactor: IReactor, logger: ILogger, operationIndex: IOperationIndex, eventBus: IEventBus, db: Kysely<Database$1>, driveContainerTypes: ReadonlySet<string>): InProcessSyncModule;
5684
5899
  }
@@ -6064,6 +6279,8 @@ declare class Reactor implements IReactor {
6064
6279
  getByIdOrSlug<TDocument extends PHDocument>(identifier: string, view?: ViewFilter, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<TDocument>;
6065
6280
  getOutgoingRelationships(sourceId: string, relationshipType: string, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<string[]>;
6066
6281
  getIncomingRelationships(targetId: string, relationshipType: string, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<string[]>;
6282
+ getOutgoingRelationshipEdges(sourceId: string, relationshipType?: string, paging?: PagingOptions, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<PagedResults<DocumentRelationship>>;
6283
+ getIncomingRelationshipEdges(targetId: string, relationshipType?: string, paging?: PagingOptions, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<PagedResults<DocumentRelationship>>;
6067
6284
  getOperations(documentId: string, view?: ViewFilter, filter?: OperationFilter, paging?: PagingOptions, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<Record<string, PagedResults<Operation>>>;
6068
6285
  find(search: SearchFilter, view?: ViewFilter, paging?: PagingOptions, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<PagedResults<PHDocument>>;
6069
6286
  create(document: PHDocument, signer?: ISigner, signal?: AbortSignal, meta?: Record<string, unknown>): Promise<JobInfo>;
@@ -6072,7 +6289,8 @@ declare class Reactor implements IReactor {
6072
6289
  load(docId: string, branch: string, operations: Operation[], signal?: AbortSignal, meta?: Record<string, unknown>): Promise<JobInfo>;
6073
6290
  executeBatch(request: BatchExecutionRequest, signal?: AbortSignal, meta?: Record<string, unknown>): Promise<BatchExecutionResult>;
6074
6291
  loadBatch(request: BatchLoadRequest, signal?: AbortSignal, meta?: Record<string, unknown>): Promise<BatchLoadResult>;
6075
- addRelationship(sourceId: string, targetId: string, relationshipType: string, branch?: string, signer?: ISigner, signal?: AbortSignal): Promise<JobInfo>;
6292
+ addRelationship(sourceId: string, targetId: string, relationshipType: string, metadata?: Record<string, unknown>, branch?: string, signer?: ISigner, signal?: AbortSignal): Promise<JobInfo>;
6293
+ updateRelationship(sourceId: string, targetId: string, relationshipType: string, metadata: Record<string, unknown> | null, branch?: string, signer?: ISigner, signal?: AbortSignal): Promise<JobInfo>;
6076
6294
  removeRelationship(sourceId: string, targetId: string, relationshipType: string, branch?: string, signer?: ISigner, signal?: AbortSignal): Promise<JobInfo>;
6077
6295
  getJobStatus(jobId: string, signal?: AbortSignal): Promise<JobInfo>;
6078
6296
  private findByIds;
@@ -6122,6 +6340,21 @@ declare class AuthEnforcementDisabledError extends Error {
6122
6340
  constructor();
6123
6341
  static isError(error: unknown): error is AuthEnforcementDisabledError;
6124
6342
  }
6343
+ /**
6344
+ * Error thrown when a relationship edge an operation names does not exist.
6345
+ *
6346
+ * Detection is by `name`, not `instanceof`: the SharedWorker RPC boundary
6347
+ * rebuilds a thrown error from `{ name, message, stack, cause }` alone
6348
+ * (`reactor-browser/src/rpc/error-info.ts`), so the class identity is lost in
6349
+ * transit.
6350
+ */
6351
+ declare class RelationshipNotFoundError extends Error {
6352
+ readonly sourceId: string;
6353
+ readonly targetId: string;
6354
+ readonly relationshipType: string;
6355
+ constructor(sourceId: string, targetId: string, relationshipType: string);
6356
+ static isError(error: unknown): error is RelationshipNotFoundError;
6357
+ }
6125
6358
  //#endregion
6126
6359
  //#region src/shared/factories.d.ts
6127
6360
  /**
@@ -7045,6 +7278,10 @@ declare class GqlRequestChannel implements IChannel {
7045
7278
  getConnectionState(): ConnectionStateSnapshot;
7046
7279
  onConnectionStateChange(callback: ConnectionStateChangeCallback): () => void;
7047
7280
  triggerPull(): void;
7281
+ /** This channel polls a remote itself; it has no holder to hear from. */
7282
+ notePoll(): void;
7283
+ /** No holder, so nothing this channel reports may strand one. */
7284
+ lastHolderPollUtcMs(): number | undefined;
7048
7285
  /**
7049
7286
  * Initializes the channel by registering it on the remote server and starting polling.
7050
7287
  */
@@ -7152,6 +7389,7 @@ declare class GqlResponseChannel implements IChannel {
7152
7389
  private lastPersistedOutboxOrdinal;
7153
7390
  private evictedOutboxFloor;
7154
7391
  private appliedOutboxOrdinal;
7392
+ private lastPollUtcMs;
7155
7393
  private connectionState;
7156
7394
  private readonly connectionStateCallbacks;
7157
7395
  constructor(logger: ILogger, channelId: string, remoteName: string, cursorStorage: ISyncCursorStorage);
@@ -7160,6 +7398,9 @@ declare class GqlResponseChannel implements IChannel {
7160
7398
  onConnectionStateChange(callback: ConnectionStateChangeCallback): () => void;
7161
7399
  /** Response channels are push-driven; resolvers populate mailboxes directly. */
7162
7400
  triggerPull(): void;
7401
+ notePoll(): void;
7402
+ /** This channel is served: its holder's polls are the liveness it reports. */
7403
+ lastHolderPollUtcMs(): number | undefined;
7163
7404
  init(): Promise<void>;
7164
7405
  private transitionConnectionState;
7165
7406
  /**
@@ -7434,5 +7675,5 @@ declare class ProcessorManager extends BaseReadModel implements IProcessorManage
7434
7675
  private deleteProcessorCursors;
7435
7676
  }
7436
7677
  //#endregion
7437
- export { ALWAYS_READABLE_SCOPES, APPEND_CONDITION_FAILED_PREFIX, type AbortMessage, type ActionCandidate, type ActionEvaluationConfig, type ActionEvaluations, type AdmissionDecision, type AppendCondition, AppendConditionFailedError, type AppendConditionStream, type AtomicTxn, type AttachmentHash, type AttachmentRef, type AuthDecisionModel, AuthEnforcementDisabledError, BareReadGate, BaseReadModel, type BatchExecutionRequest, type BatchExecutionResult, type BatchLoadRequest, type BatchLoadResult, type BuiltDecisionModel, type BuiltInReadModelKind, type CachedSnapshot, type ChannelConfig, ChannelError, ChannelErrorSource, type ChannelHealth, type ChannelMeta, ChannelScheme, type ConnectionState, type ConnectionStateChangeCallback, type ConnectionStateChangedEvent, type ConnectionStateSnapshot, type ConsistencyCoordinate, type ConsistencyKey, type ConsistencyToken, ConsistencyTracker, DEFAULT_DRIVE_CONTAINER_TYPES, DOCUMENT_INDEXER_READ_MODEL, DOCUMENT_VIEW_READ_MODEL, DRIVE_AUTH_ERROR_MESSAGES, type Database, type DbConfig, type DeadLetterAddedEvent, type DecisionContext, type DecisionModel, type DecisionTarget, DefaultSubscriptionErrorHandler, DocumentAlreadyExistsError, type DocumentChangeEvent, DocumentChangeType, type DocumentDecisionModel, DocumentExistence, type DocumentGraphEdge, type DocumentIndexerDatabase, DocumentIntegrityService, DocumentModelRegistry, DocumentModelResolver, type DocumentModelSource, type DocumentModelSpec, type DocumentRelationship, type DocumentRevisions, type DocumentStreamKey, type DocumentViewDatabase, DriveClient, DriveCollectionId, DuplicateManifestError, DuplicateModuleError, DuplicateOperationError, type Evaluation, EventBus, EventBusAggregateError, type ExecuteMessage, type ExecutionJobPlan, type ExecutorStartedEvent, type ExecutorStoppedEvent, type FactorySpec, type FileModelSource, type GqlChannelConfig, GqlRequestChannel, GqlRequestChannelFactory, GqlResponseChannel, GqlResponseChannelFactory, type HeartbeatMessage, HybridProjectionCoordinator, type HybridProjectionCoordinatorOptions, type HybridProjectionOptions, type IChannel, type IChannelFactory, type IConsistencyTracker, type IDocumentGraph, type IDocumentIndexer, type IDocumentIntegrityService, type IDocumentModelLoader, type IDocumentModelRegistry, type IDocumentModelResolver, type IDocumentView, type IDriveClient, type IEventBus, type IJobAwaiter, type IJobExecutor, type IJobExecutorManager, type IJobTracker, type IKeyframeStore, type ILiveReadModelCoordinator, type IMailbox, type IOperationIndex, type IOperationStore, type IPollTimer, type IProcessor, type IProcessorHostModuleBase, type IProcessorManager, type IProjectionTransport, type IQueue, type IReactor, type IReactorClient, type IReactorProcessorHostModuleBase, type IReactorSubscriptionManager, type IReadGate, type IReadModel, type IReadModelCoordinator, type IRelationalDb, type IStreamStateReader, type ISubscriptionErrorHandler, type ISyncCursorStorage, type ISyncManager, type ISyncRemoteStorage, type ISyncStatusTracker, type IWriteCache, SimpleJobExecutor as InMemoryJobExecutor, SimpleJobExecutor, InMemoryJobTracker, InMemoryQueue, type InProcessReactorClientModule, type InProcessReactorModule, type InProcessSyncModule, type InitMessage, type InsertableDocumentSnapshot, IntervalPollTimer, InvalidModuleError, type Job, type JobAvailableEvent, JobAwaiter, type JobCompletedEvent, type JobExecutorConfig, JobExecutorEventTypes, type JobExecutorFactory, type JobFailedEvent, type JobInfo, type JobPendingEvent, type JobReadReadyEvent, type JobResult, type JobRunningEvent, type JobStartedEvent, JobStatus, type JobWriteReadyEvent, type JobWriteReadyPayload, type JwtHandler, type KeyframeSnapshot, type KeyframeValidationIssue, KyselyDocumentIndexer, KyselyDocumentView, KyselyKeyframeStore, KyselyOperationStore, KyselySyncCursorStorage, KyselySyncRemoteStorage, KyselyWriteCache, type LoadJobPlan, type LoadModelMessage, type LogMessage, Mailbox, type MetricsMessage, type ModelLoadFailedMessage, type ModelLoadedEvent, type ModelLoadedMessage, type ModelManifestEntry, ModelReadGate, ModuleNotFoundError, type ModuleRef, NullDocumentModelResolver, type OperationBatch, type OperationContext, type OperationFilter, type OperationIndexEntry, type OperationTable, type OperationWithContext, OptimisticLockError, type OutOfOrderPair, type PackageModelSource, type PagedResults, type PagingOptions, type ParentMessage, type ParsedDriveUrl, type ParsedPaging, PollBehavior, PollingChannelError, type PoolInstrumentation, type PoolStats, type ProcessorApp, type ProcessorFactory, type ProcessorFactoryBuilder, type ProcessorFilter, ProcessorManager, type ProcessorRecord, type ProcessorStatus, type Projection, type ProjectionShardBuilderConfig, type ProjectionShardHooks, type ProjectionShardManagerConfig, type ProjectionWorkerFactory, PropagationMode, QueueEventTypes, REACTOR_SCHEMA, RECOVERABLE_GRAPHQL_ERROR_CODES, Reactor, ReactorBuilder, ReactorClient, ReactorClientBuilder, type ReactorClientModule, ReactorEventTypes, type ReactorFeatureFlags, type ReactorFeatures, type ReactorHostModuleBaseOptions, type JobFailedEvent$1 as ReactorJobFailedEvent, type ReactorModule, type ReactorReadModels, ReactorSubscriptionManager, type ReadGateOptions, type ReadModelBatchCompletedEvent, ReadModelCoordinator, type ReadModelCoordinatorFactory, type ReadModelCoordinatorFactoryDeps, type ReadModelFactory, type ReadModelFactoryDeps, type ReadModelIndexedEvent, type ReadModelIndexingStage, type ReadModelRegistrationStage, type ReadModelStage, type ReadyMessage, type RebuildResult, type RegisteredDecisionModel, RelationalDbProcessor, RelationshipChangeType, type Remote, type RemoteCursor, type RemoteFilter, type RemoteMeta, type RemoteOptions, type RemoteRecord, type RemoteStatus, type ResultMessage, RetryAccounting, RevisionMismatchError, type SanitizedArg, type SearchFilter, SeededStateReader, type ShutdownMessage, type ShutdownStatus, type SignatureVerificationHandler, type SignatureVerifierSpec, type SignerConfig, SimpleJobExecutorManager, type SnapshotValidationIssue, type Database$1 as StorageDatabase, type StreamOrderIssue, type StreamQuery, type SubscriptionErrorContext, SyncBuilder, type SyncEnvelope, type SyncEnvelopeType, SyncEventTypes, type SyncFailedEvent, type SyncModule, SyncOperation, SyncOperationAggregateError, type SyncOperationErrorType, SyncOperationStatus, type SyncPendingEvent, SyncScopeGate, SyncStatus, type SyncStatusChangeCallback, SyncStatusTracker, type SyncSucceededEvent, type TrackedProcessor, type Unsubscribe, type ValidationResult, type ViewFilter, type ErrorInfo as WorkerErrorInfo, type WorkerMessage, type WorkerPoolConfig, type WorkerPoolOptions, type WriteCacheConfig, addRelationshipAction, authDecisionModel, batchOperationsByDocument, buildDecisionModel, classifyJobFailure, consolidateSyncOperations, createDocumentAction, createForwardingLogger, createHybridProjectionCoordinatorFactory, createMutableShutdownStatus, createReactorHostModuleBase, createRelationalDb, decideAtHead, deleteDocumentAction, documentActions, documentDecisionModel, driveIdFromUrl, envelopesToSyncOperations, errorToInfo, firstOutOfOrderPair, getMigrationStatus, instrumentPgPool, isDriveAuthError, isRecoverableGraphQLError, makeConsistencyKey, parseDriveUrl, parsePagingOptions, quarantinesDocument, readDecisionModel, removeRelationshipAction, runMigrations, sanitizeArg, selectDecisionModel, supportsLiveReadModelRegistration, syncOperationErrorType, trimMailboxFromAckOrdinal, updateRelationshipAction, upgradeDocumentAction, workerEntryPath };
7678
+ export { ALWAYS_READABLE_SCOPES, APPEND_CONDITION_FAILED_PREFIX, type AbortMessage, type ActionCandidate, type ActionEvaluationConfig, type ActionEvaluations, type AdmissionDecision, type AppendCondition, AppendConditionFailedError, type AppendConditionStream, type AtomicTxn, type AttachmentHash, type AttachmentRef, type AuthDecisionModel, AuthEnforcementDisabledError, BareReadGate, BaseReadModel, type BatchExecutionRequest, type BatchExecutionResult, type BatchLoadRequest, type BatchLoadResult, type BuiltDecisionModel, type BuiltInReadModelKind, type CachedSnapshot, type ChannelConfig, ChannelError, ChannelErrorSource, type ChannelHealth, type ChannelMeta, ChannelScheme, type ConnectionState, type ConnectionStateChangeCallback, type ConnectionStateChangedEvent, type ConnectionStateSnapshot, type ConsistencyCoordinate, type ConsistencyKey, type ConsistencyToken, ConsistencyTracker, DEFAULT_DRIVE_CONTAINER_TYPES, DOCUMENT_INDEXER_READ_MODEL, DOCUMENT_VIEW_READ_MODEL, DRIVE_AUTH_ERROR_MESSAGES, type Database, type DbConfig, type DeadLetterAddedEvent, type DecisionContext, type DecisionModel, type DecisionTarget, DefaultSubscriptionErrorHandler, type DegradedComponent, DocumentAlreadyExistsError, type DocumentChangeEvent, DocumentChangeType, type DocumentDecisionModel, DocumentExistence, type DocumentGraphEdge, type DocumentIndexerDatabase, DocumentIntegrityService, DocumentModelRegistry, DocumentModelResolver, type DocumentModelSource, type DocumentModelSpec, type DocumentRelationship, type DocumentRevisions, type DocumentStreamKey, type DocumentViewDatabase, DriveClient, DriveCollectionId, DriveRequestError, DuplicateManifestError, DuplicateModuleError, DuplicateOperationError, type Evaluation, EventBus, EventBusAggregateError, type ExecuteMessage, type ExecutionJobPlan, type ExecutorStartedEvent, type ExecutorStoppedEvent, type FactorySpec, type FileModelSource, type GqlChannelConfig, GqlRequestChannel, GqlRequestChannelFactory, GqlResponseChannel, GqlResponseChannelFactory, type HeartbeatMessage, HybridProjectionCoordinator, type HybridProjectionCoordinatorOptions, type HybridProjectionOptions, type IChannel, type IChannelFactory, type IConsistencyTracker, type IDocumentGraph, type IDocumentIndexer, type IDocumentIntegrityService, type IDocumentModelLoader, type IDocumentModelRegistry, type IDocumentModelResolver, type IDocumentView, type IDriveClient, type IEventBus, type IJobAwaiter, type IJobExecutor, type IJobExecutorManager, type IJobTracker, type IKeyframeStore, type ILiveReadModelCoordinator, type IMailbox, type IOperationIndex, type IOperationStore, type IPollTimer, type IProcessor, type IProcessorHostModuleBase, type IProcessorManager, type IProjectionTransport, type IQueue, type IReactor, type IReactorClient, type IReactorProcessorHostModuleBase, type IReactorSubscriptionManager, type IReadGate, type IReadModel, type IReadModelCoordinator, type IRelationalDb, type IStreamStateReader, type ISubscriptionErrorHandler, type ISyncCursorStorage, type ISyncManager, type ISyncRemoteStorage, type ISyncStatusTracker, type IWriteCache, SimpleJobExecutor as InMemoryJobExecutor, SimpleJobExecutor, InMemoryJobTracker, InMemoryQueue, type InProcessReactorClientModule, type InProcessReactorModule, type InProcessSyncModule, type InitMessage, type InsertableDocumentSnapshot, IntervalPollTimer, InvalidModuleError, type Job, type JobAvailableEvent, JobAwaiter, type JobCompletedEvent, type JobExecutorConfig, JobExecutorEventTypes, type JobExecutorFactory, type JobFailedEvent, type JobInfo, type JobPendingEvent, type JobReadReadyEvent, type JobResult, type JobResultSummary, type JobRunningEvent, type JobStartedEvent, JobStatus, type JobWriteReadyEvent, type JobWriteReadyPayload, type JwtHandler, type KeyframeSnapshot, type KeyframeValidationIssue, KyselyDocumentIndexer, KyselyDocumentView, KyselyKeyframeStore, KyselyOperationStore, KyselySyncCursorStorage, KyselySyncRemoteStorage, KyselyWriteCache, type LoadJobPlan, type LoadModelMessage, type LogMessage, Mailbox, type MetricsMessage, type ModelLoadFailedMessage, type ModelLoadedEvent, type ModelLoadedMessage, type ModelManifestEntry, ModelReadGate, ModuleNotFoundError, type ModuleRef, NullDocumentModelResolver, type OperationBatch, type OperationContext, type OperationFilter, type OperationIndexEntry, type OperationTable, type OperationWithContext, OptimisticLockError, type OutOfOrderPair, type PackageModelSource, type PagedResults, type PagingOptions, type ParentMessage, type ParsedDriveUrl, type ParsedPaging, PollBehavior, PollingChannelError, type PoolInstrumentation, type PoolStats, type ProcessorApp, type ProcessorFactory, type ProcessorFactoryBuilder, type ProcessorFilter, ProcessorManager, type ProcessorRecord, type ProcessorStatus, type Projection, type ProjectionShardBuilderConfig, type ProjectionShardHooks, type ProjectionShardManagerConfig, type ProjectionWorkerFactory, PropagationMode, QueueEventTypes, REACTOR_SCHEMA, RECOVERABLE_GRAPHQL_ERROR_CODES, Reactor, ReactorBuilder, ReactorClient, ReactorClientBuilder, type ReactorClientModule, ReactorEventTypes, type ReactorFeatureFlags, type ReactorFeatures, type ReactorHostModuleBaseOptions, type JobFailedEvent$1 as ReactorJobFailedEvent, type ReactorModule, type ReactorReadModels, ReactorSubscriptionManager, type ReadGateOptions, type ReadModelBatchCompletedEvent, ReadModelCoordinator, type ReadModelCoordinatorFactory, type ReadModelCoordinatorFactoryDeps, type ReadModelFactory, type ReadModelFactoryDeps, type ReadModelIndexedEvent, type ReadModelIndexingStage, type ReadModelRegistrationStage, type ReadModelStage, type ReadyMessage, type RebuildResult, type RegisteredDecisionModel, RelationalDbProcessor, RelationshipChangeType, RelationshipNotFoundError, type Remote, type RemoteCursor, type RemoteFilter, type RemoteMeta, type RemoteOptions, type RemoteRecord, type RemoteStatus, type ResultMessage, RetryAccounting, RevisionMismatchError, type SanitizedArg, type SearchFilter, SeededStateReader, type ShutdownMessage, type ShutdownStatus, type SignatureVerificationHandler, type SignatureVerifierSpec, type SignerConfig, SimpleJobExecutorManager, type SnapshotValidationIssue, type Database$1 as StorageDatabase, type StreamOrderIssue, type StreamQuery, type SubmittedActionResult, type SubscriptionErrorContext, SyncBuilder, type SyncEnvelope, type SyncEnvelopeType, SyncEventTypes, type SyncFailedEvent, type SyncModule, SyncOperation, SyncOperationAggregateError, type SyncOperationErrorType, SyncOperationStatus, type SyncPendingEvent, SyncScopeGate, SyncStatus, type SyncStatusChangeCallback, SyncStatusTracker, type SyncSucceededEvent, type TrackedProcessor, type Unsubscribe, type ValidationResult, type ViewFilter, type ErrorInfo as WorkerErrorInfo, type WorkerMessage, type WorkerPoolConfig, type WorkerPoolOptions, type WriteCacheConfig, addRelationshipAction, authDecisionModel, batchOperationsByDocument, buildDecisionModel, classifyJobFailure, consolidateSyncOperations, createDocumentAction, createForwardingLogger, createHybridProjectionCoordinatorFactory, createMutableShutdownStatus, createReactorHostModuleBase, createRelationalDb, decideAtHead, deleteDocumentAction, documentActions, documentDecisionModel, driveIdFromUrl, envelopesToSyncOperations, errorToInfo, firstOutOfOrderPair, getMigrationStatus, instrumentPgPool, isDriveAuthError, isRecoverableGraphQLError, makeConsistencyKey, parseDriveUrl, parsePagingOptions, quarantinesDocument, readDecisionModel, removeRelationshipAction, runMigrations, sanitizeArg, selectDecisionModel, supportsLiveReadModelRegistration, syncOperationErrorType, trimMailboxFromAckOrdinal, updateRelationshipAction, upgradeDocumentAction, workerEntryPath };
7438
7679
  //# sourceMappingURL=index.d.ts.map