@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.
- package/dist/.tsbuildinfo +1 -1
- package/dist/adapter-types.d.ts +35 -47
- package/dist/adapter-types.d.ts.map +1 -1
- package/dist/adapter-types.js.map +1 -1
- package/dist/derived-mutations.d.ts +4 -4
- package/dist/derived-mutations.d.ts.map +1 -1
- package/dist/derived-mutations.test.js.map +1 -1
- package/dist/devtools/devtools-bridge.d.ts +1 -2
- package/dist/devtools/devtools-bridge.d.ts.map +1 -1
- package/dist/devtools/devtools-messages.d.ts +592 -3
- package/dist/devtools/devtools-messages.d.ts.map +1 -1
- package/dist/devtools/devtools-messages.js +171 -3
- package/dist/devtools/devtools-messages.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/init-singleton-tables.d.ts +2 -2
- package/dist/init-singleton-tables.d.ts.map +1 -1
- package/dist/init-singleton-tables.js.map +1 -1
- package/dist/leader-thread/apply-mutation.d.ts +2 -5
- package/dist/leader-thread/apply-mutation.d.ts.map +1 -1
- package/dist/leader-thread/apply-mutation.js +29 -41
- package/dist/leader-thread/apply-mutation.js.map +1 -1
- package/dist/leader-thread/connection.d.ts +4 -4
- package/dist/leader-thread/connection.d.ts.map +1 -1
- package/dist/leader-thread/connection.js +5 -5
- package/dist/leader-thread/connection.js.map +1 -1
- package/dist/leader-thread/leader-sync-processor.d.ts +2 -2
- package/dist/leader-thread/leader-sync-processor.d.ts.map +1 -1
- package/dist/leader-thread/leader-sync-processor.js +12 -20
- package/dist/leader-thread/leader-sync-processor.js.map +1 -1
- package/dist/leader-thread/leader-worker-devtools.d.ts +1 -1
- package/dist/leader-thread/leader-worker-devtools.d.ts.map +1 -1
- package/dist/leader-thread/leader-worker-devtools.js +81 -37
- package/dist/leader-thread/leader-worker-devtools.js.map +1 -1
- package/dist/leader-thread/make-leader-thread-layer.d.ts +11 -12
- package/dist/leader-thread/make-leader-thread-layer.d.ts.map +1 -1
- package/dist/leader-thread/make-leader-thread-layer.js +14 -33
- package/dist/leader-thread/make-leader-thread-layer.js.map +1 -1
- package/dist/leader-thread/mutationlog.d.ts +19 -6
- package/dist/leader-thread/mutationlog.d.ts.map +1 -1
- package/dist/leader-thread/mutationlog.js +6 -7
- package/dist/leader-thread/mutationlog.js.map +1 -1
- package/dist/leader-thread/pull-queue-set.d.ts.map +1 -1
- package/dist/leader-thread/recreate-db.d.ts.map +1 -1
- package/dist/leader-thread/recreate-db.js +18 -24
- package/dist/leader-thread/recreate-db.js.map +1 -1
- package/dist/leader-thread/types.d.ts +16 -36
- package/dist/leader-thread/types.d.ts.map +1 -1
- package/dist/leader-thread/types.js.map +1 -1
- package/dist/mutation.d.ts +2 -9
- package/dist/mutation.d.ts.map +1 -1
- package/dist/mutation.js +5 -5
- package/dist/mutation.js.map +1 -1
- package/dist/query-builder/impl.d.ts +1 -1
- package/dist/rehydrate-from-mutationlog.d.ts +5 -5
- package/dist/rehydrate-from-mutationlog.d.ts.map +1 -1
- package/dist/rehydrate-from-mutationlog.js +19 -13
- package/dist/rehydrate-from-mutationlog.js.map +1 -1
- package/dist/schema/EventId.d.ts +14 -16
- package/dist/schema/EventId.d.ts.map +1 -1
- package/dist/schema/EventId.js +7 -15
- package/dist/schema/EventId.js.map +1 -1
- package/dist/schema/MutationEvent.d.ts +80 -49
- package/dist/schema/MutationEvent.d.ts.map +1 -1
- package/dist/schema/MutationEvent.js +15 -32
- package/dist/schema/MutationEvent.js.map +1 -1
- package/dist/schema/system-tables.d.ts +26 -26
- package/dist/schema/system-tables.d.ts.map +1 -1
- package/dist/schema/system-tables.js +11 -19
- package/dist/schema/system-tables.js.map +1 -1
- package/dist/schema-management/common.d.ts +3 -3
- package/dist/schema-management/common.d.ts.map +1 -1
- package/dist/schema-management/common.js.map +1 -1
- package/dist/schema-management/migrations.d.ts +4 -4
- package/dist/schema-management/migrations.d.ts.map +1 -1
- package/dist/schema-management/migrations.js +6 -6
- package/dist/schema-management/migrations.js.map +1 -1
- package/dist/sync/client-session-sync-processor.d.ts +4 -4
- package/dist/sync/client-session-sync-processor.d.ts.map +1 -1
- package/dist/sync/index.d.ts +1 -1
- package/dist/sync/index.d.ts.map +1 -1
- package/dist/sync/index.js +1 -1
- package/dist/sync/index.js.map +1 -1
- package/dist/sync/next/history-dag-common.d.ts +4 -1
- package/dist/sync/next/history-dag-common.d.ts.map +1 -1
- package/dist/sync/next/history-dag-common.js +1 -1
- package/dist/sync/next/history-dag-common.js.map +1 -1
- package/dist/sync/next/rebase-events.d.ts +3 -3
- package/dist/sync/next/rebase-events.d.ts.map +1 -1
- package/dist/sync/next/rebase-events.js +2 -3
- package/dist/sync/next/rebase-events.js.map +1 -1
- package/dist/sync/next/test/mutation-fixtures.d.ts +7 -7
- package/dist/sync/next/test/mutation-fixtures.d.ts.map +1 -1
- package/dist/sync/next/test/mutation-fixtures.js +9 -3
- package/dist/sync/next/test/mutation-fixtures.js.map +1 -1
- package/dist/sync/sync.d.ts +11 -21
- package/dist/sync/sync.d.ts.map +1 -1
- package/dist/sync/sync.js.map +1 -1
- package/dist/sync/syncstate.d.ts +23 -45
- package/dist/sync/syncstate.d.ts.map +1 -1
- package/dist/sync/syncstate.js +12 -56
- package/dist/sync/syncstate.js.map +1 -1
- package/dist/sync/syncstate.test.js +69 -125
- package/dist/sync/syncstate.test.js.map +1 -1
- package/dist/sync/validate-push-payload.d.ts +2 -2
- package/dist/sync/validate-push-payload.d.ts.map +1 -1
- package/dist/sync/validate-push-payload.js +2 -2
- package/dist/sync/validate-push-payload.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +5 -6
- package/src/adapter-types.ts +40 -39
- package/src/derived-mutations.test.ts +1 -1
- package/src/derived-mutations.ts +5 -9
- package/src/devtools/devtools-bridge.ts +1 -2
- package/src/devtools/devtools-messages.ts +243 -3
- package/src/index.ts +6 -0
- package/src/init-singleton-tables.ts +2 -2
- package/src/leader-thread/apply-mutation.ts +35 -53
- package/src/leader-thread/connection.ts +7 -7
- package/src/leader-thread/{LeaderSyncProcessor.ts → leader-sync-processor.ts} +268 -306
- package/src/leader-thread/leader-worker-devtools.ts +124 -52
- package/src/leader-thread/make-leader-thread-layer.ts +30 -62
- package/src/leader-thread/mutationlog.ts +10 -14
- package/src/leader-thread/recreate-db.ts +20 -24
- package/src/leader-thread/types.ts +20 -41
- package/src/mutation.ts +7 -17
- package/src/rehydrate-from-mutationlog.ts +26 -18
- package/src/schema/EventId.ts +9 -23
- package/src/schema/MutationEvent.ts +24 -46
- package/src/schema/system-tables.ts +11 -19
- package/src/schema-management/common.ts +3 -3
- package/src/schema-management/migrations.ts +10 -10
- package/src/sync/{ClientSessionSyncProcessor.ts → client-session-sync-processor.ts} +19 -26
- package/src/sync/index.ts +1 -1
- package/src/sync/next/history-dag-common.ts +1 -1
- package/src/sync/next/rebase-events.ts +7 -7
- package/src/sync/next/test/mutation-fixtures.ts +10 -3
- package/src/sync/sync.ts +6 -19
- package/src/sync/syncstate.test.ts +67 -127
- package/src/sync/syncstate.ts +19 -21
- package/src/sync/validate-push-payload.ts +4 -7
- package/src/version.ts +1 -1
- package/dist/devtools/devtool-message-leader.d.ts +0 -2
- package/dist/devtools/devtool-message-leader.d.ts.map +0 -1
- package/dist/devtools/devtool-message-leader.js +0 -2
- package/dist/devtools/devtool-message-leader.js.map +0 -1
- package/dist/devtools/devtools-messages-client-session.d.ts +0 -297
- package/dist/devtools/devtools-messages-client-session.d.ts.map +0 -1
- package/dist/devtools/devtools-messages-client-session.js +0 -61
- package/dist/devtools/devtools-messages-client-session.js.map +0 -1
- package/dist/devtools/devtools-messages-common.d.ts +0 -65
- package/dist/devtools/devtools-messages-common.d.ts.map +0 -1
- package/dist/devtools/devtools-messages-common.js +0 -35
- package/dist/devtools/devtools-messages-common.js.map +0 -1
- package/dist/devtools/devtools-messages-leader.d.ts +0 -261
- package/dist/devtools/devtools-messages-leader.d.ts.map +0 -1
- package/dist/devtools/devtools-messages-leader.js +0 -85
- package/dist/devtools/devtools-messages-leader.js.map +0 -1
- package/dist/leader-thread/LeaderSyncProcessor.d.ts +0 -37
- package/dist/leader-thread/LeaderSyncProcessor.d.ts.map +0 -1
- package/dist/leader-thread/LeaderSyncProcessor.js +0 -432
- package/dist/leader-thread/LeaderSyncProcessor.js.map +0 -1
- package/dist/schema/EventId.test.d.ts +0 -2
- package/dist/schema/EventId.test.d.ts.map +0 -1
- package/dist/schema/EventId.test.js +0 -11
- package/dist/schema/EventId.test.js.map +0 -1
- package/dist/schema/MutationEvent.test.d.ts +0 -2
- package/dist/schema/MutationEvent.test.d.ts.map +0 -1
- package/dist/schema/MutationEvent.test.js +0 -2
- package/dist/schema/MutationEvent.test.js.map +0 -1
- package/dist/sync/ClientSessionSyncProcessor.d.ts +0 -43
- package/dist/sync/ClientSessionSyncProcessor.d.ts.map +0 -1
- package/dist/sync/ClientSessionSyncProcessor.js +0 -141
- package/dist/sync/ClientSessionSyncProcessor.js.map +0 -1
- package/src/devtools/devtools-messages-client-session.ts +0 -109
- package/src/devtools/devtools-messages-common.ts +0 -52
- package/src/devtools/devtools-messages-leader.ts +0 -115
- package/src/schema/EventId.test.ts +0 -12
@@ -1,13 +1,14 @@
|
|
1
1
|
import { LS_DEV, shouldNeverHappen, TRACE_VERBOSE } from '@livestore/utils'
|
2
|
-
import type {
|
2
|
+
import type { Scope } from '@livestore/utils/effect'
|
3
3
|
import { Effect, Schema, Stream } from '@livestore/utils/effect'
|
4
4
|
import * as otel from '@opentelemetry/api'
|
5
5
|
|
6
|
-
import type {
|
6
|
+
import type { Coordinator, UnexpectedError } from '../adapter-types.js'
|
7
7
|
import * as EventId from '../schema/EventId.js'
|
8
8
|
import { type LiveStoreSchema } from '../schema/mod.js'
|
9
9
|
import * as MutationEvent from '../schema/MutationEvent.js'
|
10
|
-
import { SyncState
|
10
|
+
import type { SyncState } from './syncstate.js'
|
11
|
+
import { updateSyncState } from './syncstate.js'
|
11
12
|
|
12
13
|
/**
|
13
14
|
* Rebase behaviour:
|
@@ -20,18 +21,20 @@ import { SyncState, updateSyncState } from './syncstate.js'
|
|
20
21
|
*/
|
21
22
|
export const makeClientSessionSyncProcessor = ({
|
22
23
|
schema,
|
23
|
-
|
24
|
-
|
24
|
+
initialLeaderHead,
|
25
|
+
pushToLeader,
|
26
|
+
pullFromLeader,
|
25
27
|
applyMutation,
|
26
28
|
rollback,
|
27
29
|
refreshTables,
|
28
30
|
span,
|
29
31
|
}: {
|
30
32
|
schema: LiveStoreSchema
|
31
|
-
|
32
|
-
|
33
|
+
initialLeaderHead: EventId.EventId
|
34
|
+
pushToLeader: (batch: ReadonlyArray<MutationEvent.AnyEncoded>) => void
|
35
|
+
pullFromLeader: Coordinator['mutations']['pull']
|
33
36
|
applyMutation: (
|
34
|
-
mutationEventDecoded: MutationEvent.
|
37
|
+
mutationEventDecoded: MutationEvent.PartialAny,
|
35
38
|
options: { otelContext: otel.Context; withChangeset: boolean },
|
36
39
|
) => {
|
37
40
|
writeTables: Set<string>
|
@@ -39,18 +42,19 @@ export const makeClientSessionSyncProcessor = ({
|
|
39
42
|
}
|
40
43
|
rollback: (changeset: Uint8Array) => void
|
41
44
|
refreshTables: (tables: Set<string>) => void
|
45
|
+
// rebaseBehaviour: 'auto-rebase' | 'manual-rebase'
|
42
46
|
span: otel.Span
|
43
47
|
}): ClientSessionSyncProcessor => {
|
44
48
|
const mutationEventSchema = MutationEvent.makeMutationEventSchemaMemo(schema)
|
45
49
|
|
46
50
|
const syncStateRef = {
|
47
|
-
current:
|
48
|
-
localHead:
|
49
|
-
upstreamHead:
|
51
|
+
current: {
|
52
|
+
localHead: initialLeaderHead,
|
53
|
+
upstreamHead: initialLeaderHead,
|
50
54
|
pending: [],
|
51
55
|
// TODO init rollbackTail from leader to be ready for backend rebasing
|
52
56
|
rollbackTail: [],
|
53
|
-
}
|
57
|
+
} as SyncState,
|
54
58
|
}
|
55
59
|
|
56
60
|
const isLocalEvent = (mutationEventEncoded: MutationEvent.EncodedWithMeta) => {
|
@@ -100,10 +104,7 @@ export const makeClientSessionSyncProcessor = ({
|
|
100
104
|
mutationEvent.meta.sessionChangeset = res.sessionChangeset
|
101
105
|
}
|
102
106
|
|
103
|
-
|
104
|
-
clientSession.leaderThread.mutations
|
105
|
-
.push(encodedMutationEvents)
|
106
|
-
.pipe(Effect.tapCauseLogPretty, Effect.provide(runtime), Effect.runFork)
|
107
|
+
pushToLeader(encodedMutationEvents)
|
107
108
|
|
108
109
|
return { writeTables }
|
109
110
|
}
|
@@ -111,13 +112,10 @@ export const makeClientSessionSyncProcessor = ({
|
|
111
112
|
const otelContext = otel.trace.setSpan(otel.context.active(), span)
|
112
113
|
|
113
114
|
const boot: ClientSessionSyncProcessor['boot'] = Effect.gen(function* () {
|
114
|
-
yield*
|
115
|
+
yield* pullFromLeader.pipe(
|
115
116
|
Stream.tap(({ payload, remaining }) =>
|
116
117
|
Effect.gen(function* () {
|
117
118
|
// console.log('pulled payload from leader', { payload, remaining })
|
118
|
-
if (clientSession.devtools.enabled) {
|
119
|
-
yield* clientSession.devtools.pullLatch.await
|
120
|
-
}
|
121
119
|
|
122
120
|
const updateResult = updateSyncState({
|
123
121
|
syncState: syncStateRef.current,
|
@@ -157,10 +155,6 @@ export const makeClientSessionSyncProcessor = ({
|
|
157
155
|
event.meta.sessionChangeset = undefined
|
158
156
|
}
|
159
157
|
}
|
160
|
-
|
161
|
-
clientSession.leaderThread.mutations
|
162
|
-
.push(updateResult.newSyncState.pending)
|
163
|
-
.pipe(Effect.tapCauseLogPretty, Effect.provide(runtime), Effect.runFork)
|
164
158
|
} else {
|
165
159
|
span.addEvent('pull:advance', {
|
166
160
|
payloadTag: payload._tag,
|
@@ -188,7 +182,6 @@ export const makeClientSessionSyncProcessor = ({
|
|
188
182
|
}),
|
189
183
|
),
|
190
184
|
Stream.runDrain,
|
191
|
-
Effect.forever, // NOTE Whenever the leader changes, we need to re-start the stream
|
192
185
|
Effect.tapCauseLogPretty,
|
193
186
|
Effect.forkScoped,
|
194
187
|
)
|
@@ -203,7 +196,7 @@ export const makeClientSessionSyncProcessor = ({
|
|
203
196
|
|
204
197
|
export interface ClientSessionSyncProcessor {
|
205
198
|
push: (
|
206
|
-
batch: ReadonlyArray<MutationEvent.
|
199
|
+
batch: ReadonlyArray<MutationEvent.PartialAny>,
|
207
200
|
options: { otelContext: otel.Context },
|
208
201
|
) => {
|
209
202
|
writeTables: Set<string>
|
package/src/sync/index.ts
CHANGED
@@ -20,7 +20,7 @@ export const emptyHistoryDag = (): HistoryDag =>
|
|
20
20
|
})
|
21
21
|
|
22
22
|
// TODO consider making `ROOT_ID` parent to itself
|
23
|
-
export const rootParentId =
|
23
|
+
export const rootParentId = { global: EventId.ROOT.global - 1, local: 0 } satisfies EventId.EventId
|
24
24
|
|
25
25
|
export type HistoryDagNode = {
|
26
26
|
id: EventId.EventId
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import * as EventId from '../../schema/EventId.js'
|
1
|
+
import type * as EventId from '../../schema/EventId.js'
|
2
2
|
import type * as MutationEvent from '../../schema/MutationEvent.js'
|
3
3
|
import type { MutationDef, MutationEventFactsSnapshot } from '../../schema/mutations.js'
|
4
4
|
import {
|
@@ -19,13 +19,13 @@ export type RebaseInput = {
|
|
19
19
|
newRemoteEvents: RebaseEventWithConflict[]
|
20
20
|
pendingLocalEvents: RebaseEventWithConflict[]
|
21
21
|
validate: (args: {
|
22
|
-
rebasedLocalEvents: MutationEvent.
|
22
|
+
rebasedLocalEvents: MutationEvent.PartialAny[]
|
23
23
|
mutationDefs: Record<string, MutationDef.Any>
|
24
24
|
}) => FactValidationResult
|
25
25
|
}
|
26
26
|
|
27
27
|
export type RebaseOutput = {
|
28
|
-
rebasedLocalEvents: MutationEvent.
|
28
|
+
rebasedLocalEvents: MutationEvent.PartialAny[]
|
29
29
|
}
|
30
30
|
|
31
31
|
export type RebaseFn = (input: RebaseInput) => RebaseOutput
|
@@ -48,7 +48,7 @@ export const rebaseEvents = ({
|
|
48
48
|
newRemoteEvents: HistoryDagNode[]
|
49
49
|
rebaseFn: RebaseFn
|
50
50
|
currentFactsSnapshot: MutationEventFactsSnapshot
|
51
|
-
}):
|
51
|
+
}): MutationEvent.Any[] => {
|
52
52
|
const initialSnapshot = new Map(currentFactsSnapshot)
|
53
53
|
applyFactGroups(
|
54
54
|
newRemoteEvents.map((event) => event.factsGroup),
|
@@ -89,10 +89,10 @@ export const rebaseEvents = ({
|
|
89
89
|
return rebasedLocalEvents.map(
|
90
90
|
(event, index) =>
|
91
91
|
({
|
92
|
-
id:
|
93
|
-
parentId:
|
92
|
+
id: { global: headGlobalId + index + 1, local: 0 } satisfies EventId.EventId,
|
93
|
+
parentId: { global: headGlobalId + index, local: 0 } satisfies EventId.EventId,
|
94
94
|
mutation: event.mutation,
|
95
95
|
args: event.args,
|
96
|
-
}) satisfies MutationEvent.
|
96
|
+
}) satisfies MutationEvent.Any,
|
97
97
|
)
|
98
98
|
}
|
@@ -140,9 +140,16 @@ export const toEventNodes = (
|
|
140
140
|
|
141
141
|
let currentEventId: EventId.EventId = EventId.ROOT
|
142
142
|
|
143
|
+
const getNextEventId = (mutationDef: MutationDef.Any): EventId.EventId => {
|
144
|
+
if (mutationDef.options.localOnly) {
|
145
|
+
return { global: currentEventId.global, local: currentEventId.local + 1 }
|
146
|
+
}
|
147
|
+
return { global: currentEventId.global + 1, local: 0 }
|
148
|
+
}
|
149
|
+
|
143
150
|
const eventNodes = partialEvents.map((partialEvent) => {
|
144
151
|
const mutationDef = mutationDefs[partialEvent.mutation]!
|
145
|
-
const eventId =
|
152
|
+
const eventId = getNextEventId(mutationDef)
|
146
153
|
currentEventId = eventId
|
147
154
|
|
148
155
|
const factsSnapshot = factsSnapshotForDag(historyDagFromNodes(nodesAcc, { skipFactsCheck: true }), undefined)
|
@@ -217,8 +224,8 @@ const getParentId = (eventId: EventId.EventId): EventId.EventId => {
|
|
217
224
|
const localParentId = eventId.local - 1
|
218
225
|
|
219
226
|
if (localParentId < 0) {
|
220
|
-
return
|
227
|
+
return { global: globalParentId - 1, local: 0 }
|
221
228
|
}
|
222
229
|
|
223
|
-
return
|
230
|
+
return { global: globalParentId, local: localParentId }
|
224
231
|
}
|
package/src/sync/sync.ts
CHANGED
@@ -1,23 +1,12 @@
|
|
1
|
-
import type { Effect, HttpClient, Option,
|
1
|
+
import type { Effect, HttpClient, Option, Stream, SubscriptionRef } from '@livestore/utils/effect'
|
2
2
|
import { Schema } from '@livestore/utils/effect'
|
3
3
|
|
4
|
-
import type { UnexpectedError } from '../adapter-types.js'
|
5
|
-
import type { InitialSyncOptions } from '../leader-thread/types.js'
|
6
4
|
import * as EventId from '../schema/EventId.js'
|
7
5
|
import type * as MutationEvent from '../schema/MutationEvent.js'
|
8
6
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
export type MakeBackendArgs = {
|
13
|
-
storeId: string
|
14
|
-
clientId: string
|
15
|
-
}
|
16
|
-
|
17
|
-
export type SyncOptions = {
|
18
|
-
makeBackend: (args: MakeBackendArgs) => Effect.Effect<SyncBackend<any>, UnexpectedError, Scope.Scope>
|
19
|
-
/** @default { _tag: 'Skip' } */
|
20
|
-
initialSyncOptions?: InitialSyncOptions
|
7
|
+
export interface SyncBackendOptionsBase {
|
8
|
+
type: string
|
9
|
+
[key: string]: Schema.JsonValue
|
21
10
|
}
|
22
11
|
|
23
12
|
export type SyncBackend<TSyncMetadata = Schema.JsonValue> = {
|
@@ -29,7 +18,7 @@ export type SyncBackend<TSyncMetadata = Schema.JsonValue> = {
|
|
29
18
|
) => Stream.Stream<
|
30
19
|
{
|
31
20
|
batch: ReadonlyArray<{
|
32
|
-
mutationEventEncoded: MutationEvent.
|
21
|
+
mutationEventEncoded: MutationEvent.AnyEncoded
|
33
22
|
metadata: Option.Option<TSyncMetadata>
|
34
23
|
}>
|
35
24
|
remaining: number
|
@@ -44,7 +33,7 @@ export type SyncBackend<TSyncMetadata = Schema.JsonValue> = {
|
|
44
33
|
* - Number of events: 1-100
|
45
34
|
* - event ids must be in ascending order
|
46
35
|
* */
|
47
|
-
batch: ReadonlyArray<MutationEvent.
|
36
|
+
batch: ReadonlyArray<MutationEvent.AnyEncoded>,
|
48
37
|
) => Effect.Effect<
|
49
38
|
{
|
50
39
|
/** Indexes are relative to `batch` */
|
@@ -57,7 +46,6 @@ export type SyncBackend<TSyncMetadata = Schema.JsonValue> = {
|
|
57
46
|
}
|
58
47
|
|
59
48
|
export class IsOfflineError extends Schema.TaggedError<IsOfflineError>()('IsOfflineError', {}) {}
|
60
|
-
|
61
49
|
export class InvalidPushError extends Schema.TaggedError<InvalidPushError>()('InvalidPushError', {
|
62
50
|
reason: Schema.Union(
|
63
51
|
Schema.TaggedStruct('Unexpected', {
|
@@ -73,7 +61,6 @@ export class InvalidPushError extends Schema.TaggedError<InvalidPushError>()('In
|
|
73
61
|
}),
|
74
62
|
),
|
75
63
|
}) {}
|
76
|
-
|
77
64
|
export class InvalidPullError extends Schema.TaggedError<InvalidPullError>()('InvalidPullError', {
|
78
65
|
message: Schema.String,
|
79
66
|
}) {}
|