@rocicorp/zero 0.24.2025090402 → 0.24.2025091200
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/out/{chunk-P6JME3HC.js → chunk-6XNI6IVJ.js} +233 -135
- package/out/chunk-6XNI6IVJ.js.map +7 -0
- package/out/chunk-ASRS2LFV.js +35 -0
- package/out/chunk-ASRS2LFV.js.map +7 -0
- package/out/{chunk-G442PJSB.js → chunk-K5ZSWG54.js} +343 -327
- package/out/chunk-K5ZSWG54.js.map +7 -0
- package/out/{chunk-4NLQ25GZ.js → chunk-KXV3BZ4U.js} +3 -3
- package/out/{inspector-4ALIZXAU.js → inspector-ZZSIUMBB.js} +36 -6
- package/out/inspector-ZZSIUMBB.js.map +7 -0
- package/out/react-native.js +276 -278
- package/out/react-native.js.map +4 -4
- package/out/react.js +98 -35
- package/out/react.js.map +2 -2
- package/out/replicache/src/connection-loop.d.ts.map +1 -1
- package/out/replicache/src/deleted-clients.d.ts +17 -10
- package/out/replicache/src/deleted-clients.d.ts.map +1 -1
- package/out/replicache/src/kv/expo-sqlite/store.d.ts +11 -0
- package/out/replicache/src/kv/expo-sqlite/store.d.ts.map +1 -0
- package/out/replicache/src/kv/idb-store.d.ts.map +1 -1
- package/out/replicache/src/kv/mem-store.d.ts.map +1 -1
- package/out/replicache/src/kv/op-sqlite/store.d.ts +14 -0
- package/out/replicache/src/kv/op-sqlite/store.d.ts.map +1 -0
- package/out/replicache/src/kv/op-sqlite/types.d.ts +13 -0
- package/out/replicache/src/kv/op-sqlite/types.d.ts.map +1 -0
- package/out/replicache/src/kv/read-impl.d.ts.map +1 -1
- package/out/replicache/src/kv/sqlite-store.d.ts +37 -63
- package/out/replicache/src/kv/sqlite-store.d.ts.map +1 -1
- package/out/replicache/src/kv/throw-if-closed.d.ts +12 -0
- package/out/replicache/src/kv/throw-if-closed.d.ts.map +1 -0
- package/out/replicache/src/kv/write-impl-base.d.ts.map +1 -1
- package/out/replicache/src/kv/write-impl.d.ts.map +1 -1
- package/out/replicache/src/persist/client-gc.d.ts.map +1 -1
- package/out/replicache/src/persist/client-group-gc.d.ts +2 -3
- package/out/replicache/src/persist/client-group-gc.d.ts.map +1 -1
- package/out/replicache/src/persist/clients.d.ts +2 -1
- package/out/replicache/src/persist/clients.d.ts.map +1 -1
- package/out/replicache/src/persist/collect-idb-databases.d.ts.map +1 -1
- package/out/replicache/src/replicache-impl.d.ts.map +1 -1
- package/out/solid.js +65 -20
- package/out/solid.js.map +3 -3
- package/out/zero/package.json +1 -1
- package/out/zero/src/zero-cache-dev.js +4 -0
- package/out/zero/src/zero-cache-dev.js.map +1 -1
- package/out/zero-cache/src/auth/write-authorizer.js +1 -1
- package/out/zero-cache/src/auth/write-authorizer.js.map +1 -1
- package/out/zero-cache/src/config/normalize.d.ts +1 -0
- package/out/zero-cache/src/config/normalize.d.ts.map +1 -1
- package/out/zero-cache/src/config/normalize.js +6 -0
- package/out/zero-cache/src/config/normalize.js.map +1 -1
- package/out/zero-cache/src/config/zero-config.d.ts +11 -0
- package/out/zero-cache/src/config/zero-config.d.ts.map +1 -1
- package/out/zero-cache/src/config/zero-config.js +53 -1
- package/out/zero-cache/src/config/zero-config.js.map +1 -1
- package/out/zero-cache/src/custom-queries/transform-query.d.ts.map +1 -1
- package/out/zero-cache/src/custom-queries/transform-query.js +4 -0
- package/out/zero-cache/src/custom-queries/transform-query.js.map +1 -1
- package/out/zero-cache/src/server/anonymous-otel-start.d.ts +1 -0
- package/out/zero-cache/src/server/anonymous-otel-start.d.ts.map +1 -1
- package/out/zero-cache/src/server/anonymous-otel-start.js +41 -2
- package/out/zero-cache/src/server/anonymous-otel-start.js.map +1 -1
- package/out/zero-cache/src/server/inspector-delegate.d.ts +9 -0
- package/out/zero-cache/src/server/inspector-delegate.d.ts.map +1 -1
- package/out/zero-cache/src/server/inspector-delegate.js +18 -0
- package/out/zero-cache/src/server/inspector-delegate.js.map +1 -1
- package/out/zero-cache/src/server/otel-diag-logger.d.ts +16 -0
- package/out/zero-cache/src/server/otel-diag-logger.d.ts.map +1 -0
- package/out/zero-cache/src/server/otel-diag-logger.js +76 -0
- package/out/zero-cache/src/server/otel-diag-logger.js.map +1 -0
- package/out/zero-cache/src/server/otel-start.d.ts.map +1 -1
- package/out/zero-cache/src/server/otel-start.js +13 -13
- package/out/zero-cache/src/server/otel-start.js.map +1 -1
- package/out/zero-cache/src/server/reaper.js +5 -1
- package/out/zero-cache/src/server/reaper.js.map +1 -1
- package/out/zero-cache/src/server/syncer.js +3 -3
- package/out/zero-cache/src/server/syncer.js.map +1 -1
- package/out/zero-cache/src/services/analyze.d.ts +1 -1
- package/out/zero-cache/src/services/analyze.d.ts.map +1 -1
- package/out/zero-cache/src/services/analyze.js +6 -6
- package/out/zero-cache/src/services/analyze.js.map +1 -1
- package/out/zero-cache/src/services/heapz.d.ts +1 -1
- package/out/zero-cache/src/services/heapz.d.ts.map +1 -1
- package/out/zero-cache/src/services/heapz.js +2 -2
- package/out/zero-cache/src/services/heapz.js.map +1 -1
- package/out/zero-cache/src/services/mutagen/pusher.d.ts +12 -4
- package/out/zero-cache/src/services/mutagen/pusher.d.ts.map +1 -1
- package/out/zero-cache/src/services/statz.d.ts +1 -1
- package/out/zero-cache/src/services/statz.d.ts.map +1 -1
- package/out/zero-cache/src/services/statz.js +3 -3
- package/out/zero-cache/src/services/statz.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/cvr-purger.d.ts +7 -1
- package/out/zero-cache/src/services/view-syncer/cvr-purger.d.ts.map +1 -1
- package/out/zero-cache/src/services/view-syncer/cvr-purger.js +17 -8
- package/out/zero-cache/src/services/view-syncer/cvr-purger.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/cvr-store.d.ts +0 -1
- package/out/zero-cache/src/services/view-syncer/cvr-store.d.ts.map +1 -1
- package/out/zero-cache/src/services/view-syncer/cvr-store.js +6 -19
- package/out/zero-cache/src/services/view-syncer/cvr-store.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/cvr.d.ts +0 -1
- package/out/zero-cache/src/services/view-syncer/cvr.d.ts.map +1 -1
- package/out/zero-cache/src/services/view-syncer/cvr.js +19 -8
- package/out/zero-cache/src/services/view-syncer/cvr.js.map +1 -1
- package/out/zero-cache/src/services/view-syncer/pipeline-driver.d.ts +1 -1
- package/out/zero-cache/src/services/view-syncer/pipeline-driver.d.ts.map +1 -1
- package/out/zero-cache/src/services/view-syncer/view-syncer.d.ts +1 -1
- package/out/zero-cache/src/services/view-syncer/view-syncer.d.ts.map +1 -1
- package/out/zero-cache/src/services/view-syncer/view-syncer.js +30 -7
- package/out/zero-cache/src/services/view-syncer/view-syncer.js.map +1 -1
- package/out/zero-client/src/client/active-clients-manager.d.ts +2 -1
- package/out/zero-client/src/client/active-clients-manager.d.ts.map +1 -1
- package/out/zero-client/src/client/delete-clients-manager.d.ts +3 -3
- package/out/zero-client/src/client/delete-clients-manager.d.ts.map +1 -1
- package/out/zero-client/src/client/inspector/inspector.d.ts.map +1 -1
- package/out/zero-client/src/client/query-manager.d.ts +2 -0
- package/out/zero-client/src/client/query-manager.d.ts.map +1 -1
- package/out/zero-client/src/client/zero.d.ts +2 -2
- package/out/zero-client/src/client/zero.d.ts.map +1 -1
- package/out/zero-protocol/src/down.d.ts +5 -0
- package/out/zero-protocol/src/down.d.ts.map +1 -1
- package/out/zero-protocol/src/inspect-down.d.ts +17 -0
- package/out/zero-protocol/src/inspect-down.d.ts.map +1 -1
- package/out/zero-protocol/src/inspect-down.js +5 -1
- package/out/zero-protocol/src/inspect-down.js.map +1 -1
- package/out/zero-protocol/src/inspect-up.d.ts +39 -10
- package/out/zero-protocol/src/inspect-up.d.ts.map +1 -1
- package/out/zero-protocol/src/inspect-up.js +10 -3
- package/out/zero-protocol/src/inspect-up.js.map +1 -1
- package/out/zero-protocol/src/protocol-version.d.ts +1 -1
- package/out/zero-protocol/src/protocol-version.d.ts.map +1 -1
- package/out/zero-protocol/src/protocol-version.js +2 -1
- package/out/zero-protocol/src/protocol-version.js.map +1 -1
- package/out/zero-protocol/src/up.d.ts +10 -1
- package/out/zero-protocol/src/up.d.ts.map +1 -1
- package/out/zero-react/src/use-query.d.ts +20 -3
- package/out/zero-react/src/use-query.d.ts.map +1 -1
- package/out/zero-react-native/src/mod.d.ts +2 -2
- package/out/zero-react-native/src/mod.d.ts.map +1 -1
- package/out/zero-solid/src/solid-view.d.ts +24 -5
- package/out/zero-solid/src/solid-view.d.ts.map +1 -1
- package/out/zero-solid/src/use-query.d.ts.map +1 -1
- package/out/zero.js +4 -4
- package/out/zql/src/ivm/array-view.d.ts +2 -1
- package/out/zql/src/ivm/array-view.d.ts.map +1 -1
- package/out/zql/src/ivm/array-view.js +16 -5
- package/out/zql/src/ivm/array-view.js.map +1 -1
- package/out/zql/src/ivm/view.d.ts +2 -1
- package/out/zql/src/ivm/view.d.ts.map +1 -1
- package/out/zql/src/query/query-delegate.d.ts +2 -1
- package/out/zql/src/query/query-delegate.d.ts.map +1 -1
- package/out/zql/src/query/query-impl.d.ts.map +1 -1
- package/out/zql/src/query/query-impl.js +17 -5
- package/out/zql/src/query/query-impl.js.map +1 -1
- package/out/zql/src/query/typed-view.d.ts +3 -2
- package/out/zql/src/query/typed-view.d.ts.map +1 -1
- package/out/{zero-cache/src/services/view-syncer → zqlite/src}/database-storage.d.ts +2 -2
- package/out/zqlite/src/database-storage.d.ts.map +1 -0
- package/out/{zero-cache/src/services/view-syncer → zqlite/src}/database-storage.js +1 -1
- package/out/zqlite/src/database-storage.js.map +1 -0
- package/package.json +1 -1
- package/out/chunk-G442PJSB.js.map +0 -7
- package/out/chunk-MKB4RXL3.js +0 -15
- package/out/chunk-MKB4RXL3.js.map +0 -7
- package/out/chunk-P6JME3HC.js.map +0 -7
- package/out/inspector-4ALIZXAU.js.map +0 -7
- package/out/replicache/src/expo/store.d.ts +0 -4
- package/out/replicache/src/expo/store.d.ts.map +0 -1
- package/out/zero-cache/src/services/view-syncer/database-storage.d.ts.map +0 -1
- package/out/zero-cache/src/services/view-syncer/database-storage.js.map +0 -1
- /package/out/{chunk-4NLQ25GZ.js.map → chunk-KXV3BZ4U.js.map} +0 -0
|
@@ -258,308 +258,6 @@ async function mustGetHeadHash(name, store) {
|
|
|
258
258
|
return hash2;
|
|
259
259
|
}
|
|
260
260
|
|
|
261
|
-
// ../replicache/src/with-transactions.ts
|
|
262
|
-
function withRead(store, fn) {
|
|
263
|
-
return using(store.read(), fn);
|
|
264
|
-
}
|
|
265
|
-
function withWriteNoImplicitCommit(store, fn) {
|
|
266
|
-
return using(store.write(), fn);
|
|
267
|
-
}
|
|
268
|
-
function withWrite(store, fn) {
|
|
269
|
-
return using(store.write(), async (write) => {
|
|
270
|
-
const result = await fn(write);
|
|
271
|
-
await write.commit();
|
|
272
|
-
return result;
|
|
273
|
-
});
|
|
274
|
-
}
|
|
275
|
-
async function using(x, fn) {
|
|
276
|
-
const write = await x;
|
|
277
|
-
try {
|
|
278
|
-
return await fn(write);
|
|
279
|
-
} finally {
|
|
280
|
-
write.release();
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
// ../replicache/src/dag/chunk.ts
|
|
285
|
-
function asRefs(sortedRefs) {
|
|
286
|
-
return sortedRefs;
|
|
287
|
-
}
|
|
288
|
-
function toRefs(refs) {
|
|
289
|
-
if (Array.isArray(refs)) {
|
|
290
|
-
refs.sort();
|
|
291
|
-
for (let i = 1; i < refs.length; i++) {
|
|
292
|
-
assert(refs[i - 1] !== refs[i], "Refs must not have duplicates");
|
|
293
|
-
}
|
|
294
|
-
return asRefs(refs);
|
|
295
|
-
}
|
|
296
|
-
const refsArray = [...refs];
|
|
297
|
-
refsArray.sort();
|
|
298
|
-
return asRefs(refsArray);
|
|
299
|
-
}
|
|
300
|
-
var Chunk = class {
|
|
301
|
-
hash;
|
|
302
|
-
data;
|
|
303
|
-
/**
|
|
304
|
-
* Meta is an array of refs. If there are no refs we do not write a meta
|
|
305
|
-
* chunk.
|
|
306
|
-
*/
|
|
307
|
-
meta;
|
|
308
|
-
constructor(hash2, data, refs) {
|
|
309
|
-
assert(
|
|
310
|
-
!refs.includes(hash2),
|
|
311
|
-
"Chunk cannot reference itself"
|
|
312
|
-
);
|
|
313
|
-
assertDeepFrozen(data);
|
|
314
|
-
this.hash = hash2;
|
|
315
|
-
this.data = data;
|
|
316
|
-
this.meta = refs;
|
|
317
|
-
}
|
|
318
|
-
};
|
|
319
|
-
function assertRefs(v2) {
|
|
320
|
-
if (!Array.isArray(v2)) {
|
|
321
|
-
throw new Error("Refs must be an array");
|
|
322
|
-
}
|
|
323
|
-
if (v2.length > 0) {
|
|
324
|
-
assertString(v2[0]);
|
|
325
|
-
for (let i = 1; i < v2.length; i++) {
|
|
326
|
-
assertString(v2[i]);
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
function createChunk(data, refs, chunkHasher) {
|
|
331
|
-
const hash2 = chunkHasher();
|
|
332
|
-
return new Chunk(hash2, data, refs);
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
// ../shared/src/random-uint64.ts
|
|
336
|
-
function randomUint64() {
|
|
337
|
-
const high = Math.floor(Math.random() * 4294967295);
|
|
338
|
-
const low = Math.floor(Math.random() * 4294967295);
|
|
339
|
-
return BigInt(high) << 32n | BigInt(low);
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
// ../replicache/src/hash.ts
|
|
343
|
-
var STRING_LENGTH = 22;
|
|
344
|
-
var hashRe = /^[0-9a-v-]+$/;
|
|
345
|
-
var emptyUUID = "0".repeat(STRING_LENGTH);
|
|
346
|
-
var emptyHash = emptyUUID;
|
|
347
|
-
var newRandomHash = makeNewRandomHashFunctionInternal();
|
|
348
|
-
function toStringAndSlice(n, len) {
|
|
349
|
-
return n.toString(32).slice(-len).padStart(len, "0");
|
|
350
|
-
}
|
|
351
|
-
function makeNewRandomHashFunctionInternal() {
|
|
352
|
-
let base = "";
|
|
353
|
-
let i = 0;
|
|
354
|
-
return () => {
|
|
355
|
-
if (!base) {
|
|
356
|
-
base = toStringAndSlice(randomUint64(), 12);
|
|
357
|
-
}
|
|
358
|
-
const tail = toStringAndSlice(i++, 10);
|
|
359
|
-
return base + tail;
|
|
360
|
-
};
|
|
361
|
-
}
|
|
362
|
-
function isHash(value) {
|
|
363
|
-
return typeof value === "string" && hashRe.test(value);
|
|
364
|
-
}
|
|
365
|
-
function assertHash(value) {
|
|
366
|
-
assert2(value, hashSchema);
|
|
367
|
-
}
|
|
368
|
-
var hashSchema = valita_exports.string().assert(isHash, "Invalid hash");
|
|
369
|
-
|
|
370
|
-
// ../replicache/src/index-defs.ts
|
|
371
|
-
var indexDefinitionSchema = readonlyObject({
|
|
372
|
-
prefix: valita_exports.string().optional(),
|
|
373
|
-
jsonPointer: valita_exports.string(),
|
|
374
|
-
allowEmpty: valita_exports.boolean().optional()
|
|
375
|
-
});
|
|
376
|
-
var indexDefinitionsSchema = readonlyRecord(
|
|
377
|
-
indexDefinitionSchema
|
|
378
|
-
);
|
|
379
|
-
function indexDefinitionEqual(a, b) {
|
|
380
|
-
return a.jsonPointer === b.jsonPointer && (a.allowEmpty ?? false) === (b.allowEmpty ?? false) && (a.prefix ?? "") === (b.prefix ?? "");
|
|
381
|
-
}
|
|
382
|
-
function indexDefinitionsEqual(a, b) {
|
|
383
|
-
if (Object.keys(a).length !== Object.keys(b).length) {
|
|
384
|
-
return false;
|
|
385
|
-
}
|
|
386
|
-
for (const [aKey, aValue] of Object.entries(a)) {
|
|
387
|
-
const bValue = b[aKey];
|
|
388
|
-
if (!bValue || !indexDefinitionEqual(aValue, bValue)) {
|
|
389
|
-
return false;
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
return true;
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
// ../replicache/src/persist/client-groups.ts
|
|
396
|
-
var clientGroupSchema = readonlyObject({
|
|
397
|
-
/**
|
|
398
|
-
* The hash of the commit in the perdag last persisted to this client group.
|
|
399
|
-
* Should only be updated by clients assigned to this client group.
|
|
400
|
-
*/
|
|
401
|
-
headHash: hashSchema,
|
|
402
|
-
/**
|
|
403
|
-
* Set of mutator names common to all clients assigned to this client group.
|
|
404
|
-
*/
|
|
405
|
-
mutatorNames: readonlyArray(valita_exports.string()),
|
|
406
|
-
/**
|
|
407
|
-
* Index definitions common to all clients assigned to this client group.
|
|
408
|
-
*/
|
|
409
|
-
indexes: indexDefinitionsSchema,
|
|
410
|
-
/**
|
|
411
|
-
* The highest mutation ID of every client assigned to this client group.
|
|
412
|
-
* Should only be updated by clients assigned to this client group. Read by
|
|
413
|
-
* other clients to determine if there are unacknowledged pending mutations
|
|
414
|
-
* for them to try to recover. This is redundant with information in the
|
|
415
|
-
* commit graph at `headHash`, but allows other clients to determine if there
|
|
416
|
-
* are unacknowledged pending mutations without having to load the commit
|
|
417
|
-
* graph.
|
|
418
|
-
*/
|
|
419
|
-
mutationIDs: readonlyRecord(valita_exports.number()),
|
|
420
|
-
/**
|
|
421
|
-
* The highest lastMutationID received from the server for every client
|
|
422
|
-
* assigned to this client group.
|
|
423
|
-
*
|
|
424
|
-
* Should be updated by the clients assigned to this client group whenever
|
|
425
|
-
* they persist to this client group. Read by other clients to determine if
|
|
426
|
-
* there are unacknowledged pending mutations for them to recover and
|
|
427
|
-
* *updated* by other clients upon successfully recovering pending mutations
|
|
428
|
-
* to avoid redundant pushes of pending mutations.
|
|
429
|
-
*
|
|
430
|
-
* Note: This will be the same as the `lastMutationIDs` of the base snapshot
|
|
431
|
-
* of the client group's commit graph when written by clients assigned to this
|
|
432
|
-
* client group. However, when written by another client recovering mutations
|
|
433
|
-
* it may be different because the other client does not update the commit
|
|
434
|
-
* graph.
|
|
435
|
-
*/
|
|
436
|
-
lastServerAckdMutationIDs: valita_exports.record(valita_exports.number()),
|
|
437
|
-
/**
|
|
438
|
-
* If the server deletes this client group it can signal that the client group
|
|
439
|
-
* was deleted. If that happens we mark this client group as disabled so that
|
|
440
|
-
* we do not use it again when creating new clients.
|
|
441
|
-
*/
|
|
442
|
-
disabled: valita_exports.boolean()
|
|
443
|
-
});
|
|
444
|
-
var CLIENT_GROUPS_HEAD_NAME = "client-groups";
|
|
445
|
-
function assertClientGroup(value) {
|
|
446
|
-
assert2(value, clientGroupSchema);
|
|
447
|
-
}
|
|
448
|
-
function chunkDataToClientGroupMap(chunkData) {
|
|
449
|
-
assertObject(chunkData);
|
|
450
|
-
const clientGroups = /* @__PURE__ */ new Map();
|
|
451
|
-
for (const [key, value] of Object.entries(chunkData)) {
|
|
452
|
-
if (value !== void 0) {
|
|
453
|
-
assertClientGroup(value);
|
|
454
|
-
clientGroups.set(key, value);
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
return clientGroups;
|
|
458
|
-
}
|
|
459
|
-
function clientGroupMapToChunkData(clientGroups, dagWrite) {
|
|
460
|
-
const chunkData = {};
|
|
461
|
-
for (const [clientGroupID, clientGroup] of clientGroups.entries()) {
|
|
462
|
-
dagWrite.assertValidHash(clientGroup.headHash);
|
|
463
|
-
chunkData[clientGroupID] = {
|
|
464
|
-
...clientGroup,
|
|
465
|
-
mutatorNames: [...clientGroup.mutatorNames.values()]
|
|
466
|
-
};
|
|
467
|
-
}
|
|
468
|
-
return deepFreeze(chunkData);
|
|
469
|
-
}
|
|
470
|
-
async function getClientGroupsAtHash(hash2, dagRead) {
|
|
471
|
-
const chunk = await dagRead.getChunk(hash2);
|
|
472
|
-
return chunkDataToClientGroupMap(chunk?.data);
|
|
473
|
-
}
|
|
474
|
-
async function getClientGroups(dagRead) {
|
|
475
|
-
const hash2 = await dagRead.getHead(CLIENT_GROUPS_HEAD_NAME);
|
|
476
|
-
if (!hash2) {
|
|
477
|
-
return /* @__PURE__ */ new Map();
|
|
478
|
-
}
|
|
479
|
-
return getClientGroupsAtHash(hash2, dagRead);
|
|
480
|
-
}
|
|
481
|
-
async function setClientGroups(clientGroups, dagWrite) {
|
|
482
|
-
const currClientGroups = await getClientGroups(dagWrite);
|
|
483
|
-
for (const [clientGroupID, clientGroup] of clientGroups) {
|
|
484
|
-
const currClientGroup = currClientGroups.get(clientGroupID);
|
|
485
|
-
validateClientGroupUpdate(clientGroup, currClientGroup);
|
|
486
|
-
}
|
|
487
|
-
return setValidatedClientGroups(clientGroups, dagWrite);
|
|
488
|
-
}
|
|
489
|
-
async function setClientGroup(clientGroupID, clientGroup, dagWrite) {
|
|
490
|
-
const currClientGroups = await getClientGroups(dagWrite);
|
|
491
|
-
const currClientGroup = currClientGroups.get(clientGroupID);
|
|
492
|
-
validateClientGroupUpdate(clientGroup, currClientGroup);
|
|
493
|
-
const newClientGroups = new Map(currClientGroups);
|
|
494
|
-
newClientGroups.set(clientGroupID, clientGroup);
|
|
495
|
-
return setValidatedClientGroups(newClientGroups, dagWrite);
|
|
496
|
-
}
|
|
497
|
-
function validateClientGroupUpdate(clientGroup, currClientGroup) {
|
|
498
|
-
const mutatorNamesSet = new Set(clientGroup.mutatorNames);
|
|
499
|
-
assert(
|
|
500
|
-
mutatorNamesSet.size === clientGroup.mutatorNames.length,
|
|
501
|
-
"A client group's mutatorNames must be a set."
|
|
502
|
-
);
|
|
503
|
-
if (currClientGroup !== void 0) {
|
|
504
|
-
assert(
|
|
505
|
-
indexDefinitionsEqual(currClientGroup.indexes, clientGroup.indexes),
|
|
506
|
-
"A client group's index definitions must never change."
|
|
507
|
-
);
|
|
508
|
-
assert(
|
|
509
|
-
mutatorNamesEqual(mutatorNamesSet, currClientGroup.mutatorNames),
|
|
510
|
-
"A client group's mutatorNames must never change."
|
|
511
|
-
);
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
async function setValidatedClientGroups(clientGroups, dagWrite) {
|
|
515
|
-
const chunkData = clientGroupMapToChunkData(clientGroups, dagWrite);
|
|
516
|
-
const refs = /* @__PURE__ */ new Set();
|
|
517
|
-
for (const clientGroup of clientGroups.values()) {
|
|
518
|
-
refs.add(clientGroup.headHash);
|
|
519
|
-
}
|
|
520
|
-
const chunk = dagWrite.createChunk(chunkData, toRefs(refs));
|
|
521
|
-
await dagWrite.putChunk(chunk);
|
|
522
|
-
await dagWrite.setHead(CLIENT_GROUPS_HEAD_NAME, chunk.hash);
|
|
523
|
-
return clientGroups;
|
|
524
|
-
}
|
|
525
|
-
function mutatorNamesEqual(mutatorNamesSet, mutatorNames) {
|
|
526
|
-
if (mutatorNames.length !== mutatorNamesSet.size) {
|
|
527
|
-
return false;
|
|
528
|
-
}
|
|
529
|
-
for (const mutatorName of mutatorNames) {
|
|
530
|
-
if (!mutatorNamesSet.has(mutatorName)) {
|
|
531
|
-
return false;
|
|
532
|
-
}
|
|
533
|
-
}
|
|
534
|
-
return true;
|
|
535
|
-
}
|
|
536
|
-
async function getClientGroup(id, dagRead) {
|
|
537
|
-
const clientGroups = await getClientGroups(dagRead);
|
|
538
|
-
return clientGroups.get(id);
|
|
539
|
-
}
|
|
540
|
-
function clientGroupHasPendingMutations(clientGroup) {
|
|
541
|
-
for (const [clientID, mutationID] of Object.entries(
|
|
542
|
-
clientGroup.mutationIDs
|
|
543
|
-
)) {
|
|
544
|
-
const lastServerAckdMutationID = clientGroup.lastServerAckdMutationIDs[clientID];
|
|
545
|
-
if (lastServerAckdMutationID === void 0 && mutationID !== 0 || lastServerAckdMutationID < mutationID) {
|
|
546
|
-
return true;
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
return false;
|
|
550
|
-
}
|
|
551
|
-
async function disableClientGroup(clientGroupID, dagWrite) {
|
|
552
|
-
const clientGroup = await getClientGroup(clientGroupID, dagWrite);
|
|
553
|
-
if (!clientGroup) {
|
|
554
|
-
return;
|
|
555
|
-
}
|
|
556
|
-
const disabledClientGroup = {
|
|
557
|
-
...clientGroup,
|
|
558
|
-
disabled: true
|
|
559
|
-
};
|
|
560
|
-
await setClientGroup(clientGroupID, disabledClientGroup, dagWrite);
|
|
561
|
-
}
|
|
562
|
-
|
|
563
261
|
// ../shared/src/json.ts
|
|
564
262
|
function deepEqual(a, b) {
|
|
565
263
|
if (a === b) {
|
|
@@ -700,6 +398,41 @@ function isJSONArray(v2, path2) {
|
|
|
700
398
|
return true;
|
|
701
399
|
}
|
|
702
400
|
|
|
401
|
+
// ../shared/src/random-uint64.ts
|
|
402
|
+
function randomUint64() {
|
|
403
|
+
const high = Math.floor(Math.random() * 4294967295);
|
|
404
|
+
const low = Math.floor(Math.random() * 4294967295);
|
|
405
|
+
return BigInt(high) << 32n | BigInt(low);
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
// ../replicache/src/hash.ts
|
|
409
|
+
var STRING_LENGTH = 22;
|
|
410
|
+
var hashRe = /^[0-9a-v-]+$/;
|
|
411
|
+
var emptyUUID = "0".repeat(STRING_LENGTH);
|
|
412
|
+
var emptyHash = emptyUUID;
|
|
413
|
+
var newRandomHash = makeNewRandomHashFunctionInternal();
|
|
414
|
+
function toStringAndSlice(n, len) {
|
|
415
|
+
return n.toString(32).slice(-len).padStart(len, "0");
|
|
416
|
+
}
|
|
417
|
+
function makeNewRandomHashFunctionInternal() {
|
|
418
|
+
let base = "";
|
|
419
|
+
let i = 0;
|
|
420
|
+
return () => {
|
|
421
|
+
if (!base) {
|
|
422
|
+
base = toStringAndSlice(randomUint64(), 12);
|
|
423
|
+
}
|
|
424
|
+
const tail = toStringAndSlice(i++, 10);
|
|
425
|
+
return base + tail;
|
|
426
|
+
};
|
|
427
|
+
}
|
|
428
|
+
function isHash(value) {
|
|
429
|
+
return typeof value === "string" && hashRe.test(value);
|
|
430
|
+
}
|
|
431
|
+
function assertHash(value) {
|
|
432
|
+
assert2(value, hashSchema);
|
|
433
|
+
}
|
|
434
|
+
var hashSchema = valita_exports.string().assert(isHash, "Invalid hash");
|
|
435
|
+
|
|
703
436
|
// ../replicache/src/size-of-value.ts
|
|
704
437
|
var SIZE_TAG = 1;
|
|
705
438
|
var SIZE_INT32 = 4;
|
|
@@ -1572,7 +1305,58 @@ function assertCookie(v2) {
|
|
|
1572
1305
|
if (typeof v2.order === "string" || typeof v2.order === "number") {
|
|
1573
1306
|
return;
|
|
1574
1307
|
}
|
|
1575
|
-
throw new Error("Invalid cookie");
|
|
1308
|
+
throw new Error("Invalid cookie");
|
|
1309
|
+
}
|
|
1310
|
+
|
|
1311
|
+
// ../replicache/src/dag/chunk.ts
|
|
1312
|
+
function asRefs(sortedRefs) {
|
|
1313
|
+
return sortedRefs;
|
|
1314
|
+
}
|
|
1315
|
+
function toRefs(refs) {
|
|
1316
|
+
if (Array.isArray(refs)) {
|
|
1317
|
+
refs.sort();
|
|
1318
|
+
for (let i = 1; i < refs.length; i++) {
|
|
1319
|
+
assert(refs[i - 1] !== refs[i], "Refs must not have duplicates");
|
|
1320
|
+
}
|
|
1321
|
+
return asRefs(refs);
|
|
1322
|
+
}
|
|
1323
|
+
const refsArray = [...refs];
|
|
1324
|
+
refsArray.sort();
|
|
1325
|
+
return asRefs(refsArray);
|
|
1326
|
+
}
|
|
1327
|
+
var Chunk = class {
|
|
1328
|
+
hash;
|
|
1329
|
+
data;
|
|
1330
|
+
/**
|
|
1331
|
+
* Meta is an array of refs. If there are no refs we do not write a meta
|
|
1332
|
+
* chunk.
|
|
1333
|
+
*/
|
|
1334
|
+
meta;
|
|
1335
|
+
constructor(hash2, data, refs) {
|
|
1336
|
+
assert(
|
|
1337
|
+
!refs.includes(hash2),
|
|
1338
|
+
"Chunk cannot reference itself"
|
|
1339
|
+
);
|
|
1340
|
+
assertDeepFrozen(data);
|
|
1341
|
+
this.hash = hash2;
|
|
1342
|
+
this.data = data;
|
|
1343
|
+
this.meta = refs;
|
|
1344
|
+
}
|
|
1345
|
+
};
|
|
1346
|
+
function assertRefs(v2) {
|
|
1347
|
+
if (!Array.isArray(v2)) {
|
|
1348
|
+
throw new Error("Refs must be an array");
|
|
1349
|
+
}
|
|
1350
|
+
if (v2.length > 0) {
|
|
1351
|
+
assertString(v2[0]);
|
|
1352
|
+
for (let i = 1; i < v2.length; i++) {
|
|
1353
|
+
assertString(v2[i]);
|
|
1354
|
+
}
|
|
1355
|
+
}
|
|
1356
|
+
}
|
|
1357
|
+
function createChunk(data, refs, chunkHasher) {
|
|
1358
|
+
const hash2 = chunkHasher();
|
|
1359
|
+
return new Chunk(hash2, data, refs);
|
|
1576
1360
|
}
|
|
1577
1361
|
|
|
1578
1362
|
// ../replicache/src/db/meta-type-enum.ts
|
|
@@ -2085,6 +1869,222 @@ function readIndexesForRead(commit, dagRead, formatVersion) {
|
|
|
2085
1869
|
return m;
|
|
2086
1870
|
}
|
|
2087
1871
|
|
|
1872
|
+
// ../replicache/src/with-transactions.ts
|
|
1873
|
+
function withRead(store, fn) {
|
|
1874
|
+
return using(store.read(), fn);
|
|
1875
|
+
}
|
|
1876
|
+
function withWriteNoImplicitCommit(store, fn) {
|
|
1877
|
+
return using(store.write(), fn);
|
|
1878
|
+
}
|
|
1879
|
+
function withWrite(store, fn) {
|
|
1880
|
+
return using(store.write(), async (write) => {
|
|
1881
|
+
const result = await fn(write);
|
|
1882
|
+
await write.commit();
|
|
1883
|
+
return result;
|
|
1884
|
+
});
|
|
1885
|
+
}
|
|
1886
|
+
async function using(x, fn) {
|
|
1887
|
+
const write = await x;
|
|
1888
|
+
try {
|
|
1889
|
+
return await fn(write);
|
|
1890
|
+
} finally {
|
|
1891
|
+
write.release();
|
|
1892
|
+
}
|
|
1893
|
+
}
|
|
1894
|
+
|
|
1895
|
+
// ../replicache/src/index-defs.ts
|
|
1896
|
+
var indexDefinitionSchema = readonlyObject({
|
|
1897
|
+
prefix: valita_exports.string().optional(),
|
|
1898
|
+
jsonPointer: valita_exports.string(),
|
|
1899
|
+
allowEmpty: valita_exports.boolean().optional()
|
|
1900
|
+
});
|
|
1901
|
+
var indexDefinitionsSchema = readonlyRecord(
|
|
1902
|
+
indexDefinitionSchema
|
|
1903
|
+
);
|
|
1904
|
+
function indexDefinitionEqual(a, b) {
|
|
1905
|
+
return a.jsonPointer === b.jsonPointer && (a.allowEmpty ?? false) === (b.allowEmpty ?? false) && (a.prefix ?? "") === (b.prefix ?? "");
|
|
1906
|
+
}
|
|
1907
|
+
function indexDefinitionsEqual(a, b) {
|
|
1908
|
+
if (Object.keys(a).length !== Object.keys(b).length) {
|
|
1909
|
+
return false;
|
|
1910
|
+
}
|
|
1911
|
+
for (const [aKey, aValue] of Object.entries(a)) {
|
|
1912
|
+
const bValue = b[aKey];
|
|
1913
|
+
if (!bValue || !indexDefinitionEqual(aValue, bValue)) {
|
|
1914
|
+
return false;
|
|
1915
|
+
}
|
|
1916
|
+
}
|
|
1917
|
+
return true;
|
|
1918
|
+
}
|
|
1919
|
+
|
|
1920
|
+
// ../replicache/src/persist/client-groups.ts
|
|
1921
|
+
var clientGroupSchema = readonlyObject({
|
|
1922
|
+
/**
|
|
1923
|
+
* The hash of the commit in the perdag last persisted to this client group.
|
|
1924
|
+
* Should only be updated by clients assigned to this client group.
|
|
1925
|
+
*/
|
|
1926
|
+
headHash: hashSchema,
|
|
1927
|
+
/**
|
|
1928
|
+
* Set of mutator names common to all clients assigned to this client group.
|
|
1929
|
+
*/
|
|
1930
|
+
mutatorNames: readonlyArray(valita_exports.string()),
|
|
1931
|
+
/**
|
|
1932
|
+
* Index definitions common to all clients assigned to this client group.
|
|
1933
|
+
*/
|
|
1934
|
+
indexes: indexDefinitionsSchema,
|
|
1935
|
+
/**
|
|
1936
|
+
* The highest mutation ID of every client assigned to this client group.
|
|
1937
|
+
* Should only be updated by clients assigned to this client group. Read by
|
|
1938
|
+
* other clients to determine if there are unacknowledged pending mutations
|
|
1939
|
+
* for them to try to recover. This is redundant with information in the
|
|
1940
|
+
* commit graph at `headHash`, but allows other clients to determine if there
|
|
1941
|
+
* are unacknowledged pending mutations without having to load the commit
|
|
1942
|
+
* graph.
|
|
1943
|
+
*/
|
|
1944
|
+
mutationIDs: readonlyRecord(valita_exports.number()),
|
|
1945
|
+
/**
|
|
1946
|
+
* The highest lastMutationID received from the server for every client
|
|
1947
|
+
* assigned to this client group.
|
|
1948
|
+
*
|
|
1949
|
+
* Should be updated by the clients assigned to this client group whenever
|
|
1950
|
+
* they persist to this client group. Read by other clients to determine if
|
|
1951
|
+
* there are unacknowledged pending mutations for them to recover and
|
|
1952
|
+
* *updated* by other clients upon successfully recovering pending mutations
|
|
1953
|
+
* to avoid redundant pushes of pending mutations.
|
|
1954
|
+
*
|
|
1955
|
+
* Note: This will be the same as the `lastMutationIDs` of the base snapshot
|
|
1956
|
+
* of the client group's commit graph when written by clients assigned to this
|
|
1957
|
+
* client group. However, when written by another client recovering mutations
|
|
1958
|
+
* it may be different because the other client does not update the commit
|
|
1959
|
+
* graph.
|
|
1960
|
+
*/
|
|
1961
|
+
lastServerAckdMutationIDs: valita_exports.record(valita_exports.number()),
|
|
1962
|
+
/**
|
|
1963
|
+
* If the server deletes this client group it can signal that the client group
|
|
1964
|
+
* was deleted. If that happens we mark this client group as disabled so that
|
|
1965
|
+
* we do not use it again when creating new clients.
|
|
1966
|
+
*/
|
|
1967
|
+
disabled: valita_exports.boolean()
|
|
1968
|
+
});
|
|
1969
|
+
var CLIENT_GROUPS_HEAD_NAME = "client-groups";
|
|
1970
|
+
function assertClientGroup(value) {
|
|
1971
|
+
assert2(value, clientGroupSchema);
|
|
1972
|
+
}
|
|
1973
|
+
function chunkDataToClientGroupMap(chunkData) {
|
|
1974
|
+
assertObject(chunkData);
|
|
1975
|
+
const clientGroups = /* @__PURE__ */ new Map();
|
|
1976
|
+
for (const [key, value] of Object.entries(chunkData)) {
|
|
1977
|
+
if (value !== void 0) {
|
|
1978
|
+
assertClientGroup(value);
|
|
1979
|
+
clientGroups.set(key, value);
|
|
1980
|
+
}
|
|
1981
|
+
}
|
|
1982
|
+
return clientGroups;
|
|
1983
|
+
}
|
|
1984
|
+
function clientGroupMapToChunkData(clientGroups, dagWrite) {
|
|
1985
|
+
const chunkData = {};
|
|
1986
|
+
for (const [clientGroupID, clientGroup] of clientGroups.entries()) {
|
|
1987
|
+
dagWrite.assertValidHash(clientGroup.headHash);
|
|
1988
|
+
chunkData[clientGroupID] = {
|
|
1989
|
+
...clientGroup,
|
|
1990
|
+
mutatorNames: [...clientGroup.mutatorNames.values()]
|
|
1991
|
+
};
|
|
1992
|
+
}
|
|
1993
|
+
return deepFreeze(chunkData);
|
|
1994
|
+
}
|
|
1995
|
+
async function getClientGroupsAtHash(hash2, dagRead) {
|
|
1996
|
+
const chunk = await dagRead.getChunk(hash2);
|
|
1997
|
+
return chunkDataToClientGroupMap(chunk?.data);
|
|
1998
|
+
}
|
|
1999
|
+
async function getClientGroups(dagRead) {
|
|
2000
|
+
const hash2 = await dagRead.getHead(CLIENT_GROUPS_HEAD_NAME);
|
|
2001
|
+
if (!hash2) {
|
|
2002
|
+
return /* @__PURE__ */ new Map();
|
|
2003
|
+
}
|
|
2004
|
+
return getClientGroupsAtHash(hash2, dagRead);
|
|
2005
|
+
}
|
|
2006
|
+
async function setClientGroups(clientGroups, dagWrite) {
|
|
2007
|
+
const currClientGroups = await getClientGroups(dagWrite);
|
|
2008
|
+
for (const [clientGroupID, clientGroup] of clientGroups) {
|
|
2009
|
+
const currClientGroup = currClientGroups.get(clientGroupID);
|
|
2010
|
+
validateClientGroupUpdate(clientGroup, currClientGroup);
|
|
2011
|
+
}
|
|
2012
|
+
return setValidatedClientGroups(clientGroups, dagWrite);
|
|
2013
|
+
}
|
|
2014
|
+
async function setClientGroup(clientGroupID, clientGroup, dagWrite) {
|
|
2015
|
+
const currClientGroups = await getClientGroups(dagWrite);
|
|
2016
|
+
const currClientGroup = currClientGroups.get(clientGroupID);
|
|
2017
|
+
validateClientGroupUpdate(clientGroup, currClientGroup);
|
|
2018
|
+
const newClientGroups = new Map(currClientGroups);
|
|
2019
|
+
newClientGroups.set(clientGroupID, clientGroup);
|
|
2020
|
+
return setValidatedClientGroups(newClientGroups, dagWrite);
|
|
2021
|
+
}
|
|
2022
|
+
function validateClientGroupUpdate(clientGroup, currClientGroup) {
|
|
2023
|
+
const mutatorNamesSet = new Set(clientGroup.mutatorNames);
|
|
2024
|
+
assert(
|
|
2025
|
+
mutatorNamesSet.size === clientGroup.mutatorNames.length,
|
|
2026
|
+
"A client group's mutatorNames must be a set."
|
|
2027
|
+
);
|
|
2028
|
+
if (currClientGroup !== void 0) {
|
|
2029
|
+
assert(
|
|
2030
|
+
indexDefinitionsEqual(currClientGroup.indexes, clientGroup.indexes),
|
|
2031
|
+
"A client group's index definitions must never change."
|
|
2032
|
+
);
|
|
2033
|
+
assert(
|
|
2034
|
+
mutatorNamesEqual(mutatorNamesSet, currClientGroup.mutatorNames),
|
|
2035
|
+
"A client group's mutatorNames must never change."
|
|
2036
|
+
);
|
|
2037
|
+
}
|
|
2038
|
+
}
|
|
2039
|
+
async function setValidatedClientGroups(clientGroups, dagWrite) {
|
|
2040
|
+
const chunkData = clientGroupMapToChunkData(clientGroups, dagWrite);
|
|
2041
|
+
const refs = /* @__PURE__ */ new Set();
|
|
2042
|
+
for (const clientGroup of clientGroups.values()) {
|
|
2043
|
+
refs.add(clientGroup.headHash);
|
|
2044
|
+
}
|
|
2045
|
+
const chunk = dagWrite.createChunk(chunkData, toRefs(refs));
|
|
2046
|
+
await dagWrite.putChunk(chunk);
|
|
2047
|
+
await dagWrite.setHead(CLIENT_GROUPS_HEAD_NAME, chunk.hash);
|
|
2048
|
+
return clientGroups;
|
|
2049
|
+
}
|
|
2050
|
+
function mutatorNamesEqual(mutatorNamesSet, mutatorNames) {
|
|
2051
|
+
if (mutatorNames.length !== mutatorNamesSet.size) {
|
|
2052
|
+
return false;
|
|
2053
|
+
}
|
|
2054
|
+
for (const mutatorName of mutatorNames) {
|
|
2055
|
+
if (!mutatorNamesSet.has(mutatorName)) {
|
|
2056
|
+
return false;
|
|
2057
|
+
}
|
|
2058
|
+
}
|
|
2059
|
+
return true;
|
|
2060
|
+
}
|
|
2061
|
+
async function getClientGroup(id, dagRead) {
|
|
2062
|
+
const clientGroups = await getClientGroups(dagRead);
|
|
2063
|
+
return clientGroups.get(id);
|
|
2064
|
+
}
|
|
2065
|
+
function clientGroupHasPendingMutations(clientGroup) {
|
|
2066
|
+
for (const [clientID, mutationID] of Object.entries(
|
|
2067
|
+
clientGroup.mutationIDs
|
|
2068
|
+
)) {
|
|
2069
|
+
const lastServerAckdMutationID = clientGroup.lastServerAckdMutationIDs[clientID];
|
|
2070
|
+
if (lastServerAckdMutationID === void 0 && mutationID !== 0 || lastServerAckdMutationID < mutationID) {
|
|
2071
|
+
return true;
|
|
2072
|
+
}
|
|
2073
|
+
}
|
|
2074
|
+
return false;
|
|
2075
|
+
}
|
|
2076
|
+
async function disableClientGroup(clientGroupID, dagWrite) {
|
|
2077
|
+
const clientGroup = await getClientGroup(clientGroupID, dagWrite);
|
|
2078
|
+
if (!clientGroup) {
|
|
2079
|
+
return;
|
|
2080
|
+
}
|
|
2081
|
+
const disabledClientGroup = {
|
|
2082
|
+
...clientGroup,
|
|
2083
|
+
disabled: true
|
|
2084
|
+
};
|
|
2085
|
+
await setClientGroup(clientGroupID, disabledClientGroup, dagWrite);
|
|
2086
|
+
}
|
|
2087
|
+
|
|
2088
2088
|
// ../replicache/src/async-iterable-to-array.ts
|
|
2089
2089
|
async function asyncIterableToArray(it) {
|
|
2090
2090
|
const arr = [];
|
|
@@ -3756,10 +3756,15 @@ var inspectVersionDownSchema = inspectBaseDownSchema.extend({
|
|
|
3756
3756
|
op: valita_exports.literal("version"),
|
|
3757
3757
|
value: valita_exports.string()
|
|
3758
3758
|
});
|
|
3759
|
+
var inspectAuthenticatedDownSchema = inspectBaseDownSchema.extend({
|
|
3760
|
+
op: valita_exports.literal("authenticated"),
|
|
3761
|
+
value: valita_exports.boolean()
|
|
3762
|
+
});
|
|
3759
3763
|
var inspectDownBodySchema = valita_exports.union(
|
|
3760
3764
|
inspectQueriesDownSchema,
|
|
3761
3765
|
inspectMetricsDownSchema,
|
|
3762
|
-
inspectVersionDownSchema
|
|
3766
|
+
inspectVersionDownSchema,
|
|
3767
|
+
inspectAuthenticatedDownSchema
|
|
3763
3768
|
);
|
|
3764
3769
|
var inspectDownMessageSchema = valita_exports.tuple([
|
|
3765
3770
|
valita_exports.literal("inspect"),
|
|
@@ -6425,7 +6430,8 @@ var ArrayView = class {
|
|
|
6425
6430
|
#root;
|
|
6426
6431
|
onDestroy;
|
|
6427
6432
|
#dirty = false;
|
|
6428
|
-
#
|
|
6433
|
+
#resultType = "unknown";
|
|
6434
|
+
#error;
|
|
6429
6435
|
#updateTTL;
|
|
6430
6436
|
constructor(input, format, queryComplete, updateTTL) {
|
|
6431
6437
|
this.#input = input;
|
|
@@ -6435,10 +6441,17 @@ var ArrayView = class {
|
|
|
6435
6441
|
this.#root = { "": format.singular ? void 0 : [] };
|
|
6436
6442
|
input.setOutput(this);
|
|
6437
6443
|
if (queryComplete === true) {
|
|
6438
|
-
this.#
|
|
6444
|
+
this.#resultType = "complete";
|
|
6445
|
+
} else if ("error" in queryComplete) {
|
|
6446
|
+
this.#resultType = "error";
|
|
6447
|
+
this.#error = queryComplete;
|
|
6439
6448
|
} else {
|
|
6440
6449
|
void queryComplete.then(() => {
|
|
6441
|
-
this.#
|
|
6450
|
+
this.#resultType = "complete";
|
|
6451
|
+
this.#fireListeners();
|
|
6452
|
+
}).catch((e) => {
|
|
6453
|
+
this.#resultType = "error";
|
|
6454
|
+
this.#error = e;
|
|
6442
6455
|
this.#fireListeners();
|
|
6443
6456
|
});
|
|
6444
6457
|
}
|
|
@@ -6461,10 +6474,7 @@ var ArrayView = class {
|
|
|
6461
6474
|
}
|
|
6462
6475
|
}
|
|
6463
6476
|
#fireListener(listener) {
|
|
6464
|
-
listener(
|
|
6465
|
-
this.data,
|
|
6466
|
-
this.#complete ? "complete" : "unknown"
|
|
6467
|
-
);
|
|
6477
|
+
listener(this.data, this.#resultType, this.#error);
|
|
6468
6478
|
}
|
|
6469
6479
|
destroy() {
|
|
6470
6480
|
this.onDestroy?.();
|
|
@@ -6637,7 +6647,7 @@ var AbstractQuery = class {
|
|
|
6637
6647
|
assert(related, "Invalid relationship");
|
|
6638
6648
|
if (isOneHop(related)) {
|
|
6639
6649
|
const { destSchema, destField, sourceField, cardinality } = related[0];
|
|
6640
|
-
|
|
6650
|
+
const q = this[newQuerySymbol](
|
|
6641
6651
|
this._delegate,
|
|
6642
6652
|
this.#schema,
|
|
6643
6653
|
destSchema,
|
|
@@ -6652,9 +6662,6 @@ var AbstractQuery = class {
|
|
|
6652
6662
|
this.customQueryID,
|
|
6653
6663
|
void 0
|
|
6654
6664
|
);
|
|
6655
|
-
if (cardinality === "one") {
|
|
6656
|
-
q = q.one();
|
|
6657
|
-
}
|
|
6658
6665
|
const sq = cb(q);
|
|
6659
6666
|
assert(
|
|
6660
6667
|
isCompoundKey(sourceField),
|
|
@@ -7049,7 +7056,12 @@ var QueryImpl = class _QueryImpl extends AbstractQuery {
|
|
|
7049
7056
|
const updateTTL = (newTTL) => {
|
|
7050
7057
|
this.customQueryID ? delegate.updateCustomQuery(this.customQueryID, newTTL) : delegate.updateServerQuery(ast, newTTL);
|
|
7051
7058
|
};
|
|
7052
|
-
const gotCallback = (got) => {
|
|
7059
|
+
const gotCallback = (got, error) => {
|
|
7060
|
+
if (error) {
|
|
7061
|
+
queryCompleteResolver.reject(error);
|
|
7062
|
+
queryComplete = error;
|
|
7063
|
+
return;
|
|
7064
|
+
}
|
|
7053
7065
|
if (got) {
|
|
7054
7066
|
delegate.addMetric(
|
|
7055
7067
|
"query-materialization-end-to-end",
|
|
@@ -7103,6 +7115,9 @@ var QueryImpl = class _QueryImpl extends AbstractQuery {
|
|
|
7103
7115
|
if (type === "complete") {
|
|
7104
7116
|
v2.destroy();
|
|
7105
7117
|
resolve(data);
|
|
7118
|
+
} else if (type === "error") {
|
|
7119
|
+
v2.destroy();
|
|
7120
|
+
resolve(Promise.reject(data));
|
|
7106
7121
|
}
|
|
7107
7122
|
});
|
|
7108
7123
|
});
|
|
@@ -7212,16 +7227,6 @@ export {
|
|
|
7212
7227
|
ChunkNotFoundError,
|
|
7213
7228
|
mustGetChunk,
|
|
7214
7229
|
mustGetHeadHash,
|
|
7215
|
-
withRead,
|
|
7216
|
-
withWriteNoImplicitCommit,
|
|
7217
|
-
withWrite,
|
|
7218
|
-
using,
|
|
7219
|
-
getClientGroups,
|
|
7220
|
-
setClientGroups,
|
|
7221
|
-
setClientGroup,
|
|
7222
|
-
getClientGroup,
|
|
7223
|
-
clientGroupHasPendingMutations,
|
|
7224
|
-
disableClientGroup,
|
|
7225
7230
|
binarySearch,
|
|
7226
7231
|
joinIterables,
|
|
7227
7232
|
once,
|
|
@@ -7258,6 +7263,16 @@ export {
|
|
|
7258
7263
|
newWriteSnapshotDD31,
|
|
7259
7264
|
clientGroupIDSchema,
|
|
7260
7265
|
clientIDSchema,
|
|
7266
|
+
withRead,
|
|
7267
|
+
withWriteNoImplicitCommit,
|
|
7268
|
+
withWrite,
|
|
7269
|
+
using,
|
|
7270
|
+
getClientGroups,
|
|
7271
|
+
setClientGroups,
|
|
7272
|
+
setClientGroup,
|
|
7273
|
+
getClientGroup,
|
|
7274
|
+
clientGroupHasPendingMutations,
|
|
7275
|
+
disableClientGroup,
|
|
7261
7276
|
makeClientID,
|
|
7262
7277
|
assertClientV6,
|
|
7263
7278
|
getClients,
|
|
@@ -7313,6 +7328,7 @@ export {
|
|
|
7313
7328
|
inspectQueriesDownSchema,
|
|
7314
7329
|
inspectMetricsDownSchema,
|
|
7315
7330
|
inspectVersionDownSchema,
|
|
7331
|
+
inspectAuthenticatedDownSchema,
|
|
7316
7332
|
inspectDownMessageSchema,
|
|
7317
7333
|
primaryKeySchema,
|
|
7318
7334
|
primaryKeyValueRecordSchema,
|
|
@@ -7328,4 +7344,4 @@ export {
|
|
|
7328
7344
|
sourceNameFromKey,
|
|
7329
7345
|
TDigest
|
|
7330
7346
|
};
|
|
7331
|
-
//# sourceMappingURL=chunk-
|
|
7347
|
+
//# sourceMappingURL=chunk-K5ZSWG54.js.map
|