@livestore/common 0.3.0-dev.11 → 0.3.0-dev.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.
Files changed (181) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/adapter-types.d.ts +35 -47
  3. package/dist/adapter-types.d.ts.map +1 -1
  4. package/dist/adapter-types.js.map +1 -1
  5. package/dist/derived-mutations.d.ts +4 -4
  6. package/dist/derived-mutations.d.ts.map +1 -1
  7. package/dist/derived-mutations.test.js.map +1 -1
  8. package/dist/devtools/devtools-bridge.d.ts +1 -2
  9. package/dist/devtools/devtools-bridge.d.ts.map +1 -1
  10. package/dist/devtools/devtools-messages.d.ts +592 -3
  11. package/dist/devtools/devtools-messages.d.ts.map +1 -1
  12. package/dist/devtools/devtools-messages.js +171 -3
  13. package/dist/devtools/devtools-messages.js.map +1 -1
  14. package/dist/index.d.ts +4 -0
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/init-singleton-tables.d.ts +2 -2
  17. package/dist/init-singleton-tables.d.ts.map +1 -1
  18. package/dist/init-singleton-tables.js.map +1 -1
  19. package/dist/leader-thread/apply-mutation.d.ts +2 -5
  20. package/dist/leader-thread/apply-mutation.d.ts.map +1 -1
  21. package/dist/leader-thread/apply-mutation.js +29 -41
  22. package/dist/leader-thread/apply-mutation.js.map +1 -1
  23. package/dist/leader-thread/connection.d.ts +4 -4
  24. package/dist/leader-thread/connection.d.ts.map +1 -1
  25. package/dist/leader-thread/connection.js +5 -5
  26. package/dist/leader-thread/connection.js.map +1 -1
  27. package/dist/leader-thread/leader-sync-processor.d.ts +2 -2
  28. package/dist/leader-thread/leader-sync-processor.d.ts.map +1 -1
  29. package/dist/leader-thread/leader-sync-processor.js +12 -20
  30. package/dist/leader-thread/leader-sync-processor.js.map +1 -1
  31. package/dist/leader-thread/leader-worker-devtools.d.ts +1 -1
  32. package/dist/leader-thread/leader-worker-devtools.d.ts.map +1 -1
  33. package/dist/leader-thread/leader-worker-devtools.js +81 -37
  34. package/dist/leader-thread/leader-worker-devtools.js.map +1 -1
  35. package/dist/leader-thread/make-leader-thread-layer.d.ts +11 -12
  36. package/dist/leader-thread/make-leader-thread-layer.d.ts.map +1 -1
  37. package/dist/leader-thread/make-leader-thread-layer.js +14 -33
  38. package/dist/leader-thread/make-leader-thread-layer.js.map +1 -1
  39. package/dist/leader-thread/mutationlog.d.ts +19 -6
  40. package/dist/leader-thread/mutationlog.d.ts.map +1 -1
  41. package/dist/leader-thread/mutationlog.js +6 -7
  42. package/dist/leader-thread/mutationlog.js.map +1 -1
  43. package/dist/leader-thread/pull-queue-set.d.ts.map +1 -1
  44. package/dist/leader-thread/recreate-db.d.ts.map +1 -1
  45. package/dist/leader-thread/recreate-db.js +18 -24
  46. package/dist/leader-thread/recreate-db.js.map +1 -1
  47. package/dist/leader-thread/types.d.ts +16 -36
  48. package/dist/leader-thread/types.d.ts.map +1 -1
  49. package/dist/leader-thread/types.js.map +1 -1
  50. package/dist/mutation.d.ts +2 -9
  51. package/dist/mutation.d.ts.map +1 -1
  52. package/dist/mutation.js +5 -5
  53. package/dist/mutation.js.map +1 -1
  54. package/dist/query-builder/impl.d.ts +1 -1
  55. package/dist/rehydrate-from-mutationlog.d.ts +5 -5
  56. package/dist/rehydrate-from-mutationlog.d.ts.map +1 -1
  57. package/dist/rehydrate-from-mutationlog.js +19 -13
  58. package/dist/rehydrate-from-mutationlog.js.map +1 -1
  59. package/dist/schema/EventId.d.ts +14 -16
  60. package/dist/schema/EventId.d.ts.map +1 -1
  61. package/dist/schema/EventId.js +7 -15
  62. package/dist/schema/EventId.js.map +1 -1
  63. package/dist/schema/MutationEvent.d.ts +80 -49
  64. package/dist/schema/MutationEvent.d.ts.map +1 -1
  65. package/dist/schema/MutationEvent.js +15 -32
  66. package/dist/schema/MutationEvent.js.map +1 -1
  67. package/dist/schema/system-tables.d.ts +26 -26
  68. package/dist/schema/system-tables.d.ts.map +1 -1
  69. package/dist/schema/system-tables.js +11 -19
  70. package/dist/schema/system-tables.js.map +1 -1
  71. package/dist/schema-management/common.d.ts +3 -3
  72. package/dist/schema-management/common.d.ts.map +1 -1
  73. package/dist/schema-management/common.js.map +1 -1
  74. package/dist/schema-management/migrations.d.ts +4 -4
  75. package/dist/schema-management/migrations.d.ts.map +1 -1
  76. package/dist/schema-management/migrations.js +6 -6
  77. package/dist/schema-management/migrations.js.map +1 -1
  78. package/dist/sync/client-session-sync-processor.d.ts +4 -4
  79. package/dist/sync/client-session-sync-processor.d.ts.map +1 -1
  80. package/dist/sync/index.d.ts +1 -1
  81. package/dist/sync/index.d.ts.map +1 -1
  82. package/dist/sync/index.js +1 -1
  83. package/dist/sync/index.js.map +1 -1
  84. package/dist/sync/next/history-dag-common.d.ts +4 -1
  85. package/dist/sync/next/history-dag-common.d.ts.map +1 -1
  86. package/dist/sync/next/history-dag-common.js +1 -1
  87. package/dist/sync/next/history-dag-common.js.map +1 -1
  88. package/dist/sync/next/rebase-events.d.ts +3 -3
  89. package/dist/sync/next/rebase-events.d.ts.map +1 -1
  90. package/dist/sync/next/rebase-events.js +2 -3
  91. package/dist/sync/next/rebase-events.js.map +1 -1
  92. package/dist/sync/next/test/mutation-fixtures.d.ts +7 -7
  93. package/dist/sync/next/test/mutation-fixtures.d.ts.map +1 -1
  94. package/dist/sync/next/test/mutation-fixtures.js +9 -3
  95. package/dist/sync/next/test/mutation-fixtures.js.map +1 -1
  96. package/dist/sync/sync.d.ts +11 -21
  97. package/dist/sync/sync.d.ts.map +1 -1
  98. package/dist/sync/sync.js.map +1 -1
  99. package/dist/sync/syncstate.d.ts +23 -45
  100. package/dist/sync/syncstate.d.ts.map +1 -1
  101. package/dist/sync/syncstate.js +12 -56
  102. package/dist/sync/syncstate.js.map +1 -1
  103. package/dist/sync/syncstate.test.js +69 -125
  104. package/dist/sync/syncstate.test.js.map +1 -1
  105. package/dist/sync/validate-push-payload.d.ts +2 -2
  106. package/dist/sync/validate-push-payload.d.ts.map +1 -1
  107. package/dist/sync/validate-push-payload.js +2 -2
  108. package/dist/sync/validate-push-payload.js.map +1 -1
  109. package/dist/version.d.ts +1 -1
  110. package/dist/version.d.ts.map +1 -1
  111. package/dist/version.js +1 -1
  112. package/dist/version.js.map +1 -1
  113. package/package.json +5 -6
  114. package/src/adapter-types.ts +40 -39
  115. package/src/derived-mutations.test.ts +1 -1
  116. package/src/derived-mutations.ts +5 -9
  117. package/src/devtools/devtools-bridge.ts +1 -2
  118. package/src/devtools/devtools-messages.ts +243 -3
  119. package/src/index.ts +6 -0
  120. package/src/init-singleton-tables.ts +2 -2
  121. package/src/leader-thread/apply-mutation.ts +35 -53
  122. package/src/leader-thread/connection.ts +7 -7
  123. package/src/leader-thread/{LeaderSyncProcessor.ts → leader-sync-processor.ts} +268 -306
  124. package/src/leader-thread/leader-worker-devtools.ts +124 -52
  125. package/src/leader-thread/make-leader-thread-layer.ts +30 -62
  126. package/src/leader-thread/mutationlog.ts +10 -14
  127. package/src/leader-thread/recreate-db.ts +20 -24
  128. package/src/leader-thread/types.ts +20 -41
  129. package/src/mutation.ts +7 -17
  130. package/src/rehydrate-from-mutationlog.ts +26 -18
  131. package/src/schema/EventId.ts +9 -23
  132. package/src/schema/MutationEvent.ts +24 -46
  133. package/src/schema/system-tables.ts +11 -19
  134. package/src/schema-management/common.ts +3 -3
  135. package/src/schema-management/migrations.ts +10 -10
  136. package/src/sync/{ClientSessionSyncProcessor.ts → client-session-sync-processor.ts} +19 -26
  137. package/src/sync/index.ts +1 -1
  138. package/src/sync/next/history-dag-common.ts +1 -1
  139. package/src/sync/next/rebase-events.ts +7 -7
  140. package/src/sync/next/test/mutation-fixtures.ts +10 -3
  141. package/src/sync/sync.ts +6 -19
  142. package/src/sync/syncstate.test.ts +67 -127
  143. package/src/sync/syncstate.ts +19 -21
  144. package/src/sync/validate-push-payload.ts +4 -7
  145. package/src/version.ts +1 -1
  146. package/dist/devtools/devtool-message-leader.d.ts +0 -2
  147. package/dist/devtools/devtool-message-leader.d.ts.map +0 -1
  148. package/dist/devtools/devtool-message-leader.js +0 -2
  149. package/dist/devtools/devtool-message-leader.js.map +0 -1
  150. package/dist/devtools/devtools-messages-client-session.d.ts +0 -297
  151. package/dist/devtools/devtools-messages-client-session.d.ts.map +0 -1
  152. package/dist/devtools/devtools-messages-client-session.js +0 -61
  153. package/dist/devtools/devtools-messages-client-session.js.map +0 -1
  154. package/dist/devtools/devtools-messages-common.d.ts +0 -65
  155. package/dist/devtools/devtools-messages-common.d.ts.map +0 -1
  156. package/dist/devtools/devtools-messages-common.js +0 -35
  157. package/dist/devtools/devtools-messages-common.js.map +0 -1
  158. package/dist/devtools/devtools-messages-leader.d.ts +0 -261
  159. package/dist/devtools/devtools-messages-leader.d.ts.map +0 -1
  160. package/dist/devtools/devtools-messages-leader.js +0 -85
  161. package/dist/devtools/devtools-messages-leader.js.map +0 -1
  162. package/dist/leader-thread/LeaderSyncProcessor.d.ts +0 -37
  163. package/dist/leader-thread/LeaderSyncProcessor.d.ts.map +0 -1
  164. package/dist/leader-thread/LeaderSyncProcessor.js +0 -432
  165. package/dist/leader-thread/LeaderSyncProcessor.js.map +0 -1
  166. package/dist/schema/EventId.test.d.ts +0 -2
  167. package/dist/schema/EventId.test.d.ts.map +0 -1
  168. package/dist/schema/EventId.test.js +0 -11
  169. package/dist/schema/EventId.test.js.map +0 -1
  170. package/dist/schema/MutationEvent.test.d.ts +0 -2
  171. package/dist/schema/MutationEvent.test.d.ts.map +0 -1
  172. package/dist/schema/MutationEvent.test.js +0 -2
  173. package/dist/schema/MutationEvent.test.js.map +0 -1
  174. package/dist/sync/ClientSessionSyncProcessor.d.ts +0 -43
  175. package/dist/sync/ClientSessionSyncProcessor.d.ts.map +0 -1
  176. package/dist/sync/ClientSessionSyncProcessor.js +0 -141
  177. package/dist/sync/ClientSessionSyncProcessor.js.map +0 -1
  178. package/src/devtools/devtools-messages-client-session.ts +0 -109
  179. package/src/devtools/devtools-messages-common.ts +0 -52
  180. package/src/devtools/devtools-messages-leader.ts +0 -115
  181. package/src/schema/EventId.test.ts +0 -12
