@livestore/common 0.0.54-dev.2 → 0.0.54-dev.22
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 +19 -15
- package/dist/adapter-types.d.ts.map +1 -1
- package/dist/adapter-types.js +14 -1
- package/dist/adapter-types.js.map +1 -1
- package/dist/bounded-collections.d.ts +1 -1
- package/dist/bounded-collections.d.ts.map +1 -1
- package/dist/bounded-collections.js.map +1 -1
- package/dist/debug-info.d.ts +4 -0
- package/dist/debug-info.d.ts.map +1 -1
- package/dist/debug-info.js +6 -9
- package/dist/debug-info.js.map +1 -1
- package/dist/devtools/devtools-messages.d.ts +163 -38
- package/dist/devtools/devtools-messages.d.ts.map +1 -1
- package/dist/devtools/devtools-messages.js +83 -39
- package/dist/devtools/devtools-messages.js.map +1 -1
- package/dist/schema/mutations.d.ts +2 -1
- package/dist/schema/mutations.d.ts.map +1 -1
- package/dist/schema/mutations.js +3 -1
- package/dist/schema/mutations.js.map +1 -1
- package/dist/schema/system-tables.d.ts +3 -3
- package/package.json +3 -3
- package/src/adapter-types.ts +24 -17
- package/src/bounded-collections.ts +1 -1
- package/src/debug-info.ts +6 -18
- package/src/devtools/devtools-messages.ts +96 -44
- package/src/schema/mutations.ts +7 -4
- package/dist/devtools/index copy.d.ts +0 -214
- package/dist/devtools/index copy.d.ts.map +0 -1
- package/dist/devtools/index copy.js +0 -137
- package/dist/devtools/index copy.js.map +0 -1
|
@@ -11,36 +11,48 @@ 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
19
|
snapshot: Schema.Uint8Array,
|
|
20
|
-
}) {
|
|
20
|
+
}).annotations({ identifier: 'LSD.SnapshotRes' }) {
|
|
21
|
+
}
|
|
22
|
+
export class LoadSnapshotReq extends Schema.TaggedStruct('LSD.LoadSnapshotReq', {
|
|
23
|
+
liveStoreVersion,
|
|
24
|
+
requestId,
|
|
25
|
+
channelId,
|
|
26
|
+
snapshot: Schema.Uint8Array,
|
|
27
|
+
}).annotations({ identifier: 'LSD.LoadSnapshotReq' }) {
|
|
28
|
+
}
|
|
29
|
+
export class LoadSnapshotRes extends Schema.TaggedStruct('LSD.LoadSnapshotRes', {
|
|
30
|
+
liveStoreVersion,
|
|
31
|
+
requestId,
|
|
32
|
+
}).annotations({ identifier: 'LSD.LoadSnapshotRes' }) {
|
|
21
33
|
}
|
|
22
34
|
export class DebugInfoReq extends Schema.TaggedStruct('LSD.DebugInfoReq', {
|
|
23
35
|
liveStoreVersion,
|
|
24
36
|
requestId,
|
|
25
37
|
channelId,
|
|
26
|
-
}) {
|
|
38
|
+
}).annotations({ identifier: 'LSD.DebugInfoReq' }) {
|
|
27
39
|
}
|
|
28
40
|
export class DebugInfoRes extends Schema.TaggedStruct('LSD.DebugInfoRes', {
|
|
29
41
|
liveStoreVersion,
|
|
30
42
|
requestId,
|
|
31
43
|
debugInfo: DebugInfo,
|
|
32
|
-
}) {
|
|
44
|
+
}).annotations({ identifier: 'LSD.DebugInfoRes' }) {
|
|
33
45
|
}
|
|
34
46
|
export class DebugInfoResetReq extends Schema.TaggedStruct('LSD.DebugInfoResetReq', {
|
|
35
47
|
liveStoreVersion,
|
|
36
48
|
requestId,
|
|
37
49
|
channelId,
|
|
38
|
-
}) {
|
|
50
|
+
}).annotations({ identifier: 'LSD.DebugInfoResetReq' }) {
|
|
39
51
|
}
|
|
40
52
|
export class DebugInfoResetRes extends Schema.TaggedStruct('LSD.DebugInfoResetRes', {
|
|
41
53
|
liveStoreVersion,
|
|
42
54
|
requestId,
|
|
43
|
-
}) {
|
|
55
|
+
}).annotations({ identifier: 'LSD.DebugInfoResetRes' }) {
|
|
44
56
|
}
|
|
45
57
|
export class DebugInfoRerunQueryReq extends Schema.TaggedStruct('LSD.DebugInfoRerunQueryReq', {
|
|
46
58
|
liveStoreVersion,
|
|
@@ -49,62 +61,88 @@ export class DebugInfoRerunQueryReq extends Schema.TaggedStruct('LSD.DebugInfoRe
|
|
|
49
61
|
queryStr: Schema.String,
|
|
50
62
|
bindValues: Schema.UndefinedOr(PreparedBindValues),
|
|
51
63
|
queriedTables: Schema.ReadonlySet(Schema.String),
|
|
52
|
-
}) {
|
|
64
|
+
}).annotations({ identifier: 'LSD.DebugInfoRerunQueryReq' }) {
|
|
53
65
|
}
|
|
54
66
|
export class DebugInfoRerunQueryRes extends Schema.TaggedStruct('LSD.DebugInfoRerunQueryRes', {
|
|
55
67
|
liveStoreVersion,
|
|
56
68
|
requestId,
|
|
57
|
-
}) {
|
|
69
|
+
}).annotations({ identifier: 'LSD.DebugInfoRerunQueryRes' }) {
|
|
58
70
|
}
|
|
59
71
|
export class MutationBroadcast extends Schema.TaggedStruct('LSD.MutationBroadcast', {
|
|
72
|
+
liveStoreVersion,
|
|
73
|
+
mutationEventEncoded: mutationEventSchemaEncodedAny,
|
|
74
|
+
persisted: Schema.Boolean,
|
|
75
|
+
}).annotations({ identifier: 'LSD.MutationBroadcast' }) {
|
|
76
|
+
}
|
|
77
|
+
export class RunMutationReq extends Schema.TaggedStruct('LSD.RunMutationReq', {
|
|
60
78
|
liveStoreVersion,
|
|
61
79
|
requestId,
|
|
80
|
+
channelId,
|
|
62
81
|
mutationEventEncoded: mutationEventSchemaEncodedAny,
|
|
63
82
|
persisted: Schema.Boolean,
|
|
64
|
-
}) {
|
|
83
|
+
}).annotations({ identifier: 'LSD.RunMutationReq' }) {
|
|
84
|
+
}
|
|
85
|
+
export class RunMutationRes extends Schema.TaggedStruct('LSD.RunMutationRes', {
|
|
86
|
+
liveStoreVersion,
|
|
87
|
+
requestId,
|
|
88
|
+
channelId,
|
|
89
|
+
}).annotations({ identifier: 'LSD.RunMutationRes' }) {
|
|
65
90
|
}
|
|
66
91
|
export class MutationLogReq extends Schema.TaggedStruct('LSD.MutationLogReq', {
|
|
67
92
|
liveStoreVersion,
|
|
68
93
|
requestId,
|
|
69
94
|
channelId,
|
|
70
|
-
}) {
|
|
95
|
+
}).annotations({ identifier: 'LSD.MutationLogReq' }) {
|
|
71
96
|
}
|
|
72
97
|
export class MutationLogRes extends Schema.TaggedStruct('LSD.MutationLogRes', {
|
|
73
98
|
liveStoreVersion,
|
|
74
99
|
requestId,
|
|
100
|
+
channelId,
|
|
101
|
+
mutationLog: Schema.Uint8Array,
|
|
102
|
+
}).annotations({ identifier: 'LSD.MutationLogRes' }) {
|
|
103
|
+
}
|
|
104
|
+
export class LoadMutationLogReq extends Schema.TaggedStruct('LSD.LoadMutationLogReq', {
|
|
105
|
+
liveStoreVersion,
|
|
106
|
+
requestId,
|
|
107
|
+
channelId,
|
|
75
108
|
mutationLog: Schema.Uint8Array,
|
|
76
|
-
}) {
|
|
109
|
+
}).annotations({ identifier: 'LSD.LoadMutationLogReq' }) {
|
|
110
|
+
}
|
|
111
|
+
export class LoadMutationLogRes extends Schema.TaggedStruct('LSD.LoadMutationLogRes', {
|
|
112
|
+
liveStoreVersion,
|
|
113
|
+
requestId,
|
|
114
|
+
}).annotations({ identifier: 'LSD.LoadMutationLogRes' }) {
|
|
77
115
|
}
|
|
78
|
-
export class
|
|
116
|
+
export class ReactivityGraphSubscribe extends Schema.TaggedStruct('LSD.ReactivityGraphSubscribe', {
|
|
79
117
|
liveStoreVersion,
|
|
80
118
|
requestId,
|
|
81
119
|
channelId,
|
|
82
120
|
includeResults: Schema.Boolean,
|
|
83
|
-
}) {
|
|
121
|
+
}).annotations({ identifier: 'LSD.ReactivityGraphSubscribe' }) {
|
|
84
122
|
}
|
|
85
|
-
export class
|
|
123
|
+
export class ReactivityGraphUnsubscribe extends Schema.TaggedStruct('LSD.ReactivityGraphUnsubscribe', {
|
|
86
124
|
liveStoreVersion,
|
|
87
125
|
requestId,
|
|
88
126
|
channelId,
|
|
89
|
-
}) {
|
|
127
|
+
}).annotations({ identifier: 'LSD.ReactivityGraphUnsubscribe' }) {
|
|
90
128
|
}
|
|
91
|
-
export class
|
|
129
|
+
export class ReactivityGraphRes extends Schema.TaggedStruct('LSD.ReactivityGraphRes', {
|
|
92
130
|
liveStoreVersion,
|
|
93
131
|
requestId,
|
|
94
|
-
|
|
95
|
-
}) {
|
|
132
|
+
reactivityGraph: Schema.Any,
|
|
133
|
+
}).annotations({ identifier: 'LSD.ReactivityGraphRes' }) {
|
|
96
134
|
}
|
|
97
135
|
export class LiveQueriesSubscribe extends Schema.TaggedStruct('LSD.LiveQueriesSubscribe', {
|
|
98
136
|
liveStoreVersion,
|
|
99
137
|
requestId,
|
|
100
138
|
channelId,
|
|
101
|
-
}) {
|
|
139
|
+
}).annotations({ identifier: 'LSD.LiveQueriesSubscribe' }) {
|
|
102
140
|
}
|
|
103
141
|
export class LiveQueriesUnsubscribe extends Schema.TaggedStruct('LSD.LiveQueriesUnsubscribe', {
|
|
104
142
|
liveStoreVersion,
|
|
105
143
|
requestId,
|
|
106
144
|
channelId,
|
|
107
|
-
}) {
|
|
145
|
+
}).annotations({ identifier: 'LSD.LiveQueriesUnsubscribe' }) {
|
|
108
146
|
}
|
|
109
147
|
export class SerializedLiveQuery extends Schema.Struct({
|
|
110
148
|
_tag: Schema.Literal('js', 'sql', 'graphql'),
|
|
@@ -114,59 +152,65 @@ export class SerializedLiveQuery extends Schema.Struct({
|
|
|
114
152
|
executionTimes: Schema.Array(Schema.Number),
|
|
115
153
|
lastestResult: Schema.Any,
|
|
116
154
|
activeSubscriptions: Schema.Array(Schema.Struct({ frames: Schema.Array(Schema.Struct({ name: Schema.String, filePath: Schema.String })) })),
|
|
117
|
-
}) {
|
|
155
|
+
}).annotations({ identifier: 'SerializedLiveQuery' }) {
|
|
118
156
|
}
|
|
119
157
|
export class LiveQueriesRes extends Schema.TaggedStruct('LSD.LiveQueriesRes', {
|
|
120
158
|
liveStoreVersion,
|
|
121
159
|
requestId,
|
|
122
160
|
liveQueries: Schema.Array(SerializedLiveQuery),
|
|
123
|
-
}) {
|
|
161
|
+
}).annotations({ identifier: 'LSD.LiveQueriesRes' }) {
|
|
124
162
|
}
|
|
125
163
|
export class ResetAllDataReq extends Schema.TaggedStruct('LSD.ResetAllDataReq', {
|
|
126
164
|
liveStoreVersion,
|
|
127
165
|
requestId,
|
|
128
166
|
channelId,
|
|
129
167
|
mode: Schema.Literal('all-data', 'only-app-db'),
|
|
130
|
-
}) {
|
|
168
|
+
}).annotations({ identifier: 'LSD.ResetAllDataReq' }) {
|
|
131
169
|
}
|
|
132
170
|
export class ResetAllDataRes extends Schema.TaggedStruct('LSD.ResetAllDataRes', {
|
|
133
171
|
liveStoreVersion,
|
|
134
172
|
requestId,
|
|
135
|
-
}) {
|
|
173
|
+
}).annotations({ identifier: 'LSD.ResetAllDataRes' }) {
|
|
136
174
|
}
|
|
137
|
-
export class
|
|
175
|
+
export class NetworkStatusChanged extends Schema.TaggedStruct('LSD.NetworkStatusChanged', {
|
|
138
176
|
liveStoreVersion,
|
|
139
177
|
channelId,
|
|
140
178
|
networkStatus: NetworkStatus,
|
|
141
|
-
}) {
|
|
179
|
+
}).annotations({ identifier: 'LSD.NetworkStatusChanged' }) {
|
|
142
180
|
}
|
|
143
|
-
export class
|
|
181
|
+
export class DevtoolsReady extends Schema.TaggedStruct('LSD.DevtoolsReady', {
|
|
144
182
|
liveStoreVersion,
|
|
145
|
-
}) {
|
|
183
|
+
}).annotations({ identifier: 'LSD.DevtoolsReady' }) {
|
|
146
184
|
}
|
|
147
185
|
export class DevtoolsConnected extends Schema.TaggedStruct('LSD.DevtoolsConnected', {
|
|
148
186
|
liveStoreVersion,
|
|
149
187
|
channelId,
|
|
150
|
-
}) {
|
|
188
|
+
}).annotations({ identifier: 'LSD.DevtoolsConnected' }) {
|
|
151
189
|
}
|
|
152
|
-
export class
|
|
190
|
+
export class AppHostReady extends Schema.TaggedStruct('LSD.AppHostReady', {
|
|
153
191
|
liveStoreVersion,
|
|
154
192
|
channelId,
|
|
155
|
-
}) {
|
|
193
|
+
}).annotations({ identifier: 'LSD.AppHostReady' }) {
|
|
156
194
|
}
|
|
157
195
|
export class Disconnect extends Schema.TaggedStruct('LSD.Disconnect', {
|
|
158
196
|
liveStoreVersion,
|
|
159
197
|
requestId,
|
|
160
198
|
channelId,
|
|
161
|
-
}) {
|
|
199
|
+
}).annotations({ identifier: 'LSD.Disconnect' }) {
|
|
200
|
+
}
|
|
201
|
+
export class Ping extends Schema.TaggedStruct('LSD.Ping', {
|
|
202
|
+
liveStoreVersion,
|
|
203
|
+
requestId,
|
|
204
|
+
channelId,
|
|
205
|
+
}).annotations({ identifier: 'LSD.Ping' }) {
|
|
206
|
+
}
|
|
207
|
+
export class Pong extends Schema.TaggedStruct('LSD.Pong', {
|
|
208
|
+
liveStoreVersion,
|
|
209
|
+
requestId,
|
|
210
|
+
}).annotations({ identifier: 'LSD.Pong' }) {
|
|
162
211
|
}
|
|
163
|
-
|
|
164
|
-
|
|
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);
|
|
212
|
+
export const MessageToAppHost = Schema.Union(SnapshotReq, LoadSnapshotReq, MutationLogReq, LoadMutationLogReq, DebugInfoReq, DebugInfoResetReq, DebugInfoRerunQueryReq, ReactivityGraphSubscribe, ReactivityGraphUnsubscribe, LiveQueriesSubscribe, LiveQueriesUnsubscribe, ResetAllDataReq, DevtoolsReady, Disconnect, DevtoolsConnected, RunMutationReq, Ping).annotations({ identifier: 'LSD.MessageToAppHost' });
|
|
213
|
+
export const MessageFromAppHost = Schema.Union(SnapshotRes, LoadSnapshotRes, MutationLogRes, LoadMutationLogRes, DebugInfoRes, DebugInfoResetRes, DebugInfoRerunQueryRes, ReactivityGraphRes, LiveQueriesRes, ResetAllDataRes, Disconnect, MutationBroadcast, AppHostReady, NetworkStatusChanged, RunMutationRes, Pong).annotations({ identifier: 'LSD.MessageFromAppHost' });
|
|
170
214
|
// TODO make specific over app key
|
|
171
215
|
export const makeBroadcastChannels = () => ({
|
|
172
216
|
fromAppHost: new BroadcastChannel(`livestore-devtools-from-app-host`),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devtools-messages.js","sourceRoot":"","sources":["../../src/devtools/devtools-messages.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,gCAAgC,CAAA;AACtE,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAGhD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC5C,OAAO,EAAE,6BAA6B,EAAE,MAAM,wBAAwB,CAAA;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAE/C,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAA;AAC/B,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAA;AAC/B,MAAM,gBAAgB,GAAG,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAA;AAEnD,MAAM,OAAO,WAAY,SAAQ,MAAM,CAAC,YAAY,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92
|
id: string;
|
|
93
93
|
};
|
|
94
94
|
}[keyof TMutationsDefRecord]>;
|
|
95
|
-
export declare const makeMutationEventSchema: <
|
|
95
|
+
export declare const makeMutationEventSchema: <TSchema extends LiveStoreSchema>(schema: TSchema) => MutationEventSchema<TSchema['_MutationDefMapType']>;
|
|
96
|
+
export declare const makeMutationEventSchemaMemo: <TSchema extends LiveStoreSchema>(schema: TSchema) => MutationEventSchema<TSchema['_MutationDefMapType']>;
|
|
96
97
|
export declare const mutationEventSchemaDecodedAny: Schema.Struct<{
|
|
97
98
|
mutation: typeof Schema.String;
|
|
98
99
|
args: typeof Schema.Any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mutations.d.ts","sourceRoot":"","sources":["../../src/schema/mutations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mutations.d.ts","sourceRoot":"","sources":["../../src/schema/mutations.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAEhD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAEjD,MAAM,MAAM,cAAc,GAAG,GAAG,CAAC,MAAM,GAAG,kBAAkB,EAAE,WAAW,CAAC,GAAG,CAAC,CAAA;AAC9E,MAAM,MAAM,iBAAiB,GAAG;IAC9B,kBAAkB,EAAE,cAAc,CAAA;IAClC,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC,GAAG,CAAA;CAChC,CAAA;AAED,MAAM,MAAM,sBAAsB,CAAC,OAAO,SAAS,iBAAiB,GAAG,iBAAiB,IAAI;IAC1F,UAAU,EAAE,OAAO,CAAA;IAEnB,GAAG,EAAE,GAAG,CAAC,MAAM,OAAO,EAAE,OAAO,CAAC,MAAM,OAAO,CAAC,CAAC,CAAA;IAC/C,aAAa,EAAE,GAAG,CAAC,MAAM,OAAO,EAAE,MAAM,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C,CAAA;QACX,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAA;QAC1D,EAAE,EAAE,MAAM,CAAA;KACX;CACF,CAAC,MAAM,mBAAmB,CAAC,EAC5B;KACG,CAAC,IAAI,MAAM,mBAAmB,GAAG;QAChC,QAAQ,EAAE,CAAC,CAAA;QACX,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAA;QAC7D,EAAE,EAAE,MAAM,CAAA;KACX;CACF,CAAC,MAAM,mBAAmB,CAAC,CAC7B,CAAA;AAED,eAAO,MAAM,uBAAuB,4CAC1B,OAAO,KACd,oBAAoB,OAAO,CAAC,qBAAqB,CAAC,CASG,CAAA;AAExD,eAAO,MAAM,2BAA2B,4CAZ9B,OAAO,KACd,oBAAoB,OAAO,CAAC,qBAAqB,CAAC,CAW2B,CAAA;AAEhF,eAAO,MAAM,6BAA6B;;;;EAIiB,CAAA;AAE3D,eAAO,MAAM,6BAA6B;;;;EAIiB,CAAA"}
|
package/dist/schema/mutations.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { memoizeByRef } from '@livestore/utils';
|
|
1
2
|
import { cuid } from '@livestore/utils/cuid';
|
|
2
3
|
import { Schema } from '@livestore/utils/effect';
|
|
3
4
|
// TODO possibly also allow for mutation event subsumption behaviour
|
|
@@ -22,11 +23,12 @@ export const rawSqlMutation = defineMutation('livestore.RawSql', Schema.Struct({
|
|
|
22
23
|
bindValues: Schema.optional(Schema.Record(Schema.String, Schema.Any)),
|
|
23
24
|
writeTables: Schema.optional(Schema.ReadonlySet(Schema.String)),
|
|
24
25
|
}), ({ sql, bindValues, writeTables }) => ({ sql, bindValues: bindValues ?? {}, writeTables }));
|
|
25
|
-
export const makeMutationEventSchema = (
|
|
26
|
+
export const makeMutationEventSchema = (schema) => Schema.Union(...[...schema.mutations.values()].map((def) => Schema.Struct({
|
|
26
27
|
mutation: Schema.Literal(def.name),
|
|
27
28
|
args: def.schema,
|
|
28
29
|
id: Schema.String,
|
|
29
30
|
}))).annotations({ title: 'MutationEventSchema' });
|
|
31
|
+
export const makeMutationEventSchemaMemo = memoizeByRef(makeMutationEventSchema);
|
|
30
32
|
export const mutationEventSchemaDecodedAny = Schema.Struct({
|
|
31
33
|
mutation: Schema.String,
|
|
32
34
|
args: Schema.Any,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mutations.js","sourceRoot":"","sources":["../../src/schema/mutations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAmDhD,oEAAoE;AACpE,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,IAAW,EACX,MAAiC,EACjC,GAA8B,EAC9B,OAKC,EAC+B,EAAE;IAClC,MAAM,SAAS,GAAG,CAAC,IAAS,EAAE,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,CAAC,CAAA;IAEvE,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;IACzD,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,QAAQ,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAA;IAC7D,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAA;IACvD,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,SAAS,EAAE,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,IAAI,KAAK,EAAE,EAAE,CAAC,CAAA;IAElG,OAAO,SAA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AG;IAChB,EAAE,EAAE,MAAM,CAAC,MAAM;CAClB,CAAC,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,gCAAgC,EAAE,CAAC,CAAA"}
|
|
@@ -193,7 +193,7 @@ export declare const mutationLogMetaTable: import("./table-def.js").TableDef<Sql
|
|
|
193
193
|
};
|
|
194
194
|
syncStatus: {
|
|
195
195
|
columnType: "text";
|
|
196
|
-
schema: Schema.Schema<"
|
|
196
|
+
schema: Schema.Schema<"error" | "localOnly" | "synced" | "pending", "error" | "localOnly" | "synced" | "pending", never>;
|
|
197
197
|
default: import("effect/Option").None<never>;
|
|
198
198
|
nullable: false;
|
|
199
199
|
primaryKey: false;
|
|
@@ -210,14 +210,14 @@ export declare const mutationLogMetaTable: import("./table-def.js").TableDef<Sql
|
|
|
210
210
|
readonly argsJson: any;
|
|
211
211
|
readonly schemaHash: number;
|
|
212
212
|
readonly createdAt: string;
|
|
213
|
-
readonly syncStatus: "
|
|
213
|
+
readonly syncStatus: "error" | "localOnly" | "synced" | "pending";
|
|
214
214
|
}, {
|
|
215
215
|
readonly id: string;
|
|
216
216
|
readonly mutation: string;
|
|
217
217
|
readonly argsJson: string;
|
|
218
218
|
readonly schemaHash: number;
|
|
219
219
|
readonly createdAt: string;
|
|
220
|
-
readonly syncStatus: "
|
|
220
|
+
readonly syncStatus: "error" | "localOnly" | "synced" | "pending";
|
|
221
221
|
}, never>>;
|
|
222
222
|
export type MutationLogMetaRow = FromTable.RowDecoded<typeof mutationLogMetaTable>;
|
|
223
223
|
//# sourceMappingURL=system-tables.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@livestore/common",
|
|
3
|
-
"version": "0.0.54-dev.
|
|
3
|
+
"version": "0.0.54-dev.22",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@opentelemetry/api": "^1.9.0",
|
|
36
|
-
"@livestore/utils": "0.0.54-dev.
|
|
37
|
-
"effect-db-schema": "0.0.54-dev.
|
|
36
|
+
"@livestore/utils": "0.0.54-dev.22",
|
|
37
|
+
"effect-db-schema": "0.0.54-dev.22"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"vitest": "^1.6.0"
|
package/src/adapter-types.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { Stream, SubscriptionRef, TRef } from '@livestore/utils/effect'
|
|
2
|
-
import { Schema } from '@livestore/utils/effect'
|
|
3
|
-
import type * as otel from '@opentelemetry/api'
|
|
1
|
+
import type { Effect, Stream, SubscriptionRef, TRef } from '@livestore/utils/effect'
|
|
2
|
+
import { Cause, Schema } from '@livestore/utils/effect'
|
|
4
3
|
|
|
5
4
|
import type { LiveStoreSchema, MutationEvent } from './schema/index.js'
|
|
6
5
|
import type { PreparedBindValues } from './util.js'
|
|
@@ -22,7 +21,6 @@ export type InMemoryDatabase = {
|
|
|
22
21
|
_tag: 'InMemoryDatabase'
|
|
23
22
|
prepare(queryStr: string): PreparedStatement
|
|
24
23
|
execute(queryStr: string, bindValues: PreparedBindValues | undefined): GetRowsChangedCount
|
|
25
|
-
dangerouslyReset(): Promise<void>
|
|
26
24
|
export(): Uint8Array
|
|
27
25
|
}
|
|
28
26
|
|
|
@@ -43,17 +41,17 @@ export type Coordinator = {
|
|
|
43
41
|
channelId: string
|
|
44
42
|
}
|
|
45
43
|
hasLock: TRef.TRef<boolean>
|
|
46
|
-
syncMutations: Stream.Stream<MutationEvent.AnyEncoded>
|
|
47
|
-
execute(queryStr: string, bindValues: PreparedBindValues | undefined
|
|
48
|
-
mutate(mutationEventEncoded: MutationEvent.Any, options: {
|
|
49
|
-
dangerouslyReset(mode: ResetMode):
|
|
50
|
-
export
|
|
44
|
+
syncMutations: Stream.Stream<MutationEvent.AnyEncoded, UnexpectedError>
|
|
45
|
+
execute(queryStr: string, bindValues: PreparedBindValues | undefined): Effect.Effect<void, UnexpectedError>
|
|
46
|
+
mutate(mutationEventEncoded: MutationEvent.Any, options: { persisted: boolean }): Effect.Effect<void, UnexpectedError>
|
|
47
|
+
dangerouslyReset(mode: ResetMode): Effect.Effect<void, UnexpectedError>
|
|
48
|
+
export: Effect.Effect<Uint8Array | undefined, UnexpectedError>
|
|
51
49
|
/**
|
|
52
50
|
* This is different from `export` since in `getInitialSnapshot` is usually the place for migrations etc to happen
|
|
53
51
|
*/
|
|
54
|
-
getInitialSnapshot
|
|
55
|
-
getMutationLogData
|
|
56
|
-
shutdown
|
|
52
|
+
getInitialSnapshot: Effect.Effect<Uint8Array, UnexpectedError>
|
|
53
|
+
getMutationLogData: Effect.Effect<Uint8Array, UnexpectedError>
|
|
54
|
+
shutdown: Effect.Effect<void, UnexpectedError>
|
|
57
55
|
networkStatus: SubscriptionRef.SubscriptionRef<NetworkStatus>
|
|
58
56
|
}
|
|
59
57
|
|
|
@@ -67,6 +65,19 @@ export type BootDb = {
|
|
|
67
65
|
txn(callback: () => void): void
|
|
68
66
|
}
|
|
69
67
|
|
|
68
|
+
export class UnexpectedError extends Schema.TaggedError<UnexpectedError>()('LiveStore.UnexpectedError', {
|
|
69
|
+
error: Schema.AnyError,
|
|
70
|
+
}) {
|
|
71
|
+
get message() {
|
|
72
|
+
try {
|
|
73
|
+
return Cause.pretty(this.error)
|
|
74
|
+
} catch (e) {
|
|
75
|
+
console.warn(`Error pretty printing error: ${e}`)
|
|
76
|
+
return this.error.toString()
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
70
81
|
// TODO possibly allow a combination of these options
|
|
71
82
|
// TODO allow a way to stream the migration progress back to the app
|
|
72
83
|
export type MigrationOptions<TSchema extends LiveStoreSchema = LiveStoreSchema> =
|
|
@@ -106,8 +117,4 @@ export type MigrationOptionsFromMutationLog<TSchema extends LiveStoreSchema = Li
|
|
|
106
117
|
}
|
|
107
118
|
}
|
|
108
119
|
|
|
109
|
-
export type StoreAdapterFactory = (opts: {
|
|
110
|
-
otelTracer: otel.Tracer
|
|
111
|
-
otelContext: otel.Context
|
|
112
|
-
schema: LiveStoreSchema
|
|
113
|
-
}) => StoreAdapter | Promise<StoreAdapter>
|
|
120
|
+
export type StoreAdapterFactory = (opts: { schema: LiveStoreSchema }) => Effect.Effect<StoreAdapter, UnexpectedError>
|
|
@@ -71,7 +71,7 @@ export class BoundArray<V> {
|
|
|
71
71
|
this.sizeLimit = sizeLimit
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
static make = <V>(sizeLimit: number, initial:
|
|
74
|
+
static make = <V>(sizeLimit: number, initial: Iterable<V> = []): BoundArray<V> => {
|
|
75
75
|
const b = new BoundArray<V>(sizeLimit)
|
|
76
76
|
for (const v of initial) {
|
|
77
77
|
b.push(v)
|
package/src/debug-info.ts
CHANGED
|
@@ -21,15 +21,7 @@ export const SlowQueryInfo = Schema.Struct({
|
|
|
21
21
|
startTimePerfNow: Schema.Number,
|
|
22
22
|
})
|
|
23
23
|
|
|
24
|
-
const BoundArraySchemaFromSelf = <
|
|
25
|
-
Schema.declare((_): _ is BoundArray<ItemDecoded> => _ instanceof BoundArray, {
|
|
26
|
-
identifier: `BoundArrayFromSelf`,
|
|
27
|
-
pretty: () => (_) => `BoundArray(${_.length})`,
|
|
28
|
-
arbitrary: () => (fc) => fc.anything() as any,
|
|
29
|
-
equivalence: () => (a, b) => a === b,
|
|
30
|
-
}) as any as Schema.Schema<BoundArray<ItemDecoded>, BoundArray<ItemEncoded>>
|
|
31
|
-
|
|
32
|
-
const BoundArraySchemaFromSelf_ = <A, I, R>(
|
|
24
|
+
const BoundArraySchemaFromSelf = <A, I, R>(
|
|
33
25
|
item: Schema.Schema<A, I, R>,
|
|
34
26
|
): Schema.Schema<BoundArray<A>, BoundArray<I>, R> =>
|
|
35
27
|
Schema.declare(
|
|
@@ -52,16 +44,19 @@ const BoundArraySchemaFromSelf_ = <A, I, R>(
|
|
|
52
44
|
},
|
|
53
45
|
{
|
|
54
46
|
description: `BoundArray<${Schema.format(item)}>`,
|
|
47
|
+
pretty: () => (_) => `BoundArray(${_.length})`,
|
|
48
|
+
arbitrary: () => (fc) => fc.anything() as any,
|
|
49
|
+
equivalence: () => (a, b) => a === b,
|
|
55
50
|
},
|
|
56
51
|
)
|
|
57
52
|
|
|
58
|
-
const BoundArraySchema = <ItemDecoded, ItemEncoded>(elSchema: Schema.Schema<ItemDecoded, ItemEncoded>) =>
|
|
53
|
+
export const BoundArraySchema = <ItemDecoded, ItemEncoded>(elSchema: Schema.Schema<ItemDecoded, ItemEncoded>) =>
|
|
59
54
|
Schema.transform(
|
|
60
55
|
Schema.Struct({
|
|
61
56
|
size: Schema.Number,
|
|
62
57
|
items: Schema.Array(elSchema),
|
|
63
58
|
}),
|
|
64
|
-
BoundArraySchemaFromSelf(
|
|
59
|
+
BoundArraySchemaFromSelf(Schema.typeSchema(elSchema)),
|
|
65
60
|
{
|
|
66
61
|
encode: (_) => ({ size: _.sizeLimit, items: [..._] }),
|
|
67
62
|
decode: (_) => BoundArray.make(_.size, _.items),
|
|
@@ -75,13 +70,6 @@ export const DebugInfo = Schema.Struct({
|
|
|
75
70
|
events: BoundArraySchema(Schema.Tuple(Schema.String, Schema.Any)),
|
|
76
71
|
})
|
|
77
72
|
|
|
78
|
-
// export interface DebugInfo {
|
|
79
|
-
// slowQueries: BoundArray<SlowQueryInfo>
|
|
80
|
-
// queryFrameDuration: number
|
|
81
|
-
// queryFrameCount: number
|
|
82
|
-
// events: BoundArray<[queryStr: string, bindValues: Bindable | undefined]>
|
|
83
|
-
// }
|
|
84
|
-
|
|
85
73
|
export type DebugInfo = typeof DebugInfo.Type
|
|
86
74
|
|
|
87
75
|
export const MutableDebugInfo = Schema.mutable(DebugInfo)
|