@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,411 @@
|
|
|
1
|
+
// An object held over a link (§7): what one remote reference is bound to on the consumer, across the links of its path
|
|
2
|
+
// (the parent, or a route address). Its state, the replicas of its last bound variant (kept while its link is down),
|
|
3
|
+
// its hold on the path's current link and calls through it.
|
|
4
|
+
import { BACKGROUND_CONTEXT } from "../../context/index.js";
|
|
5
|
+
import { currentVariants, variantNames, variantOrder, } from "../contracts/internal.js";
|
|
6
|
+
import { ChordError } from "../data/index.js";
|
|
7
|
+
import { asChordError, invalid } from "../data/internal.js";
|
|
8
|
+
import { LIVE, LOADING, } from "../host/internal.js";
|
|
9
|
+
import { errorFromWire, jsonPart, parsePart, } from "../link/internal.js";
|
|
10
|
+
import { Replica } from "./replica.js";
|
|
11
|
+
/**
|
|
12
|
+
* One remote reference's object, owned by its host across the links of its path. It is `loading` until a link's hold
|
|
13
|
+
* of it is bound, and again whenever that link drops or its relay's upstream starts over; each link holds it with its
|
|
14
|
+
* own id. Two references are two holds, each member of each with its own Delta decoder.
|
|
15
|
+
*/
|
|
16
|
+
export class RemoteObject {
|
|
17
|
+
kind = "remote";
|
|
18
|
+
/** The object in errors: its type, and its params key when it has params. */
|
|
19
|
+
label;
|
|
20
|
+
contract;
|
|
21
|
+
#host;
|
|
22
|
+
/** What its holds ask for: the params as a part (checked by L1 when the reference was made), the address. */
|
|
23
|
+
request;
|
|
24
|
+
/** Whom its reference acts for: named on route links (`actingFor`). */
|
|
25
|
+
caller;
|
|
26
|
+
/** Its params, for placing it anew (`retry` after a part past the limits). */
|
|
27
|
+
#params;
|
|
28
|
+
/** Its path: the parent's or a route address's; the host's `unplaced` one after a part past the limits. */
|
|
29
|
+
#path;
|
|
30
|
+
/** The object whose activation declared the reference (`self.get`): its holds carry its chain while it activates. */
|
|
31
|
+
#dependent;
|
|
32
|
+
#state = LOADING;
|
|
33
|
+
/** The last binding, kept while loading or failed: members keep their last values and watches. */
|
|
34
|
+
#bound;
|
|
35
|
+
/** The hold on the path's link while one is open: that link's consumer side and this hold's id on it. */
|
|
36
|
+
#hold;
|
|
37
|
+
#binding;
|
|
38
|
+
#lastFailure;
|
|
39
|
+
constructor(host, contract, { params, key }, address, caller, path, dependent) {
|
|
40
|
+
this.#host = host;
|
|
41
|
+
this.contract = contract;
|
|
42
|
+
this.label = key === "" ? contract.name : `${contract.name}(${key})`;
|
|
43
|
+
const { name: type, version, fingerprint } = contract;
|
|
44
|
+
this.request = {
|
|
45
|
+
type,
|
|
46
|
+
version,
|
|
47
|
+
fingerprint,
|
|
48
|
+
params: jsonPart(params),
|
|
49
|
+
address,
|
|
50
|
+
};
|
|
51
|
+
this.caller = caller;
|
|
52
|
+
this.#params = params;
|
|
53
|
+
this.#path = path;
|
|
54
|
+
this.#dependent = dependent;
|
|
55
|
+
}
|
|
56
|
+
get state() {
|
|
57
|
+
return this.#state;
|
|
58
|
+
}
|
|
59
|
+
/** An object over a link is no blocker of this host's first pass. */
|
|
60
|
+
get blocksFirstPass() {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
/** The error of the last `failed`, until `bound`. */
|
|
64
|
+
get lastFailure() {
|
|
65
|
+
return this.#lastFailure;
|
|
66
|
+
}
|
|
67
|
+
/** The variant last bound; `undefined` before the first binding. */
|
|
68
|
+
get variant() {
|
|
69
|
+
return this.#bound?.variant;
|
|
70
|
+
}
|
|
71
|
+
/** Whether its state members have values: bound once. */
|
|
72
|
+
get hydrated() {
|
|
73
|
+
return this.#bound !== undefined;
|
|
74
|
+
}
|
|
75
|
+
/** Its one reference bound to it. */
|
|
76
|
+
hold(binding) {
|
|
77
|
+
this.#binding = binding;
|
|
78
|
+
}
|
|
79
|
+
/** The reference was released: the current link's provider is told and the reference's sent calls rejected. */
|
|
80
|
+
unhold(_binding) {
|
|
81
|
+
const error = new ChordError({ code: "released", message: `${this.label}: released` });
|
|
82
|
+
this.#hold?.side.release(this.#hold.id, error);
|
|
83
|
+
this.#end(error);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Holds on `link`, the path's link now (a first hold, or a re-hold on a new link), with the activation chain of its
|
|
87
|
+
* dependent while that activates (Q5).
|
|
88
|
+
*/
|
|
89
|
+
attach(link) {
|
|
90
|
+
const chain = this.#dependent?.activationChain();
|
|
91
|
+
this.#hold = { side: link.consumer, id: link.consumer.attach(this, chain) };
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Its path's address cannot be reached for now (a route's `resolve` failed, a suspension): `failed { waiting }` with
|
|
95
|
+
* `error`, still on the path, bound by its next link.
|
|
96
|
+
*/
|
|
97
|
+
unreachable(error) {
|
|
98
|
+
this.#lastFailure = error;
|
|
99
|
+
if (this.#state.kind !== "ended")
|
|
100
|
+
this.#move({ kind: "failed", cause: { kind: "waiting", error }, retryAt: undefined });
|
|
101
|
+
}
|
|
102
|
+
/** The link dropped: loading until a new link's hold is bound (`#startOver`). */
|
|
103
|
+
dropped(_error) {
|
|
104
|
+
this.#hold = undefined;
|
|
105
|
+
this.#startOver();
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Calls a method of the bound variant over the link; one outside it fails `invalid/member`. Only a live object is
|
|
109
|
+
* called: bound on an open link.
|
|
110
|
+
*/
|
|
111
|
+
async call(method, args, context) {
|
|
112
|
+
const bound = this.#bound;
|
|
113
|
+
const hold = this.#hold;
|
|
114
|
+
const data = bound.methods.get(method);
|
|
115
|
+
if (data === undefined) {
|
|
116
|
+
throw invalid("member", `${this.label} (variant ${bound.variant}) has no method "${method}"`);
|
|
117
|
+
}
|
|
118
|
+
// Arguments are checked by the provider.
|
|
119
|
+
return hold.side.call(hold.id, bound.names.methods.indexOf(method), data, args, context);
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* The replica of `member`; `not_ready` before the first binding, `invalid/member` for a member no binding had (one
|
|
123
|
+
* a later variant lacks reads its `invalid/member` failure).
|
|
124
|
+
*/
|
|
125
|
+
member(member) {
|
|
126
|
+
const bound = this.#bound;
|
|
127
|
+
if (bound === undefined)
|
|
128
|
+
throw new ChordError({ code: "not_ready", message: `${this.label}: not bound yet` });
|
|
129
|
+
const replica = bound.replicas.get(member);
|
|
130
|
+
if (replica === undefined) {
|
|
131
|
+
throw invalid("member", `${this.label} (variant ${bound.variant}) has no state member "${member}"`);
|
|
132
|
+
}
|
|
133
|
+
return replica;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* What its reference follows of `member` (a consumer over a link binds at its own version, mapped at the provider):
|
|
137
|
+
* the replica while live, a member the bound variant lacks (`invalid/member`); while loading or failed nothing, the
|
|
138
|
+
* replica (kept until the next binding) giving its last value (rule 5).
|
|
139
|
+
*/
|
|
140
|
+
followed(member, _version) {
|
|
141
|
+
const bound = this.#bound;
|
|
142
|
+
const replica = bound?.replicas.get(member);
|
|
143
|
+
const state = this.#state;
|
|
144
|
+
if (state.kind === "live") {
|
|
145
|
+
if (replica !== undefined)
|
|
146
|
+
return { kind: "live", source: replica, instance: bound };
|
|
147
|
+
const message = `${this.label} (variant ${bound?.variant}) has no state member "${member}"`;
|
|
148
|
+
return { kind: "lacking", error: invalid("member", message) };
|
|
149
|
+
}
|
|
150
|
+
if (state.kind === "failed")
|
|
151
|
+
return { kind: "failed", error: state.cause.error, last: replica, instance: bound };
|
|
152
|
+
return { kind: "loading", last: replica, instance: bound };
|
|
153
|
+
}
|
|
154
|
+
/** Its binding while live (its replicas change); `undefined` while loading or failed. */
|
|
155
|
+
get attachable() {
|
|
156
|
+
return this.#state.kind === "live" ? this.#bound : undefined;
|
|
157
|
+
}
|
|
158
|
+
/** Keyed members are only in local contracts: no instance to pin a key on. */
|
|
159
|
+
get instance() {
|
|
160
|
+
return undefined;
|
|
161
|
+
}
|
|
162
|
+
/** Keyed members are only in local contracts (`keyedMember`). */
|
|
163
|
+
keyedMapping(member) {
|
|
164
|
+
return this.keyedMember(member);
|
|
165
|
+
}
|
|
166
|
+
/** Keyed members are only in local contracts (`keyedMember`). */
|
|
167
|
+
async pinKey(member) {
|
|
168
|
+
return this.keyedMember(member);
|
|
169
|
+
}
|
|
170
|
+
/** Keyed members are only in local contracts, whose objects are never held over a link (slice 6a §12). */
|
|
171
|
+
keyedMember(member) {
|
|
172
|
+
throw invalid("member", `${this.label} has no keyed member "${member}": keyed members are local`);
|
|
173
|
+
}
|
|
174
|
+
/** An object over a link activates on another host: it is in no chain here (Q5). */
|
|
175
|
+
get activationId() {
|
|
176
|
+
return undefined;
|
|
177
|
+
}
|
|
178
|
+
/** An object over a link waits for nothing on this host: no chain of waits (its holds carry the chain, Q5). */
|
|
179
|
+
pathTo() {
|
|
180
|
+
return undefined;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* `ref.retry()`, as a step of `walk`: a failed object's provider is asked for an attempt with the walk's hop budget,
|
|
184
|
+
* none left: nothing is sent (a hold it refused is started there again; a parked object there passes it on with one
|
|
185
|
+
* hop less). One that failed for a part past the link's limits is placed anew and held with a new id, now or on its
|
|
186
|
+
* path's next link (a `hostAddress` that throws fails it broken again).
|
|
187
|
+
*/
|
|
188
|
+
retry(walk) {
|
|
189
|
+
if (this.#state.kind !== "failed")
|
|
190
|
+
return;
|
|
191
|
+
if (this.#path === this.#host.unplaced) {
|
|
192
|
+
this.#place();
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
if (walk.hops > 0)
|
|
196
|
+
this.#hold?.side.retry(this.#hold.id, walk.hops);
|
|
197
|
+
}
|
|
198
|
+
/** Places a reference whose part was past the limits anew, on its path now (a throwing `hostAddress` fails it). */
|
|
199
|
+
#place() {
|
|
200
|
+
let path;
|
|
201
|
+
try {
|
|
202
|
+
path = this.#host.pathOf(this.contract, this.#params, this.caller.principal);
|
|
203
|
+
}
|
|
204
|
+
catch (error) {
|
|
205
|
+
this.#fail(asChordError(error, this.contract.name));
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
this.#path.detach(this);
|
|
209
|
+
this.#path = path;
|
|
210
|
+
this.#move(LOADING);
|
|
211
|
+
path.attach(this);
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* A part of its snapshot or of a state change was past the link's limits (`too_large/part`): the hold is released
|
|
215
|
+
* at the provider, and the reference fails broken with `error`, final: no link holds it again (a reconnect
|
|
216
|
+
* included) until `retry`.
|
|
217
|
+
*/
|
|
218
|
+
tooLarge(error) {
|
|
219
|
+
const hold = this.#hold;
|
|
220
|
+
if (hold === undefined)
|
|
221
|
+
return;
|
|
222
|
+
this.#hold = undefined;
|
|
223
|
+
hold.side.release(hold.id, error);
|
|
224
|
+
this.#path.detach(this);
|
|
225
|
+
this.#path = this.#host.unplaced;
|
|
226
|
+
this.#path.attach(this);
|
|
227
|
+
this.#fail(error);
|
|
228
|
+
}
|
|
229
|
+
/** Fails broken with `error`: no automatic retry. */
|
|
230
|
+
#fail(error) {
|
|
231
|
+
this.#lastFailure = error;
|
|
232
|
+
this.#move({ kind: "failed", cause: { kind: "broken", error }, retryAt: undefined });
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Prepares one entry of a `bound` message (a first binding, a re-hold; a live hold is bound again): the
|
|
236
|
+
* variant and every state member once, as a value or as failed. Returns what applies it inside the batch of the
|
|
237
|
+
* whole message: a member it had gets the snapshot as one frame `[["r", value]]` and a fresh decoder, a member
|
|
238
|
+
* outside the new variant fails (its replica stays, for a later binding that has it again), a new one gets its first
|
|
239
|
+
* value. Throws on a snapshot that
|
|
240
|
+
* does not fit (a protocol error), and `too_large/part` for a value past the link's limits, before anything changed.
|
|
241
|
+
* `wentLive` follows the batch.
|
|
242
|
+
*/
|
|
243
|
+
prepareBound(entry, link) {
|
|
244
|
+
const variant = variantOrder(this.contract)[entry.variant];
|
|
245
|
+
if (variant === undefined)
|
|
246
|
+
throw new Error(`hold ${entry.hold}: no variant ${entry.variant}`);
|
|
247
|
+
const data = currentVariants(this.contract).get(variant);
|
|
248
|
+
const names = variantNames(data);
|
|
249
|
+
const members = new Map();
|
|
250
|
+
const add = (index, state) => {
|
|
251
|
+
const member = names.state[index];
|
|
252
|
+
if (member === undefined || members.has(member))
|
|
253
|
+
throw new Error(`hold ${entry.hold}: member ${index} in bound`);
|
|
254
|
+
members.set(member, state);
|
|
255
|
+
};
|
|
256
|
+
// Fresh JSON from the link: state is JSON and never validated (§30).
|
|
257
|
+
for (const { member, value } of entry.members) {
|
|
258
|
+
add(member, { kind: "value", value: parsePart(link.openPart(value, link.limits, link.context)) });
|
|
259
|
+
}
|
|
260
|
+
for (const { member, error } of entry.failed)
|
|
261
|
+
add(member, { kind: "failed", error: errorFromWire(error) });
|
|
262
|
+
if (members.size !== names.state.length)
|
|
263
|
+
throw new Error(`hold ${entry.hold}: the snapshot misses a member`);
|
|
264
|
+
return () => {
|
|
265
|
+
const previous = this.#bound?.replicas;
|
|
266
|
+
const replicas = new Map();
|
|
267
|
+
// First: a derive recomputing in this batch reads the new variant through its reference.
|
|
268
|
+
this.#bound = { variant, methods: data.methods, names, replicas };
|
|
269
|
+
for (const [member, state] of members) {
|
|
270
|
+
const replica = previous?.get(member);
|
|
271
|
+
if (replica === undefined) {
|
|
272
|
+
replicas.set(member, new Replica(this.#host.batch, state));
|
|
273
|
+
}
|
|
274
|
+
else {
|
|
275
|
+
replica.reset(state);
|
|
276
|
+
replicas.set(member, replica);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
for (const [member, replica] of previous ?? []) {
|
|
280
|
+
if (members.has(member))
|
|
281
|
+
continue;
|
|
282
|
+
replica.vanish(invalid("member", `${this.label} (variant ${variant}) has no state member "${member}"`));
|
|
283
|
+
replicas.set(member, replica);
|
|
284
|
+
}
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
/** After a `bound` message's batch: the reference goes live (its parked calls are sent, a parked dependent goes on). */
|
|
288
|
+
wentLive() {
|
|
289
|
+
this.#lastFailure = undefined;
|
|
290
|
+
this.#move(LIVE);
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* `failed`: the provider's object failed and no attempt runs (`retryIn`: the rest of its backoff window), or the hold
|
|
294
|
+
* is unbound there or its object parked on a failed dependency (`waiting`), each new cause a new message. On a bound
|
|
295
|
+
* hold it unbinds it (slice 7b, model §5): the members keep their last values until the next `bound`.
|
|
296
|
+
*/
|
|
297
|
+
failed(message) {
|
|
298
|
+
// A plugin's error a provider failed with is this object's failure, as a ChordError.
|
|
299
|
+
const error = asChordError(errorFromWire(message.cause.error), this.label);
|
|
300
|
+
this.#lastFailure = error;
|
|
301
|
+
const retryAt = message.retryIn === undefined ? undefined : Date.now() + message.retryIn;
|
|
302
|
+
this.#move({ kind: "failed", cause: { kind: message.cause.kind, error }, retryAt });
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* `loading`: the provider's object started a new attempt after a failure, or its relay's upstream link dropped
|
|
306
|
+
* (`#startOver`).
|
|
307
|
+
*/
|
|
308
|
+
loading() {
|
|
309
|
+
this.#startOver();
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Decodes and applies one entry of a state message (its members by index, each with its ops), without changing
|
|
313
|
+
* anything yet: returns what adopts it into the replicas, run inside the batch that applies the whole message.
|
|
314
|
+
* Throws on an entry that does not fit (a protocol error), and `too_large/part` for ops past the link's limits.
|
|
315
|
+
*/
|
|
316
|
+
prepare({ hold: id, members, failed, retired }, link) {
|
|
317
|
+
const bound = this.#bound;
|
|
318
|
+
if (this.#state.kind !== "live" || bound === undefined)
|
|
319
|
+
throw new Error(`hold ${id}: state before bound`);
|
|
320
|
+
const replica = (index) => {
|
|
321
|
+
const name = bound.names.state[index];
|
|
322
|
+
const found = name === undefined ? undefined : bound.replicas.get(name);
|
|
323
|
+
if (found === undefined)
|
|
324
|
+
throw new Error(`hold ${id}: no state member ${index}`);
|
|
325
|
+
return found;
|
|
326
|
+
};
|
|
327
|
+
// Made by the first retirement (rare): no allocation per message otherwise.
|
|
328
|
+
let retirements;
|
|
329
|
+
for (const member of retired) {
|
|
330
|
+
const target = replica(member);
|
|
331
|
+
retirements ??= new Set();
|
|
332
|
+
if (retirements.has(target))
|
|
333
|
+
throw new Error(`hold ${id}: member ${member} retired twice in one state`);
|
|
334
|
+
retirements.add(target);
|
|
335
|
+
}
|
|
336
|
+
const changed = new Set();
|
|
337
|
+
const updates = members.map(({ member, ops }) => {
|
|
338
|
+
const target = replica(member);
|
|
339
|
+
if (changed.has(target))
|
|
340
|
+
throw new Error(`hold ${id}: member ${member} twice in one state`);
|
|
341
|
+
changed.add(target);
|
|
342
|
+
return { target, ...target.decode(parsePart(link.openPart(ops, link.limits, link.context))) };
|
|
343
|
+
});
|
|
344
|
+
const failures = failed.map(({ member, error }) => ({ target: replica(member), error: errorFromWire(error) }));
|
|
345
|
+
return () => {
|
|
346
|
+
for (const { target, value, ops } of updates)
|
|
347
|
+
target.adopt(value, ops, retirements?.has(target) === true);
|
|
348
|
+
for (const { target, error } of failures)
|
|
349
|
+
target.fail(error);
|
|
350
|
+
// A retirement without ops (a derive whose value stayed, rule 21): the flag alone, after the failures (a
|
|
351
|
+
// failed member keeps it for its next value).
|
|
352
|
+
if (retirements !== undefined) {
|
|
353
|
+
for (const target of retirements)
|
|
354
|
+
if (!changed.has(target))
|
|
355
|
+
target.retireAlone();
|
|
356
|
+
}
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* Its principal was revoked on this host (`host.revoke`): released at its provider if it is held there, then ended
|
|
361
|
+
* with `error` as `lost` does; no later link holds it.
|
|
362
|
+
*/
|
|
363
|
+
revoke(error) {
|
|
364
|
+
const hold = this.#hold;
|
|
365
|
+
this.#hold = undefined;
|
|
366
|
+
hold?.side.release(hold.id, error);
|
|
367
|
+
this.lost(error);
|
|
368
|
+
}
|
|
369
|
+
/** `gone`, or the host closes: the reference ends, its calls reject with `error`. */
|
|
370
|
+
lost(error) {
|
|
371
|
+
const binding = this.#binding;
|
|
372
|
+
this.#hold?.side.forget(this.#hold.id, error);
|
|
373
|
+
this.#end(error);
|
|
374
|
+
binding?.end(error);
|
|
375
|
+
}
|
|
376
|
+
/** Ends the object: detached from its path, waits rejected, replicas ended; keeps nothing of its reference. */
|
|
377
|
+
#end(error) {
|
|
378
|
+
const bound = this.#bound;
|
|
379
|
+
this.#state = { kind: "ended", error };
|
|
380
|
+
this.#binding = undefined;
|
|
381
|
+
this.#dependent = undefined;
|
|
382
|
+
this.#hold = undefined;
|
|
383
|
+
this.#bound = undefined;
|
|
384
|
+
this.#path.detach(this);
|
|
385
|
+
for (const replica of bound?.replicas.values() ?? [])
|
|
386
|
+
replica.end(error);
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Loading again until the next binding; the members keep their last values. A drop while it is loading already
|
|
390
|
+
* changes nothing: a dependent parked on it goes on waiting for the next link's binding (a drop is not a dependency
|
|
391
|
+
* failure).
|
|
392
|
+
*/
|
|
393
|
+
#startOver() {
|
|
394
|
+
const { kind } = this.#state;
|
|
395
|
+
if (kind !== "ended" && kind !== "loading")
|
|
396
|
+
this.#move(LOADING);
|
|
397
|
+
}
|
|
398
|
+
/** Moves to `state` and tells the reference: its members follow what it shows now (in a batch), then its state. */
|
|
399
|
+
#move(state) {
|
|
400
|
+
this.#state = state;
|
|
401
|
+
const binding = this.#binding;
|
|
402
|
+
if (binding === undefined)
|
|
403
|
+
return;
|
|
404
|
+
if (binding.following)
|
|
405
|
+
this.#host.batch.within(() => binding.retarget(), BACKGROUND_CONTEXT);
|
|
406
|
+
else
|
|
407
|
+
binding.retarget();
|
|
408
|
+
binding.moved();
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
//# sourceMappingURL=remote-object.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote-object.js","sourceRoot":"","sources":["../../../src/next/remote/remote-object.ts"],"names":[],"mappings":"AAAA,uHAAuH;AACvH,qHAAqH;AACrH,4DA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,IAAI,IAAI,KAAK,OAAO,IAAI,IAAI,KAAK,SAAS;YAAE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACjE,CAAC;IAED,mHAAmH;IACnH,KAAK,CAAC,KAAe;QACpB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC9B,IAAI,OAAO,KAAK,SAAS;YAAE,OAAO;QAClC,IAAI,OAAO,CAAC,SAAS;YAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,kBAAkB,CAAC,CAAC;;YACxF,OAAO,CAAC,QAAQ,EAAE,CAAC;QACxB,OAAO,CAAC,KAAK,EAAE,CAAC;IACjB,CAAC;CACD","sourcesContent":["// An object held over a link (§7): what one remote reference is bound to on the consumer, across the links of its path\n// (the parent, or a route address). Its state, the replicas of its last bound variant (kept while its link is down),\n// its hold on the path's current link and calls through it.\n\nimport { BACKGROUND_CONTEXT, type Context } from \"../../context/index.ts\";\nimport type { JsonValue } from \"../../json.ts\";\nimport type { Contract, ParamsOf } from \"../contracts/index.ts\";\nimport {\n\tcurrentVariants,\n\ttype MethodData,\n\ttype VariantNames,\n\tvariantNames,\n\tvariantOrder,\n} from \"../contracts/internal.ts\";\nimport { ChordError } from \"../data/index.ts\";\nimport { asChordError, invalid } from \"../data/internal.ts\";\nimport {\n\ttype AnyHost,\n\ttype Attachable,\n\ttype Binding,\n\ttype Caller,\n\ttype CheckedParams,\n\ttype ChordObject,\n\ttype Followed,\n\tLIVE,\n\tLOADING,\n\ttype PinnedKey,\n\ttype RefState,\n\ttype RetryWalk,\n\ttype Target,\n} from \"../host/internal.ts\";\nimport {\n\ttype BoundEntry,\n\terrorFromWire,\n\tjsonPart,\n\ttype Message,\n\tparsePart,\n\ttype StateEntry,\n\ttype WireAddress,\n} from \"../link/internal.ts\";\nimport type { DeriveSource } from \"../state/internal.ts\";\nimport type { ConsumerSide } from \"./consumer.ts\";\nimport type { HoldRequest } from \"./hold.ts\";\nimport type { HostLink } from \"./host-link.ts\";\nimport type { Path } from \"./path.ts\";\nimport { type MemberSnapshot, Replica } from \"./replica.ts\";\n\n/** The last binding: its variant, methods, the bound version's names (the wire's indexes) and a replica per member. */\ntype Bound = {\n\treadonly variant: string;\n\treadonly methods: ReadonlyMap<string, MethodData>;\n\treadonly names: VariantNames;\n\treadonly replicas: ReadonlyMap<string, Replica>;\n};\n\n/**\n * One remote reference's object, owned by its host across the links of its path. It is `loading` until a link's hold\n * of it is bound, and again whenever that link drops or its relay's upstream starts over; each link holds it with its\n * own id. Two references are two holds, each member of each with its own Delta decoder.\n */\nexport class RemoteObject implements Target {\n\treadonly kind = \"remote\";\n\t/** The object in errors: its type, and its params key when it has params. */\n\treadonly label: string;\n\treadonly contract: Contract;\n\treadonly #host: AnyHost;\n\t/** What its holds ask for: the params as a part (checked by L1 when the reference was made), the address. */\n\treadonly request: HoldRequest;\n\t/** Whom its reference acts for: named on route links (`actingFor`). */\n\treadonly caller: Caller;\n\t/** Its params, for placing it anew (`retry` after a part past the limits). */\n\treadonly #params: ParamsOf<Contract>;\n\t/** Its path: the parent's or a route address's; the host's `unplaced` one after a part past the limits. */\n\t#path: Path;\n\t/** The object whose activation declared the reference (`self.get`): its holds carry its chain while it activates. */\n\t#dependent: ChordObject | undefined;\n\t#state: RefState = LOADING;\n\t/** The last binding, kept while loading or failed: members keep their last values and watches. */\n\t#bound: Bound | undefined;\n\t/** The hold on the path's link while one is open: that link's consumer side and this hold's id on it. */\n\t#hold: { readonly side: ConsumerSide; readonly id: number } | undefined;\n\t#binding: Binding | undefined;\n\t#lastFailure: ChordError | undefined;\n\n\tconstructor(\n\t\thost: AnyHost,\n\t\tcontract: Contract,\n\t\t{ params, key }: CheckedParams,\n\t\taddress: WireAddress,\n\t\tcaller: Caller,\n\t\tpath: Path,\n\t\tdependent: ChordObject | undefined,\n\t) {\n\t\tthis.#host = host;\n\t\tthis.contract = contract;\n\t\tthis.label = key === \"\" ? contract.name : `${contract.name}(${key})`;\n\t\tconst { name: type, version, fingerprint } = contract;\n\t\tthis.request = {\n\t\t\ttype,\n\t\t\tversion,\n\t\t\tfingerprint,\n\t\t\tparams: jsonPart(params),\n\t\t\taddress,\n\t\t};\n\t\tthis.caller = caller;\n\t\tthis.#params = params;\n\t\tthis.#path = path;\n\t\tthis.#dependent = dependent;\n\t}\n\n\tget state(): RefState {\n\t\treturn this.#state;\n\t}\n\n\t/** An object over a link is no blocker of this host's first pass. */\n\tget blocksFirstPass(): false {\n\t\treturn false;\n\t}\n\n\t/** The error of the last `failed`, until `bound`. */\n\tget lastFailure(): ChordError | undefined {\n\t\treturn this.#lastFailure;\n\t}\n\n\t/** The variant last bound; `undefined` before the first binding. */\n\tget variant(): string | undefined {\n\t\treturn this.#bound?.variant;\n\t}\n\n\t/** Whether its state members have values: bound once. */\n\tget hydrated(): boolean {\n\t\treturn this.#bound !== undefined;\n\t}\n\n\t/** Its one reference bound to it. */\n\thold(binding: Binding): void {\n\t\tthis.#binding = binding;\n\t}\n\n\t/** The reference was released: the current link's provider is told and the reference's sent calls rejected. */\n\tunhold(_binding: Binding): void {\n\t\tconst error = new ChordError({ code: \"released\", message: `${this.label}: released` });\n\t\tthis.#hold?.side.release(this.#hold.id, error);\n\t\tthis.#end(error);\n\t}\n\n\t/**\n\t * Holds on `link`, the path's link now (a first hold, or a re-hold on a new link), with the activation chain of its\n\t * dependent while that activates (Q5).\n\t */\n\tattach(link: HostLink): void {\n\t\tconst chain = this.#dependent?.activationChain();\n\t\tthis.#hold = { side: link.consumer, id: link.consumer.attach(this, chain) };\n\t}\n\n\t/**\n\t * Its path's address cannot be reached for now (a route's `resolve` failed, a suspension): `failed { waiting }` with\n\t * `error`, still on the path, bound by its next link.\n\t */\n\tunreachable(error: ChordError): void {\n\t\tthis.#lastFailure = error;\n\t\tif (this.#state.kind !== \"ended\")\n\t\t\tthis.#move({ kind: \"failed\", cause: { kind: \"waiting\", error }, retryAt: undefined });\n\t}\n\n\t/** The link dropped: loading until a new link's hold is bound (`#startOver`). */\n\tdropped(_error: ChordError): void {\n\t\tthis.#hold = undefined;\n\t\tthis.#startOver();\n\t}\n\n\t/**\n\t * Calls a method of the bound variant over the link; one outside it fails `invalid/member`. Only a live object is\n\t * called: bound on an open link.\n\t */\n\tasync call(method: string, args: unknown, context: Context): Promise<unknown> {\n\t\tconst bound = this.#bound!;\n\t\tconst hold = this.#hold!;\n\t\tconst data = bound.methods.get(method);\n\t\tif (data === undefined) {\n\t\t\tthrow invalid(\"member\", `${this.label} (variant ${bound.variant}) has no method \"${method}\"`);\n\t\t}\n\t\t// Arguments are checked by the provider.\n\t\treturn hold.side.call(hold.id, bound.names.methods.indexOf(method), data, args, context);\n\t}\n\n\t/**\n\t * The replica of `member`; `not_ready` before the first binding, `invalid/member` for a member no binding had (one\n\t * a later variant lacks reads its `invalid/member` failure).\n\t */\n\tmember(member: string): DeriveSource {\n\t\tconst bound = this.#bound;\n\t\tif (bound === undefined) throw new ChordError({ code: \"not_ready\", message: `${this.label}: not bound yet` });\n\t\tconst replica = bound.replicas.get(member);\n\t\tif (replica === undefined) {\n\t\t\tthrow invalid(\"member\", `${this.label} (variant ${bound.variant}) has no state member \"${member}\"`);\n\t\t}\n\t\treturn replica;\n\t}\n\n\t/**\n\t * What its reference follows of `member` (a consumer over a link binds at its own version, mapped at the provider):\n\t * the replica while live, a member the bound variant lacks (`invalid/member`); while loading or failed nothing, the\n\t * replica (kept until the next binding) giving its last value (rule 5).\n\t */\n\tfollowed(member: string, _version: number): Followed {\n\t\tconst bound = this.#bound;\n\t\tconst replica = bound?.replicas.get(member);\n\t\tconst state = this.#state;\n\t\tif (state.kind === \"live\") {\n\t\t\tif (replica !== undefined) return { kind: \"live\", source: replica, instance: bound };\n\t\t\tconst message = `${this.label} (variant ${bound?.variant}) has no state member \"${member}\"`;\n\t\t\treturn { kind: \"lacking\", error: invalid(\"member\", message) };\n\t\t}\n\t\tif (state.kind === \"failed\") return { kind: \"failed\", error: state.cause.error, last: replica, instance: bound };\n\t\treturn { kind: \"loading\", last: replica, instance: bound };\n\t}\n\n\t/** Its binding while live (its replicas change); `undefined` while loading or failed. */\n\tget attachable(): Attachable | undefined {\n\t\treturn this.#state.kind === \"live\" ? this.#bound : undefined;\n\t}\n\n\t/** Keyed members are only in local contracts: no instance to pin a key on. */\n\tget instance(): undefined {\n\t\treturn undefined;\n\t}\n\n\t/** Keyed members are only in local contracts (`keyedMember`). */\n\tkeyedMapping(member: string): never {\n\t\treturn this.keyedMember(member);\n\t}\n\n\t/** Keyed members are only in local contracts (`keyedMember`). */\n\tasync pinKey(member: string): Promise<PinnedKey> {\n\t\treturn this.keyedMember(member);\n\t}\n\n\t/** Keyed members are only in local contracts, whose objects are never held over a link (slice 6a §12). */\n\tkeyedMember(member: string): never {\n\t\tthrow invalid(\"member\", `${this.label} has no keyed member \"${member}\": keyed members are local`);\n\t}\n\n\t/** An object over a link activates on another host: it is in no chain here (Q5). */\n\tget activationId(): undefined {\n\t\treturn undefined;\n\t}\n\n\t/** An object over a link waits for nothing on this host: no chain of waits (its holds carry the chain, Q5). */\n\tpathTo(): undefined {\n\t\treturn undefined;\n\t}\n\n\t/**\n\t * `ref.retry()`, as a step of `walk`: a failed object's provider is asked for an attempt with the walk's hop budget,\n\t * none left: nothing is sent (a hold it refused is started there again; a parked object there passes it on with one\n\t * hop less). One that failed for a part past the link's limits is placed anew and held with a new id, now or on its\n\t * path's next link (a `hostAddress` that throws fails it broken again).\n\t */\n\tretry(walk: RetryWalk): void {\n\t\tif (this.#state.kind !== \"failed\") return;\n\t\tif (this.#path === this.#host.unplaced) {\n\t\t\tthis.#place();\n\t\t\treturn;\n\t\t}\n\t\tif (walk.hops > 0) this.#hold?.side.retry(this.#hold.id, walk.hops);\n\t}\n\n\t/** Places a reference whose part was past the limits anew, on its path now (a throwing `hostAddress` fails it). */\n\t#place(): void {\n\t\tlet path: Path;\n\t\ttry {\n\t\t\tpath = this.#host.pathOf(this.contract, this.#params, this.caller.principal);\n\t\t} catch (error) {\n\t\t\tthis.#fail(asChordError(error, this.contract.name));\n\t\t\treturn;\n\t\t}\n\t\tthis.#path.detach(this);\n\t\tthis.#path = path;\n\t\tthis.#move(LOADING);\n\t\tpath.attach(this);\n\t}\n\n\t/**\n\t * A part of its snapshot or of a state change was past the link's limits (`too_large/part`): the hold is released\n\t * at the provider, and the reference fails broken with `error`, final: no link holds it again (a reconnect\n\t * included) until `retry`.\n\t */\n\ttooLarge(error: ChordError): void {\n\t\tconst hold = this.#hold;\n\t\tif (hold === undefined) return;\n\t\tthis.#hold = undefined;\n\t\thold.side.release(hold.id, error);\n\t\tthis.#path.detach(this);\n\t\tthis.#path = this.#host.unplaced;\n\t\tthis.#path.attach(this);\n\t\tthis.#fail(error);\n\t}\n\n\t/** Fails broken with `error`: no automatic retry. */\n\t#fail(error: ChordError): void {\n\t\tthis.#lastFailure = error;\n\t\tthis.#move({ kind: \"failed\", cause: { kind: \"broken\", error }, retryAt: undefined });\n\t}\n\n\t/**\n\t * Prepares one entry of a `bound` message (a first binding, a re-hold; a live hold is bound again): the\n\t * variant and every state member once, as a value or as failed. Returns what applies it inside the batch of the\n\t * whole message: a member it had gets the snapshot as one frame `[[\"r\", value]]` and a fresh decoder, a member\n\t * outside the new variant fails (its replica stays, for a later binding that has it again), a new one gets its first\n\t * value. Throws on a snapshot that\n\t * does not fit (a protocol error), and `too_large/part` for a value past the link's limits, before anything changed.\n\t * `wentLive` follows the batch.\n\t */\n\tprepareBound(entry: BoundEntry, link: HostLink): () => void {\n\t\tconst variant = variantOrder(this.contract)[entry.variant];\n\t\tif (variant === undefined) throw new Error(`hold ${entry.hold}: no variant ${entry.variant}`);\n\t\tconst data = currentVariants(this.contract).get(variant)!;\n\t\tconst names = variantNames(data);\n\t\tconst members = new Map<string, MemberSnapshot>();\n\t\tconst add = (index: number, state: MemberSnapshot): void => {\n\t\t\tconst member = names.state[index];\n\t\t\tif (member === undefined || members.has(member))\n\t\t\t\tthrow new Error(`hold ${entry.hold}: member ${index} in bound`);\n\t\t\tmembers.set(member, state);\n\t\t};\n\t\t// Fresh JSON from the link: state is JSON and never validated (§30).\n\t\tfor (const { member, value } of entry.members) {\n\t\t\tadd(member, { kind: \"value\", value: parsePart(link.openPart(value, link.limits, link.context)) as JsonValue });\n\t\t}\n\t\tfor (const { member, error } of entry.failed) add(member, { kind: \"failed\", error: errorFromWire(error) });\n\t\tif (members.size !== names.state.length) throw new Error(`hold ${entry.hold}: the snapshot misses a member`);\n\t\treturn () => {\n\t\t\tconst previous = this.#bound?.replicas;\n\t\t\tconst replicas = new Map<string, Replica>();\n\t\t\t// First: a derive recomputing in this batch reads the new variant through its reference.\n\t\t\tthis.#bound = { variant, methods: data.methods, names, replicas };\n\t\t\tfor (const [member, state] of members) {\n\t\t\t\tconst replica = previous?.get(member);\n\t\t\t\tif (replica === undefined) {\n\t\t\t\t\treplicas.set(member, new Replica(this.#host.batch, state));\n\t\t\t\t} else {\n\t\t\t\t\treplica.reset(state);\n\t\t\t\t\treplicas.set(member, replica);\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (const [member, replica] of previous ?? []) {\n\t\t\t\tif (members.has(member)) continue;\n\t\t\t\treplica.vanish(invalid(\"member\", `${this.label} (variant ${variant}) has no state member \"${member}\"`));\n\t\t\t\treplicas.set(member, replica);\n\t\t\t}\n\t\t};\n\t}\n\n\t/** After a `bound` message's batch: the reference goes live (its parked calls are sent, a parked dependent goes on). */\n\twentLive(): void {\n\t\tthis.#lastFailure = undefined;\n\t\tthis.#move(LIVE);\n\t}\n\n\t/**\n\t * `failed`: the provider's object failed and no attempt runs (`retryIn`: the rest of its backoff window), or the hold\n\t * is unbound there or its object parked on a failed dependency (`waiting`), each new cause a new message. On a bound\n\t * hold it unbinds it (slice 7b, model §5): the members keep their last values until the next `bound`.\n\t */\n\tfailed(message: Extract<Message, { readonly kind: \"failed\" }>): void {\n\t\t// A plugin's error a provider failed with is this object's failure, as a ChordError.\n\t\tconst error = asChordError(errorFromWire(message.cause.error), this.label);\n\t\tthis.#lastFailure = error;\n\t\tconst retryAt = message.retryIn === undefined ? undefined : Date.now() + message.retryIn;\n\t\tthis.#move({ kind: \"failed\", cause: { kind: message.cause.kind, error }, retryAt });\n\t}\n\n\t/**\n\t * `loading`: the provider's object started a new attempt after a failure, or its relay's upstream link dropped\n\t * (`#startOver`).\n\t */\n\tloading(): void {\n\t\tthis.#startOver();\n\t}\n\n\t/**\n\t * Decodes and applies one entry of a state message (its members by index, each with its ops), without changing\n\t * anything yet: returns what adopts it into the replicas, run inside the batch that applies the whole message.\n\t * Throws on an entry that does not fit (a protocol error), and `too_large/part` for ops past the link's limits.\n\t */\n\tprepare({ hold: id, members, failed, retired }: StateEntry, link: HostLink): () => void {\n\t\tconst bound = this.#bound;\n\t\tif (this.#state.kind !== \"live\" || bound === undefined) throw new Error(`hold ${id}: state before bound`);\n\t\tconst replica = (index: number): Replica => {\n\t\t\tconst name = bound.names.state[index];\n\t\t\tconst found = name === undefined ? undefined : bound.replicas.get(name);\n\t\t\tif (found === undefined) throw new Error(`hold ${id}: no state member ${index}`);\n\t\t\treturn found;\n\t\t};\n\t\t// Made by the first retirement (rare): no allocation per message otherwise.\n\t\tlet retirements: Set<Replica> | undefined;\n\t\tfor (const member of retired) {\n\t\t\tconst target = replica(member);\n\t\t\tretirements ??= new Set();\n\t\t\tif (retirements.has(target)) throw new Error(`hold ${id}: member ${member} retired twice in one state`);\n\t\t\tretirements.add(target);\n\t\t}\n\t\tconst changed = new Set<Replica>();\n\t\tconst updates = members.map(({ member, ops }) => {\n\t\t\tconst target = replica(member);\n\t\t\tif (changed.has(target)) throw new Error(`hold ${id}: member ${member} twice in one state`);\n\t\t\tchanged.add(target);\n\t\t\treturn { target, ...target.decode(parsePart(link.openPart(ops, link.limits, link.context))) };\n\t\t});\n\t\tconst failures = failed.map(({ member, error }) => ({ target: replica(member), error: errorFromWire(error) }));\n\t\treturn () => {\n\t\t\tfor (const { target, value, ops } of updates) target.adopt(value, ops, retirements?.has(target) === true);\n\t\t\tfor (const { target, error } of failures) target.fail(error);\n\t\t\t// A retirement without ops (a derive whose value stayed, rule 21): the flag alone, after the failures (a\n\t\t\t// failed member keeps it for its next value).\n\t\t\tif (retirements !== undefined) {\n\t\t\t\tfor (const target of retirements) if (!changed.has(target)) target.retireAlone();\n\t\t\t}\n\t\t};\n\t}\n\n\t/**\n\t * Its principal was revoked on this host (`host.revoke`): released at its provider if it is held there, then ended\n\t * with `error` as `lost` does; no later link holds it.\n\t */\n\trevoke(error: ChordError): void {\n\t\tconst hold = this.#hold;\n\t\tthis.#hold = undefined;\n\t\thold?.side.release(hold.id, error);\n\t\tthis.lost(error);\n\t}\n\n\t/** `gone`, or the host closes: the reference ends, its calls reject with `error`. */\n\tlost(error: ChordError): void {\n\t\tconst binding = this.#binding;\n\t\tthis.#hold?.side.forget(this.#hold.id, error);\n\t\tthis.#end(error);\n\t\tbinding?.end(error);\n\t}\n\n\t/** Ends the object: detached from its path, waits rejected, replicas ended; keeps nothing of its reference. */\n\t#end(error: ChordError): void {\n\t\tconst bound = this.#bound;\n\t\tthis.#state = { kind: \"ended\", error };\n\t\tthis.#binding = undefined;\n\t\tthis.#dependent = undefined;\n\t\tthis.#hold = undefined;\n\t\tthis.#bound = undefined;\n\t\tthis.#path.detach(this);\n\t\tfor (const replica of bound?.replicas.values() ?? []) replica.end(error);\n\t}\n\n\t/**\n\t * Loading again until the next binding; the members keep their last values. A drop while it is loading already\n\t * changes nothing: a dependent parked on it goes on waiting for the next link's binding (a drop is not a dependency\n\t * failure).\n\t */\n\t#startOver(): void {\n\t\tconst { kind } = this.#state;\n\t\tif (kind !== \"ended\" && kind !== \"loading\") this.#move(LOADING);\n\t}\n\n\t/** Moves to `state` and tells the reference: its members follow what it shows now (in a batch), then its state. */\n\t#move(state: RefState): void {\n\t\tthis.#state = state;\n\t\tconst binding = this.#binding;\n\t\tif (binding === undefined) return;\n\t\tif (binding.following) this.#host.batch.within(() => binding.retarget(), BACKGROUND_CONTEXT);\n\t\telse binding.retarget();\n\t\tbinding.moved();\n\t}\n}\n"]}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { Context } from "../../context/index.ts";
|
|
2
|
+
import { type Op } from "../../delta/index.ts";
|
|
3
|
+
import type { JsonValue } from "../../json.ts";
|
|
4
|
+
import type { ChordError } from "../data/index.ts";
|
|
5
|
+
import { type Batch, Source, type WatchStart } from "../state/internal.ts";
|
|
6
|
+
/** A member as a snapshot has it: a value, or failed. */
|
|
7
|
+
export type MemberSnapshot = {
|
|
8
|
+
readonly kind: "value";
|
|
9
|
+
readonly value: JsonValue;
|
|
10
|
+
} | {
|
|
11
|
+
readonly kind: "failed";
|
|
12
|
+
readonly error: unknown;
|
|
13
|
+
};
|
|
14
|
+
/** One state member of a hold, as the consumer reads and watches it; changed only inside the consumer's batch. */
|
|
15
|
+
export declare class Replica extends Source {
|
|
16
|
+
#private;
|
|
17
|
+
constructor(batch: Batch, state: MemberSnapshot);
|
|
18
|
+
get value(): JsonValue;
|
|
19
|
+
/** Its value, or while failed its failure and last good value. */
|
|
20
|
+
start(): WatchStart;
|
|
21
|
+
/**
|
|
22
|
+
* The value `wire` (this member's wire ops from one state part) makes, and its ops; changes nothing yet. Throws on
|
|
23
|
+
* ops that do not fit (a protocol error): an ended member's, and a failed member's other than its recovery, which
|
|
24
|
+
* the provider sends as `[["r", value]]`.
|
|
25
|
+
*/
|
|
26
|
+
decode(wire: unknown): {
|
|
27
|
+
readonly value: JsonValue;
|
|
28
|
+
readonly ops: readonly Op[];
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Adopts the member's new value, the ops that made it and whether the provider's document was retired, in the
|
|
32
|
+
* current batch (one adoption per member and batch).
|
|
33
|
+
*/
|
|
34
|
+
adopt(value: JsonValue, ops: readonly Op[], retired: boolean): void;
|
|
35
|
+
/**
|
|
36
|
+
* The provider's document was retired with no ops for this member (a derive whose value stayed, rule 21), in the
|
|
37
|
+
* current batch: the flag alone; while failed it waits for the next value (a failed member's value is never read).
|
|
38
|
+
*/
|
|
39
|
+
retireAlone(): void;
|
|
40
|
+
/**
|
|
41
|
+
* A re-hold's snapshot of the member, in the batch that applies it, with a fresh decoder (the provider's encoder
|
|
42
|
+
* starts anew with it): a value is one frame `[["r", value]]`, a failed member fails.
|
|
43
|
+
*/
|
|
44
|
+
reset(state: MemberSnapshot): void;
|
|
45
|
+
/**
|
|
46
|
+
* The provider's member failed, in the batch that applies it: reads throw `error`, watches get one failure call and
|
|
47
|
+
* stay open, derives over it fail; its recovery is `[["r", value]]`.
|
|
48
|
+
*/
|
|
49
|
+
fail(error: unknown): void;
|
|
50
|
+
deliver(context: Context): void;
|
|
51
|
+
/**
|
|
52
|
+
* The member is not in a newly bound variant, in the batch that binds it: as a failure (`fail`) with `error`; a later
|
|
53
|
+
* binding of a variant that has it brings it back (`reset`), as on the provider's host.
|
|
54
|
+
*/
|
|
55
|
+
vanish(error: ChordError): void;
|
|
56
|
+
/** Its reference ended (outside a batch): reads throw `error`, watches end `ended`. */
|
|
57
|
+
end(error: ChordError): void;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=replica.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replica.d.ts","sourceRoot":"","sources":["../../../src/next/remote/replica.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAA2B,KAAK,EAAE,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,KAAK,KAAK,EAAa,MAAM,EAAE,KAAK,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAYtF,yDAAyD;AACz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