@powerhousedao/reactor 6.2.3-dev.2 → 6.2.3-dev.21

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/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
  */
@@ -686,6 +712,16 @@ interface IOperationStore {
686
712
  * Returns operations for a document/scope/branch whose index is greater
687
713
  * than the given revision.
688
714
  *
715
+ * `paging.cursor` is opaque to callers: treat it only as the value
716
+ * returned in `nextCursor` from a previous page, never construct or
717
+ * interpret it directly. An implementation must never emit a `nextCursor`
718
+ * equal to the start-of-stream sentinel ("0"), since a caller that walks
719
+ * `nextCursor` to exhaustion would read that as "start over" and loop
720
+ * forever. The reference encoding (used by the Kysely and Hypercore
721
+ * stores) is the index to resume from, i.e. the last returned row's index
722
+ * plus one, so a page that happens to end at index 0 still produces a
723
+ * cursor distinguishable from the start sentinel.
724
+ *
689
725
  * @param documentId - The document id
690
726
  * @param scope - The operation scope
691
727
  * @param branch - The branch name
@@ -708,6 +744,16 @@ interface IOperationStore {
708
744
  /**
709
745
  * Gets operations that may conflict with incoming operations during a load.
710
746
  *
747
+ * `paging.cursor` is opaque to callers: treat it only as the value
748
+ * returned in `nextCursor` from a previous page, never construct or
749
+ * interpret it directly. An implementation must never emit a `nextCursor`
750
+ * equal to the start-of-stream sentinel ("0"), since a caller that walks
751
+ * `nextCursor` to exhaustion would read that as "start over" and loop
752
+ * forever. The reference encoding (used by the Kysely and Hypercore
753
+ * stores) is the index to resume from, i.e. the last returned row's index
754
+ * plus one, so a page that happens to end at index 0 still produces a
755
+ * cursor distinguishable from the start sentinel.
756
+ *
711
757
  * @param documentId - The document id
712
758
  * @param scope - The scope to query
713
759
  * @param branch - The branch name
@@ -1553,6 +1599,13 @@ type JobWriteReadyEvent = {
1553
1599
  jobId: string;
1554
1600
  operations: OperationWithContext$1[];
1555
1601
  jobMeta: JobMeta;
1602
+ /**
1603
+ * The ids of the actions the caller submitted with this job. `operations`
1604
+ * can also carry operations the job merely moved into a new position, so a
1605
+ * consumer reporting back to the caller needs this to tell the two apart.
1606
+ * Absent on jobs that carry no submitted actions.
1607
+ */
1608
+ submittedActionIds?: string[];
1556
1609
  /**
1557
1610
  * Maps documentId to the collection IDs it belongs to.
1558
1611
  * Used by SyncManager to route operations only to remotes
@@ -2056,6 +2109,36 @@ interface IReactorClient {
2056
2109
  * @returns The source documents and paging cursor
2057
2110
  */
2058
2111
  getIncomingRelationships(targetIdentifier: string, relationshipType: string, view?: ViewFilter, paging?: PagingOptions, signal?: AbortSignal): Promise<PagedResults<PHDocument>>;
2112
+ /**
2113
+ * Retrieves the outgoing relationship edges of a source document.
2114
+ *
2115
+ * Unlike {@link IReactorClient.getOutgoingRelationships}, which returns the
2116
+ * documents at the far end, this returns the edges themselves, carrying the
2117
+ * metadata and timestamps recorded against each relationship.
2118
+ *
2119
+ * @param sourceIdentifier - Required, this is either a document "id" field or a "slug"
2120
+ * @param relationshipType - Optional relationship type to filter by
2121
+ * @param view - Optional filter containing branch and scopes information
2122
+ * @param paging - Optional pagination options
2123
+ * @param signal - Optional abort signal to cancel the request
2124
+ * @returns The matching relationship edges and paging cursor
2125
+ */
2126
+ getOutgoingRelationshipEdges(sourceIdentifier: string, relationshipType?: string, view?: ViewFilter, paging?: PagingOptions, signal?: AbortSignal): Promise<PagedResults<DocumentRelationship>>;
2127
+ /**
2128
+ * Retrieves the incoming relationship edges of a target document.
2129
+ *
2130
+ * Unlike {@link IReactorClient.getIncomingRelationships}, which returns the
2131
+ * documents at the far end, this returns the edges themselves, carrying the
2132
+ * metadata and timestamps recorded against each relationship.
2133
+ *
2134
+ * @param targetIdentifier - Required, this is either a document "id" field or a "slug"
2135
+ * @param relationshipType - Optional relationship type to filter by
2136
+ * @param view - Optional filter containing branch and scopes information
2137
+ * @param paging - Optional pagination options
2138
+ * @param signal - Optional abort signal to cancel the request
2139
+ * @returns The matching relationship edges and paging cursor
2140
+ */
2141
+ getIncomingRelationshipEdges(targetIdentifier: string, relationshipType?: string, view?: ViewFilter, paging?: PagingOptions, signal?: AbortSignal): Promise<PagedResults<DocumentRelationship>>;
2059
2142
  /**
2060
2143
  * Filters documents by criteria and returns a list of them
2061
2144
  *
@@ -2231,14 +2314,31 @@ interface IReactorClient {
2231
2314
  /**
2232
2315
  * Adds a relationship between two documents and waits for completion.
2233
2316
  *
2317
+ * Adding a relationship that already exists is a no-op, metadata included.
2318
+ * Use {@link IReactorClient.updateRelationship} to change an existing edge.
2319
+ *
2234
2320
  * @param sourceIdentifier - Source document id or slug
2235
2321
  * @param targetIdentifier - Target document id or slug
2236
2322
  * @param relationshipType - Relationship type identifier
2323
+ * @param metadata - Optional metadata to attach to the relationship
2237
2324
  * @param branch - Optional branch to add the relationship to, defaults to "main"
2238
2325
  * @param signal - Optional abort signal to cancel the request
2239
2326
  * @returns The updated source document
2240
2327
  */
2241
- addRelationship(sourceIdentifier: string, targetIdentifier: string, relationshipType: string, branch?: string, signal?: AbortSignal): Promise<PHDocument>;
2328
+ addRelationship(sourceIdentifier: string, targetIdentifier: string, relationshipType: string, metadata?: Record<string, unknown>, branch?: string, signal?: AbortSignal): Promise<PHDocument>;
2329
+ /**
2330
+ * Replaces the metadata of an existing relationship and waits for completion.
2331
+ * The relationship's createdAt is preserved.
2332
+ *
2333
+ * @param sourceIdentifier - Source document id or slug
2334
+ * @param targetIdentifier - Target document id or slug
2335
+ * @param relationshipType - Relationship type identifier
2336
+ * @param metadata - The metadata to store; null clears it
2337
+ * @param branch - Optional branch holding the relationship, defaults to "main"
2338
+ * @param signal - Optional abort signal to cancel the request
2339
+ * @returns The updated source document
2340
+ */
2341
+ updateRelationship(sourceIdentifier: string, targetIdentifier: string, relationshipType: string, metadata: Record<string, unknown> | null, branch?: string, signal?: AbortSignal): Promise<PHDocument>;
2242
2342
  /**
2243
2343
  * Removes a relationship between two documents and waits for completion.
2244
2344
  *
@@ -3329,8 +3429,22 @@ declare class KyselyOperationStore implements IOperationStore {
3329
3429
  private findIdempotentReplay;
3330
3430
  /** True when the staged write creates a document rather than appending to one. */
3331
3431
  private isCreate;
3432
+ /**
3433
+ * The paging cursor here encodes the index to resume from (one past the
3434
+ * last row returned), not the last row's own index. This keeps "0" an
3435
+ * unambiguous start-of-stream sentinel even when a page ends at index 0
3436
+ * (e.g. `limit: 1` on a fresh stream), which would otherwise make
3437
+ * `nextCursor` equal the start cursor and loop a caller that walks pages
3438
+ * forever.
3439
+ */
3332
3440
  getSince(documentId: string, scope: string, branch: string, revision: number, filter?: OperationFilter, paging?: PagingOptions, signal?: AbortSignal): Promise<PagedResults<Operation>>;
3333
3441
  getSinceId(id: number, paging?: PagingOptions, signal?: AbortSignal): Promise<PagedResults<OperationWithContext$1>>;
3442
+ /**
3443
+ * The paging cursor here encodes the index to resume from (one past the
3444
+ * last row returned), not the last row's own index, for the same reason as
3445
+ * `getSince`: a page ending at index 0 must not produce a cursor that is
3446
+ * indistinguishable from the start-of-stream sentinel.
3447
+ */
3334
3448
  getConflicting(documentId: string, scope: string, branch: string, minTimestamp: string, paging?: PagingOptions, signal?: AbortSignal): Promise<PagedResults<Operation>>;
3335
3449
  getRevisions(documentId: string, branch: string, signal?: AbortSignal): Promise<DocumentRevisions>;
3336
3450
  getStreamLatestTimestamp(documentId: string, scope: string, branch: string, signal?: AbortSignal): Promise<string | undefined>;
@@ -3836,6 +3950,38 @@ declare class ReactorClient implements IReactorClient {
3836
3950
  * Retrieves incoming relationships of a given type to a target document.
3837
3951
  */
3838
3952
  getIncomingRelationships(targetIdentifier: string, relationshipType: string, view?: ViewFilter, paging?: PagingOptions, signal?: AbortSignal): Promise<PagedResults<PHDocument>>;
3953
+ /**
3954
+ * Retrieves the outgoing relationship edges of a source document, carrying the
3955
+ * metadata and timestamps the far-end documents do not.
3956
+ */
3957
+ getOutgoingRelationshipEdges(sourceIdentifier: string, relationshipType?: string, view?: ViewFilter, paging?: PagingOptions, signal?: AbortSignal): Promise<PagedResults<DocumentRelationship>>;
3958
+ /**
3959
+ * Retrieves the incoming relationship edges of a target document, carrying the
3960
+ * metadata and timestamps the far-end documents do not.
3961
+ */
3962
+ getIncomingRelationshipEdges(targetIdentifier: string, relationshipType?: string, view?: ViewFilter, paging?: PagingOptions, signal?: AbortSignal): Promise<PagedResults<DocumentRelationship>>;
3963
+ /**
3964
+ * Drops the edges whose far-end document the subject may read no domain scope
3965
+ * of. An edge is withheld whole rather than stripped of its metadata: the
3966
+ * document-shaped relationship reads already answer with the far end stripped
3967
+ * to the scopes the gate allows, so the far end's existence is disclosed
3968
+ * either way, but an edge's metadata is content about the pair that the far
3969
+ * end's own reads would refuse. An edge to a far end stripped to nothing
3970
+ * therefore carries content past a refusal, and there is no useful shell to
3971
+ * hand back in its place.
3972
+ *
3973
+ * `nextCursor` and `options` are left as the underlying stream reported them,
3974
+ * because a caller must feed them back to resume from the right position. A
3975
+ * gated page can therefore be shorter than the limit it asked for.
3976
+ */
3977
+ private gateEdges;
3978
+ /**
3979
+ * One relationship edge, or undefined when it does not exist. A point lookup:
3980
+ * the pair is filtered in SQL rather than scanned out of the source's edge
3981
+ * list, which on a drive with thousands of children is the difference between
3982
+ * one query and dozens.
3983
+ */
3984
+ private readRelationshipEdge;
3839
3985
  /**
3840
3986
  * Filters documents by criteria and returns a list of them
3841
3987
  */
@@ -3923,7 +4069,11 @@ declare class ReactorClient implements IReactorClient {
3923
4069
  /**
3924
4070
  * Adds multiple documents as children to another and waits for completion
3925
4071
  */
3926
- addRelationship(sourceIdentifier: string, targetIdentifier: string, relationshipType: string, branch?: string, signal?: AbortSignal): Promise<PHDocument>;
4072
+ addRelationship(sourceIdentifier: string, targetIdentifier: string, relationshipType: string, metadata?: Record<string, unknown>, branch?: string, signal?: AbortSignal): Promise<PHDocument>;
4073
+ /**
4074
+ * Replaces the metadata of an existing relationship and waits for completion.
4075
+ */
4076
+ updateRelationship(sourceIdentifier: string, targetIdentifier: string, relationshipType: string, metadata: Record<string, unknown> | null, branch?: string, signal?: AbortSignal): Promise<PHDocument>;
3927
4077
  /**
3928
4078
  * Removes a relationship between two documents and waits for completion.
3929
4079
  */
@@ -4274,6 +4424,7 @@ interface DocumentSnapshotTable {
4274
4424
  documentType: string;
4275
4425
  lastOperationIndex: number;
4276
4426
  lastOperationHash: string;
4427
+ lastOperationOrdinal: Generated<number>;
4277
4428
  lastUpdatedAt: Generated<Date>;
4278
4429
  snapshotVersion: Generated<number>;
4279
4430
  identifiers: unknown;
@@ -4450,8 +4601,29 @@ declare const DRIVE_AUTH_ERROR_MESSAGES: {
4450
4601
  readonly forbidden: "Forbidden: insufficient permissions";
4451
4602
  readonly authenticationRequired: "Forbidden: authentication required";
4452
4603
  };
4604
+ /**
4605
+ * A non-GraphQL HTTP failure against a drive endpoint.
4606
+ *
4607
+ * Drive discovery (`GET <base>/d/:drive`) is REST, not GraphQL, so its
4608
+ * failures cannot be a `GraphQLRequestError` without the name lying about
4609
+ * what was called. It carries the status for the same reason that one does:
4610
+ * `isDriveAuthError` is what decides whether a failure prompts a login, and a
4611
+ * bare `Error` tells it nothing.
4612
+ */
4613
+ declare class DriveRequestError extends Error {
4614
+ readonly statusCode: number | undefined;
4615
+ constructor(message: string, statusCode?: number);
4616
+ }
4453
4617
  /** True when the remote rejected the caller as unauthenticated/unauthorized:
4454
- * an HTTP 401/403, or a Forbidden/Unauthorized GraphQL error. */
4618
+ * an HTTP 401/403, or a Forbidden/Unauthorized GraphQL error.
4619
+ *
4620
+ * 403 and 401 only — NOT 404. The drive info endpoint answers a drive the
4621
+ * caller may not read with the same 404 it gives a drive that does not exist,
4622
+ * so that an unauthorized caller cannot enumerate drives by probing slugs.
4623
+ * That is deliberate, and it costs exactly this: a protected drive is
4624
+ * indistinguishable from a typo, and prompting for a login on every 404 would
4625
+ * fire on every mistyped URL. See the `WWW-Authenticate` note on the endpoint
4626
+ * for the signal that would let a client tell the two apart. */
4455
4627
  declare function isDriveAuthError(error: unknown): boolean;
4456
4628
  declare class PollingChannelError extends Error {
4457
4629
  constructor(message: string);
@@ -4637,6 +4809,23 @@ interface IChannel {
4637
4809
  * not poll (e.g. push-only response channels) should treat this as a no-op.
4638
4810
  */
4639
4811
  triggerPull(): void;
4812
+ /**
4813
+ * Records that this channel's holder just interacted with it.
4814
+ *
4815
+ * Only a served channel has a holder to hear from; a channel that polls a
4816
+ * remote itself should treat this as a no-op, as with triggerPull.
4817
+ */
4818
+ notePoll(): void;
4819
+ /**
4820
+ * When this channel's holder last interacted with it, if it has one.
4821
+ *
4822
+ * A channel that polls a remote itself reports undefined: the only liveness
4823
+ * it knows is the remote's, which says nothing about whether anyone still
4824
+ * wants what this replica holds for it. Reporting a timestamp is the
4825
+ * channel's own claim that it serves a holder, and is what makes it
4826
+ * eligible to be removed when that holder goes silent.
4827
+ */
4828
+ lastHolderPollUtcMs(): number | undefined;
4640
4829
  }
4641
4830
  /**
4642
4831
  * Factory for creating channel instances.
@@ -4919,6 +5108,30 @@ interface IReactor {
4919
5108
  * @returns The list of source document ids
4920
5109
  */
4921
5110
  getIncomingRelationships(targetId: string, relationshipType: string, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<string[]>;
5111
+ /**
5112
+ * Retrieves outgoing relationship edges from a source document, carrying the
5113
+ * metadata and timestamps the document ids alone do not.
5114
+ *
5115
+ * @param sourceId - The source document id
5116
+ * @param relationshipType - Optional relationship type to filter by
5117
+ * @param paging - Optional pagination options
5118
+ * @param consistencyToken - Optional token for read-after-write consistency
5119
+ * @param signal - Optional abort signal to cancel the request
5120
+ * @returns The matching relationship edges
5121
+ */
5122
+ getOutgoingRelationshipEdges(sourceId: string, relationshipType?: string, paging?: PagingOptions, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<PagedResults<DocumentRelationship>>;
5123
+ /**
5124
+ * Retrieves incoming relationship edges to a target document, carrying the
5125
+ * metadata and timestamps the document ids alone do not.
5126
+ *
5127
+ * @param targetId - The target document id
5128
+ * @param relationshipType - Optional relationship type to filter by
5129
+ * @param paging - Optional pagination options
5130
+ * @param consistencyToken - Optional token for read-after-write consistency
5131
+ * @param signal - Optional abort signal to cancel the request
5132
+ * @returns The matching relationship edges
5133
+ */
5134
+ getIncomingRelationshipEdges(targetId: string, relationshipType?: string, paging?: PagingOptions, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<PagedResults<DocumentRelationship>>;
4922
5135
  /**
4923
5136
  * Retrieves the operations for a document
4924
5137
  *
@@ -5020,15 +5233,32 @@ interface IReactor {
5020
5233
  /**
5021
5234
  * Adds a relationship between two documents.
5022
5235
  *
5236
+ * Adding a relationship that already exists is a no-op, metadata included.
5237
+ * Use {@link IReactor.updateRelationship} to change an existing edge.
5238
+ *
5023
5239
  * @param sourceId - Source document id
5024
5240
  * @param targetId - Target document id
5025
5241
  * @param relationshipType - Relationship type identifier
5242
+ * @param metadata - Optional metadata to attach to the relationship
5026
5243
  * @param branch - Branch to add the relationship to, defaults to "main"
5027
5244
  * @param signer - Optional signer to sign the actions
5028
5245
  * @param signal - Optional abort signal to cancel the request
5029
5246
  * @returns The job id and status
5030
5247
  */
5031
- addRelationship(sourceId: string, targetId: string, relationshipType: string, branch?: string, signer?: ISigner, signal?: AbortSignal): Promise<JobInfo>;
5248
+ addRelationship(sourceId: string, targetId: string, relationshipType: string, metadata?: Record<string, unknown>, branch?: string, signer?: ISigner, signal?: AbortSignal): Promise<JobInfo>;
5249
+ /**
5250
+ * Replaces the metadata of an existing relationship, preserving its createdAt.
5251
+ *
5252
+ * @param sourceId - Source document id
5253
+ * @param targetId - Target document id
5254
+ * @param relationshipType - Relationship type identifier
5255
+ * @param metadata - The metadata to store; null clears it
5256
+ * @param branch - Branch holding the relationship, defaults to "main"
5257
+ * @param signer - Optional signer to sign the actions
5258
+ * @param signal - Optional abort signal to cancel the request
5259
+ * @returns The job id and status
5260
+ */
5261
+ updateRelationship(sourceId: string, targetId: string, relationshipType: string, metadata: Record<string, unknown> | null, branch?: string, signer?: ISigner, signal?: AbortSignal): Promise<JobInfo>;
5032
5262
  /**
5033
5263
  * Removes a relationship between two documents.
5034
5264
  *
@@ -5091,6 +5321,20 @@ interface ReactorModule {
5091
5321
  * direct access to internal components for advanced use cases, testing, or
5092
5322
  * integration scenarios.
5093
5323
  */
5324
+ /**
5325
+ * A component that failed to build or catch up, and was started anyway.
5326
+ *
5327
+ * The reactor does not take itself down for one of these: a read model that
5328
+ * cannot reach its database should not stop the writes. But it does serve
5329
+ * reads that are silently incomplete, so the failure is recorded rather than
5330
+ * only logged -- a host can refuse readiness on a non-empty list instead of
5331
+ * reporting healthy while answering from an index that stopped at boot.
5332
+ */
5333
+ interface DegradedComponent {
5334
+ /** Names the component that failed, e.g. `read model 0 (attachments)`. */
5335
+ component: string;
5336
+ error: Error;
5337
+ }
5094
5338
  interface InProcessReactorModule extends ReactorModule {
5095
5339
  /**
5096
5340
  * The enforcement flags this reactor resolved, as plain booleans. Held on the
@@ -5129,6 +5373,11 @@ interface InProcessReactorModule extends ReactorModule {
5129
5373
  * record per-pool acquire-wait and stat metrics.
5130
5374
  */
5131
5375
  pools: PoolInstrumentation[];
5376
+ /**
5377
+ * Components that failed to initialize and were started degraded. Empty on
5378
+ * a clean boot. See {@link DegradedComponent}.
5379
+ */
5380
+ degradedComponents: DegradedComponent[];
5132
5381
  }
5133
5382
  /**
5134
5383
  * Base reactor client contract — the client plus its reactor module. Satisfied
@@ -5249,6 +5498,101 @@ declare class NullDocumentModelResolver implements IDocumentModelResolver {
5249
5498
  */
5250
5499
  type WorkerFactory = (index: number) => IExecutorWorker;
5251
5500
  //#endregion
5501
+ //#region src/read-models/base-read-model.d.ts
5502
+ /** Bounds on an indexing pass: one transaction, and the stall between yields. */
5503
+ type ReadModelIndexingConfig = {
5504
+ /** Maximum operations committed in a single transaction. */commitChunkSize: number; /** Maximum elapsed milliseconds before yielding between chunks. */
5505
+ yieldDeadlineMs: number;
5506
+ };
5507
+ /** Small enough that a chunk's transaction rarely outlasts the yield deadline. */
5508
+ declare const DEFAULT_COMMIT_CHUNK_SIZE = 50;
5509
+ /** Matches the executor's own default, so both paths yield on the same cadence. */
5510
+ declare const DEFAULT_READ_MODEL_YIELD_DEADLINE_MS = 50;
5511
+ declare const defaultReadModelIndexingConfig: ReadModelIndexingConfig;
5512
+ /** For read models whose callers can observe where a batch was split. */
5513
+ declare const unchunkedReadModelIndexingConfig: ReadModelIndexingConfig;
5514
+ type BaseReadModelConfig = {
5515
+ readModelId: string;
5516
+ rebuildStateOnInit: boolean; /** Defaults to {@link defaultReadModelIndexingConfig}. */
5517
+ indexing?: ReadModelIndexingConfig;
5518
+ };
5519
+ /**
5520
+ * Base class for read models that provides catch-up/rewind functionality.
5521
+ * Handles initialization, state tracking via ViewState table, and consistency tracking.
5522
+ * Subclasses override commitOperations() with their specific domain logic.
5523
+ */
5524
+ declare class BaseReadModel implements IReadModel {
5525
+ protected db: Kysely<DocumentViewDatabase>;
5526
+ protected operationIndex: IOperationIndex;
5527
+ protected writeCache: IWriteCache;
5528
+ protected consistencyTracker: IConsistencyTracker;
5529
+ protected config: BaseReadModelConfig;
5530
+ protected lastOrdinal: number;
5531
+ readonly name: string;
5532
+ private readonly indexing;
5533
+ /**
5534
+ * Lowest ordinal this model failed to commit and has not committed since, or
5535
+ * zero when there is none. The stored cursor is held below it so replay from
5536
+ * the cursor still reaches every operation the failed pass left out.
5537
+ */
5538
+ private uncommittedOrdinal;
5539
+ constructor(db: Kysely<DocumentViewDatabase>, operationIndex: IOperationIndex, writeCache: IWriteCache, consistencyTracker: IConsistencyTracker, config: BaseReadModelConfig);
5540
+ /**
5541
+ * Initializes the read model by loading state and catching up on missed operations.
5542
+ */
5543
+ init(): Promise<void>;
5544
+ /**
5545
+ * Commits the batch in chunks, yielding between them with no transaction
5546
+ * open. A chunk that throws leaves the earlier chunks committed, so the pass
5547
+ * saves the cursor for that prefix and parks it below the operation it could
5548
+ * not commit before rethrowing.
5549
+ */
5550
+ indexOperations(items: OperationWithContext$1[]): Promise<void>;
5551
+ /**
5552
+ * Waits for the read model to reach the specified consistency level.
5553
+ */
5554
+ waitForConsistency(token: ConsistencyToken, timeoutMs?: number, signal?: AbortSignal): Promise<void>;
5555
+ protected commitOperations(items: OperationWithContext$1[]): Promise<void>;
5556
+ /**
5557
+ * Rebuilds document state for each operation using the write cache.
5558
+ */
5559
+ protected rebuildStateForOperations(operations: OperationWithContext$1[]): Promise<OperationWithContext$1[]>;
5560
+ /**
5561
+ * Loads the last processed ordinal from the ViewState table.
5562
+ * Returns undefined if no state exists for this read model.
5563
+ */
5564
+ protected loadState(): Promise<number | undefined>;
5565
+ /**
5566
+ * Initializes the ViewState row for this read model.
5567
+ */
5568
+ protected initializeState(): Promise<void>;
5569
+ /**
5570
+ * Saves the last processed ordinal to the ViewState table.
5571
+ */
5572
+ protected saveState(trx: Transaction<DocumentViewDatabase>, items: OperationWithContext$1[]): Promise<void>;
5573
+ /**
5574
+ * Updates the consistency tracker with the processed operations.
5575
+ */
5576
+ protected updateConsistencyTracker(items: OperationWithContext$1[]): void;
5577
+ /**
5578
+ * Saves the cursor for the chunks that did commit before a later chunk threw.
5579
+ * A failure here is swallowed: the cursor simply stays where the pass found
5580
+ * it, which is equally safe, and the commit error is the one worth raising.
5581
+ */
5582
+ private recordCommittedPrefix;
5583
+ /** Writes the cursor for the given items, never past a parked ordinal. */
5584
+ private persistCursor;
5585
+ /**
5586
+ * Holds the cursor written by {@link saveState}, which subclasses may
5587
+ * override, below the lowest operation this model failed to commit.
5588
+ */
5589
+ private clampCursorToPark;
5590
+ /** Remembers the lowest ordinal the failed pass left uncommitted. */
5591
+ private park;
5592
+ /** The park lifts once a later pass commits the operation that failed. */
5593
+ private liftParkIfCommitted;
5594
+ }
5595
+ //#endregion
5252
5596
  //#region src/projection/protocol.d.ts
5253
5597
  /**
5254
5598
  * Identifier for a built-in read model the projection worker materializes
@@ -5284,6 +5628,12 @@ type ProjectionInitMessage = {
5284
5628
  preReadyKinds: BuiltInReadModelKind[];
5285
5629
  postReadyKinds: BuiltInReadModelKind[];
5286
5630
  chainDepthReportIntervalMs: number;
5631
+ /**
5632
+ * Chunking bounds every read model this worker builds indexes under. The
5633
+ * host computes one config for both the in-process and the worker path, so
5634
+ * a tuned cadence cannot apply to one and not the other.
5635
+ */
5636
+ indexing: ReadModelIndexingConfig;
5287
5637
  };
5288
5638
  /**
5289
5639
  * Relays a JOB_WRITE_READY event from the host bus into the worker's
@@ -5488,6 +5838,11 @@ type ProjectionShardManagerConfig = ProjectionShardHooks & {
5488
5838
  models: ModelManifestEntry[];
5489
5839
  preReadyKinds: BuiltInReadModelKind[];
5490
5840
  postReadyKinds: BuiltInReadModelKind[];
5841
+ /**
5842
+ * Chunking bounds the shards' read models index under. Comes from the same
5843
+ * host config the in-process read models get, so the two paths cannot drift.
5844
+ */
5845
+ indexing: ReadModelIndexingConfig;
5491
5846
  factory: ProjectionWorkerFactory;
5492
5847
  logger: ILogger;
5493
5848
  hostBus: IEventBus;
@@ -5679,6 +6034,7 @@ declare class SyncBuilder {
5679
6034
  withMaxDeadLettersPerRemote(limit: number): this;
5680
6035
  withMaxInboxBatchSize(limit: number): this;
5681
6036
  withMaxHeldOperationsPerRemote(limit: number): this;
6037
+ withStaleRemotePollWindowMs(windowMs: number): this;
5682
6038
  build(reactor: IReactor, logger: ILogger, operationIndex: IOperationIndex, eventBus: IEventBus, db: Kysely<Database$1>, driveContainerTypes: ReadonlySet<string>): ISyncManager;
5683
6039
  buildModule(reactor: IReactor, logger: ILogger, operationIndex: IOperationIndex, eventBus: IEventBus, db: Kysely<Database$1>, driveContainerTypes: ReadonlySet<string>): InProcessSyncModule;
5684
6040
  }
@@ -5934,6 +6290,10 @@ declare class ReactorBuilder {
5934
6290
  * models never index an operation, so the manager advances these from the
5935
6291
  * shards' relayed indexing reports; without them every read carrying a
5936
6292
  * consistency token waits forever.
6293
+ * @param indexing The chunking bounds the host's own read models index
6294
+ * under. The shards' read models are built inside the worker, so without
6295
+ * this they would fall back to the library default and a host that tuned
6296
+ * the cadence would silently get it on the in-process path only.
5937
6297
  * @param registerShutdownHook Whether the builder owns `manager.shutdown()`
5938
6298
  * at signal time. False for the coordinator-factory path, whose factory
5939
6299
  * registers its own hook so host chains drain before the worker stops.
@@ -6064,6 +6424,8 @@ declare class Reactor implements IReactor {
6064
6424
  getByIdOrSlug<TDocument extends PHDocument>(identifier: string, view?: ViewFilter, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<TDocument>;
6065
6425
  getOutgoingRelationships(sourceId: string, relationshipType: string, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<string[]>;
6066
6426
  getIncomingRelationships(targetId: string, relationshipType: string, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<string[]>;
6427
+ getOutgoingRelationshipEdges(sourceId: string, relationshipType?: string, paging?: PagingOptions, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<PagedResults<DocumentRelationship>>;
6428
+ getIncomingRelationshipEdges(targetId: string, relationshipType?: string, paging?: PagingOptions, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<PagedResults<DocumentRelationship>>;
6067
6429
  getOperations(documentId: string, view?: ViewFilter, filter?: OperationFilter, paging?: PagingOptions, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<Record<string, PagedResults<Operation>>>;
6068
6430
  find(search: SearchFilter, view?: ViewFilter, paging?: PagingOptions, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<PagedResults<PHDocument>>;
6069
6431
  create(document: PHDocument, signer?: ISigner, signal?: AbortSignal, meta?: Record<string, unknown>): Promise<JobInfo>;
@@ -6072,7 +6434,8 @@ declare class Reactor implements IReactor {
6072
6434
  load(docId: string, branch: string, operations: Operation[], signal?: AbortSignal, meta?: Record<string, unknown>): Promise<JobInfo>;
6073
6435
  executeBatch(request: BatchExecutionRequest, signal?: AbortSignal, meta?: Record<string, unknown>): Promise<BatchExecutionResult>;
6074
6436
  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>;
6437
+ addRelationship(sourceId: string, targetId: string, relationshipType: string, metadata?: Record<string, unknown>, branch?: string, signer?: ISigner, signal?: AbortSignal): Promise<JobInfo>;
6438
+ updateRelationship(sourceId: string, targetId: string, relationshipType: string, metadata: Record<string, unknown> | null, branch?: string, signer?: ISigner, signal?: AbortSignal): Promise<JobInfo>;
6076
6439
  removeRelationship(sourceId: string, targetId: string, relationshipType: string, branch?: string, signer?: ISigner, signal?: AbortSignal): Promise<JobInfo>;
6077
6440
  getJobStatus(jobId: string, signal?: AbortSignal): Promise<JobInfo>;
6078
6441
  private findByIds;
@@ -6122,6 +6485,21 @@ declare class AuthEnforcementDisabledError extends Error {
6122
6485
  constructor();
6123
6486
  static isError(error: unknown): error is AuthEnforcementDisabledError;
6124
6487
  }
6488
+ /**
6489
+ * Error thrown when a relationship edge an operation names does not exist.
6490
+ *
6491
+ * Detection is by `name`, not `instanceof`: the SharedWorker RPC boundary
6492
+ * rebuilds a thrown error from `{ name, message, stack, cause }` alone
6493
+ * (`reactor-browser/src/rpc/error-info.ts`), so the class identity is lost in
6494
+ * transit.
6495
+ */
6496
+ declare class RelationshipNotFoundError extends Error {
6497
+ readonly sourceId: string;
6498
+ readonly targetId: string;
6499
+ readonly relationshipType: string;
6500
+ constructor(sourceId: string, targetId: string, relationshipType: string);
6501
+ static isError(error: unknown): error is RelationshipNotFoundError;
6502
+ }
6125
6503
  //#endregion
6126
6504
  //#region src/shared/factories.d.ts
6127
6505
  /**
@@ -6704,67 +7082,12 @@ declare function firstOutOfOrderPair(operations: Operation[], options?: {
6704
7082
  requireStrict?: boolean;
6705
7083
  }): OutOfOrderPair | undefined;
6706
7084
  //#endregion
6707
- //#region src/read-models/base-read-model.d.ts
6708
- type BaseReadModelConfig = {
6709
- readModelId: string;
6710
- rebuildStateOnInit: boolean;
6711
- };
6712
- /**
6713
- * Base class for read models that provides catch-up/rewind functionality.
6714
- * Handles initialization, state tracking via ViewState table, and consistency tracking.
6715
- * Subclasses override commitOperations() with their specific domain logic.
6716
- */
6717
- declare class BaseReadModel implements IReadModel {
6718
- protected db: Kysely<DocumentViewDatabase>;
6719
- protected operationIndex: IOperationIndex;
6720
- protected writeCache: IWriteCache;
6721
- protected consistencyTracker: IConsistencyTracker;
6722
- protected config: BaseReadModelConfig;
6723
- protected lastOrdinal: number;
6724
- readonly name: string;
6725
- constructor(db: Kysely<DocumentViewDatabase>, operationIndex: IOperationIndex, writeCache: IWriteCache, consistencyTracker: IConsistencyTracker, config: BaseReadModelConfig);
6726
- /**
6727
- * Initializes the read model by loading state and catching up on missed operations.
6728
- */
6729
- init(): Promise<void>;
6730
- /**
6731
- * Template method: runs domain-specific commitOperations, then persists
6732
- * state and updates consistency tracking.
6733
- */
6734
- indexOperations(items: OperationWithContext$1[]): Promise<void>;
6735
- /**
6736
- * Waits for the read model to reach the specified consistency level.
6737
- */
6738
- waitForConsistency(token: ConsistencyToken, timeoutMs?: number, signal?: AbortSignal): Promise<void>;
6739
- protected commitOperations(items: OperationWithContext$1[]): Promise<void>;
6740
- /**
6741
- * Rebuilds document state for each operation using the write cache.
6742
- */
6743
- protected rebuildStateForOperations(operations: OperationWithContext$1[]): Promise<OperationWithContext$1[]>;
6744
- /**
6745
- * Loads the last processed ordinal from the ViewState table.
6746
- * Returns undefined if no state exists for this read model.
6747
- */
6748
- protected loadState(): Promise<number | undefined>;
6749
- /**
6750
- * Initializes the ViewState row for this read model.
6751
- */
6752
- protected initializeState(): Promise<void>;
6753
- /**
6754
- * Saves the last processed ordinal to the ViewState table.
6755
- */
6756
- protected saveState(trx: Transaction<DocumentViewDatabase>, items: OperationWithContext$1[]): Promise<void>;
6757
- /**
6758
- * Updates the consistency tracker with the processed operations.
6759
- */
6760
- protected updateConsistencyTracker(items: OperationWithContext$1[]): void;
6761
- }
6762
- //#endregion
6763
7085
  //#region src/storage/kysely/document-indexer.d.ts
6764
7086
  type IndexerDatabase = Database$1 & DocumentIndexerDatabase & DocumentViewDatabase;
6765
7087
  declare class KyselyDocumentIndexer extends BaseReadModel implements IDocumentIndexer {
6766
7088
  private _db;
6767
- constructor(db: Kysely<IndexerDatabase>, operationIndex: IOperationIndex, writeCache: IWriteCache, consistencyTracker: IConsistencyTracker);
7089
+ constructor(db: Kysely<IndexerDatabase>, operationIndex: IOperationIndex, writeCache: IWriteCache, consistencyTracker: IConsistencyTracker, indexing?: ReadModelIndexingConfig);
7090
+ /** Opens no transaction for a batch carrying no relationship operation. */
6768
7091
  protected commitOperations(items: OperationWithContext$1[]): Promise<void>;
6769
7092
  getOutgoing(documentId: string, types?: string[], paging?: PagingOptions, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<PagedResults<DocumentRelationship>>;
6770
7093
  getIncoming(documentId: string, types?: string[], paging?: PagingOptions, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<PagedResults<DocumentRelationship>>;
@@ -6819,23 +7142,28 @@ declare class ReadModelCoordinator implements ILiveReadModelCoordinator {
6819
7142
  //#endregion
6820
7143
  //#region src/read-models/document-view.d.ts
6821
7144
  type Database$2 = Database$1 & DocumentViewDatabase;
6822
- declare class KyselyDocumentView extends BaseReadModel implements IDocumentView {
6823
- private operationStore;
7145
+ /**
7146
+ * What a single-document read of a deleted document returns. A listing omits a
7147
+ * deleted document under either value.
7148
+ */
7149
+ declare enum DeletedDocumentRead {
6824
7150
  /**
6825
- * Whether a single-document read serves a deleted document's state as of the
6826
- * deletion rather than hiding it. Only meaningful with `documentDecisions`,
6827
- * which is what makes deletion positional. Listings omit it either way.
7151
+ * The document reads as missing: `get` throws and `resolveIdOrSlug` does not
7152
+ * match its id.
6828
7153
  */
6829
- private readonly servesDeletionBoundary;
6830
- private _db;
6831
- constructor(db: Kysely<Database$2>, operationStore: IOperationStore, operationIndex: IOperationIndex, writeCache: IWriteCache, consistencyTracker: IConsistencyTracker,
7154
+ NotFound = "NotFound",
6832
7155
  /**
6833
- * Whether a single-document read serves a deleted document's state as of the
6834
- * deletion rather than hiding it. Only meaningful with `documentDecisions`,
6835
- * which is what makes deletion positional. Listings omit it either way.
7156
+ * The document's state as of the deletion, with `state.document.isDeleted`
7157
+ * telling the caller what it holds. Only meaningful with `documentDecisions`,
7158
+ * which is what makes deletion positional.
6836
7159
  */
6837
-
6838
- servesDeletionBoundary: boolean);
7160
+ StateAtDeletion = "StateAtDeletion"
7161
+ }
7162
+ declare class KyselyDocumentView extends BaseReadModel implements IDocumentView {
7163
+ private operationStore;
7164
+ private readonly deletedDocumentRead;
7165
+ private _db;
7166
+ constructor(db: Kysely<Database$2>, operationStore: IOperationStore, operationIndex: IOperationIndex, writeCache: IWriteCache, consistencyTracker: IConsistencyTracker, deletedDocumentRead: DeletedDocumentRead, indexing?: ReadModelIndexingConfig);
6839
7167
  /**
6840
7168
  * Indexes committed operations into DocumentSnapshot rows. CREATE_DOCUMENT
6841
7169
  * only seeds header/document/auth. UPGRADE_DOCUMENT reindexes every scope
@@ -6845,6 +7173,11 @@ declare class KyselyDocumentView extends BaseReadModel implements IDocumentView
6845
7173
  * without either fall back to header/document/auth, because their sibling
6846
7174
  * echoes may be stale. All other action types index only header and their
6847
7175
  * own scope.
7176
+ *
7177
+ * The header row is the one row every scope's chain writes, so it accepts a
7178
+ * write only from an operation whose global ordinal is at least the one the
7179
+ * row already carries. Without that, a chunked pass that started earlier
7180
+ * reverts a concurrent rename with the stale echo its later chunks carry.
6848
7181
  */
6849
7182
  protected commitOperations(items: OperationWithContext$1[]): Promise<void>;
6850
7183
  exists(documentIds: string[], existence: DocumentExistence, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<boolean[]>;
@@ -7045,6 +7378,10 @@ declare class GqlRequestChannel implements IChannel {
7045
7378
  getConnectionState(): ConnectionStateSnapshot;
7046
7379
  onConnectionStateChange(callback: ConnectionStateChangeCallback): () => void;
7047
7380
  triggerPull(): void;
7381
+ /** This channel polls a remote itself; it has no holder to hear from. */
7382
+ notePoll(): void;
7383
+ /** No holder, so nothing this channel reports may strand one. */
7384
+ lastHolderPollUtcMs(): number | undefined;
7048
7385
  /**
7049
7386
  * Initializes the channel by registering it on the remote server and starting polling.
7050
7387
  */
@@ -7152,6 +7489,7 @@ declare class GqlResponseChannel implements IChannel {
7152
7489
  private lastPersistedOutboxOrdinal;
7153
7490
  private evictedOutboxFloor;
7154
7491
  private appliedOutboxOrdinal;
7492
+ private lastPollUtcMs;
7155
7493
  private connectionState;
7156
7494
  private readonly connectionStateCallbacks;
7157
7495
  constructor(logger: ILogger, channelId: string, remoteName: string, cursorStorage: ISyncCursorStorage);
@@ -7160,6 +7498,9 @@ declare class GqlResponseChannel implements IChannel {
7160
7498
  onConnectionStateChange(callback: ConnectionStateChangeCallback): () => void;
7161
7499
  /** Response channels are push-driven; resolvers populate mailboxes directly. */
7162
7500
  triggerPull(): void;
7501
+ notePoll(): void;
7502
+ /** This channel is served: its holder's polls are the liveness it reports. */
7503
+ lastHolderPollUtcMs(): number | undefined;
7163
7504
  init(): Promise<void>;
7164
7505
  private transitionConnectionState;
7165
7506
  /**
@@ -7434,5 +7775,5 @@ declare class ProcessorManager extends BaseReadModel implements IProcessorManage
7434
7775
  private deleteProcessorCursors;
7435
7776
  }
7436
7777
  //#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 };
7778
+ 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 BaseReadModelConfig, 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_COMMIT_CHUNK_SIZE, DEFAULT_DRIVE_CONTAINER_TYPES, DEFAULT_READ_MODEL_YIELD_DEADLINE_MS, 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, DeletedDocumentRead, 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 ReadModelIndexingConfig, 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, defaultReadModelIndexingConfig, deleteDocumentAction, documentActions, documentDecisionModel, driveIdFromUrl, envelopesToSyncOperations, errorToInfo, firstOutOfOrderPair, getMigrationStatus, instrumentPgPool, isDriveAuthError, isRecoverableGraphQLError, makeConsistencyKey, parseDriveUrl, parsePagingOptions, quarantinesDocument, readDecisionModel, removeRelationshipAction, runMigrations, sanitizeArg, selectDecisionModel, supportsLiveReadModelRegistration, syncOperationErrorType, trimMailboxFromAckOrdinal, unchunkedReadModelIndexingConfig, updateRelationshipAction, upgradeDocumentAction, workerEntryPath };
7438
7779
  //# sourceMappingURL=index.d.ts.map