@livestore/common 0.0.54-dev.4 → 0.0.54

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 (90) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/__tests__/fixture.d.ts +0 -2
  3. package/dist/__tests__/fixture.d.ts.map +1 -1
  4. package/dist/adapter-types.d.ts +75 -16
  5. package/dist/adapter-types.d.ts.map +1 -1
  6. package/dist/adapter-types.js +18 -0
  7. package/dist/adapter-types.js.map +1 -1
  8. package/dist/bounded-collections.d.ts +1 -1
  9. package/dist/bounded-collections.d.ts.map +1 -1
  10. package/dist/bounded-collections.js.map +1 -1
  11. package/dist/debug-info.d.ts +4 -0
  12. package/dist/debug-info.d.ts.map +1 -1
  13. package/dist/debug-info.js +6 -9
  14. package/dist/debug-info.js.map +1 -1
  15. package/dist/derived-mutations.d.ts +4 -5
  16. package/dist/derived-mutations.d.ts.map +1 -1
  17. package/dist/devtools/devtools-messages.d.ts +244 -42
  18. package/dist/devtools/devtools-messages.d.ts.map +1 -1
  19. package/dist/devtools/devtools-messages.js +110 -48
  20. package/dist/devtools/devtools-messages.js.map +1 -1
  21. package/dist/devtools/devtools-window-message.d.ts +29 -0
  22. package/dist/devtools/devtools-window-message.d.ts.map +1 -0
  23. package/dist/devtools/devtools-window-message.js +33 -0
  24. package/dist/devtools/devtools-window-message.js.map +1 -0
  25. package/dist/devtools/index.d.ts +1 -0
  26. package/dist/devtools/index.d.ts.map +1 -1
  27. package/dist/devtools/index.js +1 -0
  28. package/dist/devtools/index.js.map +1 -1
  29. package/dist/index.d.ts +1 -0
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/index.js +1 -0
  32. package/dist/index.js.map +1 -1
  33. package/dist/mutation.d.ts.map +1 -1
  34. package/dist/rehydrate-from-mutationlog.d.ts +8 -3
  35. package/dist/rehydrate-from-mutationlog.d.ts.map +1 -1
  36. package/dist/rehydrate-from-mutationlog.js +71 -56
  37. package/dist/rehydrate-from-mutationlog.js.map +1 -1
  38. package/dist/schema/index.d.ts.map +1 -1
  39. package/dist/schema/mutations.d.ts +2 -1
  40. package/dist/schema/mutations.d.ts.map +1 -1
  41. package/dist/schema/mutations.js +4 -2
  42. package/dist/schema/mutations.js.map +1 -1
  43. package/dist/schema/parse-utils.d.ts +3 -14
  44. package/dist/schema/parse-utils.d.ts.map +1 -1
  45. package/dist/schema/schema-helpers.d.ts +3 -13
  46. package/dist/schema/schema-helpers.d.ts.map +1 -1
  47. package/dist/schema/system-tables.d.ts +0 -5
  48. package/dist/schema/system-tables.d.ts.map +1 -1
  49. package/dist/schema/table-def.d.ts +3 -21
  50. package/dist/schema/table-def.d.ts.map +1 -1
  51. package/dist/schema/table-def.js +0 -1
  52. package/dist/schema/table-def.js.map +1 -1
  53. package/dist/schema-management/common.d.ts.map +1 -1
  54. package/dist/schema-management/migrations.d.ts +10 -5
  55. package/dist/schema-management/migrations.d.ts.map +1 -1
  56. package/dist/schema-management/migrations.js +24 -13
  57. package/dist/schema-management/migrations.js.map +1 -1
  58. package/dist/schema-management/validate-mutation-defs.d.ts.map +1 -1
  59. package/dist/sql-queries/misc.d.ts.map +1 -1
  60. package/dist/sql-queries/sql-queries.d.ts.map +1 -1
  61. package/dist/sql-queries/sql-query-builder.d.ts +33 -33
  62. package/dist/sql-queries/sql-query-builder.d.ts.map +1 -1
  63. package/dist/sql-queries/types.d.ts.map +1 -1
  64. package/dist/sync/sync.d.ts +3 -3
  65. package/dist/util.d.ts +0 -1
  66. package/dist/util.d.ts.map +1 -1
  67. package/dist/util.js +1 -1
  68. package/dist/util.js.map +1 -1
  69. package/dist/version.d.ts +2 -0
  70. package/dist/version.d.ts.map +1 -0
  71. package/dist/version.js +3 -0
  72. package/dist/version.js.map +1 -0
  73. package/package.json +4 -8
  74. package/src/adapter-types.ts +53 -15
  75. package/src/bounded-collections.ts +1 -1
  76. package/src/debug-info.ts +6 -18
  77. package/src/devtools/devtools-messages.ts +146 -65
  78. package/src/devtools/devtools-window-message.ts +27 -0
  79. package/src/devtools/index.ts +1 -0
  80. package/src/index.ts +1 -0
  81. package/src/rehydrate-from-mutationlog.ts +99 -64
  82. package/src/schema/mutations.ts +8 -5
  83. package/src/schema/table-def.ts +0 -4
  84. package/src/schema-management/migrations.ts +104 -84
  85. package/src/util.ts +1 -1
  86. package/src/version.ts +3 -0
  87. package/dist/devtools/index copy.d.ts +0 -214
  88. package/dist/devtools/index copy.d.ts.map +0 -1
  89. package/dist/devtools/index copy.js +0 -137
  90. package/dist/devtools/index copy.js.map +0 -1
@@ -1,9 +1,9 @@
1
- import { version as pkgVersion } from '@livestore/common/package.json';
2
- import { Schema } from '@livestore/utils/effect';
1
+ import { Schema, Transferable } from '@livestore/utils/effect';
3
2
  import { NetworkStatus } from '../adapter-types.js';
4
3
  import { DebugInfo } from '../debug-info.js';
