@quereus/sync 4.3.1 → 4.4.0
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/src/clock/hlc.d.ts +16 -1
- package/dist/src/clock/hlc.d.ts.map +1 -1
- package/dist/src/clock/hlc.js +22 -58
- package/dist/src/clock/hlc.js.map +1 -1
- package/dist/src/clock/site.d.ts.map +1 -1
- package/dist/src/clock/site.js +3 -0
- package/dist/src/clock/site.js.map +1 -1
- package/dist/src/index.d.ts +2 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +11 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/metadata/keys.d.ts +17 -3
- package/dist/src/metadata/keys.d.ts.map +1 -1
- package/dist/src/metadata/keys.js +49 -18
- package/dist/src/metadata/keys.js.map +1 -1
- package/dist/src/metadata/peer-state.d.ts +12 -0
- package/dist/src/metadata/peer-state.d.ts.map +1 -1
- package/dist/src/metadata/peer-state.js +34 -7
- package/dist/src/metadata/peer-state.js.map +1 -1
- package/dist/src/sync/change-applicator.d.ts.map +1 -1
- package/dist/src/sync/change-applicator.js +24 -3
- package/dist/src/sync/change-applicator.js.map +1 -1
- package/dist/src/sync/manager.d.ts +17 -0
- package/dist/src/sync/manager.d.ts.map +1 -1
- package/dist/src/sync/protocol.d.ts +44 -2
- package/dist/src/sync/protocol.d.ts.map +1 -1
- package/dist/src/sync/protocol.js.map +1 -1
- package/dist/src/sync/snapshot-stream.d.ts.map +1 -1
- package/dist/src/sync/snapshot-stream.js +118 -25
- package/dist/src/sync/snapshot-stream.js.map +1 -1
- package/dist/src/sync/snapshot.d.ts.map +1 -1
- package/dist/src/sync/snapshot.js +47 -5
- package/dist/src/sync/snapshot.js.map +1 -1
- package/dist/src/sync/store-adapter.d.ts +2 -2
- package/dist/src/sync/store-adapter.js +12 -4
- package/dist/src/sync/store-adapter.js.map +1 -1
- package/dist/src/sync/sync-manager-impl.d.ts +20 -1
- package/dist/src/sync/sync-manager-impl.d.ts.map +1 -1
- package/dist/src/sync/sync-manager-impl.js +35 -1
- package/dist/src/sync/sync-manager-impl.js.map +1 -1
- package/dist/src/sync/wire.d.ts +273 -0
- package/dist/src/sync/wire.d.ts.map +1 -0
- package/dist/src/sync/wire.js +310 -0
- package/dist/src/sync/wire.js.map +1 -0
- package/package.json +7 -6
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wire protocol - the single source of truth for the sync transport layer.
|
|
3
|
+
*
|
|
4
|
+
* `protocol.ts` (this module's sibling) holds the transport-agnostic DATA
|
|
5
|
+
* structures (`ChangeSet`, `Change`, `SnapshotChunk`, ...). This module holds
|
|
6
|
+
* everything that turns those structures into JSON-safe objects and back, plus
|
|
7
|
+
* the message envelopes the sync client and coordinator exchange over the wire:
|
|
8
|
+
*
|
|
9
|
+
* - cross-platform base64 helpers (browser btoa/atob, Node `Buffer` fallback);
|
|
10
|
+
* - `Serialized*` types describing the on-the-wire JSON shapes;
|
|
11
|
+
* - codec functions (`serialize*` / `deserialize*`) for change sets, snapshot
|
|
12
|
+
* chunks, and HLCs;
|
|
13
|
+
* - the `ClientMessage` / `ServerMessage` unions (the true superset of what both
|
|
14
|
+
* sides emit and handle);
|
|
15
|
+
* - `PROTOCOL_VERSION`, stamped into the handshake so peers can detect drift.
|
|
16
|
+
*
|
|
17
|
+
* This module imports ONLY from within `@quereus/sync` (`protocol.ts`, the clock,
|
|
18
|
+
* the metadata codec, `manager.ts` for the `SnapshotCheckpoint` type) and
|
|
19
|
+
* `@quereus/quereus`. It must NOT import from `@quereus/sync-client` or
|
|
20
|
+
* `@quereus/sync-coordinator` — both depend on `@quereus/sync`, so importing the
|
|
21
|
+
* other way would create a cycle.
|
|
22
|
+
*
|
|
23
|
+
* Uint8Array (blob) `SqlValue`s ride the `{ __bin: "<base64>" }` tagged encoding
|
|
24
|
+
* from `encodeSqlValue` / `decodeSqlValue`; HLCs and site ids ride base64.
|
|
25
|
+
*/
|
|
26
|
+
import { serializeHLC, deserializeHLC, siteIdToBase64, siteIdFromBase64, } from '../clock/index.js';
|
|
27
|
+
import { encodeSqlValue, decodeSqlValue } from '../metadata/column-version.js';
|
|
28
|
+
// ============================================================================
|
|
29
|
+
// Protocol version
|
|
30
|
+
// ============================================================================
|
|
31
|
+
/**
|
|
32
|
+
* Wire protocol version. Bump on ANY breaking change to message shapes or codec.
|
|
33
|
+
*
|
|
34
|
+
* NOTE: strict integer equality today (see the `protocolVersion` field on the
|
|
35
|
+
* handshake / handshake_ack). If rolling/mixed-version upgrades ever become a
|
|
36
|
+
* requirement, widen to a `{min,max}`-supported range and negotiate — do not
|
|
37
|
+
* silently accept a mismatch.
|
|
38
|
+
*/
|
|
39
|
+
export const PROTOCOL_VERSION = 1;
|
|
40
|
+
// ============================================================================
|
|
41
|
+
// Base64 helpers (work in both browser and Node.js)
|
|
42
|
+
// ============================================================================
|
|
43
|
+
// Cross-platform base64: btoa/atob when present (browser), `Buffer` otherwise
|
|
44
|
+
// (Node). This is a RESOLVED divergence, not a style choice — the coordinator's
|
|
45
|
+
// old copy was `Buffer`-only, which throws in a browser. `@quereus/sync` runs in
|
|
46
|
+
// the browser too (it backs the sync client), so the dual path is mandatory.
|
|
47
|
+
/** Encode bytes to a base64 string. */
|
|
48
|
+
export function bytesToBase64(bytes) {
|
|
49
|
+
if (typeof btoa === 'function') {
|
|
50
|
+
// NOTE: `String.fromCharCode(...bytes)` spreads every byte as an argument; a
|
|
51
|
+
// very large blob (hundreds of KB) can exceed the JS arg-count limit and
|
|
52
|
+
// throw. Fine for HLCs and typical cell blobs; if big-blob snapshot chunks
|
|
53
|
+
// ever appear here, switch to a chunked loop over `bytes`.
|
|
54
|
+
return btoa(String.fromCharCode(...bytes));
|
|
55
|
+
}
|
|
56
|
+
return Buffer.from(bytes).toString('base64');
|
|
57
|
+
}
|
|
58
|
+
/** Decode a base64 string to bytes. */
|
|
59
|
+
export function base64ToBytes(str) {
|
|
60
|
+
if (typeof atob === 'function') {
|
|
61
|
+
return Uint8Array.from(atob(str), c => c.charCodeAt(0));
|
|
62
|
+
}
|
|
63
|
+
return new Uint8Array(Buffer.from(str, 'base64'));
|
|
64
|
+
}
|
|
65
|
+
// ============================================================================
|
|
66
|
+
// HLC transport helpers
|
|
67
|
+
// ============================================================================
|
|
68
|
+
/** Serialize an HLC for transport (base64 of the binary HLC encoding). */
|
|
69
|
+
export function serializeHLCForTransport(hlc) {
|
|
70
|
+
return bytesToBase64(serializeHLC(hlc));
|
|
71
|
+
}
|
|
72
|
+
/** Deserialize an HLC from transport format (base64 → binary → HLC). */
|
|
73
|
+
export function deserializeHLCFromTransport(str) {
|
|
74
|
+
return deserializeHLC(base64ToBytes(str));
|
|
75
|
+
}
|
|
76
|
+
// ============================================================================
|
|
77
|
+
// Schema migration codec
|
|
78
|
+
// ============================================================================
|
|
79
|
+
function serializeSchemaMigration(m) {
|
|
80
|
+
return {
|
|
81
|
+
type: m.type,
|
|
82
|
+
schema: m.schema,
|
|
83
|
+
table: m.table,
|
|
84
|
+
ddl: m.ddl,
|
|
85
|
+
hlc: serializeHLCForTransport(m.hlc),
|
|
86
|
+
schemaVersion: m.schemaVersion,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
function deserializeSchemaMigration(m) {
|
|
90
|
+
return {
|
|
91
|
+
type: m.type,
|
|
92
|
+
schema: m.schema,
|
|
93
|
+
table: m.table,
|
|
94
|
+
ddl: m.ddl,
|
|
95
|
+
hlc: deserializeHLCFromTransport(m.hlc),
|
|
96
|
+
schemaVersion: m.schemaVersion,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
// ============================================================================
|
|
100
|
+
// ChangeSet codec
|
|
101
|
+
// ============================================================================
|
|
102
|
+
function serializeChange(c) {
|
|
103
|
+
const base = {
|
|
104
|
+
type: c.type,
|
|
105
|
+
schema: c.schema,
|
|
106
|
+
table: c.table,
|
|
107
|
+
pk: c.pk.map(v => encodeSqlValue(v)),
|
|
108
|
+
hlc: serializeHLCForTransport(c.hlc),
|
|
109
|
+
};
|
|
110
|
+
if (c.type === 'column') {
|
|
111
|
+
const cc = c;
|
|
112
|
+
return {
|
|
113
|
+
...base,
|
|
114
|
+
column: cc.column,
|
|
115
|
+
value: encodeSqlValue(cc.value),
|
|
116
|
+
// Carry the per-cell before-image (value + HLC) present-only: write both
|
|
117
|
+
// together gated on priorHlc, never a phantom key. priorHlc reuses the same
|
|
118
|
+
// base64-binary HLC encoding as `hlc`; priorValue rides encodeSqlValue.
|
|
119
|
+
...(cc.priorHlc !== undefined
|
|
120
|
+
? {
|
|
121
|
+
priorValue: encodeSqlValue(cc.priorValue ?? null),
|
|
122
|
+
priorHlc: serializeHLCForTransport(cc.priorHlc),
|
|
123
|
+
}
|
|
124
|
+
: {}),
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
const rd = c;
|
|
128
|
+
return {
|
|
129
|
+
...base,
|
|
130
|
+
// Carry the row before-image present-only. An empty array is present:
|
|
131
|
+
// [].map(...) is still [] and [] !== undefined, so the conditional spread
|
|
132
|
+
// preserves the empty-present vs absent boundary.
|
|
133
|
+
...(rd.priorRow !== undefined
|
|
134
|
+
? { priorRow: rd.priorRow.map(v => encodeSqlValue(v)) }
|
|
135
|
+
: {}),
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
function deserializeChange(c) {
|
|
139
|
+
const base = {
|
|
140
|
+
type: c.type,
|
|
141
|
+
schema: c.schema,
|
|
142
|
+
table: c.table,
|
|
143
|
+
pk: c.pk.map(v => decodeSqlValue(v)),
|
|
144
|
+
hlc: deserializeHLCFromTransport(c.hlc),
|
|
145
|
+
};
|
|
146
|
+
if (c.type === 'column') {
|
|
147
|
+
return {
|
|
148
|
+
...base,
|
|
149
|
+
type: 'column',
|
|
150
|
+
column: c.column,
|
|
151
|
+
value: decodeSqlValue(c.value),
|
|
152
|
+
// Mirror serialize: attach the before-image only when the serialized
|
|
153
|
+
// object carries it, so absent stays absent (not a phantom undefined).
|
|
154
|
+
...(c.priorHlc !== undefined
|
|
155
|
+
? {
|
|
156
|
+
priorValue: decodeSqlValue(c.priorValue),
|
|
157
|
+
priorHlc: deserializeHLCFromTransport(c.priorHlc),
|
|
158
|
+
}
|
|
159
|
+
: {}),
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
return {
|
|
163
|
+
...base,
|
|
164
|
+
type: 'delete',
|
|
165
|
+
...(c.priorRow !== undefined
|
|
166
|
+
? { priorRow: c.priorRow.map(v => decodeSqlValue(v)) }
|
|
167
|
+
: {}),
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Serialize a ChangeSet for JSON transport.
|
|
172
|
+
* Encodes Uint8Array values in changes and PKs so they survive JSON round-trip.
|
|
173
|
+
*/
|
|
174
|
+
export function serializeChangeSet(cs) {
|
|
175
|
+
return {
|
|
176
|
+
siteId: siteIdToBase64(cs.siteId),
|
|
177
|
+
transactionId: cs.transactionId,
|
|
178
|
+
hlc: serializeHLCForTransport(cs.hlc),
|
|
179
|
+
changes: cs.changes.map(serializeChange),
|
|
180
|
+
schemaMigrations: cs.schemaMigrations.map(serializeSchemaMigration),
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Deserialize a ChangeSet from JSON transport format.
|
|
185
|
+
* Decodes tagged Uint8Array values in changes and PKs.
|
|
186
|
+
*/
|
|
187
|
+
export function deserializeChangeSet(obj) {
|
|
188
|
+
return {
|
|
189
|
+
siteId: siteIdFromBase64(obj.siteId),
|
|
190
|
+
transactionId: obj.transactionId,
|
|
191
|
+
hlc: deserializeHLCFromTransport(obj.hlc),
|
|
192
|
+
changes: obj.changes.map(deserializeChange),
|
|
193
|
+
// Lenient read: default to [] when absent. The serializer always emits it
|
|
194
|
+
// (ChangeSet.schemaMigrations is required), so this only guards a malformed
|
|
195
|
+
// peer — cheap Postel, and real drift is caught by the version handshake.
|
|
196
|
+
schemaMigrations: (obj.schemaMigrations ?? []).map(deserializeSchemaMigration),
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
// ============================================================================
|
|
200
|
+
// SnapshotChunk codec
|
|
201
|
+
// ============================================================================
|
|
202
|
+
/**
|
|
203
|
+
* Serialize a SnapshotChunk for JSON transport.
|
|
204
|
+
* Converts binary fields (siteId, HLCs) and SqlValue blobs to base64/tagged JSON.
|
|
205
|
+
*/
|
|
206
|
+
export function serializeSnapshotChunk(chunk) {
|
|
207
|
+
switch (chunk.type) {
|
|
208
|
+
case 'header':
|
|
209
|
+
return {
|
|
210
|
+
type: 'header',
|
|
211
|
+
siteId: siteIdToBase64(chunk.siteId),
|
|
212
|
+
hlc: serializeHLCForTransport(chunk.hlc),
|
|
213
|
+
tableCount: chunk.tableCount,
|
|
214
|
+
migrationCount: chunk.migrationCount,
|
|
215
|
+
snapshotId: chunk.snapshotId,
|
|
216
|
+
};
|
|
217
|
+
case 'column-versions':
|
|
218
|
+
return {
|
|
219
|
+
type: 'column-versions',
|
|
220
|
+
schema: chunk.schema,
|
|
221
|
+
table: chunk.table,
|
|
222
|
+
entries: chunk.entries.map(([key, hlc, value]) => [
|
|
223
|
+
key,
|
|
224
|
+
serializeHLCForTransport(hlc),
|
|
225
|
+
encodeSqlValue(value),
|
|
226
|
+
]),
|
|
227
|
+
};
|
|
228
|
+
case 'tombstone':
|
|
229
|
+
// Each entry carries an HLC (bigint wallTime) and blob-capable pk/priorRow,
|
|
230
|
+
// so it MUST route through serializeHLC / encodeSqlValue — a raw bigint
|
|
231
|
+
// throws at JSON.stringify (e.g. the S3 snapshot upload path).
|
|
232
|
+
return {
|
|
233
|
+
type: 'tombstone',
|
|
234
|
+
schema: chunk.schema,
|
|
235
|
+
table: chunk.table,
|
|
236
|
+
entries: chunk.entries.map(e => ({
|
|
237
|
+
pk: e.pk.map(v => encodeSqlValue(v)),
|
|
238
|
+
hlc: serializeHLCForTransport(e.hlc),
|
|
239
|
+
createdAt: e.createdAt,
|
|
240
|
+
...(e.priorRow !== undefined
|
|
241
|
+
? { priorRow: e.priorRow.map(v => encodeSqlValue(v)) }
|
|
242
|
+
: {}),
|
|
243
|
+
})),
|
|
244
|
+
};
|
|
245
|
+
case 'schema-migration':
|
|
246
|
+
return {
|
|
247
|
+
type: 'schema-migration',
|
|
248
|
+
migration: serializeSchemaMigration(chunk.migration),
|
|
249
|
+
};
|
|
250
|
+
// table-start, table-end, footer carry no binary fields — pass through as-is
|
|
251
|
+
// (spread copies to a plain, JSON-safe object without dropping any key).
|
|
252
|
+
case 'table-start':
|
|
253
|
+
case 'table-end':
|
|
254
|
+
case 'footer':
|
|
255
|
+
return { ...chunk };
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Deserialize a SnapshotChunk from JSON transport format.
|
|
260
|
+
* Converts base64 back to binary fields (siteId, HLC) and decodes SqlValue blobs.
|
|
261
|
+
*/
|
|
262
|
+
export function deserializeSnapshotChunk(obj) {
|
|
263
|
+
switch (obj.type) {
|
|
264
|
+
case 'header':
|
|
265
|
+
return {
|
|
266
|
+
type: 'header',
|
|
267
|
+
siteId: siteIdFromBase64(obj.siteId),
|
|
268
|
+
hlc: deserializeHLCFromTransport(obj.hlc),
|
|
269
|
+
tableCount: obj.tableCount,
|
|
270
|
+
migrationCount: obj.migrationCount,
|
|
271
|
+
snapshotId: obj.snapshotId,
|
|
272
|
+
};
|
|
273
|
+
case 'column-versions':
|
|
274
|
+
return {
|
|
275
|
+
type: 'column-versions',
|
|
276
|
+
schema: obj.schema,
|
|
277
|
+
table: obj.table,
|
|
278
|
+
entries: obj.entries.map(([key, hlc, value]) => [
|
|
279
|
+
key,
|
|
280
|
+
deserializeHLCFromTransport(hlc),
|
|
281
|
+
decodeSqlValue(value),
|
|
282
|
+
]),
|
|
283
|
+
};
|
|
284
|
+
case 'tombstone':
|
|
285
|
+
return {
|
|
286
|
+
type: 'tombstone',
|
|
287
|
+
schema: obj.schema,
|
|
288
|
+
table: obj.table,
|
|
289
|
+
entries: obj.entries.map(e => ({
|
|
290
|
+
pk: e.pk.map(v => decodeSqlValue(v)),
|
|
291
|
+
hlc: deserializeHLCFromTransport(e.hlc),
|
|
292
|
+
createdAt: e.createdAt,
|
|
293
|
+
...(e.priorRow !== undefined
|
|
294
|
+
? { priorRow: e.priorRow.map(v => decodeSqlValue(v)) }
|
|
295
|
+
: {}),
|
|
296
|
+
})),
|
|
297
|
+
};
|
|
298
|
+
case 'schema-migration':
|
|
299
|
+
return {
|
|
300
|
+
type: 'schema-migration',
|
|
301
|
+
migration: deserializeSchemaMigration(obj.migration),
|
|
302
|
+
};
|
|
303
|
+
// table-start, table-end, footer carry no binary fields — pass through as-is.
|
|
304
|
+
case 'table-start':
|
|
305
|
+
case 'table-end':
|
|
306
|
+
case 'footer':
|
|
307
|
+
return { ...obj };
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
//# sourceMappingURL=wire.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wire.js","sourceRoot":"","sources":["../../../src/sync/wire.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAGH,OAAO,EACL,YAAY,EACZ,cAAc,EACd,cAAc,EACd,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAY/E,+EAA+E;AAC/E,mBAAmB;AACnB,+EAA+E;AAE/E;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAElC,+EAA+E;AAC/E,oDAAoD;AACpD,+EAA+E;AAE/E,8EAA8E;AAC9E,gFAAgF;AAChF,iFAAiF;AACjF,6EAA6E;AAE7E,uCAAuC;AACvC,MAAM,UAAU,aAAa,CAAC,KAAiB;IAC7C,IAAI,OAAO,IAAI,KAAK,UAAU,EAAE,CAAC;QAC/B,6EAA6E;QAC7E,yEAAyE;QACzE,2EAA2E;QAC3E,2DAA2D;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CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;oBAC7B,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC,CAAe;oBAClD,GAAG,EAAE,2BAA2B,CAAC,CAAC,CAAC,GAAG,CAAC;oBACvC,SAAS,EAAE,CAAC,CAAC,SAAS;oBACtB,GAAG,CAAC,CAAC,CAAC,QAAQ,KAAK,SAAS;wBAC1B,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC,CAAQ,EAAE;wBAC7D,CAAC,CAAC,EAAE,CAAC;iBACR,CAAC,CAAC;aACJ,CAAC;QACJ,KAAK,kBAAkB;YACrB,OAAO;gBACL,IAAI,EAAE,kBAAkB;gBACxB,SAAS,EAAE,0BAA0B,CAAC,GAAG,CAAC,SAAS,CAAC;aACrD,CAAC;QACJ,8EAA8E;QAC9E,KAAK,aAAa,CAAC;QACnB,KAAK,WAAW,CAAC;QACjB,KAAK,QAAQ;YACX,OAAO,EAAE,GAAG,GAAG,EAAE,CAAC;IACtB,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quereus/sync",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.4.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Fully opaque CRDT sync for Quereus - write normal SQL, get automatic multi-master replication with conflict resolution",
|
|
6
6
|
"keywords": [
|
|
@@ -41,18 +41,19 @@
|
|
|
41
41
|
"scripts": {
|
|
42
42
|
"clean": "rimraf dist",
|
|
43
43
|
"build": "tsc",
|
|
44
|
+
"lint": "echo 'No lint configured'",
|
|
44
45
|
"typecheck": "tsc --noEmit",
|
|
45
46
|
"test": "cd ../.. && node --import ./packages/quereus-sync/register.mjs node_modules/mocha/bin/mocha.js \"packages/quereus-sync/test/**/*.spec.ts\" --reporter min --colors",
|
|
46
47
|
"test:single": "cd ../.. && node --import ./packages/quereus-sync/register.mjs node_modules/mocha/bin/mocha.js --bail"
|
|
47
48
|
},
|
|
48
49
|
"peerDependencies": {
|
|
49
|
-
"@quereus/isolation": "^4.
|
|
50
|
-
"@quereus/quereus": "^4.
|
|
51
|
-
"@quereus/store": "^4.
|
|
50
|
+
"@quereus/isolation": "^4.4.0",
|
|
51
|
+
"@quereus/quereus": "^4.4.0",
|
|
52
|
+
"@quereus/store": "^4.4.0"
|
|
52
53
|
},
|
|
53
54
|
"dependencies": {
|
|
54
|
-
"@quereus/quereus": "^4.
|
|
55
|
-
"@quereus/store": "^4.
|
|
55
|
+
"@quereus/quereus": "^4.4.0",
|
|
56
|
+
"@quereus/store": "^4.4.0"
|
|
56
57
|
},
|
|
57
58
|
"devDependencies": {
|
|
58
59
|
"@types/mocha": "^10.0.10",
|