@serfab/cadre-core 1.19.1 → 1.21.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/cadre-node.d.ts +53 -14
- package/dist/cadre-node.js +97 -30
- package/dist/cadre-node.js.map +1 -1
- package/dist/control-database.d.ts +2 -1
- package/dist/control-database.js +146 -135
- package/dist/control-database.js.map +1 -1
- package/dist/control-protocol-guard.js +3 -2
- package/dist/control-protocol-guard.js.map +1 -1
- package/dist/control-stream.js +2 -1
- package/dist/control-stream.js.map +1 -1
- package/dist/describe-thrown.d.ts +12 -0
- package/dist/describe-thrown.js +59 -0
- package/dist/describe-thrown.js.map +1 -0
- package/dist/edge-node/dissolve.d.ts +1 -1
- package/dist/edge-node/dissolve.js +1 -1
- package/dist/edge-node/dissolve.js.map +1 -1
- package/dist/edge-node/edge-join.js +2 -1
- package/dist/edge-node/edge-join.js.map +1 -1
- package/dist/edge-node/edge-node.js +2 -1
- package/dist/edge-node/edge-node.js.map +1 -1
- package/dist/edge-node/strand-move.d.ts +0 -2
- package/dist/edge-node/strand-move.js +1 -4
- package/dist/edge-node/strand-move.js.map +1 -1
- package/dist/edge-node/strands.js +2 -1
- package/dist/edge-node/strands.js.map +1 -1
- package/dist/enrollment.js +2 -1
- package/dist/enrollment.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/member-redemption.js +3 -9
- package/dist/member-redemption.js.map +1 -1
- package/dist/node-local-snapshot.js +2 -1
- package/dist/node-local-snapshot.js.map +1 -1
- package/dist/peer-dial.js +3 -2
- package/dist/peer-dial.js.map +1 -1
- package/dist/pending-join-runner.d.ts +29 -2
- package/dist/pending-join-runner.js +60 -20
- package/dist/pending-join-runner.js.map +1 -1
- package/dist/push-notifier-apns.js +8 -7
- package/dist/push-notifier-apns.js.map +1 -1
- package/dist/push-notifier-fcm.js +6 -5
- package/dist/push-notifier-fcm.js.map +1 -1
- package/dist/push-notifier-shared.d.ts +0 -2
- package/dist/push-notifier-shared.js +4 -4
- package/dist/push-notifier-shared.js.map +1 -1
- package/dist/relay-reservation.js +24 -4
- package/dist/relay-reservation.js.map +1 -1
- package/dist/strand-addr-protocol.js +2 -1
- package/dist/strand-addr-protocol.js.map +1 -1
- package/dist/strand-app-schema-report.d.ts +56 -0
- package/dist/strand-app-schema-report.js +83 -0
- package/dist/strand-app-schema-report.js.map +1 -0
- package/dist/strand-database.d.ts +9 -5
- package/dist/strand-database.js +12 -6
- package/dist/strand-database.js.map +1 -1
- package/dist/strand-first-sync-gate.js +4 -3
- package/dist/strand-first-sync-gate.js.map +1 -1
- package/dist/strand-formation-protocol.js +4 -3
- package/dist/strand-formation-protocol.js.map +1 -1
- package/dist/strand-instance-manager.d.ts +8 -2
- package/dist/strand-instance-manager.js +8 -6
- package/dist/strand-instance-manager.js.map +1 -1
- package/dist/strand-membership-reconciler.js +9 -11
- package/dist/strand-membership-reconciler.js.map +1 -1
- package/dist/strand-move.js +4 -6
- package/dist/strand-move.js.map +1 -1
- package/dist/strand-offline.d.ts +10 -39
- package/dist/strand-offline.js +9 -54
- package/dist/strand-offline.js.map +1 -1
- package/dist/types.d.ts +8 -5
- package/dist/types.js.map +1 -1
- package/package.json +8 -8
- package/src/cadre-node.ts +11528 -11456
- package/src/control-database.ts +5603 -5592
- package/src/control-protocol-guard.ts +3 -2
- package/src/control-stream.ts +2 -1
- package/src/describe-thrown.ts +60 -0
- package/src/edge-node/dissolve.ts +2 -1
- package/src/edge-node/edge-join.ts +1 -1
- package/src/edge-node/edge-node.ts +2 -1
- package/src/edge-node/strand-move.ts +1 -5
- package/src/edge-node/strands.ts +74 -73
- package/src/enrollment.ts +2 -1
- package/src/index.ts +924 -917
- package/src/member-redemption.ts +3 -9
- package/src/node-local-snapshot.ts +2 -1
- package/src/peer-dial.ts +605 -604
- package/src/pending-join-runner.ts +68 -22
- package/src/push-notifier-apns.ts +8 -7
- package/src/push-notifier-fcm.ts +6 -5
- package/src/push-notifier-shared.ts +5 -5
- package/src/relay-reservation.ts +1239 -1211
- package/src/strand-addr-protocol.ts +2 -1
- package/src/strand-app-schema-report.ts +122 -0
- package/src/strand-database.ts +474 -466
- package/src/strand-first-sync-gate.ts +600 -599
- package/src/strand-formation-protocol.ts +4 -3
- package/src/strand-instance-manager.ts +2219 -2210
- package/src/strand-membership-reconciler.ts +942 -945
- package/src/strand-move.ts +594 -597
- package/src/strand-offline.ts +11 -80
- package/src/types.ts +2963 -2960
package/src/member-redemption.ts
CHANGED
|
@@ -31,6 +31,7 @@ import { requireEd25519PublicKeyB64 } from './ed25519-key.js';
|
|
|
31
31
|
import { dialAddr, nextMacrotask, trailingPeerId } from './peer-dial.js';
|
|
32
32
|
import { chainMessages } from './control-retry.js';
|
|
33
33
|
import { isRetriableControlWriteFailure } from './control-write-retry.js';
|
|
34
|
+
import { toError } from './describe-thrown.js';
|
|
34
35
|
import type { CadreJoinProgress } from './types.js';
|
|
35
36
|
|
|
36
37
|
const log = debug('sereus:cadre:member-redemption');
|
|
@@ -424,13 +425,6 @@ function isRefusal<Accepted>(reply: Accepted | RedemptionRefusalFrame): reply is
|
|
|
424
425
|
return (reply as { accepted?: unknown }).accepted === false;
|
|
425
426
|
}
|
|
426
427
|
|
|
427
|
-
function asError(error: unknown): Error {
|
|
428
|
-
if (error instanceof Error) return error;
|
|
429
|
-
// A WebSocket transport rejects a refused dial with an `ErrorEvent`, whose text is its `message`.
|
|
430
|
-
const message = (error as { message?: unknown } | null)?.message;
|
|
431
|
-
return new Error(typeof message === 'string' && message.length > 0 ? message : String(error), { cause: error });
|
|
432
|
-
}
|
|
433
|
-
|
|
434
428
|
/**
|
|
435
429
|
* Run `op` with a signal that aborts when either `deadline` or the caller's `signal` does.
|
|
436
430
|
* Relayed by hand rather than with `AbortSignal.any`, which the phone runtimes lack.
|
|
@@ -491,8 +485,8 @@ async function dialOnce<Accepted>(node: Libp2p, options: MemberRedemptionOptions
|
|
|
491
485
|
} catch (error) {
|
|
492
486
|
// The caller's abort cut this attempt short; its reason, not the cut, is the answer.
|
|
493
487
|
options.signal?.throwIfAborted();
|
|
494
|
-
log('%s redemption via %s failed before an answer (%s); trying the next address', options.label, addr,
|
|
495
|
-
outcomes.push({ addr, error:
|
|
488
|
+
log('%s redemption via %s failed before an answer (%s); trying the next address', options.label, addr, toError(error).message);
|
|
489
|
+
outcomes.push({ addr, error: toError(error) });
|
|
496
490
|
continue;
|
|
497
491
|
}
|
|
498
492
|
if (isRefusal(reply)) {
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
* (`file-durable-slot.ts`) is what stays behind the `*-store-file` subpaths.
|
|
30
30
|
*/
|
|
31
31
|
import debug from 'debug';
|
|
32
|
+
import { describeThrown } from './describe-thrown.js';
|
|
32
33
|
|
|
33
34
|
const log = debug('sereus:cadre:node-local-snapshot');
|
|
34
35
|
|
|
@@ -231,7 +232,7 @@ async function loadEntries<E>(
|
|
|
231
232
|
// slot is what knows the platform detail worth acting on (which file, which
|
|
232
233
|
// database).
|
|
233
234
|
throw new Error(
|
|
234
|
-
`failed to read the ${spec.label} for party ${partyId}: ${
|
|
235
|
+
`failed to read the ${spec.label} for party ${partyId}: ${describeThrown(error)}`,
|
|
235
236
|
{ cause: error }
|
|
236
237
|
);
|
|
237
238
|
}
|