@livestore/adapter-web 0.0.0-snapshot-a953343ad2d7468c6573bcb5e26f0eab4302078f
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/.eslintrc.cjs +6 -0
- package/README.md +12 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/common/connection.d.ts +7 -0
- package/dist/common/connection.d.ts.map +1 -0
- package/dist/common/connection.js +25 -0
- package/dist/common/connection.js.map +1 -0
- package/dist/devtools-bridge/background-browser-channel.d.ts +9 -0
- package/dist/devtools-bridge/background-browser-channel.d.ts.map +1 -0
- package/dist/devtools-bridge/background-browser-channel.js +31 -0
- package/dist/devtools-bridge/background-browser-channel.js.map +1 -0
- package/dist/devtools-bridge/background-message.d.ts +75 -0
- package/dist/devtools-bridge/background-message.d.ts.map +1 -0
- package/dist/devtools-bridge/background-message.js +53 -0
- package/dist/devtools-bridge/background-message.js.map +1 -0
- package/dist/devtools-bridge/bridge-shared.d.ts +14 -0
- package/dist/devtools-bridge/bridge-shared.d.ts.map +1 -0
- package/dist/devtools-bridge/bridge-shared.js +67 -0
- package/dist/devtools-bridge/bridge-shared.js.map +1 -0
- package/dist/devtools-bridge/browser-extension-bridge.d.ts +3 -0
- package/dist/devtools-bridge/browser-extension-bridge.d.ts.map +1 -0
- package/dist/devtools-bridge/browser-extension-bridge.js +59 -0
- package/dist/devtools-bridge/browser-extension-bridge.js.map +1 -0
- package/dist/devtools-bridge/iframe-message.d.ts +16 -0
- package/dist/devtools-bridge/iframe-message.d.ts.map +1 -0
- package/dist/devtools-bridge/iframe-message.js +11 -0
- package/dist/devtools-bridge/iframe-message.js.map +1 -0
- package/dist/devtools-bridge/index.d.ts +6 -0
- package/dist/devtools-bridge/index.d.ts.map +1 -0
- package/dist/devtools-bridge/index.js +5 -0
- package/dist/devtools-bridge/index.js.map +1 -0
- package/dist/devtools-bridge/web-bridge.d.ts +31 -0
- package/dist/devtools-bridge/web-bridge.d.ts.map +1 -0
- package/dist/devtools-bridge/web-bridge.js +131 -0
- package/dist/devtools-bridge/web-bridge.js.map +1 -0
- package/dist/in-memory/index.d.ts +4 -0
- package/dist/in-memory/index.d.ts.map +1 -0
- package/dist/in-memory/index.js +50 -0
- package/dist/in-memory/index.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/opfs-utils.d.ts +5 -0
- package/dist/opfs-utils.d.ts.map +1 -0
- package/dist/opfs-utils.js +43 -0
- package/dist/opfs-utils.js.map +1 -0
- package/dist/web-worker/client-session/client-session-devtools.d.ts +7 -0
- package/dist/web-worker/client-session/client-session-devtools.d.ts.map +1 -0
- package/dist/web-worker/client-session/client-session-devtools.js +107 -0
- package/dist/web-worker/client-session/client-session-devtools.js.map +1 -0
- package/dist/web-worker/client-session/index.d.ts +41 -0
- package/dist/web-worker/client-session/index.d.ts.map +1 -0
- package/dist/web-worker/client-session/index.js +299 -0
- package/dist/web-worker/client-session/index.js.map +1 -0
- package/dist/web-worker/client-session/trim-batch.d.ts +4 -0
- package/dist/web-worker/client-session/trim-batch.d.ts.map +1 -0
- package/dist/web-worker/client-session/trim-batch.js +13 -0
- package/dist/web-worker/client-session/trim-batch.js.map +1 -0
- package/dist/web-worker/client-session/trim-batch.test.d.ts +2 -0
- package/dist/web-worker/client-session/trim-batch.test.d.ts.map +1 -0
- package/dist/web-worker/client-session/trim-batch.test.js +38 -0
- package/dist/web-worker/client-session/trim-batch.test.js.map +1 -0
- package/dist/web-worker/common/persisted-sqlite.d.ts +23 -0
- package/dist/web-worker/common/persisted-sqlite.d.ts.map +1 -0
- package/dist/web-worker/common/persisted-sqlite.js +92 -0
- package/dist/web-worker/common/persisted-sqlite.js.map +1 -0
- package/dist/web-worker/common/shutdown-channel.d.ts +7 -0
- package/dist/web-worker/common/shutdown-channel.d.ts.map +1 -0
- package/dist/web-worker/common/shutdown-channel.js +7 -0
- package/dist/web-worker/common/shutdown-channel.js.map +1 -0
- package/dist/web-worker/common/worker-schema.d.ts +226 -0
- package/dist/web-worker/common/worker-schema.d.ts.map +1 -0
- package/dist/web-worker/common/worker-schema.js +176 -0
- package/dist/web-worker/common/worker-schema.js.map +1 -0
- package/dist/web-worker/leader-worker/make-leader-worker.d.ts +15 -0
- package/dist/web-worker/leader-worker/make-leader-worker.d.ts.map +1 -0
- package/dist/web-worker/leader-worker/make-leader-worker.js +144 -0
- package/dist/web-worker/leader-worker/make-leader-worker.js.map +1 -0
- package/dist/web-worker/shared-worker/make-shared-worker.d.ts +2 -0
- package/dist/web-worker/shared-worker/make-shared-worker.d.ts.map +1 -0
- package/dist/web-worker/shared-worker/make-shared-worker.js +160 -0
- package/dist/web-worker/shared-worker/make-shared-worker.js.map +1 -0
- package/dist/web-worker/vite-dev-polyfill.d.ts +2 -0
- package/dist/web-worker/vite-dev-polyfill.d.ts.map +1 -0
- package/dist/web-worker/vite-dev-polyfill.js +37 -0
- package/dist/web-worker/vite-dev-polyfill.js.map +1 -0
- package/package.json +78 -0
- package/src/common/connection.ts +32 -0
- package/src/devtools-bridge/background-browser-channel.ts +57 -0
- package/src/devtools-bridge/background-message.ts +42 -0
- package/src/devtools-bridge/bridge-shared.ts +97 -0
- package/src/devtools-bridge/browser-extension-bridge.ts +64 -0
- package/src/devtools-bridge/iframe-message.ts +9 -0
- package/src/devtools-bridge/index.ts +9 -0
- package/src/devtools-bridge/web-bridge.ts +169 -0
- package/src/in-memory/index.ts +66 -0
- package/src/index.ts +3 -0
- package/src/opfs-utils.ts +61 -0
- package/src/web-worker/ambient.d.ts +37 -0
- package/src/web-worker/client-session/client-session-devtools.ts +167 -0
- package/src/web-worker/client-session/index.ts +537 -0
- package/src/web-worker/client-session/trim-batch.test.ts +48 -0
- package/src/web-worker/client-session/trim-batch.ts +15 -0
- package/src/web-worker/common/persisted-sqlite.ts +136 -0
- package/src/web-worker/common/shutdown-channel.ts +8 -0
- package/src/web-worker/common/worker-schema.ts +206 -0
- package/src/web-worker/leader-worker/make-leader-worker.ts +276 -0
- package/src/web-worker/shared-worker/make-shared-worker.ts +300 -0
- package/src/web-worker/vite-dev-polyfill.ts +36 -0
- package/tsconfig.json +17 -0
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { Devtools, InvalidPushError, SyncState, UnexpectedError } from '@livestore/common';
|
|
2
|
+
import * as WebMeshWorker from '@livestore/devtools-web-common/worker';
|
|
3
|
+
import { Schema } from '@livestore/utils/effect';
|
|
4
|
+
export declare const StorageTypeOpfs: Schema.Struct<{
|
|
5
|
+
type: Schema.Literal<["opfs"]>;
|
|
6
|
+
/**
|
|
7
|
+
* Default is `livestore-${storeId}`
|
|
8
|
+
*
|
|
9
|
+
* When providing this option, make sure to include the `storeId` in the path to avoid
|
|
10
|
+
* conflicts with other LiveStore apps.
|
|
11
|
+
*/
|
|
12
|
+
directory: Schema.optional<typeof Schema.String>;
|
|
13
|
+
}>;
|
|
14
|
+
export type StorageTypeOpfs = typeof StorageTypeOpfs.Type;
|
|
15
|
+
export declare const StorageType: Schema.Struct<{
|
|
16
|
+
type: Schema.Literal<["opfs"]>;
|
|
17
|
+
/**
|
|
18
|
+
* Default is `livestore-${storeId}`
|
|
19
|
+
*
|
|
20
|
+
* When providing this option, make sure to include the `storeId` in the path to avoid
|
|
21
|
+
* conflicts with other LiveStore apps.
|
|
22
|
+
*/
|
|
23
|
+
directory: Schema.optional<typeof Schema.String>;
|
|
24
|
+
}>;
|
|
25
|
+
export type StorageType = typeof StorageType.Type;
|
|
26
|
+
export type StorageTypeEncoded = typeof StorageType.Encoded;
|
|
27
|
+
export declare const SyncBackendOptions: Schema.Record$<typeof Schema.String, Schema.Schema<Schema.JsonValue, Schema.JsonValue, never>>;
|
|
28
|
+
export type SyncBackendOptions = Record<string, Schema.JsonValue>;
|
|
29
|
+
export declare namespace LeaderWorkerOuter {
|
|
30
|
+
const InitialMessage_base: Schema.TaggedRequestClass<InitialMessage, "InitialMessage", {
|
|
31
|
+
readonly _tag: Schema.tag<"InitialMessage">;
|
|
32
|
+
} & {
|
|
33
|
+
port: Schema.Schema<MessagePort, MessagePort, never>;
|
|
34
|
+
storeId: typeof Schema.String;
|
|
35
|
+
clientId: typeof Schema.String;
|
|
36
|
+
}, typeof Schema.Void, typeof UnexpectedError>;
|
|
37
|
+
export class InitialMessage extends InitialMessage_base {
|
|
38
|
+
}
|
|
39
|
+
const Request_base: typeof InitialMessage;
|
|
40
|
+
export class Request extends Request_base {
|
|
41
|
+
}
|
|
42
|
+
export {};
|
|
43
|
+
}
|
|
44
|
+
export declare namespace LeaderWorkerInner {
|
|
45
|
+
const InitialMessage_base_1: Schema.TaggedRequestClass<InitialMessage, "InitialMessage", {
|
|
46
|
+
readonly _tag: Schema.tag<"InitialMessage">;
|
|
47
|
+
} & {
|
|
48
|
+
storageOptions: Schema.Struct<{
|
|
49
|
+
type: Schema.Literal<["opfs"]>;
|
|
50
|
+
/**
|
|
51
|
+
* Default is `livestore-${storeId}`
|
|
52
|
+
*
|
|
53
|
+
* When providing this option, make sure to include the `storeId` in the path to avoid
|
|
54
|
+
* conflicts with other LiveStore apps.
|
|
55
|
+
*/
|
|
56
|
+
directory: Schema.optional<typeof Schema.String>;
|
|
57
|
+
}>;
|
|
58
|
+
devtoolsEnabled: typeof Schema.Boolean;
|
|
59
|
+
storeId: typeof Schema.String;
|
|
60
|
+
clientId: typeof Schema.String;
|
|
61
|
+
debugInstanceId: typeof Schema.String;
|
|
62
|
+
}, typeof Schema.Void, typeof UnexpectedError>;
|
|
63
|
+
export class InitialMessage extends InitialMessage_base_1 {
|
|
64
|
+
}
|
|
65
|
+
const BootStatusStream_base: Schema.TaggedRequestClass<BootStatusStream, "BootStatusStream", {
|
|
66
|
+
readonly _tag: Schema.tag<"BootStatusStream">;
|
|
67
|
+
}, Schema.Union<[Schema.Struct<{
|
|
68
|
+
stage: Schema.Literal<["loading"]>;
|
|
69
|
+
}>, Schema.Struct<{
|
|
70
|
+
stage: Schema.Literal<["migrating"]>;
|
|
71
|
+
progress: Schema.Struct<{
|
|
72
|
+
done: typeof Schema.Number;
|
|
73
|
+
total: typeof Schema.Number;
|
|
74
|
+
}>;
|
|
75
|
+
}>, Schema.Struct<{
|
|
76
|
+
stage: Schema.Literal<["rehydrating"]>;
|
|
77
|
+
progress: Schema.Struct<{
|
|
78
|
+
done: typeof Schema.Number;
|
|
79
|
+
total: typeof Schema.Number;
|
|
80
|
+
}>;
|
|
81
|
+
}>, Schema.Struct<{
|
|
82
|
+
stage: Schema.Literal<["syncing"]>;
|
|
83
|
+
progress: Schema.Struct<{
|
|
84
|
+
done: typeof Schema.Number;
|
|
85
|
+
total: typeof Schema.Number;
|
|
86
|
+
}>;
|
|
87
|
+
}>, Schema.Struct<{
|
|
88
|
+
stage: Schema.Literal<["done"]>;
|
|
89
|
+
}>]>, typeof UnexpectedError>;
|
|
90
|
+
export class BootStatusStream extends BootStatusStream_base {
|
|
91
|
+
}
|
|
92
|
+
const PushToLeader_base: Schema.TaggedRequestClass<PushToLeader, "PushToLeader", {
|
|
93
|
+
readonly _tag: Schema.tag<"PushToLeader">;
|
|
94
|
+
} & {
|
|
95
|
+
batch: Schema.Array$<Schema.Struct<{
|
|
96
|
+
mutation: typeof Schema.String;
|
|
97
|
+
args: typeof Schema.Any;
|
|
98
|
+
id: Schema.Struct<{
|
|
99
|
+
global: Schema.BrandSchema<number & import("effect/Brand").Brand<"GlobalEventId">, number, never>;
|
|
100
|
+
client: Schema.BrandSchema<number & import("effect/Brand").Brand<"ClientEventId">, number, never>;
|
|
101
|
+
}>;
|
|
102
|
+
parentId: Schema.Struct<{
|
|
103
|
+
global: Schema.BrandSchema<number & import("effect/Brand").Brand<"GlobalEventId">, number, never>;
|
|
104
|
+
client: Schema.BrandSchema<number & import("effect/Brand").Brand<"ClientEventId">, number, never>;
|
|
105
|
+
}>;
|
|
106
|
+
clientId: typeof Schema.String;
|
|
107
|
+
sessionId: Schema.UndefinedOr<typeof Schema.String>;
|
|
108
|
+
}>>;
|
|
109
|
+
}, typeof Schema.Void, Schema.Union<[typeof UnexpectedError, typeof InvalidPushError]>>;
|
|
110
|
+
export class PushToLeader extends PushToLeader_base {
|
|
111
|
+
}
|
|
112
|
+
const PullStream_base: Schema.TaggedRequestClass<PullStream, "PullStream", {
|
|
113
|
+
readonly _tag: Schema.tag<"PullStream">;
|
|
114
|
+
} & {
|
|
115
|
+
cursor: Schema.Struct<{
|
|
116
|
+
global: Schema.BrandSchema<number & import("effect/Brand").Brand<"GlobalEventId">, number, never>;
|
|
117
|
+
client: Schema.BrandSchema<number & import("effect/Brand").Brand<"ClientEventId">, number, never>;
|
|
118
|
+
}>;
|
|
119
|
+
}, Schema.Struct<{
|
|
120
|
+
payload: Schema.Union<[typeof SyncState.PayloadUpstreamRebase, typeof SyncState.PayloadUpstreamAdvance]>;
|
|
121
|
+
remaining: typeof Schema.Number;
|
|
122
|
+
}>, typeof UnexpectedError>;
|
|
123
|
+
export class PullStream extends PullStream_base {
|
|
124
|
+
}
|
|
125
|
+
const Export_base: Schema.TaggedRequestClass<Export, "Export", {
|
|
126
|
+
readonly _tag: Schema.tag<"Export">;
|
|
127
|
+
}, Schema.Schema<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>, never>, typeof UnexpectedError>;
|
|
128
|
+
export class Export extends Export_base {
|
|
129
|
+
}
|
|
130
|
+
const ExportMutationlog_base: Schema.TaggedRequestClass<ExportMutationlog, "ExportMutationlog", {
|
|
131
|
+
readonly _tag: Schema.tag<"ExportMutationlog">;
|
|
132
|
+
}, Schema.Schema<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>, never>, typeof UnexpectedError>;
|
|
133
|
+
export class ExportMutationlog extends ExportMutationlog_base {
|
|
134
|
+
}
|
|
135
|
+
const GetRecreateSnapshot_base: Schema.TaggedRequestClass<GetRecreateSnapshot, "GetRecreateSnapshot", {
|
|
136
|
+
readonly _tag: Schema.tag<"GetRecreateSnapshot">;
|
|
137
|
+
}, Schema.Struct<{
|
|
138
|
+
snapshot: Schema.Schema<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>, never>;
|
|
139
|
+
migrationsReport: Schema.Struct<{
|
|
140
|
+
migrations: Schema.Array$<Schema.Struct<{
|
|
141
|
+
tableName: typeof Schema.String;
|
|
142
|
+
hashes: Schema.Struct<{
|
|
143
|
+
expected: typeof Schema.Number;
|
|
144
|
+
actual: Schema.optional<typeof Schema.Number>;
|
|
145
|
+
}>;
|
|
146
|
+
}>>;
|
|
147
|
+
}>;
|
|
148
|
+
}>, typeof UnexpectedError>;
|
|
149
|
+
export class GetRecreateSnapshot extends GetRecreateSnapshot_base {
|
|
150
|
+
}
|
|
151
|
+
const GetLeaderHead_base: Schema.TaggedRequestClass<GetLeaderHead, "GetLeaderHead", {
|
|
152
|
+
readonly _tag: Schema.tag<"GetLeaderHead">;
|
|
153
|
+
}, Schema.Struct<{
|
|
154
|
+
global: Schema.BrandSchema<number & import("effect/Brand").Brand<"GlobalEventId">, number, never>;
|
|
155
|
+
client: Schema.BrandSchema<number & import("effect/Brand").Brand<"ClientEventId">, number, never>;
|
|
156
|
+
}>, typeof UnexpectedError>;
|
|
157
|
+
export class GetLeaderHead extends GetLeaderHead_base {
|
|
158
|
+
}
|
|
159
|
+
const GetLeaderSyncState_base: Schema.TaggedRequestClass<GetLeaderSyncState, "GetLeaderSyncState", {
|
|
160
|
+
readonly _tag: Schema.tag<"GetLeaderSyncState">;
|
|
161
|
+
}, typeof SyncState.SyncState, typeof UnexpectedError>;
|
|
162
|
+
export class GetLeaderSyncState extends GetLeaderSyncState_base {
|
|
163
|
+
}
|
|
164
|
+
const NetworkStatusStream_base: Schema.TaggedRequestClass<NetworkStatusStream, "NetworkStatusStream", {
|
|
165
|
+
readonly _tag: Schema.tag<"NetworkStatusStream">;
|
|
166
|
+
}, Schema.Struct<{
|
|
167
|
+
isConnected: typeof Schema.Boolean;
|
|
168
|
+
timestampMs: typeof Schema.Number;
|
|
169
|
+
latchClosed: typeof Schema.Boolean;
|
|
170
|
+
}>, typeof UnexpectedError>;
|
|
171
|
+
export class NetworkStatusStream extends NetworkStatusStream_base {
|
|
172
|
+
}
|
|
173
|
+
const Shutdown_base: Schema.TaggedRequestClass<Shutdown, "Shutdown", {
|
|
174
|
+
readonly _tag: Schema.tag<"Shutdown">;
|
|
175
|
+
}, typeof Schema.Void, typeof UnexpectedError>;
|
|
176
|
+
export class Shutdown extends Shutdown_base {
|
|
177
|
+
}
|
|
178
|
+
const ExtraDevtoolsMessage_base: Schema.TaggedRequestClass<ExtraDevtoolsMessage, "ExtraDevtoolsMessage", {
|
|
179
|
+
readonly _tag: Schema.tag<"ExtraDevtoolsMessage">;
|
|
180
|
+
} & {
|
|
181
|
+
message: Schema.Union<[typeof Devtools.Leader.SnapshotReq, typeof Devtools.Leader.LoadDatabaseFileReq, typeof Devtools.Leader.MutationLogReq, Schema.TaggedStruct<"LSD.Leader.ResetAllData.Request", {
|
|
182
|
+
mode: Schema.Literal<["all-data", "only-app-db"]>;
|
|
183
|
+
} & {
|
|
184
|
+
readonly requestId: typeof Schema.String;
|
|
185
|
+
readonly liveStoreVersion: typeof Devtools.liveStoreVersion;
|
|
186
|
+
readonly clientId: typeof Schema.String;
|
|
187
|
+
}>, typeof Devtools.Leader.NetworkStatusSubscribe, typeof Devtools.Leader.NetworkStatusUnsubscribe, typeof Devtools.Leader.Disconnect, typeof Devtools.Leader.RunMutationReq, typeof Devtools.Leader.Ping, typeof Devtools.Leader.DatabaseFileInfoReq, typeof Devtools.Leader.SyncHistorySubscribe, typeof Devtools.Leader.SyncHistoryUnsubscribe, typeof Devtools.Leader.SyncingInfoReq, typeof Devtools.Leader.SyncHeadSubscribe, typeof Devtools.Leader.SyncHeadUnsubscribe, Schema.TaggedStruct<"LSD.Leader.SetSyncLatch.Request", {
|
|
188
|
+
closeLatch: typeof Schema.Boolean;
|
|
189
|
+
} & {
|
|
190
|
+
readonly requestId: typeof Schema.String;
|
|
191
|
+
readonly liveStoreVersion: typeof Devtools.liveStoreVersion;
|
|
192
|
+
readonly clientId: typeof Schema.String;
|
|
193
|
+
}>]>;
|
|
194
|
+
}, typeof Schema.Void, typeof UnexpectedError>;
|
|
195
|
+
export class ExtraDevtoolsMessage extends ExtraDevtoolsMessage_base {
|
|
196
|
+
}
|
|
197
|
+
export const Request: Schema.Union<[typeof InitialMessage, typeof BootStatusStream, typeof PushToLeader, typeof PullStream, typeof Export, typeof ExportMutationlog, typeof GetRecreateSnapshot, typeof GetLeaderHead, typeof GetLeaderSyncState, typeof NetworkStatusStream, typeof Shutdown, typeof ExtraDevtoolsMessage, typeof WebMeshWorker.Schema.CreateConnection]>;
|
|
198
|
+
export type Request = typeof Request.Type;
|
|
199
|
+
export {};
|
|
200
|
+
}
|
|
201
|
+
export declare namespace SharedWorker {
|
|
202
|
+
const InitialMessagePayloadFromClientSession_base: Schema.TaggedStruct<"FromClientSession", {
|
|
203
|
+
initialMessage: typeof LeaderWorkerInner.InitialMessage;
|
|
204
|
+
}>;
|
|
205
|
+
export class InitialMessagePayloadFromClientSession extends InitialMessagePayloadFromClientSession_base {
|
|
206
|
+
}
|
|
207
|
+
const InitialMessage_base_2: Schema.TaggedRequestClass<InitialMessage, "InitialMessage", {
|
|
208
|
+
readonly _tag: Schema.tag<"InitialMessage">;
|
|
209
|
+
} & {
|
|
210
|
+
payload: Schema.Union<[typeof InitialMessagePayloadFromClientSession, Schema.TaggedStruct<"FromWebBridge", {}>]>;
|
|
211
|
+
}, typeof Schema.Void, typeof UnexpectedError>;
|
|
212
|
+
export class InitialMessage extends InitialMessage_base_2 {
|
|
213
|
+
}
|
|
214
|
+
const UpdateMessagePort_base: Schema.TaggedRequestClass<UpdateMessagePort, "UpdateMessagePort", {
|
|
215
|
+
readonly _tag: Schema.tag<"UpdateMessagePort">;
|
|
216
|
+
} & {
|
|
217
|
+
port: Schema.Schema<MessagePort, MessagePort, never>;
|
|
218
|
+
}, typeof Schema.Void, typeof UnexpectedError>;
|
|
219
|
+
export class UpdateMessagePort extends UpdateMessagePort_base {
|
|
220
|
+
}
|
|
221
|
+
const Request_base_1: Schema.Union<[typeof InitialMessage, typeof UpdateMessagePort, typeof LeaderWorkerInner.BootStatusStream, typeof LeaderWorkerInner.PushToLeader, typeof LeaderWorkerInner.PullStream, typeof LeaderWorkerInner.Export, typeof LeaderWorkerInner.GetRecreateSnapshot, typeof LeaderWorkerInner.ExportMutationlog, typeof LeaderWorkerInner.GetLeaderHead, typeof LeaderWorkerInner.GetLeaderSyncState, typeof LeaderWorkerInner.NetworkStatusStream, typeof LeaderWorkerInner.Shutdown, typeof LeaderWorkerInner.ExtraDevtoolsMessage, typeof WebMeshWorker.Schema.CreateConnection]>;
|
|
222
|
+
export class Request extends Request_base_1 {
|
|
223
|
+
}
|
|
224
|
+
export {};
|
|
225
|
+
}
|
|
226
|
+
//# sourceMappingURL=worker-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker-schema.d.ts","sourceRoot":"","sources":["../../../src/web-worker/common/worker-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,QAAQ,EACR,gBAAgB,EAGhB,SAAS,EACT,eAAe,EAChB,MAAM,mBAAmB,CAAA;AAE1B,OAAO,KAAK,aAAa,MAAM,uCAAuC,CAAA;AACtE,OAAO,EAAE,MAAM,EAAgB,MAAM,yBAAyB,CAAA;AAE9D,eAAO,MAAM,eAAe;;IAE1B;;;;;OAKG;;EAEH,CAAA;AAEF,MAAM,MAAM,eAAe,GAAG,OAAO,eAAe,CAAC,IAAI,CAAA;AAUzD,eAAO,MAAM,WAAW;;IAnBtB;;;;;OAKG;;EAiBJ,CAAA;AACD,MAAM,MAAM,WAAW,GAAG,OAAO,WAAW,CAAC,IAAI,CAAA;AACjD,MAAM,MAAM,kBAAkB,GAAG,OAAO,WAAW,CAAC,OAAO,CAAA;AAG3D,eAAO,MAAM,kBAAkB,gGAAiE,CAAA;AAChG,MAAM,MAAM,kBAAkB,GA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AAC,OAAO,MAAM;kCAA4B,OAAQ,MAAM;wBAAiB,OAAQ,MAAM;qCAA+B,OAAQ,MAAM;4BAAqB,OAAQ,QAAQ,QAAO,OAAQ,MAAM;;;;;IApG/tH,MAAM,OAAO,mBAAoB,SAAQ,wBAOvC;KAAG;;;;gBAlFgB,OAAQ,WAAW;gBAG/B,OAAQ,WAAW;;IAiF5B,MAAM,OAAO,aAAc,SAAQ,kBAIjC;KAAG;;;;IAEL,MAAM,OAAO,kBAAmB,SAAQ,uBAItC;KAAG;;;;4BAgBmB,OAAQ,OAAO;4BAE3B,OAAQ,MACpB;4BAMS,OACP,OAAI;;IAxBN,MAAM,OAAO,mBAAoB,SAAQ,wBAIvC;KAAG;;;;IAEL,MAAM,OAAO,QAAS,SAAQ,aAI5B;KAAG;;;;;kBAqEs+N,OAAQ,OAAO;;uCAAmE,OAAQ,MAAM;;sCAAuF,OAAQ,MAAM;;+BAAiX,OAAQ,OAAO;;uCAAsC,OAAQ,MAAM;;sCAAuF,OAAQ,MAAM;;;IAnEzsP,MAAM,OAAO,oBAAqB,SAAQ,yBAMxC;KAAG;IAEL,MAAM,CAAC,MAAM,OAAO,sVAcnB,CAAA;IACD,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,CAAC,IAAI,CAAA;;CAC1C;AAED,yBAAiB,YAAY,CAAC;;;;IAC5B,MAAM,OAAO,sCAAuC,SAAQ,2CAE1D;KAAG;;;;;;IAEL,MAAM,OAAO,cAAe,SAAQ,qBAMlC;KAAG;;;;;;IAEL,MAAM,OAAO,iBAAkB,SAAQ,sBAMrC;KAAG;;IAEL,MAAM,OAAO,OAAQ,SAAQ,cAkB5B;KAAG;;CACL"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { BootStatus, Devtools, InvalidPushError, MigrationsReport, NetworkStatus, SyncState, UnexpectedError, } from '@livestore/common';
|
|
2
|
+
import { EventId, MutationEvent } from '@livestore/common/schema';
|
|
3
|
+
import * as WebMeshWorker from '@livestore/devtools-web-common/worker';
|
|
4
|
+
import { Schema, Transferable } from '@livestore/utils/effect';
|
|
5
|
+
export const StorageTypeOpfs = Schema.Struct({
|
|
6
|
+
type: Schema.Literal('opfs'),
|
|
7
|
+
/**
|
|
8
|
+
* Default is `livestore-${storeId}`
|
|
9
|
+
*
|
|
10
|
+
* When providing this option, make sure to include the `storeId` in the path to avoid
|
|
11
|
+
* conflicts with other LiveStore apps.
|
|
12
|
+
*/
|
|
13
|
+
directory: Schema.optional(Schema.String),
|
|
14
|
+
});
|
|
15
|
+
// export const StorageTypeIndexeddb = Schema.Struct({
|
|
16
|
+
// type: Schema.Literal('indexeddb'),
|
|
17
|
+
// /** @default "livestore" */
|
|
18
|
+
// databaseName: Schema.optionalWith(Schema.String, { default: () => 'livestore' }),
|
|
19
|
+
// /** @default "livestore-" */
|
|
20
|
+
// storeNamePrefix: Schema.optionalWith(Schema.String, { default: () => 'livestore-' }),
|
|
21
|
+
// })
|
|
22
|
+
export const StorageType = Schema.Union(StorageTypeOpfs);
|
|
23
|
+
// export const SyncBackendOptions = Schema.Union(SyncBackendOptionsWebsocket)
|
|
24
|
+
export const SyncBackendOptions = Schema.Record({ key: Schema.String, value: Schema.JsonValue });
|
|
25
|
+
export var LeaderWorkerOuter;
|
|
26
|
+
(function (LeaderWorkerOuter) {
|
|
27
|
+
class InitialMessage extends Schema.TaggedRequest()('InitialMessage', {
|
|
28
|
+
payload: { port: Transferable.MessagePort, storeId: Schema.String, clientId: Schema.String },
|
|
29
|
+
success: Schema.Void,
|
|
30
|
+
failure: UnexpectedError,
|
|
31
|
+
}) {
|
|
32
|
+
}
|
|
33
|
+
LeaderWorkerOuter.InitialMessage = InitialMessage;
|
|
34
|
+
class Request extends Schema.Union(InitialMessage) {
|
|
35
|
+
}
|
|
36
|
+
LeaderWorkerOuter.Request = Request;
|
|
37
|
+
})(LeaderWorkerOuter || (LeaderWorkerOuter = {}));
|
|
38
|
+
// TODO unify this code with schema from node adapter
|
|
39
|
+
export var LeaderWorkerInner;
|
|
40
|
+
(function (LeaderWorkerInner) {
|
|
41
|
+
class InitialMessage extends Schema.TaggedRequest()('InitialMessage', {
|
|
42
|
+
payload: {
|
|
43
|
+
storageOptions: StorageType,
|
|
44
|
+
devtoolsEnabled: Schema.Boolean,
|
|
45
|
+
storeId: Schema.String,
|
|
46
|
+
clientId: Schema.String,
|
|
47
|
+
debugInstanceId: Schema.String,
|
|
48
|
+
},
|
|
49
|
+
success: Schema.Void,
|
|
50
|
+
failure: UnexpectedError,
|
|
51
|
+
}) {
|
|
52
|
+
}
|
|
53
|
+
LeaderWorkerInner.InitialMessage = InitialMessage;
|
|
54
|
+
class BootStatusStream extends Schema.TaggedRequest()('BootStatusStream', {
|
|
55
|
+
payload: {},
|
|
56
|
+
success: BootStatus,
|
|
57
|
+
failure: UnexpectedError,
|
|
58
|
+
}) {
|
|
59
|
+
}
|
|
60
|
+
LeaderWorkerInner.BootStatusStream = BootStatusStream;
|
|
61
|
+
class PushToLeader extends Schema.TaggedRequest()('PushToLeader', {
|
|
62
|
+
payload: {
|
|
63
|
+
batch: Schema.Array(MutationEvent.AnyEncoded),
|
|
64
|
+
},
|
|
65
|
+
success: Schema.Void,
|
|
66
|
+
failure: Schema.Union(UnexpectedError, InvalidPushError),
|
|
67
|
+
}) {
|
|
68
|
+
}
|
|
69
|
+
LeaderWorkerInner.PushToLeader = PushToLeader;
|
|
70
|
+
class PullStream extends Schema.TaggedRequest()('PullStream', {
|
|
71
|
+
payload: {
|
|
72
|
+
cursor: EventId.EventId,
|
|
73
|
+
},
|
|
74
|
+
success: Schema.Struct({
|
|
75
|
+
payload: SyncState.PayloadUpstream,
|
|
76
|
+
remaining: Schema.Number,
|
|
77
|
+
}),
|
|
78
|
+
failure: UnexpectedError,
|
|
79
|
+
}) {
|
|
80
|
+
}
|
|
81
|
+
LeaderWorkerInner.PullStream = PullStream;
|
|
82
|
+
class Export extends Schema.TaggedRequest()('Export', {
|
|
83
|
+
payload: {},
|
|
84
|
+
success: Transferable.Uint8Array,
|
|
85
|
+
failure: UnexpectedError,
|
|
86
|
+
}) {
|
|
87
|
+
}
|
|
88
|
+
LeaderWorkerInner.Export = Export;
|
|
89
|
+
class ExportMutationlog extends Schema.TaggedRequest()('ExportMutationlog', {
|
|
90
|
+
payload: {},
|
|
91
|
+
success: Transferable.Uint8Array,
|
|
92
|
+
failure: UnexpectedError,
|
|
93
|
+
}) {
|
|
94
|
+
}
|
|
95
|
+
LeaderWorkerInner.ExportMutationlog = ExportMutationlog;
|
|
96
|
+
class GetRecreateSnapshot extends Schema.TaggedRequest()('GetRecreateSnapshot', {
|
|
97
|
+
payload: {},
|
|
98
|
+
success: Schema.Struct({
|
|
99
|
+
snapshot: Transferable.Uint8Array,
|
|
100
|
+
migrationsReport: MigrationsReport,
|
|
101
|
+
}),
|
|
102
|
+
failure: UnexpectedError,
|
|
103
|
+
}) {
|
|
104
|
+
}
|
|
105
|
+
LeaderWorkerInner.GetRecreateSnapshot = GetRecreateSnapshot;
|
|
106
|
+
class GetLeaderHead extends Schema.TaggedRequest()('GetLeaderHead', {
|
|
107
|
+
payload: {},
|
|
108
|
+
success: EventId.EventId,
|
|
109
|
+
failure: UnexpectedError,
|
|
110
|
+
}) {
|
|
111
|
+
}
|
|
112
|
+
LeaderWorkerInner.GetLeaderHead = GetLeaderHead;
|
|
113
|
+
class GetLeaderSyncState extends Schema.TaggedRequest()('GetLeaderSyncState', {
|
|
114
|
+
payload: {},
|
|
115
|
+
success: SyncState.SyncState,
|
|
116
|
+
failure: UnexpectedError,
|
|
117
|
+
}) {
|
|
118
|
+
}
|
|
119
|
+
LeaderWorkerInner.GetLeaderSyncState = GetLeaderSyncState;
|
|
120
|
+
class NetworkStatusStream extends Schema.TaggedRequest()('NetworkStatusStream', {
|
|
121
|
+
payload: {},
|
|
122
|
+
success: NetworkStatus,
|
|
123
|
+
failure: UnexpectedError,
|
|
124
|
+
}) {
|
|
125
|
+
}
|
|
126
|
+
LeaderWorkerInner.NetworkStatusStream = NetworkStatusStream;
|
|
127
|
+
class Shutdown extends Schema.TaggedRequest()('Shutdown', {
|
|
128
|
+
payload: {},
|
|
129
|
+
success: Schema.Void,
|
|
130
|
+
failure: UnexpectedError,
|
|
131
|
+
}) {
|
|
132
|
+
}
|
|
133
|
+
LeaderWorkerInner.Shutdown = Shutdown;
|
|
134
|
+
class ExtraDevtoolsMessage extends Schema.TaggedRequest()('ExtraDevtoolsMessage', {
|
|
135
|
+
payload: {
|
|
136
|
+
message: Devtools.Leader.MessageToApp,
|
|
137
|
+
},
|
|
138
|
+
success: Schema.Void,
|
|
139
|
+
failure: UnexpectedError,
|
|
140
|
+
}) {
|
|
141
|
+
}
|
|
142
|
+
LeaderWorkerInner.ExtraDevtoolsMessage = ExtraDevtoolsMessage;
|
|
143
|
+
LeaderWorkerInner.Request = Schema.Union(InitialMessage, BootStatusStream, PushToLeader, PullStream, Export, ExportMutationlog, GetRecreateSnapshot, GetLeaderHead, GetLeaderSyncState, NetworkStatusStream, Shutdown, ExtraDevtoolsMessage, WebMeshWorker.Schema.CreateConnection);
|
|
144
|
+
})(LeaderWorkerInner || (LeaderWorkerInner = {}));
|
|
145
|
+
export var SharedWorker;
|
|
146
|
+
(function (SharedWorker) {
|
|
147
|
+
class InitialMessagePayloadFromClientSession extends Schema.TaggedStruct('FromClientSession', {
|
|
148
|
+
initialMessage: LeaderWorkerInner.InitialMessage,
|
|
149
|
+
}) {
|
|
150
|
+
}
|
|
151
|
+
SharedWorker.InitialMessagePayloadFromClientSession = InitialMessagePayloadFromClientSession;
|
|
152
|
+
class InitialMessage extends Schema.TaggedRequest()('InitialMessage', {
|
|
153
|
+
payload: {
|
|
154
|
+
payload: Schema.Union(InitialMessagePayloadFromClientSession, Schema.TaggedStruct('FromWebBridge', {})),
|
|
155
|
+
},
|
|
156
|
+
success: Schema.Void,
|
|
157
|
+
failure: UnexpectedError,
|
|
158
|
+
}) {
|
|
159
|
+
}
|
|
160
|
+
SharedWorker.InitialMessage = InitialMessage;
|
|
161
|
+
class UpdateMessagePort extends Schema.TaggedRequest()('UpdateMessagePort', {
|
|
162
|
+
payload: {
|
|
163
|
+
port: Transferable.MessagePort,
|
|
164
|
+
},
|
|
165
|
+
success: Schema.Void,
|
|
166
|
+
failure: UnexpectedError,
|
|
167
|
+
}) {
|
|
168
|
+
}
|
|
169
|
+
SharedWorker.UpdateMessagePort = UpdateMessagePort;
|
|
170
|
+
class Request extends Schema.Union(InitialMessage, UpdateMessagePort,
|
|
171
|
+
// Proxied requests
|
|
172
|
+
LeaderWorkerInner.BootStatusStream, LeaderWorkerInner.PushToLeader, LeaderWorkerInner.PullStream, LeaderWorkerInner.Export, LeaderWorkerInner.GetRecreateSnapshot, LeaderWorkerInner.ExportMutationlog, LeaderWorkerInner.GetLeaderHead, LeaderWorkerInner.GetLeaderSyncState, LeaderWorkerInner.NetworkStatusStream, LeaderWorkerInner.Shutdown, LeaderWorkerInner.ExtraDevtoolsMessage, WebMeshWorker.Schema.CreateConnection) {
|
|
173
|
+
}
|
|
174
|
+
SharedWorker.Request = Request;
|
|
175
|
+
})(SharedWorker || (SharedWorker = {}));
|
|
176
|
+
//# sourceMappingURL=worker-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker-schema.js","sourceRoot":"","sources":["../../../src/web-worker/common/worker-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,QAAQ,EACR,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,SAAS,EACT,eAAe,GAChB,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,KAAK,aAAa,MAAM,uCAAuC,CAAA;AACtE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAE9D,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC;IAC3C,IAAI,EAAE,MAAM,CAAC,OA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/B;QACD,OAAO,EAAE,MAAM,CAAC,IAAI;QACpB,OAAO,EAAE,eAAe;KACzB,CAAC;KAAG;IANQ,8BAAiB,oBAMzB,CAAA;IAEL,MAAa,OAAQ,SAAQ,MAAM,CAAC,KAAK,CACvC,cAAc,EACd,iBAAiB;IAEjB,mBAAmB;IACnB,iBAAiB,CAAC,gBAAgB,EAClC,iBAAiB,CAAC,YAAY,EAC9B,iBAAiB,CAAC,UAAU,EAC5B,iBAAiB,CAAC,MAAM,EACxB,iBAAiB,CAAC,mBAAmB,EACrC,iBAAiB,CAAC,iBAAiB,EACnC,iBAAiB,CAAC,aAAa,EAC/B,iBAAiB,CAAC,kBAAkB,EACpC,iBAAiB,CAAC,mBAAmB,EACrC,iBAAiB,CAAC,QAAQ,EAC1B,iBAAiB,CAAC,oBAAoB,EAEtC,aAAa,CAAC,MAAM,CAAC,gBAAgB,CACtC;KAAG;IAlBS,oBAAO,UAkBhB,CAAA;AACN,CAAC,EAxCgB,YAAY,KAAZ,YAAY,QAwC5B"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { SyncOptions } from '@livestore/common';
|
|
2
|
+
import type { LiveStoreSchema } from '@livestore/common/schema';
|
|
3
|
+
import type { WorkerError } from '@livestore/utils/effect';
|
|
4
|
+
import { Effect } from '@livestore/utils/effect';
|
|
5
|
+
import type * as otel from '@opentelemetry/api';
|
|
6
|
+
export type WorkerOptions = {
|
|
7
|
+
schema: LiveStoreSchema;
|
|
8
|
+
sync?: SyncOptions;
|
|
9
|
+
otelOptions?: {
|
|
10
|
+
tracer?: otel.Tracer;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export declare const makeWorker: (options: WorkerOptions) => void;
|
|
14
|
+
export declare const makeWorkerEffect: (options: WorkerOptions) => Effect.Effect<never, WorkerError.WorkerError, never>;
|
|
15
|
+
//# sourceMappingURL=make-leader-worker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"make-leader-worker.d.ts","sourceRoot":"","sources":["../../../src/web-worker/leader-worker/make-leader-worker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA2B,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAS7E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAO/D,OAAO,KAAK,EAAqB,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAC7E,OAAO,EAEL,MAAM,EAWP,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,KAAK,IAAI,MAAM,oBAAoB,CAAA;AAO/C,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,eAAe,CAAA;IACvB,IAAI,CAAC,EAAE,WAAW,CAAA;IAClB,WAAW,CAAC,EAAE;QACZ,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,CAAA;KACrB,CAAA;CACF,CAAA;AASD,eAAO,MAAM,UAAU,YAAa,aAAa,SAEhD,CAAA;AAED,eAAO,MAAM,gBAAgB,YAAa,aAAa,yDAyBtD,CAAA"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { Devtools, UnexpectedError } from '@livestore/common';
|
|
2
|
+
import { configureConnection, getClientHeadFromDb, LeaderThreadCtx, makeLeaderThreadLayer, } from '@livestore/common/leader-thread';
|
|
3
|
+
import { MutationEvent } from '@livestore/common/schema';
|
|
4
|
+
import { makeChannelForConnectedMeshNode } from '@livestore/devtools-web-common/web-channel';
|
|
5
|
+
import * as WebMeshWorker from '@livestore/devtools-web-common/worker';
|
|
6
|
+
import { sqliteDbFactory } from '@livestore/sqlite-wasm/browser';
|
|
7
|
+
import { loadSqlite3Wasm } from '@livestore/sqlite-wasm/load-wasm';
|
|
8
|
+
import { isDevEnv, LS_DEV } from '@livestore/utils';
|
|
9
|
+
import { BrowserWorkerRunner, Effect, FetchHttpClient, identity, Layer, Logger, LogLevel, OtelTracer, Scheduler, Stream, TaskTracing, WorkerRunner, } from '@livestore/utils/effect';
|
|
10
|
+
import * as OpfsUtils from '../../opfs-utils.js';
|
|
11
|
+
import { getAppDbFileName, sanitizeOpfsDir } from '../common/persisted-sqlite.js';
|
|
12
|
+
import { makeShutdownChannel } from '../common/shutdown-channel.js';
|
|
13
|
+
import * as WorkerSchema from '../common/worker-schema.js';
|
|
14
|
+
if (isDevEnv()) {
|
|
15
|
+
globalThis.__debugLiveStoreUtils = {
|
|
16
|
+
opfs: OpfsUtils,
|
|
17
|
+
blobUrl: (buffer) => URL.createObjectURL(new Blob([buffer], { type: 'application/octet-stream' })),
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export const makeWorker = (options) => {
|
|
21
|
+
makeWorkerEffect(options).pipe(Effect.runFork);
|
|
22
|
+
};
|
|
23
|
+
export const makeWorkerEffect = (options) => {
|
|
24
|
+
const TracingLive = options.otelOptions?.tracer
|
|
25
|
+
? Layer.unwrapEffect(Effect.map(OtelTracer.make, Layer.setTracer)).pipe(Layer.provideMerge(Layer.succeed(OtelTracer.OtelTracer, options.otelOptions.tracer)))
|
|
26
|
+
: undefined;
|
|
27
|
+
return makeWorkerRunnerOuter(options).pipe(Layer.provide(BrowserWorkerRunner.layer), Layer.launch, Effect.scoped, Effect.tapCauseLogPretty, Effect.annotateLogs({ thread: self.name }), Effect.provide(Logger.prettyWithThread(self.name)), Effect.provide(FetchHttpClient.layer), LS_DEV ? TaskTracing.withAsyncTaggingTracing((name) => console.createTask(name)) : identity, TracingLive ? Effect.provide(TracingLive) : identity,
|
|
28
|
+
// We're using this custom scheduler to improve op batching behaviour and reduce the overhead
|
|
29
|
+
// of the Effect fiber runtime given we have different tradeoffs on a worker thread.
|
|
30
|
+
// Despite the "message channel" name, is has nothing to do with the `incomingRequestsPort` above.
|
|
31
|
+
Effect.withScheduler(Scheduler.messageChannel()),
|
|
32
|
+
// We're increasing the Effect ops limit here to allow for larger chunks of operations at a time
|
|
33
|
+
Effect.withMaxOpsBeforeYield(4096), Logger.withMinimumLogLevel(LogLevel.Debug));
|
|
34
|
+
};
|
|
35
|
+
const makeWorkerRunnerOuter = (workerOptions) => WorkerRunner.layerSerialized(WorkerSchema.LeaderWorkerOuter.InitialMessage, {
|
|
36
|
+
// Port coming from client session and forwarded via the shared worker
|
|
37
|
+
InitialMessage: ({ port: incomingRequestsPort, storeId, clientId }) => Effect.gen(function* () {
|
|
38
|
+
yield* makeWorkerRunnerInner(workerOptions).pipe(Layer.provide(BrowserWorkerRunner.layerMessagePort(incomingRequestsPort)), Layer.launch, Effect.scoped, Effect.withSpan('@livestore/adapter-web:worker:wrapper:InitialMessage:innerFiber'), Effect.tapCauseLogPretty, Effect.provide(WebMeshWorker.CacheService.layer({ nodeName: `leader-${storeId}-${clientId}` })), Effect.forkScoped);
|
|
39
|
+
return Layer.empty;
|
|
40
|
+
}).pipe(Effect.withSpan('@livestore/adapter-web:worker:wrapper:InitialMessage'), Layer.unwrapScoped),
|
|
41
|
+
});
|
|
42
|
+
const makeWorkerRunnerInner = ({ schema, sync: syncOptions }) => WorkerRunner.layerSerialized(WorkerSchema.LeaderWorkerInner.Request, {
|
|
43
|
+
InitialMessage: ({ storageOptions, storeId, clientId, devtoolsEnabled, debugInstanceId }) => Effect.gen(function* () {
|
|
44
|
+
const sqlite3 = yield* Effect.promise(() => loadSqlite3Wasm());
|
|
45
|
+
const makeSqliteDb = sqliteDbFactory({ sqlite3 });
|
|
46
|
+
const runtime = yield* Effect.runtime();
|
|
47
|
+
const makeDb = (kind) => makeSqliteDb({
|
|
48
|
+
_tag: 'opfs',
|
|
49
|
+
opfsDirectory: sanitizeOpfsDir(storageOptions.directory, storeId),
|
|
50
|
+
fileName: kind === 'app' ? getAppDbFileName(schema) : 'mutationlog.db',
|
|
51
|
+
configureDb: (db) => configureConnection(db, {
|
|
52
|
+
// The persisted databases use the AccessHandlePoolVFS which always uses a single database connection.
|
|
53
|
+
// Multiple connections are not supported. This means that we can use the exclusive locking mode to
|
|
54
|
+
// avoid unnecessary system calls and enable the use of the WAL journal mode without the use of shared memory.
|
|
55
|
+
// TODO bring back exclusive locking mode when `WAL` is working properly
|
|
56
|
+
// lockingMode: 'EXCLUSIVE',
|
|
57
|
+
foreignKeys: true,
|
|
58
|
+
}).pipe(Effect.provide(runtime), Effect.runSync),
|
|
59
|
+
}).pipe(Effect.acquireRelease((db) => Effect.try(() => db.close()).pipe(Effect.ignoreLogged)));
|
|
60
|
+
// Might involve some async work, so we're running them concurrently
|
|
61
|
+
const [dbReadModel, dbMutationLog] = yield* Effect.all([makeDb('app'), makeDb('mutationlog')], {
|
|
62
|
+
concurrency: 2,
|
|
63
|
+
});
|
|
64
|
+
const devtoolsOptions = yield* makeDevtoolsOptions({ devtoolsEnabled, dbReadModel, dbMutationLog });
|
|
65
|
+
const shutdownChannel = yield* makeShutdownChannel(storeId);
|
|
66
|
+
return makeLeaderThreadLayer({
|
|
67
|
+
schema,
|
|
68
|
+
storeId,
|
|
69
|
+
clientId,
|
|
70
|
+
makeSqliteDb,
|
|
71
|
+
syncOptions,
|
|
72
|
+
dbReadModel,
|
|
73
|
+
dbMutationLog,
|
|
74
|
+
devtoolsOptions,
|
|
75
|
+
shutdownChannel,
|
|
76
|
+
});
|
|
77
|
+
}).pipe(Effect.tapCauseLogPretty, UnexpectedError.mapToUnexpectedError, Effect.withPerformanceMeasure('@livestore/adapter-web:worker:InitialMessage'), Effect.withSpan('@livestore/adapter-web:worker:InitialMessage'), Effect.annotateSpans({ debugInstanceId }), Layer.unwrapScoped),
|
|
78
|
+
GetRecreateSnapshot: () => Effect.gen(function* () {
|
|
79
|
+
const workerCtx = yield* LeaderThreadCtx;
|
|
80
|
+
// NOTE we can only return the cached snapshot once as it's transferred (i.e. disposed), so we need to set it to undefined
|
|
81
|
+
// const cachedSnapshot =
|
|
82
|
+
// result._tag === 'Recreate' ? yield* Ref.getAndSet(result.snapshotRef, undefined) : undefined
|
|
83
|
+
// return cachedSnapshot ?? workerCtx.db.export()
|
|
84
|
+
const snapshot = workerCtx.dbReadModel.export();
|
|
85
|
+
return { snapshot, migrationsReport: workerCtx.initialState.migrationsReport };
|
|
86
|
+
}).pipe(UnexpectedError.mapToUnexpectedError, Effect.withSpan('@livestore/adapter-web:worker:GetRecreateSnapshot')),
|
|
87
|
+
PullStream: ({ cursor }) => Effect.gen(function* () {
|
|
88
|
+
const { connectedClientSessionPullQueues } = yield* LeaderThreadCtx;
|
|
89
|
+
const pullQueue = yield* connectedClientSessionPullQueues.makeQueue(cursor);
|
|
90
|
+
return Stream.fromQueue(pullQueue);
|
|
91
|
+
}).pipe(Stream.unwrapScoped),
|
|
92
|
+
PushToLeader: ({ batch }) => Effect.andThen(LeaderThreadCtx, ({ syncProcessor }) => syncProcessor.push(batch.map((mutationEvent) => new MutationEvent.EncodedWithMeta(mutationEvent)),
|
|
93
|
+
// We'll wait in order to keep back pressure on the client session
|
|
94
|
+
{ waitForProcessing: true })).pipe(Effect.uninterruptible, Effect.withSpan('@livestore/adapter-web:worker:PushToLeader')),
|
|
95
|
+
Export: () => Effect.andThen(LeaderThreadCtx, (_) => _.dbReadModel.export()).pipe(UnexpectedError.mapToUnexpectedError, Effect.withSpan('@livestore/adapter-web:worker:Export')),
|
|
96
|
+
ExportMutationlog: () => Effect.andThen(LeaderThreadCtx, (_) => _.dbMutationLog.export()).pipe(UnexpectedError.mapToUnexpectedError, Effect.withSpan('@livestore/adapter-web:worker:ExportMutationlog')),
|
|
97
|
+
BootStatusStream: () => Effect.andThen(LeaderThreadCtx, (_) => Stream.fromQueue(_.bootStatusQueue)).pipe(Stream.unwrap),
|
|
98
|
+
GetLeaderHead: () => Effect.gen(function* () {
|
|
99
|
+
const workerCtx = yield* LeaderThreadCtx;
|
|
100
|
+
return getClientHeadFromDb(workerCtx.dbMutationLog);
|
|
101
|
+
}).pipe(UnexpectedError.mapToUnexpectedError, Effect.withSpan('@livestore/adapter-web:worker:GetLeaderHead')),
|
|
102
|
+
GetLeaderSyncState: () => Effect.gen(function* () {
|
|
103
|
+
const workerCtx = yield* LeaderThreadCtx;
|
|
104
|
+
return yield* workerCtx.syncProcessor.syncState;
|
|
105
|
+
}).pipe(UnexpectedError.mapToUnexpectedError, Effect.withSpan('@livestore/adapter-web:worker:GetLeaderSyncState')),
|
|
106
|
+
NetworkStatusStream: () => Effect.gen(function* (_) {
|
|
107
|
+
const ctx = yield* LeaderThreadCtx;
|
|
108
|
+
if (ctx.syncBackend === undefined) {
|
|
109
|
+
return Stream.make({ isConnected: false, timestampMs: Date.now(), latchClosed: false });
|
|
110
|
+
}
|
|
111
|
+
return Stream.zipLatest(ctx.syncBackend.isConnected.changes, ctx.devtools.enabled ? ctx.devtools.syncBackendLatchState.changes : Stream.make({ latchClosed: false })).pipe(Stream.map(([isConnected, { latchClosed }]) => ({ isConnected, timestampMs: Date.now(), latchClosed })));
|
|
112
|
+
}).pipe(Stream.unwrap),
|
|
113
|
+
Shutdown: () => Effect.gen(function* () {
|
|
114
|
+
yield* Effect.logDebug('[@livestore/adapter-web:worker] Shutdown');
|
|
115
|
+
// Buy some time for Otel to flush
|
|
116
|
+
// TODO find a cleaner way to do this
|
|
117
|
+
yield* Effect.sleep(300);
|
|
118
|
+
}).pipe(UnexpectedError.mapToUnexpectedError, Effect.withSpan('@livestore/adapter-web:worker:Shutdown')),
|
|
119
|
+
ExtraDevtoolsMessage: ({ message }) => Effect.andThen(LeaderThreadCtx, (_) => _.extraIncomingMessagesQueue.offer(message)).pipe(UnexpectedError.mapToUnexpectedError, Effect.withSpan('@livestore/adapter-web:worker:ExtraDevtoolsMessage')),
|
|
120
|
+
'DevtoolsWebCommon.CreateConnection': WebMeshWorker.CreateConnection,
|
|
121
|
+
});
|
|
122
|
+
const makeDevtoolsOptions = ({ devtoolsEnabled, dbReadModel, dbMutationLog, }) => Effect.gen(function* () {
|
|
123
|
+
if (devtoolsEnabled === false) {
|
|
124
|
+
return { enabled: false };
|
|
125
|
+
}
|
|
126
|
+
const { node } = yield* WebMeshWorker.CacheService;
|
|
127
|
+
return {
|
|
128
|
+
enabled: true,
|
|
129
|
+
makeBootContext: Effect.gen(function* () {
|
|
130
|
+
return {
|
|
131
|
+
devtoolsWebChannel: yield* makeChannelForConnectedMeshNode({
|
|
132
|
+
node,
|
|
133
|
+
target: `devtools`,
|
|
134
|
+
schema: { listen: Devtools.Leader.MessageToApp, send: Devtools.Leader.MessageFromApp },
|
|
135
|
+
}),
|
|
136
|
+
persistenceInfo: {
|
|
137
|
+
readModel: dbReadModel.metadata.persistenceInfo,
|
|
138
|
+
mutationLog: dbMutationLog.metadata.persistenceInfo,
|
|
139
|
+
},
|
|
140
|
+
};
|
|
141
|
+
}),
|
|
142
|
+
};
|
|
143
|
+
});
|
|
144
|
+
//# sourceMappingURL=make-leader-worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"make-leader-worker.js","sourceRoot":"","sources":["../../../src/web-worker/leader-worker/make-leader-worker.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAE7D,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,EACf,qBAAqB,GACtB,MAAM,iCAAiC,CAAA;AAExC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,EAAE,+BAA+B,EAAE,MAAM,4CAA4C,CAAA;AAC5F,OAAO,KAAK,aAAa,MAAM,uCAAuC,CAAA;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAEnD,OAAO,EACL,mBAAmB,EACnB,MAAM,EACN,eAAe,EACf,QAAQ,EACR,KAAK,EACL,MAAM,EACN,QAAQ,EACR,UAAU,EACV,SAAS,EACT,MAAM,EACN,WAAW,EACX,YAAY,GACb,MAAM,yBAAyB,CAAA;AAGhC,OAAO,KAAK,SAAS,MAAM,qBAAqB,CAAA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