5
4
  import { mutationEventSchemaEncodedAny } from '../schema/mutations.js';
6
5
  import { PreparedBindValues } from '../util.js';
6
+ import { liveStoreVersion as pkgVersion } from '../version.js';
7
7
  const requestId = Schema.String;
8
8
  const channelId = Schema.String;
9
9
  const liveStoreVersion = Schema.Literal(pkgVersion);
@@ -11,36 +11,67 @@ export class SnapshotReq extends Schema.TaggedStruct('LSD.SnapshotReq', {
11
11
  liveStoreVersion,
12
12
  requestId,
13
13
  channelId,
14
- }) {
14
+ }).annotations({ identifier: 'LSD.SnapshotReq' }) {
15
15
  }
16
16
  export class SnapshotRes extends Schema.TaggedStruct('LSD.SnapshotRes', {
17
17
  liveStoreVersion,
18
18
  requestId,
19
- snapshot: Schema.Uint8Array,
20
- }) {
19
+ snapshot: Transferable.Uint8Array,
20
+ }).annotations({ identifier: 'LSD.SnapshotRes' }) {
21
+ }
22
+ export class LoadDatabaseFileReq extends Schema.TaggedStruct('LSD.LoadDatabaseFileReq', {
23
+ liveStoreVersion,
24
+ requestId,
25
+ channelId,
26
+ data: Transferable.Uint8Array,
27
+ }).annotations({ identifier: 'LSD.LoadDatabaseFileReq' }) {
28
+ }
29
+ export class LoadDatabaseFileRes extends Schema.TaggedStruct('LSD.LoadDatabaseFileRes', {
30
+ liveStoreVersion,
31
+ requestId,
32
+ status: Schema.Literal('ok', 'unsupported-file', 'unsupported-database'),
33
+ }).annotations({ identifier: 'LSD.LoadDatabaseFileRes' }) {
21
34
  }
22
35
  export class DebugInfoReq extends Schema.TaggedStruct('LSD.DebugInfoReq', {
23
36
  liveStoreVersion,
24
37
  requestId,
25
38
  channelId,
26
- }) {
39
+ }).annotations({ identifier: 'LSD.DebugInfoReq' }) {
27
40
  }
28
41
  export class DebugInfoRes extends Schema.TaggedStruct('LSD.DebugInfoRes', {
29
42
  liveStoreVersion,
30
43
  requestId,
31
44
  debugInfo: DebugInfo,
32
- }) {
45
+ }).annotations({ identifier: 'LSD.DebugInfoRes' }) {
46
+ }
47
+ export class DebugInfoHistorySubscribe extends Schema.TaggedStruct('LSD.DebugInfoHistorySubscribe', {
48
+ liveStoreVersion,
49
+ requestId,
50
+ channelId,
51
+ }).annotations({ identifier: 'LSD.DebugInfoHistorySubscribe' }) {
52
+ }
53
+ export class DebugInfoHistoryRes extends Schema.TaggedStruct('LSD.DebugInfoHistoryRes', {
54
+ liveStoreVersion,
55
+ requestId,
56
+ debugInfoHistory: Schema.Array(DebugInfo),
57
+ }).annotations({ identifier: 'LSD.DebugInfoHistoryRes' }) {
58
+ }
59
+ export class DebugInfoHistoryUnsubscribe extends Schema.TaggedStruct('LSD.DebugInfoHistoryUnsubscribe', {
60
+ liveStoreVersion,
61
+ requestId,
62
+ channelId,
63
+ }).annotations({ identifier: 'LSD.DebugInfoHistoryUnsubscribe' }) {
33
64
  }
34
65
  export class DebugInfoResetReq extends Schema.TaggedStruct('LSD.DebugInfoResetReq', {
35
66
  liveStoreVersion,
36
67
  requestId,
37
68
  channelId,
38
- }) {
69
+ }).annotations({ identifier: 'LSD.DebugInfoResetReq' }) {
39
70
  }
40
71
  export class DebugInfoResetRes extends Schema.TaggedStruct('LSD.DebugInfoResetRes', {
41
72
  liveStoreVersion,
42
73
  requestId,
43
- }) {
74
+ }).annotations({ identifier: 'LSD.DebugInfoResetRes' }) {
44
75
  }
45
76
  export class DebugInfoRerunQueryReq extends Schema.TaggedStruct('LSD.DebugInfoRerunQueryReq', {
46
77
  liveStoreVersion,
@@ -49,62 +80,76 @@ export class DebugInfoRerunQueryReq extends Schema.TaggedStruct('LSD.DebugInfoRe
49
80
  queryStr: Schema.String,
50
81
  bindValues: Schema.UndefinedOr(PreparedBindValues),
51
82
  queriedTables: Schema.ReadonlySet(Schema.String),
52
- }) {
83
+ }).annotations({ identifier: 'LSD.DebugInfoRerunQueryReq' }) {
53
84
  }
54
85
  export class DebugInfoRerunQueryRes extends Schema.TaggedStruct('LSD.DebugInfoRerunQueryRes', {
55
86
  liveStoreVersion,
56
87
  requestId,
57
- }) {
88
+ }).annotations({ identifier: 'LSD.DebugInfoRerunQueryRes' }) {
58
89
  }
59
90
  export class MutationBroadcast extends Schema.TaggedStruct('LSD.MutationBroadcast', {
91
+ liveStoreVersion,
92
+ mutationEventEncoded: mutationEventSchemaEncodedAny,
93
+ persisted: Schema.Boolean,
94
+ }).annotations({ identifier: 'LSD.MutationBroadcast' }) {
95
+ }
96
+ export class RunMutationReq extends Schema.TaggedStruct('LSD.RunMutationReq', {
60
97
  liveStoreVersion,
61
98
  requestId,
99
+ channelId,
62
100
  mutationEventEncoded: mutationEventSchemaEncodedAny,
63
101
  persisted: Schema.Boolean,
64
- }) {
102
+ }).annotations({ identifier: 'LSD.RunMutationReq' }) {
103
+ }
104
+ export class RunMutationRes extends Schema.TaggedStruct('LSD.RunMutationRes', {
105
+ liveStoreVersion,
106
+ requestId,
107
+ channelId,
108
+ }).annotations({ identifier: 'LSD.RunMutationRes' }) {
65
109
  }
