@evolu/common 8.10.0 → 8.11.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/Config.d.ts +22 -22
- package/dist/src/Config.d.ts.map +1 -1
- package/dist/src/Console.d.ts +62 -7
- package/dist/src/Console.d.ts.map +1 -1
- package/dist/src/Console.js +20 -4
- package/dist/src/Crypto.d.ts +76 -4
- package/dist/src/Crypto.d.ts.map +1 -1
- package/dist/src/Crypto.js +55 -4
- package/dist/src/Error.d.ts +45 -0
- package/dist/src/Error.d.ts.map +1 -1
- package/dist/src/Error.js +69 -0
- package/dist/src/Fs.d.ts +92 -18
- package/dist/src/Fs.d.ts.map +1 -1
- package/dist/src/Fs.js +2 -0
- package/dist/src/Identicon.d.ts +2 -2
- package/dist/src/Identicon.js +2 -2
- package/dist/src/LeakDetector.d.ts +22 -3
- package/dist/src/LeakDetector.d.ts.map +1 -1
- package/dist/src/LeakDetector.js +12 -2
- package/dist/src/LockManager.d.ts +8 -0
- package/dist/src/LockManager.d.ts.map +1 -1
- package/dist/src/LockManager.js +6 -0
- package/dist/src/Object.d.ts.map +1 -1
- package/dist/src/Object.js +5 -0
- package/dist/src/Platform.d.ts +47 -7
- package/dist/src/Platform.d.ts.map +1 -1
- package/dist/src/Platform.js +24 -5
- package/dist/src/Random.d.ts +25 -2
- package/dist/src/Random.d.ts.map +1 -1
- package/dist/src/Random.js +14 -2
- package/dist/src/Resource.d.ts +156 -1
- package/dist/src/Resource.d.ts.map +1 -1
- package/dist/src/Resource.js +201 -72
- package/dist/src/Schedule.d.ts +11 -10
- package/dist/src/Schedule.d.ts.map +1 -1
- package/dist/src/Schedule.js +1 -1
- package/dist/src/Sqlite.d.ts +132 -16
- package/dist/src/Sqlite.d.ts.map +1 -1
- package/dist/src/Sqlite.js +63 -9
- package/dist/src/Task.d.ts +15 -4
- package/dist/src/Task.d.ts.map +1 -1
- package/dist/src/Task.js +41 -15
- package/dist/src/Test.d.ts +9 -0
- package/dist/src/Test.d.ts.map +1 -1
- package/dist/src/Test.js +4 -0
- package/dist/src/Time.d.ts +106 -9
- package/dist/src/Time.d.ts.map +1 -1
- package/dist/src/Time.js +55 -4
- package/dist/src/Type.d.ts +1455 -1310
- package/dist/src/Type.d.ts.map +1 -1
- package/dist/src/Type.js +1274 -517
- package/dist/src/WebSocket.d.ts +164 -13
- package/dist/src/WebSocket.d.ts.map +1 -1
- package/dist/src/WebSocket.js +133 -24
- package/dist/src/Worker.d.ts +90 -8
- package/dist/src/Worker.d.ts.map +1 -1
- package/dist/src/Worker.js +28 -2
- package/dist/src/index.d.ts +6 -7
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +2 -3
- package/dist/src/local-first/Db.d.ts +52 -3
- package/dist/src/local-first/Db.d.ts.map +1 -1
- package/dist/src/local-first/Db.js +412 -137
- package/dist/src/local-first/Evolu.d.ts +336 -211
- package/dist/src/local-first/Evolu.d.ts.map +1 -1
- package/dist/src/local-first/Evolu.js +102 -15
- package/dist/src/local-first/Owner.d.ts +13 -30
- package/dist/src/local-first/Owner.d.ts.map +1 -1
- package/dist/src/local-first/Owner.js +13 -30
- package/dist/src/local-first/Protocol.d.ts +94 -16
- package/dist/src/local-first/Protocol.d.ts.map +1 -1
- package/dist/src/local-first/Protocol.js +118 -38
- package/dist/src/local-first/Query.d.ts +8 -15
- package/dist/src/local-first/Query.d.ts.map +1 -1
- package/dist/src/local-first/Schema.d.ts +335 -21
- package/dist/src/local-first/Schema.d.ts.map +1 -1
- package/dist/src/local-first/Schema.js +214 -17
- package/dist/src/local-first/Shared.d.ts +537 -22
- package/dist/src/local-first/Shared.d.ts.map +1 -1
- package/dist/src/local-first/Shared.js +1437 -234
- package/dist/src/local-first/Storage.d.ts +192 -14
- package/dist/src/local-first/Storage.d.ts.map +1 -1
- package/dist/src/local-first/Storage.js +81 -20
- package/dist/src/local-first/Timestamp.d.ts +392 -41
- package/dist/src/local-first/Timestamp.d.ts.map +1 -1
- package/dist/src/local-first/Timestamp.js +403 -81
- package/dist/src/local-first/index.d.ts +0 -1
- package/dist/src/local-first/index.d.ts.map +1 -1
- package/dist/src/local-first/index.js +0 -1
- package/package.json +1 -1
- package/src/Assert.test.ts +2 -5
- package/src/Config.test.ts +2 -6
- package/src/Config.ts +133 -133
- package/src/Console.ts +62 -7
- package/src/Crypto.ts +76 -4
- package/src/Eq.test.ts +2 -3
- package/src/Error.test.ts +76 -3
- package/src/Error.ts +71 -0
- package/src/Fs.ts +92 -18
- package/src/Identicon.ts +2 -2
- package/src/LeakDetector.ts +22 -3
- package/src/LockManager.ts +8 -0
- package/src/Object.test.ts +27 -12
- package/src/Object.ts +5 -0
- package/src/Platform.ts +50 -8
- package/src/Random.ts +25 -2
- package/src/Resource.test.ts +837 -0
- package/src/Resource.ts +235 -15
- package/src/Schedule.test.ts +50 -12
- package/src/Schedule.ts +24 -14
- package/src/Sqlite.ts +137 -17
- package/src/Task.test.ts +189 -8
- package/src/Task.ts +56 -17
- package/src/Test.ts +9 -0
- package/src/Time.ts +106 -9
- package/src/Type.test.ts +946 -1028
- package/src/Type.ts +4195 -3136
- package/src/Types.test.ts +4 -14
- package/src/WebSocket.ts +313 -40
- package/src/Worker.ts +90 -8
- package/src/index.ts +15 -6
- package/src/local-first/Db.ts +644 -339
- package/src/local-first/Evolu.test.ts +686 -21
- package/src/local-first/Evolu.ts +450 -228
- package/src/local-first/Owner.ts +13 -30
- package/src/local-first/Protocol.test.ts +617 -10
- package/src/local-first/Protocol.ts +196 -72
- package/src/local-first/Query.ts +8 -15
- package/src/local-first/Schema.test.ts +143 -0
- package/src/local-first/Schema.ts +363 -24
- package/src/local-first/Shared.test.ts +7731 -559
- package/src/local-first/Shared.ts +2036 -267
- package/src/local-first/Storage.ts +218 -32
- package/src/local-first/Timestamp.test.ts +344 -70
- package/src/local-first/Timestamp.ts +434 -118
- package/src/local-first/index.ts +0 -1
- package/dist/src/local-first/Error.d.ts +0 -12
- package/dist/src/local-first/Error.d.ts.map +0 -1
- package/dist/src/local-first/Error.js +0 -6
- package/dist/src/local-first/LocalAuth.d.ts +0 -150
- package/dist/src/local-first/LocalAuth.d.ts.map +0 -1
- package/dist/src/local-first/LocalAuth.js +0 -179
- package/src/local-first/Error.ts +0 -17
- package/src/local-first/LocalAuth.ts +0 -457
package/dist/src/Resource.js
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Concurrency-safe helpers for efficient reuse of disposable
|
|
2
|
+
* Concurrency-safe helpers for efficient reuse and replacement of disposable
|
|
3
|
+
* resources.
|
|
4
|
+
*
|
|
5
|
+
* ## Replacement policies
|
|
6
|
+
*
|
|
7
|
+
* Replacing a live resource has two policies.
|
|
8
|
+
*
|
|
9
|
+
* Exclusive replacement disposes the current resource and then creates the
|
|
10
|
+
* next, so at most one exists and there is an observable gap with none.
|
|
11
|
+
* {@link ResettableResource} implements it. Leases do not fit this policy: a
|
|
12
|
+
* reset is requested precisely when holders are stuck on a dead resource, so
|
|
13
|
+
* waiting for them inverts the purpose, and revoking them is safe only when the
|
|
14
|
+
* resource's own API is total after disposal, in which case a lease adds
|
|
15
|
+
* nothing.
|
|
16
|
+
*
|
|
17
|
+
* Overlapping replacement creates the next generation first and disposes the
|
|
18
|
+
* previous one when its last lease is released, so work in progress finishes on
|
|
19
|
+
* the generation it started with. It keeps the old generation when creation
|
|
20
|
+
* fails, at the cost of both existing for a while. It is not implemented. It
|
|
21
|
+
* belongs on {@link SharedResource} as an invalidate operation: mark the current
|
|
22
|
+
* generation stale, stop leasing it, dispose it on its last release, and create
|
|
23
|
+
* the next on the next acquire. Before that can ship,
|
|
24
|
+
* {@link SharedResourceByKey} must stop removing a key when its resource is
|
|
25
|
+
* disposed, and {@link SharedResourceByKeyWithClaims} must stop keeping one
|
|
26
|
+
* resource object per key for the lifetime of its claims.
|
|
3
27
|
*
|
|
4
28
|
* @module
|
|
5
29
|
*/
|
|
@@ -256,6 +280,124 @@ export const createSharedResource = (create, { idleDisposeAfter, onDisposed } =
|
|
|
256
280
|
}, sharedResourceHandle);
|
|
257
281
|
return ok(sharedResource);
|
|
258
282
|
};
|
|
283
|
+
/**
|
|
284
|
+
* Creates {@link ResettableResource}.
|
|
285
|
+
*
|
|
286
|
+
* The first resource is created before this Task returns; if that creation
|
|
287
|
+
* aborts, nothing is left running. If the caller's Fiber aborts during initial
|
|
288
|
+
* creation, this Task waits for creation to settle, disposes any created
|
|
289
|
+
* resource, and returns the abort instead of a resource.
|
|
290
|
+
*
|
|
291
|
+
* The `create` Task must not fail: the previous resource is already disposed
|
|
292
|
+
* when it runs, so a failure would leave nothing to fall back to. Handle
|
|
293
|
+
* recoverable failures inside `create`, or return a resource whose state models
|
|
294
|
+
* them.
|
|
295
|
+
*
|
|
296
|
+
* The resource's own API must model its not-ready state, as a reconnecting
|
|
297
|
+
* connection models "connecting": `get` returns `undefined` during a reset, and
|
|
298
|
+
* callers treat that absence the same way. A resource whose API assumes
|
|
299
|
+
* readiness gains nothing here; every caller would rebuild that state around
|
|
300
|
+
* it.
|
|
301
|
+
*
|
|
302
|
+
* As with {@link createSharedResource}, a returned resource must be live and
|
|
303
|
+
* independently owned, and `create` runs on a Run created from the Run that
|
|
304
|
+
* executes this Task, so dependencies are captured at creation time.
|
|
305
|
+
*
|
|
306
|
+
* Every successful `create` invocation must return a fresh object identity,
|
|
307
|
+
* never one returned earlier. A reset skips when the observed resource is no
|
|
308
|
+
* longer current, and that comparison is by identity; a reused object makes a
|
|
309
|
+
* stale observation match the replacement and reset it again.
|
|
310
|
+
*
|
|
311
|
+
* A reset runs `create` and the resource's disposer while holding a
|
|
312
|
+
* non-reentrant lock. Neither may directly or transitively await another
|
|
313
|
+
* {@link ResettableResource.reset | reset} of this ResettableResource, because
|
|
314
|
+
* that reset waits for the same lock.
|
|
315
|
+
*/
|
|
316
|
+
export const createResettableResource = (create) => async (run) => {
|
|
317
|
+
const env_3 = { stack: [], error: void 0, hasError: false };
|
|
318
|
+
try {
|
|
319
|
+
const { leakDetector } = run.deps;
|
|
320
|
+
let current;
|
|
321
|
+
const disposer = __addDisposableResource(env_3, new AsyncDisposableStack(), true);
|
|
322
|
+
const resettableResourceRun = disposer.use(run.create());
|
|
323
|
+
const mutex = createMutex();
|
|
324
|
+
const resettableResourceHandle = {};
|
|
325
|
+
const resetFrom = (observed) => mutex.withLock(async (run) => {
|
|
326
|
+
// A resource other than the observed one is current. An aborted
|
|
327
|
+
// creation leaves no current resource, so a queued request still runs.
|
|
328
|
+
if (current !== undefined && current !== observed) {
|
|
329
|
+
return ok();
|
|
330
|
+
}
|
|
331
|
+
const previous = current;
|
|
332
|
+
await disposeCurrent();
|
|
333
|
+
const next = await run.ok(create);
|
|
334
|
+
assert(next !== previous, "ResettableResource create must return a fresh object identity.");
|
|
335
|
+
// A resource returned after disposal started is disposed here, so
|
|
336
|
+
// `get` never exposes it while owner finalization runs.
|
|
337
|
+
if (run.signal.aborted) {
|
|
338
|
+
const env_4 = { stack: [], error: void 0, hasError: false };
|
|
339
|
+
try {
|
|
340
|
+
const _next = __addDisposableResource(env_4, next, true);
|
|
341
|
+
}
|
|
342
|
+
catch (e_4) {
|
|
343
|
+
env_4.error = e_4;
|
|
344
|
+
env_4.hasError = true;
|
|
345
|
+
}
|
|
346
|
+
finally {
|
|
347
|
+
const result_3 = __disposeResources(env_4);
|
|
348
|
+
if (result_3)
|
|
349
|
+
await result_3;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
run.signal.throwIfAborted();
|
|
353
|
+
current = next;
|
|
354
|
+
return ok();
|
|
355
|
+
});
|
|
356
|
+
const disposeCurrent = async () => {
|
|
357
|
+
const env_5 = { stack: [], error: void 0, hasError: false };
|
|
358
|
+
try {
|
|
359
|
+
const _resource = __addDisposableResource(env_5, current, true);
|
|
360
|
+
current = undefined;
|
|
361
|
+
}
|
|
362
|
+
catch (e_5) {
|
|
363
|
+
env_5.error = e_5;
|
|
364
|
+
env_5.hasError = true;
|
|
365
|
+
}
|
|
366
|
+
finally {
|
|
367
|
+
const result_4 = __disposeResources(env_5);
|
|
368
|
+
if (result_4)
|
|
369
|
+
await result_4;
|
|
370
|
+
}
|
|
371
|
+
};
|
|
372
|
+
resettableResourceRun.defer(() => {
|
|
373
|
+
leakDetector.untrack(resettableResourceHandle);
|
|
374
|
+
});
|
|
375
|
+
resettableResourceRun.defer(disposeCurrent);
|
|
376
|
+
await resettableResourceRun.ok(resetFrom(undefined));
|
|
377
|
+
// The caller can abort independently of the resource-owned Run.
|
|
378
|
+
run.signal.throwIfAborted();
|
|
379
|
+
const resettableResource = {
|
|
380
|
+
get: () => current,
|
|
381
|
+
reset: (observed) => () => resettableResourceRun(resetFrom(observed)),
|
|
382
|
+
[Symbol.asyncDispose]: () => resettableResourceRun[Symbol.asyncDispose](),
|
|
383
|
+
};
|
|
384
|
+
leakDetector.track(resettableResource, {
|
|
385
|
+
name: "ResettableResource",
|
|
386
|
+
isLeaked: () => resettableResourceRun.getState().type === "Running",
|
|
387
|
+
}, resettableResourceHandle);
|
|
388
|
+
disposer.move();
|
|
389
|
+
return ok(resettableResource);
|
|
390
|
+
}
|
|
391
|
+
catch (e_3) {
|
|
392
|
+
env_3.error = e_3;
|
|
393
|
+
env_3.hasError = true;
|
|
394
|
+
}
|
|
395
|
+
finally {
|
|
396
|
+
const result_2 = __disposeResources(env_3);
|
|
397
|
+
if (result_2)
|
|
398
|
+
await result_2;
|
|
399
|
+
}
|
|
400
|
+
};
|
|
259
401
|
export function createSharedResourceByKey(create, { idleDisposeAfter, lookup = identity, onDisposed, } = {}) {
|
|
260
402
|
return (run) => {
|
|
261
403
|
const sharedResourceByKeyRun = run.create();
|
|
@@ -287,21 +429,21 @@ export function createSharedResourceByKey(create, { idleDisposeAfter, lookup = i
|
|
|
287
429
|
// SharedResource disposals are aborted and awaited before the registered
|
|
288
430
|
// SharedResources are disposed.
|
|
289
431
|
disposer.defer(async () => {
|
|
290
|
-
const
|
|
432
|
+
const env_6 = { stack: [], error: void 0, hasError: false };
|
|
291
433
|
try {
|
|
292
|
-
const keyDisposer = __addDisposableResource(
|
|
434
|
+
const keyDisposer = __addDisposableResource(env_6, new AsyncDisposableStack(), true);
|
|
293
435
|
for (const sharedResource of sharedResourcesByKey.values())
|
|
294
436
|
keyDisposer.use(sharedResource);
|
|
295
437
|
sharedResourcesByKey.clear();
|
|
296
438
|
}
|
|
297
|
-
catch (
|
|
298
|
-
|
|
299
|
-
|
|
439
|
+
catch (e_6) {
|
|
440
|
+
env_6.error = e_6;
|
|
441
|
+
env_6.hasError = true;
|
|
300
442
|
}
|
|
301
443
|
finally {
|
|
302
|
-
const
|
|
303
|
-
if (
|
|
304
|
-
await
|
|
444
|
+
const result_5 = __disposeResources(env_6);
|
|
445
|
+
if (result_5)
|
|
446
|
+
await result_5;
|
|
305
447
|
}
|
|
306
448
|
});
|
|
307
449
|
disposer.use(sharedResourceByKeyRun);
|
|
@@ -346,23 +488,23 @@ export function createSharedResourceByKey(create, { idleDisposeAfter, lookup = i
|
|
|
346
488
|
return ok(lease);
|
|
347
489
|
})),
|
|
348
490
|
use: (key, callback) => async (run) => {
|
|
349
|
-
const
|
|
491
|
+
const env_7 = { stack: [], error: void 0, hasError: false };
|
|
350
492
|
try {
|
|
351
|
-
const lease = __addDisposableResource(
|
|
493
|
+
const lease = __addDisposableResource(env_7, await run.ok(sharedResourceByKey.acquire(key)), false);
|
|
352
494
|
return await run(callback(lease.resource, lease.created));
|
|
353
495
|
}
|
|
354
|
-
catch (
|
|
355
|
-
|
|
356
|
-
|
|
496
|
+
catch (e_7) {
|
|
497
|
+
env_7.error = e_7;
|
|
498
|
+
env_7.hasError = true;
|
|
357
499
|
}
|
|
358
500
|
finally {
|
|
359
|
-
__disposeResources(
|
|
501
|
+
__disposeResources(env_7);
|
|
360
502
|
}
|
|
361
503
|
},
|
|
362
504
|
forEachCurrent: (callback) => async (run) => {
|
|
363
|
-
const
|
|
505
|
+
const env_8 = { stack: [], error: void 0, hasError: false };
|
|
364
506
|
try {
|
|
365
|
-
const leaseDisposer = __addDisposableResource(
|
|
507
|
+
const leaseDisposer = __addDisposableResource(env_8, new DisposableStack(), false);
|
|
366
508
|
const leasesByKey = [];
|
|
367
509
|
// oxlint-disable-next-line unicorn/no-useless-spread -- Snapshot keys because each acquisition awaits and can mutate the registry.
|
|
368
510
|
for (const [key] of [...sharedResourcesByKey]) {
|
|
@@ -375,12 +517,12 @@ export function createSharedResourceByKey(create, { idleDisposeAfter, lookup = i
|
|
|
375
517
|
callback(lease.resource, key);
|
|
376
518
|
return ok();
|
|
377
519
|
}
|
|
378
|
-
catch (
|
|
379
|
-
|
|
380
|
-
|
|
520
|
+
catch (e_8) {
|
|
521
|
+
env_8.error = e_8;
|
|
522
|
+
env_8.hasError = true;
|
|
381
523
|
}
|
|
382
524
|
finally {
|
|
383
|
-
__disposeResources(
|
|
525
|
+
__disposeResources(env_8);
|
|
384
526
|
}
|
|
385
527
|
},
|
|
386
528
|
snapshot: () => {
|
|
@@ -423,7 +565,7 @@ export function createSharedResourceByKey(create, { idleDisposeAfter, lookup = i
|
|
|
423
565
|
* happen later when `idleDisposeAfter` is configured.
|
|
424
566
|
*/
|
|
425
567
|
export const createSharedResourceByKeyWithClaims = (create, { idleDisposeAfter, resourceLookup = identity, claimLookup = identity, onFirstClaimAdded, onLastClaimRemoved, } = {}) => async (run) => {
|
|
426
|
-
const
|
|
568
|
+
const env_9 = { stack: [], error: void 0, hasError: false };
|
|
427
569
|
try {
|
|
428
570
|
const sharedResourceByKeyWithClaimsRun = run.create();
|
|
429
571
|
const { leakDetector } = run.deps;
|
|
@@ -446,7 +588,7 @@ export const createSharedResourceByKeyWithClaims = (create, { idleDisposeAfter,
|
|
|
446
588
|
sharedResourceByKeyWithClaimsRun.panic(defect);
|
|
447
589
|
}
|
|
448
590
|
};
|
|
449
|
-
const disposer = __addDisposableResource(
|
|
591
|
+
const disposer = __addDisposableResource(env_9, new AsyncDisposableStack(), true);
|
|
450
592
|
// Explicit disposal stops claim operations and runs their finalizers before
|
|
451
593
|
// disposing the keyed registry. The nested stack is empty if keyed-registry
|
|
452
594
|
// creation fails. Both internal Runs attach to the root, whose disposal
|
|
@@ -454,12 +596,12 @@ export const createSharedResourceByKeyWithClaims = (create, { idleDisposeAfter,
|
|
|
454
596
|
const sharedResourceByKeyDisposer = disposer.use(new AsyncDisposableStack());
|
|
455
597
|
disposer.use(sharedResourceByKeyWithClaimsRun);
|
|
456
598
|
const releaseClaimLease = (heldClaimLease, notifyTransition = true) => {
|
|
457
|
-
const
|
|
599
|
+
const env_10 = { stack: [], error: void 0, hasError: false };
|
|
458
600
|
try {
|
|
459
601
|
if (!heldClaimLeases.delete(heldClaimLease))
|
|
460
602
|
return false;
|
|
461
603
|
leakDetector.untrack(heldClaimLease);
|
|
462
|
-
const _resourceLeases = __addDisposableResource(
|
|
604
|
+
const _resourceLeases = __addDisposableResource(env_10, heldClaimLease.resourceLeases, false);
|
|
463
605
|
for (const resourceKey of heldClaimLease.resourceKeys) {
|
|
464
606
|
const decremented = claimResourceRelation.decrement(heldClaimLease.claim, resourceKey);
|
|
465
607
|
if (decremented.count > 0)
|
|
@@ -477,18 +619,18 @@ export const createSharedResourceByKeyWithClaims = (create, { idleDisposeAfter,
|
|
|
477
619
|
}
|
|
478
620
|
return true;
|
|
479
621
|
}
|
|
480
|
-
catch (
|
|
481
|
-
|
|
482
|
-
|
|
622
|
+
catch (e_10) {
|
|
623
|
+
env_10.error = e_10;
|
|
624
|
+
env_10.hasError = true;
|
|
483
625
|
}
|
|
484
626
|
finally {
|
|
485
|
-
__disposeResources(
|
|
627
|
+
__disposeResources(env_10);
|
|
486
628
|
}
|
|
487
629
|
};
|
|
488
630
|
const drainClaimLeases = () => {
|
|
489
|
-
const
|
|
631
|
+
const env_11 = { stack: [], error: void 0, hasError: false };
|
|
490
632
|
try {
|
|
491
|
-
const disposer = __addDisposableResource(
|
|
633
|
+
const disposer = __addDisposableResource(env_11, new DisposableStack(), false);
|
|
492
634
|
disposer.defer(() => {
|
|
493
635
|
claimResourceRelation.clear();
|
|
494
636
|
resourcesByKey.clear();
|
|
@@ -499,12 +641,12 @@ export const createSharedResourceByKeyWithClaims = (create, { idleDisposeAfter,
|
|
|
499
641
|
});
|
|
500
642
|
}
|
|
501
643
|
}
|
|
502
|
-
catch (
|
|
503
|
-
|
|
504
|
-
|
|
644
|
+
catch (e_11) {
|
|
645
|
+
env_11.error = e_11;
|
|
646
|
+
env_11.hasError = true;
|
|
505
647
|
}
|
|
506
648
|
finally {
|
|
507
|
-
__disposeResources(
|
|
649
|
+
__disposeResources(env_11);
|
|
508
650
|
}
|
|
509
651
|
};
|
|
510
652
|
sharedResourceByKeyWithClaimsRun.defer(() => {
|
|
@@ -523,13 +665,13 @@ export const createSharedResourceByKeyWithClaims = (create, { idleDisposeAfter,
|
|
|
523
665
|
...resourceKeys.slice(1),
|
|
524
666
|
];
|
|
525
667
|
return sharedResourceByKeyWithClaimsRun(async (run) => {
|
|
526
|
-
const
|
|
668
|
+
const env_12 = { stack: [], error: void 0, hasError: false };
|
|
527
669
|
try {
|
|
528
670
|
assert(createLookupSet({
|
|
529
671
|
lookup: resourceLookup,
|
|
530
672
|
values: resourceKeysSnapshot,
|
|
531
673
|
}).size === resourceKeysSnapshot.length, "resourceKeys must not contain lookup duplicates.");
|
|
532
|
-
const resourceLeases = __addDisposableResource(
|
|
674
|
+
const resourceLeases = __addDisposableResource(env_12, new DisposableStack(), false);
|
|
533
675
|
const [firstResourceKey, ...remainingResourceKeys] = resourceKeysSnapshot;
|
|
534
676
|
// acquire releases a transferred lease before surfacing owner abort,
|
|
535
677
|
// so a throwing await cannot leave ownership uncollected.
|
|
@@ -572,10 +714,10 @@ export const createSharedResourceByKeyWithClaims = (create, { idleDisposeAfter,
|
|
|
572
714
|
isLeaked: () => heldClaimLeases.has(heldClaimLease),
|
|
573
715
|
}, heldClaimLease);
|
|
574
716
|
try {
|
|
575
|
-
const
|
|
717
|
+
const env_13 = { stack: [], error: void 0, hasError: false };
|
|
576
718
|
try {
|
|
577
719
|
let succeeded = false;
|
|
578
|
-
const compensations = __addDisposableResource(
|
|
720
|
+
const compensations = __addDisposableResource(env_13, new DisposableStack(), false);
|
|
579
721
|
for (const [claim, resource, resourceKey,] of firstClaimTransitions) {
|
|
580
722
|
onFirstClaimAdded?.(claim, resource, resourceKey);
|
|
581
723
|
// oxlint-disable-next-line eslint/no-loop-func -- Captures this iteration's block-scoped transition values for rollback.
|
|
@@ -587,12 +729,12 @@ export const createSharedResourceByKeyWithClaims = (create, { idleDisposeAfter,
|
|
|
587
729
|
}
|
|
588
730
|
succeeded = true;
|
|
589
731
|
}
|
|
590
|
-
catch (
|
|
591
|
-
|
|
592
|
-
|
|
732
|
+
catch (e_12) {
|
|
733
|
+
env_13.error = e_12;
|
|
734
|
+
env_13.hasError = true;
|
|
593
735
|
}
|
|
594
736
|
finally {
|
|
595
|
-
__disposeResources(
|
|
737
|
+
__disposeResources(env_13);
|
|
596
738
|
}
|
|
597
739
|
}
|
|
598
740
|
catch (defect) {
|
|
@@ -601,33 +743,33 @@ export const createSharedResourceByKeyWithClaims = (create, { idleDisposeAfter,
|
|
|
601
743
|
}
|
|
602
744
|
return ok(project(claimLease, resources));
|
|
603
745
|
}
|
|
604
|
-
catch (
|
|
605
|
-
|
|
606
|
-
|
|
746
|
+
catch (e_13) {
|
|
747
|
+
env_12.error = e_13;
|
|
748
|
+
env_12.hasError = true;
|
|
607
749
|
}
|
|
608
750
|
finally {
|
|
609
|
-
__disposeResources(
|
|
751
|
+
__disposeResources(env_12);
|
|
610
752
|
}
|
|
611
753
|
});
|
|
612
754
|
};
|
|
613
755
|
const sharedResourceByKeyWithClaims = {
|
|
614
756
|
claim: (claim, resourceKeys) => acquireClaim(claim, resourceKeys, (claimLease) => claimLease),
|
|
615
757
|
use: (claim, resourceKeys, callback) => async (run) => {
|
|
616
|
-
const
|
|
758
|
+
const env_14 = { stack: [], error: void 0, hasError: false };
|
|
617
759
|
try {
|
|
618
760
|
const acquired = await run.ok(acquireClaim(claim, resourceKeys, (claimLease, resources) => ({
|
|
619
761
|
claimLease,
|
|
620
762
|
resources,
|
|
621
763
|
})));
|
|
622
|
-
const _claimLease = __addDisposableResource(
|
|
764
|
+
const _claimLease = __addDisposableResource(env_14, acquired.claimLease, false);
|
|
623
765
|
return await run(callback(acquired.resources));
|
|
624
766
|
}
|
|
625
|
-
catch (
|
|
626
|
-
|
|
627
|
-
|
|
767
|
+
catch (e_14) {
|
|
768
|
+
env_14.error = e_14;
|
|
769
|
+
env_14.hasError = true;
|
|
628
770
|
}
|
|
629
771
|
finally {
|
|
630
|
-
__disposeResources(
|
|
772
|
+
__disposeResources(env_14);
|
|
631
773
|
}
|
|
632
774
|
},
|
|
633
775
|
getClaimsForResource: (resourceKey) => new Set(claimResourceRelation.getAs(resourceKey)),
|
|
@@ -668,26 +810,13 @@ export const createSharedResourceByKeyWithClaims = (create, { idleDisposeAfter,
|
|
|
668
810
|
}, sharedResourceByKeyWithClaimsHandle);
|
|
669
811
|
return ok(sharedResourceByKeyWithClaims);
|
|
670
812
|
}
|
|
671
|
-
catch (
|
|
672
|
-
|
|
673
|
-
|
|
813
|
+
catch (e_9) {
|
|
814
|
+
env_9.error = e_9;
|
|
815
|
+
env_9.hasError = true;
|
|
674
816
|
}
|
|
675
817
|
finally {
|
|
676
|
-
const
|
|
677
|
-
if (
|
|
678
|
-
await
|
|
818
|
+
const result_6 = __disposeResources(env_9);
|
|
819
|
+
if (result_6)
|
|
820
|
+
await result_6;
|
|
679
821
|
}
|
|
680
822
|
};
|
|
681
|
-
// TODO: Add a lease-based reloadable resource when a concrete use case needs
|
|
682
|
-
// resource swapping. A ResourceRef-style get/set API is unsafe because set can
|
|
683
|
-
// dispose a resource still held by a caller of get. Model resource generations
|
|
684
|
-
// explicitly and distinguish two replacement policies, probably as separate
|
|
685
|
-
// APIs rather than a boolean option:
|
|
686
|
-
// - Overlapping: create and validate the replacement, publish it to new leases,
|
|
687
|
-
// then dispose the old generation after its existing leases drain. This
|
|
688
|
-
// supports zero-downtime reload and keeps the old generation when creation
|
|
689
|
-
// fails, but both generations temporarily exist.
|
|
690
|
-
// - Exclusive: stop or queue new leases, drain and dispose the old generation,
|
|
691
|
-
// then create and publish the replacement. This guarantees at most one live
|
|
692
|
-
// resource, but introduces downtime and leaves no valid resource when creation
|
|
693
|
-
// fails unless the owner retries or recreates the old configuration.
|
package/dist/src/Schedule.d.ts
CHANGED
|
@@ -28,6 +28,15 @@ import type { Predicate } from "./Types.ts";
|
|
|
28
28
|
* time origin on the first step call, not when `schedule(deps)` creates the
|
|
29
29
|
* step.
|
|
30
30
|
*
|
|
31
|
+
* They measure elapsed time on `Time.performance`, so a system clock adjustment
|
|
32
|
+
* cannot distort it. On platforms where that clock stops while the device
|
|
33
|
+
* sleeps, a suspended interval measures as little or no elapsed time, so a
|
|
34
|
+
* schedule does not see the gap the wall clock saw. A time box outlives the
|
|
35
|
+
* wall-clock deadline it was given, as {@link during} and {@link maxElapsed} do.
|
|
36
|
+
* {@link resetScheduleAfter} does not treat the sleep as inactivity, and
|
|
37
|
+
* {@link compensate}, {@link fixed} and {@link windowed} do not treat it as time
|
|
38
|
+
* to catch up on.
|
|
39
|
+
*
|
|
31
40
|
* ### Composing a retry policy
|
|
32
41
|
*
|
|
33
42
|
* ```ts
|
|
@@ -66,18 +75,10 @@ import type { Predicate } from "./Types.ts";
|
|
|
66
75
|
* Or use a preset:
|
|
67
76
|
*
|
|
68
77
|
* ```ts
|
|
69
|
-
* import {
|
|
70
|
-
* assertTrue,
|
|
71
|
-
* ok,
|
|
72
|
-
* retry,
|
|
73
|
-
* retryStrategyAws,
|
|
74
|
-
* type Task,
|
|
75
|
-
* } from "@evolu/common";
|
|
78
|
+
* import { ok, retry, retryStrategyAws, type Task } from "@evolu/common";
|
|
76
79
|
*
|
|
77
80
|
* const fetchData: Task<string> = () => ok("data");
|
|
78
|
-
* const
|
|
79
|
-
*
|
|
80
|
-
* assertTrue(typeof fetchWithRetry === "function");
|
|
81
|
+
* const _fetchWithRetry = retry(fetchData, retryStrategyAws);
|
|
81
82
|
* ```
|
|
82
83
|
*/
|
|
83
84
|
export type Schedule<out Output, in Input = unknown> = (deps: ScheduleDeps) => (input: Input) => NextResult<readonly [Output, Millis]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Schedule.d.ts","sourceRoot":"","sources":["../../src/Schedule.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAIL,KAAK,yBAAyB,EAG9B,KAAK,UAAU,EAEhB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAa,KAAK,UAAU,EAAM,MAAM,aAAa,CAAC;AAE7D,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,eAAe,EAEpB,MAAM,
|
|
1
|
+
{"version":3,"file":"Schedule.d.ts","sourceRoot":"","sources":["../../src/Schedule.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAIL,KAAK,yBAAyB,EAG9B,KAAK,UAAU,EAEhB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAa,KAAK,UAAU,EAAM,MAAM,aAAa,CAAC;AAE7D,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,eAAe,EAEpB,MAAM,EAGN,cAAc,EAEd,KAAK,OAAO,EACb,MAAM,WAAW,CAAC;AACnB,OAAO,EAKL,WAAW,EAEZ,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuEG;AACH,MAAM,MAAM,QAAQ,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,KAAK,GAAG,OAAO,IAAI,CACrD,IAAI,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,EAAE,KAAK,KAAK,IAAI,MAChC,MAAM,YAAY,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,KAAG,QAAQ,CAAC,MAAM,EAAE,KAAK,CAOlE,CAAC;AAEJ;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,gBAAgB,EAAE,QAAQ,CAAC,MAAM,CAI7C,CAAC"}
|
package/dist/src/Schedule.js
CHANGED
|
@@ -297,7 +297,7 @@ const createScheduleStepMetrics = (deps) => {
|
|
|
297
297
|
let start = null;
|
|
298
298
|
let previous = null;
|
|
299
299
|
return () => {
|
|
300
|
-
const now = deps.time.now();
|
|
300
|
+
const now = deps.time.performance.now();
|
|
301
301
|
start ??= now;
|
|
302
302
|
const elapsed = saturateComputedMillis(now - start);
|
|
303
303
|
const elapsedSincePrevious = previous === null ? minMillis : saturateComputedMillis(now - previous);
|