@@ -1,261 +0,0 @@
1
- import { Schema } from '@livestore/utils/effect';
2
- import { Disconnect, Ping, Pong } from './devtools-messages-common.js';
3
- declare const ResetAllDataReq_base: Schema.Struct<{
4
- _tag: Schema.tag<"LSD.Leader.ResetAllDataReq">;
5
- } & {
6
- liveStoreVersion: Schema.Literal<["0.3.0-dev.11"]>;
7
- } & {
8
- requestId: typeof Schema.String;
9
- } & {
10
- mode: Schema.Literal<["all-data", "only-app-db"]>;
11
- }>;
12
- export declare class ResetAllDataReq extends ResetAllDataReq_base {
13
- }
14
- declare const ResetAllDataRes_base: Schema.Struct<{
15
- _tag: Schema.tag<"LSD.Leader.ResetAllDataRes">;
16
- } & {
17
- liveStoreVersion: Schema.Literal<["0.3.0-dev.11"]>;
18
- } & {
19
- requestId: typeof Schema.String;
20
- }>;
21
- export declare class ResetAllDataRes extends ResetAllDataRes_base {
22
- }
23
- declare const DatabaseFileInfoReq_base: Schema.Struct<{
24
- _tag: Schema.tag<"LSD.Leader.DatabaseFileInfoReq">;
25
- } & {
26
- liveStoreVersion: Schema.Literal<["0.3.0-dev.11"]>;
27
- } & {
28
- requestId: typeof Schema.String;
29
- }>;
30
- export declare class DatabaseFileInfoReq extends DatabaseFileInfoReq_base {
31
- }
32
- declare const DatabaseFileInfo_base: Schema.Struct<{
33
- fileSize: typeof Schema.Number;
34
- persistenceInfo: Schema.TypeLiteral<{
35
- fileName: typeof Schema.String;
36
- }, readonly [{
37
- readonly key: typeof Schema.String;
38
- readonly value: typeof Schema.Any;
39
- }]>;
40
- }>;
41
- export declare class DatabaseFileInfo extends DatabaseFileInfo_base {
42
- }
43
- declare const DatabaseFileInfoRes_base: Schema.Struct<{
44
- _tag: Schema.tag<"LSD.Leader.DatabaseFileInfoRes">;
45
- } & {
46
- liveStoreVersion: Schema.Literal<["0.3.0-dev.11"]>;
47
- } & {
48
- requestId: typeof Schema.String;
49
- } & {
50
- readModel: typeof DatabaseFileInfo;
51
- mutationLog: typeof DatabaseFileInfo;
52
- }>;
53
- export declare class DatabaseFileInfoRes extends DatabaseFileInfoRes_base {
54
- }
55
- declare const NetworkStatusSubscribe_base: Schema.Struct<{
56
- _tag: Schema.tag<"LSD.Leader.NetworkStatusSubscribe">;
57
- } & {
58
- liveStoreVersion: Schema.Literal<["0.3.0-dev.11"]>;
59
- } & {
60
- requestId: typeof Schema.String;
61
- }>;
62
- export declare class NetworkStatusSubscribe extends NetworkStatusSubscribe_base {
63
- }
64
- declare const NetworkStatusUnsubscribe_base: Schema.Struct<{
65
- _tag: Schema.tag<"LSD.Leader.NetworkStatusUnsubscribe">;
66
- } & {
67
- liveStoreVersion: Schema.Literal<["0.3.0-dev.11"]>;
68
- } & {
69
- requestId: typeof Schema.String;
70
- }>;
71
- export declare class NetworkStatusUnsubscribe extends NetworkStatusUnsubscribe_base {
72
- }
73
- declare const NetworkStatusRes_base: Schema.Struct<{
74
- _tag: Schema.tag<"LSD.Leader.NetworkStatusRes">;
75
- } & {
76
- liveStoreVersion: Schema.Literal<["0.3.0-dev.11"]>;
77
- } & {
78
- requestId: typeof Schema.String;
79
- } & {
80
- networkStatus: Schema.Struct<{
81
- isConnected: typeof Schema.Boolean;
82
- timestampMs: typeof Schema.Number;
83
- }>;
84
- }>;
85
- export declare class NetworkStatusRes extends NetworkStatusRes_base {
86
- }
87
- declare const SyncingInfoReq_base: Schema.Struct<{
88
- _tag: Schema.tag<"LSD.Leader.SyncingInfoReq">;
89
- } & {
90
- liveStoreVersion: Schema.Literal<["0.3.0-dev.11"]>;
91
- } & {
92
- requestId: typeof Schema.String;
93
- }>;
94
- export declare class SyncingInfoReq extends SyncingInfoReq_base {
95
- }
96
- declare const SyncingInfo_base: Schema.Struct<{
97
- enabled: typeof Schema.Boolean;
98
- metadata: Schema.Record$<typeof Schema.String, typeof Schema.Any>;
99
- }>;
100
- export declare class SyncingInfo extends SyncingInfo_base {
101
- }
102
- declare const SyncingInfoRes_base: Schema.Struct<{
103
- _tag: Schema.tag<"LSD.Leader.SyncingInfoRes">;
104
- } & {
105
- liveStoreVersion: Schema.Literal<["0.3.0-dev.11"]>;
106
- } & {
107
- requestId: typeof Schema.String;
108
- } & {
109
- syncingInfo: typeof SyncingInfo;
110
- }>;
111
- export declare class SyncingInfoRes extends SyncingInfoRes_base {
112
- }
113
- declare const SyncHistorySubscribe_base: Schema.Struct<{
114
- _tag: Schema.tag<"LSD.Leader.SyncHistorySubscribe">;
115
- } & {
116
- liveStoreVersion: Schema.Literal<["0.3.0-dev.11"]>;
117
- } & {
118
- requestId: typeof Schema.String;
119
- }>;
120
- export declare class SyncHistorySubscribe extends SyncHistorySubscribe_base {
121
- }
122
- declare const SyncHistoryUnsubscribe_base: Schema.Struct<{
123
- _tag: Schema.tag<"LSD.Leader.SyncHistoryUnsubscribe">;
124
- } & {
125
- liveStoreVersion: Schema.Literal<["0.3.0-dev.11"]>;
126
- } & {
127
- requestId: typeof Schema.String;
128
- }>;
129
- export declare class SyncHistoryUnsubscribe extends SyncHistoryUnsubscribe_base {
130
- }
131
- declare const SyncHistoryRes_base: Schema.Struct<{
132
- _tag: Schema.tag<"LSD.Leader.SyncHistoryRes">;
133
- } & {
134
- liveStoreVersion: Schema.Literal<["0.3.0-dev.11"]>;
135
- } & {
136
- requestId: typeof Schema.String;
137
- } & {
138
- mutationEventEncoded: Schema.Struct<{
139
- mutation: typeof Schema.String;
140
- args: typeof Schema.Any;
141
- id: Schema.BrandSchema<number & import("effect/Brand").Brand<"GlobalEventId">, number, never>;
142
- parentId: Schema.BrandSchema<number & import("effect/Brand").Brand<"GlobalEventId">, number, never>;
143
- }>;
144
- metadata: Schema.Option<Schema.Schema<Schema.JsonValue, Schema.JsonValue, never>>;
145
- }>;
146
- export declare class SyncHistoryRes extends SyncHistoryRes_base {
147
- }
148
- declare const SnapshotReq_base: Schema.Struct<{
149
- _tag: Schema.tag<"LSD.Leader.SnapshotReq">;
150
- } & {
151
- liveStoreVersion: Schema.Literal<["0.3.0-dev.11"]>;
152
- } & {
153
- requestId: typeof Schema.String;
154
- }>;
155
- export declare class SnapshotReq extends SnapshotReq_base {
156
- }
157
- declare const SnapshotRes_base: Schema.Struct<{
158
- _tag: Schema.tag<"LSD.Leader.SnapshotRes">;
159
- } & {
160
- liveStoreVersion: Schema.Literal<["0.3.0-dev.11"]>;
161
- } & {
162
- requestId: typeof Schema.String;
163
- } & {
164
- snapshot: Schema.Schema<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>, never>;
165
- }>;
166
- export declare class SnapshotRes extends SnapshotRes_base {
167
- }
168
- declare const LoadDatabaseFileReq_base: Schema.Struct<{
169
- _tag: Schema.tag<"LSD.Leader.LoadDatabaseFileReq">;
170
- } & {
171
- liveStoreVersion: Schema.Literal<["0.3.0-dev.11"]>;
172
- } & {
173
- requestId: typeof Schema.String;
174
- } & {
175
- data: Schema.Schema<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>, never>;
176
- }>;
177
- export declare class LoadDatabaseFileReq extends LoadDatabaseFileReq_base {
178
- }
179
- declare const LoadDatabaseFileRes_base: Schema.Struct<{
180
- _tag: Schema.tag<"LSD.Leader.LoadDatabaseFileRes">;
181
- } & {
182
- liveStoreVersion: Schema.Literal<["0.3.0-dev.11"]>;
183
- } & {
184
- requestId: typeof Schema.String;
185
- } & {
186
- status: Schema.Literal<["ok", "unsupported-file", "unsupported-database"]>;
187
- }>;
188
- export declare class LoadDatabaseFileRes extends LoadDatabaseFileRes_base {
189
- }
190
- declare const MutationBroadcast_base: Schema.Struct<{
191
- _tag: Schema.tag<"LSD.Leader.MutationBroadcast">;
192
- } & {
193
- liveStoreVersion: Schema.Literal<["0.3.0-dev.11"]>;
194
- } & {
195
- mutationEventEncoded: Schema.Struct<{
196
- mutation: typeof Schema.String;
197
- args: typeof Schema.Any;
198
- id: Schema.Struct<{
199
- global: Schema.BrandSchema<number & import("effect/Brand").Brand<"GlobalEventId">, number, never>;
200
- local: Schema.BrandSchema<number & import("effect/Brand").Brand<"LocalEventId">, number, never>;
201
- }>;
202
- parentId: Schema.Struct<{
203
- global: Schema.BrandSchema<number & import("effect/Brand").Brand<"GlobalEventId">, number, never>;
204
- local: Schema.BrandSchema<number & import("effect/Brand").Brand<"LocalEventId">, number, never>;
205
- }>;
206
- }>;
207
- }>;
208
- export declare class MutationBroadcast extends MutationBroadcast_base {
209
- }
210
- declare const RunMutationReq_base: Schema.Struct<{
211
- _tag: Schema.tag<"LSD.Leader.RunMutationReq">;
212
- } & {
213
- liveStoreVersion: Schema.Literal<["0.3.0-dev.11"]>;
214
- } & {
215
- requestId: typeof Schema.String;
216
- } & {
217
- mutationEventEncoded: Schema.SchemaClass<{
218
- readonly mutation: string;
219
- readonly args: any;
220
- }, {
221
- readonly mutation: string;
222
- readonly args: any;
223
- }, never>;
224
- }>;
225
- export declare class RunMutationReq extends RunMutationReq_base {
226
- }
227
- declare const RunMutationRes_base: Schema.Struct<{
228
- _tag: Schema.tag<"LSD.Leader.RunMutationRes">;
229
- } & {
230
- liveStoreVersion: Schema.Literal<["0.3.0-dev.11"]>;
231
- } & {
232
- requestId: typeof Schema.String;
233
- }>;
234
- export declare class RunMutationRes extends RunMutationRes_base {
235
- }
236
- declare const MutationLogReq_base: Schema.Struct<{
237
- _tag: Schema.tag<"LSD.Leader.MutationLogReq">;
238
- } & {
239
- liveStoreVersion: Schema.Literal<["0.3.0-dev.11"]>;
240
- } & {
241
- requestId: typeof Schema.String;
242
- }>;
243
- export declare class MutationLogReq extends MutationLogReq_base {
244
- }
245
- declare const MutationLogRes_base: Schema.Struct<{
246
- _tag: Schema.tag<"LSD.Leader.MutationLogRes">;
247
- } & {
248
- liveStoreVersion: Schema.Literal<["0.3.0-dev.11"]>;
249
- } & {
250
- requestId: typeof Schema.String;
251
- } & {
252
- mutationLog: Schema.Schema<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>, never>;
253
- }>;
254
- export declare class MutationLogRes extends MutationLogRes_base {
255
- }
256
- export declare const MessageToAppLeader: Schema.Union<[typeof SnapshotReq, typeof LoadDatabaseFileReq, typeof MutationLogReq, typeof ResetAllDataReq, typeof NetworkStatusSubscribe, typeof NetworkStatusUnsubscribe, typeof Disconnect, typeof RunMutationReq, typeof Ping, typeof DatabaseFileInfoReq, typeof SyncHistorySubscribe, typeof SyncHistoryUnsubscribe, typeof SyncingInfoReq]>;
257
- export type MessageToAppLeader = typeof MessageToAppLeader.Type;
258
- export declare const MessageFromAppLeader: Schema.Union<[typeof SnapshotRes, typeof LoadDatabaseFileRes, typeof MutationLogRes, typeof ResetAllDataRes, typeof Disconnect, typeof MutationBroadcast, typeof NetworkStatusRes, typeof RunMutationRes, typeof Pong, typeof DatabaseFileInfoRes, typeof SyncHistoryRes, typeof SyncingInfoRes]>;
259
- export type MessageFromAppLeader = typeof MessageFromAppLeader.Type;
260
- export {};
261
- //# sourceMappingURL=devtools-messages-leader.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"devtools-messages-leader.d.ts","sourceRoot":"","sources":["../../src/devtools/devtools-messages-leader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAgB,MAAM,yBAAyB,CAAA;AAI9D,OAAO,EAAE,UAAU,EAAgC,IAAI,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAA;;;;;;;;;;AAEpG,qBAAa,eAAgB,SAAQ,oBAEnC;CAAG;;;;;;;;AAEL,qBAAa,eAAgB,SAAQ,oBAAkD;CAAG;;;;;;;;AAE1F,qBAAa,mBAAoB,SAAQ,wBAAsD;CAAG;;;;;;;;;;AAElG,qBAAa,gBAAiB,SAAQ,qBAGpC;CAAG;;;;;;;;;;;AAEL,qBAAa,mBAAoB,SAAQ,wBAGvC;CAAG;;;;;;;;AAEL,qBAAa,sBAAuB,SAAQ,2BAAyD;CAAG;;;;;;;;AACxG,qBAAa,wBAAyB,SAAQ,6BAA2D;CAAG;;;;;;;;;;;;;AAE5G,qBAAa,gBAAiB,SAAQ,qBAEpC;CAAG;;;;;;;;AAEL,qBAAa,cAAe,SAAQ,mBAAiD;CAAG;;;;;AAExF,qBAAa,WAAY,SAAQ,gBAG/B;CAAG;;;;;;;;;;AAEL,qBAAa,cAAe,SAAQ,mBAElC;CAAG;;;;;;;;AAEL,qBAAa,oBAAqB,SAAQ,yBAAuD;CAAG;;;;;;;;AACpG,qBAAa,sBAAuB,SAAQ,2BAAyD;CAAG;;;;;;;;;;;;;;;;AACxG,qBAAa,cAAe,SAAQ,mBAGlC;CAAG;;;;;;;;AAEL,qBAAa,WAAY,SAAQ,gBAA8C;CAAG;;;;;;;;;;AAElF,qBAAa,WAAY,SAAQ,gBAE/B;CAAG;;;;;;;;;;AAEL,qBAAa,mBAAoB,SAAQ,wBAEvC;CAAG;;;;;;;;;;AAEL,qBAAa,mBAAoB,SAAQ,wBAEvC;CAAG;;;;;;;;;;;;;;;;;;;AAGL,qBAAa,iBAAkB,SAAQ,sBAErC;CAAG;;;;;;;;;;;;;;;;AAGL,qBAAa,cAAe,SAAQ,mBAElC;CAAG;;;;;;;;AAEL,qBAAa,cAAe,SAAQ,mBAAiD;CAAG;;;;;;;;AAExF,qBAAa,cAAe,SAAQ,mBAAiD;CAAG;;;;;;;;;;AAExF,qBAAa,cAAe,SAAQ,mBAElC;CAAG;AAEL,eAAO,MAAM,kBAAkB,qVAcwB,CAAA;AAEvD,MAAM,MAAM,kBAAkB,GAAG,OAAO,kBAAkB,CAAC,IAAI,CAAA;AAE/D,eAAO,MAAM,oBAAoB,mSAawB,CAAA;AAEzD,MAAM,MAAM,oBAAoB,GAAG,OAAO,oBAAoB,CAAC,IAAI,CAAA"}
@@ -1,85 +0,0 @@
1
- import { Schema, Transferable } from '@livestore/utils/effect';
2
- import { NetworkStatus } from '../adapter-types.js';
3
- import * as MutationEvent from '../schema/MutationEvent.js';
4
- import { Disconnect, LSDMessage, LSDReqResMessage, Ping, Pong } from './devtools-messages-common.js';
5
- export class ResetAllDataReq extends LSDReqResMessage('LSD.Leader.ResetAllDataReq', {
6
- mode: Schema.Literal('all-data', 'only-app-db'),
7
- }) {
8
- }
9
- export class ResetAllDataRes extends LSDReqResMessage('LSD.Leader.ResetAllDataRes', {}) {
10
- }
11
- export class DatabaseFileInfoReq extends LSDReqResMessage('LSD.Leader.DatabaseFileInfoReq', {}) {
12
- }
13
- export class DatabaseFileInfo extends Schema.Struct({
14
- fileSize: Schema.Number,
15
- persistenceInfo: Schema.Struct({ fileName: Schema.String }, { key: Schema.String, value: Schema.Any }),
16
- }) {
17
- }
18
- export class DatabaseFileInfoRes extends LSDReqResMessage('LSD.Leader.DatabaseFileInfoRes', {
19
- readModel: DatabaseFileInfo,
20
- mutationLog: DatabaseFileInfo,
21
- }) {
22
- }
23
- export class NetworkStatusSubscribe extends LSDReqResMessage('LSD.Leader.NetworkStatusSubscribe', {}) {
24
- }
25
- export class NetworkStatusUnsubscribe extends LSDReqResMessage('LSD.Leader.NetworkStatusUnsubscribe', {}) {
26
- }
27
- export class NetworkStatusRes extends LSDReqResMessage('LSD.Leader.NetworkStatusRes', {
28
- networkStatus: NetworkStatus,
29
- }) {
30
- }
31
- export class SyncingInfoReq extends LSDReqResMessage('LSD.Leader.SyncingInfoReq', {}) {
32
- }
33
- export class SyncingInfo extends Schema.Struct({
34
- enabled: Schema.Boolean,
35
- metadata: Schema.Record({ key: Schema.String, value: Schema.Any }),
36
- }) {
37
- }
38
- export class SyncingInfoRes extends LSDReqResMessage('LSD.Leader.SyncingInfoRes', {
39
- syncingInfo: SyncingInfo,
40
- }) {
41
- }
42
- export class SyncHistorySubscribe extends LSDReqResMessage('LSD.Leader.SyncHistorySubscribe', {}) {
43
- }
44
- export class SyncHistoryUnsubscribe extends LSDReqResMessage('LSD.Leader.SyncHistoryUnsubscribe', {}) {
45
- }
46
- export class SyncHistoryRes extends LSDReqResMessage('LSD.Leader.SyncHistoryRes', {
47
- mutationEventEncoded: MutationEvent.AnyEncodedGlobal,
48
- metadata: Schema.Option(Schema.JsonValue),
49
- }) {
50
- }
51
- export class SnapshotReq extends LSDReqResMessage('LSD.Leader.SnapshotReq', {}) {
52
- }
53
- export class SnapshotRes extends LSDReqResMessage('LSD.Leader.SnapshotRes', {
54
- snapshot: Transferable.Uint8Array,
55
- }) {
56
- }
57
- export class LoadDatabaseFileReq extends LSDReqResMessage('LSD.Leader.LoadDatabaseFileReq', {
58
- data: Transferable.Uint8Array,
59
- }) {
60
- }
61
- export class LoadDatabaseFileRes extends LSDReqResMessage('LSD.Leader.LoadDatabaseFileRes', {
62
- status: Schema.Literal('ok', 'unsupported-file', 'unsupported-database'),
63
- }) {
64
- }
65
- // TODO refactor this to use push/pull semantics
66
- export class MutationBroadcast extends LSDMessage('LSD.Leader.MutationBroadcast', {
67
- mutationEventEncoded: MutationEvent.AnyEncoded,
68
- }) {
69
- }
70
- // TODO refactor this to use push/pull semantics
71
- export class RunMutationReq extends LSDReqResMessage('LSD.Leader.RunMutationReq', {
72
- mutationEventEncoded: MutationEvent.AnyEncoded.pipe(Schema.omit('id', 'parentId')),
73
- }) {
74
- }
75
- export class RunMutationRes extends LSDReqResMessage('LSD.Leader.RunMutationRes', {}) {
76
- }
77
- export class MutationLogReq extends LSDReqResMessage('LSD.Leader.MutationLogReq', {}) {
78
- }
79
- export class MutationLogRes extends LSDReqResMessage('LSD.Leader.MutationLogRes', {
80
- mutationLog: Transferable.Uint8Array,
81
- }) {
82
- }
83
- export const MessageToAppLeader = Schema.Union(SnapshotReq, LoadDatabaseFileReq, MutationLogReq, ResetAllDataReq, NetworkStatusSubscribe, NetworkStatusUnsubscribe, Disconnect, RunMutationReq, Ping, DatabaseFileInfoReq, SyncHistorySubscribe, SyncHistoryUnsubscribe, SyncingInfoReq).annotations({ identifier: 'LSD.MessageToAppLeader' });
84
- export const MessageFromAppLeader = Schema.Union(SnapshotRes, LoadDatabaseFileRes, MutationLogRes, ResetAllDataRes, Disconnect, MutationBroadcast, NetworkStatusRes, RunMutationRes, Pong, DatabaseFileInfoRes, SyncHistoryRes, SyncingInfoRes).annotations({ identifier: 'LSD.MessageFromAppLeader' });
85
- //# sourceMappingURL=devtools-messages-leader.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"devtools-messages-leader.js","sourceRoot":"","sources":["../../src/devtools/devtools-messages-leader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAE9D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,KAAK,aAAa,MAAM,4BAA4B,CAAA;AAC3D,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,gBAAgB,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAA;AAEpG,MAAM,OAAO,eAAgB,SAAQ,gBAAgB,CAAC,4BAA4B,EAAE;IAClF,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,UAAU,EAAE,aAAa,CAAC;CAChD,CAAC;CAAG;AAEL,MAAM,OAAO,eAAgB,SAAQ,gBAAgB,CAAC,4BAA4B,EAAE,EAAE,CAAC;CAAG;AAE1F,MAAM,OAAO,mBAAoB,SAAQ,gBAAgB,CAAC,gCAAgC,EAAE,EAAE,CAAC;CAAG;AAElG,MAAM,OAAO,gBAAiB,SAAQ,MAAM,CAAC,MAAM,CAAC;IAClD,QAAQ,EAAE,MAAM,CAAC,MAAM;IACvB,eAAe,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,GAAG,EAAE,CAAC;CACvG,CAAC;CAAG;AAEL,MAAM,OAAO,mBAAoB,SAAQ,gBAAgB,CAAC,gCAAgC,EAAE;IAC1F,SAAS,EAAE,gBAAgB;IAC3B,WAAW,EAAE,gBAAgB;CAC9B,CAAC;CAAG;AAEL,MAAM,OAAO,sBAAuB,SAAQ,gBAAgB,CAAC,mCAA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,EACf,UAAU,EACV,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,IAAI,EACJ,mBAAmB,EACnB,cAAc,EACd,cAAc,CACf,CAAC,WAAW,CAAC,EAAE,UAAU,EAAE,0BAA0B,EAAE,CAAC,CAAA"}
@@ -1,37 +0,0 @@
1
- import type { Scope } from '@livestore/utils/effect';
2
- import { Effect } from '@livestore/utils/effect';
3
- import type { SqliteDb } from '../adapter-types.js';
4
- import { UnexpectedError } from '../adapter-types.js';
5
- import type { LiveStoreSchema } from '../schema/mod.js';
6
- import type { InitialBlockingSyncContext, LeaderSyncProcessor } from './types.js';
7
- /**
8
- * The LeaderSyncProcessor manages synchronization of mutations between
9
- * the local state and the sync backend, ensuring efficient and orderly processing.
10
- *
11
- * In the LeaderSyncProcessor, pulling always has precedence over pushing.
12
- *
13
- * Responsibilities:
14
- * - Queueing incoming local mutations in a localPushMailbox.
15
- * - Broadcasting mutations to client sessions via pull queues.
16
- * - Pushing mutations to the sync backend.
17
- *
18
- * Notes:
19
- *
20
- * local push processing:
21
- * - localPushMailbox:
22
- * - Maintains events in ascending order.
23
- * - Uses `Deferred` objects to resolve/reject events based on application success.
24
- * - Processes events from the mailbox, applying mutations in batches.
25
- * - Controlled by a `Latch` to manage execution flow.
26
- * - The latch closes on pull receipt and re-opens post-pull completion.
27
- * - Processes up to `maxBatchSize` events per cycle.
28
- *
29
- */
30
- export declare const makeLeaderSyncProcessor: ({ schema, dbMissing, dbMutationLog, initialBlockingSyncContext, }: {
31
- schema: LiveStoreSchema;
32
- /** Only used to know whether we can safely query dbMutationLog during setup execution */
33
- dbMissing: boolean;
34
- dbMutationLog: SqliteDb;
35
- initialBlockingSyncContext: InitialBlockingSyncContext;
36
- }) => Effect.Effect<LeaderSyncProcessor, UnexpectedError, Scope.Scope>;
37
- //# sourceMappingURL=LeaderSyncProcessor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LeaderSyncProcessor.d.ts","sourceRoot":"","sources":["../../src/leader-thread/LeaderSyncProcessor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAc,KAAK,EAAU,MAAM,yBAAyB,CAAA;AACxE,OAAO,EAGL,MAAM,EAUP,MAAM,yBAAyB,CAAA;AAGhC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AACrD,OAAO,KAAK,EAAE,eAAe,EAA2B,MAAM,kBAAkB,CAAA;AAehF,OAAO,KAAK,EAAE,0BAA0B,EAAmB,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAQlG;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,uBAAuB,sEAKjC;IACD,MAAM,EAAE,eAAe,CAAA;IACvB,yFAAyF;IACzF,SAAS,EAAE,OAAO,CAAA;IAClB,aAAa,EAAE,QAAQ,CAAA;IACvB,0BAA0B,EAAE,0BAA0B,CAAA;CACvD,KAAG,MAAM,CAAC,MAAM,CAAC,mBAAmB,EAAE,eAAe,EAAE,KAAK,CAAC,KAAK,CA6L/D,CAAA"}