foldkit-sync 0.7.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +543 -893
- package/dist/entity.d.mts +231 -0
- package/dist/entity.d.mts.map +1 -0
- package/dist/entity.mjs +204 -0
- package/dist/entity.mjs.map +1 -0
- package/dist/index.d.mts +51 -485
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +132 -331
- package/dist/index.mjs.map +1 -1
- package/dist/journal.d.mts +132 -0
- package/dist/journal.d.mts.map +1 -0
- package/dist/journal.mjs +204 -0
- package/dist/journal.mjs.map +1 -0
- package/dist/sync-CP5UGs4r.d.mts +547 -0
- package/dist/sync-CP5UGs4r.d.mts.map +1 -0
- package/dist/transport-hlEQpHIv.mjs +359 -0
- package/dist/transport-hlEQpHIv.mjs.map +1 -0
- package/package.json +25 -8
package/dist/index.d.mts
CHANGED
|
@@ -1,489 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $ as Sequence, A as serveSocket, B as InvalidOutboxError, C as TransportError, D as layerSocket, E as layerLoopback, F as CheckpointRegressionError, G as StorageError, H as ReplayError, I as CommittedOrderError, J as WrongReplicaStorageError, K as UnsupportedClockVersionError, L as ForeignAcknowledgementError, M as OutboxEntry, N as Storage, O as nativeSocket, P as indexedDb, Q as ReplicaId, R as ForeignRejectionError, S as Transport, T as layerFromPromise, U as ReplicaClosedError, V as InvalidReplicaHistoryError, W as ReplicaError, X as LocalSequence, Y as DocumentId, Z as OpId, _ as ExchangeFrame, a as JournalContract, b as SocketLike, c as Replica, d as ReplicaStatus, et as documentId, f as Sync$1, g as syncMetrics, h as defineSync, i as Exchange, it as sequence, j as toPromise, k as portSocket, l as ReplicaSnapshot, m as TransportClient, n as CommitStamp, nt as opId, o as Operation, p as SyncDefinition, q as UnsupportedReplicaVersionError, r as CommittedOperation, rt as replicaId, s as Rejection, t as Checkpoint, tt as localSequence, u as ReplicaState, v as ExchangeReply, w as TransportShape, x as SocketOptions, y as NotifyFrame, z as InvalidExchangeError } from "./sync-CP5UGs4r.mjs";
|
|
2
|
+
import { Duration, Effect, Exit, Layer, PubSub, Schema as Schema$1, Scope, Stream } from "effect";
|
|
2
3
|
import { AppScope, Contract, MergeConstructors, MergeFields, MessageSet, RunnableApplication, Surface, Wiring, WritableProjection } from "foldkit-surface";
|
|
3
4
|
import { UrlRequest } from "foldkit/navigation";
|
|
4
5
|
import { Subscriptions } from "foldkit/subscription";
|
|
5
6
|
import * as Url from "foldkit/url";
|
|
6
7
|
import { Document, HtmlBuilder } from "foldkit/html";
|
|
7
8
|
import * as Update from "foldkit/update";
|
|
8
|
-
//#region src/ids.d.ts
|
|
9
|
-
/** Identifies the replicated document a replica or operation belongs to. */
|
|
10
|
-
export declare const DocumentId: Schema$1.brand<Schema$1.NonEmptyString, "@foldkit-sync/DocumentId">;
|
|
11
|
-
export type DocumentId = typeof DocumentId.Type;
|
|
12
|
-
/** Identifies one replica (writer identity) within a document. */
|
|
13
|
-
export declare const ReplicaId: Schema$1.brand<Schema$1.NonEmptyString, "@foldkit-sync/ReplicaId">;
|
|
14
|
-
export type ReplicaId = typeof ReplicaId.Type;
|
|
15
|
-
/** The stable identity of one operation within a document. */
|
|
16
|
-
export declare const OpId: Schema$1.brand<Schema$1.NonEmptyString, "@foldkit-sync/OpId">;
|
|
17
|
-
export type OpId = typeof OpId.Type;
|
|
18
|
-
/**
|
|
19
|
-
* A position in the committed document order. `0` is the start; a committed
|
|
20
|
-
* operation's `serverSequence` and a replica's `cursor` are the same family.
|
|
21
|
-
*/
|
|
22
|
-
export declare const Sequence: Schema$1.brand<Schema$1.Number, "@foldkit-sync/Sequence">;
|
|
23
|
-
export type Sequence = typeof Sequence.Type;
|
|
24
|
-
/** A replica's own operation counter within a document; 1-based. */
|
|
25
|
-
export declare const LocalSequence: Schema$1.brand<Schema$1.Number, "@foldkit-sync/LocalSequence">;
|
|
26
|
-
export type LocalSequence = typeof LocalSequence.Type;
|
|
27
|
-
/**
|
|
28
|
-
* Decode-and-brand helpers. A branded schema constructs the same value with
|
|
29
|
-
* `DocumentId.make('todos')`, which is the spelling to lead with; these stay
|
|
30
|
-
* for callers that already have them.
|
|
31
|
-
*/
|
|
32
|
-
export declare const documentId: (value: string) => DocumentId;
|
|
33
|
-
export declare const replicaId: (value: string) => ReplicaId;
|
|
34
|
-
export declare const opId: (value: string) => OpId;
|
|
35
|
-
export declare const sequence: (value: number) => Sequence;
|
|
36
|
-
export declare const localSequence: (value: number) => LocalSequence;
|
|
37
|
-
//#endregion
|
|
38
|
-
//#region src/errors.d.ts
|
|
39
|
-
declare const StorageError_base: Schema$1.Class<StorageError, Schema$1.TaggedStruct<"StorageError", {
|
|
40
|
-
readonly message: Schema$1.String;
|
|
41
|
-
readonly cause: Schema$1.optional<Schema$1.Unknown>;
|
|
42
|
-
}>, import("effect/Cause").YieldableError>;
|
|
43
|
-
/** The persisted storage could not be read or written. */
|
|
44
|
-
export declare class StorageError extends StorageError_base {}
|
|
45
|
-
declare const UnsupportedClockVersionError_base: Schema$1.Class<UnsupportedClockVersionError, Schema$1.TaggedStruct<"UnsupportedClockVersionError", {
|
|
46
|
-
readonly schemaVersion: Schema$1.NullOr<Schema$1.Number>;
|
|
47
|
-
readonly message: Schema$1.String;
|
|
48
|
-
}>, import("effect/Cause").YieldableError>;
|
|
49
|
-
/** The stored clock state targets a schema version this build does not support. */
|
|
50
|
-
export declare class UnsupportedClockVersionError extends UnsupportedClockVersionError_base {}
|
|
51
|
-
declare const WrongReplicaStorageError_base: Schema$1.Class<WrongReplicaStorageError, Schema$1.TaggedStruct<"WrongReplicaStorageError", {
|
|
52
|
-
readonly documentId: Schema$1.String;
|
|
53
|
-
readonly replicaId: Schema$1.String;
|
|
54
|
-
readonly message: Schema$1.String;
|
|
55
|
-
}>, import("effect/Cause").YieldableError>;
|
|
56
|
-
/** The storage holds a different replica's state. */
|
|
57
|
-
export declare class WrongReplicaStorageError extends WrongReplicaStorageError_base {}
|
|
58
|
-
declare const InvalidReplicaHistoryError_base: Schema$1.Class<InvalidReplicaHistoryError, Schema$1.TaggedStruct<"InvalidReplicaHistoryError", {
|
|
59
|
-
readonly message: Schema$1.String;
|
|
60
|
-
readonly cause: Schema$1.optional<Schema$1.Unknown>;
|
|
61
|
-
}>, import("effect/Cause").YieldableError>;
|
|
62
|
-
/** The persisted replica history is internally inconsistent. */
|
|
63
|
-
export declare class InvalidReplicaHistoryError extends InvalidReplicaHistoryError_base {}
|
|
64
|
-
declare const InvalidExchangeError_base: Schema$1.Class<InvalidExchangeError, Schema$1.TaggedStruct<"InvalidExchangeError", {
|
|
65
|
-
readonly message: Schema$1.String;
|
|
66
|
-
readonly cause: Schema$1.optional<Schema$1.Unknown>;
|
|
67
|
-
}>, import("effect/Cause").YieldableError>;
|
|
68
|
-
/** The server's exchange response did not match the protocol schema. */
|
|
69
|
-
export declare class InvalidExchangeError extends InvalidExchangeError_base {}
|
|
70
|
-
declare const InvalidOutboxError_base: Schema$1.Class<InvalidOutboxError, Schema$1.TaggedStruct<"InvalidOutboxError", {
|
|
71
|
-
readonly message: Schema$1.String;
|
|
72
|
-
}>, import("effect/Cause").YieldableError>;
|
|
73
|
-
/** A persisted pending operation could not have been produced by this replica. */
|
|
74
|
-
export declare class InvalidOutboxError extends InvalidOutboxError_base {}
|
|
75
|
-
declare const CheckpointRegressionError_base: Schema$1.Class<CheckpointRegressionError, Schema$1.TaggedStruct<"CheckpointRegressionError", {
|
|
76
|
-
readonly cursor: Schema$1.Number;
|
|
77
|
-
readonly checkpointCursor: Schema$1.Number;
|
|
78
|
-
readonly message: Schema$1.String;
|
|
79
|
-
}>, import("effect/Cause").YieldableError>;
|
|
80
|
-
/** The server sent a checkpoint older than the replica's cursor. */
|
|
81
|
-
export declare class CheckpointRegressionError extends CheckpointRegressionError_base {}
|
|
82
|
-
declare const CommittedOrderError_base: Schema$1.Class<CommittedOrderError, Schema$1.TaggedStruct<"CommittedOrderError", {
|
|
83
|
-
readonly expected: Schema$1.Number;
|
|
84
|
-
readonly actual: Schema$1.Number;
|
|
85
|
-
readonly message: Schema$1.String;
|
|
86
|
-
}>, import("effect/Cause").YieldableError>;
|
|
87
|
-
/** Committed operations were not contiguous from the replica's cursor. */
|
|
88
|
-
export declare class CommittedOrderError extends CommittedOrderError_base {}
|
|
89
|
-
declare const ForeignRejectionError_base: Schema$1.Class<ForeignRejectionError, Schema$1.TaggedStruct<"ForeignRejectionError", {
|
|
90
|
-
readonly opId: Schema$1.String;
|
|
91
|
-
readonly message: Schema$1.String;
|
|
92
|
-
}>, import("effect/Cause").YieldableError>;
|
|
93
|
-
/** The server rejected an operation the replica never sent. */
|
|
94
|
-
export declare class ForeignRejectionError extends ForeignRejectionError_base {}
|
|
95
|
-
declare const ForeignAcknowledgementError_base: Schema$1.Class<ForeignAcknowledgementError, Schema$1.TaggedStruct<"ForeignAcknowledgementError", {
|
|
96
|
-
readonly opId: Schema$1.String;
|
|
97
|
-
readonly message: Schema$1.String;
|
|
98
|
-
}>, import("effect/Cause").YieldableError>;
|
|
99
|
-
/**
|
|
100
|
-
* The server answered an operation this request never sent, or both
|
|
101
|
-
* acknowledged and rejected it. Acting on either would let a faulty or hostile
|
|
102
|
-
* server delete local work.
|
|
103
|
-
*/
|
|
104
|
-
export declare class ForeignAcknowledgementError extends ForeignAcknowledgementError_base {}
|
|
105
|
-
declare const ReplicaClosedError_base: Schema$1.Class<ReplicaClosedError, Schema$1.TaggedStruct<"ReplicaClosedError", {
|
|
106
|
-
readonly message: Schema$1.String;
|
|
107
|
-
}>, import("effect/Cause").YieldableError>;
|
|
108
|
-
/** The replica was closed while work was still being submitted. */
|
|
109
|
-
export declare class ReplicaClosedError extends ReplicaClosedError_base {}
|
|
110
|
-
declare const UnsupportedReplicaVersionError_base: Schema$1.Class<UnsupportedReplicaVersionError, Schema$1.TaggedStruct<"UnsupportedReplicaVersionError", {
|
|
111
|
-
readonly protocolVersion: Schema$1.NullOr<Schema$1.Number>;
|
|
112
|
-
readonly schemaVersion: Schema$1.NullOr<Schema$1.Number>;
|
|
113
|
-
readonly message: Schema$1.String;
|
|
114
|
-
}>, import("effect/Cause").YieldableError>;
|
|
115
|
-
/** The stored replica state targets a protocol or schema version this build does not support. */
|
|
116
|
-
export declare class UnsupportedReplicaVersionError extends UnsupportedReplicaVersionError_base {}
|
|
117
|
-
declare const ReplayError_base: Schema$1.Class<ReplayError, Schema$1.TaggedStruct<"ReplayError", {
|
|
118
|
-
readonly message: Schema$1.String;
|
|
119
|
-
readonly cause: Schema$1.optional<Schema$1.Unknown>;
|
|
120
|
-
}>, import("effect/Cause").YieldableError>;
|
|
121
|
-
/**
|
|
122
|
-
* `replay` threw for a submitted Message, so it could never be applied here or
|
|
123
|
-
* on any other replica; nothing was written.
|
|
124
|
-
*/
|
|
125
|
-
export declare class ReplayError extends ReplayError_base {}
|
|
126
|
-
type ReplicaError = StorageError | ReplayError | WrongReplicaStorageError | InvalidReplicaHistoryError | InvalidExchangeError | UnsupportedReplicaVersionError | InvalidOutboxError | CheckpointRegressionError | CommittedOrderError | ForeignRejectionError | ForeignAcknowledgementError | ReplicaClosedError;
|
|
127
|
-
//#endregion
|
|
128
|
-
//#region src/indexedDb.d.ts
|
|
129
|
-
/** One submitted operation, as `Storage.append` records it. */
|
|
130
|
-
interface OutboxEntry {
|
|
131
|
-
/** The replica's revision once this operation is in its outbox. */
|
|
132
|
-
readonly revision: number;
|
|
133
|
-
readonly nextLocalSequence: number;
|
|
134
|
-
/**
|
|
135
|
-
* The operation's local sequence. An entry with the sequence of one already in the
|
|
136
|
-
* outbox replaces it: a coalesced submit rewrites the last operation.
|
|
137
|
-
*/
|
|
138
|
-
readonly localSequence: number;
|
|
139
|
-
/** The operation, encoded. */
|
|
140
|
-
readonly operation: unknown;
|
|
141
|
-
}
|
|
142
|
-
/** Persists a replica's state with compare-and-swap on its revision. */
|
|
143
|
-
interface Storage {
|
|
144
|
-
/**
|
|
145
|
-
* The saved state, with every operation appended since in its `pending` (replacing the
|
|
146
|
-
* one of the same local sequence), and the last one's `revision` and `nextLocalSequence`.
|
|
147
|
-
*/
|
|
148
|
-
load: () => Effect.Effect<unknown, StorageError>;
|
|
149
|
-
/** Replaces the whole state, and with it every appended operation. */
|
|
150
|
-
save: (state: unknown, expectedRevision: number | null) => Effect.Effect<void, StorageError>;
|
|
151
|
-
/**
|
|
152
|
-
* Optional. Records one submitted operation without rewriting the rest of the state, so
|
|
153
|
-
* a submit costs the operation's size rather than the document's. Without it, a submit
|
|
154
|
-
* saves the whole state.
|
|
155
|
-
*/
|
|
156
|
-
append?: (entry: OutboxEntry, expectedRevision: number) => Effect.Effect<void, StorageError>;
|
|
157
|
-
/** Idempotent; the caller closes the connection explicitly. */
|
|
158
|
-
close: Effect.Effect<void>;
|
|
159
|
-
}
|
|
160
|
-
/** One database per document/replica; CAS prevents two tabs from sharing a writer identity. */
|
|
161
|
-
export declare const indexedDb: (name: string | Config.Config<string>, factory?: IDBFactory | undefined) => Effect.Effect<Required<Storage>, StorageError, import("effect/Scope").Scope>;
|
|
162
|
-
//#endregion
|
|
163
|
-
//#region src/transport.d.ts
|
|
164
|
-
declare const TransportError_base: Schema$1.Class<TransportError, Schema$1.TaggedStruct<"SyncTransportError", {
|
|
165
|
-
readonly message: Schema$1.String;
|
|
166
|
-
}>, import("effect/Cause").YieldableError>;
|
|
167
|
-
/** The wire failure of a transport. A refusal is a result, not an error. */
|
|
168
|
-
export declare class TransportError extends TransportError_base {}
|
|
169
|
-
/** One request/response frame, as it crosses a wire. */
|
|
170
|
-
interface ExchangeFrame {
|
|
171
|
-
readonly id: string;
|
|
172
|
-
readonly cursor: number;
|
|
173
|
-
readonly pending: ReadonlyArray<Operation>;
|
|
174
|
-
readonly epoch?: string | undefined;
|
|
175
|
-
}
|
|
176
|
-
interface ExchangeReply {
|
|
177
|
-
readonly id: string;
|
|
178
|
-
readonly result?: unknown;
|
|
179
|
-
readonly error?: string;
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Sent by a server, unasked, when the document may have changed. It carries no
|
|
183
|
-
* data: the replica exchanges from its own cursor, so a notice that is lost,
|
|
184
|
-
* late, or one of many is harmless.
|
|
185
|
-
*/
|
|
186
|
-
interface NotifyFrame {
|
|
187
|
-
readonly notify: true;
|
|
188
|
-
}
|
|
189
|
-
interface TransportShape {
|
|
190
|
-
/** `epoch` is the server history the replica's cursor points into, when it knows one. */
|
|
191
|
-
readonly exchange: (cursor: number, pending: ReadonlyArray<Operation>, epoch?: string | undefined) => Effect.Effect<unknown, TransportError>;
|
|
192
|
-
/**
|
|
193
|
-
* Emits when the server may have something new, for a transport that can hear
|
|
194
|
-
* it: `Replica.start` exchanges on each. A wake-up, not data.
|
|
195
|
-
*/
|
|
196
|
-
readonly changes?: Stream.Stream<void> | undefined;
|
|
197
|
-
/**
|
|
198
|
-
* The connection itself, for another protocol to share, such as presence: a send goes to
|
|
199
|
-
* the socket open now and is dropped while none is, and messages from every socket the
|
|
200
|
-
* transport opens arrive here. It is the transport's to close.
|
|
201
|
-
*/
|
|
202
|
-
readonly socket?: SocketLike | undefined;
|
|
203
|
-
}
|
|
204
|
-
declare const Transport_base: Context.ServiceClass<Transport, "foldkit-sync/Transport", TransportShape>;
|
|
205
|
-
/**
|
|
206
|
-
* The seam the replica syncs through.
|
|
207
|
-
*
|
|
208
|
-
* A service, not a concrete client, so an application substitutes an in-process
|
|
209
|
-
* transport, a socket, or a test double without the replica knowing. A refusal
|
|
210
|
-
* arrives in the exchange result; only a wire failure is a `TransportError`.
|
|
211
|
-
*/
|
|
212
|
-
export declare class Transport extends Transport_base {}
|
|
213
|
-
/** A transport backed by an in-process handler, for tests and single-process demos. */
|
|
214
|
-
export declare const layerLoopback: (handler: (cursor: number, pending: ReadonlyArray<Operation>, epoch?: string | undefined) => unknown | Promise<unknown>) => Layer.Layer<Transport>;
|
|
215
|
-
/** Wraps the promise-based client the replica already speaks. */
|
|
216
|
-
export declare const layerFromPromise: (transport: TransportClient) => Layer.Layer<Transport>;
|
|
217
|
-
/** Bridges the service back to the promise client the replica consumes. */
|
|
218
|
-
export declare const toPromise: (transport: TransportShape) => TransportClient;
|
|
219
|
-
/**
|
|
220
|
-
* Serves one accepted socket, answering each exchange frame.
|
|
221
|
-
*
|
|
222
|
-
* The counterpart to `layerSocket`: the handler returns the exchange result, or
|
|
223
|
-
* throws and the failure is written back as an error frame. With `changes`, a
|
|
224
|
-
* subscription to the document's commits, the socket is also sent a
|
|
225
|
-
* `NotifyFrame` after each, so a client hears of others' edits without polling.
|
|
226
|
-
* Returns a function that stops serving.
|
|
227
|
-
*/
|
|
228
|
-
export declare const serveSocket: (socket: SocketLike, options: {
|
|
229
|
-
readonly exchange: (cursor: number, pending: ReadonlyArray<Operation>, epoch?: string | undefined) => unknown | Promise<unknown>;
|
|
230
|
-
/** Subscribes to the document's commits; returns the unsubscribe. */
|
|
231
|
-
readonly changes?: ((listener: () => void) => () => void) | undefined;
|
|
232
|
-
}) => (() => void);
|
|
233
|
-
/** The minimal socket the layer needs; the global `WebSocket` satisfies it. */
|
|
234
|
-
interface SocketLike {
|
|
235
|
-
send(data: string): void;
|
|
236
|
-
close(): void;
|
|
237
|
-
onMessage(listener: (data: string) => void): () => void;
|
|
238
|
-
onClose(listener: () => void): () => void;
|
|
239
|
-
/**
|
|
240
|
-
* Optional. When provided, exchanges wait for it before sending, so a
|
|
241
|
-
* transport can connect asynchronously. Absent means already connected.
|
|
242
|
-
*/
|
|
243
|
-
onOpen?(listener: () => void): () => void;
|
|
244
|
-
}
|
|
245
|
-
interface SocketOptions {
|
|
246
|
-
readonly url: string;
|
|
247
|
-
/** Injectable for tests; defaults to the platform `WebSocket`. */
|
|
248
|
-
readonly makeSocket?: ((url: string) => SocketLike) | undefined;
|
|
249
|
-
/**
|
|
250
|
-
* Consecutive failed connections after which queued work fails and new
|
|
251
|
-
* exchanges fail fast until a connection is healthy again. Reconnecting goes
|
|
252
|
-
* on regardless. Default 5.
|
|
253
|
-
*/
|
|
254
|
-
readonly maxRetries?: number | undefined;
|
|
255
|
-
/** Base delay of the exponential reconnect backoff. Default `50 millis`. */
|
|
256
|
-
readonly retryBase?: Duration.Input | undefined;
|
|
257
|
-
/** Longest wait between reconnect attempts. Default `5 seconds`. */
|
|
258
|
-
readonly maxRetryDelay?: Duration.Input | undefined;
|
|
259
|
-
/** Exchanges queued or in flight before new ones fail. Default 64. */
|
|
260
|
-
readonly maxQueue?: number | undefined;
|
|
261
|
-
}
|
|
262
|
-
/** The default socket factory: the platform `WebSocket`, as a `SocketLike`. */
|
|
263
|
-
export declare const nativeSocket: (url: string) => SocketLike;
|
|
264
|
-
/**
|
|
265
|
-
* A WebSocket client transport.
|
|
266
|
-
*
|
|
267
|
-
* One connection is live at a time. While it is connecting, exchanges queue; if
|
|
268
|
-
* it closes, the transport reconnects on an exponential, jittered backoff and
|
|
269
|
-
* re-sends every queued and in-flight frame with its original id, so a lost
|
|
270
|
-
* reply is answered rather than dropped and a late reply cannot resolve a newer
|
|
271
|
-
* frame. It never stops reconnecting: after `maxRetries` consecutive failures
|
|
272
|
-
* queued work fails with a `TransportError`, and exchanges fail fast while no
|
|
273
|
-
* socket is up, until a socket opens. The count resets only when a connection
|
|
274
|
-
* proves healthy, by answering a frame or by staying open for `maxRetryDelay`:
|
|
275
|
-
* a server that accepts a socket and drops it at once is backed off like one
|
|
276
|
-
* that refuses it. A queue over `maxQueue` fails new
|
|
277
|
-
* exchanges with backpressure. The socket is released when the layer's scope
|
|
278
|
-
* ends.
|
|
279
|
-
*/
|
|
280
|
-
export declare const layerSocket: (options: SocketOptions) => Layer.Layer<Transport, TransportError>;
|
|
281
|
-
//#endregion
|
|
282
|
-
//#region src/sync.d.ts
|
|
283
|
-
/** Wire and persisted-format versions. A bump must handle the older value explicitly. */
|
|
284
|
-
declare const PROTOCOL_VERSION = 1;
|
|
285
|
-
declare const SCHEMA_VERSION = 1;
|
|
286
|
-
/** A client-authored operation envelope. `message` is the application's encoded Message. */
|
|
287
|
-
declare const OperationSchema: Schema$1.Struct<{
|
|
288
|
-
readonly protocolVersion: Schema$1.Literal<1>;
|
|
289
|
-
readonly schemaVersion: Schema$1.Literal<1>;
|
|
290
|
-
readonly documentId: Schema$1.brand<Schema$1.NonEmptyString, "@foldkit-sync/DocumentId">;
|
|
291
|
-
readonly replicaId: Schema$1.brand<Schema$1.NonEmptyString, "@foldkit-sync/ReplicaId">;
|
|
292
|
-
readonly localSequence: Schema$1.brand<Schema$1.Number, "@foldkit-sync/LocalSequence">;
|
|
293
|
-
readonly opId: Schema$1.brand<Schema$1.NonEmptyString, "@foldkit-sync/OpId">;
|
|
294
|
-
readonly baseCursor: Schema$1.brand<Schema$1.Number, "@foldkit-sync/Sequence">;
|
|
295
|
-
readonly message: Schema$1.Unknown;
|
|
296
|
-
}>;
|
|
297
|
-
type Operation = typeof OperationSchema.Type;
|
|
298
|
-
/** An operation the server committed, with its authoritative order and actor. */
|
|
299
|
-
declare const CommittedSchema: Schema$1.Struct<{
|
|
300
|
-
readonly serverSequence: Schema$1.brand<Schema$1.Number, "@foldkit-sync/Sequence">;
|
|
301
|
-
readonly actorId: Schema$1.NonEmptyString;
|
|
302
|
-
readonly protocolVersion: Schema$1.Literal<1>;
|
|
303
|
-
readonly schemaVersion: Schema$1.Literal<1>;
|
|
304
|
-
readonly documentId: Schema$1.brand<Schema$1.NonEmptyString, "@foldkit-sync/DocumentId">;
|
|
305
|
-
readonly replicaId: Schema$1.brand<Schema$1.NonEmptyString, "@foldkit-sync/ReplicaId">;
|
|
306
|
-
readonly localSequence: Schema$1.brand<Schema$1.Number, "@foldkit-sync/LocalSequence">;
|
|
307
|
-
readonly opId: Schema$1.brand<Schema$1.NonEmptyString, "@foldkit-sync/OpId">;
|
|
308
|
-
readonly baseCursor: Schema$1.brand<Schema$1.Number, "@foldkit-sync/Sequence">;
|
|
309
|
-
readonly message: Schema$1.Unknown;
|
|
310
|
-
}>;
|
|
311
|
-
/** Named to avoid colliding with `foldkit-durable`'s `Committed`. */
|
|
312
|
-
type CommittedOperation = typeof CommittedSchema.Type;
|
|
313
|
-
/** Counters and a histogram an application can scrape. */
|
|
314
|
-
export declare const syncMetrics: {
|
|
315
|
-
exchanges: Metric.Counter<number>;
|
|
316
|
-
applied: Metric.Counter<number>;
|
|
317
|
-
checkpoints: Metric.Counter<number>;
|
|
318
|
-
exchangePending: Metric.Histogram<number>;
|
|
319
|
-
};
|
|
320
|
-
interface Checkpoint<Shared> {
|
|
321
|
-
readonly cursor: Sequence;
|
|
322
|
-
readonly model: Shared;
|
|
323
|
-
}
|
|
324
|
-
interface Exchange<Shared> {
|
|
325
|
-
/** Server-committed operations as they arrived; validated against `CommittedOperation` on adoption. */
|
|
326
|
-
readonly operations: ReadonlyArray<unknown>;
|
|
327
|
-
readonly rejected: ReadonlyArray<OpId>;
|
|
328
|
-
/** Sends from the request that are durably committed, so the replica can drop them. */
|
|
329
|
-
readonly acknowledged?: ReadonlyArray<OpId> | undefined;
|
|
330
|
-
/** The snapshot a replica predating compaction adopts in place of the log. */
|
|
331
|
-
readonly checkpoint?: Checkpoint<Shared> | undefined;
|
|
332
|
-
/** The server sent only part of what is after the cursor; the replica asks again. */
|
|
333
|
-
readonly more?: boolean | undefined;
|
|
334
|
-
/**
|
|
335
|
-
* The identity of the server's history. The replica sends back the one it last saw; a
|
|
336
|
-
* server that finds another answers from the start of its own history, and the replica,
|
|
337
|
-
* seeing a new epoch, rebuilds its committed state from that answer and keeps its outbox.
|
|
338
|
-
*/
|
|
339
|
-
readonly epoch?: string | undefined;
|
|
340
|
-
}
|
|
341
|
-
interface ReplicaState<Shared> {
|
|
342
|
-
readonly protocolVersion: typeof PROTOCOL_VERSION;
|
|
343
|
-
readonly schemaVersion: typeof SCHEMA_VERSION;
|
|
344
|
-
readonly documentId: DocumentId;
|
|
345
|
-
readonly replicaId: ReplicaId;
|
|
346
|
-
readonly revision: number;
|
|
347
|
-
readonly nextLocalSequence: LocalSequence;
|
|
348
|
-
readonly cursor: Sequence;
|
|
349
|
-
readonly committed: Shared;
|
|
350
|
-
readonly committedIds: ReadonlyArray<string>;
|
|
351
|
-
readonly pending: ReadonlyArray<Operation>;
|
|
352
|
-
/** The server history `cursor` points into, once an exchange has named one. */
|
|
353
|
-
readonly epoch?: string;
|
|
354
|
-
}
|
|
355
|
-
/**
|
|
356
|
-
* What the promise-based edge adapter consumes; the Effect `Transport` service
|
|
357
|
-
* is the primary seam.
|
|
358
|
-
*/
|
|
359
|
-
interface TransportClient {
|
|
360
|
-
/** `epoch` is the server history the replica's cursor points into, when it knows one. */
|
|
361
|
-
exchange(cursor: Sequence, pending: ReadonlyArray<Operation>, epoch?: string | undefined): Promise<unknown>;
|
|
362
|
-
}
|
|
363
|
-
/** A redacted view of a replica's state, for a UI to explain and recover. */
|
|
364
|
-
interface ReplicaStatus {
|
|
365
|
-
readonly pending: number;
|
|
366
|
-
readonly cursor: Sequence;
|
|
367
|
-
/** The last exchange failure, cleared by a successful exchange. */
|
|
368
|
-
readonly lastError: string | undefined;
|
|
369
|
-
/** Operations the server refused, most recent first. */
|
|
370
|
-
readonly rejected: ReadonlyArray<OpId>;
|
|
371
|
-
}
|
|
372
|
-
/**
|
|
373
|
-
* A consistent status and optimistic-shared pair, read from one replica state.
|
|
374
|
-
* `Replica.changes` emits it so a UI can hold a single subscription.
|
|
375
|
-
*/
|
|
376
|
-
interface ReplicaSnapshot<Shared> {
|
|
377
|
-
readonly status: ReplicaStatus;
|
|
378
|
-
readonly shared: Shared;
|
|
379
|
-
/** The server-confirmed state the optimistic `shared` is built on. */
|
|
380
|
-
readonly committed: Shared;
|
|
381
|
-
/**
|
|
382
|
-
* The local sequence the next submitted operation takes. Only a successful
|
|
383
|
-
* submit moves it, so a caller that submits one Message at a time can tell
|
|
384
|
-
* from one snapshot whether `shared` already holds it.
|
|
385
|
-
*/
|
|
386
|
-
readonly nextLocalSequence: LocalSequence;
|
|
387
|
-
}
|
|
388
|
-
interface Replica<Message, Shared> {
|
|
389
|
-
/** The optimistic projection: committed state with pending operations replayed. */
|
|
390
|
-
readonly shared: Effect.Effect<Shared>;
|
|
391
|
-
/**
|
|
392
|
-
* The server-confirmed state through `cursor`, with no pending operation
|
|
393
|
-
* applied. A pending edit reaches it only once the server commits it, and a
|
|
394
|
-
* rejected one never does.
|
|
395
|
-
*/
|
|
396
|
-
readonly committed: Effect.Effect<Shared>;
|
|
397
|
-
readonly pending: Effect.Effect<ReadonlyArray<Operation>>;
|
|
398
|
-
readonly cursor: Effect.Effect<Sequence>;
|
|
399
|
-
/**
|
|
400
|
-
* Waiting/recovery information without exposing Messages or the Model. It is a
|
|
401
|
-
* snapshot; `statusChanges` re-emits it after every submit and exchange.
|
|
402
|
-
*/
|
|
403
|
-
readonly status: Effect.Effect<ReplicaStatus>;
|
|
404
|
-
/** The status, re-emitted after every submit and exchange. */
|
|
405
|
-
readonly statusChanges: Stream.Stream<ReplicaStatus>;
|
|
406
|
-
/**
|
|
407
|
-
* The status and the optimistic shared value together, re-emitted after every
|
|
408
|
-
* submit and exchange, so a UI can subscribe once instead of to both.
|
|
409
|
-
*/
|
|
410
|
-
readonly changes: Stream.Stream<ReplicaSnapshot<Shared>>;
|
|
411
|
-
/** The status, `shared`, `committed` and next local sequence, read from one replica state. */
|
|
412
|
-
readonly snapshot: Effect.Effect<ReplicaSnapshot<Shared>>;
|
|
413
|
-
readonly submit: (message: Message) => Effect.Effect<void, ReplicaError>;
|
|
414
|
-
/** Reconciles against the server. The `Transport` service must be provided. */
|
|
415
|
-
readonly synchronize: Effect.Effect<void, ReplicaError | TransportError, Transport>;
|
|
416
|
-
/**
|
|
417
|
-
* The exchange loop: exchanges once, then after every `submit` and every
|
|
418
|
-
* notice on the transport's `changes`, until the replica closes or the fiber
|
|
419
|
-
* is interrupted. A failed exchange is recorded
|
|
420
|
-
* in `status.lastError` and retried on a backoff (from 0.5 s, doubling up to
|
|
421
|
-
* 30 s), or at once on the next `submit`, so the fiber never fails. Fork it
|
|
422
|
-
* with `Effect.forkScoped` and provide `Transport`.
|
|
423
|
-
*/
|
|
424
|
-
readonly start: Effect.Effect<void, never, Transport>;
|
|
425
|
-
readonly close: Effect.Effect<void>;
|
|
426
|
-
}
|
|
427
|
-
interface SyncDefinition<Message, Shared, MessageEncoded, SharedEncoded> {
|
|
428
|
-
readonly documentId: DocumentId;
|
|
429
|
-
readonly message: Schema$1.Codec<Message, MessageEncoded, never, never>;
|
|
430
|
-
readonly shared: Schema$1.Codec<Shared, SharedEncoded, never, never>;
|
|
431
|
-
readonly empty: Shared;
|
|
432
|
-
readonly durable: (message: Message) => boolean;
|
|
433
|
-
readonly replay: (shared: Shared, message: Message) => Shared;
|
|
434
|
-
/**
|
|
435
|
-
* Optional. Merges a durable Message into the one submitted before it, while that one
|
|
436
|
-
* has not been sent: one operation instead of two, for a burst of typing. Replaying the
|
|
437
|
-
* result must equal replaying `last` then `next`. Undefined keeps them apart.
|
|
438
|
-
*/
|
|
439
|
-
readonly coalesce?: ((last: Message, next: Message) => Message | undefined) | undefined;
|
|
440
|
-
}
|
|
441
|
-
interface Sync$1<Message, Shared> {
|
|
442
|
-
readonly documentId: DocumentId;
|
|
443
|
-
/** Whether a Message is one the replica records and replays. */
|
|
444
|
-
readonly durable: (message: Message) => boolean;
|
|
445
|
-
/**
|
|
446
|
-
* Low-level wire codecs for adapters and the transport. Most applications use
|
|
447
|
-
* `journalContract` and `openReplica`; these are exposed for a custom
|
|
448
|
-
* transport or a server that must speak the operation envelope directly.
|
|
449
|
-
*/
|
|
450
|
-
readonly codec: {
|
|
451
|
-
readonly normalizeOperation: (input: unknown) => Operation;
|
|
452
|
-
readonly operationFrom: (input: unknown, documentId: DocumentId) => Operation;
|
|
453
|
-
readonly committedFrom: (input: unknown, documentId: DocumentId) => CommittedOperation;
|
|
454
|
-
readonly decodeExchange: (input: unknown) => Exchange<Shared>;
|
|
455
|
-
};
|
|
456
|
-
/** The codecs and pure reducer `foldkit-durable`'s `makeJournal` consumes. */
|
|
457
|
-
readonly journalContract: () => JournalContract<Operation, Shared>;
|
|
458
|
-
readonly openReplica: (replicaId: ReplicaId, storage: Storage) => Effect.Effect<Replica<Message, Shared>, ReplicaError>;
|
|
459
|
-
}
|
|
460
|
-
/** Structural match for `foldkit-durable`'s journal options; Sync stays independent. */
|
|
461
|
-
interface JournalContract<Operation, Shared> {
|
|
462
|
-
/** The replica each operation came from, which Durable binds to its first committer. */
|
|
463
|
-
readonly replicaId: (operation: Operation) => string;
|
|
464
|
-
/** Sync's operation id includes the replica, even after Durable compacts its payload. */
|
|
465
|
-
readonly legacyReplicaId: (opId: string) => string;
|
|
466
|
-
readonly operation: {
|
|
467
|
-
/** Operations are stored in their encoded form, so this is the identity. */
|
|
468
|
-
readonly encode: (operation: Operation) => Operation;
|
|
469
|
-
readonly decode: (input: unknown) => Operation;
|
|
470
|
-
};
|
|
471
|
-
readonly snapshot: {
|
|
472
|
-
readonly encode: (snapshot: Shared) => unknown;
|
|
473
|
-
readonly decode: (input: unknown) => Shared;
|
|
474
|
-
};
|
|
475
|
-
readonly empty: () => Shared;
|
|
476
|
-
readonly reduce: (snapshot: Shared, operation: Operation) => Shared;
|
|
477
|
-
}
|
|
478
|
-
/**
|
|
479
|
-
* Binds the replicated-state protocol to one application contract.
|
|
480
|
-
*
|
|
481
|
-
* The returned codecs decide what is a valid operation and what the shared
|
|
482
|
-
* projection means; the replica owns the local outbox, optimistic projection,
|
|
483
|
-
* and reconciliation as Effects, and never runs a second reducer.
|
|
484
|
-
*/
|
|
485
|
-
export declare const defineSync: <Message, Shared, MessageEncoded, SharedEncoded>(definition: SyncDefinition<Message, Shared, MessageEncoded, SharedEncoded>) => Sync$1<Message, Shared>;
|
|
486
|
-
//#endregion
|
|
487
9
|
//#region src/make.d.ts
|
|
488
10
|
type MessageConstructor<Message> = (...args: never[]) => Message;
|
|
489
11
|
/** The Message union a tuple of constructors produces. */
|
|
@@ -502,8 +24,16 @@ interface PolicyJournalContract<Operation, Shared, Principal> extends JournalCon
|
|
|
502
24
|
readonly principal: Principal;
|
|
503
25
|
readonly operation: Operation;
|
|
504
26
|
readonly snapshot: Shared;
|
|
505
|
-
}) =>
|
|
27
|
+
}) => AuthorizeDecision;
|
|
506
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* What a rule decides: allowed, refused, or refused with a reason the server
|
|
31
|
+
* sends to the person whose edit it was. The shape of Durable's own decision.
|
|
32
|
+
*/
|
|
33
|
+
type AuthorizeDecision = boolean | {
|
|
34
|
+
readonly allowed: false;
|
|
35
|
+
readonly reason: string;
|
|
36
|
+
};
|
|
507
37
|
/** What a per-variant `authorize` rule sees before the journal commits. */
|
|
508
38
|
interface AuthorizeRequest<Principal, Message, Shared> {
|
|
509
39
|
readonly principal: Principal;
|
|
@@ -517,7 +47,17 @@ interface AuthorizeRequest<Principal, Message, Shared> {
|
|
|
517
47
|
*/
|
|
518
48
|
type AuthorizePolicy<Principal, Fields extends Schema$1.Struct.Fields, Ms extends readonly unknown[]> = { readonly [K in TagOf<Ms[number]>]?: (request: AuthorizeRequest<Principal, Extract<MsgOf<Ms>, {
|
|
519
49
|
readonly _tag: K;
|
|
520
|
-
}>, Schema$1.Struct.Type<Fields>>) =>
|
|
50
|
+
}>, Schema$1.Struct.Type<Fields>>) => AuthorizeDecision; };
|
|
51
|
+
/**
|
|
52
|
+
* Per-variant commit stamps, keyed by durable tag: each writes what the server's commit
|
|
53
|
+
* decided (its sequence, its actor) into that variant, and returns the same variant. A
|
|
54
|
+
* variant without one is committed as sent.
|
|
55
|
+
*/
|
|
56
|
+
type StampPolicy<Ms extends readonly unknown[]> = { readonly [K in TagOf<Ms[number]>]?: (message: Extract<MsgOf<Ms>, {
|
|
57
|
+
readonly _tag: K;
|
|
58
|
+
}>, commit: CommitStamp) => Extract<MsgOf<Ms>, {
|
|
59
|
+
readonly _tag: K;
|
|
60
|
+
}>; };
|
|
521
61
|
interface BaseOptions<Principal, Fields extends Schema$1.Struct.Fields, Ms extends readonly unknown[]> {
|
|
522
62
|
readonly documentId: DocumentId;
|
|
523
63
|
/** Name for the generated `surface`; defaults to the document id. */
|
|
@@ -531,6 +71,8 @@ interface BaseOptions<Principal, Fields extends Schema$1.Struct.Fields, Ms exten
|
|
|
531
71
|
readonly replay?: (shared: Schema$1.Struct.Type<NoInfer<Fields>>, message: MsgOf<NoInfer<Ms>>) => Schema$1.Struct.Type<NoInfer<Fields>>;
|
|
532
72
|
/** Authorization the server journal applies before committing; see `AuthorizePolicy`. */
|
|
533
73
|
readonly authorize?: AuthorizePolicy<Principal, NoInfer<Fields>, NoInfer<Ms>>;
|
|
74
|
+
/** What the server's commit writes into a durable Message; see `StampPolicy`. */
|
|
75
|
+
readonly stamp?: StampPolicy<NoInfer<Ms>>;
|
|
534
76
|
/**
|
|
535
77
|
* Merges a durable Message into the one submitted before it while that one is unsent,
|
|
536
78
|
* so a burst of edits is one operation. Replaying the result must equal replaying
|
|
@@ -674,7 +216,15 @@ interface MountOptions<Model, Message, Shared, Resources> {
|
|
|
674
216
|
* return Commands (a DOM the change has to reach). Omitted, the Model is `next`. It is
|
|
675
217
|
* not called for a status that changes nothing the Model shows, such as the first.
|
|
676
218
|
*/
|
|
677
|
-
readonly onReinstall?: ((next: Model, previous: Model) => Update.Return<Model, Message, Resources>) | undefined;
|
|
219
|
+
readonly onReinstall?: ((next: Model, previous: Model, change: Reinstall) => Update.Return<Model, Message, Resources>) | undefined;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* What a reinstall came from. `reset` is a server reset: the replica's
|
|
223
|
+
* committed history is a new one, so anything an application derived from
|
|
224
|
+
* the old one (reads cached by commit sequence, say) is to be read again.
|
|
225
|
+
*/
|
|
226
|
+
interface Reinstall {
|
|
227
|
+
readonly reset: boolean;
|
|
678
228
|
}
|
|
679
229
|
/**
|
|
680
230
|
* The shared slice as the server has confirmed it, outside the Model. It is a
|
|
@@ -704,6 +254,15 @@ interface Mounted<Model, Message, Shared = unknown> {
|
|
|
704
254
|
* report an optimistic edit as done: `Agent.when({ source: mounted.committed, … })`.
|
|
705
255
|
*/
|
|
706
256
|
readonly committed: CommittedView<Shared>;
|
|
257
|
+
/**
|
|
258
|
+
* Resolves once the Model has caught up with the replica: no persist in
|
|
259
|
+
* flight or unanswered, every replica status the mount was told of seen,
|
|
260
|
+
* and every reinstall it asked for applied. It observes and never does the
|
|
261
|
+
* work. Frames are not its to wait for (`Frames.track` in
|
|
262
|
+
* `foldkit-mixins/testing` is), nor I/O a Command started. Rejects after
|
|
263
|
+
* `dispose`.
|
|
264
|
+
*/
|
|
265
|
+
readonly settled: () => Promise<void>;
|
|
707
266
|
/** Waits for in-flight persists, then disposes the runtime. The replica stays open. */
|
|
708
267
|
readonly dispose: () => Promise<void>;
|
|
709
268
|
}
|
|
@@ -814,7 +373,10 @@ export declare const createPresenceHub: <Update>() => PresenceHub<Update>;
|
|
|
814
373
|
* id: the server owns peer identity, so a client cannot assert another's.
|
|
815
374
|
*/
|
|
816
375
|
export declare const socketPresenceChannel: <Update>(socket: SocketLike) => Effect.Effect<PresenceChannel<Update>, never, Scope.Scope>;
|
|
817
|
-
/**
|
|
376
|
+
/**
|
|
377
|
+
* Serves presence frames on an accepted socket, stamping the connection's
|
|
378
|
+
* identity, until the socket closes or the returned function is called.
|
|
379
|
+
*/
|
|
818
380
|
export declare const servePresence: <Update>(socket: SocketLike, hub: PresenceHub<Update>, options: {
|
|
819
381
|
readonly peerId: string;
|
|
820
382
|
}) => (() => void);
|
|
@@ -939,6 +501,10 @@ export declare const Sync: {
|
|
|
939
501
|
}) => (() => void);
|
|
940
502
|
/** The default socket factory: the platform `WebSocket`. */
|
|
941
503
|
nativeSocket: (url: string) => SocketLike;
|
|
504
|
+
/** A socket over a `MessagePort`, closed by `close()` or an abort signal. */
|
|
505
|
+
portSocket: (port: MessagePort, options?: {
|
|
506
|
+
readonly signal?: AbortSignal | undefined;
|
|
507
|
+
}) => SocketLike;
|
|
942
508
|
};
|
|
943
509
|
/** An ephemeral, TTL'd peer registry, deliberately outside the durable log. */
|
|
944
510
|
presence: {
|
|
@@ -1016,5 +582,5 @@ export declare const Sync: {
|
|
|
1016
582
|
};
|
|
1017
583
|
};
|
|
1018
584
|
//#endregion
|
|
1019
|
-
export type
|
|
585
|
+
export { type ApplicationSync, type AuthorizeDecision, type AuthorizePolicy, type AuthorizeRequest, type Checkpoint, CheckpointRegressionError, type CommitStamp, type CommittedOperation, CommittedOrderError, type CommittedView, type DefinedSync, DocumentId, type Exchange, type ExchangeFrame, type ExchangeReply, ForeignAcknowledgementError, ForeignRejectionError, type FragmentMessages, InvalidExchangeError, InvalidOutboxError, InvalidReplicaHistoryError, type JournalContract, LocalSequence, type LwwClock, type LwwClockState, type MakeOptions, type MountOptions, type MountUrl, type Mounted, type MsgOf, type NotifyFrame, OpId, type Operation, type OutboxEntry, type PolicyJournalContract, type Presence, type PresenceChannel, type PresenceHub, type PresenceOptions, type PresencePeer, type PresenceUpdate, type Reinstall, type Rejection, ReplayError, type Replica, ReplicaClosedError, type ReplicaError, ReplicaId, type ReplicaSnapshot, type ReplicaState, type ReplicaStatus, Sequence, type SocketLike, type SocketOptions, type StampPolicy, type Storage, StorageError, type SyncDefinition, type SyncFragment, Transport, type TransportClient, TransportError, type TransportShape, UnsupportedClockVersionError, UnsupportedReplicaVersionError, WrongReplicaStorageError, defineSync, documentId, indexedDb, layerFromPromise, layerLoopback, layerSocket, localSequence, nativeSocket, opId, portSocket, replicaId, sequence, serveSocket, syncMetrics, toPromise };
|
|
1020
586
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/make.ts","../src/mount.ts","../src/presence.ts","../src/lww.ts","../src/index.ts"],"mappings":";;;;;;;;;KA4BK,mBAAmB,eAAe,kBAAkB;;KAG7C,MAAM,iCAAiC,wBAAuB,wBAAwB,KAC9F;KAGC,WACH,UACA,UAAU,SAAO,OAAO,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