@powerhousedao/reactor 6.2.2-dev.3 → 6.2.2-dev.31

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, CreateDocumentActionInput, DocumentModelModule, ISigner, Operation, OperationContext, OperationWithContext, OperationWithContext as OperationWithContext$1, PHDocument, PHDocumentState, SignatureVerificationHandler, UpgradeDocumentActionInput, UpgradeManifest, UpgradeReducer, UpgradeTransition, actions as documentActions } from "@powerhousedao/shared/document-model";
1
+ import { Action, AuthDecision, AuthRequest, AuthSubject, CreateDocumentActionInput, DocumentModelModule, ISigner, Operation, OperationContext, OperationWithContext, OperationWithContext as OperationWithContext$1, 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";
@@ -69,6 +69,17 @@ declare enum JobQueueState {
69
69
  RUNNING = 3,
70
70
  RESOLVED = 4
71
71
  }
72
+ /**
73
+ * How a retry is accounted against the job's retry limit.
74
+ * - `CountAgainstLimit` (default): a fault; the job eventually exhausts its
75
+ * retries and fails terminally.
76
+ * - `ExemptFromLimit`: not a fault, so the attempt is not charged to the job.
77
+ * Used for concurrency conflicts, where the retry does new work.
78
+ */
79
+ declare enum RetryAccounting {
80
+ CountAgainstLimit = "count-against-limit",
81
+ ExemptFromLimit = "exempt-from-limit"
82
+ }
72
83
  /**
73
84
  * Interface for a job execution handle
74
85
  */
@@ -230,6 +241,11 @@ type ViewFilter = {
230
241
  branch?: string;
231
242
  scopes?: string[];
232
243
  revision?: number;
244
+ /**
245
+ * Read subject for the IReactorClient read gate; defaults to the client's
246
+ * signer. Set per request when serving many principals. Ignored by IReactor.
247
+ */
248
+ subject?: AuthSubject;
233
249
  };
234
250
  /**
235
251
  * Describes filter options for searching documents.
@@ -328,6 +344,16 @@ interface IReadModelCoordinator {
328
344
  */
329
345
  getChainDepth(): number;
330
346
  }
347
+ type ReadModelRegistrationStage = "pre_ready" | "post_ready";
348
+ /**
349
+ * Optional capability exposed by coordinators that support adding read models
350
+ * after construction. Custom and remote coordinators are not required to
351
+ * implement it.
352
+ */
353
+ interface ILiveReadModelCoordinator extends IReadModelCoordinator {
354
+ addReadModel(readModel: IReadModel, stage: ReadModelRegistrationStage): void;
355
+ }
356
+ declare function supportsLiveReadModelRegistration(coordinator: IReadModelCoordinator): coordinator is ILiveReadModelCoordinator;
331
357
  //#endregion
332
358
  //#region src/sync/types.d.ts
