@earendil-works/chord 1.3.0 → 1.5.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/CHANGELOG.md +54 -0
- package/README.md +129 -10
- package/dist/cell.d.ts +7 -7
- package/dist/cell.d.ts.map +1 -1
- package/dist/cell.js.map +1 -1
- package/dist/context/index.d.ts +8 -0
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +15 -0
- package/dist/context/index.js.map +1 -1
- package/dist/contract.d.ts +51 -52
- package/dist/contract.d.ts.map +1 -1
- package/dist/contract.js +19 -24
- package/dist/contract.js.map +1 -1
- package/dist/delta/apply-immutable-trusted.js +3 -4
- package/dist/delta/apply-immutable-trusted.js.map +1 -1
- package/dist/delta/diff.d.ts.map +1 -1
- package/dist/delta/diff.js +5 -3
- package/dist/delta/diff.js.map +1 -1
- package/dist/delta/index.d.ts +9 -1
- package/dist/delta/index.d.ts.map +1 -1
- package/dist/delta/index.js +15 -11
- package/dist/delta/index.js.map +1 -1
- package/dist/delta/pending.d.ts +36 -0
- package/dist/delta/pending.d.ts.map +1 -0
- package/dist/delta/pending.js +143 -0
- package/dist/delta/pending.js.map +1 -0
- package/dist/delta/tracker.d.ts +12 -0
- package/dist/delta/tracker.d.ts.map +1 -1
- package/dist/delta/tracker.js +109 -39
- package/dist/delta/tracker.js.map +1 -1
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +9 -7
- package/dist/host.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/next/contracts/accepts.d.ts +81 -0
- package/dist/next/contracts/accepts.d.ts.map +1 -0
- package/dist/next/contracts/accepts.js +123 -0
- package/dist/next/contracts/accepts.js.map +1 -0
- package/dist/next/contracts/contract.d.ts +121 -0
- package/dist/next/contracts/contract.d.ts.map +1 -0
- package/dist/next/contracts/contract.js +50 -0
- package/dist/next/contracts/contract.js.map +1 -0
- package/dist/next/contracts/declare.d.ts +107 -0
- package/dist/next/contracts/declare.d.ts.map +1 -0
- package/dist/next/contracts/declare.js +136 -0
- package/dist/next/contracts/declare.js.map +1 -0
- package/dist/next/contracts/evolve.d.ts +92 -0
- package/dist/next/contracts/evolve.d.ts.map +1 -0
- package/dist/next/contracts/evolve.js +179 -0
- package/dist/next/contracts/evolve.js.map +1 -0
- package/dist/next/contracts/fingerprint.d.ts +16 -0
- package/dist/next/contracts/fingerprint.d.ts.map +1 -0
- package/dist/next/contracts/fingerprint.js +50 -0
- package/dist/next/contracts/fingerprint.js.map +1 -0
- package/dist/next/contracts/history.d.ts +71 -0
- package/dist/next/contracts/history.d.ts.map +1 -0
- package/dist/next/contracts/history.js +3 -0
- package/dist/next/contracts/history.js.map +1 -0
- package/dist/next/contracts/host-kind.d.ts +40 -0
- package/dist/next/contracts/host-kind.d.ts.map +1 -0
- package/dist/next/contracts/host-kind.js +37 -0
- package/dist/next/contracts/host-kind.js.map +1 -0
- package/dist/next/contracts/index.d.ts +7 -0
- package/dist/next/contracts/index.d.ts.map +1 -0
- package/dist/next/contracts/index.js +6 -0
- package/dist/next/contracts/index.js.map +1 -0
- package/dist/next/contracts/internal.d.ts +10 -0
- package/dist/next/contracts/internal.d.ts.map +1 -0
- package/dist/next/contracts/internal.js +9 -0
- package/dist/next/contracts/internal.js.map +1 -0
- package/dist/next/contracts/names.d.ts +3 -0
- package/dist/next/contracts/names.d.ts.map +1 -0
- package/dist/next/contracts/names.js +13 -0
- package/dist/next/contracts/names.js.map +1 -0
- package/dist/next/contracts/params.d.ts +28 -0
- package/dist/next/contracts/params.d.ts.map +1 -0
- package/dist/next/contracts/params.js +50 -0
- package/dist/next/contracts/params.js.map +1 -0
- package/dist/next/contracts/schema.d.ts +102 -0
- package/dist/next/contracts/schema.d.ts.map +1 -0
- package/dist/next/contracts/schema.js +103 -0
- package/dist/next/contracts/schema.js.map +1 -0
- package/dist/next/contracts/snapshot.d.ts +16 -0
- package/dist/next/contracts/snapshot.d.ts.map +1 -0
- package/dist/next/contracts/snapshot.js +167 -0
- package/dist/next/contracts/snapshot.js.map +1 -0
- package/dist/next/data/args.d.ts +50 -0
- package/dist/next/data/args.d.ts.map +1 -0
- package/dist/next/data/args.js +83 -0
- package/dist/next/data/args.js.map +1 -0
- package/dist/next/data/errors.d.ts +73 -0
- package/dist/next/data/errors.d.ts.map +1 -0
- package/dist/next/data/errors.js +107 -0
- package/dist/next/data/errors.js.map +1 -0
- package/dist/next/data/failure.d.ts +26 -0
- package/dist/next/data/failure.d.ts.map +1 -0
- package/dist/next/data/failure.js +72 -0
- package/dist/next/data/failure.js.map +1 -0
- package/dist/next/data/index.d.ts +4 -0
- package/dist/next/data/index.d.ts.map +1 -0
- package/dist/next/data/index.js +4 -0
- package/dist/next/data/index.js.map +1 -0
- package/dist/next/data/internal.d.ts +7 -0
- package/dist/next/data/internal.d.ts.map +1 -0
- package/dist/next/data/internal.js +8 -0
- package/dist/next/data/internal.js.map +1 -0
- package/dist/next/data/params.d.ts +20 -0
- package/dist/next/data/params.d.ts.map +1 -0
- package/dist/next/data/params.js +31 -0
- package/dist/next/data/params.js.map +1 -0
- package/dist/next/data/principal.d.ts +17 -0
- package/dist/next/data/principal.d.ts.map +1 -0
- package/dist/next/data/principal.js +41 -0
- package/dist/next/data/principal.js.map +1 -0
- package/dist/next/data/validator.d.ts +12 -0
- package/dist/next/data/validator.d.ts.map +1 -0
- package/dist/next/data/validator.js +34 -0
- package/dist/next/data/validator.js.map +1 -0
- package/dist/next/documents/address-source.d.ts +20 -0
- package/dist/next/documents/address-source.d.ts.map +1 -0
- package/dist/next/documents/address-source.js +44 -0
- package/dist/next/documents/address-source.js.map +1 -0
- package/dist/next/documents/definition.d.ts +84 -0
- package/dist/next/documents/definition.d.ts.map +1 -0
- package/dist/next/documents/definition.js +73 -0
- package/dist/next/documents/definition.js.map +1 -0
- package/dist/next/documents/documents.d.ts +106 -0
- package/dist/next/documents/documents.d.ts.map +1 -0
- package/dist/next/documents/documents.js +224 -0
- package/dist/next/documents/documents.js.map +1 -0
- package/dist/next/documents/fence.d.ts +9 -0
- package/dist/next/documents/fence.d.ts.map +1 -0
- package/dist/next/documents/fence.js +15 -0
- package/dist/next/documents/fence.js.map +1 -0
- package/dist/next/documents/handles.d.ts +76 -0
- package/dist/next/documents/handles.d.ts.map +1 -0
- package/dist/next/documents/handles.js +66 -0
- package/dist/next/documents/handles.js.map +1 -0
- package/dist/next/documents/index.d.ts +4 -0
- package/dist/next/documents/index.d.ts.map +1 -0
- package/dist/next/documents/index.js +3 -0
- package/dist/next/documents/index.js.map +1 -0
- package/dist/next/documents/internal.d.ts +9 -0
- package/dist/next/documents/internal.d.ts.map +1 -0
- package/dist/next/documents/internal.js +9 -0
- package/dist/next/documents/internal.js.map +1 -0
- package/dist/next/documents/keyed-slot.d.ts +103 -0
- package/dist/next/documents/keyed-slot.d.ts.map +1 -0
- package/dist/next/documents/keyed-slot.js +395 -0
- package/dist/next/documents/keyed-slot.js.map +1 -0
- package/dist/next/documents/line.d.ts +7 -0
- package/dist/next/documents/line.d.ts.map +1 -0
- package/dist/next/documents/line.js +14 -0
- package/dist/next/documents/line.js.map +1 -0
- package/dist/next/documents/persistence.d.ts +104 -0
- package/dist/next/documents/persistence.d.ts.map +1 -0
- package/dist/next/documents/persistence.js +128 -0
- package/dist/next/documents/persistence.js.map +1 -0
- package/dist/next/documents/residency.d.ts +31 -0
- package/dist/next/documents/residency.d.ts.map +1 -0
- package/dist/next/documents/residency.js +93 -0
- package/dist/next/documents/residency.js.map +1 -0
- package/dist/next/documents/slot.d.ts +109 -0
- package/dist/next/documents/slot.d.ts.map +1 -0
- package/dist/next/documents/slot.js +181 -0
- package/dist/next/documents/slot.js.map +1 -0
- package/dist/next/documents/transaction.d.ts +133 -0
- package/dist/next/documents/transaction.d.ts.map +1 -0
- package/dist/next/documents/transaction.js +409 -0
- package/dist/next/documents/transaction.js.map +1 -0
- package/dist/next/host/activity.d.ts +31 -0
- package/dist/next/host/activity.d.ts.map +1 -0
- package/dist/next/host/activity.js +40 -0
- package/dist/next/host/activity.js.map +1 -0
- package/dist/next/host/adapted.d.ts +49 -0
- package/dist/next/host/adapted.d.ts.map +1 -0
- package/dist/next/host/adapted.js +214 -0
- package/dist/next/host/adapted.js.map +1 -0
- package/dist/next/host/attempt.d.ts +278 -0
- package/dist/next/host/attempt.d.ts.map +1 -0
- package/dist/next/host/attempt.js +1072 -0
- package/dist/next/host/attempt.js.map +1 -0
- package/dist/next/host/backoff.d.ts +29 -0
- package/dist/next/host/backoff.d.ts.map +1 -0
- package/dist/next/host/backoff.js +69 -0
- package/dist/next/host/backoff.js.map +1 -0
- package/dist/next/host/ctx.d.ts +47 -0
- package/dist/next/host/ctx.d.ts.map +1 -0
- package/dist/next/host/ctx.js +108 -0
- package/dist/next/host/ctx.js.map +1 -0
- package/dist/next/host/deadline.d.ts +12 -0
- package/dist/next/host/deadline.d.ts.map +1 -0
- package/dist/next/host/deadline.js +40 -0
- package/dist/next/host/deadline.js.map +1 -0
- package/dist/next/host/dependencies.d.ts +65 -0
- package/dist/next/host/dependencies.d.ts.map +1 -0
- package/dist/next/host/dependencies.js +115 -0
- package/dist/next/host/dependencies.js.map +1 -0
- package/dist/next/host/destination.d.ts +48 -0
- package/dist/next/host/destination.d.ts.map +1 -0
- package/dist/next/host/destination.js +101 -0
- package/dist/next/host/destination.js.map +1 -0
- package/dist/next/host/facet.d.ts +79 -0
- package/dist/next/host/facet.d.ts.map +1 -0
- package/dist/next/host/facet.js +55 -0
- package/dist/next/host/facet.js.map +1 -0
- package/dist/next/host/follow.d.ts +52 -0
- package/dist/next/host/follow.d.ts.map +1 -0
- package/dist/next/host/follow.js +207 -0
- package/dist/next/host/follow.js.map +1 -0
- package/dist/next/host/host.d.ts +495 -0
- package/dist/next/host/host.d.ts.map +1 -0
- package/dist/next/host/host.js +1075 -0
- package/dist/next/host/host.js.map +1 -0
- package/dist/next/host/index.d.ts +17 -0
- package/dist/next/host/index.d.ts.map +1 -0
- package/dist/next/host/index.js +6 -0
- package/dist/next/host/index.js.map +1 -0
- package/dist/next/host/internal.d.ts +10 -0
- package/dist/next/host/internal.d.ts.map +1 -0
- package/dist/next/host/internal.js +8 -0
- package/dist/next/host/internal.js.map +1 -0
- package/dist/next/host/members.d.ts +50 -0
- package/dist/next/host/members.d.ts.map +1 -0
- package/dist/next/host/members.js +107 -0
- package/dist/next/host/members.js.map +1 -0
- package/dist/next/host/native.d.ts +55 -0
- package/dist/next/host/native.d.ts.map +1 -0
- package/dist/next/host/native.js +92 -0
- package/dist/next/host/native.js.map +1 -0
- package/dist/next/host/object.d.ts +290 -0
- package/dist/next/host/object.d.ts.map +1 -0
- package/dist/next/host/object.js +1127 -0
- package/dist/next/host/object.js.map +1 -0
- package/dist/next/host/parked.d.ts +23 -0
- package/dist/next/host/parked.d.ts.map +1 -0
- package/dist/next/host/parked.js +79 -0
- package/dist/next/host/parked.js.map +1 -0
- package/dist/next/host/presence.d.ts +34 -0
- package/dist/next/host/presence.d.ts.map +1 -0
- package/dist/next/host/presence.js +117 -0
- package/dist/next/host/presence.js.map +1 -0
- package/dist/next/host/ref-state.d.ts +53 -0
- package/dist/next/host/ref-state.d.ts.map +1 -0
- package/dist/next/host/ref-state.js +83 -0
- package/dist/next/host/ref-state.js.map +1 -0
- package/dist/next/host/reference-keys.d.ts +36 -0
- package/dist/next/host/reference-keys.d.ts.map +1 -0
- package/dist/next/host/reference-keys.js +168 -0
- package/dist/next/host/reference-keys.js.map +1 -0
- package/dist/next/host/reference-source.d.ts +65 -0
- package/dist/next/host/reference-source.d.ts.map +1 -0
- package/dist/next/host/reference-source.js +285 -0
- package/dist/next/host/reference-source.js.map +1 -0
- package/dist/next/host/reference.d.ts +308 -0
- package/dist/next/host/reference.d.ts.map +1 -0
- package/dist/next/host/reference.js +775 -0
- package/dist/next/host/reference.js.map +1 -0
- package/dist/next/host/retry-on.d.ts +28 -0
- package/dist/next/host/retry-on.d.ts.map +1 -0
- package/dist/next/host/retry-on.js +52 -0
- package/dist/next/host/retry-on.js.map +1 -0
- package/dist/next/host/revocation.d.ts +16 -0
- package/dist/next/host/revocation.d.ts.map +1 -0
- package/dist/next/host/revocation.js +27 -0
- package/dist/next/host/revocation.js.map +1 -0
- package/dist/next/host/root.d.ts +27 -0
- package/dist/next/host/root.d.ts.map +1 -0
- package/dist/next/host/root.js +68 -0
- package/dist/next/host/root.js.map +1 -0
- package/dist/next/host/route.d.ts +64 -0
- package/dist/next/host/route.d.ts.map +1 -0
- package/dist/next/host/route.js +190 -0
- package/dist/next/host/route.js.map +1 -0
- package/dist/next/host/routines.d.ts +76 -0
- package/dist/next/host/routines.d.ts.map +1 -0
- package/dist/next/host/routines.js +350 -0
- package/dist/next/host/routines.js.map +1 -0
- package/dist/next/host/sleep.d.ts +9 -0
- package/dist/next/host/sleep.d.ts.map +1 -0
- package/dist/next/host/sleep.js +40 -0
- package/dist/next/host/sleep.js.map +1 -0
- package/dist/next/host/staging.d.ts +94 -0
- package/dist/next/host/staging.d.ts.map +1 -0
- package/dist/next/host/staging.js +302 -0
- package/dist/next/host/staging.js.map +1 -0
- package/dist/next/host/unbound.d.ts +30 -0
- package/dist/next/host/unbound.d.ts.map +1 -0
- package/dist/next/host/unbound.js +67 -0
- package/dist/next/host/unbound.js.map +1 -0
- package/dist/next/host/uuid.d.ts +3 -0
- package/dist/next/host/uuid.d.ts.map +1 -0
- package/dist/next/host/uuid.js +38 -0
- package/dist/next/host/uuid.js.map +1 -0
- package/dist/next/index.d.ts +28 -0
- package/dist/next/index.d.ts.map +1 -0
- package/dist/next/index.js +18 -0
- package/dist/next/index.js.map +1 -0
- package/dist/next/jobs/definition.d.ts +96 -0
- package/dist/next/jobs/definition.d.ts.map +1 -0
- package/dist/next/jobs/definition.js +83 -0
- package/dist/next/jobs/definition.js.map +1 -0
- package/dist/next/jobs/index.d.ts +5 -0
- package/dist/next/jobs/index.d.ts.map +1 -0
- package/dist/next/jobs/index.js +3 -0
- package/dist/next/jobs/index.js.map +1 -0
- package/dist/next/jobs/internal.d.ts +3 -0
- package/dist/next/jobs/internal.d.ts.map +1 -0
- package/dist/next/jobs/internal.js +4 -0
- package/dist/next/jobs/internal.js.map +1 -0
- package/dist/next/jobs/job.d.ts +152 -0
- package/dist/next/jobs/job.d.ts.map +1 -0
- package/dist/next/jobs/job.js +320 -0
- package/dist/next/jobs/job.js.map +1 -0
- package/dist/next/jobs/persisted.d.ts +38 -0
- package/dist/next/jobs/persisted.d.ts.map +1 -0
- package/dist/next/jobs/persisted.js +95 -0
- package/dist/next/jobs/persisted.js.map +1 -0
- package/dist/next/jobs/records.d.ts +231 -0
- package/dist/next/jobs/records.d.ts.map +1 -0
- package/dist/next/jobs/records.js +869 -0
- package/dist/next/jobs/records.js.map +1 -0
- package/dist/next/jobs/run-states.d.ts +69 -0
- package/dist/next/jobs/run-states.d.ts.map +1 -0
- package/dist/next/jobs/run-states.js +228 -0
- package/dist/next/jobs/run-states.js.map +1 -0
- package/dist/next/jobs/run.d.ts +113 -0
- package/dist/next/jobs/run.d.ts.map +1 -0
- package/dist/next/jobs/run.js +200 -0
- package/dist/next/jobs/run.js.map +1 -0
- package/dist/next/jobs/running.d.ts +44 -0
- package/dist/next/jobs/running.d.ts.map +1 -0
- package/dist/next/jobs/running.js +117 -0
- package/dist/next/jobs/running.js.map +1 -0
- package/dist/next/jobs/stored.d.ts +63 -0
- package/dist/next/jobs/stored.d.ts.map +1 -0
- package/dist/next/jobs/stored.js +55 -0
- package/dist/next/jobs/stored.js.map +1 -0
- package/dist/next/link/binary.d.ts +4 -0
- package/dist/next/link/binary.d.ts.map +1 -0
- package/dist/next/link/binary.js +534 -0
- package/dist/next/link/binary.js.map +1 -0
- package/dist/next/link/channel.d.ts +63 -0
- package/dist/next/link/channel.d.ts.map +1 -0
- package/dist/next/link/channel.js +202 -0
- package/dist/next/link/channel.js.map +1 -0
- package/dist/next/link/errors.d.ts +7 -0
- package/dist/next/link/errors.d.ts.map +1 -0
- package/dist/next/link/errors.js +21 -0
- package/dist/next/link/errors.js.map +1 -0
- package/dist/next/link/index.d.ts +8 -0
- package/dist/next/link/index.d.ts.map +1 -0
- package/dist/next/link/index.js +8 -0
- package/dist/next/link/index.js.map +1 -0
- package/dist/next/link/internal.d.ts +9 -0
- package/dist/next/link/internal.d.ts.map +1 -0
- package/dist/next/link/internal.js +10 -0
- package/dist/next/link/internal.js.map +1 -0
- package/dist/next/link/ipc.d.ts +22 -0
- package/dist/next/link/ipc.d.ts.map +1 -0
- package/dist/next/link/ipc.js +64 -0
- package/dist/next/link/ipc.js.map +1 -0
- package/dist/next/link/link.d.ts +34 -0
- package/dist/next/link/link.d.ts.map +1 -0
- package/dist/next/link/link.js +87 -0
- package/dist/next/link/link.js.map +1 -0
- package/dist/next/link/message.d.ts +249 -0
- package/dist/next/link/message.d.ts.map +1 -0
- package/dist/next/link/message.js +123 -0
- package/dist/next/link/message.js.map +1 -0
- package/dist/next/link/part.d.ts +80 -0
- package/dist/next/link/part.d.ts.map +1 -0
- package/dist/next/link/part.js +164 -0
- package/dist/next/link/part.js.map +1 -0
- package/dist/next/link/text.d.ts +6 -0
- package/dist/next/link/text.d.ts.map +1 -0
- package/dist/next/link/text.js +335 -0
- package/dist/next/link/text.js.map +1 -0
- package/dist/next/link/values.d.ts +40 -0
- package/dist/next/link/values.d.ts.map +1 -0
- package/dist/next/link/values.js +117 -0
- package/dist/next/link/values.js.map +1 -0
- package/dist/next/link/websocket.d.ts +26 -0
- package/dist/next/link/websocket.d.ts.map +1 -0
- package/dist/next/link/websocket.js +91 -0
- package/dist/next/link/websocket.js.map +1 -0
- package/dist/next/registries/contribution.d.ts +50 -0
- package/dist/next/registries/contribution.d.ts.map +1 -0
- package/dist/next/registries/contribution.js +129 -0
- package/dist/next/registries/contribution.js.map +1 -0
- package/dist/next/registries/entries.d.ts +18 -0
- package/dist/next/registries/entries.d.ts.map +1 -0
- package/dist/next/registries/entries.js +42 -0
- package/dist/next/registries/entries.js.map +1 -0
- package/dist/next/registries/index.d.ts +3 -0
- package/dist/next/registries/index.d.ts.map +1 -0
- package/dist/next/registries/index.js +5 -0
- package/dist/next/registries/index.js.map +1 -0
- package/dist/next/registries/internal.d.ts +4 -0
- package/dist/next/registries/internal.d.ts.map +1 -0
- package/dist/next/registries/internal.js +5 -0
- package/dist/next/registries/internal.js.map +1 -0
- package/dist/next/registries/record.d.ts +94 -0
- package/dist/next/registries/record.d.ts.map +1 -0
- package/dist/next/registries/record.js +253 -0
- package/dist/next/registries/record.js.map +1 -0
- package/dist/next/registries/registry.d.ts +74 -0
- package/dist/next/registries/registry.d.ts.map +1 -0
- package/dist/next/registries/registry.js +14 -0
- package/dist/next/registries/registry.js.map +1 -0
- package/dist/next/registries/value.d.ts +48 -0
- package/dist/next/registries/value.d.ts.map +1 -0
- package/dist/next/registries/value.js +199 -0
- package/dist/next/registries/value.js.map +1 -0
- package/dist/next/remote/calls.d.ts +25 -0
- package/dist/next/remote/calls.d.ts.map +1 -0
- package/dist/next/remote/calls.js +62 -0
- package/dist/next/remote/calls.js.map +1 -0
- package/dist/next/remote/consumer.d.ts +42 -0
- package/dist/next/remote/consumer.d.ts.map +1 -0
- package/dist/next/remote/consumer.js +343 -0
- package/dist/next/remote/consumer.js.map +1 -0
- package/dist/next/remote/hold.d.ts +130 -0
- package/dist/next/remote/hold.d.ts.map +1 -0
- package/dist/next/remote/hold.js +537 -0
- package/dist/next/remote/hold.js.map +1 -0
- package/dist/next/remote/host-link.d.ts +77 -0
- package/dist/next/remote/host-link.d.ts.map +1 -0
- package/dist/next/remote/host-link.js +182 -0
- package/dist/next/remote/host-link.js.map +1 -0
- package/dist/next/remote/internal.d.ts +6 -0
- package/dist/next/remote/internal.d.ts.map +1 -0
- package/dist/next/remote/internal.js +6 -0
- package/dist/next/remote/internal.js.map +1 -0
- package/dist/next/remote/path.d.ts +46 -0
- package/dist/next/remote/path.d.ts.map +1 -0
- package/dist/next/remote/path.js +73 -0
- package/dist/next/remote/path.js.map +1 -0
- package/dist/next/remote/provider.d.ts +76 -0
- package/dist/next/remote/provider.d.ts.map +1 -0
- package/dist/next/remote/provider.js +506 -0
- package/dist/next/remote/provider.js.map +1 -0
- package/dist/next/remote/relay.d.ts +58 -0
- package/dist/next/remote/relay.d.ts.map +1 -0
- package/dist/next/remote/relay.js +117 -0
- package/dist/next/remote/relay.js.map +1 -0
- package/dist/next/remote/remote-object.d.ts +133 -0
- package/dist/next/remote/remote-object.d.ts.map +1 -0
- package/dist/next/remote/remote-object.js +411 -0
- package/dist/next/remote/remote-object.js.map +1 -0
- package/dist/next/remote/replica.d.ts +59 -0
- package/dist/next/remote/replica.d.ts.map +1 -0
- package/dist/next/remote/replica.js +125 -0
- package/dist/next/remote/replica.js.map +1 -0
- package/dist/next/state/batch.d.ts +64 -0
- package/dist/next/state/batch.d.ts.map +1 -0
- package/dist/next/state/batch.js +163 -0
- package/dist/next/state/batch.js.map +1 -0
- package/dist/next/state/derive.d.ts +52 -0
- package/dist/next/state/derive.d.ts.map +1 -0
- package/dist/next/state/derive.js +182 -0
- package/dist/next/state/derive.js.map +1 -0
- package/dist/next/state/index.d.ts +6 -0
- package/dist/next/state/index.d.ts.map +1 -0
- package/dist/next/state/index.js +4 -0
- package/dist/next/state/index.js.map +1 -0
- package/dist/next/state/internal.d.ts +6 -0
- package/dist/next/state/internal.d.ts.map +1 -0
- package/dist/next/state/internal.js +8 -0
- package/dist/next/state/internal.js.map +1 -0
- package/dist/next/state/native-source.d.ts +106 -0
- package/dist/next/state/native-source.d.ts.map +1 -0
- package/dist/next/state/native-source.js +240 -0
- package/dist/next/state/native-source.js.map +1 -0
- package/dist/next/state/watchable.d.ts +114 -0
- package/dist/next/state/watchable.d.ts.map +1 -0
- package/dist/next/state/watchable.js +156 -0
- package/dist/next/state/watchable.js.map +1 -0
- package/dist/next/state/writable.d.ts +32 -0
- package/dist/next/state/writable.d.ts.map +1 -0
- package/dist/next/state/writable.js +49 -0
- package/dist/next/state/writable.js.map +1 -0
- package/dist/next/store/adapter.d.ts +67 -0
- package/dist/next/store/adapter.d.ts.map +1 -0
- package/dist/next/store/adapter.js +118 -0
- package/dist/next/store/adapter.js.map +1 -0
- package/dist/next/store/allocator.d.ts +17 -0
- package/dist/next/store/allocator.d.ts.map +1 -0
- package/dist/next/store/allocator.js +30 -0
- package/dist/next/store/allocator.js.map +1 -0
- package/dist/next/store/applier.d.ts +8 -0
- package/dist/next/store/applier.d.ts.map +1 -0
- package/dist/next/store/applier.js +375 -0
- package/dist/next/store/applier.js.map +1 -0
- package/dist/next/store/apply-batch.d.ts +12 -0
- package/dist/next/store/apply-batch.d.ts.map +1 -0
- package/dist/next/store/apply-batch.js +83 -0
- package/dist/next/store/apply-batch.js.map +1 -0
- package/dist/next/store/archive.d.ts +32 -0
- package/dist/next/store/archive.d.ts.map +1 -0
- package/dist/next/store/archive.js +129 -0
- package/dist/next/store/archive.js.map +1 -0
- package/dist/next/store/backend.d.ts +10 -0
- package/dist/next/store/backend.d.ts.map +1 -0
- package/dist/next/store/backend.js +15 -0
- package/dist/next/store/backend.js.map +1 -0
- package/dist/next/store/catalog.d.ts +24 -0
- package/dist/next/store/catalog.d.ts.map +1 -0
- package/dist/next/store/catalog.js +17 -0
- package/dist/next/store/catalog.js.map +1 -0
- package/dist/next/store/claims.d.ts +23 -0
- package/dist/next/store/claims.d.ts.map +1 -0
- package/dist/next/store/claims.js +65 -0
- package/dist/next/store/claims.js.map +1 -0
- package/dist/next/store/columns.d.ts +77 -0
- package/dist/next/store/columns.d.ts.map +1 -0
- package/dist/next/store/columns.js +77 -0
- package/dist/next/store/columns.js.map +1 -0
- package/dist/next/store/engine.d.ts +176 -0
- package/dist/next/store/engine.d.ts.map +1 -0
- package/dist/next/store/engine.js +283 -0
- package/dist/next/store/engine.js.map +1 -0
- package/dist/next/store/evaluate.d.ts +17 -0
- package/dist/next/store/evaluate.d.ts.map +1 -0
- package/dist/next/store/evaluate.js +128 -0
- package/dist/next/store/evaluate.js.map +1 -0
- package/dist/next/store/export.d.ts +17 -0
- package/dist/next/store/export.d.ts.map +1 -0
- package/dist/next/store/export.js +200 -0
- package/dist/next/store/export.js.map +1 -0
- package/dist/next/store/expression.d.ts +150 -0
- package/dist/next/store/expression.d.ts.map +1 -0
- package/dist/next/store/expression.js +268 -0
- package/dist/next/store/expression.js.map +1 -0
- package/dist/next/store/import.d.ts +10 -0
- package/dist/next/store/import.d.ts.map +1 -0
- package/dist/next/store/import.js +276 -0
- package/dist/next/store/import.js.map +1 -0
- package/dist/next/store/index.d.ts +16 -0
- package/dist/next/store/index.d.ts.map +1 -0
- package/dist/next/store/index.js +13 -0
- package/dist/next/store/index.js.map +1 -0
- package/dist/next/store/json-column.d.ts +33 -0
- package/dist/next/store/json-column.d.ts.map +1 -0
- package/dist/next/store/json-column.js +61 -0
- package/dist/next/store/json-column.js.map +1 -0
- package/dist/next/store/jsonl.d.ts +9 -0
- package/dist/next/store/jsonl.d.ts.map +1 -0
- package/dist/next/store/jsonl.js +61 -0
- package/dist/next/store/jsonl.js.map +1 -0
- package/dist/next/store/outbox.d.ts +26 -0
- package/dist/next/store/outbox.d.ts.map +1 -0
- package/dist/next/store/outbox.js +80 -0
- package/dist/next/store/outbox.js.map +1 -0
- package/dist/next/store/query.d.ts +39 -0
- package/dist/next/store/query.d.ts.map +1 -0
- package/dist/next/store/query.js +97 -0
- package/dist/next/store/query.js.map +1 -0
- package/dist/next/store/refusal.d.ts +15 -0
- package/dist/next/store/refusal.d.ts.map +1 -0
- package/dist/next/store/refusal.js +36 -0
- package/dist/next/store/refusal.js.map +1 -0
- package/dist/next/store/rows.d.ts +80 -0
- package/dist/next/store/rows.d.ts.map +1 -0
- package/dist/next/store/rows.js +183 -0
- package/dist/next/store/rows.js.map +1 -0
- package/dist/next/store/schema.d.ts +25 -0
- package/dist/next/store/schema.d.ts.map +1 -0
- package/dist/next/store/schema.js +115 -0
- package/dist/next/store/schema.js.map +1 -0
- package/dist/next/store/sql.d.ts +73 -0
- package/dist/next/store/sql.d.ts.map +1 -0
- package/dist/next/store/sql.js +234 -0
- package/dist/next/store/sql.js.map +1 -0
- package/dist/next/store/step.d.ts +48 -0
- package/dist/next/store/step.d.ts.map +1 -0
- package/dist/next/store/step.js +50 -0
- package/dist/next/store/step.js.map +1 -0
- package/dist/next/store/store.d.ts +161 -0
- package/dist/next/store/store.d.ts.map +1 -0
- package/dist/next/store/store.js +627 -0
- package/dist/next/store/store.js.map +1 -0
- package/dist/next/store/table-changes.d.ts +29 -0
- package/dist/next/store/table-changes.d.ts.map +1 -0
- package/dist/next/store/table-changes.js +102 -0
- package/dist/next/store/table-changes.js.map +1 -0
- package/dist/next/store/table-evolve.d.ts +74 -0
- package/dist/next/store/table-evolve.d.ts.map +1 -0
- package/dist/next/store/table-evolve.js +201 -0
- package/dist/next/store/table-evolve.js.map +1 -0
- package/dist/next/store/table-handle.d.ts +67 -0
- package/dist/next/store/table-handle.d.ts.map +1 -0
- package/dist/next/store/table-handle.js +101 -0
- package/dist/next/store/table-handle.js.map +1 -0
- package/dist/next/store/table-history.d.ts +75 -0
- package/dist/next/store/table-history.d.ts.map +1 -0
- package/dist/next/store/table-history.js +42 -0
- package/dist/next/store/table-history.js.map +1 -0
- package/dist/next/store/table-migration.d.ts +16 -0
- package/dist/next/store/table-migration.d.ts.map +1 -0
- package/dist/next/store/table-migration.js +202 -0
- package/dist/next/store/table-migration.js.map +1 -0
- package/dist/next/store/table-writes.d.ts +125 -0
- package/dist/next/store/table-writes.d.ts.map +1 -0
- package/dist/next/store/table-writes.js +165 -0
- package/dist/next/store/table-writes.js.map +1 -0
- package/dist/next/store/table.d.ts +80 -0
- package/dist/next/store/table.d.ts.map +1 -0
- package/dist/next/store/table.js +103 -0
- package/dist/next/store/table.js.map +1 -0
- package/dist/next/store/text.d.ts +14 -0
- package/dist/next/store/text.d.ts.map +1 -0
- package/dist/next/store/text.js +51 -0
- package/dist/next/store/text.js.map +1 -0
- package/dist/next/store/writes.d.ts +5 -0
- package/dist/next/store/writes.d.ts.map +1 -0
- package/dist/next/store/writes.js +4 -0
- package/dist/next/store/writes.js.map +1 -0
- package/dist/next-node/compression.d.ts +7 -0
- package/dist/next-node/compression.d.ts.map +1 -0
- package/dist/next-node/compression.js +24 -0
- package/dist/next-node/compression.js.map +1 -0
- package/dist/next-node/http/admission.d.ts +63 -0
- package/dist/next-node/http/admission.d.ts.map +1 -0
- package/dist/next-node/http/admission.js +134 -0
- package/dist/next-node/http/admission.js.map +1 -0
- package/dist/next-node/http/authenticate.d.ts +21 -0
- package/dist/next-node/http/authenticate.d.ts.map +1 -0
- package/dist/next-node/http/authenticate.js +34 -0
- package/dist/next-node/http/authenticate.js.map +1 -0
- package/dist/next-node/http/cookies.d.ts +24 -0
- package/dist/next-node/http/cookies.d.ts.map +1 -0
- package/dist/next-node/http/cookies.js +62 -0
- package/dist/next-node/http/cookies.js.map +1 -0
- package/dist/next-node/http/file.d.ts +23 -0
- package/dist/next-node/http/file.d.ts.map +1 -0
- package/dist/next-node/http/file.js +94 -0
- package/dist/next-node/http/file.js.map +1 -0
- package/dist/next-node/http/headers.d.ts +37 -0
- package/dist/next-node/http/headers.d.ts.map +1 -0
- package/dist/next-node/http/headers.js +129 -0
- package/dist/next-node/http/headers.js.map +1 -0
- package/dist/next-node/http/http.d.ts +100 -0
- package/dist/next-node/http/http.d.ts.map +1 -0
- package/dist/next-node/http/http.js +462 -0
- package/dist/next-node/http/http.js.map +1 -0
- package/dist/next-node/http/incoming.d.ts +19 -0
- package/dist/next-node/http/incoming.d.ts.map +1 -0
- package/dist/next-node/http/incoming.js +31 -0
- package/dist/next-node/http/incoming.js.map +1 -0
- package/dist/next-node/http/index.d.ts +11 -0
- package/dist/next-node/http/index.d.ts.map +1 -0
- package/dist/next-node/http/index.js +12 -0
- package/dist/next-node/http/index.js.map +1 -0
- package/dist/next-node/http/node.d.ts +78 -0
- package/dist/next-node/http/node.d.ts.map +1 -0
- package/dist/next-node/http/node.js +291 -0
- package/dist/next-node/http/node.js.map +1 -0
- package/dist/next-node/http/request.d.ts +54 -0
- package/dist/next-node/http/request.d.ts.map +1 -0
- package/dist/next-node/http/request.js +116 -0
- package/dist/next-node/http/request.js.map +1 -0
- package/dist/next-node/http/response.d.ts +63 -0
- package/dist/next-node/http/response.d.ts.map +1 -0
- package/dist/next-node/http/response.js +202 -0
- package/dist/next-node/http/response.js.map +1 -0
- package/dist/next-node/http/router.d.ts +114 -0
- package/dist/next-node/http/router.d.ts.map +1 -0
- package/dist/next-node/http/router.js +261 -0
- package/dist/next-node/http/router.js.map +1 -0
- package/dist/next-node/http/upgrades.d.ts +58 -0
- package/dist/next-node/http/upgrades.d.ts.map +1 -0
- package/dist/next-node/http/upgrades.js +184 -0
- package/dist/next-node/http/upgrades.js.map +1 -0
- package/dist/next-node/plugins/build.d.ts +57 -0
- package/dist/next-node/plugins/build.d.ts.map +1 -0
- package/dist/next-node/plugins/build.js +334 -0
- package/dist/next-node/plugins/build.js.map +1 -0
- package/dist/next-node/plugins/discover.d.ts +36 -0
- package/dist/next-node/plugins/discover.d.ts.map +1 -0
- package/dist/next-node/plugins/discover.js +91 -0
- package/dist/next-node/plugins/discover.js.map +1 -0
- package/dist/next-node/plugins/evaluate.d.ts +33 -0
- package/dist/next-node/plugins/evaluate.d.ts.map +1 -0
- package/dist/next-node/plugins/evaluate.js +98 -0
- package/dist/next-node/plugins/evaluate.js.map +1 -0
- package/dist/next-node/plugins/index.d.ts +9 -0
- package/dist/next-node/plugins/index.d.ts.map +1 -0
- package/dist/next-node/plugins/index.js +11 -0
- package/dist/next-node/plugins/index.js.map +1 -0
- package/dist/next-node/plugins/install.d.ts +13 -0
- package/dist/next-node/plugins/install.d.ts.map +1 -0
- package/dist/next-node/plugins/install.js +37 -0
- package/dist/next-node/plugins/install.js.map +1 -0
- package/dist/next-node/plugins/plugins.d.ts +135 -0
- package/dist/next-node/plugins/plugins.d.ts.map +1 -0
- package/dist/next-node/plugins/plugins.js +206 -0
- package/dist/next-node/plugins/plugins.js.map +1 -0
- package/dist/next-node/plugins/runtime.d.ts +41 -0
- package/dist/next-node/plugins/runtime.d.ts.map +1 -0
- package/dist/next-node/plugins/runtime.js +136 -0
- package/dist/next-node/plugins/runtime.js.map +1 -0
- package/dist/next-node/plugins/stack.d.ts +16 -0
- package/dist/next-node/plugins/stack.d.ts.map +1 -0
- package/dist/next-node/plugins/stack.js +61 -0
- package/dist/next-node/plugins/stack.js.map +1 -0
- package/dist/next-node/plugins/watcher.d.ts +58 -0
- package/dist/next-node/plugins/watcher.d.ts.map +1 -0
- package/dist/next-node/plugins/watcher.js +281 -0
- package/dist/next-node/plugins/watcher.js.map +1 -0
- package/dist/next-node/workers/control.d.ts +83 -0
- package/dist/next-node/workers/control.d.ts.map +1 -0
- package/dist/next-node/workers/control.js +77 -0
- package/dist/next-node/workers/control.js.map +1 -0
- package/dist/next-node/workers/index.d.ts +5 -0
- package/dist/next-node/workers/index.d.ts.map +1 -0
- package/dist/next-node/workers/index.js +7 -0
- package/dist/next-node/workers/index.js.map +1 -0
- package/dist/next-node/workers/lock.d.ts +21 -0
- package/dist/next-node/workers/lock.d.ts.map +1 -0
- package/dist/next-node/workers/lock.js +137 -0
- package/dist/next-node/workers/lock.js.map +1 -0
- package/dist/next-node/workers/main.d.ts +46 -0
- package/dist/next-node/workers/main.d.ts.map +1 -0
- package/dist/next-node/workers/main.js +230 -0
- package/dist/next-node/workers/main.js.map +1 -0
- package/dist/next-node/workers/process.d.ts +42 -0
- package/dist/next-node/workers/process.d.ts.map +1 -0
- package/dist/next-node/workers/process.js +125 -0
- package/dist/next-node/workers/process.js.map +1 -0
- package/dist/next-node/workers/workers.d.ts +80 -0
- package/dist/next-node/workers/workers.d.ts.map +1 -0
- package/dist/next-node/workers/workers.js +572 -0
- package/dist/next-node/workers/workers.js.map +1 -0
- package/dist/object.d.ts +4 -4
- package/dist/object.d.ts.map +1 -1
- package/dist/object.js +3 -4
- package/dist/object.js.map +1 -1
- package/dist/output.d.ts +9 -3
- package/dist/output.d.ts.map +1 -1
- package/dist/output.js +21 -9
- package/dist/output.js.map +1 -1
- package/dist/remote.d.ts.map +1 -1
- package/dist/remote.js +2 -2
- package/dist/remote.js.map +1 -1
- package/dist/schema.d.ts +8 -4
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +180 -5
- package/dist/schema.js.map +1 -1
- package/dist/sqlite/cloudflare.d.ts +54 -0
- package/dist/sqlite/cloudflare.d.ts.map +1 -0
- package/dist/sqlite/cloudflare.js +144 -0
- package/dist/sqlite/cloudflare.js.map +1 -0
- package/dist/sqlite/database.d.ts +40 -0
- package/dist/sqlite/database.d.ts.map +1 -0
- package/dist/sqlite/database.js +2 -0
- package/dist/sqlite/database.js.map +1 -0
- package/dist/sqlite/index.d.ts +4 -0
- package/dist/sqlite/index.d.ts.map +1 -0
- package/dist/sqlite/index.js +3 -0
- package/dist/sqlite/index.js.map +1 -0
- package/dist/sqlite/migrations.d.ts +10 -0
- package/dist/sqlite/migrations.d.ts.map +1 -0
- package/dist/sqlite/migrations.js +33 -0
- package/dist/sqlite/migrations.js.map +1 -0
- package/dist/sqlite/node.d.ts +41 -0
- package/dist/sqlite/node.d.ts.map +1 -0
- package/dist/sqlite/node.js +191 -0
- package/dist/sqlite/node.js.map +1 -0
- package/dist/sqlite/schema.d.ts +3 -0
- package/dist/sqlite/schema.d.ts.map +1 -0
- package/dist/sqlite/schema.js +10 -0
- package/dist/sqlite/schema.js.map +1 -0
- package/dist/telemetry-sqlite/index.d.ts +24 -0
- package/dist/telemetry-sqlite/index.d.ts.map +1 -0
- package/dist/telemetry-sqlite/index.js +273 -0
- package/dist/telemetry-sqlite/index.js.map +1 -0
- package/dist/telemetry-sqlite/store.d.ts +9 -0
- package/dist/telemetry-sqlite/store.d.ts.map +1 -0
- package/dist/telemetry-sqlite/store.js +110 -0
- package/dist/telemetry-sqlite/store.js.map +1 -0
- package/dist/watch.d.ts +194 -0
- package/dist/watch.d.ts.map +1 -0
- package/dist/watch.js +383 -0
- package/dist/watch.js.map +1 -0
- package/dist/wire.d.ts +174 -193
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +81 -80
- package/dist/wire.js.map +1 -1
- package/docs/guide.md +15 -15
- package/docs/next/benchmarks.md +959 -0
- package/docs/next/decisions.md +2957 -0
- package/docs/next/dependencies/book.md +1671 -0
- package/docs/next/dependencies/index.html +2641 -0
- package/docs/next/dependencies/model.md +330 -0
- package/docs/next/design.md +2554 -0
- package/docs/next/durable-observers/book.md +432 -0
- package/docs/next/durable-observers/index.html +517 -0
- package/docs/next/flow-control/book.md +333 -0
- package/docs/next/flow-control/fold/index.html +265 -0
- package/docs/next/flow-control/index.html +548 -0
- package/docs/next/flow-control/window/index.html +228 -0
- package/docs/next/guide-plugins-hosts/book.md +607 -0
- package/docs/next/guide-plugins-hosts/index.html +652 -0
- package/docs/next/http-workers/book.md +378 -0
- package/docs/next/http-workers/index.html +515 -0
- package/docs/next/layer-1.md +311 -0
- package/docs/next/layer-2.md +216 -0
- package/docs/next/plugin-model/book.md +186 -0
- package/docs/next/plugin-model/index.html +310 -0
- package/docs/next/plugin-primer/book.md +273 -0
- package/docs/next/plugin-primer/index.html +430 -0
- package/docs/next/slice-1.md +236 -0
- package/docs/next/slice-10.md +285 -0
- package/docs/next/slice-11.md +93 -0
- package/docs/next/slice-2.md +174 -0
- package/docs/next/slice-3a.md +296 -0
- package/docs/next/slice-3b.md +197 -0
- package/docs/next/slice-4.md +146 -0
- package/docs/next/slice-4a.md +418 -0
- package/docs/next/slice-4b.md +208 -0
- package/docs/next/slice-5.md +281 -0
- package/docs/next/slice-6a.md +676 -0
- package/docs/next/slice-6b.md +332 -0
- package/docs/next/slice-7a.md +130 -0
- package/docs/next/slice-7b/book.md +608 -0
- package/docs/next/slice-7b/index.html +842 -0
- package/docs/next/slice-7b.md +255 -0
- package/docs/next/slice-7c.md +165 -0
- package/docs/next/slice-8.md +194 -0
- package/docs/next/slices.md +230 -0
- package/docs/next/store/book.md +665 -0
- package/docs/next/store/index.html +861 -0
- package/docs/next/store/walkthrough.md +193 -0
- package/docs/spec.md +9 -9
- package/docs/tutorial.md +26 -25
- package/package.json +42 -5
- package/src/delta/README.md +69 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attempt.js","sourceRoot":"","sources":["../../../src/next/host/attempt.ts"],"names":[],"mappings":"AAAA,sHAAsH;AACtH,kHAAkH;AAClH,sHAAsH;AACtH,sHAAsH;AACtH,mHAAmH;AACnH,WAAW;AAEX,OAAO,EAAE,gBAAgB,EAAgB,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAIzF,OAAO,EAAE,YAAY,EAAgB,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,UAAU,EAAqC,MAAM,kBAAkB,CAAC;AACjF,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,EAAc,MAAM,qBAAqB,CAAC;AAE7G,OAAO,EAKN,SAAS,GACT,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAA6C,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAIrF,OAAO,EAAE,MAAM,EAAqB,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEjF,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C,OAAO,EAAc,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAyB,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACrF,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAmB,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC3G,OAAO,EAAqB,YAAY,EAAE,MAAM,aAAa,CAAC;AAE9D,OAAO,EACN,aAAa,EACb,mBAAm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AAC;QAChB,OAAO,EAAE,CAAC;QACV,MAAM,KAAK,CAAC;IACb,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,CAAC;AAC9C,CAAC","sourcesContent":["// Attempts (§6, §13, §14, §15): one activation of an object, a fresh instance each time. It is the `self` its factory\n// declares with (handles to the object's documents and jobs, under its seal token); it runs the activation steps,\n// each failing with its own kind; it takes the live object's calls and starts its routines and jobs; and it ends with\n// its seal (slice 6a §1.3), the drain and the closes of its natives. A reload's swap hands it over (slice 7b §5): its\n// routines stop and hand over to the new attempt's, its jobs to the new attempt's, and it is sealed once its calls\n// settled.\n\nimport { awaitWithContext, type Context, withAbortSignal } from \"../../context/index.ts\";\nimport type { JsonValue } from \"../../json.ts\";\nimport type { NativeWatchable, Watchable, WatchEnd } from \"../../watch.ts\";\nimport type { Contract, Implementation, ParamsOf } from \"../contracts/index.ts\";\nimport { contractData, type ShapeOf } from \"../contracts/internal.ts\";\nimport { ChordError, type FailureCause, type Principal } from \"../data/index.ts\";\nimport { asChordError, checkArgs, checkParams, invalid, openFailure, type Value } from \"../data/internal.ts\";\nimport type { HandleOf, JsonObject, StateDefinition, Tx } from \"../documents/index.ts\";\nimport {\n\ttype AnyDefinition,\n\ttype KeyDeclarer,\n\ttype KeyedSlot,\n\ttype KeySource,\n\tSealToken,\n} from \"../documents/internal.ts\";\nimport type { JobDefinition, JobHandle, JobImplementation } from \"../jobs/index.ts\";\nimport { type AnyJobImplementation, type CutReason, Job } from \"../jobs/internal.ts\";\nimport type { Contribution, Registry, RegistryValue } from \"../registries/index.ts\";\nimport type { RegistryContribution, RegistryWaiter } from \"../registries/internal.ts\";\nimport type { Writable } from \"../state/index.ts\";\nimport { Derive, type DeriveSource, WritableSource } from \"../state/internal.ts\";\nimport type { Columns } from \"../store/columns.ts\";\nimport { tableSqlName } from \"../store/sql.ts\";\nimport type { ChordStore } from \"../store/store.ts\";\nimport type { TableDefinition } from \"../store/table.ts\";\nimport { type Table, TableHandle } from \"../store/table-handle.ts\";\nimport { prepareTables } from \"../store/table-migration.ts\";\nimport { AdaptedMembers } from \"./adapted.ts\";\nimport { CallContext, type Caller, type Ctx, withLinkedAbortSignal } from \"./ctx.ts\";\nimport { Deadline } from \"./deadline.ts\";\nimport { checkDependencies, type Dependency, ParkedLong, parkedCause, waitingOn } from \"./dependencies.ts\";\nimport { type FollowAttach, FollowSource } from \"./follow.ts\";\nimport type { HostError } from \"./host.ts\";\nimport {\n\tattachDerives,\n\tcheckImplementation,\n\tcontributionOf,\n\ttype KeyedBinding,\n\ttype Members,\n\ttype Method,\n} from \"./members.ts\";\nimport {\n\ttype CloseFailed,\n\tdrained,\n\ttype Native,\n\ttype NativeCloseReason,\n\tNativeHandle,\n\ttype NativeOptions,\n\ttype NativeSlot,\n} from \"./native.ts\";\nimport type { ChordObject, Served } from \"./object.ts\";\nimport type { Failed } from \"./ref-state.ts\";\nimport type { Binding, CheckedParams, Reference, RetryWalk } from \"./reference.ts\";\nimport { type RetrySource, retrySource } from \"./retry-on.ts\";\nimport {\n\ttype OnHandler,\n\ttype OnLiveHandler,\n\ttype OnNativeHandler,\n\ttype RoutineDeclarations,\n\tRoutines,\n} from \"./routines.ts\";\n\n/**\n * What a factory declares with. Declarations (`state`, `derive`, `get`, `registry`, `writable`, `retryOn`, `open`,\n * `on`, `onLive`, `job`) are valid only while it runs. `P` is the app's principal type, which the ctx of routine calls\n * and job runs carry.\n */\nexport interface Self<P extends Principal = Principal> extends RoutineDeclarations<P> {\n\t/** This object's documents of `definition`, in memory for its life (across its attempts). */\n\tstate<D extends StateDefinition<JsonObject, boolean, false>>(definition: D): HandleOf<D>;\n\t/**\n\t * A value computed from `sources` (JSON watchables and native ones: a `writable`, a registry value, `ref.state`) by\n\t * the pure, synchronous `compute`; always JSON.\n\t */\n\tderive<const S extends readonly (Watchable<unknown> | NativeWatchable<unknown>)[], T extends JsonValue>(\n\t\tsources: S,\n\t\tcompute: (\n\t\t\tvalues: {\n\t\t\t\treadonly [I in keyof S]: S[I] extends Watchable<infer V>\n\t\t\t\t\t? V\n\t\t\t\t\t: S[I] extends NativeWatchable<infer V>\n\t\t\t\t\t\t? V\n\t\t\t\t\t\t: never;\n\t\t\t},\n\t\t) => T,\n\t): Watchable<T>;\n\t/** A reference to another object, live once this object is, released when it ends. */\n\tget<C extends Contract>(Type: C, params: ParamsOf<C>): Reference<C>;\n\t/**\n\t * Registry `R`'s composed value as this plugin's version of `R` sees it: a declared dependency, as `get` is\n\t * (the attempt parks until it has a usable value: `failed { waiting }` while it has none, woken when it has). Read\n\t * `.value` at use; once live, a later failure of the registry keeps its last good value while every contribution it\n\t * was built from is still in the table.\n\t */\n\tregistry<C, V>(R: Registry<C, V>): RegistryValue<V>;\n\t/**\n\t * An in-process value this attempt sets (`set`, identity compared): a contribution, a derive source and an `on`\n\t * source, never a state member; its watches end with the attempt, and `set` after its end throws `released`.\n\t */\n\twritable<T>(initial: T): Writable<T>;\n\t/**\n\t * Wake signals: a new value of any of `sources` (registry values; constants never change) retries this object\n\t * while it is failed, as `ref.retry()` does, and once more at once if its current activation fails. Followed from\n\t * the factory's return until the next attempt's declaration or the object's end; failures wake nothing.\n\t */\n\tretryOn(...sources: readonly (Watchable<unknown> | NativeWatchable<unknown>)[]): void;\n\t/**\n\t * A native, opened during activation after the references are live and the earlier natives are open, and closed\n\t * in reverse when the attempt ends. `open` gets a context aborted when the attempt is abandoned; `close` one aborted\n\t * at the close timeout. Throw `broken(error)` from `open` when retrying is pointless.\n\t */\n\topen<T>(\n\t\topen: (context: Context) => Promise<T>,\n\t\tclose: (value: T, reason: NativeCloseReason, context: Context) => void | Promise<void>,\n\t\toptions?: NativeOptions,\n\t): Native<T>;\n\t/** Runs `fn` as one transaction of this object (§9). */\n\ttx<R>(fn: (tx: Tx) => R | Promise<R>, context: Context): Promise<R>;\n\t/**\n\t * A source following another runtime's synchronous observer (Durable's views, slice 6b §3): `attach` runs during\n\t * activation once the natives opened (a rejection or `undefined` fails the activation `transient`), and the observer\n\t * is detached when the attempt ends. Its runtime failing fails this object `transient`; its `ended` is final, the\n\t * source keeping its last value. A state member, a derive source, an `on` source.\n\t */\n\tfollow<T>(attach: FollowAttach<T>): Watchable<T>;\n\t/**\n\t * This object's job `definition` (§15), once per job name: `run` runs each started run outside transactions,\n\t * `finish` records its outcome in one. Starts are taken once the object is live.\n\t */\n\tjob<A, R, S>(definition: JobDefinition<A, R, S>, implementation: JobImplementation<A, R, S, P>): JobHandle<A, R, S>;\n}\n\n/**\n * What the factory of a `local` type with empty params declares with: one object per host and type, so its data may\n * persist (P3). `P` as for `Self`.\n */\nexport interface StoreSelf<P extends Principal = Principal> extends Self<P> {\n\t/** This object's documents of `definition`: in memory for its life, or persisted in the host's store. */\n\tstate<D extends StateDefinition<JsonObject, boolean, boolean>>(definition: D): HandleOf<D>;\n\t/** This object's table `definition` in the host's store, once per table name. */\n\ttable<C extends Columns, K extends readonly string[]>(definition: TableDefinition<C, K>): Table<C, K>;\n\t/**\n\t * Contributes `value` to registry `R` from the moment this object is live until it ends, fails or restarts (R21: a\n\t * host-lifetime object): a plain value, or a Chord watchable of one (followed: its change recomposes). At most one\n\t * per registry.\n\t */\n\tcontribute<C>(R: Registry<C, unknown>, value: Contribution<C>): void;\n}\n\n/** A key of a keyed member pinned on one instance, loaded: its source (mapped when older), and the release (once). */\nexport type PinnedKey = { readonly source: DeriveSource; readonly release: () => void };\n\n/**\n * A factory: synchronous and declarative, run once per attempt. A remote one also gets the principal in its object's\n * identity and returns one variant, `{ variant, members }`. Methods get a `Ctx` for the app's principal type `P`.\n */\nexport type Factory<C extends Contract, P extends Principal = Principal> = ShapeOf<C>[\"kind\"] extends \"local\"\n\t? (params: ParamsOf<C>, self: keyof ParamsOf<C> extends never ? StoreSelf<P> : Self<P>) => Implementation<C, Ctx<P>>\n\t: (params: ParamsOf<C>, principal: P, self: Self<P>) => Implementation<C, Ctx<P>>;\n\n/** No declarations of a kind: the shared empty list. */\nconst NONE: readonly never[] = [];\n\n/** Running work of one kind (calls, routine calls, job invocations), with the bookkeeping each runs once. */\ntype Work = Map<Promise<unknown>, (() => void) | undefined>;\n\n/** Its routines once started: aborted when they stop (its seal, a reload's handover or restart), and their running calls. */\ntype RoutineRun = { readonly abort: AbortController; readonly calls: Work };\n\n/**\n * What a reload did to an attempt: `started` (a reload started it), `handedOver` (a swap: its jobs are the new\n * attempt's, its invocations finish on their own), `callsDrained` (a swap or restart waited for its calls: its end's\n * drain does not again), `routinesStopped` (its routines stopped, and do not start late after a handover).\n */\ntype Reloaded = { started: boolean; handedOver: boolean; callsDrained: boolean; routinesStopped: boolean };\n\n/** A first dependency check that did not park: the shared answer. */\nconst NOT_PARKED = { done: true, cause: undefined } as const;\n\n/** No running work: the shared empty map. */\nconst NO_WORK: ReadonlyMap<Promise<unknown>, (() => void) | undefined> = new Map();\n\n/** Runs the bookkeeping of the work still in `work` (stuck past the drain) and forgets it. */\nfunction cleanUp(work: Work | undefined): void {\n\tif (work === undefined) return;\n\tfor (const [running, cleanup] of work) {\n\t\twork.delete(running);\n\t\tcleanup?.();\n\t}\n}\n\n/** An attempt's registry reads, contributions and wake signals, and its writables (slice 8). */\ntype RegistryDeclarations = {\n\t/** Releases its registry reads (with its references): a read keeps an older version's mapping. */\n\treadonly reads: (() => void)[];\n\t/** Its wake signals (`self.retryOn`), handed to its object right after the factory. */\n\treadonly retrySources: RetrySource[];\n\t/** Its writables, whose watches end with it. */\n\treadonly writables: { detach(error: Error): void }[];\n\t/** Its contributions as declared, resolved during activation into `contributions`. */\n\treadonly declared: { readonly registry: Registry<unknown, unknown>; readonly value: unknown }[];\n\tcontributions: readonly RegistryContribution[];\n};\n\n/** How an attempt's activation ended. */\ntype Activation =\n\t| { readonly kind: \"live\" }\n\t| { readonly kind: \"failed\"; readonly cause: FailureCause }\n\t| { readonly kind: \"ended\"; readonly error: ChordError };\n\n/** How an activation that did not go live ended. */\ntype NotLive = Exclude<Activation, { readonly kind: \"live\" }>;\n\n/** The error of an object, or a getter, that waited `ms` without the object going live. */\nexport function notLive(label: string, ms: number): ChordError {\n\treturn new ChordError({ code: \"unavailable\", message: `${label}: did not become live within ${ms} ms` });\n}\n\n/**\n * One attempt of an object. Activation: factory, documents hydrated (the object's slots), references bound, then parked\n * until every dependency is live (no timer: the deadline paused), then its own steps: natives opened one after\n * another, followed sources attached, members checked, derives computed; bounded by the host's `readyTimeout`.\n * Ending: sealed at once (calls aborted, its transactions refused and the one holding the line discarded, its job\n * invocations cut off), then the drain, the closes in reverse, derives detached; its object releases its references.\n * Documents and job runs stay on the object.\n */\nexport class Attempt implements StoreSelf, KeyDeclarer, RegistryWaiter {\n\treadonly #object: ChordObject;\n\t/** The type its object was served as when it was made: its provider's `accepts` map its older consumers. */\n\treadonly #served: Served;\n\t/** Its shared mappings for the consumers of older versions (Q10), by version; made by the first. */\n\t#adapted: Map<number, AdaptedMembers> | undefined;\n\t/** The object's context: the natives' closes run under it. */\n\treadonly #context: Context;\n\t/** Aborted when the attempt is abandoned or ends: openers, activation's waits and calls run under its signal. */\n\treadonly #abort = new AbortController();\n\t/** The object's context under this attempt's signal. */\n\treadonly #opening: Context;\n\t/** The seal token its handles and transactions carry (the seal fence). */\n\treadonly #token = new SealToken();\n\t/** Its routines once they started (most attempts have none). */\n\t#routineRun: RoutineRun | undefined;\n\t/** The documents it declared, by name: \"declared twice\" is per attempt. */\n\treadonly #declared = new Map<string, AnyDefinition>();\n\t/** Its factory's `at(key)` pins: the object holds them from its factory's return to the next one's (rule 6). */\n\treadonly #pins: (() => void)[] = [];\n\t#declaring = false;\n\t/** Set once it went live: its derives' failures are reported from then on (`derive_failed`). */\n\t#isLive = false;\n\t/** The checked implementation and, for a remote object, its variant, once activation checked them. */\n\t#members: Members | undefined;\n\t#variant: string | undefined;\n\treadonly #derives: Derive[] = [];\n\t/** Its followed sources, attached in declaration order after the natives. */\n\treadonly #follows: FollowSource[] = [];\n\treadonly #routines = new Routines();\n\treadonly #jobs = new Map<string, Job>();\n\t/** The tables it declared, by name. */\n\treadonly #tables = new Map<string, TableHandle>();\n\t/** References this attempt declared with `self.get` (params checked), bound during activation. */\n\treadonly #references: { readonly binding: Binding; readonly contract: Contract; readonly params: CheckedParams }[] =\n\t\t[];\n\t/**\n\t * Its dependencies (`self.get` references and `self.registry` values) in declaration order: the parked cause and\n\t * `parked_long` name the first that blocks. Made by the first; let go after the dependency check (a live attempt\n\t * keeps none).\n\t */\n\t#dependencies: Dependency[] | undefined;\n\treadonly #natives: NativeSlot[] = [];\n\t/**\n\t * Running calls' handlers, routine calls and job runs, each with its bookkeeping (call counts, `ctx.get`\n\t * references): an ending attempt waits for them (the drain); the bookkeeping runs once, when its work settles or at\n\t * teardown for work stuck past the drain (decision \"The seal fence\" (4)). One map and one reaction per piece of work:\n\t * the call path costs no more than before the cleanups.\n\t */\n\treadonly #running: Work = new Map();\n\t/**\n\t * Its running job invocations, as `#running`: the drain at its end waits for them; a swap does not (they finish on\n\t * their old code, slice 7b §8). Made by the first.\n\t */\n\t#runs: Work | undefined;\n\t/** What activation returns once the attempt was abandoned: a timeout, a cycle through its object, or its end. */\n\t#abandoned: NotLive | undefined;\n\t/** Its dependencies while it is parked on them (the dependency check); `undefined` otherwise. */\n\t#parked: readonly Dependency[] | undefined;\n\t/** A dependency changed since the last check: the parked attempt checks again (one check per batch of changes). */\n\t#moved = false;\n\t/** What a parked attempt waiting for a change waits on; resolved after the change's batch. */\n\t#changed: PromiseWithResolvers<void> | undefined;\n\t/** A followed source's end while this attempt activated: it fails as it goes live (if its activation returned). */\n\t#endedEarly: ChordError | undefined;\n\t/** Its registry reads, contributions, wake signals and writables, made by the first: most attempts have none. */\n\t#registryDeclarations: RegistryDeclarations | undefined;\n\t/**\n\t * Its first dependency check, for a reload (its report, a swap's handover): waited for by someone, or done with why\n\t * it parked (`undefined`: it did not). Made by the first who asks or by the check.\n\t */\n\t#check:\n\t\t| { readonly done: false; readonly waiting: PromiseWithResolvers<FailureCause | undefined> }\n\t\t| { readonly done: true; readonly cause: FailureCause | undefined }\n\t\t| undefined;\n\t/** What a reload did to it, made by the first such step (most attempts never meet one). */\n\t#reloaded: Reloaded | undefined;\n\n\tconstructor(object: ChordObject, context: Context) {\n\t\tthis.#object = object;\n\t\tthis.#served = object.served;\n\t\tthis.#context = context;\n\t\tthis.#opening = withAbortSignal(this.#abort.signal, context);\n\t}\n\n\tstate<D extends StateDefinition<JsonObject, boolean, boolean>>(definition: D): HandleOf<D> {\n\t\tthis.#assertDeclaring(\"state\");\n\t\tconst what = `state \"${definition.name}\"`;\n\t\tif (this.#declared.has(definition.name)) throw new Error(`${this.#object.label}: ${what} is declared twice`);\n\t\tif (definition.persist) {\n\t\t\tthis.#assertPersistable(what);\n\t\t\tthis.#object.claimDocuments(\"chord\");\n\t\t}\n\t\tthis.#declared.set(definition.name, definition);\n\t\treturn this.#object.documents.declare(definition, this.#token, this);\n\t}\n\n\t/** `handle.at(key)`: pins `key` of `slot` while this attempt's factory's pins are held, and returns its source. */\n\tat(slot: KeyedSlot, key: string): KeySource {\n\t\tthis.#assertDeclaring(\"state(...).at\");\n\t\tthis.#pins.push(slot.pin(key, this.#opening));\n\t\treturn slot.source(key);\n\t}\n\n\ttable<C extends Columns, K extends readonly string[]>(definition: TableDefinition<C, K>): Table<C, K> {\n\t\tthis.#assertDeclaring(\"table\");\n\t\tconst object = this.#object;\n\t\tconst { served, label } = object;\n\t\tconst store = this.#assertPersistable(`table \"${definition.name}\"`);\n\t\tif (this.#tables.has(definition.name)) throw new Error(`${label}: table \"${definition.name}\" is declared twice`);\n\t\tconst sqlName = tableSqlName(served.contract.name, definition.name);\n\t\tobject.claimTable(sqlName);\n\t\tconst owner = {\n\t\t\tlabel,\n\t\t\tscope: object.documents,\n\t\t\tassertLive: () => object.documents.assertLive(),\n\t\t\tfail: (error: ChordError) => object.failLive(this, { kind: \"broken\", error }),\n\t\t};\n\t\t// The handle's rows are the definition's, typed by `C` and `K`.\n\t\tconst handle = new TableHandle(definition as unknown as TableDefinition, sqlName, store, owner);\n\t\tthis.#tables.set(definition.name, handle);\n\t\treturn handle as unknown as Table<C, K>;\n\t}\n\n\tderive<const S extends readonly (Watchable<unknown> | NativeWatchable<unknown>)[], T extends JsonValue>(\n\t\tsources: S,\n\t\tcompute: (\n\t\t\tvalues: {\n\t\t\t\treadonly [I in keyof S]: S[I] extends Watchable<infer V>\n\t\t\t\t\t? V\n\t\t\t\t\t: S[I] extends NativeWatchable<infer V>\n\t\t\t\t\t\t? V\n\t\t\t\t\t\t: never;\n\t\t\t},\n\t\t) => T,\n\t): Watchable<T> {\n\t\tthis.#assertDeclaring(\"derive\");\n\t\t// The values are the sources' values, in order; the result is `T`.\n\t\tconst derive = new Derive(sources, compute as (values: readonly unknown[]) => T, this.#object.host.batch);\n\t\tthis.#derives.push(derive);\n\t\treturn derive as unknown as Watchable<T>;\n\t}\n\n\tget<C extends Contract>(Type: C, params: ParamsOf<C>): Reference<C> {\n\t\tthis.#assertDeclaring(\"get\");\n\t\tconst { host } = this.#object;\n\t\tconst checked = checkParams(Type, params, this.#opening);\n\t\tconst binding = host.reference(Type, this.#object, this.#caller(), {});\n\t\tthis.#references.push({ binding, contract: Type, params: checked });\n\t\tthis.#dependencies ??= [];\n\t\tthis.#dependencies.push({ kind: \"reference\", binding });\n\t\t// The binding was built from `Type`'s members.\n\t\treturn binding.reference as Reference<C>;\n\t}\n\n\tregistry<C, V>(R: Registry<C, V>): RegistryValue<V> {\n\t\tthis.#assertDeclaring(\"registry\");\n\t\tconst value = this.#object.host.registryRecord(R.name).value(R.version);\n\t\tthis.#dependencies ??= [];\n\t\tthis.#dependencies.push({ kind: \"registry\", value });\n\t\t// Its values are the composition as `R`'s version has it, `V`.\n\t\treturn value as RegistryValue<V>;\n\t}\n\n\twritable<T>(initial: T): Writable<T> {\n\t\tthis.#assertDeclaring(\"writable\");\n\t\tconst owner = {\n\t\t\tcontext: this.#context,\n\t\t\tassertUsable: () => {\n\t\t\t\tif (this.#token.sealed) throw this.#object.ended();\n\t\t\t},\n\t\t};\n\t\tconst writable = new WritableSource(initial, owner, this.#object.host.batch);\n\t\tthis.#declarations().writables.push(writable);\n\t\treturn writable;\n\t}\n\n\tretryOn(...sources: readonly (Watchable<unknown> | NativeWatchable<unknown>)[]): void {\n\t\tthis.#assertDeclaring(\"retryOn\");\n\t\tconst { retrySources } = this.#declarations();\n\t\tfor (const source of sources) retrySources.push(retrySource(source, this.#object.label));\n\t}\n\n\tcontribute<C>(R: Registry<C, unknown>, value: Contribution<C>): void {\n\t\tthis.#assertDeclaring(\"contribute\");\n\t\tconst { served, label } = this.#object;\n\t\t// R21: the types allow it only to host-lifetime objects; plugin code is bundled without type checks.\n\t\tif (served.kind !== \"local\" || !served.hostLifetime) {\n\t\t\tthrow new Error(`${label}: self.contribute is valid only in a local type with empty params`);\n\t\t}\n\t\tconst { declared } = this.#declarations();\n\t\tif (declared.some(({ registry }) => registry.name === R.name)) {\n\t\t\tthrow new Error(`${label}: registry ${R.name} is contributed to twice`);\n\t\t}\n\t\tdeclared.push({ registry: R as Registry<unknown, unknown>, value });\n\t}\n\n\topen<T>(\n\t\topen: (context: Context) => Promise<T>,\n\t\tclose: (value: T, reason: NativeCloseReason, context: Context) => void | Promise<void>,\n\t\toptions: NativeOptions = {},\n\t): Native<T> {\n\t\tthis.#assertDeclaring(\"open\");\n\t\tconst { host, label } = this.#object;\n\t\tconst closeTimeout = options.closeTimeout ?? host.timeouts.close;\n\t\tconst owner = {\n\t\t\tobject: label,\n\t\t\tposition: this.#natives.length + 1,\n\t\t\tcontext: this.#context,\n\t\t\treport: (error: HostError) => host.report(error),\n\t\t};\n\t\tconst native = new NativeHandle(open, close, closeTimeout, owner);\n\t\tthis.#natives.push(native);\n\t\treturn native;\n\t}\n\n\ttx<R>(fn: (tx: Tx) => R | Promise<R>, context: Context): Promise<R> {\n\t\treturn this.#object.documents.tx(fn, this.#token, context);\n\t}\n\n\tfollow<T>(attach: FollowAttach<T>): Watchable<T> {\n\t\tthis.#assertDeclaring(\"follow\");\n\t\tconst object = this.#object;\n\t\tconst owner = { label: object.label, context: this.#context, ended: (end: WatchEnd) => this.#followEnded(end) };\n\t\t// The source holds what the runtime gives it, `T`, as Chord's JSON sources do.\n\t\tconst source = new FollowSource(attach as unknown as FollowAttach<JsonValue>, owner, object.host.batch);\n\t\tthis.#follows.push(source);\n\t\treturn source as unknown as Watchable<T>;\n\t}\n\n\ton<T>(source: Watchable<T>, fn: OnHandler<T>): void;\n\ton<T>(source: NativeWatchable<T>, fn: OnNativeHandler<T>): void;\n\ton(source: Watchable<unknown> | NativeWatchable<unknown>, fn: (...args: never[]) => void | Promise<void>): void {\n\t\tthis.#assertDeclaring(\"on\");\n\t\tthis.#routines.on(source, fn);\n\t}\n\n\tonLive(fn: OnLiveHandler): void {\n\t\tthis.#assertDeclaring(\"onLive\");\n\t\tthis.#routines.onLive(fn);\n\t}\n\n\tjob<A, R, S>(definition: JobDefinition<A, R, S>, implementation: JobImplementation<A, R, S>): JobHandle<A, R, S> {\n\t\tthis.#assertDeclaring(\"job\");\n\t\tconst object = this.#object;\n\t\tif (this.#jobs.has(definition.name)) {\n\t\t\tthrow new Error(`${object.label}: job \"${definition.name}\" is declared twice`);\n\t\t}\n\t\tif (definition.persist !== undefined) {\n\t\t\tthis.#assertPersistable(`job \"${definition.name}\"`);\n\t\t\tobject.claimDocuments(\"chord.jobs\");\n\t\t\tobject.claimDocuments(\"chord.job-states\");\n\t\t}\n\t\tconst owner = {\n\t\t\thost: object.host,\n\t\t\tcaller: this.#caller(),\n\t\t\tcontext: this.#context,\n\t\t\tsignal: this.#abort.signal,\n\t\t\ttoken: this.#token,\n\t\t\tdocuments: object.documents,\n\t\t\tadmit: (running: Promise<unknown>, cleanup?: () => void) => this.#admit(this.#running, running, cleanup),\n\t\t\tadmitRun: (running: Promise<unknown>, cleanup: () => void) => {\n\t\t\t\tthis.#runs ??= new Map();\n\t\t\t\tthis.#admit(this.#runs, running, cleanup);\n\t\t\t},\n\t\t};\n\t\t// The job keeps its runs as JSON and calls the implementation with them; the handle types them again.\n\t\tconst records = object.jobRecords(definition as JobDefinition<unknown, unknown, unknown>);\n\t\tconst job = new Job(records, implementation as unknown as AnyJobImplementation, owner);\n\t\tthis.#jobs.set(definition.name, job);\n\t\treturn job as unknown as JobHandle<A, R, S>;\n\t}\n\n\t/**\n\t * Activates once `ending` (the previous instance's) has finished; `readyTimeout` bounds both (an attempt abandoned\n\t * while it waits has opened nothing).\n\t */\n\tasync activate(ending: Promise<void> | undefined): Promise<Activation> {\n\t\tconst { ready } = this.#object.host.timeouts;\n\t\tconst deadline = new Deadline(ready, () => {\n\t\t\tthis.abandon({ kind: \"failed\", cause: { kind: \"transient\", error: notLive(this.#object.label, ready) } });\n\t\t});\n\t\ttry {\n\t\t\tif (ending !== undefined) {\n\t\t\t\ttry {\n\t\t\t\t\tawait awaitWithContext(ending, this.#opening);\n\t\t\t\t} catch {\n\t\t\t\t\t// An ending never rejects: only an abandonment (the deadline) ends this wait early.\n\t\t\t\t\treturn this.#abandoned!;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn await this.#activate(deadline);\n\t\t} finally {\n\t\t\tdeadline.clear();\n\t\t\t// Ended before its first dependency check (its factory threw, it was abandoned): nothing parked.\n\t\t\tthis.#settleCheck(undefined);\n\t\t}\n\t}\n\n\t/** Abandons the activation with `outcome` (once): its waits stop and the openers' contexts are aborted. */\n\tabandon(outcome: NotLive): void {\n\t\tif (this.#abandoned !== undefined) return;\n\t\tthis.#abandoned = outcome;\n\t\tconst reason = outcome.kind === \"ended\" ? outcome.error : outcome.cause.error;\n\t\tthis.#abort.abort(reason);\n\t\tthis.#stopRoutines(reason);\n\t}\n\n\t/**\n\t * A followed runtime ended its observer (R4): `failed` fails this attempt `transient`, live or activating; `ended`\n\t * does only while it activates (it would go live over a source that ended). An activation that already returned\n\t * fails as it goes live.\n\t */\n\t#followEnded(end: WatchEnd): void {\n\t\tif (end.kind === \"ended\" && this.#isLive) return;\n\t\tconst { label } = this.#object;\n\t\tconst error =\n\t\t\tend.kind === \"failed\"\n\t\t\t\t? asChordError(end.error, label)\n\t\t\t\t: new ChordError({ code: \"unavailable\", message: `${label}: a followed source ended while it activated` });\n\t\tif (this.#isLive) {\n\t\t\tthis.#object.failLive(this, { kind: \"transient\", error });\n\t\t\treturn;\n\t\t}\n\t\tthis.#endedEarly ??= error;\n\t\tthis.abandon({ kind: \"failed\", cause: { kind: \"transient\", error } });\n\t}\n\n\t/**\n\t * The object went live: its jobs take starts and its routines start, in this turn; both stop when it is sealed.\n\t * After a swap (`previous`, the attempt it replaced) its routines start once the previous attempt's routine calls\n\t * finished (the handover per object, §14), calls never wait for it.\n\t */\n\tlive(previous?: Attempt): void {\n\t\tthis.#isLive = true;\n\t\tconst early = this.#endedEarly;\n\t\tif (early !== undefined) {\n\t\t\tthis.#object.failLive(this, { kind: \"transient\", error: early });\n\t\t\treturn;\n\t\t}\n\t\tfor (const job of this.#jobs.values()) job.live();\n\t\tif (this.#routines.empty) return;\n\t\tif (previous === undefined) this.#startRoutines();\n\t\telse void previous.handOverRoutines().then(() => this.#startRoutines());\n\t}\n\n\t/** Starts its routines, unless it was sealed meanwhile. */\n\t#startRoutines(): void {\n\t\tif (this.#abandoned !== undefined || this.#reloaded?.routinesStopped === true) return;\n\t\tconst { host, label } = this.#object;\n\t\tconst run: RoutineRun = { abort: new AbortController(), calls: new Map() };\n\t\tthis.#routineRun = run;\n\t\tthis.#routines.start({\n\t\t\tlabel,\n\t\t\thost,\n\t\t\tcaller: this.#caller(),\n\t\t\tcontext: withAbortSignal(run.abort.signal, this.#context),\n\t\t\tadmit: (running, cleanup) => this.#admit(run.calls, running, cleanup),\n\t\t});\n\t}\n\n\t/** Its routines stop with `reason` (or may not start any more: `#startRoutines` asks the abandonment too). */\n\t#stopRoutines(reason: unknown): void {\n\t\tthis.#routineRun?.abort.abort(reason);\n\t}\n\n\t/**\n\t * A reload swaps this live attempt out (slice 7b §5): its routines stop, its jobs are handed over (their running\n\t * invocations finish on this code), it takes no new starts; its calls run on until `drainCalls` settled.\n\t */\n\thandOver(): void {\n\t\tthis.#reload().handedOver = true;\n\t\tthis.stopRoutines();\n\t\tfor (const job of this.#jobs.values()) job.handOver();\n\t}\n\n\t/** Its routines stop (their ctx aborted); their running calls are waited for by the drain or the handover. */\n\tstopRoutines(): void {\n\t\tthis.#reload().routinesStopped = true;\n\t\tthis.#stopRoutines(\n\t\t\tnew ChordError({ code: \"released\", reason: \"ended\", message: `${this.#object.label}: reloaded` }),\n\t\t);\n\t}\n\n\t/**\n\t * The new attempt's routines may start: once this attempt's routine calls finished, bounded by `closeTimeout` (a\n\t * stuck one is reported `drain_timeout`; the whole attempt is sealed by then: the swap's retirement drains its\n\t * calls and routine calls on the same bound from the swap's start, then seals it, so a stuck call's later commit\n\t * is refused `released`).\n\t */\n\tasync handOverRoutines(): Promise<void> {\n\t\tconst { host, label } = this.#object;\n\t\tconst calls = this.#routineRun?.calls ?? NO_WORK;\n\t\tif ((await drained(calls.keys(), calls.size, host.timeouts.close)) === \"timeout\") {\n\t\t\thost.report({ kind: \"drain_timeout\", object: label });\n\t\t}\n\t}\n\n\t/**\n\t * Waits for its running calls and routine calls (not its job invocations), bounded by `closeTimeout`\n\t * (`drain_timeout` reported): a reload's swap or restart lets them finish before the seal. Its end's drain then\n\t * waits for them no more.\n\t */\n\tasync drainCalls(): Promise<void> {\n\t\tconst { host, label } = this.#object;\n\t\tconst calls = [...this.#running.keys(), ...(this.#routineRun?.calls ?? NO_WORK).keys()];\n\t\tthis.#reload().callsDrained = true;\n\t\tif ((await drained(calls, calls.length, host.timeouts.close)) === \"timeout\") {\n\t\t\thost.report({ kind: \"drain_timeout\", object: label });\n\t\t}\n\t}\n\n\t/** A reload started it: once live, its object retries its blocked job runs (slice 7b §8). */\n\tstartedByReload(): void {\n\t\tthis.#reload().started = true;\n\t}\n\n\t/** Whether a reload started it. */\n\tget reloadStarted(): boolean {\n\t\treturn this.#reloaded?.started === true;\n\t}\n\n\t/** What a reload did to it, made by the first such step. */\n\t#reload(): Reloaded {\n\t\tthis.#reloaded ??= { started: false, handedOver: false, callsDrained: false, routinesStopped: false };\n\t\treturn this.#reloaded;\n\t}\n\n\t/** Whether its factory declared job `name`. */\n\tdeclaresJob(name: string): boolean {\n\t\treturn this.#jobs.has(name);\n\t}\n\n\t/** Whether its factory opens natives (`self.open`): a reload restarts it instead of swapping it. */\n\tget opensNatives(): boolean {\n\t\treturn this.#natives.length > 0;\n\t}\n\n\t/**\n\t * Its first dependency check: why it parked (`parkedCause`), `undefined` when it went on (its dependencies live) or\n\t * its activation ended before (a reload's report and a swap's handover wait for it).\n\t */\n\tget checked(): Promise<FailureCause | undefined> {\n\t\tconst check = this.#check;\n\t\tif (check?.done === true) return Promise.resolve(check.cause);\n\t\tif (check !== undefined) return check.waiting.promise;\n\t\tconst waiting = Promise.withResolvers<FailureCause | undefined>();\n\t\tthis.#check = { done: false, waiting };\n\t\treturn waiting.promise;\n\t}\n\n\t/** Its first dependency check is done: parked for `cause`, or not (once). */\n\t#settleCheck(cause: FailureCause | undefined): void {\n\t\tconst check = this.#check;\n\t\tif (check?.done === true) return;\n\t\t// Not parked (most attempts): the shared answer, nothing made.\n\t\tthis.#check = cause === undefined ? NOT_PARKED : { done: true, cause };\n\t\tcheck?.waiting.resolve(cause);\n\t}\n\n\t/** Whether it is parked on its dependencies (the dependency check runs). */\n\tget isParked(): boolean {\n\t\treturn this.#parked !== undefined;\n\t}\n\n\t/** Its contributions, resolved by its activation: in the registries' tables while its object is live. */\n\tget contributions(): readonly RegistryContribution[] {\n\t\treturn this.#registryDeclarations?.contributions ?? NONE;\n\t}\n\n\t/** The variant a remote object's factory chose; `undefined` for a local object. */\n\tget variant(): string | undefined {\n\t\treturn this.#variant;\n\t}\n\n\t/** The state members, as Chord follows them. */\n\tget stateMembers(): ReadonlyMap<string, DeriveSource> {\n\t\treturn this.#members!.state;\n\t}\n\n\t/**\n\t * Calls a method for `caller`, bound at `version`: a method outside the variant fails `invalid/member` first (for an\n\t * older version after its table's checks), then the arguments are checked against that version (L1) and, for an\n\t * older one (Q10), mapped forwards, the handler's result mapped back, or the provider's replacement of a removed\n\t * method run instead; a refused method fails `contract_mismatch`. The handler runs under a ctx aborted by the caller\n\t * and by this attempt's end, admitted to the drain before it runs. Either rejects the caller at once; the handler\n\t * runs on, its transactions refused, and the drain waits for it. Its `ctx.get` references are released when it\n\t * settles. Measured choices (fix round 2): one body for every version (with the shared part in a helper method, a\n\t * call over a link was about 10% slower in the links benchmark), and no `async` (a check's throw is returned as a\n\t * rejection; as an async function a local call allocated about 250 B more).\n\t */\n\tcall(method: string, args: unknown, context: Context, caller: Caller, version: number): Promise<unknown> {\n\t\tlet checked: ReturnType<typeof checkArgs>;\n\t\tlet handler: Method | undefined;\n\t\ttry {\n\t\t\tcontext.abortSignal?.throwIfAborted();\n\t\t\tconst { served } = this.#object;\n\t\t\tconst own = this.#members!.methods.get(method);\n\t\t\tif (own === undefined && version === served.contract.version) throw this.#noMethod(method);\n\t\t\tchecked = checkArgs(served.provider, method, args, version, context);\n\t\t\tconst call = checked.kind === \"call\" ? checked.call : undefined;\n\t\t\thandler = call !== undefined ? (callArgs, ctx) => call(callArgs as Value, ctx) : own;\n\t\t\tif (handler === undefined) throw this.#noMethod(method);\n\t\t} catch (error) {\n\t\t\treturn Promise.reject(error);\n\t\t}\n\t\tconst { host, served } = this.#object;\n\t\tconst linked = withLinkedAbortSignal(this.#abort.signal, context);\n\t\tconst callContext = linked.context;\n\t\t// A local object's handlers act as the host, its principal and its incarnation (§4); a remote one's as their\n\t\t// caller. The caller stays the reference's (presence, §19).\n\t\tconst acting = served.kind === \"remote\" ? caller : { principal: host.principal, incarnation: host.incarnation };\n\t\tconst ctx = new CallContext(callContext, acting, host);\n\t\t// Admitted to the drain before the handler runs: the handler may end its own object before it returns.\n\t\tconst running = Promise.withResolvers<unknown>();\n\t\thost.count(\"calls\", 1);\n\t\tthis.#admit(this.#running, running.promise, () => {\n\t\t\thost.count(\"calls\", -1);\n\t\t\tlinked.release();\n\t\t\tctx.settle();\n\t\t});\n\t\t// Plugin code, not type-checked: a synchronous throw or a plain value becomes the promise. Constants: the closure\n\t\t// captures them, not the `let`s above.\n\t\tconst run = handler;\n\t\tconst runArgs = checked.args;\n\t\t(async () => run(runArgs, ctx))().then(running.resolve, running.reject);\n\t\tconst settled = awaitWithContext(running.promise, callContext);\n\t\tif (checked.kind === \"call\" || checked.result === undefined) return settled;\n\t\t// The handler's result is the current version's: its mapping back is the provider's (results are not validated).\n\t\tconst back = checked.result;\n\t\treturn settled.then((result) => back(result as Value));\n\t}\n\n\t/** The `invalid/member` error of a method outside the variant. */\n\t#noMethod(method: string): ChordError {\n\t\treturn invalid(\"member\", `${this.#object.label}${this.#inVariant()} has no method \"${method}\"`);\n\t}\n\n\t/**\n\t * The keyed member `member`'s ultimate slot (slice 6a §12, rule 22: through re-exposures); an unknown one fails\n\t * `invalid/member`.\n\t */\n\tkeyedMember(member: string): KeyedSlot {\n\t\tconst keyed = this.#members!.keyed.get(member);\n\t\tif (keyed === undefined) throw invalid(\"member\", `${this.#object.label} has no keyed member \"${member}\"`);\n\t\treturn keyed.kind === \"own\" ? keyed.slot : keyed.binding.keyedSlot(keyed.member);\n\t}\n\n\t/** The keyed members as checked: what each is (`KeyedBinding`), for the keys its object holds across attempts. */\n\tget keyedMembers(): ReadonlyMap<string, KeyedBinding> {\n\t\treturn this.#members!.keyed;\n\t}\n\n\t/**\n\t * State member `member` as a consumer of `version` follows it: its own member at its version, else its shared mapping\n\t * for that version (`AdaptedMembers`); `invalid/member` outside the variant, `contract_mismatch` for a version or\n\t * member its provider refuses.\n\t */\n\tmemberAt(member: string, version: number): DeriveSource {\n\t\tif (version === this.#served.contract.version) return this.member(member);\n\t\treturn this.#adaptedAt(version).member(member);\n\t}\n\n\t/** How a consumer of `version` reads keyed member `member`'s documents: mapped when older (`undefined`: as they are). */\n\tkeyMapping(member: string, version: number): ((current: JsonValue) => JsonValue) | undefined {\n\t\tif (version === this.#served.contract.version) return undefined;\n\t\treturn this.#adaptedAt(version).keyed(member);\n\t}\n\n\t/**\n\t * Pins `key` of keyed member `member` on this instance, loaded (its own slot's document, or the re-exposed reference's\n\t * key), as a consumer of `version` reads it (mapped when older); `release` lets it go.\n\t */\n\tasync pinKey(member: string, key: string, version: number, context: Context): Promise<PinnedKey> {\n\t\tconst keyed = this.#members!.keyed.get(member);\n\t\tif (keyed === undefined) throw invalid(\"member\", `${this.#object.label} has no keyed member \"${member}\"`);\n\t\tconst raw =\n\t\t\tkeyed.kind === \"own\"\n\t\t\t\t? await pinned(keyed.slot, key, context)\n\t\t\t\t: await keyed.binding.pinKey(keyed.member, key, context);\n\t\tif (version === this.#served.contract.version) return raw;\n\t\ttry {\n\t\t\tconst mapped = this.#adaptedAt(version).key(member, raw.source);\n\t\t\treturn {\n\t\t\t\tsource: mapped.source,\n\t\t\t\trelease: () => {\n\t\t\t\t\tmapped.release();\n\t\t\t\t\traw.release();\n\t\t\t\t},\n\t\t\t};\n\t\t} catch (error) {\n\t\t\traw.release();\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\t/** No consumer of `version` is left: its shared mapping goes. */\n\tdropVersion(version: number): void {\n\t\tconst adapted = this.#adapted?.get(version);\n\t\tif (adapted === undefined) return;\n\t\tthis.#adapted!.delete(version);\n\t\tadapted.detach(this.#object.ended());\n\t}\n\n\t/** Its mapping for `version`, made by the first use, reading this instance's own members and provider. */\n\t#adaptedAt(version: number): AdaptedMembers {\n\t\tthis.#adapted ??= new Map();\n\t\tlet adapted = this.#adapted.get(version);\n\t\tif (adapted === undefined) {\n\t\t\tconst { host, label } = this.#object;\n\t\t\tadapted = new AdaptedMembers(\n\t\t\t\t{\n\t\t\t\t\tserved: this.#served,\n\t\t\t\t\tvariant: this.#variant,\n\t\t\t\t\tlabel,\n\t\t\t\t\tbatch: host.batch,\n\t\t\t\t\tmember: (name) => this.member(name),\n\t\t\t\t\treport: (member, error) => host.report({ kind: \"derive_failed\", object: label, member, error }),\n\t\t\t\t},\n\t\t\t\tversion,\n\t\t\t);\n\t\t\tthis.#adapted.set(version, adapted);\n\t\t}\n\t\treturn adapted;\n\t}\n\n\t/** The state member `member`, as Chord follows it; one outside the variant fails `invalid/member`. */\n\tmember(member: string): DeriveSource {\n\t\tconst source = this.#members!.state.get(member);\n\t\tif (source === undefined) {\n\t\t\tthrow invalid(\"member\", `${this.#object.label}${this.#inVariant()} has no state member \"${member}\"`);\n\t\t}\n\t\treturn source;\n\t}\n\n\t/**\n\t * Ends the attempt at once (the seal fence): calls, openers and routines aborted with `error` (their callers\n\t * rejected with it), its transactions refused and the one holding the line discarded, its job invocations cut off\n\t * (an in-memory run ends `aborted` with `runs` as its reason: `reload` for a native restart, slice 7b §8); documents\n\t * stay readable.\n\t */\n\tseal(error: ChordError, runs: CutReason = \"restart\"): void {\n\t\tthis.abandon({ kind: \"ended\", error });\n\t\tconst { documents } = this.#object;\n\t\tdocuments.fence(this.#token);\n\t\tfor (const job of this.#jobs.values()) job.seal(error, runs);\n\t}\n\n\t/**\n\t * Tears a sealed attempt down: waits for its running handlers, routine calls and runs up to the host's\n\t * `closeTimeout` (the drain), then closes its natives in reverse with `reason`. Resolves with the closes that threw.\n\t */\n\tasync close(reason: NativeCloseReason): Promise<CloseFailed[]> {\n\t\tconst { host, label } = this.#object;\n\t\tif ((await this.#drained()) === \"timeout\") host.report({ kind: \"drain_timeout\", object: label });\n\t\t// The close writer: the persisted runs the seal stopped, and the held state changes (slice 6b §4.2).\n\t\tconst handedOver = this.#reloaded?.handedOver === true;\n\t\tif (!handedOver) for (const job of this.#jobs.values()) await job.writeAtClose(this.#context);\n\t\t// Work stuck past the drain keeps running, but no longer counts as a call or holds its `ctx.get` references.\n\t\tcleanUp(this.#running);\n\t\tcleanUp(this.#routineRun?.calls);\n\t\tif (!handedOver) cleanUp(this.#runs);\n\t\tconst failures: CloseFailed[] = [];\n\t\tfor (const native of [...this.#natives].reverse()) {\n\t\t\tconst failure = await native.close(reason);\n\t\t\tif (failure !== undefined) failures.push(failure);\n\t\t}\n\t\treturn failures;\n\t}\n\n\t/**\n\t * The drain at its end, bounded by `closeTimeout`: its running calls (unless a reload's `drainCalls` waited for them\n\t * already), routine calls and job invocations (unless a swap handed its jobs over: they finish on their own).\n\t */\n\t#drained(): Promise<\"settled\" | \"timeout\"> {\n\t\tconst { close } = this.#object.host.timeouts;\n\t\tconst reloaded = this.#reloaded;\n\t\tconst running = reloaded?.callsDrained === true ? NO_WORK : this.#running;\n\t\tconst runs = reloaded?.handedOver === true ? undefined : this.#runs;\n\t\tconst routineCalls = this.#routineRun?.calls;\n\t\t// Most attempts have only calls: no list is made for them.\n\t\tif (routineCalls === undefined && runs === undefined) return drained(running.keys(), running.size, close);\n\t\tconst all = [...running.keys(), ...(routineCalls ?? NO_WORK).keys(), ...(runs ?? NO_WORK).keys()];\n\t\treturn drained(all, all.length, close);\n\t}\n\n\t/**\n\t * Detaches its derives (once their object no longer needs them: reads throw `released`, their watches end), its\n\t * followed sources (their observers detached, their watches ended) and its writables (their watches ended).\n\t */\n\tdetach(): void {\n\t\tconst ended = this.#object.ended();\n\t\tfor (const adapted of this.#adapted?.values() ?? []) adapted.detach(ended);\n\t\tthis.#adapted = undefined;\n\t\tfor (const derive of this.#derives) derive.detach(ended);\n\t\tfor (const follow of this.#follows) follow.detach();\n\t\tconst declarations = this.#registryDeclarations;\n\t\tif (declarations !== undefined) for (const writable of declarations.writables) writable.detach(ended);\n\t}\n\n\t/** Releases its references and registry reads. */\n\treleaseReferences(): void {\n\t\tfor (const { binding } of this.#references) binding.release();\n\t\tconst declarations = this.#registryDeclarations;\n\t\tif (declarations !== undefined) for (const release of declarations.reads.splice(0)) release();\n\t}\n\n\t/** The activation steps; each catches its own failures with their kind (the table in slice 2's spec). */\n\tasync #activate(deadline: Deadline): Promise<Activation> {\n\t\tlet implementation: unknown;\n\t\tlet dependencies: readonly Dependency[] = NONE;\n\t\ttry {\n\t\t\timplementation = this.#declare();\n\t\t\t// Right after the factory, before anything can fail: a failed attempt keeps its wake signals.\n\t\t\tthis.#object.retryOn(this.#registryDeclarations?.retrySources ?? NONE);\n\t\t\tconst { documents } = this.#object;\n\t\t\t// The object holds the pins from now on.\n\t\t\tdocuments.hydrate(this.#declared, this.#pins.splice(0), this.#opening);\n\t\t\tconst loading = documents.load(this.#opening);\n\t\t\tif (loading !== undefined) await loading;\n\t\t\tif (this.#tables.size > 0) await this.#prepareTables(deadline);\n\t\t\t// A persisted job's runs, loaded once per object: rebuilt before anything runs.\n\t\t\tfor (const job of this.#jobs.values()) await job.load(this.#opening);\n\t\t\tconst { host } = this.#object;\n\t\t\tfor (const { binding, contract, params } of this.#references) {\n\t\t\t\thost.bind(binding, contract, params, this.#opening);\n\t\t\t}\n\t\t\t// Once all are bound: a dependency made here may have bound back to this object meanwhile.\n\t\t\tfor (const { binding } of this.#references) {\n\t\t\t\tconst { target } = binding;\n\t\t\t\tif (target !== undefined) this.#object.assertNoCycle(target, this.#opening);\n\t\t\t}\n\t\t\t// Needed only up to the dependency check: a live attempt keeps none.\n\t\t\tdependencies = this.#dependencies ?? NONE;\n\t\t\tthis.#dependencies = undefined;\n\t\t\tfor (const dependency of dependencies) {\n\t\t\t\t// Read from here until its references are released: an older version's mapping is kept meanwhile.\n\t\t\t\tif (dependency.kind === \"registry\") this.#declarations().reads.push(dependency.value.read());\n\t\t\t}\n\t\t} catch (error) {\n\t\t\treturn this.#broken(error);\n\t\t}\n\t\t// Parked only when something is not live yet (most activations find their dependencies live).\n\t\tif ((dependencies.length > 0 && checkDependencies(dependencies).kind !== \"live\") || this.#pinsKeys()) {\n\t\t\tconst parked = await this.#park(dependencies, deadline);\n\t\t\tif (parked !== undefined) return parked;\n\t\t} else {\n\t\t\tthis.#settleCheck(undefined);\n\t\t\t// Its own steps start in a later turn: an object ended in the turn it was made opens nothing.\n\t\t\tawait undefined;\n\t\t}\n\t\treturn this.#ownSteps(implementation);\n\t}\n\n\t/**\n\t * Parks while a dependency is not live (dependency model §3), with no timer: the deadline paused, `parked_long`'s\n\t * report the only clock. Checks at every change of a dependency (after its batch) and shows what it found on its\n\t * object; once all are live, the keys the factory pinned on them are loaded (a failed load parks it `waiting`\n\t * until the next change or a retry). Resolves `undefined` once all are live and pinned, else with how it ends:\n\t * abandoned, or broken (a cycle, an ended dependency).\n\t */\n\tasync #park(dependencies: readonly Dependency[], deadline: Deadline): Promise<NotLive | undefined> {\n\t\tconst object = this.#object;\n\t\tdeadline.pause();\n\t\tthis.#parked = dependencies;\n\t\tobject.waitsFor(dependencies);\n\t\t// Waiters on a registry are woken when its value turns usable or its failure changes.\n\t\tconst waits: (() => void)[] = [];\n\t\tfor (const each of dependencies) if (each.kind === \"registry\") waits.push(each.value.wait(this));\n\t\tconst long = new ParkedLong(object);\n\t\ttry {\n\t\t\tfor (;;) {\n\t\t\t\tthis.#moved = false;\n\t\t\t\tconst check = checkDependencies(dependencies);\n\t\t\t\tif (check.kind !== \"parked\") this.#settleCheck(undefined);\n\t\t\t\tif (check.kind === \"broken\")\n\t\t\t\t\treturn this.#abandoned ?? { kind: \"failed\", cause: { kind: \"broken\", error: check.error } };\n\t\t\t\tif (check.kind === \"live\") {\n\t\t\t\t\tconst pinned = await this.#pinKeys(long);\n\t\t\t\t\tif (this.#abandoned !== undefined) return this.#abandoned;\n\t\t\t\t\t// Changed while the keys loaded: checked again.\n\t\t\t\t\tif (pinned === undefined && !this.#moved) {\n\t\t\t\t\t\t// Its own steps follow: `loading` until its outcome (a failure shows as the failure, not this).\n\t\t\t\t\t\tobject.unparked(this);\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\t\t\t\t\tif (pinned !== undefined) object.parked(this, pinned, true);\n\t\t\t\t} else {\n\t\t\t\t\tobject.parked(this, check.shown, check.firstPass);\n\t\t\t\t\tthis.#settleCheck(parkedCause(check));\n\t\t\t\t\tlong.blockedBy(check.blocker);\n\t\t\t\t}\n\t\t\t\tif (!(await this.#nextChange())) return this.#abandoned!;\n\t\t\t}\n\t\t} finally {\n\t\t\tlong.stop();\n\t\t\tfor (const release of waits) release();\n\t\t\tthis.#parked = undefined;\n\t\t\tobject.waitsFor(NONE);\n\t\t\tdeadline.resume();\n\t\t}\n\t}\n\n\t/**\n\t * Waits for the next change of a dependency (at once when one came during the check); `false` when the attempt was\n\t * abandoned meanwhile (its end, the only thing that stops the wait).\n\t */\n\tasync #nextChange(): Promise<boolean> {\n\t\tif (this.#moved) return true;\n\t\tthis.#changed = Promise.withResolvers();\n\t\ttry {\n\t\t\tawait awaitWithContext(this.#changed.promise, this.#opening);\n\t\t\treturn true;\n\t\t} catch {\n\t\t\treturn false;\n\t\t} finally {\n\t\t\tthis.#changed = undefined;\n\t\t}\n\t}\n\n\t/**\n\t * Loads the keys the factory pinned on its dependencies' keyed members (`at(key)`), each reference's named to `long`\n\t * as the blocker while they load (`failed` when they failed); `undefined` once all are, else what the parked attempt\n\t * shows for the first that failed to load (`waiting` on its reference).\n\t */\n\tasync #pinKeys(long: ParkedLong): Promise<Failed | undefined> {\n\t\tfor (const { binding } of this.#references) {\n\t\t\tconst { label } = binding;\n\t\t\ttry {\n\t\t\t\tconst pinning = binding.pinKeys(this.#opening);\n\t\t\t\tif (pinning === undefined) continue;\n\t\t\t\tlong.blockedBy({ label, state: \"loading\" });\n\t\t\t\tawait pinning;\n\t\t\t} catch (error) {\n\t\t\t\tlong.blockedBy({ label, state: \"failed\" });\n\t\t\t\treturn waitingOn(label, asChordError(error, label));\n\t\t\t}\n\t\t}\n\t\treturn undefined;\n\t}\n\n\t/**\n\t * A dependency of this parked attempt changed (its state, its cause, its first outcome): it checks again after the\n\t * batch that changed it, once however many changed. A change while it checks or loads pinned keys is remembered\n\t * (`#moved`); one outside parking costs a flag.\n\t */\n\tdependencyMoved(): void {\n\t\tif (this.#moved) return;\n\t\tthis.#moved = true;\n\t\tif (this.#changed !== undefined) queueMicrotask(() => this.#changed?.resolve());\n\t}\n\n\t/** A registry it is parked on closed with its host: the parked attempt ends with `error`. */\n\tclosed(error: ChordError): void {\n\t\tthis.abandon({ kind: \"ended\", error });\n\t}\n\n\t/** Whether its factory pinned keys on its dependencies' keyed members (`at(key)`), which load while it is parked. */\n\t#pinsKeys(): boolean {\n\t\tfor (const { binding } of this.#references) if (binding.pinsKeys) return true;\n\t\treturn false;\n\t}\n\n\t/**\n\t * `ref.retry()` on its parked object (`failed { waiting }`): passed on to every failed dependency (a broken or\n\t * transient one retries, a parked one passes it on, a request waiting in an index is left alone), as a step of\n\t * `walk`; then it checks again (a key that failed to load is loaded again).\n\t */\n\tretryDependencies(walk: RetryWalk): void {\n\t\tfor (const dependency of this.#parked ?? NONE) {\n\t\t\tif (dependency.kind === \"reference\" && dependency.binding.refState.kind === \"failed\") {\n\t\t\t\tdependency.binding.retry(walk);\n\t\t\t}\n\t\t}\n\t\tthis.dependencyMoved();\n\t}\n\n\t/**\n\t * The steps after the dependency check (its own: natives, followed sources, the member check, derives, the keys\n\t * references pin on its keyed members), under the deadline. A dependency that leaves `live` meanwhile changes\n\t * nothing (R18 after live).\n\t */\n\tasync #ownSteps(implementation: unknown): Promise<Activation> {\n\t\tfor (const native of this.#natives) {\n\t\t\t// An attempt abandoned before this open (ended while it waited) closed its natives already: none opens late.\n\t\t\tif (this.#abandoned !== undefined) return this.#abandoned;\n\t\t\ttry {\n\t\t\t\tawait awaitWithContext(native.open(this.#opening), this.#opening);\n\t\t\t} catch (error) {\n\t\t\t\treturn this.#abandoned ?? { kind: \"failed\", cause: openFailure(error, this.#object.label) };\n\t\t\t}\n\t\t}\n\t\tfor (const follow of this.#follows) {\n\t\t\tif (this.#abandoned !== undefined) return this.#abandoned;\n\t\t\ttry {\n\t\t\t\tawait awaitWithContext(follow.attach(this.#opening), this.#opening);\n\t\t\t} catch (error) {\n\t\t\t\tconst cause: FailureCause = { kind: \"transient\", error: asChordError(error, this.#object.label) };\n\t\t\t\treturn this.#abandoned ?? { kind: \"failed\", cause };\n\t\t\t}\n\t\t}\n\t\tlet members: Members;\n\t\ttry {\n\t\t\tconst checked = checkImplementation(this.#object.served.contract, implementation);\n\t\t\tmembers = checked.members;\n\t\t\tthis.#members = members;\n\t\t\tthis.#variant = checked.variant;\n\t\t\tif (this.#registryDeclarations !== undefined)\n\t\t\t\tthis.#registryDeclarations.contributions = this.#resolveContributions(this.#registryDeclarations);\n\t\t\tconst { host, label } = this.#object;\n\t\t\tattachDerives(this.#derives, members.state, (member) => (error) => {\n\t\t\t\t// During activation a throwing derive fails the attempt, which `activation_failed` reports alone.\n\t\t\t\tif (!this.#isLive) return;\n\t\t\t\thost.report({ kind: \"derive_failed\", object: label, ...(member === undefined ? {} : { member }), error });\n\t\t\t});\n\t\t\tfor (const derive of this.#derives) void derive.value;\n\t\t} catch (error) {\n\t\t\treturn this.#broken(error);\n\t\t}\n\t\treturn this.#abandoned ?? { kind: \"live\" };\n\t}\n\n\t/** Its declared contributions, as Chord follows them (its references are live now), by its plugin and type. */\n\t#resolveContributions({ declared }: RegistryDeclarations): readonly RegistryContribution[] {\n\t\tconst { served, host } = this.#object;\n\t\tconst contributor = { plugin: served.plugin, type: served.contract.name };\n\t\treturn declared.map(({ registry, value }) =>\n\t\t\tcontributionOf(host.registryRecord(registry.name), contributor, registry.version, value),\n\t\t);\n\t}\n\n\t/**\n\t * Brings the declared tables to their definitions before the references are bound (slice 6a §9): created fresh or\n\t * migrated eagerly, with the `readyTimeout` deadline paused meanwhile (resumed with the budget it had left).\n\t */\n\tasync #prepareTables(deadline: Deadline): Promise<void> {\n\t\tconst handles = [...this.#tables.values()];\n\t\tconst tables = handles.map(({ definition, sql }) => ({ definition, table: sql.table }));\n\t\tconst fence = { admit: () => !this.#token.sealed && this.#abandoned === undefined, adopt: () => {} };\n\t\tdeadline.pause();\n\t\ttry {\n\t\t\tawait prepareTables(tables, handles[0]!.store, fence, this.#object.label, this.#opening);\n\t\t} finally {\n\t\t\tdeadline.resume();\n\t\t}\n\t}\n\n\t/**\n\t * Runs the factory with declarations open; the member check establishes what it returned. A throwing factory\n\t * releases its pins.\n\t */\n\t#declare(): unknown {\n\t\tthis.#declaring = true;\n\t\ttry {\n\t\t\tconst { served, params, principal } = this.#object;\n\t\t\tif (served.kind === \"local\") return served.factory(params, this);\n\t\t\t// A remote object's identity has its principal.\n\t\t\treturn served.factory(params, principal!, this);\n\t\t} catch (error) {\n\t\t\tfor (const release of this.#pins) release();\n\t\t\tthrow error;\n\t\t} finally {\n\t\t\tthis.#declaring = false;\n\t\t}\n\t}\n\n\t/**\n\t * Persisted data needs a stable identity (P3: a `local` type with empty params, also checked by the types) and the\n\t * host's store; returns the store.\n\t */\n\t#assertPersistable(what: string): ChordStore {\n\t\tconst { host, served, label } = this.#object;\n\t\tif (served.kind !== \"local\" || contractData(served.contract).params.fields.length > 0) {\n\t\t\tthrow new Error(`${label}: ${what}: persist needs a stable identity (a local type with empty params)`);\n\t\t}\n\t\tif (host.store === undefined) throw new Error(`${label}: ${what}: persist needs a store`);\n\t\treturn host.store;\n\t}\n\n\t/**\n\t * Adds `running` to `work` (its calls, routine calls or job invocations: the drain), with `cleanup` run once: when\n\t * it settles, or at teardown if it never does.\n\t */\n\t#admit(work: Work, running: Promise<unknown>, cleanup?: () => void): void {\n\t\twork.set(running, cleanup);\n\t\t// Out of the map already: the teardown ran the cleanup.\n\t\tconst settled = (): void => {\n\t\t\tif (work.delete(running)) cleanup?.();\n\t\t};\n\t\trunning.then(settled, settled);\n\t}\n\n\t/** Whom this object's own work acts for: a remote object as its principal, a local one as the host; from this host. */\n\t#caller(): Caller {\n\t\tconst { host, served, principal } = this.#object;\n\t\treturn { principal: served.kind === \"remote\" ? principal : host.principal, incarnation: host.incarnation };\n\t}\n\n\t/** ` (variant reader)` for a remote object, for errors. */\n\t#inVariant(): string {\n\t\treturn this.#variant === undefined ? \"\" : ` (variant ${this.#variant})`;\n\t}\n\n\t#broken(error: unknown): Activation {\n\t\tconst cause: FailureCause = { kind: \"broken\", error: asChordError(error, this.#object.label) };\n\t\treturn this.#abandoned ?? { kind: \"failed\", cause };\n\t}\n\n\t#declarations(): RegistryDeclarations {\n\t\tthis.#registryDeclarations ??= {\n\t\t\treads: [],\n\t\t\tretrySources: [],\n\t\t\twritables: [],\n\t\t\tdeclared: [],\n\t\t\tcontributions: NONE,\n\t\t};\n\t\treturn this.#registryDeclarations;\n\t}\n\n\t#assertDeclaring(declaration: string): void {\n\t\tif (!this.#declaring) {\n\t\t\tthrow new Error(`${this.#object.label}: self.${declaration} is valid only in the factory`);\n\t\t}\n\t}\n}\n\n/** Pins `key` on `slot` and loads it when it is not in memory; a failed load releases the pin. */\nasync function pinned(slot: KeyedSlot, key: string, context: Context): Promise<PinnedKey> {\n\tconst release = slot.pin(key, context);\n\ttry {\n\t\tawait slot.ensure(key, context);\n\t} catch (error) {\n\t\trelease();\n\t\tthrow error;\n\t}\n\treturn { source: slot.source(key), release };\n}\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The delay after a failure: 1 s after the first (no `previous` delay), then the previous one doubled, up to 60 s.
|
|
3
|
+
* Identities, routines and job finishes back off alike.
|
|
4
|
+
*/
|
|
5
|
+
export declare function nextDelay(previous: number | undefined): number;
|
|
6
|
+
/**
|
|
7
|
+
* The host's backoff map. When a window ends, `due(identity)` runs: the host retries the identity's object, or
|
|
8
|
+
* deletes the entry when there is none. An entry is deleted on success, on a broken failure, and when its window has
|
|
9
|
+
* passed with nothing left to retry.
|
|
10
|
+
*/
|
|
11
|
+
export declare class Backoff {
|
|
12
|
+
#private;
|
|
13
|
+
constructor(due: (identity: string) => void);
|
|
14
|
+
/** Records a transient failure: a window of the previous delay doubled (1 s at first), then `due`. */
|
|
15
|
+
failed(identity: string): void;
|
|
16
|
+
/** Whether `identity` is inside a window: a new object for it waits for `due` before its first attempt. */
|
|
17
|
+
waiting(identity: string): boolean;
|
|
18
|
+
/** When the window of `identity` ends, while one runs: a failed reference's `retryAt`. */
|
|
19
|
+
until(identity: string): number | undefined;
|
|
20
|
+
/** Ends the window at once (its object is retried now: `ref.retry()`, a wake); the delay stays for the next failure. */
|
|
21
|
+
skip(identity: string): void;
|
|
22
|
+
/** Its object ended: an entry whose window has passed gets no outcome any more and goes. */
|
|
23
|
+
ended(identity: string): void;
|
|
24
|
+
/** Forgets `identity` (success, a broken failure, or a window that passed with nothing to retry). */
|
|
25
|
+
delete(identity: string): void;
|
|
26
|
+
/** Forgets every identity (the host closes). */
|
|
27
|
+
clear(): void;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=backoff.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backoff.d.ts","sourceRoot":"","sources":["../../../src/next/host/backoff.ts"],"names":[],"mappings":"AASA;;;GAGG;AACH,wBAAgB,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAE9D;AAQD;;;;GAIG;AACH,qBAAa,OAAO;;IAInB,YAAY,GAAG,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,EAE1C;IAED,sGAAsG;IACtG,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAU7B;IAED,2GAA2G;IAC3G,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEjC;IAED,0FAA0F;IAC1F,KAAK,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAG1C;IAED,wHAAwH;IACxH,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAI3B;IAED,4FAA4F;IAC5F,KAAK,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAE5B;IAED,qGAAqG;IACrG,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAG7B;IAED,gDAAgD;IAChD,KAAK,IAAI,IAAI,CAEZ;CACD"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// Retry backoff per identity (§6): after a transient failure an identity waits 1 s, doubling up to 60 s. The entries
|
|
2
|
+
// hold no object, so a failed object is collected after its last reference while its window still runs.
|
|
3
|
+
/** The delay after the first transient failure. */
|
|
4
|
+
const FIRST_DELAY = 1_000;
|
|
5
|
+
/** The longest delay. */
|
|
6
|
+
const MAX_DELAY = 60_000;
|
|
7
|
+
/**
|
|
8
|
+
* The delay after a failure: 1 s after the first (no `previous` delay), then the previous one doubled, up to 60 s.
|
|
9
|
+
* Identities, routines and job finishes back off alike.
|
|
10
|
+
*/
|
|
11
|
+
export function nextDelay(previous) {
|
|
12
|
+
return previous === undefined ? FIRST_DELAY : Math.min(previous * 2, MAX_DELAY);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The host's backoff map. When a window ends, `due(identity)` runs: the host retries the identity's object, or
|
|
16
|
+
* deletes the entry when there is none. An entry is deleted on success, on a broken failure, and when its window has
|
|
17
|
+
* passed with nothing left to retry.
|
|
18
|
+
*/
|
|
19
|
+
export class Backoff {
|
|
20
|
+
#entries = new Map();
|
|
21
|
+
#due;
|
|
22
|
+
constructor(due) {
|
|
23
|
+
this.#due = due;
|
|
24
|
+
}
|
|
25
|
+
/** Records a transient failure: a window of the previous delay doubled (1 s at first), then `due`. */
|
|
26
|
+
failed(identity) {
|
|
27
|
+
const previous = this.#entries.get(identity);
|
|
28
|
+
clearTimeout(previous?.timer);
|
|
29
|
+
const delay = nextDelay(previous?.delay);
|
|
30
|
+
const entry = { delay, until: Date.now() + delay, timer: undefined };
|
|
31
|
+
entry.timer = setTimeout(() => {
|
|
32
|
+
entry.timer = undefined;
|
|
33
|
+
this.#due(identity);
|
|
34
|
+
}, delay);
|
|
35
|
+
this.#entries.set(identity, entry);
|
|
36
|
+
}
|
|
37
|
+
/** Whether `identity` is inside a window: a new object for it waits for `due` before its first attempt. */
|
|
38
|
+
waiting(identity) {
|
|
39
|
+
return this.#entries.get(identity)?.timer !== undefined;
|
|
40
|
+
}
|
|
41
|
+
/** When the window of `identity` ends, while one runs: a failed reference's `retryAt`. */
|
|
42
|
+
until(identity) {
|
|
43
|
+
const entry = this.#entries.get(identity);
|
|
44
|
+
return entry?.timer === undefined ? undefined : entry.until;
|
|
45
|
+
}
|
|
46
|
+
/** Ends the window at once (its object is retried now: `ref.retry()`, a wake); the delay stays for the next failure. */
|
|
47
|
+
skip(identity) {
|
|
48
|
+
const entry = this.#entries.get(identity);
|
|
49
|
+
clearTimeout(entry?.timer);
|
|
50
|
+
if (entry !== undefined)
|
|
51
|
+
entry.timer = undefined;
|
|
52
|
+
}
|
|
53
|
+
/** Its object ended: an entry whose window has passed gets no outcome any more and goes. */
|
|
54
|
+
ended(identity) {
|
|
55
|
+
if (this.#entries.has(identity) && !this.waiting(identity))
|
|
56
|
+
this.#entries.delete(identity);
|
|
57
|
+
}
|
|
58
|
+
/** Forgets `identity` (success, a broken failure, or a window that passed with nothing to retry). */
|
|
59
|
+
delete(identity) {
|
|
60
|
+
clearTimeout(this.#entries.get(identity)?.timer);
|
|
61
|
+
this.#entries.delete(identity);
|
|
62
|
+
}
|
|
63
|
+
/** Forgets every identity (the host closes). */
|
|
64
|
+
clear() {
|
|
65
|
+
for (const identity of [...this.#entries.keys()])
|
|
66
|
+
this.delete(identity);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=backoff.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backoff.js","sourceRoot":"","sources":["../../../src/next/host/backoff.ts"],"names":[],"mappings":"AAAA,qHAAqH;AACrH,wGAAwG;AAExG,mDAAmD;AACnD,MAAM,WAAW,GAAG,KAAK,CAAC;AAE1B,yBAAyB;AACzB,MAAM,SAAS,GAAG,MAAM,CAAC;AAEzB;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,QAA4B;IACrD,OAAO,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,GAAG,CAAC,EAAE,SAAS,CAAC,CAAC;AACjF,CAA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,QAAgB;QACpB,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC1C,YAAY,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;QAC3B,IAAI,KAAK,KAAK,SAAS;YAAE,KAAK,CAAC,KAAK,GAAG,SAAS,CAAC;IAClD,CAAC;IAED,4FAA4F;IAC5F,KAAK,CAAC,QAAgB;QACrB,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;YAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC5F,CAAC;IAED,qGAAqG;IACrG,MAAM,CAAC,QAAgB;QACtB,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,CAAC;QACjD,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAChC,CAAC;IAED,gDAAgD;IAChD,KAAK;QACJ,KAAK,MAAM,QAAQ,IAAI,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;YAAE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACzE,CAAC;CACD","sourcesContent":["// Retry backoff per identity (§6): after a transient failure an identity waits 1 s, doubling up to 60 s. The entries\n// hold no object, so a failed object is collected after its last reference while its window still runs.\n\n/** The delay after the first transient failure. */\nconst FIRST_DELAY = 1_000;\n\n/** The longest delay. */\nconst MAX_DELAY = 60_000;\n\n/**\n * The delay after a failure: 1 s after the first (no `previous` delay), then the previous one doubled, up to 60 s.\n * Identities, routines and job finishes back off alike.\n */\nexport function nextDelay(previous: number | undefined): number {\n\treturn previous === undefined ? FIRST_DELAY : Math.min(previous * 2, MAX_DELAY);\n}\n\n/**\n * One identity's backoff: the delay of its last window, when that window ends (`Date.now()` time), and the timer ending\n * a window still running.\n */\ntype Entry = { readonly delay: number; readonly until: number; timer: ReturnType<typeof setTimeout> | undefined };\n\n/**\n * The host's backoff map. When a window ends, `due(identity)` runs: the host retries the identity's object, or\n * deletes the entry when there is none. An entry is deleted on success, on a broken failure, and when its window has\n * passed with nothing left to retry.\n */\nexport class Backoff {\n\treadonly #entries = new Map<string, Entry>();\n\treadonly #due: (identity: string) => void;\n\n\tconstructor(due: (identity: string) => void) {\n\t\tthis.#due = due;\n\t}\n\n\t/** Records a transient failure: a window of the previous delay doubled (1 s at first), then `due`. */\n\tfailed(identity: string): void {\n\t\tconst previous = this.#entries.get(identity);\n\t\tclearTimeout(previous?.timer);\n\t\tconst delay = nextDelay(previous?.delay);\n\t\tconst entry: Entry = { delay, until: Date.now() + delay, timer: undefined };\n\t\tentry.timer = setTimeout(() => {\n\t\t\tentry.timer = undefined;\n\t\t\tthis.#due(identity);\n\t\t}, delay);\n\t\tthis.#entries.set(identity, entry);\n\t}\n\n\t/** Whether `identity` is inside a window: a new object for it waits for `due` before its first attempt. */\n\twaiting(identity: string): boolean {\n\t\treturn this.#entries.get(identity)?.timer !== undefined;\n\t}\n\n\t/** When the window of `identity` ends, while one runs: a failed reference's `retryAt`. */\n\tuntil(identity: string): number | undefined {\n\t\tconst entry = this.#entries.get(identity);\n\t\treturn entry?.timer === undefined ? undefined : entry.until;\n\t}\n\n\t/** Ends the window at once (its object is retried now: `ref.retry()`, a wake); the delay stays for the next failure. */\n\tskip(identity: string): void {\n\t\tconst entry = this.#entries.get(identity);\n\t\tclearTimeout(entry?.timer);\n\t\tif (entry !== undefined) entry.timer = undefined;\n\t}\n\n\t/** Its object ended: an entry whose window has passed gets no outcome any more and goes. */\n\tended(identity: string): void {\n\t\tif (this.#entries.has(identity) && !this.waiting(identity)) this.#entries.delete(identity);\n\t}\n\n\t/** Forgets `identity` (success, a broken failure, or a window that passed with nothing to retry). */\n\tdelete(identity: string): void {\n\t\tclearTimeout(this.#entries.get(identity)?.timer);\n\t\tthis.#entries.delete(identity);\n\t}\n\n\t/** Forgets every identity (the host closes). */\n\tclear(): void {\n\t\tfor (const identity of [...this.#entries.keys()]) this.delete(identity);\n\t}\n}\n"]}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { type Context, type ContextKey } from "../../context/index.ts";
|
|
2
|
+
import type { Contract, ParamsOf } from "../contracts/index.ts";
|
|
3
|
+
import { type Principal } from "../data/index.ts";
|
|
4
|
+
import type { AnyHost, GetOptions } from "./host.ts";
|
|
5
|
+
import type { Reference } from "./reference.ts";
|
|
6
|
+
/** A handler's context. */
|
|
7
|
+
export interface Ctx<P extends Principal = Principal> extends Context {
|
|
8
|
+
/** The caller as its link stamped it; on a local object's handler the host's principal (none on a client). */
|
|
9
|
+
readonly principal: P | undefined;
|
|
10
|
+
/** The calling host's incarnation over a link, this host's otherwise (R20). */
|
|
11
|
+
readonly incarnation: string;
|
|
12
|
+
/**
|
|
13
|
+
* A reference as the caller (`principal`) sees it, released when the handler settles; afterwards `get` throws
|
|
14
|
+
* `released`.
|
|
15
|
+
*/
|
|
16
|
+
get<C extends Contract>(Type: C, params: ParamsOf<C>, options?: GetOptions): Promise<Reference<C>>;
|
|
17
|
+
}
|
|
18
|
+
/** Who makes a call: the principal it acts as and its host's incarnation. */
|
|
19
|
+
export type Caller = {
|
|
20
|
+
readonly principal: Principal | undefined;
|
|
21
|
+
readonly incarnation: string;
|
|
22
|
+
};
|
|
23
|
+
/** The ctx of one handler run (or root scope): its references are released by `settle` when it settled. */
|
|
24
|
+
export declare class CallContext implements Ctx {
|
|
25
|
+
#private;
|
|
26
|
+
readonly principal: Principal | undefined;
|
|
27
|
+
readonly incarnation: string;
|
|
28
|
+
constructor(context: Context, caller: Caller, host: AnyHost);
|
|
29
|
+
get abortSignal(): AbortSignal | undefined;
|
|
30
|
+
get telemetry(): Context["telemetry"];
|
|
31
|
+
value<T>(key: ContextKey<T>): T | undefined;
|
|
32
|
+
toString(): string;
|
|
33
|
+
get<C extends Contract>(Type: C, params: ParamsOf<C>, options?: GetOptions): Promise<Reference<C>>;
|
|
34
|
+
/** The handler settled: its references are released, waiting gets give up, and `get` throws from now on. */
|
|
35
|
+
settle(): void;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* A child of `context` aborted by `signal` and by the caller's signal (the caller's reason first) until `release()`,
|
|
39
|
+
* which the call runs when it settles. Not `AbortSignal.any`: before Node 24.16.0 it keeps cleanup entries per call for
|
|
40
|
+
* as long as its sources live (nodejs/node#62367), and a call's sources (its attempt, its reference) live long.
|
|
41
|
+
* Without a caller's signal the child is aborted by `signal` itself and `release` does nothing.
|
|
42
|
+
*/
|
|
43
|
+
export declare function withLinkedAbortSignal(signal: AbortSignal, context: Context): {
|
|
44
|
+
readonly context: Context;
|
|
45
|
+
release(): void;
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=ctx.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ctx.d.ts","sourceRoot":"","sources":["../../../src/next/host/ctx.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,UAAU,EAAuC,MAAM,wBAAwB,CAAC;AAC5G,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,KAAK,EAAW,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEzD,2BAA2B;AAC3B,MAAM,WAAW,GAAG,CAAC,CAAC,SAAS,SAAS,GAAG,SAAS,CAAE,SAAQ,OAAO;IACpE,8GAA8G;IAC9G,QAAQ,CAAC,SAAS,EAAE,CAAC,GAAG,SAAS,CAAC;IAClC,+EAA+E;IAC/E,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B;;;OAGG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
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
// The `ctx` a method handler gets (§8): its call's context, who called, the calling host's incarnation, and
|
|
2
|
+
// call-scoped references; and the abort signal of a call's context, linked to long-lived sources until it settles.
|
|
3
|
+
import { withAbortSignal, withoutAbortSignal } from "../../context/index.js";
|
|
4
|
+
import { ChordError } from "../data/index.js";
|
|
5
|
+
/** The ctx of one handler run (or root scope): its references are released by `settle` when it settled. */
|
|
6
|
+
export class CallContext {
|
|
7
|
+
principal;
|
|
8
|
+
incarnation;
|
|
9
|
+
#context;
|
|
10
|
+
#host;
|
|
11
|
+
/** The references taken with `get`; `undefined` once the handler settled. */
|
|
12
|
+
#references = [];
|
|
13
|
+
/** Aborted when the handler settles: a `get` still waiting gives up and releases its reference. By the first. */
|
|
14
|
+
#settling;
|
|
15
|
+
constructor(context, caller, host) {
|
|
16
|
+
this.#context = context;
|
|
17
|
+
this.principal = caller.principal;
|
|
18
|
+
this.incarnation = caller.incarnation;
|
|
19
|
+
this.#host = host;
|
|
20
|
+
}
|
|
21
|
+
get abortSignal() {
|
|
22
|
+
return this.#context.abortSignal;
|
|
23
|
+
}
|
|
24
|
+
get telemetry() {
|
|
25
|
+
return this.#context.telemetry;
|
|
26
|
+
}
|
|
27
|
+
value(key) {
|
|
28
|
+
return this.#context.value(key);
|
|
29
|
+
}
|
|
30
|
+
toString() {
|
|
31
|
+
return `${this.#context}.Ctx`;
|
|
32
|
+
}
|
|
33
|
+
async get(Type, params, options = {}) {
|
|
34
|
+
// A settled scope refuses `released` whatever aborted it; an aborted call creates nothing.
|
|
35
|
+
if (this.#references === undefined)
|
|
36
|
+
throw settled(Type);
|
|
37
|
+
this.#context.abortSignal?.throwIfAborted();
|
|
38
|
+
// Made for the caller: its principal and its origin's incarnation travel with the reference's holds.
|
|
39
|
+
const caller = { principal: this.principal, incarnation: this.incarnation };
|
|
40
|
+
this.#settling ??= new AbortController();
|
|
41
|
+
const scoped = withLinkedAbortSignal(this.#settling.signal, this.#context);
|
|
42
|
+
let binding;
|
|
43
|
+
try {
|
|
44
|
+
binding = await this.#host.acquire(Type, params, caller, scoped.context, options);
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
throw this.#references === undefined ? settled(Type) : error;
|
|
48
|
+
}
|
|
49
|
+
finally {
|
|
50
|
+
scoped.release();
|
|
51
|
+
}
|
|
52
|
+
// A get that finished in the turn its handler settled: nobody releases its reference later.
|
|
53
|
+
if (this.#references === undefined) {
|
|
54
|
+
binding.release();
|
|
55
|
+
throw settled(Type);
|
|
56
|
+
}
|
|
57
|
+
this.#references.push(binding);
|
|
58
|
+
// The binding was built from `Type`'s members.
|
|
59
|
+
return binding.reference;
|
|
60
|
+
}
|
|
61
|
+
/** The handler settled: its references are released, waiting gets give up, and `get` throws from now on. */
|
|
62
|
+
settle() {
|
|
63
|
+
const references = this.#references ?? [];
|
|
64
|
+
this.#references = undefined;
|
|
65
|
+
this.#settling?.abort();
|
|
66
|
+
for (const binding of references)
|
|
67
|
+
binding.release();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function settled(Type) {
|
|
71
|
+
return new ChordError({
|
|
72
|
+
code: "released",
|
|
73
|
+
reason: "settled",
|
|
74
|
+
message: `${Type.name}: ctx.get after its call settled`,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* A child of `context` aborted by `signal` and by the caller's signal (the caller's reason first) until `release()`,
|
|
79
|
+
* which the call runs when it settles. Not `AbortSignal.any`: before Node 24.16.0 it keeps cleanup entries per call for
|
|
80
|
+
* as long as its sources live (nodejs/node#62367), and a call's sources (its attempt, its reference) live long.
|
|
81
|
+
* Without a caller's signal the child is aborted by `signal` itself and `release` does nothing.
|
|
82
|
+
*/
|
|
83
|
+
export function withLinkedAbortSignal(signal, context) {
|
|
84
|
+
const caller = context.abortSignal;
|
|
85
|
+
if (caller === undefined)
|
|
86
|
+
return { context: withAbortSignal(signal, context), release: NOTHING };
|
|
87
|
+
const linked = new AbortController();
|
|
88
|
+
const listeners = [caller, signal].map((source) => {
|
|
89
|
+
const forward = () => {
|
|
90
|
+
release();
|
|
91
|
+
linked.abort(source.reason);
|
|
92
|
+
};
|
|
93
|
+
return [source, forward];
|
|
94
|
+
});
|
|
95
|
+
const release = () => {
|
|
96
|
+
for (const [source, forward] of listeners)
|
|
97
|
+
source.removeEventListener("abort", forward);
|
|
98
|
+
};
|
|
99
|
+
const aborted = listeners.find(([source]) => source.aborted);
|
|
100
|
+
if (aborted !== undefined)
|
|
101
|
+
linked.abort(aborted[0].reason);
|
|
102
|
+
else
|
|
103
|
+
for (const [source, forward] of listeners)
|
|
104
|
+
source.addEventListener("abort", forward, { once: true });
|
|
105
|
+
return { context: withAbortSignal(linked.signal, withoutAbortSignal(context)), release };
|
|
106
|
+
}
|
|
107
|
+
const NOTHING = () => { };
|
|
108
|
+
//# sourceMappingURL=ctx.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ctx.js","sourceRoot":"","sources":["../../../src/next/host/ctx.ts"],"names":[],"mappings":"AAAA,4GAA4G;AAC5G,mHAAmH;AAEnH,OAAO,EAAiC,eAAe,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5G,OAAO,EAAE,UAAU,EAAkB,MAAM,kBAAkB,CAAC;AAoB9D,2GAA2G;AAC3G,MAAM,OAAO,WAAW;IACd,SAAS,CAAwB;IACjC,WAAW,CAAS;IACpB,QAAQ,CAAU;IAClB,KAAK,CAAU;IACxB,6EAA6E;IAC7E,WAAW,GAA0B,EAAE,CAAC;IACxC,iHAAiH;IACjH,SAAS,CAA8B;IAEvC,YAAY,OAAgB,EAAE,MAAc,EAAE,IAAa;QAC1D,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;QAClC,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,WAAW,CAAC;QACtC,IAAI,CAAC,KA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EAAE;YAC1B,OAAO,EAAE,CAAC;YACV,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC7B,CAAC,CAAC;QACF,OAAO,CAAC,MAAM,EAAE,OAAO,CAAU,CAAC;IACnC,CAAC,CAAC,CAAC;IACH,MAAM,OAAO,GAAG,GAAS,EAAE;QAC1B,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,SAAS;YAAE,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACzF,CAAC,CAAC;IACF,MAAM,OAAO,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC7D,IAAI,OAAO,KAAK,SAAS;QAAE,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;;QACtD,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,SAAS;YAAE,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAC1G,OAAO,EAAE,OAAO,EAAE,eAAe,CAAC,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC;AAC1F,CAAC;AAED,MAAM,OAAO,GAAG,GAAS,EAAE,GAAE,CAAC,CAAC","sourcesContent":["// The `ctx` a method handler gets (§8): its call's context, who called, the calling host's incarnation, and\n// call-scoped references; and the abort signal of a call's context, linked to long-lived sources until it settles.\n\nimport { type Context, type ContextKey, withAbortSignal, withoutAbortSignal } from \"../../context/index.ts\";\nimport type { Contract, ParamsOf } from \"../contracts/index.ts\";\nimport { ChordError, type Principal } from \"../data/index.ts\";\nimport type { AnyHost, GetOptions } from \"./host.ts\";\nimport type { Binding, Reference } from \"./reference.ts\";\n\n/** A handler's context. */\nexport interface Ctx<P extends Principal = Principal> extends Context {\n\t/** The caller as its link stamped it; on a local object's handler the host's principal (none on a client). */\n\treadonly principal: P | undefined;\n\t/** The calling host's incarnation over a link, this host's otherwise (R20). */\n\treadonly incarnation: string;\n\t/**\n\t * A reference as the caller (`principal`) sees it, released when the handler settles; afterwards `get` throws\n\t * `released`.\n\t */\n\tget<C extends Contract>(Type: C, params: ParamsOf<C>, options?: GetOptions): Promise<Reference<C>>;\n}\n\n/** Who makes a call: the principal it acts as and its host's incarnation. */\nexport type Caller = { readonly principal: Principal | undefined; readonly incarnation: string };\n\n/** The ctx of one handler run (or root scope): its references are released by `settle` when it settled. */\nexport class CallContext implements Ctx {\n\treadonly principal: Principal | undefined;\n\treadonly incarnation: string;\n\treadonly #context: Context;\n\treadonly #host: AnyHost;\n\t/** The references taken with `get`; `undefined` once the handler settled. */\n\t#references: Binding[] | undefined = [];\n\t/** Aborted when the handler settles: a `get` still waiting gives up and releases its reference. By the first. */\n\t#settling: AbortController | undefined;\n\n\tconstructor(context: Context, caller: Caller, host: AnyHost) {\n\t\tthis.#context = context;\n\t\tthis.principal = caller.principal;\n\t\tthis.incarnation = caller.incarnation;\n\t\tthis.#host = host;\n\t}\n\n\tget abortSignal(): AbortSignal | undefined {\n\t\treturn this.#context.abortSignal;\n\t}\n\n\tget telemetry(): Context[\"telemetry\"] {\n\t\treturn this.#context.telemetry;\n\t}\n\n\tvalue<T>(key: ContextKey<T>): T | undefined {\n\t\treturn this.#context.value(key);\n\t}\n\n\ttoString(): string {\n\t\treturn `${this.#context}.Ctx`;\n\t}\n\n\tasync get<C extends Contract>(Type: C, params: ParamsOf<C>, options: GetOptions = {}): Promise<Reference<C>> {\n\t\t// A settled scope refuses `released` whatever aborted it; an aborted call creates nothing.\n\t\tif (this.#references === undefined) throw settled(Type);\n\t\tthis.#context.abortSignal?.throwIfAborted();\n\t\t// Made for the caller: its principal and its origin's incarnation travel with the reference's holds.\n\t\tconst caller = { principal: this.principal, incarnation: this.incarnation };\n\t\tthis.#settling ??= new AbortController();\n\t\tconst scoped = withLinkedAbortSignal(this.#settling.signal, this.#context);\n\t\tlet binding: Binding;\n\t\ttry {\n\t\t\tbinding = await this.#host.acquire(Type, params, caller, scoped.context, options);\n\t\t} catch (error) {\n\t\t\tthrow this.#references === undefined ? settled(Type) : error;\n\t\t} finally {\n\t\t\tscoped.release();\n\t\t}\n\t\t// A get that finished in the turn its handler settled: nobody releases its reference later.\n\t\tif (this.#references === undefined) {\n\t\t\tbinding.release();\n\t\t\tthrow settled(Type);\n\t\t}\n\t\tthis.#references.push(binding);\n\t\t// The binding was built from `Type`'s members.\n\t\treturn binding.reference as Reference<C>;\n\t}\n\n\t/** The handler settled: its references are released, waiting gets give up, and `get` throws from now on. */\n\tsettle(): void {\n\t\tconst references = this.#references ?? [];\n\t\tthis.#references = undefined;\n\t\tthis.#settling?.abort();\n\t\tfor (const binding of references) binding.release();\n\t}\n}\n\nfunction settled(Type: Contract): ChordError {\n\treturn new ChordError({\n\t\tcode: \"released\",\n\t\treason: \"settled\",\n\t\tmessage: `${Type.name}: ctx.get after its call settled`,\n\t});\n}\n\n/**\n * A child of `context` aborted by `signal` and by the caller's signal (the caller's reason first) until `release()`,\n * which the call runs when it settles. Not `AbortSignal.any`: before Node 24.16.0 it keeps cleanup entries per call for\n * as long as its sources live (nodejs/node#62367), and a call's sources (its attempt, its reference) live long.\n * Without a caller's signal the child is aborted by `signal` itself and `release` does nothing.\n */\nexport function withLinkedAbortSignal(\n\tsignal: AbortSignal,\n\tcontext: Context,\n): { readonly context: Context; release(): void } {\n\tconst caller = context.abortSignal;\n\tif (caller === undefined) return { context: withAbortSignal(signal, context), release: NOTHING };\n\tconst linked = new AbortController();\n\tconst listeners = [caller, signal].map((source) => {\n\t\tconst forward = (): void => {\n\t\t\trelease();\n\t\t\tlinked.abort(source.reason);\n\t\t};\n\t\treturn [source, forward] as const;\n\t});\n\tconst release = (): void => {\n\t\tfor (const [source, forward] of listeners) source.removeEventListener(\"abort\", forward);\n\t};\n\tconst aborted = listeners.find(([source]) => source.aborted);\n\tif (aborted !== undefined) linked.abort(aborted[0].reason);\n\telse for (const [source, forward] of listeners) source.addEventListener(\"abort\", forward, { once: true });\n\treturn { context: withAbortSignal(linked.signal, withoutAbortSignal(context)), release };\n}\n\nconst NOTHING = (): void => {};\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** A deadline of `ms` calling `expired` once when reached; paused time does not count. */
|
|
2
|
+
export declare class Deadline {
|
|
3
|
+
#private;
|
|
4
|
+
constructor(ms: number, expired: () => void);
|
|
5
|
+
/** Stops the clock; `resume` restarts it with the budget left. */
|
|
6
|
+
pause(): void;
|
|
7
|
+
/** Restarts a paused clock. */
|
|
8
|
+
resume(): void;
|
|
9
|
+
/** Ends the deadline: `expired` is never called. */
|
|
10
|
+
clear(): void;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=deadline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deadline.d.ts","sourceRoot":"","sources":["../../../src/next/host/deadline.ts"],"names":[],"mappings":"AAGA,0FAA0F;AAC1F,qBAAa,QAAQ;;IAQpB,YAAY,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,IAAI,EAI1C;IAED,kEAAkE;IAClE,KAAK,IAAI,IAAI,CAKZ;IAED,+BAA+B;IAC/B,MAAM,IAAI,IAAI,CAEb;IAED,oDAAoD;IACpD,KAAK,IAAI,IAAI,CAIZ;CAMD"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// An activation's `readyTimeout` deadline (slice 6a §9): one timer that eager migration work pauses and resumes with
|
|
2
|
+
// the budget it had left, so a long migration does not fail its object while other activations keep their bounds.
|
|
3
|
+
/** A deadline of `ms` calling `expired` once when reached; paused time does not count. */
|
|
4
|
+
export class Deadline {
|
|
5
|
+
#expired;
|
|
6
|
+
/** The budget left when the timer last started (or paused). */
|
|
7
|
+
#remaining;
|
|
8
|
+
#started = 0;
|
|
9
|
+
#timer;
|
|
10
|
+
#cleared = false;
|
|
11
|
+
constructor(ms, expired) {
|
|
12
|
+
this.#expired = expired;
|
|
13
|
+
this.#remaining = ms;
|
|
14
|
+
this.#start();
|
|
15
|
+
}
|
|
16
|
+
/** Stops the clock; `resume` restarts it with the budget left. */
|
|
17
|
+
pause() {
|
|
18
|
+
if (this.#timer === undefined)
|
|
19
|
+
return;
|
|
20
|
+
clearTimeout(this.#timer);
|
|
21
|
+
this.#timer = undefined;
|
|
22
|
+
this.#remaining = Math.max(0, this.#remaining - (Date.now() - this.#started));
|
|
23
|
+
}
|
|
24
|
+
/** Restarts a paused clock. */
|
|
25
|
+
resume() {
|
|
26
|
+
if (this.#timer === undefined && !this.#cleared)
|
|
27
|
+
this.#start();
|
|
28
|
+
}
|
|
29
|
+
/** Ends the deadline: `expired` is never called. */
|
|
30
|
+
clear() {
|
|
31
|
+
clearTimeout(this.#timer);
|
|
32
|
+
this.#timer = undefined;
|
|
33
|
+
this.#cleared = true;
|
|
34
|
+
}
|
|
35
|
+
#start() {
|
|
36
|
+
this.#started = Date.now();
|
|
37
|
+
this.#timer = setTimeout(this.#expired, this.#remaining);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=deadline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deadline.js","sourceRoot":"","sources":["../../../src/next/host/deadline.ts"],"names":[],"mappings":"AAAA,qHAAqH;AACrH,kHAAkH;AAElH,0FAA0F;AAC1F,MAAM,OAAO,QAAQ;IACX,QAAQ,CAAa;IAC9B,+DAA+D;IAC/D,UAAU,CAAS;IACnB,QAAQ,GAAG,CAAC,CAAC;IACb,MAAM,CAA4C;IAClD,QAAQ,GAAG,KAAK,CAAC;IAEjB,YAAY,EAAU,EAAE,OAAmB;QAC1C,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;QACrB,IAAI,CAAC,MAAM,EAAE,CAAC;IACf,CAAC;IAED,kEAAkE;IAClE,KAAK;QACJ,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS;YAAE,OAAO;QACtC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC1B,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;QACxB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,UAAU,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC/E,CAAC;IAED,+BAA+B;IAC/B,MAAM;QACL,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,IAAI,CAAC,IAAI,CAAC,QAAQ;YAAE,IAAI,CAAC,MAAM,EAAE,CAAC;IAChE,CAAC;IAED,oDAAoD;IACpD,KAAK;QACJ,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC1B,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;QACxB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;IACtB,CAAC;IAED,MAAM;QACL,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC3B,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;IAC1D,CAAC;CACD","sourcesContent":["// An activation's `readyTimeout` deadline (slice 6a §9): one timer that eager migration work pauses and resumes with\n// the budget it had left, so a long migration does not fail its object while other activations keep their bounds.\n\n/** A deadline of `ms` calling `expired` once when reached; paused time does not count. */\nexport class Deadline {\n\treadonly #expired: () => void;\n\t/** The budget left when the timer last started (or paused). */\n\t#remaining: number;\n\t#started = 0;\n\t#timer: ReturnType<typeof setTimeout> | undefined;\n\t#cleared = false;\n\n\tconstructor(ms: number, expired: () => void) {\n\t\tthis.#expired = expired;\n\t\tthis.#remaining = ms;\n\t\tthis.#start();\n\t}\n\n\t/** Stops the clock; `resume` restarts it with the budget left. */\n\tpause(): void {\n\t\tif (this.#timer === undefined) return;\n\t\tclearTimeout(this.#timer);\n\t\tthis.#timer = undefined;\n\t\tthis.#remaining = Math.max(0, this.#remaining - (Date.now() - this.#started));\n\t}\n\n\t/** Restarts a paused clock. */\n\tresume(): void {\n\t\tif (this.#timer === undefined && !this.#cleared) this.#start();\n\t}\n\n\t/** Ends the deadline: `expired` is never called. */\n\tclear(): void {\n\t\tclearTimeout(this.#timer);\n\t\tthis.#timer = undefined;\n\t\tthis.#cleared = true;\n\t}\n\n\t#start(): void {\n\t\tthis.#started = Date.now();\n\t\tthis.#timer = setTimeout(this.#expired, this.#remaining);\n\t}\n}\n"]}
|