@livestore/sync-cf 0.3.0-dev.9 → 0.3.1-dev.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/LICENSE +201 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/cf-worker/durable-object.d.ts +45 -28
- package/dist/cf-worker/durable-object.d.ts.map +1 -1
- package/dist/cf-worker/durable-object.js +214 -129
- package/dist/cf-worker/durable-object.js.map +1 -1
- package/dist/cf-worker/worker.d.ts +44 -1
- package/dist/cf-worker/worker.d.ts.map +1 -1
- package/dist/cf-worker/worker.js +83 -13
- package/dist/cf-worker/worker.js.map +1 -1
- package/dist/common/mod.d.ts +5 -0
- package/dist/common/mod.d.ts.map +1 -1
- package/dist/common/mod.js +5 -0
- package/dist/common/mod.js.map +1 -1
- package/dist/common/ws-message-types.d.ts +148 -98
- package/dist/common/ws-message-types.d.ts.map +1 -1
- package/dist/common/ws-message-types.js +19 -24
- package/dist/common/ws-message-types.js.map +1 -1
- package/dist/sync-impl/ws-impl.d.ts +2 -5
- package/dist/sync-impl/ws-impl.d.ts.map +1 -1
- package/dist/sync-impl/ws-impl.js +89 -37
- package/dist/sync-impl/ws-impl.js.map +1 -1
- package/package.json +5 -4
- package/src/cf-worker/durable-object.ts +253 -141
- package/src/cf-worker/worker.ts +125 -14
- package/src/common/mod.ts +7 -0
- package/src/common/ws-message-types.ts +22 -36
- package/src/sync-impl/ws-impl.ts +145 -91
- package/dist/cf-worker/index.d.ts +0 -3
- package/dist/cf-worker/index.d.ts.map +0 -1
- package/dist/cf-worker/index.js +0 -33
- package/dist/cf-worker/index.js.map +0 -1
- package/dist/cf-worker/make-worker.d.ts +0 -6
- package/dist/cf-worker/make-worker.d.ts.map +0 -1
- package/dist/cf-worker/make-worker.js +0 -31
- package/dist/cf-worker/make-worker.js.map +0 -1
- package/dist/cf-worker/types.d.ts +0 -2
- package/dist/cf-worker/types.d.ts.map +0 -1
- package/dist/cf-worker/types.js +0 -2
- package/dist/cf-worker/types.js.map +0 -1
- package/dist/common/index.d.ts +0 -2
- package/dist/common/index.d.ts.map +0 -1
- package/dist/common/index.js +0 -2
- package/dist/common/index.js.map +0 -1
- package/dist/sync-impl/index.d.ts +0 -2
- package/dist/sync-impl/index.d.ts.map +0 -1
- package/dist/sync-impl/index.js +0 -2
- package/dist/sync-impl/index.js.map +0 -1
|
@@ -1,62 +1,57 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LiveStoreEvent } from '@livestore/common/schema';
|
|
2
2
|
import { Schema } from '@livestore/utils/effect';
|
|
3
3
|
export const PullReq = Schema.TaggedStruct('WSMessage.PullReq', {
|
|
4
4
|
requestId: Schema.String,
|
|
5
5
|
/** Omitting the cursor will start from the beginning */
|
|
6
6
|
cursor: Schema.optional(Schema.Number),
|
|
7
|
-
});
|
|
7
|
+
}).annotations({ title: '@livestore/sync-cf:PullReq' });
|
|
8
8
|
export const SyncMetadata = Schema.Struct({
|
|
9
9
|
/** ISO date format */
|
|
10
10
|
createdAt: Schema.String,
|
|
11
|
-
});
|
|
11
|
+
}).annotations({ title: '@livestore/sync-cf:SyncMetadata' });
|
|
12
12
|
export const PullRes = Schema.TaggedStruct('WSMessage.PullRes', {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
mutationEventEncoded: MutationEvent.AnyEncodedGlobal,
|
|
13
|
+
batch: Schema.Array(Schema.Struct({
|
|
14
|
+
eventEncoded: LiveStoreEvent.AnyEncodedGlobal,
|
|
16
15
|
metadata: Schema.Option(SyncMetadata),
|
|
17
16
|
})),
|
|
17
|
+
requestId: Schema.Struct({ context: Schema.Literal('pull', 'push'), requestId: Schema.String }),
|
|
18
18
|
remaining: Schema.Number,
|
|
19
|
-
});
|
|
20
|
-
export const PushBroadcast = Schema.TaggedStruct('WSMessage.PushBroadcast', {
|
|
21
|
-
mutationEventEncoded: MutationEvent.AnyEncodedGlobal,
|
|
22
|
-
metadata: Schema.Option(SyncMetadata),
|
|
23
|
-
});
|
|
19
|
+
}).annotations({ title: '@livestore/sync-cf:PullRes' });
|
|
24
20
|
export const PushReq = Schema.TaggedStruct('WSMessage.PushReq', {
|
|
25
21
|
requestId: Schema.String,
|
|
26
|
-
batch: Schema.Array(
|
|
27
|
-
});
|
|
22
|
+
batch: Schema.Array(LiveStoreEvent.AnyEncodedGlobal),
|
|
23
|
+
}).annotations({ title: '@livestore/sync-cf:PushReq' });
|
|
28
24
|
export const PushAck = Schema.TaggedStruct('WSMessage.PushAck', {
|
|
29
25
|
requestId: Schema.String,
|
|
30
|
-
|
|
31
|
-
});
|
|
26
|
+
}).annotations({ title: '@livestore/sync-cf:PushAck' });
|
|
32
27
|
export const Error = Schema.TaggedStruct('WSMessage.Error', {
|
|
33
28
|
requestId: Schema.String,
|
|
34
29
|
message: Schema.String,
|
|
35
|
-
});
|
|
30
|
+
}).annotations({ title: '@livestore/sync-cf:Error' });
|
|
36
31
|
export const Ping = Schema.TaggedStruct('WSMessage.Ping', {
|
|
37
32
|
requestId: Schema.Literal('ping'),
|
|
38
|
-
});
|
|
33
|
+
}).annotations({ title: '@livestore/sync-cf:Ping' });
|
|
39
34
|
export const Pong = Schema.TaggedStruct('WSMessage.Pong', {
|
|
40
35
|
requestId: Schema.Literal('ping'),
|
|
41
|
-
});
|
|
36
|
+
}).annotations({ title: '@livestore/sync-cf:Pong' });
|
|
42
37
|
export const AdminResetRoomReq = Schema.TaggedStruct('WSMessage.AdminResetRoomReq', {
|
|
43
38
|
requestId: Schema.String,
|
|
44
39
|
adminSecret: Schema.String,
|
|
45
|
-
});
|
|
40
|
+
}).annotations({ title: '@livestore/sync-cf:AdminResetRoomReq' });
|
|
46
41
|
export const AdminResetRoomRes = Schema.TaggedStruct('WSMessage.AdminResetRoomRes', {
|
|
47
42
|
requestId: Schema.String,
|
|
48
|
-
});
|
|
43
|
+
}).annotations({ title: '@livestore/sync-cf:AdminResetRoomRes' });
|
|
49
44
|
export const AdminInfoReq = Schema.TaggedStruct('WSMessage.AdminInfoReq', {
|
|
50
45
|
requestId: Schema.String,
|
|
51
46
|
adminSecret: Schema.String,
|
|
52
|
-
});
|
|
47
|
+
}).annotations({ title: '@livestore/sync-cf:AdminInfoReq' });
|
|
53
48
|
export const AdminInfoRes = Schema.TaggedStruct('WSMessage.AdminInfoRes', {
|
|
54
49
|
requestId: Schema.String,
|
|
55
50
|
info: Schema.Struct({
|
|
56
51
|
durableObjectId: Schema.String,
|
|
57
52
|
}),
|
|
58
|
-
});
|
|
59
|
-
export const Message = Schema.Union(PullReq, PullRes,
|
|
60
|
-
export const BackendToClientMessage = Schema.Union(PullRes,
|
|
53
|
+
}).annotations({ title: '@livestore/sync-cf:AdminInfoRes' });
|
|
54
|
+
export const Message = Schema.Union(PullReq, PullRes, PushReq, PushAck, Error, Ping, Pong, AdminResetRoomReq, AdminResetRoomRes, AdminInfoReq, AdminInfoRes).annotations({ title: '@livestore/sync-cf:Message' });
|
|
55
|
+
export const BackendToClientMessage = Schema.Union(PullRes, PushAck, AdminResetRoomRes, AdminInfoRes, Error, Pong);
|
|
61
56
|
export const ClientToBackendMessage = Schema.Union(PullReq, PushReq, AdminResetRoomReq, AdminInfoReq, Ping);
|
|
62
57
|
//# sourceMappingURL=ws-message-types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ws-message-types.js","sourceRoot":"","sources":["../../src/common/ws-message-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"ws-message-types.js","sourceRoot":"","sources":["../../src/common/ws-message-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAEhD,MAAM,CAAC,MAAM,OAAO,GAAG,MAAM,CAAC,YAAY,CAAC,mBAAmB,EAAE;IAC9D,SAAS,EAAE,MAAM,CAAC,MAAM;IACxB,wDAAwD;IACxD,MAAM,EAAE,MAAM,CAAC,Q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B,CAAC,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,iCAAiC,EAAE,CAAC,CAAA;AAI5D,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC,wBAAwB,EAAE;IACxE,SAAS,EAAE,MAAM,CAAC,MAAM;IACxB,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC;QAClB,eAAe,EAAE,MAAM,CAAC,MAAM;KAC/B,CAAC;CACH,CAAC,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,iCAAiC,EAAE,CAAC,CAAA;AAI5D,MAAM,CAAC,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CACjC,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,iBAAiB,EACjB,iBAAiB,EACjB,YAAY,EACZ,YAAY,CACb,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,4BAA4B,EAAE,CAAC,CAAA;AAKtD,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,KAAK,EAAE,IAAI,CAAC,CAAA;AAGlH,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,IAAI,CAAC,CAAA"}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { Scope } from '@livestore/utils/effect';
|
|
3
|
-
import { Effect } from '@livestore/utils/effect';
|
|
1
|
+
import type { SyncBackendConstructor } from '@livestore/common';
|
|
4
2
|
import type { SyncMetadata } from '../common/ws-message-types.js';
|
|
5
3
|
export interface WsSyncOptions {
|
|
6
4
|
url: string;
|
|
7
|
-
storeId: string;
|
|
8
5
|
}
|
|
9
|
-
export declare const
|
|
6
|
+
export declare const makeCfSync: (options: WsSyncOptions) => SyncBackendConstructor<SyncMetadata>;
|
|
10
7
|
//# sourceMappingURL=ws-impl.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ws-impl.d.ts","sourceRoot":"","sources":["../../src/sync-impl/ws-impl.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"ws-impl.d.ts","sourceRoot":"","sources":["../../src/sync-impl/ws-impl.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAe,sBAAsB,EAAE,MAAM,mBAAmB,CAAA;AAoB5E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAEjE,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAA;CACZ;AAED,eAAO,MAAM,UAAU,GACpB,SAAS,aAAa,KAAG,sBAAsB,CAAC,YAAY,CAuHzD,CAAA"}
|
|
@@ -1,45 +1,92 @@
|
|
|
1
1
|
/// <reference lib="dom" />
|
|
2
|
-
import { InvalidPullError, InvalidPushError } from '@livestore/common';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { InvalidPullError, InvalidPushError, UnexpectedError } from '@livestore/common';
|
|
3
|
+
import { EventSequenceNumber } from '@livestore/common/schema';
|
|
4
|
+
import { LS_DEV, shouldNeverHappen } from '@livestore/utils';
|
|
5
|
+
import { Deferred, Effect, Option, PubSub, Queue, Schedule, Schema, Stream, SubscriptionRef, UrlParams, WebSocket, } from '@livestore/utils/effect';
|
|
5
6
|
import { nanoid } from '@livestore/utils/nanoid';
|
|
6
|
-
import { WSMessage } from '../common/mod.js';
|
|
7
|
-
export const
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
import { SearchParamsSchema, WSMessage } from '../common/mod.js';
|
|
8
|
+
export const makeCfSync = (options) => ({ storeId, payload }) => Effect.gen(function* () {
|
|
9
|
+
const urlParamsData = yield* Schema.encode(SearchParamsSchema)({
|
|
10
|
+
storeId,
|
|
11
|
+
payload,
|
|
12
|
+
}).pipe(UnexpectedError.mapToUnexpectedError);
|
|
13
|
+
const urlParams = UrlParams.fromInput(urlParamsData);
|
|
14
|
+
const wsUrl = `${options.url}/websocket?${UrlParams.toString(urlParams)}`;
|
|
10
15
|
const { isConnected, incomingMessages, send } = yield* connect(wsUrl);
|
|
16
|
+
/**
|
|
17
|
+
* We need to account for the scenario where push-caused PullRes message arrive before the pull-caused PullRes message.
|
|
18
|
+
* i.e. a scenario where the WS connection is created but before the server processed the initial pull, a push from
|
|
19
|
+
* another client triggers a PullRes message sent to this client which we need to stash until our pull-caused
|
|
20
|
+
* PullRes message arrives at which point we can combine the stashed events with the pull-caused events and continue.
|
|
21
|
+
*/
|
|
22
|
+
const stashedPullBatch = [];
|
|
23
|
+
// We currently only support one pull stream for a sync backend.
|
|
24
|
+
let pullStarted = false;
|
|
11
25
|
const api = {
|
|
12
26
|
isConnected,
|
|
27
|
+
// Currently we're already eagerly connecting when the sync backend is created but we might want to refactor this later to clean this up
|
|
28
|
+
connect: Effect.void,
|
|
13
29
|
pull: (args) => Effect.gen(function* () {
|
|
30
|
+
if (pullStarted) {
|
|
31
|
+
return shouldNeverHappen(`Pull already started for this sync backend.`);
|
|
32
|
+
}
|
|
33
|
+
pullStarted = true;
|
|
34
|
+
let pullResponseReceived = false;
|
|
14
35
|
const requestId = nanoid();
|
|
15
36
|
const cursor = Option.getOrUndefined(args)?.cursor.global;
|
|
16
37
|
yield* send(WSMessage.PullReq.make({ cursor, requestId }));
|
|
17
|
-
return Stream.fromPubSub(incomingMessages).pipe(Stream.
|
|
38
|
+
return Stream.fromPubSub(incomingMessages).pipe(Stream.tap((_) => _._tag === 'WSMessage.Error' && _.requestId === requestId
|
|
18
39
|
? new InvalidPullError({ message: _.message })
|
|
19
|
-
: Effect.void), Stream.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
40
|
+
: Effect.void), Stream.filterMap((msg) => {
|
|
41
|
+
if (msg._tag === 'WSMessage.PullRes') {
|
|
42
|
+
if (msg.requestId.context === 'pull') {
|
|
43
|
+
if (msg.requestId.requestId === requestId) {
|
|
44
|
+
pullResponseReceived = true;
|
|
45
|
+
if (stashedPullBatch.length > 0 && msg.remaining === 0) {
|
|
46
|
+
const pullResHead = msg.batch.at(-1)?.eventEncoded.seqNum ?? EventSequenceNumber.ROOT.global;
|
|
47
|
+
// Index where stashed events are greater than pullResHead
|
|
48
|
+
const newPartialBatchIndex = stashedPullBatch.findIndex((batchItem) => batchItem.eventEncoded.seqNum > pullResHead);
|
|
49
|
+
const batchWithNewStashedEvents = newPartialBatchIndex === -1 ? [] : stashedPullBatch.slice(newPartialBatchIndex);
|
|
50
|
+
const combinedBatch = [...msg.batch, ...batchWithNewStashedEvents];
|
|
51
|
+
return Option.some({ ...msg, batch: combinedBatch, remaining: 0 });
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
return Option.some(msg);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
// Ignore
|
|
59
|
+
return Option.none();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
if (pullResponseReceived) {
|
|
64
|
+
return Option.some(msg);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
stashedPullBatch.push(...msg.batch);
|
|
68
|
+
return Option.none();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return Option.none();
|
|
73
|
+
}));
|
|
28
74
|
}).pipe(Stream.unwrap),
|
|
29
75
|
push: (batch) => Effect.gen(function* () {
|
|
30
|
-
const
|
|
76
|
+
const pushAck = yield* Deferred.make();
|
|
31
77
|
const requestId = nanoid();
|
|
32
|
-
yield* Stream.fromPubSub(incomingMessages).pipe(Stream.
|
|
33
|
-
? Deferred.fail(
|
|
34
|
-
: Effect.void), Stream.filter(
|
|
35
|
-
// TODO bring back filterting of "own events"
|
|
36
|
-
// Stream.filter((_) => _.mutationId === mutationEventEncoded.id.global),
|
|
37
|
-
Stream.take(1), Stream.tap(() => Deferred.succeed(ready, void 0)), Stream.runDrain, Effect.tapCauseLogPretty, Effect.fork);
|
|
78
|
+
yield* Stream.fromPubSub(incomingMessages).pipe(Stream.tap((_) => _._tag === 'WSMessage.Error' && _.requestId === requestId
|
|
79
|
+
? Deferred.fail(pushAck, new InvalidPushError({ reason: { _tag: 'Unexpected', message: _.message } }))
|
|
80
|
+
: Effect.void), Stream.filter((_) => _._tag === 'WSMessage.PushAck' && _.requestId === requestId), Stream.take(1), Stream.tap(() => Deferred.succeed(pushAck, void 0)), Stream.runDrain, Effect.tapCauseLogPretty, Effect.fork);
|
|
38
81
|
yield* send(WSMessage.PushReq.make({ batch, requestId }));
|
|
39
|
-
yield*
|
|
40
|
-
const createdAt = new Date().toISOString();
|
|
41
|
-
return { metadata: Array.from({ length: batch.length }, () => Option.some({ createdAt })) };
|
|
82
|
+
yield* pushAck;
|
|
42
83
|
}),
|
|
84
|
+
metadata: {
|
|
85
|
+
name: '@livestore/cf-sync',
|
|
86
|
+
description: 'LiveStore sync backend implementation using Cloudflare Workers & Durable Objects',
|
|
87
|
+
protocol: 'ws',
|
|
88
|
+
url: options.url,
|
|
89
|
+
},
|
|
43
90
|
};
|
|
44
91
|
return api;
|
|
45
92
|
});
|
|
@@ -51,17 +98,19 @@ const connect = (wsUrl) => Effect.gen(function* () {
|
|
|
51
98
|
const send = (message) => Effect.gen(function* () {
|
|
52
99
|
// Wait first until we're online
|
|
53
100
|
yield* waitUntilOnline;
|
|
54
|
-
yield* Effect.spanEvent(`Sending message: ${message._tag}`, message._tag === 'WSMessage.PushReq'
|
|
55
|
-
? {
|
|
56
|
-
id: message.batch[0].id,
|
|
57
|
-
parentId: message.batch[0].parentId,
|
|
58
|
-
batchLength: message.batch.length,
|
|
59
|
-
}
|
|
60
|
-
: message._tag === 'WSMessage.PullReq'
|
|
61
|
-
? { cursor: message.cursor ?? '-' }
|
|
62
|
-
: {});
|
|
63
101
|
// TODO use MsgPack instead of JSON to speed up the serialization / reduce the size of the messages
|
|
64
102
|
socketRef.current.send(Schema.encodeSync(Schema.parseJson(WSMessage.Message))(message));
|
|
103
|
+
if (LS_DEV) {
|
|
104
|
+
yield* Effect.spanEvent(`Sent message: ${message._tag}`, message._tag === 'WSMessage.PushReq'
|
|
105
|
+
? {
|
|
106
|
+
seqNum: message.batch[0].seqNum,
|
|
107
|
+
parentSeqNum: message.batch[0].parentSeqNum,
|
|
108
|
+
batchLength: message.batch.length,
|
|
109
|
+
}
|
|
110
|
+
: message._tag === 'WSMessage.PullReq'
|
|
111
|
+
? { cursor: message.cursor ?? '-' }
|
|
112
|
+
: {});
|
|
113
|
+
}
|
|
65
114
|
});
|
|
66
115
|
const innerConnect = Effect.gen(function* () {
|
|
67
116
|
// If the browser already tells us we're offline, then we'll at least wait until the browser
|
|
@@ -69,10 +118,12 @@ const connect = (wsUrl) => Effect.gen(function* () {
|
|
|
69
118
|
while (typeof navigator !== 'undefined' && navigator.onLine === false) {
|
|
70
119
|
yield* Effect.sleep(1000);
|
|
71
120
|
}
|
|
121
|
+
// TODO bring this back in a cross-platform way
|
|
72
122
|
// if (navigator.onLine === false) {
|
|
73
123
|
// yield* Effect.async((cb) => self.addEventListener('online', () => cb(Effect.void)))
|
|
74
124
|
// }
|
|
75
125
|
const socket = yield* WebSocket.makeWebSocket({ url: wsUrl, reconnect: Schedule.exponential(100) });
|
|
126
|
+
// socket.binaryType = 'arraybuffer'
|
|
76
127
|
yield* SubscriptionRef.set(isConnected, true);
|
|
77
128
|
socketRef.current = socket;
|
|
78
129
|
const connectionClosed = yield* Deferred.make();
|
|
@@ -101,7 +152,8 @@ const connect = (wsUrl) => Effect.gen(function* () {
|
|
|
101
152
|
// NOTE it seems that this callback doesn't work reliably on a worker but only via `window.addEventListener`
|
|
102
153
|
// We might need to proxy the event from the main thread to the worker if we want this to work reliably.
|
|
103
154
|
// eslint-disable-next-line unicorn/prefer-global-this
|
|
104
|
-
if (typeof self !== 'undefined') {
|
|
155
|
+
if (typeof self !== 'undefined' && typeof self.addEventListener === 'function') {
|
|
156
|
+
// TODO support an Expo equivalent for this
|
|
105
157
|
// eslint-disable-next-line unicorn/prefer-global-this
|
|
106
158
|
yield* Effect.eventListener(self, 'offline', () => Deferred.succeed(connectionClosed, void 0));
|
|
107
159
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ws-impl.js","sourceRoot":"","sources":["../../src/sync-impl/ws-impl.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAG3B,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"ws-impl.js","sourceRoot":"","sources":["../../src/sync-impl/ws-impl.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAG3B,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACvF,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAC5D,OAAO,EACL,QAAQ,EACR,MAAM,EACN,MAAM,EACN,MAAM,EACN,KAAK,EACL,QAAQ,EACR,MAAM,EACN,MAAM,EACN,eAAe,EACf,SAAS,EACT,SAAS,GACV,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAEhD,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAOhE,MAAM,CAAC,MAAM,UAAU,GACrB,CAAC,OAAsB,EAAwC,EAAE,CACjE,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,CACvB,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,MAAM,aAAa,GAAG,KAAK,CAAC,CAAC,MAAM,CAAC,MAAM,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0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"exports": {
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@livestore/common": "0.3.
|
|
18
|
-
"@livestore/utils": "0.3.
|
|
17
|
+
"@livestore/common": "0.3.1-dev.0",
|
|
18
|
+
"@livestore/utils": "0.3.1-dev.0"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@cloudflare/workers-types": "^4.
|
|
21
|
+
"@cloudflare/workers-types": "^4.20250303.0"
|
|
22
22
|
},
|
|
23
23
|
"files": [
|
|
24
24
|
"dist",
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"package.json",
|
|
27
27
|
"README.md"
|
|
28
28
|
],
|
|
29
|
+
"license": "Apache-2.0",
|
|
29
30
|
"publishConfig": {
|
|
30
31
|
"access": "public"
|
|
31
32
|
},
|