foldkit-sync 0.12.1 → 0.12.3
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/do.d.mts +1 -3
- package/dist/do.d.mts.map +1 -1
- package/dist/do.mjs +3 -4
- package/dist/entity.d.mts +0 -2
- package/dist/entity.d.mts.map +1 -1
- package/dist/entity.mjs +1 -2
- package/dist/index.d.mts +1 -9
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +9 -17
- package/dist/index.mjs.map +1 -1
- package/dist/{journal-BtYEDz0E.mjs → journal-D5h-jqXE.mjs} +4 -6
- package/dist/{journal-BtYEDz0E.mjs.map → journal-D5h-jqXE.mjs.map} +1 -1
- package/dist/journal.d.mts +1 -3
- package/dist/journal.d.mts.map +1 -1
- package/dist/journal.mjs +1 -1
- package/dist/{make-CFOcLcQ1.d.mts → make-DJ0Q1SSc.d.mts} +1 -13
- package/dist/make-DJ0Q1SSc.d.mts.map +1 -0
- package/dist/remote.d.mts +0 -2
- package/dist/remote.d.mts.map +1 -1
- package/dist/remote.mjs +1 -2
- package/dist/{transport-DiKXy5zx.mjs → transport-BZ6utYmB.mjs} +3 -5
- package/dist/{transport-DiKXy5zx.mjs.map → transport-BZ6utYmB.mjs.map} +1 -1
- package/package.json +7 -7
- package/dist/make-CFOcLcQ1.d.mts.map +0 -1
package/dist/do.d.mts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { n as AuthorizeDecision, v as Operation, w as Sync } from "./make-
|
|
1
|
+
import { n as AuthorizeDecision, v as Operation, w as Sync } from "./make-DJ0Q1SSc.mjs";
|
|
2
2
|
import { Duration, Effect, Layer } from "effect";
|
|
3
3
|
import { Journal } from "foldkit-durable/core";
|
|
4
4
|
import { RemoteUnauthenticated } from "foldkit-remote";
|
|
5
|
-
//#region src/do.d.ts
|
|
6
5
|
/** The sliver of a Durable Object the host uses: state for the journal to open with. */
|
|
7
6
|
export interface DocumentHostContext {
|
|
8
7
|
readonly storage?: unknown;
|
|
@@ -88,5 +87,4 @@ export interface AcceptingWebSocket extends WebSocket {
|
|
|
88
87
|
export declare const defineDocumentHost: <Message, Shared, Principal, Env, RP = never>(Base: new (ctx: DocumentHostContext, env: Env) => object, config: DocumentHostConfig<Message, Shared, Principal, Env, RP> & DocumentHostLayer<Env, RP>) => new (ctx: DocumentHostContext, env: Env) => {
|
|
89
88
|
fetch(request: Request): Promise<Response>;
|
|
90
89
|
};
|
|
91
|
-
//#endregion
|
|
92
90
|
//# sourceMappingURL=do.d.mts.map
|
package/dist/do.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"do.d.mts","names":[],"sources":["../src/do.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"do.d.mts","names":[],"sources":["../src/do.ts"],"mappings":";;;;;iBAyCiB;WACN;;;iBAIM,mBAAmB,SAAS,QAAQ,WAAW,KAAK;;WAE1D,MAAM,KAAK,SAAS;;;;;;;;WAQpB,cACP,KAAK,qBACL,KAAK,QACF,QAAQ,QAAQ,WAAW,QAAQ,WAAW;;;;;;;;WAQ1C,mBACP,SAAS,SACT,KAAK,QACF,OAAO,OAAO,WAAW,uBAAuB;;;;;;;WAO5C,WAEH,KAAK,KACL,SAAS,QAAQ,WAAW,QAAQ,WAAW,eAC5C,OAAO;;;;;;;;;;WAWP;aAEM,OAAO,SAAS;aAChB,QAAQ,WAAW;;;WAIzB,UAAU,WAAW,cAAc,OAAO;;;;;WAK1C,UAEH,WAAW,WACX,WAAW,cACR,oBAAoB,OAAO,OAAO;;;;;;WAOlC,wBAAwB,QAAQ,WAAW,QAAQ;;;;;;;;YASlD,kBAAkB,KAAK,OAAO;WAC3B;;WACA,QAAQ,KAAK,QAAQ,MAAM,MAAM;;;;;;iBAM/B,2BAA2B;EAC1C;;;;;;;;qBAuCW,qBAAsB,SAAS,QAAQ,WAAW,KAAK,YAAU,WACjE,KAAK,qBAAqB,KAAK,gBAAc,QAChD,mBAAmB,SAAS,QAAQ,WAAW,KAAK,MAAM,kBAAkB,KAAK,aACnF,KAAK,qBAAqB,KAAK;EAAU,MAAM,SAAS,UAAU,QAAQ"}
|
package/dist/do.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { u as workerSocket } from "./transport-
|
|
2
|
-
import { n as documentHost, s as checkRevalidate } from "./journal-
|
|
1
|
+
import { u as workerSocket } from "./transport-BZ6utYmB.mjs";
|
|
2
|
+
import { n as documentHost, s as checkRevalidate } from "./journal-D5h-jqXE.mjs";
|
|
3
3
|
import { Result } from "effect";
|
|
4
|
-
|
|
4
|
+
// src/do.ts
|
|
5
5
|
/**
|
|
6
6
|
* `foldkit-sync/do`: serve one document's Sync exchange from a Cloudflare
|
|
7
7
|
* Durable Object, the single writer its journal wants. Each socket the
|
|
@@ -106,7 +106,6 @@ const defineDocumentHost = (Base, config) => {
|
|
|
106
106
|
}
|
|
107
107
|
};
|
|
108
108
|
};
|
|
109
|
-
//#endregion
|
|
110
109
|
export { defineDocumentHost };
|
|
111
110
|
|
|
112
111
|
//# sourceMappingURL=do.mjs.map
|
package/dist/entity.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Option, Schema } from "effect";
|
|
2
|
-
//#region src/entity.d.ts
|
|
3
2
|
/** Who committed an edit: the actor, shown in words, and the replica (a tab), which says whose it is. */
|
|
4
3
|
export declare const Author: Schema.Struct<{
|
|
5
4
|
readonly actor: Schema.String;
|
|
@@ -116,6 +115,5 @@ export declare const EditableEntity: {
|
|
|
116
115
|
make: typeof make;
|
|
117
116
|
};
|
|
118
117
|
export type EditableEntity<E extends EntityFields, Ms extends ReadonlyArray<Member<E>>> = ReturnType<typeof make<E, Ms>>;
|
|
119
|
-
//#endregion
|
|
120
118
|
export {};
|
|
121
119
|
//# sourceMappingURL=entity.d.mts.map
|
package/dist/entity.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entity.d.mts","names":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C,eAAA,OAAA,cAAa,SAAA,GAAA,cAAM;;;;;;EAS7B,WAAA,UAAA,cAAa,SAAA,GAAA,cAAM,MACvB,cAAa,SAAA,GAAA,cAAM,oBAExB,cAAc,SAAQ,SAAA,GAAA;;EAiBd,UAAA,SAAA,cAAc,OAAO,GAAC,iBAC9B;aAAyB,IAAI,KAAK;aAAa,QAAM;;;;;;EAOvB,WAAA,KAAA,MAAA,GAAA,aAAA,QAAA,eAAA,OAAO,GAAC;;EAKzB,SAAA,OAAA,cAAa,SAAA,GAAA,cAAM,KAAO,KAAK,IAAE,QAAA,eAAc,OAAO,OAAM,SAAA,GAAA;EA7F3C,OAAA,MAAA,SAAA,GAAA,aAAA;;;qBAuGxB;;;YACD,eACV,UAAU,cACV,WAAW,cAAc,OAAO,OAC9B,kBAAkB,KAAK,GAAG"}
|
package/dist/entity.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Equal, Option, Schema } from "effect";
|
|
2
|
-
|
|
2
|
+
// src/entity.ts
|
|
3
3
|
/**
|
|
4
4
|
* `foldkit-sync/entity`: edits to rows a server owns, kept in a replicated
|
|
5
5
|
* slice that the journal owns. `foldkit-sync/remote` shows them over the rows
|
|
@@ -137,7 +137,6 @@ const make = (entity, options) => {
|
|
|
137
137
|
};
|
|
138
138
|
/** Edits to an Entity's members, kept per cell in a replicated slice and laid over its rows. */
|
|
139
139
|
const EditableEntity = { make };
|
|
140
|
-
//#endregion
|
|
141
140
|
export { Author, EditableEntity };
|
|
142
141
|
|
|
143
142
|
//# sourceMappingURL=entity.mjs.map
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as InvalidOutboxError, A as ExchangeReply, B as nativeSocket, C as ReplicaStatus, D as defineSync, E as TransportClient, F as TransportError, G as OutboxEntry, H as serveSocket, I as TransportShape, J as CheckpointRegressionError, K as Storage, L as layerFromPromise, M as SocketLike, N as SocketOptions, O as syncMetrics, P as Transport, Q as InvalidExchangeError, R as layerLoopback, S as ReplicaState, T as SyncDefinition, U as toPromise, V as portSocket, W as workerSocket, X as ForeignAcknowledgementError, Y as CommittedOrderError, Z as ForeignRejectionError, _ as JournalContract, _t as sequence, a as DefinedSync, at as UnsupportedClockVersionError, b as Replica, c as MsgOf, ct as DocumentId, d as SyncFragment, dt as ReplicaId, et as InvalidReplicaHistoryError, f as forApplication, ft as Sequence, g as Exchange, gt as replicaId, h as CommittedOperation, ht as opId, i as AuthorizeRequest, it as StorageError, j as NotifyFrame, k as ExchangeFrame, l as PolicyJournalContract, lt as LocalSequence, m as CommitStamp, mt as localSequence, n as AuthorizeDecision, nt as ReplicaClosedError, o as FragmentMessages, ot as UnsupportedReplicaVersionError, p as Checkpoint, pt as documentId, q as indexedDb, r as AuthorizePolicy, rt as ReplicaError, s as MakeOptions, st as WrongReplicaStorageError, t as ApplicationSync, tt as ReplayError, u as StampPolicy, ut as OpId, v as Operation, w as Sync$1, x as ReplicaSnapshot, y as Rejection, z as layerSocket } from "./make-
|
|
1
|
+
import { $ as InvalidOutboxError, A as ExchangeReply, B as nativeSocket, C as ReplicaStatus, D as defineSync, E as TransportClient, F as TransportError, G as OutboxEntry, H as serveSocket, I as TransportShape, J as CheckpointRegressionError, K as Storage, L as layerFromPromise, M as SocketLike, N as SocketOptions, O as syncMetrics, P as Transport, Q as InvalidExchangeError, R as layerLoopback, S as ReplicaState, T as SyncDefinition, U as toPromise, V as portSocket, W as workerSocket, X as ForeignAcknowledgementError, Y as CommittedOrderError, Z as ForeignRejectionError, _ as JournalContract, _t as sequence, a as DefinedSync, at as UnsupportedClockVersionError, b as Replica, c as MsgOf, ct as DocumentId, d as SyncFragment, dt as ReplicaId, et as InvalidReplicaHistoryError, f as forApplication, ft as Sequence, g as Exchange, gt as replicaId, h as CommittedOperation, ht as opId, i as AuthorizeRequest, it as StorageError, j as NotifyFrame, k as ExchangeFrame, l as PolicyJournalContract, lt as LocalSequence, m as CommitStamp, mt as localSequence, n as AuthorizeDecision, nt as ReplicaClosedError, o as FragmentMessages, ot as UnsupportedReplicaVersionError, p as Checkpoint, pt as documentId, q as indexedDb, r as AuthorizePolicy, rt as ReplicaError, s as MakeOptions, st as WrongReplicaStorageError, t as ApplicationSync, tt as ReplayError, u as StampPolicy, ut as OpId, v as Operation, w as Sync$1, x as ReplicaSnapshot, y as Rejection, z as layerSocket } from "./make-DJ0Q1SSc.mjs";
|
|
2
2
|
import { Duration, Effect, Exit, Layer, PubSub, Schema, Scope, Stream } from "effect";
|
|
3
3
|
import { RunnableApplication } from "foldkit-surface";
|
|
4
4
|
import { UrlRequest } from "foldkit/navigation";
|
|
@@ -6,7 +6,6 @@ import { Subscriptions } from "foldkit/subscription";
|
|
|
6
6
|
import * as Url from "foldkit/url";
|
|
7
7
|
import { Document, HtmlBuilder } from "foldkit/html";
|
|
8
8
|
import * as Update from "foldkit/update";
|
|
9
|
-
//#region src/presence.d.ts
|
|
10
9
|
/** One peer's presence. A `null` value means the peer left. */
|
|
11
10
|
interface PresenceUpdate<Update> {
|
|
12
11
|
readonly id: string;
|
|
@@ -120,8 +119,6 @@ export declare const servePresence: <Update>(socket: SocketLike, hub: PresenceHu
|
|
|
120
119
|
readonly peerId: string;
|
|
121
120
|
readonly opens?: Effect.Effect<boolean, unknown> | undefined;
|
|
122
121
|
}) => (() => void);
|
|
123
|
-
//#endregion
|
|
124
|
-
//#region src/lww.d.ts
|
|
125
122
|
/** A logical write time; replica ids break concurrent ties using UTF-16 order. */
|
|
126
123
|
declare const Stamp: Schema.Struct<{
|
|
127
124
|
readonly counter: Schema.Number;
|
|
@@ -192,8 +189,6 @@ export declare const lwwRegister: <Value, Encoded, RD, RE>(value: Schema.Codec<V
|
|
|
192
189
|
readonly value: Value;
|
|
193
190
|
};
|
|
194
191
|
};
|
|
195
|
-
//#endregion
|
|
196
|
-
//#region src/mount.d.ts
|
|
197
192
|
/**
|
|
198
193
|
* A Command that dispatches `message` as the next transition, which under `Sync.mount`
|
|
199
194
|
* means within this one: the mount applies it straight after the `update` that returned
|
|
@@ -306,8 +301,6 @@ interface Mounted<Model, Message, Shared = unknown> {
|
|
|
306
301
|
/** The application's Message union, as `Surface.application` types it. */
|
|
307
302
|
type MessageOf<App> = App extends RunnableApplication<any, any, any, any> ? Schema.Schema.Type<App['Message']> : never;
|
|
308
303
|
export declare const mount: <Model, F extends Schema.Struct.Fields, Cases extends Record<string, Schema.Struct.Fields>, Fields extends Schema.Struct.Fields, Ms extends readonly unknown[], Resources = never, Principal = unknown>(app: RunnableApplication<Model, F, Cases, Resources>, sync: DefinedSync<Model, Fields, MessageOf<RunnableApplication<Model, F, Cases, Resources>>, Ms, Principal>, options: MountOptions<Model, MessageOf<RunnableApplication<Model, F, Cases, Resources>>, Schema.Struct.Type<Fields>, Resources>) => Mounted<Model, MessageOf<RunnableApplication<Model, F, Cases, Resources>>, Schema.Struct.Type<Fields>>;
|
|
309
|
-
//#endregion
|
|
310
|
-
//#region src/index.d.ts
|
|
311
304
|
/**
|
|
312
305
|
* The contract `Sync.define` and `Sync.forApplication(App).make` produce: the
|
|
313
306
|
* wire codecs, the server journal's contract, and `openReplica`.
|
|
@@ -400,6 +393,5 @@ export declare const Sync: {
|
|
|
400
393
|
}, StorageError | UnsupportedClockVersionError, never>;
|
|
401
394
|
};
|
|
402
395
|
};
|
|
403
|
-
//#endregion
|
|
404
396
|
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, forApplication, indexedDb, layerFromPromise, layerLoopback, layerSocket, localSequence, nativeSocket, opId, portSocket, replicaId, sequence, serveSocket, syncMetrics, toPromise, workerSocket };
|
|
405
397
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":["SyncContract","_$__indexedDb_js0.Storage","_$__errors_js0.StorageError","_$__presence_js0.PresenceOptions","_$__presence_js0.PresenceUpdate","_$__ids_js0.DocumentId","_$__ids_js0.ReplicaId","_$__errors_js0.UnsupportedClockVersionError"],"sources":["../src/presence.ts","../src/lww.ts","../src/mount.ts","../src/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":["SyncContract","_$__indexedDb_js0.Storage","_$__errors_js0.StorageError","_$__presence_js0.PresenceOptions","_$__presence_js0.PresenceUpdate","_$__ids_js0.DocumentId","_$__ids_js0.ReplicaId","_$__errors_js0.UnsupportedClockVersionError"],"sources":["../src/presence.ts","../src/lww.ts","../src/mount.ts","../src/index.ts"],"mappings":";;;;;;;;;UAciB,eAAe;WACrB;WACA,OAAO;;;;;;;;;;UAWD,gBAAgB;WACtB,SAAS,OAAO,OAAO,eAAe;WACtC,UAAU,QAAQ,eAAe,YAAY,OAAO;;UAG9C,gBAAgB;;WAEtB;;WAEA,KAAK,SAAS;;;;;;WAMd,cAAc,mBAAmB;WACjC,UAAU,gBAAgB;;;;;;WAM1B,WAAW,SAAS;;UAGd,aAAa;WACnB;WACA,OAAO;W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kBAAe,qCAAA;;;;;;;IAKf,iBAAQ;;IAER,YAAS;e,YAFDE"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as localSequence, a as layerSocket, b as sequence, c as serveSocket, d as DocumentId, f as LocalSequence, g as documentId, h as Sequence, i as layerLoopback, l as toPromise, m as ReplicaId, n as TransportError, o as nativeSocket, p as OpId, r as layerFromPromise, s as portSocket, t as Transport, u as workerSocket, v as opId, y as replicaId } from "./transport-
|
|
1
|
+
import { _ as localSequence, a as layerSocket, b as sequence, c as serveSocket, d as DocumentId, f as LocalSequence, g as documentId, h as Sequence, i as layerLoopback, l as toPromise, m as ReplicaId, n as TransportError, o as nativeSocket, p as OpId, r as layerFromPromise, s as portSocket, t as Transport, u as workerSocket, v as opId, y as replicaId } from "./transport-BZ6utYmB.mjs";
|
|
2
2
|
import { Clock, Duration, Effect, Equal, Exit, Fiber, Metric, Option, Predicate, PubSub, Queue, Ref, Schema, Stream, SynchronizedRef } from "effect";
|
|
3
3
|
import { MessageSet, Projection, Surface } from "foldkit-surface";
|
|
4
4
|
import { absurd } from "effect/Function";
|
|
@@ -7,7 +7,7 @@ import * as Port from "foldkit/port";
|
|
|
7
7
|
import * as Runtime from "foldkit/runtime";
|
|
8
8
|
import * as Subscription from "foldkit/subscription";
|
|
9
9
|
import * as Url from "foldkit/url";
|
|
10
|
-
|
|
10
|
+
// src/errors.ts
|
|
11
11
|
/** The persisted storage could not be read or written. */
|
|
12
12
|
var StorageError = class extends Schema.TaggedError()("StorageError", {
|
|
13
13
|
message: Schema.String,
|
|
@@ -78,8 +78,7 @@ var ReplayError = class extends Schema.TaggedError()("ReplayError", {
|
|
|
78
78
|
message: Schema.String,
|
|
79
79
|
cause: Schema.optional(Schema.Unknown)
|
|
80
80
|
}) {};
|
|
81
|
-
|
|
82
|
-
//#region src/indexedDb.ts
|
|
81
|
+
// src/indexedDb.ts
|
|
83
82
|
const storageError = (message, cause) => new StorageError({
|
|
84
83
|
message: `${message}: ${cause instanceof Error ? cause.message : String(cause)}`,
|
|
85
84
|
cause
|
|
@@ -173,8 +172,7 @@ const indexedDb = Effect.fn("Storage.indexedDb")(function* (name, factory = glob
|
|
|
173
172
|
close: Effect.sync(() => database.close())
|
|
174
173
|
};
|
|
175
174
|
});
|
|
176
|
-
|
|
177
|
-
//#region src/lww.ts
|
|
175
|
+
// src/lww.ts
|
|
178
176
|
/** A logical write time; replica ids break concurrent ties using UTF-16 order. */
|
|
179
177
|
const Stamp = Schema.Struct({
|
|
180
178
|
counter: Schema.Number.check(Schema.isInt(), Schema.isGreaterThanOrEqualTo(0), Schema.isLessThanOrEqualTo(Number.MAX_SAFE_INTEGER)),
|
|
@@ -289,8 +287,7 @@ const lwwRegister = (value) => {
|
|
|
289
287
|
merge
|
|
290
288
|
};
|
|
291
289
|
};
|
|
292
|
-
|
|
293
|
-
//#region src/sync.ts
|
|
290
|
+
// src/sync.ts
|
|
294
291
|
/** Wire and persisted-format versions. A bump must handle the older value explicitly. */
|
|
295
292
|
const PROTOCOL_VERSION = 1;
|
|
296
293
|
const SCHEMA_VERSION = 1;
|
|
@@ -799,8 +796,7 @@ const defineSync = (definition) => {
|
|
|
799
796
|
openReplica
|
|
800
797
|
};
|
|
801
798
|
};
|
|
802
|
-
|
|
803
|
-
//#region src/make.ts
|
|
799
|
+
// src/make.ts
|
|
804
800
|
/**
|
|
805
801
|
* The Foldkit-facing sync layer: `Sync.forApplication(App).make(config)`
|
|
806
802
|
* compiles an application, a writable projection, and a durable Message subset
|
|
@@ -947,8 +943,7 @@ const build = (app) => {
|
|
|
947
943
|
make
|
|
948
944
|
};
|
|
949
945
|
};
|
|
950
|
-
|
|
951
|
-
//#region src/mount.ts
|
|
946
|
+
// src/mount.ts
|
|
952
947
|
/**
|
|
953
948
|
* `Sync.mount`: runs a Foldkit application over a replica with one reducer.
|
|
954
949
|
*
|
|
@@ -1281,8 +1276,7 @@ const mount = (app, sync, options) => {
|
|
|
1281
1276
|
}
|
|
1282
1277
|
};
|
|
1283
1278
|
};
|
|
1284
|
-
|
|
1285
|
-
//#region src/presence.ts
|
|
1279
|
+
// src/presence.ts
|
|
1286
1280
|
/**
|
|
1287
1281
|
* Tracks ephemeral peers with a time-to-live.
|
|
1288
1282
|
*
|
|
@@ -1551,8 +1545,7 @@ const servePresence = (socket, hub, options) => {
|
|
|
1551
1545
|
stopClose();
|
|
1552
1546
|
};
|
|
1553
1547
|
};
|
|
1554
|
-
|
|
1555
|
-
//#region src/index.ts
|
|
1548
|
+
// src/index.ts
|
|
1556
1549
|
/**
|
|
1557
1550
|
* `foldkit-sync` — a local-first replica of a shared Foldkit projection.
|
|
1558
1551
|
*
|
|
@@ -1615,7 +1608,6 @@ const Sync = {
|
|
|
1615
1608
|
openClock: openLwwClock
|
|
1616
1609
|
}
|
|
1617
1610
|
};
|
|
1618
|
-
//#endregion
|
|
1619
1611
|
export { CheckpointRegressionError, CommittedOrderError, DocumentId, ForeignAcknowledgementError, ForeignRejectionError, InvalidExchangeError, InvalidOutboxError, InvalidReplicaHistoryError, LocalSequence, OpId, ReplayError, ReplicaClosedError, ReplicaId, Sequence, StorageError, Sync, Transport, TransportError, UnsupportedClockVersionError, UnsupportedReplicaVersionError, WrongReplicaStorageError, createPresence, createPresenceHub, defineSync, documentId, fact, forApplication, indexedDb, layerFromPromise, layerLoopback, layerSocket, localSequence, loopbackPresenceChannel, lwwRegister, mount, nativeSocket, opId, openLwwClock, portSocket, replicaId, sequence, servePresence, serveSocket, socketPresenceChannel, syncMetrics, toPromise, workerSocket };
|
|
1620
1612
|
|
|
1621
1613
|
//# sourceMappingURL=index.mjs.map
|