333
359
  declare enum ChannelScheme {
@@ -537,6 +563,36 @@ declare class OptimisticLockError extends Error {
537
563
  declare class RevisionMismatchError extends Error {
538
564
  constructor(expected: number, actual: number);
539
565
  }
566
+ /**
567
+ * One read-set stream and the highest operation index observed on it, or -1
568
+ * if it was observed empty.
569
+ */
570
+ type AppendConditionStream = {
571
+ documentId: string;
572
+ scope: string;
573
+ branch: string;
574
+ revision: number;
575
+ };
576
+ /**
577
+ * A read-set enforced by {@link IOperationStore.apply}: the append fails if
578
+ * any stream has operations past its recorded revision.
579
+ */
580
+ type AppendCondition = {
581
+ streams: AppendConditionStream[];
582
+ };
583
+ /** Error history keeps messages, not classes, so failures match by prefix. */
584
+ declare const APPEND_CONDITION_FAILED_PREFIX = "Append condition failed: ";
585
+ /**
586
+ * A read-set stream grew before the append committed. A concurrency
587
+ * conflict, not a fault: the caller retries against the new stream heads.
588
+ */
589
+ declare class AppendConditionFailedError extends Error {
590
+ readonly condition: AppendCondition;
591
+ constructor(condition: AppendCondition);
592
+ static isError(error: unknown): error is AppendConditionFailedError;
593
+ /** True when a recorded error message is an append-condition failure. */
594
+ static isFailureMessage(message: string): boolean;
595
+ }
540
596
  /**
541
597
  * A write transaction passed to {@link IOperationStore.apply}. Accumulates
542
598
  * operations that are committed atomically when the callback returns.
@@ -571,6 +627,12 @@ interface IOperationStore {
571
627
  * returned instead of throwing. If no matching stored row is found, the
572
628
  * original error is propagated unchanged.
573
629
  *
630
+ * With an {@link AppendCondition}, the append additionally fails with
631
+ * {@link AppendConditionFailedError} — writing nothing — if any read-set
632
+ * stream has operations past its recorded revision. The written and
633
+ * read-set streams are advisory-locked in sorted key order, so concurrent
634
+ * conditional appends on overlapping streams serialize.
635
+ *
574
636
  * @param documentId - The document id
575
637
  * @param documentType - The document type identifier
576
638
  * @param scope - The operation scope (e.g. "global", "local")
@@ -578,9 +640,10 @@ interface IOperationStore {
578
640
  * @param revision - Expected current revision (optimistic lock)
579
641
  * @param fn - Callback that stages operations via {@link AtomicTxn}
580
642
  * @param signal - Optional abort signal to cancel the request
643
+ * @param condition - Optional read-set to enforce at write time
581
644
  * @returns The stored operations; empty array when no operations were staged
582
645
  */
583
- apply(documentId: string, documentType: string, scope: string, branch: string, revision: number, fn: (txn: AtomicTxn) => void | Promise<void>, signal?: AbortSignal): Promise<Operation[]>;
646
+ apply(documentId: string, documentType: string, scope: string, branch: string, revision: number, fn: (txn: AtomicTxn) => void | Promise<void>, signal?: AbortSignal, condition?: AppendCondition): Promise<Operation[]>;
584
647
  /**
585
648
  * Returns operations for a document/scope/branch whose index is greater
586
649
  * than the given revision.
@@ -1152,6 +1215,51 @@ declare class DriveCollectionId {
1152
1215
  equals(other: DriveCollectionId): boolean;
1153
1216
  }
1154
1217
  //#endregion
1218
+ //#region src/cache/write-cache-types.d.ts
1219
+ /**
1220
+ * Configuration options for the write cache
1221
+ */
1222
+ type WriteCacheConfig = {
1223
+ /** Maximum number of document streams to cache (LRU eviction). Default: 1000 */maxDocuments: number; /** Number of snapshots to keep in each document's ring buffer. Default: 10 */
1224
+ ringBufferSize: number; /** Persist a keyframe snapshot every N revisions. Default: 10 */
1225
+ keyframeInterval: number;
1226
+ };
1227
+ /**
1228
+ * Unique identifier for a document stream
1229
+ */
1230
+ type DocumentStreamKey = {
1231
+ /** Document identifier */documentId: string; /** Operation scope */
1232
+ scope: string; /** Branch name */
1233
+ branch: string;
1234
+ };
1235
+ /**
1236
+ * Where a snapshot sits in its stream.
1237
+ *
1238
+ * - `Head`: the newest revision of the stream when it was stored. Only these
1239
+ * can answer a read that asks for the head.
1240
+ * - `Historical`: state at an earlier revision. Usable as a starting point to
1241
+ * replay forward from, and as an answer to a read for that same revision.
1242
+ */
1243
+ declare enum SnapshotPosition {
1244
+ Head = "head",
1245
+ Historical = "historical"
1246
+ }
1247
+ /**
1248
+ * A cached document snapshot at a specific revision
1249
+ */
1250
+ type CachedSnapshot = {
1251
+ /** The revision number of this snapshot */revision: number; /** The document state at this revision */
1252
+ document: PHDocument; /** Where this snapshot sat in the stream when it was stored */
1253
+ position: SnapshotPosition;
1254
+ };
1255
+ /**
1256
+ * Serialized keyframe snapshot for K/V store persistence
1257
+ */
1258
+ type KeyframeSnapshot = {
1259
+ /** The revision number of this keyframe */revision: number; /** Serialized document state */
1260
+ document: string;
1261
+ };
1262
+ //#endregion
1155
1263
  //#region src/cache/write/interfaces.d.ts
1156
1264
  /**
1157
1265
  * IWriteCache is a write-side projection that optimizes document state retrieval
@@ -1166,7 +1274,8 @@ interface IWriteCache {
1166
1274
  * @param documentId - The document identifier
1167
1275
  * @param scope - Operation scope
1168
1276
  * @param branch - Branch name
1169
- * @param targetRevision - The exact revision to retrieve (optional, defaults to latest)
1277
+ * @param targetRevision - Index of the last operation to apply, defaulting
1278
+ * to latest. An operation index, never `header.revision[scope]`.
1170
1279
  * @param signal - Optional abort signal to cancel the operation
1171
1280
  * @returns The complete document at the specified revision
1172
1281
  *
@@ -1192,15 +1301,19 @@ interface IWriteCache {
1192
1301
  * @param documentId - The document identifier
1193
1302
  * @param scope - Operation scope
1194
1303
  * @param branch - Branch name
1195
- * @param revision - The revision this document represents
1304
+ * @param revision - Index of the last operation this document reflects, so
1305
+ * `header.revision[scope]` is one greater. -1 for an empty scope.
1196
1306
  * @param document - The document to cache
1307
+ * @param position - Whether `revision` is the stream's head. Nothing checks
1308
+ * it: claiming `Head` for an earlier revision makes a getState() with no
1309
+ * target return stale state.
1197
1310
  *
1198
1311
  * @example
1199
1312
  * ```typescript
1200
- * cache.putState(docId, 'global', 'main', 42, document);
1313
+ * cache.putState(docId, 'global', 'main', 42, document, SnapshotPosition.Head);
1201
1314
  * ```
1202
1315
  */
1203
- putState(documentId: string, scope: string, branch: string, revision: number, document: PHDocument): void;
1316
+ putState(documentId: string, scope: string, branch: string, revision: number, document: PHDocument, position: SnapshotPosition): void;
1204
1317
  /**
1205
1318
  * Invalidates (removes) cached entries for a document stream.
1206
1319
  *
@@ -1884,6 +1997,7 @@ declare class ReactorClient implements IReactorClient {
1884
1997
  private documentView;
1885
1998
  readonly drives: IDriveClient;
1886
1999
  constructor(logger: ILogger, reactor: IReactor, signer: ISigner, subscriptionManager: IReactorSubscriptionManager, jobAwaiter: IJobAwaiter, documentIndexer: IDocumentIndexer, documentView: IDocumentView);
2000
+ private readSubject;
1887
2001
  /**
1888
2002
  * Retrieves a list of document model modules.
1889
2003
  */
@@ -2013,11 +2127,28 @@ type JobResult = {
2013
2127
  duration?: number; /** Any additional metadata from the execution */
2014
2128
  metadata?: Record<string, any>;
2015
2129
  };
2130
+ /**
2131
+ * Enforcement the reactor performs, each off by default.
2132
+ *
2133
+ * A verdict reached while replaying is part of the document's history, so two
2134
+ * reactors that share documents and disagree on these diverge. A flag is turned
2135
+ * on for a set of reactors that sync with each other, not for one node.
2136
+ */
2137
+ type ReactorFeatureFlags = {
2138
+ /**
2139
+ * Decide whether an operation may be admitted by building a decision model
2140
+ * over the document stream, rather than reading the deleted flag from the
2141
+ * document meta cache. Deletion then takes effect from the deleting
2142
+ * operation's position rather than for the whole document.
2143
+ */
2144
+ documentDecisions: boolean;
2145
+ };
2016
2146
  /**
2017
2147
  * Configuration options for the job executor
2018
2148
  */
2019
2149
  type JobExecutorConfig = {
2020
- /** Maximum number of conflicting operations to skip when reshuffling. */maxSkipThreshold?: number; /** Maximum number of concurrent jobs to execute */
2150
+ /** Feature flags; anything unset is off. */featureFlags?: Partial<ReactorFeatureFlags>; /** Maximum number of conflicting operations to skip when reshuffling. */
2151
+ maxSkipThreshold?: number; /** Maximum number of concurrent jobs to execute */
2021
2152
  maxConcurrency?: number; /** Maximum time in milliseconds a job can run before being considered timed out */
2022
2153
  jobTimeoutMs?: number; /** Base delay in milliseconds for exponential backoff retries */
2023
2154
  retryBaseDelayMs?: number; /** Maximum delay in milliseconds for exponential backoff retries */
@@ -2242,9 +2373,10 @@ type InitMessage = {
2242
2373
  correlationId: string;
2243
2374
  workerId: string;
2244
2375
  poolConfig: WorkerPoolConfig;
2245
- db: DbConfig;
2246
- signatureVerifier: SignatureVerifierSpec;
2247
- models: ModelManifestEntry[];
2376
+ db: DbConfig; /** Omitted = the worker performs no executor-side signature verification. */
2377
+ signatureVerifier?: SignatureVerifierSpec;
2378
+ models: ModelManifestEntry[]; /** Omitted = the worker builds its executor with the built-in defaults. */
2379
+ executorConfig?: JobExecutorConfig;
2248
2380
  };
2249
2381
  /**
2250
2382
  * Dispatches a job to the worker for execution.
@@ -2679,9 +2811,11 @@ interface IQueue {
2679
2811
  * Retry a failed job.
2680
2812
  * @param jobId - The ID of the job to retry
2681
2813
  * @param error - Optional error information from the failure
2814
+ * @param accounting - Whether the attempt counts against the job's retry
2815
+ * limit; defaults to {@link RetryAccounting.CountAgainstLimit}
2682
2816
  * @returns Promise that resolves when the job is requeued for retry
2683
2817
  */
2684
- retryJob(jobId: string, error?: ErrorInfo$1): Promise<void>;
2818
+ retryJob(jobId: string, error?: ErrorInfo$1, accounting?: RetryAccounting): Promise<void>;
2685
2819
  /**
2686
2820
  * Returns true if and only if all jobs have been resolved.
2687
2821
  */
@@ -2749,6 +2883,25 @@ interface DocumentViewDatabase {
2749
2883
  }
2750
2884
  type InsertableDocumentSnapshot = Insertable<DocumentSnapshotTable>;
2751
2885
  //#endregion
2886
+ //#region src/core/model-sources.d.ts
2887
+ /** An importable file holding one or more document-model exports. */
2888
+ type FileModelSource = {
2889
+ filePath: string;
2890
+ exportName?: string;
2891
+ };
2892
+ /** An importable package specifier holding one or more document-model exports. */
2893
+ type PackageModelSource = {
2894
+ packageName: string;
2895
+ subpath?: string;
2896
+ exportName?: string;
2897
+ };
2898
+ /**
2899
+ * A source of document models: a live module, an importable file, or an
2900
+ * importable package. File and package sources can cross a worker-thread
2901
+ * boundary (workers re-import them); a live module cannot.
2902
+ */
2903
+ type DocumentModelSource = DocumentModelModule<any> | FileModelSource | PackageModelSource;
2904
+ //#endregion
2752
2905
  //#region src/registry/interfaces.d.ts
2753
2906
  type RegistrationResult<T> = {
2754
2907
  status: "success";
@@ -2759,18 +2912,18 @@ type RegistrationResult<T> = {
2759
2912
  error: Error;
2760
2913
  };
2761
2914
  /**
2762
- * Loader that can asynchronously resolve and return a document model module
2763
- * for a given document type. Used by the queue to gate CREATE_DOCUMENT jobs
2764
- * until the required model is available in the registry.
2915
+ * Loader that asynchronously resolves a document type to a
2916
+ * {@link DocumentModelSource}. Used by the queue to gate CREATE_DOCUMENT
2917
+ * jobs until the required model is available in the registry.
2765
2918
  *
2766
- * `resolveSpec` is an optional companion that returns the IPC-clonable spec
2767
- * for the same document type. Implementations that integrate with the worker
2768
- * pool must provide it so the parent can broadcast `load-model` to workers
2769
- * after registering the model on the parent.
2919
+ * Return an importable source ({ filePath } or { packageName }) whenever
2920
+ * possible: the resolver registers the resolved models on the host registry
2921
+ * and broadcasts importable sources to executor workers. A live
2922
+ * DocumentModelModule is also valid but host-only — it cannot cross a
2923
+ * worker-thread boundary, so worker pools will not receive it.
2770
2924
  */
2771
2925
  interface IDocumentModelLoader {
2772
- load(documentType: string): Promise<DocumentModelModule<any>>;
2773
- resolveSpec?(documentType: string): Promise<ModelManifestEntry | null>;
2926
+ load(documentType: string): Promise<DocumentModelSource>;
2774
2927
  }
2775
2928
  /**
2776
2929
  * Registry for managing document model modules.
@@ -2943,6 +3096,7 @@ interface OperationTable {
2943
3096
  action: unknown;
2944
3097
  skip: number;
2945
3098
  error?: string | null;
3099
+ deniedReason?: string | null;
2946
3100
  hash: string;
2947
3101
  }
2948
3102
  interface KeyframeTable {
@@ -2974,6 +3128,7 @@ interface OperationIndexOperationTable {
2974
3128
  skip: number;
2975
3129
  hash: string;
2976
3130
  action: unknown;
3131
+ deniedReason?: string | null;
2977
3132
  sourceRemote: Generated<string>;
2978
3133
  }
2979
3134
  interface SyncRemoteTable {
@@ -3841,7 +3996,6 @@ declare class DocumentModelResolver implements IDocumentModelResolver {
3841
3996
  ensureModelLoaded(documentType: string): Promise<void>;
3842
3997
  private loadRegisterAndBroadcast;
3843
3998
  private notifyPeersModelLoaded;
3844
- private broadcastIfPossible;
3845
3999
  }
3846
4000
  /**
3847
4001
  * No-op resolver used when no document model loader is configured.
@@ -3862,38 +4016,6 @@ declare class NullDocumentModelResolver implements IDocumentModelResolver {
3862
4016
  */
3863
4017
  type WorkerFactory = (index: number) => IExecutorWorker;
3864
4018
  //#endregion
3865
- //#region src/cache/write-cache-types.d.ts
3866
- /**
3867
- * Configuration options for the write cache
3868
- */
3869
- type WriteCacheConfig = {
3870
- /** Maximum number of document streams to cache (LRU eviction). Default: 1000 */maxDocuments: number; /** Number of snapshots to keep in each document's ring buffer. Default: 10 */
3871
- ringBufferSize: number; /** Persist a keyframe snapshot every N revisions. Default: 10 */
3872
- keyframeInterval: number;
3873
- };
3874
- /**
3875
- * Unique identifier for a document stream
3876
- */
3877
- type DocumentStreamKey = {
3878
- /** Document identifier */documentId: string; /** Operation scope */
3879
- scope: string; /** Branch name */
3880
- branch: string;
3881
- };
3882
- /**
3883
- * A cached document snapshot at a specific revision
3884
- */
3885
- type CachedSnapshot = {
3886
- /** The revision number of this snapshot */revision: number; /** The document state at this revision */
3887
- document: PHDocument;
3888
- };
3889
- /**
3890
- * Serialized keyframe snapshot for K/V store persistence
3891
- */
3892
- type KeyframeSnapshot = {
3893
- /** The revision number of this keyframe */revision: number; /** Serialized document state */
3894
- document: string;
3895
- };
3896
- //#endregion
3897
4019
  //#region src/projection/protocol.d.ts
3898
4020
  /**
3899
4021
  * Identifier for a built-in read model the projection worker materializes
@@ -4144,6 +4266,7 @@ declare class SyncBuilder {
4144
4266
  * them (`BaseReadModel` subclasses, in particular).
4145
4267
  */
4146
4268
  interface ReadModelFactoryDeps {
4269
+ documentModelRegistry: IDocumentModelRegistry;
4147
4270
  operationIndex: IOperationIndex;
4148
4271
  writeCache: IWriteCache;
4149
4272
  processorManagerConsistencyTracker: IConsistencyTracker;
@@ -4153,16 +4276,28 @@ interface ReadModelFactoryDeps {
4153
4276
  * dependencies once they are available. Awaited during `buildModule()`.
4154
4277
  */
4155
4278
  type ReadModelFactory = (deps: ReadModelFactoryDeps) => IReadModel | Promise<IReadModel>;
4279
+ type WorkerPoolBase = {
4280
+ /** Number of worker threads to spawn; also the sticky-routing modulus. */numWorkers: number;
4281
+ /**
4282
+ * Factory spec the default transport's workers import to instantiate
4283
+ * their signature verifier. Omitted = no executor-side verification,
4284
+ * parity with the in-process executor's default.
4285
+ */
4286
+ verifier?: SignatureVerifierSpec;
4287
+ };
4156
4288
  /**
4157
- * Describes a document-model package the worker should import at runtime.
4158
- * Either a bare-specifier package or an absolute file path.
4289
+ * Executor worker-pool configuration. Either `db` (default thread
4290
+ * transport; each worker opens its own Postgres pool) or a custom
4291
+ * `factory` transport is required by construction — an enabled pool
4292
+ * without connection info is unrepresentable.
4159
4293
  */
4160
- type DocumentModelSpecInput = {
4161
- packageName: string;
4162
- version: string;
4163
- } | {
4164
- filePath: string;
4165
- };
4294
+ type WorkerPoolOptions = (WorkerPoolBase & {
4295
+ db: DbConfig;
4296
+ factory?: WorkerFactory;
4297
+ }) | (WorkerPoolBase & {
4298
+ db?: DbConfig;
4299
+ factory: WorkerFactory;
4300
+ });
4166
4301
  /**
4167
4302
  * Caller-facing config for {@link ReactorBuilder.withProjectionShards}.
4168
4303
  * When set, the builder replaces the in-process
@@ -4177,6 +4312,12 @@ type ProjectionShardBuilderConfig = {
4177
4312
  shardCount: number;
4178
4313
  preReadyKinds: BuiltInReadModelKind[];
4179
4314
  postReadyKinds: BuiltInReadModelKind[];
4315
+ /**
4316
+ * Connection info for the projection workers' own pools. Falls back to
4317
+ * the executor worker pool's `db` when {@link ReactorBuilder.withWorkerPool}
4318
+ * is configured with one.
4319
+ */
4320
+ db?: DbConfig;
4180
4321
  poolSize?: number;
4181
4322
  initTimeoutMs?: number;
4182
4323
  shutdownGraceMs?: number;
@@ -4185,7 +4326,7 @@ type ProjectionShardBuilderConfig = {
4185
4326
  };
4186
4327
  declare class ReactorBuilder {
4187
4328
  private logger?;
4188
- private documentModels;
4329
+ private documentModelSources;
4189
4330
  private upgradeManifests;
4190
4331
  private features;
4191
4332
  private readModels;
@@ -4206,17 +4347,20 @@ declare class ReactorBuilder {
4206
4347
  private documentModelLoader?;
4207
4348
  private shutdownHooks;
4208
4349
  private driveContainerTypes;
4209
- private documentModelSpecs;
4210
- private workerPoolConfig?;
4350
+ private workerPool?;
4211
4351
  private resolvedModelManifest?;
4212
- private workerDbConfig?;
4213
- private workerSignatureVerifierSpec?;
4214
- private workerFactory?;
4215
4352
  private projectionShardConfig?;
4216
4353
  private projectionWorkerFactory?;
4217
4354
  private instrumentedPools;
4218
4355
  withLogger(logger: ILogger): this;
4219
- withDocumentModels(models: DocumentModelModule<any>[]): this;
4356
+ /**
4357
+ * Register document-model sources: live modules, importable files, or
4358
+ * importable packages. Appends across calls. At `buildModule()` every
4359
+ * source is resolved host-side and registered on the registry; file and
4360
+ * package sources additionally form the worker manifest when the worker
4361
+ * pool is enabled (live modules cannot cross a thread boundary).
4362
+ */
4363
+ withDocumentModelSources(sources: DocumentModelSource[]): this;
4220
4364
  withUpgradeManifests(manifests: UpgradeManifest<readonly number[]>[]): this;
4221
4365
  withFeatures(features: ReactorFeatures): this;
4222
4366
  withReadModel(readModel: IReadModel): this;
@@ -4260,43 +4404,27 @@ declare class ReactorBuilder {
4260
4404
  * shutdown chain.
4261
4405
  */
4262
4406
  withShutdownHook(hook: () => Promise<void>): this;
4263
- withDocumentModelSpecs(specs: DocumentModelSpecInput[]): this;
4264
4407
  /**
4265
- * Stores the worker-pool configuration. When `config.enabled === true` the
4266
- * builder constructs a {@link WorkerPoolJobExecutorManager} in place of the
4267
- * in-process {@link SimpleJobExecutorManager}.
4408
+ * Enable the executor worker pool: N `node:worker_threads` workers with
4409
+ * sticky per-document routing, replacing the in-process executor. Calling
4410
+ * this enables the pool — there is no `enabled` flag. Provide `db`
4411
+ * (each worker opens its own Postgres pool; the parent database is built
4412
+ * from it too unless {@link withKysely} is set) or a custom `factory`
4413
+ * transport. `verifier` is imported by the default transport's workers;
4414
+ * omitted = no executor-side signature verification.
4268
4415
  */
4269
- withWorkerPool(config: WorkerPoolConfig): this;
4270
- /**
4271
- * Postgres connection info forwarded to each worker so it can open its own
4272
- * pool. Required when `workerPool.enabled === true` unless a custom
4273
- * `withWorkerFactory` or `withExecutor` is provided.
4274
- */
4275
- withWorkerDbConfig(db: DbConfig): this;
4276
- /**
4277
- * Factory spec the worker imports to instantiate its signature verifier.
4278
- * Required when `workerPool.enabled === true` unless a custom
4279
- * `withWorkerFactory` or `withExecutor` is provided.
4280
- */
4281
- withWorkerSignatureVerifierSpec(spec: SignatureVerifierSpec): this;
4282
- /**
4283
- * Inject a custom {@link WorkerFactory}. When set, the builder skips
4284
- * default thread-transport wiring and hands the factory directly to the
4285
- * pool manager. Use this in tests or to plug in a different transport
4286
- * (e.g. a child-process adapter).
4287
- */
4288
- withWorkerFactory(factory: WorkerFactory): this;
4416
+ withWorkerPool(options: WorkerPoolOptions): this;
4289
4417
  /**
4290
4418
  * Configure N sharded projection workers. When set, the builder replaces
4291
4419
  * the default in-process {@link ReadModelCoordinator} with a
4292
- * {@link ProjectionShardManager}. The same `DbConfig` registered via
4293
- * {@link withWorkerDbConfig} is reused for the projection workers'
4294
- * connection info; only the `poolSize` is overridden by
4295
- * {@link ProjectionShardBuilderConfig.poolSize}.
4420
+ * {@link ProjectionShardManager}.
4296
4421
  *
4297
- * Requires {@link withWorkerDbConfig} (the projection workers need
4298
- * connection info to open their own pools). The same model manifest
4299
- * resolved from {@link withDocumentModelSpecs} is forwarded.
4422
+ * Projection workers open their own Postgres pools from `config.db`,
4423
+ * falling back to the executor worker pool's `db` when
4424
+ * {@link withWorkerPool} is configured with one; only the `poolSize` is
4425
+ * overridden by {@link ProjectionShardBuilderConfig.poolSize}. The same
4426
+ * model manifest resolved from {@link withDocumentModelSources} is
4427
+ * forwarded.
4300
4428
  */
4301
4429
  withProjectionShards(config: ProjectionShardBuilderConfig): this;
4302
4430
  /**
@@ -4308,6 +4436,14 @@ declare class ReactorBuilder {
4308
4436
  getResolvedModelManifest(): ModelManifestEntry[] | undefined;
4309
4437
  build(): Promise<IReactor>;
4310
4438
  buildModule(): Promise<InProcessReactorModule>;
4439
+ /**
4440
+ * The single Postgres config for the parent, executor workers, and
4441
+ * projection shards. They must share one physical database (the parent
4442
+ * writes operations; workers and shards read them), so divergent
4443
+ * worker/shard targets throw. `withKysely` overrides the parent and is not
4444
+ * validated against a worker/shard `db`.
4445
+ */
4446
+ private resolveReactorDbConfig;
4311
4447
  /**
4312
4448
  * Constructs a {@link ProjectionShardManager} bound to the host event
4313
4449
  * bus. Builds the default thread-transport factory unless one was
@@ -4318,9 +4454,9 @@ declare class ReactorBuilder {
4318
4454
  private createProjectionShardManager;
4319
4455
  private createDefaultProjectionWorkerFactory;
4320
4456
  /**
4321
- * Default {@link WorkerFactory} used when `workerPool.enabled` is set and
4322
- * the caller did not inject `withWorkerFactory`. Each worker spawns a real
4323
- * `node:worker_threads` Worker pointing at the compiled `worker/entry.js`.
4457
+ * Default {@link WorkerFactory} used when the pool options carry no
4458
+ * custom `factory`. Each worker spawns a real `node:worker_threads`
4459
+ * Worker pointing at the compiled `worker/entry.js`.
4324
4460
  */
4325
4461
  private createDefaultWorkerFactory;
4326
4462
  /**
@@ -4596,7 +4732,7 @@ declare class InMemoryQueue implements IQueue {
4596
4732
  completeJob(jobId: string): Promise<void>;
4597
4733
  failJob(jobId: string, error?: ErrorInfo$1): Promise<void>;
4598
4734
  deferJob(jobId: string): void;
4599
- retryJob(jobId: string, error?: ErrorInfo$1): Promise<void>;
4735
+ retryJob(jobId: string, error?: ErrorInfo$1, accounting?: RetryAccounting): Promise<void>;
4600
4736
  /**
4601
4737
  * Check if the queue is drained and call the callback if it is
4602
4738
  */
@@ -4899,6 +5035,8 @@ declare class KyselyWriteCache implements IWriteCache {
4899
5035
  /**
4900
5036
  * Retrieves document state at a specific revision from cache or rebuilds it.
4901
5037
  *
5038
+ * Note: this returns a _shallow_ copy of the document.
5039
+ *
4902
5040
  * Cache hit path: Returns cached snapshot if available (O(1))
4903
5041
  * Warm miss path: Rebuilds from cached base revision + incremental ops
4904
5042
  * Cold miss path: Rebuilds from keyframe or from scratch using all operations
@@ -4936,7 +5074,8 @@ declare class KyselyWriteCache implements IWriteCache {
4936
5074
  * @param document - The document to cache
4937
5075
  * @throws {Error} If document serialization fails
4938
5076
  */
4939
- putState(documentId: string, scope: string, branch: string, revision: number, document: PHDocument): void;
5077
+ putState(documentId: string, scope: string, branch: string, revision: number, document: PHDocument, position: SnapshotPosition): void;
5078
+ private store;
4940
5079
  /**
4941
5080
  * Invalidates cached document streams.
4942
5081
  *
@@ -4965,6 +5104,13 @@ declare class KyselyWriteCache implements IWriteCache {
4965
5104
  getStream(documentId: string, scope: string, branch: string): DocumentStream | undefined;
4966
5105
  private findNearestKeyframe;
4967
5106
  private coldMissRebuild;
5107
+ /**
5108
+ * Copies the current document revisions onto the document. Overwrites the
5109
+ * requested scope revision with the target revision, if provided.
5110
+ */
5111
+ private stampRevisions;
5112
+ /** The stored operation at `index`, or undefined if it is no longer there. */
5113
+ private operationAt;
4968
5114
  /**
4969
5115
  * Resolves which module version to use for a given operation in phase 2.
4970
5116
  *
@@ -4988,9 +5134,23 @@ declare class KyselyOperationStore implements IOperationStore {
4988
5134
  constructor(db: Kysely<Database$1>);
4989
5135
  private get queryExecutor();
4990
5136
  withTransaction(trx: Transaction<Database$1>): KyselyOperationStore;
4991
- apply(documentId: string, documentType: string, scope: string, branch: string, revision: number, fn: (txn: AtomicTxn) => void | Promise<void>, signal?: AbortSignal): Promise<Operation[]>;
5137
+ apply(documentId: string, documentType: string, scope: string, branch: string, revision: number, fn: (txn: AtomicTxn) => void | Promise<void>, signal?: AbortSignal, condition?: AppendCondition): Promise<Operation[]>;
4992
5138
  private resolveUniqueConstraint;
4993
5139
  private executeApply;
5140
+ /**
5141
+ * Locks the written stream and every read-set stream, in sorted key order
5142
+ * so that overlapping concurrent appends serialize rather than deadlock.
5143
+ * The locks are still taken one row at a time, so the query preserves that
5144
+ * order. It must stay separate from the guarded insert, which would
5145
+ * otherwise read a snapshot taken before the locks were held.
5146
+ */
5147
+ private acquireStreamLocks;
5148
+ /**
5149
+ * Inserts the staged operations with the condition compiled in as a WHERE
5150
+ * NOT EXISTS guard, making the check and the append one statement. Returns
5151
+ * the rows inserted; zero means the guard failed and nothing was written.
5152
+ */
5153
+ private insertGuarded;
4994
5154
  private findIdempotentReplay;
4995
5155
  getSince(documentId: string, scope: string, branch: string, revision: number, filter?: OperationFilter, paging?: PagingOptions, signal?: AbortSignal): Promise<PagedResults<Operation>>;
4996
5156
  getSinceId(id: number, paging?: PagingOptions, signal?: AbortSignal): Promise<PagedResults<OperationWithContext$1>>;
@@ -5048,6 +5208,7 @@ declare class SimpleJobExecutor implements IJobExecutor {
5048
5208
  private collectionMembershipCache;
5049
5209
  private driveContainerTypes;
5050
5210
  private config;
5211
+ private featureFlags;
5051
5212
  private signatureVerifierModule;
5052
5213
  private documentActionHandler;
5053
5214
  private executionScope;
@@ -5060,6 +5221,13 @@ declare class SimpleJobExecutor implements IJobExecutor {
5060
5221
  private getCollectionMembershipsForOperations;
5061
5222
  private processActions;
5062
5223
  private executeRegularAction;
5224
+ /**
5225
+ * If an operation happened that could change a decision model verdict, we
5226
+ * need to re-evaluate across the streams that could be affected. Previously
5227
+ * approved operations may need to be denied, which will apply new denied
5228
+ * operations with appropriate skip.
5229
+ */
5230
+ private reevaluateReadingScopes;
5063
5231
  private executeLoadJob;
5064
5232
  private accumulateResultOrReturnError;
5065
5233
  }
@@ -5128,6 +5296,61 @@ declare class DocumentModelRegistry implements IDocumentModelRegistry {
5128
5296
  getUpgradeReducer(documentType: string, fromVersion: number, toVersion: number): UpgradeReducer<any, any>;
5129
5297
  }
5130
5298
  //#endregion
5299
+ //#region src/decision/types.d.ts
5300
+ /** One operation stream. */
5301
+ type StreamQuery = {
5302
+ documentId: string;
5303
+ branch: string;
5304
+ scope: string;
5305
+ };
5306
+ /** The document and branch a decision model is built for. */
5307
+ type DecisionTarget = {
5308
+ documentId: string;
5309
+ branch: string;
5310
+ };
5311
+ /** The executing scope's own state, for conditions that read it. */
5312
+ type DecisionContext = {
5313
+ scopeState: unknown;
5314
+ };
5315
+ /**
5316
+ * A named stream whose value in the model is that scope's state from the
5317
+ * document rebuild the reactor already performs. A derived query may read
5318
+ * only statically-queried projections, so composition is one layer deep.
5319
+ */
5320
+ type Projection<M> = {
5321
+ query: StreamQuery | ((model: Partial<M>) => StreamQuery[]);
5322
+ /**
5323
+ * Action types in this stream that can change a verdict. Reads of the stream
5324
+ * are filtered to these, so anything left out is invisible to a decision.
5325
+ */
5326
+ decidingActions: string[]; /** Applies one of this stream's operations while deciding. */
5327
+ apply: (document: PHDocument, operation: Operation) => PHDocument;
5328
+ };
5329
+ /** Projections plus a decision function over the built model. */
5330
+ type DecisionModel<M> = {
5331
+ projections: { [K in keyof M]: Projection<M> };
5332
+ /**
5333
+ * Whether or not this model decides about operations in a given scope. That
5334
+ * is, a scope it reads is not necessarily one it judges, and vise-versa.
5335
+ */
5336
+ judgesScope(scope: string): boolean;
5337
+ decide(model: M, subject: AuthSubject, request: AuthRequest, ctx: DecisionContext): AuthDecision;
5338
+ };
5339
+ /** A built model plus the read-set condition recording what the build read. */
5340
+ type BuiltDecisionModel<M> = {
5341
+ model: M;
5342
+ appendCondition: AppendCondition;
5343
+ };
5344
+ //#endregion
5345
+ //#region src/decision/build-decision-model.d.ts
5346
+ /**
5347
+ * Reads each projection's stream through the write cache, recording the
5348
+ * revision observed. Static projections resolve first; derived projections
5349
+ * see only those and contribute a map from document id to state. Each
5350
+ * distinct stream is read once and yields one append condition entry.
5351
+ */
5352
+ declare function buildDecisionModel<M>(cache: IWriteCache, definition: (target: DecisionTarget) => DecisionModel<M>, target: DecisionTarget, signal?: AbortSignal): Promise<BuiltDecisionModel<M>>;
5353
+ //#endregion
5131
5354
  //#region src/read-models/base-read-model.d.ts
5132
5355
  type BaseReadModelConfig = {
5133
5356
  readModelId: string;
@@ -5212,7 +5435,7 @@ declare class KyselyDocumentIndexer extends BaseReadModel implements IDocumentIn
5212
5435
  * serialized so the executor can return to dispatch without holding ordering
5213
5436
  * implicitly.
5214
5437
  */
5215
- declare class ReadModelCoordinator implements IReadModelCoordinator {
5438
+ declare class ReadModelCoordinator implements ILiveReadModelCoordinator {
5216
5439
  private eventBus;
5217
5440
  readonly preReady: IReadModel[];
5218
5441
  readonly postReady: IReadModel[];
@@ -5231,6 +5454,7 @@ declare class ReadModelCoordinator implements IReadModelCoordinator {
5231
5454
  */
5232
5455
  drain(): Promise<void>;
5233
5456
  getChainDepth(): number;
5457
+ addReadModel(readModel: IReadModel, stage: ReadModelRegistrationStage): void;
5234
5458
  private handleWriteReady;
5235
5459
  private emitEmptyReadReady;
5236
5460
  private runChain;
@@ -5676,5 +5900,5 @@ declare class ProcessorManager extends BaseReadModel implements IProcessorManage
5676
5900
  private deleteProcessorCursors;
5677
5901
  }
5678
5902
  //#endregion
5679
- export { type AbortMessage, type AtomicTxn, type AttachmentHash, type AttachmentRef, BaseReadModel, type BatchExecutionRequest, type BatchExecutionResult, type BatchLoadRequest, type BatchLoadResult, 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, DRIVE_AUTH_ERROR_MESSAGES, type Database, type DbConfig, type DeadLetterAddedEvent, DefaultSubscriptionErrorHandler, type DocumentChangeEvent, DocumentChangeType, type DocumentGraphEdge, type DocumentIndexerDatabase, DocumentIntegrityService, DocumentModelRegistry, DocumentModelResolver, type DocumentModelSpec, type DocumentModelSpecInput, type DocumentRelationship, type DocumentRevisions, type DocumentStreamKey, type DocumentViewDatabase, DriveClient, DriveCollectionId, DuplicateManifestError, DuplicateModuleError, DuplicateOperationError, EventBus, EventBusAggregateError, type ExecuteMessage, type ExecutionJobPlan, type ExecutorStartedEvent, type ExecutorStoppedEvent, type FactorySpec, type GqlChannelConfig, GqlRequestChannel, GqlRequestChannelFactory, GqlResponseChannel, GqlResponseChannelFactory, type HeartbeatMessage, 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 IMailbox, type IOperationIndex, type IOperationStore, type IPollTimer, type IProcessor, type IProcessorHostModule, type IProcessorManager, type IProjectionTransport, type IQueue, type IReactor, type IReactorClient, type IReactorSubscriptionManager, type IReadModel, type IReadModelCoordinator, type IRelationalDb, 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, ModuleNotFoundError, type ModuleRef, NullDocumentModelResolver, type OperationBatch, type OperationContext, type OperationFilter, type OperationIndexEntry, type OperationTable, type OperationWithContext, OptimisticLockError, 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 ProjectionShardBuilderConfig, type ProjectionShardManagerConfig, type ProjectionWorkerFactory, PropagationMode, QueueEventTypes, REACTOR_SCHEMA, Reactor, ReactorBuilder, ReactorClient, ReactorClientBuilder, type ReactorClientModule, ReactorEventTypes, type ReactorFeatures, type JobFailedEvent$1 as ReactorJobFailedEvent, type ReactorModule, ReactorSubscriptionManager, type ReadModelBatchCompletedEvent, ReadModelCoordinator, type ReadModelFactory, type ReadModelFactoryDeps, type ReadModelIndexedEvent, type ReadModelIndexingStage, type ReadModelStage, type ReadyMessage, type RebuildResult, RelationalDbProcessor, RelationshipChangeType, type Remote, type RemoteCursor, type RemoteFilter, type RemoteMeta, type RemoteOptions, type RemoteRecord, type RemoteStatus, type ResultMessage, RevisionMismatchError, type SanitizedArg, type SearchFilter, type ShutdownMessage, type ShutdownStatus, type SignatureVerificationHandler, type SignatureVerifierSpec, type SignerConfig, SimpleJobExecutorManager, type SnapshotValidationIssue, type Database$1 as StorageDatabase, type SubscriptionErrorContext, SyncBuilder, type SyncEnvelope, type SyncEnvelopeType, SyncEventTypes, type SyncFailedEvent, type SyncModule, SyncOperation, SyncOperationAggregateError, type SyncOperationErrorType, SyncOperationStatus, type SyncPendingEvent, SyncStatus, type SyncStatusChangeCallback, SyncStatusTracker, type SyncSucceededEvent, type TrackedProcessor, type Unsubscribe, type ValidationResult, type ViewFilter, type ErrorInfo as WorkerErrorInfo, type WorkerMessage, type WorkerPoolConfig, type WriteCacheConfig, addRelationshipAction, batchOperationsByDocument, consolidateSyncOperations, createDocumentAction, createForwardingLogger, createMutableShutdownStatus, createRelationalDb, deleteDocumentAction, documentActions, driveIdFromUrl, envelopesToSyncOperations, errorToInfo, getMigrationStatus, instrumentPgPool, isDriveAuthError, makeConsistencyKey, parseDriveUrl, parsePagingOptions, removeRelationshipAction, runMigrations, sanitizeArg, trimMailboxFromAckOrdinal, updateRelationshipAction, upgradeDocumentAction, workerEntryPath };
5903
+ export { APPEND_CONDITION_FAILED_PREFIX, type AbortMessage, type AppendCondition, AppendConditionFailedError, type AppendConditionStream, type AtomicTxn, type AttachmentHash, type AttachmentRef, 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, DRIVE_AUTH_ERROR_MESSAGES, type Database, type DbConfig, type DeadLetterAddedEvent, type DecisionContext, type DecisionModel, type DecisionTarget, DefaultSubscriptionErrorHandler, type DocumentChangeEvent, DocumentChangeType, type DocumentGraphEdge, type DocumentIndexerDatabase, DocumentIntegrityService, DocumentModelRegistry, DocumentModelResolver, type DocumentModelSource, type DocumentModelSpec, type DocumentRelationship, type DocumentRevisions, type DocumentStreamKey, type DocumentViewDatabase, DriveClient, DriveCollectionId, DuplicateManifestError, DuplicateModuleError, DuplicateOperationError, EventBus, EventBusAggregateError, type ExecuteMessage, type ExecutionJobPlan, type ExecutorStartedEvent, type ExecutorStoppedEvent, type FactorySpec, type FileModelSource, type GqlChannelConfig, GqlRequestChannel, GqlRequestChannelFactory, GqlResponseChannel, GqlResponseChannelFactory, type HeartbeatMessage, 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 IProcessorHostModule, type IProcessorManager, type IProjectionTransport, type IQueue, type IReactor, type IReactorClient, type IReactorSubscriptionManager, type IReadModel, type IReadModelCoordinator, type IRelationalDb, 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, ModuleNotFoundError, type ModuleRef, NullDocumentModelResolver, type OperationBatch, type OperationContext, type OperationFilter, type OperationIndexEntry, type OperationTable, type OperationWithContext, OptimisticLockError, 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 ProjectionShardManagerConfig, type ProjectionWorkerFactory, PropagationMode, QueueEventTypes, REACTOR_SCHEMA, Reactor, ReactorBuilder, ReactorClient, ReactorClientBuilder, type ReactorClientModule, ReactorEventTypes, type ReactorFeatures, type JobFailedEvent$1 as ReactorJobFailedEvent, type ReactorModule, ReactorSubscriptionManager, type ReadModelBatchCompletedEvent, ReadModelCoordinator, type ReadModelFactory, type ReadModelFactoryDeps, type ReadModelIndexedEvent, type ReadModelIndexingStage, type ReadModelRegistrationStage, type ReadModelStage, type ReadyMessage, type RebuildResult, RelationalDbProcessor, RelationshipChangeType, type Remote, type RemoteCursor, type RemoteFilter, type RemoteMeta, type RemoteOptions, type RemoteRecord, type RemoteStatus, type ResultMessage, RetryAccounting, RevisionMismatchError, type SanitizedArg, type SearchFilter, type ShutdownMessage, type ShutdownStatus, type SignatureVerificationHandler, type SignatureVerifierSpec, type SignerConfig, SimpleJobExecutorManager, type SnapshotValidationIssue, type Database$1 as StorageDatabase, type StreamQuery, type SubscriptionErrorContext, SyncBuilder, type SyncEnvelope, type SyncEnvelopeType, SyncEventTypes, type SyncFailedEvent, type SyncModule, SyncOperation, SyncOperationAggregateError, type SyncOperationErrorType, SyncOperationStatus, type SyncPendingEvent, 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, batchOperationsByDocument, buildDecisionModel, consolidateSyncOperations, createDocumentAction, createForwardingLogger, createMutableShutdownStatus, createRelationalDb, deleteDocumentAction, documentActions, driveIdFromUrl, envelopesToSyncOperations, errorToInfo, getMigrationStatus, instrumentPgPool, isDriveAuthError, makeConsistencyKey, parseDriveUrl, parsePagingOptions, removeRelationshipAction, runMigrations, sanitizeArg, supportsLiveReadModelRegistration, trimMailboxFromAckOrdinal, updateRelationshipAction, upgradeDocumentAction, workerEntryPath };
5680
5904
  //# sourceMappingURL=index.d.ts.map