66
110
  export class MutationLogReq extends Schema.TaggedStruct('LSD.MutationLogReq', {
67
111
  liveStoreVersion,
68
112
  requestId,
69
113
  channelId,
70
- }) {
114
+ }).annotations({ identifier: 'LSD.MutationLogReq' }) {
71
115
  }
72
116
  export class MutationLogRes extends Schema.TaggedStruct('LSD.MutationLogRes', {
73
117
  liveStoreVersion,
74
118
  requestId,
75
- mutationLog: Schema.Uint8Array,
76
- }) {
119
+ channelId,
120
+ mutationLog: Transferable.Uint8Array,
121
+ }).annotations({ identifier: 'LSD.MutationLogRes' }) {
77
122
  }
78
- export class SignalsSubscribe extends Schema.TaggedStruct('LSD.SignalsSubscribe', {
123
+ export class ReactivityGraphSubscribe extends Schema.TaggedStruct('LSD.ReactivityGraphSubscribe', {
79
124
  liveStoreVersion,
80
125
  requestId,
81
126
  channelId,
82
127
  includeResults: Schema.Boolean,
83
- }) {
128
+ }).annotations({ identifier: 'LSD.ReactivityGraphSubscribe' }) {
84
129
  }
85
- export class SignalsUnsubscribe extends Schema.TaggedStruct('LSD.SignalsUnsubscribe', {
130
+ export class ReactivityGraphUnsubscribe extends Schema.TaggedStruct('LSD.ReactivityGraphUnsubscribe', {
86
131
  liveStoreVersion,
87
132
  requestId,
88
133
  channelId,
89
- }) {
134
+ }).annotations({ identifier: 'LSD.ReactivityGraphUnsubscribe' }) {
90
135
  }
91
- export class SignalsRes extends Schema.TaggedStruct('LSD.SignalsRes', {
136
+ export class ReactivityGraphRes extends Schema.TaggedStruct('LSD.ReactivityGraphRes', {
92
137
  liveStoreVersion,
93
138
  requestId,
94
- signals: Schema.Any,
95
- }) {
139
+ reactivityGraph: Schema.Any,
140
+ }).annotations({ identifier: 'LSD.ReactivityGraphRes' }) {
96
141
  }
97
142
  export class LiveQueriesSubscribe extends Schema.TaggedStruct('LSD.LiveQueriesSubscribe', {
98
143
  liveStoreVersion,
99
144
  requestId,
100
145
  channelId,
101
- }) {
146
+ }).annotations({ identifier: 'LSD.LiveQueriesSubscribe' }) {
102
147
  }
103
148
  export class LiveQueriesUnsubscribe extends Schema.TaggedStruct('LSD.LiveQueriesUnsubscribe', {
104
149
  liveStoreVersion,
105
150
  requestId,
106
151
  channelId,
107
- }) {
152
+ }).annotations({ identifier: 'LSD.LiveQueriesUnsubscribe' }) {
108
153
  }
109
154
  export class SerializedLiveQuery extends Schema.Struct({
110
155
  _tag: Schema.Literal('js', 'sql', 'graphql'),
@@ -114,62 +159,79 @@ export class SerializedLiveQuery extends Schema.Struct({
114
159
  executionTimes: Schema.Array(Schema.Number),
115
160
  lastestResult: Schema.Any,
116
161
  activeSubscriptions: Schema.Array(Schema.Struct({ frames: Schema.Array(Schema.Struct({ name: Schema.String, filePath: Schema.String })) })),
117
- }) {
162
+ }).annotations({ identifier: 'SerializedLiveQuery' }) {
118
163
  }
119
164
  export class LiveQueriesRes extends Schema.TaggedStruct('LSD.LiveQueriesRes', {
120
165
  liveStoreVersion,
121
166
  requestId,
122
167
  liveQueries: Schema.Array(SerializedLiveQuery),
123
- }) {
168
+ }).annotations({ identifier: 'LSD.LiveQueriesRes' }) {
124
169
  }
125
170
  export class ResetAllDataReq extends Schema.TaggedStruct('LSD.ResetAllDataReq', {
126
171
  liveStoreVersion,
127
172
  requestId,
128
173
  channelId,
129
174
  mode: Schema.Literal('all-data', 'only-app-db'),
130
- }) {
175
+ }).annotations({ identifier: 'LSD.ResetAllDataReq' }) {
131
176
  }
132
177
  export class ResetAllDataRes extends Schema.TaggedStruct('LSD.ResetAllDataRes', {
133
178
  liveStoreVersion,
134
179
  requestId,
135
- }) {
180
+ }).annotations({ identifier: 'LSD.ResetAllDataRes' }) {
136
181
  }
