@powerhousedao/reactor 6.2.2-dev.36 → 6.2.2-dev.38
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/{build-worker-executor-B9gIvuvf.js → build-worker-executor-CAEZD_yJ.js} +2 -2
- package/dist/{build-worker-executor-B9gIvuvf.js.map → build-worker-executor-CAEZD_yJ.js.map} +1 -1
- package/dist/{document-indexer-BY-mPXJF.js → document-indexer-C0GB0b8Q.js} +11 -5
- package/dist/document-indexer-C0GB0b8Q.js.map +1 -0
- package/dist/{drive-container-types-ZSLCC3lC.js → drive-container-types-BJCKXJwH.js} +607 -178
- package/dist/drive-container-types-BJCKXJwH.js.map +1 -0
- package/dist/entry.js +2 -2
- package/dist/index.d.ts +215 -14
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +225 -83
- package/dist/index.js.map +1 -1
- package/dist/projection-entry.js +4 -4
- package/dist/projection-entry.js.map +1 -1
- package/dist/{worker-BMn-2vsH.js → worker-jEJW6_j7.js} +2 -2
- package/dist/{worker-BMn-2vsH.js.map → worker-jEJW6_j7.js.map} +1 -1
- package/package.json +5 -4
- package/dist/document-indexer-BY-mPXJF.js.map +0 -1
- package/dist/drive-container-types-ZSLCC3lC.js.map +0 -1
package/dist/entry.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { o as instrumentPgPool } from "./drive-container-types-
|
|
1
|
+
import { o as instrumentPgPool } from "./drive-container-types-BJCKXJwH.js";
|
|
2
2
|
import { n as errorToInfo, t as createForwardingLogger } from "./forwarding-logger-BBkMSxuJ.js";
|
|
3
|
-
import { n as defaultLoadFactory, t as buildWorkerExecutor } from "./build-worker-executor-
|
|
3
|
+
import { n as defaultLoadFactory, t as buildWorkerExecutor } from "./build-worker-executor-CAEZD_yJ.js";
|
|
4
4
|
import { ConsoleLogger } from "document-model";
|
|
5
5
|
import { isMainThread, parentPort } from "node:worker_threads";
|
|
6
6
|
//#region src/executor/worker/run-worker.ts
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Action,
|
|
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";
|
|
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";
|
|
@@ -138,9 +138,14 @@ type JobAvailableEvent = {
|
|
|
138
138
|
//#endregion
|
|
139
139
|
//#region src/shared/types.d.ts
|
|
140
140
|
/**
|
|
141
|
-
* Information about an error including message and stack trace.
|
|
141
|
+
* Information about an error including its name, message and stack trace.
|
|
142
|
+
*
|
|
143
|
+
* The name is what survives the crossing out of the executor: a consumer that
|
|
144
|
+
* has to tell a terminal failure from a retryable one, or classify a dead
|
|
145
|
+
* letter, only ever sees this record rather than the thrown error.
|
|
142
146
|
*/
|
|
143
147
|
type ErrorInfo$1 = {
|
|
148
|
+
name: string;
|
|
144
149
|
message: string;
|
|
145
150
|
stack: string;
|
|
146
151
|
};
|
|
@@ -424,7 +429,13 @@ declare enum ChannelErrorSource {
|
|
|
424
429
|
Inbox = "inbox",
|
|
425
430
|
Outbox = "outbox"
|
|
426
431
|
}
|
|
427
|
-
type SyncOperationErrorType = "SIGNATURE_INVALID" | "HASH_MISMATCH" | "LIBRARY_ERROR" | "MISSING_OPERATIONS" | "EXCESSIVE_SHUFFLE" | "GRACEFUL_ABORT"
|
|
432
|
+
type SyncOperationErrorType = "SIGNATURE_INVALID" | "HASH_MISMATCH" | "LIBRARY_ERROR" | "MISSING_OPERATIONS" | "EXCESSIVE_SHUFFLE" | "GRACEFUL_ABORT"
|
|
433
|
+
/**
|
|
434
|
+
* An arriving auth operation did not exceed the local auth head. Exempt from
|
|
435
|
+
* quarantine, because reconciling the two policies needs the traffic a
|
|
436
|
+
* quarantine would stop.
|
|
437
|
+
*/
|
|
438
|
+
| "AUTH_TIMESTAMP_NOT_MONOTONIC" /** An arriving operation carried a timestamp that is not an ISO-8601 instant. */ | "INVALID_TIMESTAMP" /** No classification applies, including rows written before the field. */ | "UNCLASSIFIED";
|
|
428
439
|
type ChannelHealth = {
|
|
429
440
|
state: "idle" | "running" | "error";
|
|
430
441
|
lastSuccessUtcMs?: number;
|
|
@@ -517,6 +528,7 @@ type DeadLetterAddedEvent = {
|
|
|
517
528
|
remoteName: string;
|
|
518
529
|
documentId: string;
|
|
519
530
|
errorSource: ChannelErrorSource;
|
|
531
|
+
errorType: SyncOperationErrorType;
|
|
520
532
|
};
|
|
521
533
|
/**
|
|
522
534
|
* Status of a sync operation result.
|
|
@@ -690,6 +702,16 @@ interface IOperationStore {
|
|
|
690
702
|
* @returns Object containing revision map and latest timestamp
|
|
691
703
|
*/
|
|
692
704
|
getRevisions(documentId: string, branch: string, signal?: AbortSignal): Promise<DocumentRevisions>;
|
|
705
|
+
/**
|
|
706
|
+
* The largest operation timestamp in one stream, or undefined when it is empty.
|
|
707
|
+
* Distinct from {@link DocumentRevisions.latestTimestamp}, which maxes over
|
|
708
|
+
* every scope.
|
|
709
|
+
*
|
|
710
|
+
* Must be a real maximum, not the last-indexed operation's timestamp: a
|
|
711
|
+
* re-evaluation pass re-appends at a fresh index while keeping the original
|
|
712
|
+
* timestamp, so a later timestamp can sit behind the last row.
|
|
713
|
+
*/
|
|
714
|
+
getStreamLatestTimestamp(documentId: string, scope: string, branch: string, signal?: AbortSignal): Promise<string | undefined>;
|
|
693
715
|
}
|
|
694
716
|
/**
|
|
695
717
|
* Stores periodic document snapshots (keyframes) so that document state
|
|
@@ -1108,7 +1130,8 @@ type DeadLetterRecord = {
|
|
|
1108
1130
|
branch: string;
|
|
1109
1131
|
operations: OperationWithContext$1[];
|
|
1110
1132
|
errorSource: ChannelErrorSource;
|
|
1111
|
-
errorMessage: string;
|
|
1133
|
+
errorMessage: string; /** Why it failed, in the closed set sync classifies failures into. */
|
|
1134
|
+
errorType: SyncOperationErrorType;
|
|
1112
1135
|
};
|
|
1113
1136
|
/**
|
|
1114
1137
|
* Persists dead-lettered sync operations so they survive reactor restarts.
|
|
@@ -1759,7 +1782,7 @@ interface IReactorClient {
|
|
|
1759
1782
|
* @param signal - Optional abort signal to cancel the request
|
|
1760
1783
|
* @returns The canonical document id
|
|
1761
1784
|
*/
|
|
1762
|
-
resolveIdOrSlug(identifier: string, signal?: AbortSignal): Promise<string>;
|
|
1785
|
+
resolveIdOrSlug(identifier: string, view?: ViewFilter, signal?: AbortSignal): Promise<string>;
|
|
1763
1786
|
/**
|
|
1764
1787
|
* Retrieves operations for a document.
|
|
1765
1788
|
*
|
|
@@ -2018,7 +2041,7 @@ declare class ReactorClient implements IReactorClient {
|
|
|
2018
2041
|
* same lookup as the data path. Resolves against the "main" branch. Throws if
|
|
2019
2042
|
* the identifier cannot be resolved or is ambiguous.
|
|
2020
2043
|
*/
|
|
2021
|
-
resolveIdOrSlug(identifier: string, signal?: AbortSignal): Promise<string>;
|
|
2044
|
+
resolveIdOrSlug(identifier: string, view?: ViewFilter, signal?: AbortSignal): Promise<string>;
|
|
2022
2045
|
/**
|
|
2023
2046
|
* Retrieves operations for a document
|
|
2024
2047
|
*/
|
|
@@ -2313,6 +2336,7 @@ interface SyncDeadLetterTable {
|
|
|
2313
2336
|
operations: unknown;
|
|
2314
2337
|
error_source: string;
|
|
2315
2338
|
error_message: string;
|
|
2339
|
+
error_type: Generated<string>;
|
|
2316
2340
|
created_at: Generated<Date>;
|
|
2317
2341
|
}
|
|
2318
2342
|
interface Database$1 {
|
|
@@ -3066,6 +3090,7 @@ declare class KyselyOperationStore implements IOperationStore {
|
|
|
3066
3090
|
getSinceId(id: number, paging?: PagingOptions, signal?: AbortSignal): Promise<PagedResults<OperationWithContext$1>>;
|
|
3067
3091
|
getConflicting(documentId: string, scope: string, branch: string, minTimestamp: string, paging?: PagingOptions, signal?: AbortSignal): Promise<PagedResults<Operation>>;
|
|
3068
3092
|
getRevisions(documentId: string, branch: string, signal?: AbortSignal): Promise<DocumentRevisions>;
|
|
3093
|
+
getStreamLatestTimestamp(documentId: string, scope: string, branch: string, signal?: AbortSignal): Promise<string | undefined>;
|
|
3069
3094
|
private rowToOperation;
|
|
3070
3095
|
private rowToOperationWithContext;
|
|
3071
3096
|
}
|
|
@@ -3136,6 +3161,11 @@ type ReactorFeatureFlags = {
|
|
|
3136
3161
|
* operation's position rather than for the whole document.
|
|
3137
3162
|
*/
|
|
3138
3163
|
documentDecisions: boolean;
|
|
3164
|
+
/**
|
|
3165
|
+
* Evaluate the auth policy by reading the auth scope as a second projection.
|
|
3166
|
+
* Requires documentDecisions.
|
|
3167
|
+
*/
|
|
3168
|
+
authEnforcement: boolean;
|
|
3139
3169
|
};
|
|
3140
3170
|
/**
|
|
3141
3171
|
* Configuration options for the job executor
|
|
@@ -3642,7 +3672,13 @@ declare class PollingChannelError extends Error {
|
|
|
3642
3672
|
declare class ChannelError extends Error {
|
|
3643
3673
|
source: ChannelErrorSource;
|
|
3644
3674
|
error: Error;
|
|
3645
|
-
|
|
3675
|
+
/**
|
|
3676
|
+
* The classification when something other than the error carries it. Absent
|
|
3677
|
+
* means derive it from `error.name`; a dead letter mirrored from a peer sets it,
|
|
3678
|
+
* because only the message crosses the wire.
|
|
3679
|
+
*/
|
|
3680
|
+
readonly errorType?: SyncOperationErrorType;
|
|
3681
|
+
constructor(source: ChannelErrorSource, error: Error, errorType?: SyncOperationErrorType);
|
|
3646
3682
|
}
|
|
3647
3683
|
//#endregion
|
|
3648
3684
|
//#region src/sync/sync-operation.d.ts
|
|
@@ -5209,6 +5245,7 @@ declare class SimpleJobExecutor implements IJobExecutor {
|
|
|
5209
5245
|
private driveContainerTypes;
|
|
5210
5246
|
private config;
|
|
5211
5247
|
private featureFlags;
|
|
5248
|
+
private decisionModel;
|
|
5212
5249
|
private signatureVerifierModule;
|
|
5213
5250
|
private documentActionHandler;
|
|
5214
5251
|
private executionScope;
|
|
@@ -5222,12 +5259,47 @@ declare class SimpleJobExecutor implements IJobExecutor {
|
|
|
5222
5259
|
private processActions;
|
|
5223
5260
|
private executeRegularAction;
|
|
5224
5261
|
/**
|
|
5225
|
-
* Orders a write by timestamp
|
|
5226
|
-
*
|
|
5227
|
-
*
|
|
5228
|
-
*
|
|
5262
|
+
* Orders a write by timestamp and decides it where it lands. The caller
|
|
5263
|
+
* supplies the timestamp, so a write can belong before operations already
|
|
5264
|
+
* stored; those are re-appended alongside it, the way a load reshuffles.
|
|
5265
|
+
*
|
|
5266
|
+
* Deciding a backdated write at the stream heads instead of at its position
|
|
5267
|
+
* would overwrite the verdict every other replica computes for it.
|
|
5229
5268
|
*/
|
|
5230
5269
|
private positionByTimestamp;
|
|
5270
|
+
/**
|
|
5271
|
+
* Decides each operation where it lands and carries the verdict on it. A
|
|
5272
|
+
* refused submitted action is reported to the caller and nothing is stored; a
|
|
5273
|
+
* refused operation the reshuffle merely moved keeps its verdict, because it
|
|
5274
|
+
* already holds a position.
|
|
5275
|
+
*
|
|
5276
|
+
* The operations carry the indexes and skips they will be stored at, because
|
|
5277
|
+
* the walk resolves skips before it orders them.
|
|
5278
|
+
*/
|
|
5279
|
+
private evaluatePositioned;
|
|
5280
|
+
/**
|
|
5281
|
+
* The scopes a re-evaluation pass visits, in a fixed order.
|
|
5282
|
+
*
|
|
5283
|
+
* The revisions map comes from a query with no ORDER BY, and the order is
|
|
5284
|
+
* load-bearing: each scope's pass re-reads the auth stream, and the walk skips
|
|
5285
|
+
* an operation by its stored denial, so a denial this pass just wrote is
|
|
5286
|
+
* visible to a later-visited scope and invisible to an earlier one. The model's
|
|
5287
|
+
* own projection order leads, then the rest sorted, so the pass is reproducible
|
|
5288
|
+
* across replicas and across runs.
|
|
5289
|
+
*/
|
|
5290
|
+
private evaluationOrder;
|
|
5291
|
+
/**
|
|
5292
|
+
* The first timestamp in the batch that does not strictly exceed everything
|
|
5293
|
+
* ahead of it, or undefined when the whole batch is monotonic.
|
|
5294
|
+
*
|
|
5295
|
+
* The bound is carried forward rather than compared against one stored maximum,
|
|
5296
|
+
* because a single execute can carry several auth actions stamped in the same
|
|
5297
|
+
* millisecond. Letting a tie through would store a stream the position walk
|
|
5298
|
+
* then refuses to read, with no repair path.
|
|
5299
|
+
*/
|
|
5300
|
+
private firstNonMonotonicTimestamp;
|
|
5301
|
+
/** The operations a batch of submitted actions appends at the scope's tail. */
|
|
5302
|
+
private appendedOperations;
|
|
5231
5303
|
/**
|
|
5232
5304
|
* Re-evaluates the document when a write meets both criteria: it was written
|
|
5233
5305
|
* to a stream the model reads, and it is timestamped before an operation
|
|
@@ -5340,6 +5412,16 @@ type Projection<M> = {
|
|
|
5340
5412
|
decidingActions: string[]; /** Applies one of this stream's operations while deciding. */
|
|
5341
5413
|
apply: (document: PHDocument, operation: Operation) => PHDocument;
|
|
5342
5414
|
};
|
|
5415
|
+
/**
|
|
5416
|
+
* The outcome of evaluating one operation. A refusal carries the reason it is
|
|
5417
|
+
* recorded with, because a model has more than one way to refuse.
|
|
5418
|
+
*/
|
|
5419
|
+
type Evaluation = {
|
|
5420
|
+
decision: "allow";
|
|
5421
|
+
} | {
|
|
5422
|
+
decision: "deny";
|
|
5423
|
+
reason: string;
|
|
5424
|
+
};
|
|
5343
5425
|
/** Projections plus a decision function over the built model. */
|
|
5344
5426
|
type DecisionModel<M> = {
|
|
5345
5427
|
projections: { [K in keyof M]: Projection<M> };
|
|
@@ -5348,7 +5430,7 @@ type DecisionModel<M> = {
|
|
|
5348
5430
|
* is, a scope it reads is not necessarily one it evaluates, and vise-versa.
|
|
5349
5431
|
*/
|
|
5350
5432
|
evaluatesScope(scope: string): boolean;
|
|
5351
|
-
decide(model: M, subject: AuthSubject, request: AuthRequest, ctx: DecisionContext):
|
|
5433
|
+
decide(model: M, subject: AuthSubject, request: AuthRequest, ctx: DecisionContext): Evaluation;
|
|
5352
5434
|
};
|
|
5353
5435
|
/** A built model plus the read-set condition recording what the build read. */
|
|
5354
5436
|
type BuiltDecisionModel<M> = {
|
|
@@ -5365,6 +5447,76 @@ type BuiltDecisionModel<M> = {
|
|
|
5365
5447
|
*/
|
|
5366
5448
|
declare function buildDecisionModel<M>(cache: IWriteCache, definition: (target: DecisionTarget) => DecisionModel<M>, target: DecisionTarget, signal?: AbortSignal): Promise<BuiltDecisionModel<M>>;
|
|
5367
5449
|
//#endregion
|
|
5450
|
+
//#region src/decision/auth-decision-model.d.ts
|
|
5451
|
+
type AuthDecisionModel = {
|
|
5452
|
+
document: PHDocumentState;
|
|
5453
|
+
auth: PHAuthState;
|
|
5454
|
+
};
|
|
5455
|
+
/** This decision model uses both the document and the auth streams. */
|
|
5456
|
+
declare function authDecisionModel(target: DecisionTarget): DecisionModel<AuthDecisionModel>;
|
|
5457
|
+
//#endregion
|
|
5458
|
+
//#region src/decision/document-decision-model.d.ts
|
|
5459
|
+
/** What the document decision model reads: the target's document scope. */
|
|
5460
|
+
type DocumentDecisionModel = {
|
|
5461
|
+
document: PHDocumentState;
|
|
5462
|
+
};
|
|
5463
|
+
/**
|
|
5464
|
+
* The simplest decision model: one projection over the document scope, which
|
|
5465
|
+
* rejects on a deleted document.
|
|
5466
|
+
*/
|
|
5467
|
+
declare function documentDecisionModel(target: DecisionTarget): DecisionModel<DocumentDecisionModel>;
|
|
5468
|
+
//#endregion
|
|
5469
|
+
//#region src/decision/registered-model.d.ts
|
|
5470
|
+
/**
|
|
5471
|
+
* A model this reactor can register. Every one carries the document projection,
|
|
5472
|
+
* because admission reads the version and the deletion timestamp off it; a model
|
|
5473
|
+
* with more projections than that is still assignable here.
|
|
5474
|
+
*/
|
|
5475
|
+
type RegisteredDecisionModel = (target: DecisionTarget) => DecisionModel<DocumentDecisionModel>;
|
|
5476
|
+
/** What admission needs out of a model built at the stream heads. */
|
|
5477
|
+
type AdmissionDecision = {
|
|
5478
|
+
evaluation: Evaluation;
|
|
5479
|
+
appendCondition: AppendCondition;
|
|
5480
|
+
documentVersion: number;
|
|
5481
|
+
deletedAtUtcIso: string | null;
|
|
5482
|
+
};
|
|
5483
|
+
/**
|
|
5484
|
+
* Builds the model at the stream heads and decides one request against it. The
|
|
5485
|
+
* append condition it returns is the read-set the store enforces at write time.
|
|
5486
|
+
*/
|
|
5487
|
+
declare function decideAtHead(model: RegisteredDecisionModel, cache: IWriteCache, target: DecisionTarget, subject: AuthSubject, request: AuthRequest, signal?: AbortSignal): Promise<AdmissionDecision>;
|
|
5488
|
+
/**
|
|
5489
|
+
* The model this reactor enforces. With `authEnforcement` off the auth scope is
|
|
5490
|
+
* absent from every append condition and no load walks it.
|
|
5491
|
+
*/
|
|
5492
|
+
declare function selectDecisionModel(flags: ReactorFeatureFlags): RegisteredDecisionModel;
|
|
5493
|
+
//#endregion
|
|
5494
|
+
//#region src/decision/stream-order.d.ts
|
|
5495
|
+
/** Where a stream's stored order contradicts its timestamps. */
|
|
5496
|
+
type OutOfOrderPair = {
|
|
5497
|
+
previous: Operation;
|
|
5498
|
+
current: Operation;
|
|
5499
|
+
/**
|
|
5500
|
+
* `descending` cannot be walked at all. `tied` walks fine — the intra-stream
|
|
5501
|
+
* rule breaks the tie by index — but violates the monotonic auth rule, so a
|
|
5502
|
+
* stream holding one can never be replicated to a peer that lacks it.
|
|
5503
|
+
*/
|
|
5504
|
+
kind: "descending" | "tied";
|
|
5505
|
+
};
|
|
5506
|
+
/**
|
|
5507
|
+
* The first pair of effective operations whose stored order contradicts their
|
|
5508
|
+
* timestamps, or undefined when the stream is in position order.
|
|
5509
|
+
*
|
|
5510
|
+
* Such a stream cannot be walked, and the auth stream is never reshuffled once
|
|
5511
|
+
* the monotonic rule is on, so run this before enabling enforcement on a fleet.
|
|
5512
|
+
*
|
|
5513
|
+
* `requireStrict` additionally rejects a tie, which is what the auth stream's
|
|
5514
|
+
* monotonic rule requires and what the walk alone does not care about.
|
|
5515
|
+
*/
|
|
5516
|
+
declare function firstOutOfOrderPair(operations: Operation[], options?: {
|
|
5517
|
+
requireStrict?: boolean;
|
|
5518
|
+
}): OutOfOrderPair | undefined;
|
|
5519
|
+
//#endregion
|
|
5368
5520
|
//#region src/read-models/base-read-model.d.ts
|
|
5369
5521
|
type BaseReadModelConfig = {
|
|
5370
5522
|
readModelId: string;
|
|
@@ -5482,8 +5634,21 @@ declare class ReadModelCoordinator implements ILiveReadModelCoordinator {
|
|
|
5482
5634
|
type Database$2 = Database$1 & DocumentViewDatabase;
|
|
5483
5635
|
declare class KyselyDocumentView extends BaseReadModel implements IDocumentView {
|
|
5484
5636
|
private operationStore;
|
|
5637
|
+
/**
|
|
5638
|
+
* Whether a single-document read serves a deleted document's state as of the
|
|
5639
|
+
* deletion rather than hiding it. Only meaningful with `documentDecisions`,
|
|
5640
|
+
* which is what makes deletion positional. Listings omit it either way.
|
|
5641
|
+
*/
|
|
5642
|
+
private readonly servesDeletionBoundary;
|
|
5485
5643
|
private _db;
|
|
5486
|
-
constructor(db: Kysely<Database$2>, operationStore: IOperationStore, operationIndex: IOperationIndex, writeCache: IWriteCache, consistencyTracker: IConsistencyTracker
|
|
5644
|
+
constructor(db: Kysely<Database$2>, operationStore: IOperationStore, operationIndex: IOperationIndex, writeCache: IWriteCache, consistencyTracker: IConsistencyTracker,
|
|
5645
|
+
/**
|
|
5646
|
+
* Whether a single-document read serves a deleted document's state as of the
|
|
5647
|
+
* deletion rather than hiding it. Only meaningful with `documentDecisions`,
|
|
5648
|
+
* which is what makes deletion positional. Listings omit it either way.
|
|
5649
|
+
*/
|
|
5650
|
+
|
|
5651
|
+
servesDeletionBoundary: boolean);
|
|
5487
5652
|
protected commitOperations(items: OperationWithContext$1[]): Promise<void>;
|
|
5488
5653
|
exists(documentIds: string[], consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<boolean[]>;
|
|
5489
5654
|
get<TDocument extends PHDocument>(documentId: string, view?: ViewFilter$1, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<TDocument>;
|
|
@@ -5615,6 +5780,8 @@ declare class GqlRequestChannel implements IChannel {
|
|
|
5615
5780
|
private isPushing;
|
|
5616
5781
|
private pendingDrain;
|
|
5617
5782
|
private receivingPages;
|
|
5783
|
+
/** Cleared for good the first time the remote rejects {@link DECISION_FIELDS}. */
|
|
5784
|
+
private peerServesDecisionFields;
|
|
5618
5785
|
private isRecovering;
|
|
5619
5786
|
private connectionState;
|
|
5620
5787
|
/** Latest unrecoverable error was an auth rejection; cleared on connect. */
|
|
@@ -5661,6 +5828,18 @@ declare class GqlRequestChannel implements IChannel {
|
|
|
5661
5828
|
* Queries the remote GraphQL endpoint for sync envelopes.
|
|
5662
5829
|
*/
|
|
5663
5830
|
private pollSyncEnvelopes;
|
|
5831
|
+
/**
|
|
5832
|
+
* True when the remote rejected the query for naming a field it does not
|
|
5833
|
+
* have. Selecting an unknown field fails validation for the whole query, so
|
|
5834
|
+
* an unhandled one takes the channel's polling down until the process
|
|
5835
|
+
* restarts rather than degrading.
|
|
5836
|
+
*/
|
|
5837
|
+
private rejectsDecisionFields;
|
|
5838
|
+
/**
|
|
5839
|
+
* The poll query. `withDecisionFields` selects the two fields added with the
|
|
5840
|
+
* auth projection; a remote on the previous schema is polled without them.
|
|
5841
|
+
*/
|
|
5842
|
+
private pollQuery;
|
|
5664
5843
|
/**
|
|
5665
5844
|
* Registers or updates this channel on the remote server via GraphQL mutation.
|
|
5666
5845
|
* Returns the remote's ack ordinal so the client can trim its outbox.
|
|
@@ -5823,6 +6002,18 @@ declare function batchOperationsByDocument(operations: OperationWithContext$1[])
|
|
|
5823
6002
|
* jobId; all other jobIds are remapped so external dependencies still resolve.
|
|
5824
6003
|
*/
|
|
5825
6004
|
declare function consolidateSyncOperations(syncOps: SyncOperation[]): SyncOperation[];
|
|
6005
|
+
/**
|
|
6006
|
+
* Classifies a failure by error name rather than `instanceof`, because a failure
|
|
6007
|
+
* that crossed the pooled-worker boundary arrives as plain data.
|
|
6008
|
+
*/
|
|
6009
|
+
declare function classifyJobFailure(errorName: string): SyncOperationErrorType;
|
|
6010
|
+
/** The explicit type when something else carried it, else derived by name. */
|
|
6011
|
+
declare function syncOperationErrorType(error: ChannelError | undefined): SyncOperationErrorType;
|
|
6012
|
+
/**
|
|
6013
|
+
* A held auth operation must not quarantine: reconciling the two policies needs
|
|
6014
|
+
* the traffic a quarantine would stop.
|
|
6015
|
+
*/
|
|
6016
|
+
declare function quarantinesDocument(errorType: SyncOperationErrorType): boolean;
|
|
5826
6017
|
//#endregion
|
|
5827
6018
|
//#region src/admin/types.d.ts
|
|
5828
6019
|
type KeyframeValidationIssue = {
|
|
@@ -5838,11 +6029,20 @@ type SnapshotValidationIssue = {
|
|
|
5838
6029
|
snapshotHash: string;
|
|
5839
6030
|
replayedHash: string;
|
|
5840
6031
|
};
|
|
6032
|
+
/** Effective operations whose stored order contradicts their timestamps. */
|
|
6033
|
+
type StreamOrderIssue = {
|
|
6034
|
+
scope: string;
|
|
6035
|
+
branch: string;
|
|
6036
|
+
previous: Operation;
|
|
6037
|
+
current: Operation;
|
|
6038
|
+
kind: OutOfOrderPair["kind"];
|
|
6039
|
+
};
|
|
5841
6040
|
type ValidationResult = {
|
|
5842
6041
|
documentId: string;
|
|
5843
6042
|
isConsistent: boolean;
|
|
5844
6043
|
keyframeIssues: KeyframeValidationIssue[];
|
|
5845
6044
|
snapshotIssues: SnapshotValidationIssue[];
|
|
6045
|
+
streamOrderIssues: StreamOrderIssue[];
|
|
5846
6046
|
};
|
|
5847
6047
|
type RebuildResult = {
|
|
5848
6048
|
documentId: string;
|
|
@@ -5866,6 +6066,7 @@ declare class DocumentIntegrityService implements IDocumentIntegrityService {
|
|
|
5866
6066
|
validateDocument(documentId: string, branch?: string, signal?: AbortSignal): Promise<ValidationResult>;
|
|
5867
6067
|
rebuildKeyframes(documentId: string, branch?: string, signal?: AbortSignal): Promise<RebuildResult>;
|
|
5868
6068
|
rebuildSnapshots(documentId: string, branch?: string, signal?: AbortSignal): Promise<RebuildResult>;
|
|
6069
|
+
private findStreamOrderIssues;
|
|
5869
6070
|
private discoverScopes;
|
|
5870
6071
|
}
|
|
5871
6072
|
//#endregion
|
|
@@ -5914,5 +6115,5 @@ declare class ProcessorManager extends BaseReadModel implements IProcessorManage
|
|
|
5914
6115
|
private deleteProcessorCursors;
|
|
5915
6116
|
}
|
|
5916
6117
|
//#endregion
|
|
5917
|
-
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 };
|
|
6118
|
+
export { APPEND_CONDITION_FAILED_PREFIX, type AbortMessage, type AdmissionDecision, type AppendCondition, AppendConditionFailedError, type AppendConditionStream, type AtomicTxn, type AttachmentHash, type AttachmentRef, type AuthDecisionModel, 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 DocumentDecisionModel, 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, 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 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 ProjectionShardManagerConfig, type ProjectionWorkerFactory, PropagationMode, QueueEventTypes, REACTOR_SCHEMA, Reactor, ReactorBuilder, ReactorClient, ReactorClientBuilder, type ReactorClientModule, ReactorEventTypes, type ReactorFeatureFlags, 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, 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, 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, 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, createMutableShutdownStatus, createRelationalDb, decideAtHead, deleteDocumentAction, documentActions, documentDecisionModel, driveIdFromUrl, envelopesToSyncOperations, errorToInfo, firstOutOfOrderPair, getMigrationStatus, instrumentPgPool, isDriveAuthError, makeConsistencyKey, parseDriveUrl, parsePagingOptions, quarantinesDocument, removeRelationshipAction, runMigrations, sanitizeArg, selectDecisionModel, supportsLiveReadModelRegistration, syncOperationErrorType, trimMailboxFromAckOrdinal, updateRelationshipAction, upgradeDocumentAction, workerEntryPath };
|
|
5918
6119
|
//# sourceMappingURL=index.d.ts.map
|