137
- export class NetworkStatusBroadcast extends Schema.TaggedStruct('LSD.NetworkStatusBroadcast', {
182
+ export class MessagePortForStoreReq extends Schema.TaggedStruct('LSD.MessagePortForStoreReq', {
183
+ liveStoreVersion,
184
+ requestId,
185
+ channelId,
186
+ }).annotations({ identifier: 'LSD.MessagePortForStoreReq' }) {
187
+ }
188
+ export class MessagePortForStoreRes extends Schema.TaggedStruct('LSD.MessagePortForStoreRes', {
189
+ liveStoreVersion,
190
+ requestId,
191
+ channelId,
192
+ port: Transferable.MessagePort,
193
+ }).annotations({ identifier: 'LSD.MessagePortForStoreRes' }) {
194
+ }
195
+ export class NetworkStatusChanged extends Schema.TaggedStruct('LSD.NetworkStatusChanged', {
138
196
  liveStoreVersion,
139
197
  channelId,
140
198
  networkStatus: NetworkStatus,
141
- }) {
199
+ }).annotations({ identifier: 'LSD.NetworkStatusChanged' }) {
142
200
  }
143
- export class DevtoolsReadyBroadcast extends Schema.TaggedStruct('LSD.DevtoolsReadyBroadcast', {
201
+ export class DevtoolsReady extends Schema.TaggedStruct('LSD.DevtoolsReady', {
144
202
  liveStoreVersion,
145
- }) {
203
+ }).annotations({ identifier: 'LSD.DevtoolsReady' }) {
146
204
  }
147
205
  export class DevtoolsConnected extends Schema.TaggedStruct('LSD.DevtoolsConnected', {
148
206
  liveStoreVersion,
149
207
  channelId,
150
- }) {
208
+ }).annotations({ identifier: 'LSD.DevtoolsConnected' }) {
151
209
  }
152
- export class AppHostReadyBroadcast extends Schema.TaggedStruct('LSD.AppHostReadyBroadcast', {
210
+ export class AppHostReady extends Schema.TaggedStruct('LSD.AppHostReady', {
153
211
  liveStoreVersion,
154
212
  channelId,
155
- }) {
213
+ isLeaderTab: Schema.Boolean,
214
+ }).annotations({ identifier: 'LSD.AppHostReady' }) {
156
215
  }
157
216
  export class Disconnect extends Schema.TaggedStruct('LSD.Disconnect', {
158
217
  liveStoreVersion,
159
218
  requestId,
160
219
  channelId,
161
- }) {
220
+ }).annotations({ identifier: 'LSD.Disconnect' }) {
221
+ }
222
+ export class Ping extends Schema.TaggedStruct('LSD.Ping', {
223
+ liveStoreVersion,
224
+ requestId,
225
+ channelId,
226
+ }).annotations({ identifier: 'LSD.Ping' }) {
227
+ }
228
+ export class Pong extends Schema.TaggedStruct('LSD.Pong', {
229
+ liveStoreVersion,
230
+ requestId,
231
+ }).annotations({ identifier: 'LSD.Pong' }) {
162
232
  }
163
- // export class SchemaChanged extends Schema.TaggedStruct('LSD.SchemaChanged', {
164
- // requestId,
165
- // }) {}
166
- export const MessageToAppHost = Schema.Union(SnapshotReq, MutationLogReq, DebugInfoReq, DebugInfoResetReq, DebugInfoRerunQueryReq, SignalsSubscribe, SignalsUnsubscribe, LiveQueriesSubscribe, LiveQueriesUnsubscribe, ResetAllDataReq, DevtoolsReadyBroadcast, Disconnect, DevtoolsConnected);
167
- export const MessageFromAppHost = Schema.Union(SnapshotRes, MutationLogRes, DebugInfoRes, DebugInfoResetRes, DebugInfoRerunQueryRes, SignalsRes, LiveQueriesRes, ResetAllDataRes, Disconnect,
168
- // SchemaChanged,
169
- MutationBroadcast, AppHostReadyBroadcast, NetworkStatusBroadcast);
170
- // TODO make specific over app key
171
- export const makeBroadcastChannels = () => ({
172
- fromAppHost: new BroadcastChannel(`livestore-devtools-from-app-host`),
173
- toAppHost: new BroadcastChannel(`livestore-devtools-to-app-host`),
174
- });
233
+ export const MessageToAppHostCoordinator = Schema.Union(SnapshotReq, LoadDatabaseFileReq, MutationLogReq, ResetAllDataReq, MessagePortForStoreRes, DevtoolsReady, Disconnect, DevtoolsConnected, RunMutationReq, Ping).annotations({ identifier: 'LSD.MessageToAppHostCoordinator' });
234
+ export const MessageToAppHostStore = Schema.Union(DebugInfoReq, DebugInfoHistorySubscribe, DebugInfoHistoryUnsubscribe, DebugInfoResetReq, DebugInfoRerunQueryReq, ReactivityGraphSubscribe, ReactivityGraphUnsubscribe, LiveQueriesSubscribe, LiveQueriesUnsubscribe).annotations({ identifier: 'LSD.MessageToAppHostStore' });
235
+ export const MessageFromAppHostCoordinator = Schema.Union(SnapshotRes, LoadDatabaseFileRes, MutationLogRes, ResetAllDataRes, MessagePortForStoreReq, Disconnect, MutationBroadcast, AppHostReady, NetworkStatusChanged, RunMutationRes, Pong).annotations({ identifier: 'LSD.MessageFromAppHostCoordinator' });
236
+ export const MessageFromAppHostStore = Schema.Union(DebugInfoRes, DebugInfoHistoryRes, DebugInfoResetRes, DebugInfoRerunQueryRes, ReactivityGraphRes, LiveQueriesRes).annotations({ identifier: 'LSD.MessageFromAppHostStore' });
175
237
  //# sourceMappingURL=devtools-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Y,CAAC,UAAU,EAAE;IACxD,gBAAgB;IAChB,SAAS;CACV,CAAC,CAAC,WAAW,CAAC,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC;CAAG;AAE7C,MAAM,CAAC,MAAM,2BAA2B,GAAG,MAAM,CAAC,KAAK,CACrD,WAAW,EACX,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,sBAAsB,EACtB,aAAa,EACb,UAAU,EACV,iBAAiB,EACjB,cAAc,EACd,IAAI,CACL,CAAC,WAAW,CAAC,EAAE,UAAU,EAAE,iCAAiC,EAAE,CAAC,CAAA;AAIhE,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC,KAAK,CAC/C,YAAY,EACZ,yBAAyB,EACzB,2BAA2B,EAC3B,iBAAiB,EACjB,sBAAsB,EACtB,wBAAwB,EACxB,0BAA0B,EAC1B,oBAAoB,EACpB,sBAAsB,CAEvB,CAAC,WAAW,CAAC,EAAE,UAAU,EAAE,2BAA2B,EAAE,CAAC,CAAA;AAI1D,MAAM,CAAC,MAAM,6BAA6B,GAAG,MAAM,CAAC,KAAK,CACvD,WAAW,EACX,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,sBAAsB,EACtB,UAAU,EACV,iBAAiB,EACjB,YAAY,EACZ,oBAAoB,EACpB,cAAc,EACd,IAAI,CACL,CAAC,WAAW,CAAC,EAAE,UAAU,EAAE,mCAAmC,EAAE,CAAC,CAAA;AAIlE,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC,KAAK,CACjD,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EACjB,sBAAsB,EACtB,kBAAkB,EAClB,cAAc,CAEf,CAAC,WAAW,CAAC,EAAE,UAAU,EAAE,6BAA6B,EAAE,CAAC,CAAA"}
@@ -0,0 +1,29 @@
1
+ import { Schema } from '@livestore/utils/effect';
2
+ export declare namespace DevtoolsWindowMessage {
3
+ const MessagePortReady_base: Schema.TaggedStruct<"LSD.WindowMessage.MessagePortForStore", {
4
+ port: Schema.Schema<MessagePort, MessagePort, never>;
5
+ channelId: typeof Schema.String;
6
+ }>;
7
+ /** Message is being created in contentscript-iframe, sent to contentscript and then sent to Store */
8
+ export class MessagePortReady extends MessagePortReady_base {
9
+ }
10
+ const ContentscriptListening_base: Schema.TaggedStruct<"LSD.WindowMessage.ContentscriptListening", {}>;
11
+ export class ContentscriptListening extends ContentscriptListening_base {
12
+ }
13
+ const LoadIframe_base: Schema.TaggedStruct<"LSD.WindowMessage.LoadIframe", {}>;
14
+ export class LoadIframe extends LoadIframe_base {
15
+ }
16
+ const StoreReady_base: Schema.TaggedStruct<"LSD.WindowMessage.StoreReady", {
17
+ channelId: typeof Schema.String;
18
+ }>;
19
+ export class StoreReady extends StoreReady_base {
20
+ }
21
+ const MessageForStore_base: Schema.Union<[typeof MessagePortReady, typeof ContentscriptListening]>;
22
+ export class MessageForStore extends MessageForStore_base {
23
+ }
24
+ const MessageForContentscript_base: Schema.Union<[typeof StoreReady, typeof LoadIframe]>;
25
+ export class MessageForContentscript extends MessageForContentscript_base {
26
+ }
27
+ export {};
28
+ }
29
+ //# sourceMappingURL=devtools-window-message.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"devtools-window-message.d.ts","sourceRoot":"","sources":["../../src/devtools/devtools-window-message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAgB,MAAM,yBAAyB,CAAA;AAI9D,yBAAiB,qBAAqB,CAAC;;;;;IACrC,qGAAqG;IACrG,MAAM,OAAO,gBAAiB,SAAQ,qBAGpC;KAAG;;IAEL,MAAM,OAAO,sBAAuB,SAAQ,2BAAmE;KAAG;;IAMlH,MAAM,OAAO,UAAW,SAAQ,eAAuD;KAAG;;;;IAE1F,MAAM,OAAO,UAAW,SAAQ,eAE9B;KAAG;;IAEL,MAAM,OAAO,eAAgB,SAAQ,oBAAsD;KAAG;;IAE9F,MAAM,OAAO,uBAAwB,SAAQ,4BAAoC;KAAG;;CACrF"}
@@ -0,0 +1,33 @@
1
+ import { Schema, Transferable } from '@livestore/utils/effect';
2
+ const channelId = Schema.String;
3
+ export var DevtoolsWindowMessage;
4
+ (function (DevtoolsWindowMessage) {
5
+ /** Message is being created in contentscript-iframe, sent to contentscript and then sent to Store */
6
+ class MessagePortReady extends Schema.TaggedStruct('LSD.WindowMessage.MessagePortForStore', {
7
+ port: Transferable.MessagePort,
8
+ channelId,
9
+ }) {
10
+ }
11
+ DevtoolsWindowMessage.MessagePortReady = MessagePortReady;
12
+ class ContentscriptListening extends Schema.TaggedStruct('LSD.WindowMessage.ContentscriptListening', {}) {
13
+ }
14
+ DevtoolsWindowMessage.ContentscriptListening = ContentscriptListening;
15
+ // export class ContentscriptReady extends Schema.TaggedStruct('LSD.WindowMessage.ContentscriptReady', {
16
+ // channelId,
17
+ // }) {}
18
+ class LoadIframe extends Schema.TaggedStruct('LSD.WindowMessage.LoadIframe', {}) {
19
+ }
20
+ DevtoolsWindowMessage.LoadIframe = LoadIframe;
21
+ class StoreReady extends Schema.TaggedStruct('LSD.WindowMessage.StoreReady', {
22
+ channelId,
23
+ }) {
24
+ }
25
+ DevtoolsWindowMessage.StoreReady = StoreReady;
26
+ class MessageForStore extends Schema.Union(MessagePortReady, ContentscriptListening) {
27
+ }
28
+ DevtoolsWindowMessage.MessageForStore = MessageForStore;
29
+ class MessageForContentscript extends Schema.Union(StoreReady, LoadIframe) {
30
+ }
31
+ DevtoolsWindowMessage.MessageForContentscript = MessageForContentscript;
32
+ })(DevtoolsWindowMessage || (DevtoolsWindowMessage = {}));
33
+ //# sourceMappingURL=devtools-window-message.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"devtools-window-message.js","sourceRoot":"","sources":["../../src/devtools/devtools-window-message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAE9D,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAA;AAE/B,MAAM,KAAW,qBAAqB,CAsBrC;AAtBD,WAAiB,qBAAqB;IACpC,qGAAqG;IACrG,MAAa,gBAAiB,SAAQ,MAAM,CAAC,YAAY,CAAC,uCAAuC,EAAE;QACjG,IAAI,EAAE,YAAY,CAAC,WAAW;QAC9B,SAAS;KACV,CAAC;KAAG;IAHQ,sCAAgB,mBAGxB,CAAA;IAEL,MAAa,sBAAuB,SAAQ,MAAM,CAAC,YAAY,CAAC,0CAA0C,EAAE,EAAE,CAAC;KAAG;IAArG,4CAAsB,yBAA+E,CAAA;IAElH,wGAAwG;IACxG,cAAc;IACd,QAAQ;IAER,MAAa,UAAW,SAAQ,MAAM,CAAC,YAAY,CAAC,8BAA8B,EAAE,EAAE,CAAC;KAAG;IAA7E,gCAAU,aAAmE,CAAA;IAE1F,MAAa,UAAW,SAAQ,MAAM,CAAC,YAAY,CAAC,8BAA8B,EAAE;QAClF,SAAS;KACV,CAAC;KAAG;IAFQ,gCAAU,aAElB,CAAA;IAEL,MAAa,eAAgB,SAAQ,MAAM,CAAC,KAAK,CAAC,gBAAgB,EAAE,sBAAsB,CAAC;KAAG;IAAjF,qCAAe,kBAAkE,CAAA;IAE9F,MAAa,uBAAwB,SAAQ,MAAM,CAAC,KAAK,CAAC,UAAU,EAAE,UAAU,CAAC;KAAG;IAAvE,6CAAuB,0BAAgD,CAAA;AACtF,CAAC,EAtBgB,qBAAqB,KAArB,qBAAqB,QAsBrC"}
@@ -1,2 +1,3 @@
1
1
  export * from './devtools-messages.js';
2
+ export * from './devtools-window-message.js';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/devtools/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/devtools/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA;AACtC,cAAc,8BAA8B,CAAA"}
@@ -1,2 +1,3 @@
1
1
  export * from './devtools-messages.js';
2
+ export * from './devtools-window-message.js';
2
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/devtools/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/devtools/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA;AACtC,cAAc,8BAA8B,CAAA"}
package/dist/index.d.ts CHANGED
@@ -11,4 +11,5 @@ export * from './sync/index.js';
11
11
  export * as Devtools from './devtools/index.js';
12
12
  export * from './debug-info.js';
13
13
  export * from './bounded-collections.js';
14
+ export * from './version.js';
14
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAA;AACzC,cAAc,WAAW,CAAA;AACzB,cAAc,oBAAoB,CAAA;AAClC,cAAc,mCAAmC,CAAA;AACjD,cAAc,eAAe,CAAA;AAC7B,cAAc,4BAA4B,CAAA;AAC1C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,iBAAiB,CAAA;AAC/B,cAAc,wBAAwB,CAAA;AACtC,cAAc,iBAAiB,CAAA;AAC/B,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAA;AAC/C,cAAc,iBAAiB,CAAA;AAC/B,cAAc,0BAA0B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAA;AACzC,cAAc,WAAW,CAAA;AACzB,cAAc,oBAAoB,CAAA;AAClC,cAAc,mCAAmC,CAAA;AACjD,cAAc,eAAe,CAAA;AAC7B,cAAc,4BAA4B,CAAA;AAC1C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,iBAAiB,CAAA;AAC/B,cAAc,wBAAwB,CAAA;AACtC,cAAc,iBAAiB,CAAA;AAC/B,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAA;AAC/C,cAAc,iBAAiB,CAAA;AAC/B,cAAc,0BAA0B,CAAA;AACxC,cAAc,cAAc,CAAA"}
package/dist/index.js CHANGED
@@ -11,4 +11,5 @@ export * from './sync/index.js';
11
11
  export * as Devtools from './devtools/index.js';
12
12
  export * from './debug-info.js';
13
13
  export * from './bounded-collections.js';
14
+ export * from './version.js';
14
15
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAA;AACzC,cAAc,WAAW,CAAA;AACzB,cAAc,oBAAoB,CAAA;AAClC,cAAc,mCAAmC,CAAA;AACjD,cAAc,eAAe,CAAA;AAC7B,cAAc,4BAA4B,CAAA;AAC1C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,iBAAiB,CAAA;AAC/B,cAAc,wBAAwB,CAAA;AACtC,cAAc,iBAAiB,CAAA;AAC/B,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAA;AAC/C,cAAc,iBAAiB,CAAA;AAC/B,cAAc,0BAA0B,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAA;AACzC,cAAc,WAAW,CAAA;AACzB,cAAc,oBAAoB,CAAA;AAClC,cAAc,mCAAmC,CAAA;AACjD,cAAc,eAAe,CAAA;AAC7B,cAAc,4BAA4B,CAAA;AAC1C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,iBAAiB,CAAA;AAC/B,cAAc,wBAAwB,CAAA;AACtC,cAAc,iBAAiB,CAAA;AAC/B,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAA;AAC/C,cAAc,iBAAiB,CAAA;AAC/B,cAAc,0BAA0B,CAAA;AACxC,cAAc,cAAc,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"mutation.d.ts","sourceRoot":"","sources":["../src/mutation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AACvE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA;AAGnD,eAAO,MAAM,uBAAuB,2CAGjC;IACD,WAAW,EAAE,YAAY,GAAG,CAAA;IAC5B,oBAAoB,EAAE,cAAc,GAAG,CAAA;CACxC,KAAG,cAAc;IAChB,YAAY,EAAE,MAAM,CAAA;IACpB,UAAU,EAAE,kBAAkB,CAAA;IAC9B,WAAW,EAAE,YAAY,MAAM,CAAC,GAAG,SAAS,CAAA;CAC7C,CAiCA,CAAA"}
1
+ {"version":3,"file":"mutation.d.ts","sourceRoot":"","sources":["../src/mutation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AACvE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA;AAGnD,eAAO,MAAM,uBAAuB,2CAGjC;IACD,WAAW,EAAE,WAAW,CAAC,GAAG,CAAA;IAC5B,oBAAoB,EAAE,aAAa,CAAC,GAAG,CAAA;CACxC,KAAG,aAAa,CAAC;IAChB,YAAY,EAAE,MAAM,CAAA;IACpB,UAAU,EAAE,kBAAkB,CAAA;IAC9B,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,SAAS,CAAA;CAC7C,CAiCA,CAAA"}
@@ -1,9 +1,14 @@
1
- import type { InMemoryDatabase, MigrationOptionsFromMutationLog } from './adapter-types.js';
1
+ import { Effect } from '@livestore/utils/effect';
2
+ import { type InMemoryDatabase, type MigrationOptionsFromMutationLog, SqliteError } from './adapter-types.js';
2
3
  import type { LiveStoreSchema } from './schema/index.js';
3
- export declare const rehydrateFromMutationLog: ({ logDb, db, schema, migrationOptions, }: {
4
+ export declare const rehydrateFromMutationLog: ({ logDb, db, schema, migrationOptions, onProgress, }: {
4
5
  logDb: InMemoryDatabase;
5
6
  db: InMemoryDatabase;
6
7
  schema: LiveStoreSchema;
7
8
  migrationOptions: MigrationOptionsFromMutationLog;
8
- }) => Promise<undefined>;
9
+ onProgress: (_: {
10
+ done: number;
11
+ total: number;
12
+ }) => Effect.Effect<void>;
13
+ }) => Effect.Effect<void, SqliteError, never>;
9
14
  //# sourceMappingURL=rehydrate-from-mutationlog.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rehydrate-from-mutationlog.d.ts","sourceRoot":"","sources":["../src/rehydrate-from-mutationlog.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,+BAA+B,EAAE,MAAM,oBAAoB,CAAA;AAE3F,OAAO,KAAK,EAAE,eAAe,EAAsB,MAAM,mBAAmB,CAAA;AAG5E,eAAO,MAAM,wBAAwB,6CAKlC;IACD,KAAK,EAAE,gBAAgB,CAAA;IACvB,EAAE,EAAE,gBAAgB,CAAA;IACpB,MAAM,EAAE,eAAe,CAAA;IACvB,gBAAgB,EAAE,+BAA+B,CAAA;CAClD,uBAwEA,CAAA"}
1
+ {"version":3,"file":"rehydrate-from-mutationlog.d.ts","sourceRoot":"","sources":["../src/rehydrate-from-mutationlog.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,MAAM,EAA0B,MAAM,yBAAyB,CAAA;AAE/E,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,+BAA+B,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAE7G,OAAO,KAAK,EAAE,eAAe,EAAsB,MAAM,mBAAmB,CAAA;AAK5E,eAAO,MAAM,wBAAwB,yDAMlC;IACD,KAAK,EAAE,gBAAgB,CAAA;IACvB,EAAE,EAAE,gBAAgB,CAAA;IACpB,MAAM,EAAE,eAAe,CAAA;IACvB,gBAAgB,EAAE,+BAA+B,CAAA;IACjD,UAAU,EAAE,CAAC,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;CACxE,4CAuGE,CAAA"}
@@ -1,68 +1,83 @@
1
1
  import { shouldNeverHappen } from '@livestore/utils';
2
- import { Schema } from '@livestore/utils/effect';
2
+ import { Chunk, Effect, Option, Schema, Stream } from '@livestore/utils/effect';
3
+ import { SqliteError } from './adapter-types.js';
3
4
  import { getExecArgsFromMutation } from './mutation.js';
4
5
  import { MUTATION_LOG_META_TABLE } from './schema/index.js';
5
- export const rehydrateFromMutationLog = async ({ logDb, db, schema, migrationOptions, }) => {
6
- try {
7
- // TODO possibly implement this in a streaming fashion
8
- const stmt = logDb.prepare(`SELECT * FROM ${MUTATION_LOG_META_TABLE} ORDER BY id ASC`);
9
- const results = stmt.select(undefined);
10
- performance.mark('livestore:hydrate-from-mutationlog:start');
11
- for (const row of results) {
12
- const mutationDef = schema.mutations.get(row.mutation) ?? shouldNeverHappen(`Unknown mutation ${row.mutation}`);
13
- if (migrationOptions.excludeMutations?.has(row.mutation) === true)
14
- continue;
15
- if (Schema.hash(mutationDef.schema) !== row.schemaHash) {
16
- console.warn(`Schema hash mismatch for mutation ${row.mutation}. Trying to apply mutation anyway.`);
17
- }
18
- const argsDecodedEither = Schema.decodeUnknownEither(Schema.parseJson(mutationDef.schema))(row.argsJson);
19
- if (argsDecodedEither._tag === 'Left') {
20
- return shouldNeverHappen(`\
6
+ import { sql } from './util.js';
7
+ export const rehydrateFromMutationLog = ({ logDb, db, schema, migrationOptions, onProgress, }) => Effect.gen(function* () {
8
+ const mutationsCount = logDb
9
+ .prepare(`SELECT COUNT(*) AS count FROM ${MUTATION_LOG_META_TABLE}`)
10
+ .select(undefined)[0].count;
11
+ const processMutation = (row) => Effect.gen(function* () {
12
+ const mutationDef = schema.mutations.get(row.mutation) ?? shouldNeverHappen(`Unknown mutation ${row.mutation}`);
13
+ if (migrationOptions.excludeMutations?.has(row.mutation) === true)
14
+ return;
15
+ if (Schema.hash(mutationDef.schema) !== row.schemaHash) {
16
+ console.warn(`Schema hash mismatch for mutation ${row.mutation}. Trying to apply mutation anyway.`);
17
+ }
18
+ const argsDecodedEither = Schema.decodeUnknownEither(Schema.parseJson(mutationDef.schema))(row.argsJson);
19
+ if (argsDecodedEither._tag === 'Left') {
20
+ return shouldNeverHappen(`\
21
21
  There was an error decoding the persisted mutation event args for mutation "${row.mutation}".
22
22
  This likely means the schema has changed in an incompatible way.
23
23
 
24
24
  Error: ${argsDecodedEither.left}
25
25
  `);
26
- }
27
- const mutationEventDecoded = {
28
- id: row.id,
29
- mutation: row.mutation,
30
- args: argsDecodedEither.right,
31
- };
32
- // const argsEncoded = JSON.parse(row.args_json)
33
- // const mutationSqlRes =
34
- // typeof mutation.sql === 'string'
35
- // ? mutation.sql
36
- // : mutation.sql(Schema.decodeUnknownSync(mutation.schema)(argsEncoded))
37
- // const mutationSql = typeof mutationSqlRes === 'string' ? mutationSqlRes : mutationSqlRes.sql
38
- // const bindValues = typeof mutationSqlRes === 'string' ? argsEncoded : mutationSqlRes.bindValues
39
- const execArgsArr = getExecArgsFromMutation({ mutationDef, mutationEventDecoded });
40
- for (const { statementSql, bindValues } of execArgsArr) {
41
- try {
42
- const getRowsChanged = db.execute(statementSql, bindValues);
43
- if (import.meta.env.DEV &&
44
- getRowsChanged() === 0 &&
45
- migrationOptions.logging?.excludeAffectedRows?.(statementSql) !== true) {
46
- console.warn(`Mutation "${mutationDef.name}" did not affect any rows:`, statementSql, bindValues);
47
- }
48
- // console.log(`Re-executed mutation ${mutationSql}`, bindValues)
49
- }
50
- catch (e) {
51
- console.error(`Error executing migration for mutation ${statementSql}`, bindValues, e);
52
- debugger;
53
- throw e;
26
+ }
27
+ const mutationEventDecoded = {
28
+ id: row.id,
29
+ mutation: row.mutation,
30
+ args: argsDecodedEither.right,
31
+ };
32
+ // const argsEncoded = JSON.parse(row.args_json)
33
+ // const mutationSqlRes =
34
+ // typeof mutation.sql === 'string'
35
+ // ? mutation.sql
36
+ // : mutation.sql(Schema.decodeUnknownSync(mutation.schema)(argsEncoded))
37
+ // const mutationSql = typeof mutationSqlRes === 'string' ? mutationSqlRes : mutationSqlRes.sql
38
+ // const bindValues = typeof mutationSqlRes === 'string' ? argsEncoded : mutationSqlRes.bindValues
39
+ const execArgsArr = getExecArgsFromMutation({ mutationDef, mutationEventDecoded });
40
+ for (const { statementSql, bindValues } of execArgsArr) {
41
+ try {
42
+ // TODO cache prepared statements for mutations
43
+ const getRowsChanged = db.execute(statementSql, bindValues);
44
+ if (import.meta.env.DEV &&
45
+ getRowsChanged() === 0 &&
46
+ migrationOptions.logging?.excludeAffectedRows?.(statementSql) !== true) {
47
+ console.warn(`Mutation "${mutationDef.name}" did not affect any rows:`, statementSql, bindValues);
54
48
  }
49
+ // console.log(`Re-executed mutation ${mutationSql}`, bindValues)
50
+ }
51
+ catch (e) {
52
+ yield* new SqliteError({
53
+ sql: statementSql,
54
+ bindValues,
55
+ code: e.resultCode,
56
+ cause: e,
57
+ });
55
58
  }
56
59
  }
57
- }
58
- catch (e) {
59
- console.error('Error while rehydrating database from mutation log', e);
60
- debugger;
61
- throw e;
62
- }
63
- finally {
64
- performance.mark('livestore:hydrate-from-mutationlog:end');
65
- performance.measure('livestore:hydrate-from-mutationlog', 'livestore:hydrate-from-mutationlog:start', 'livestore:hydrate-from-mutationlog:end');
66
- }
67
- };
60
+ }).pipe(Effect.withSpan(`@livestore/common:rehydrateFromMutationLog:processMutation`));
61
+ const CHUNK_SIZE = 100;
62
+ const stmt = logDb.prepare(sql `\
63
+ SELECT * FROM ${MUTATION_LOG_META_TABLE}
64
+ WHERE id > COALESCE($id, '')
65
+ ORDER BY id ASC
66
+ LIMIT ${CHUNK_SIZE}
67
+ `);
68
+ let processedMutations = 0;
69
+ yield* Stream.unfoldChunk({ _tag: 'Initial ' }, (item) => {
70
+ // End stream if no more rows
71
+ if (Chunk.isChunk(item) && item.length === 0)
72
+ return Option.none();
73
+ const lastId = Chunk.isChunk(item) ? Chunk.last(item).pipe(Option.getOrUndefined)?.id : undefined;
74
+ const nextItem = Chunk.fromIterable(stmt.select({ $id: lastId }));
75
+ const prevItem = Chunk.isChunk(item) ? item : Chunk.empty();
76
+ return Option.some([prevItem, nextItem]);
77
+ }).pipe(Stream.bufferChunks({ capacity: 2 }), Stream.tap((row) => Effect.gen(function* () {
78
+ yield* processMutation(row);
79
+ processedMutations++;
80
+ yield* onProgress({ done: processedMutations, total: mutationsCount });
81
+ })), Stream.runDrain);
82
+ }).pipe(Effect.withPerformanceMeasure('@livestore/common:rehydrateFromMutationLog'), Effect.withSpan('@livestore/common:rehydrateFromMutationLog'));
68
83
  //# sourceMappingURL=rehydrate-from-mutationlog.js.map