@earendil-works/chord 1.4.0 → 1.5.1
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 +92 -0
- package/README.md +115 -90
- package/dist/context/index.d.ts +1 -1
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +1 -1
- package/dist/context/index.js.map +1 -1
- package/dist/contracts/accepts.d.ts +81 -0
- package/dist/contracts/accepts.d.ts.map +1 -0
- package/dist/contracts/accepts.js +123 -0
- package/dist/contracts/accepts.js.map +1 -0
- package/dist/contracts/contract.d.ts +121 -0
- package/dist/contracts/contract.d.ts.map +1 -0
- package/dist/contracts/contract.js +50 -0
- package/dist/contracts/contract.js.map +1 -0
- package/dist/contracts/declare.d.ts +107 -0
- package/dist/contracts/declare.d.ts.map +1 -0
- package/dist/contracts/declare.js +136 -0
- package/dist/contracts/declare.js.map +1 -0
- package/dist/contracts/evolve.d.ts +92 -0
- package/dist/contracts/evolve.d.ts.map +1 -0
- package/dist/contracts/evolve.js +179 -0
- package/dist/contracts/evolve.js.map +1 -0
- package/dist/contracts/fingerprint.d.ts +16 -0
- package/dist/contracts/fingerprint.d.ts.map +1 -0
- package/dist/contracts/fingerprint.js +50 -0
- package/dist/contracts/fingerprint.js.map +1 -0
- package/dist/contracts/history.d.ts +71 -0
- package/dist/contracts/history.d.ts.map +1 -0
- package/dist/contracts/history.js +3 -0
- package/dist/contracts/history.js.map +1 -0
- package/dist/contracts/host-kind.d.ts +40 -0
- package/dist/contracts/host-kind.d.ts.map +1 -0
- package/dist/contracts/host-kind.js +37 -0
- package/dist/contracts/host-kind.js.map +1 -0
- package/dist/contracts/index.d.ts +7 -0
- package/dist/contracts/index.d.ts.map +1 -0
- package/dist/contracts/index.js +6 -0
- package/dist/contracts/index.js.map +1 -0
- package/dist/contracts/internal.d.ts +10 -0
- package/dist/contracts/internal.d.ts.map +1 -0
- package/dist/contracts/internal.js +9 -0
- package/dist/contracts/internal.js.map +1 -0
- package/dist/contracts/names.d.ts +3 -0
- package/dist/contracts/names.d.ts.map +1 -0
- package/dist/contracts/names.js +13 -0
- package/dist/contracts/names.js.map +1 -0
- package/dist/contracts/params.d.ts +28 -0
- package/dist/contracts/params.d.ts.map +1 -0
- package/dist/contracts/params.js +50 -0
- package/dist/contracts/params.js.map +1 -0
- package/dist/contracts/schema.d.ts +102 -0
- package/dist/contracts/schema.d.ts.map +1 -0
- package/dist/contracts/schema.js +103 -0
- package/dist/contracts/schema.js.map +1 -0
- package/dist/contracts/snapshot.d.ts +16 -0
- package/dist/contracts/snapshot.d.ts.map +1 -0
- package/dist/contracts/snapshot.js +167 -0
- package/dist/contracts/snapshot.js.map +1 -0
- package/dist/data/args.d.ts +50 -0
- package/dist/data/args.d.ts.map +1 -0
- package/dist/data/args.js +83 -0
- package/dist/data/args.js.map +1 -0
- package/dist/data/errors.d.ts +80 -0
- package/dist/data/errors.d.ts.map +1 -0
- package/dist/data/errors.js +116 -0
- package/dist/data/errors.js.map +1 -0
- package/dist/data/failure.d.ts +26 -0
- package/dist/data/failure.d.ts.map +1 -0
- package/dist/data/failure.js +77 -0
- package/dist/data/failure.js.map +1 -0
- package/dist/data/index.d.ts +4 -0
- package/dist/data/index.d.ts.map +1 -0
- package/dist/data/index.js +5 -0
- package/dist/data/index.js.map +1 -0
- package/dist/data/internal.d.ts +7 -0
- package/dist/data/internal.d.ts.map +1 -0
- package/dist/data/internal.js +8 -0
- package/dist/data/internal.js.map +1 -0
- package/dist/data/params.d.ts +20 -0
- package/dist/data/params.d.ts.map +1 -0
- package/dist/data/params.js +31 -0
- package/dist/data/params.js.map +1 -0
- package/dist/data/principal.d.ts +22 -0
- package/dist/data/principal.d.ts.map +1 -0
- package/dist/data/principal.js +49 -0
- package/dist/data/principal.js.map +1 -0
- package/dist/data/validator.d.ts +12 -0
- package/dist/data/validator.d.ts.map +1 -0
- package/dist/data/validator.js +35 -0
- package/dist/data/validator.js.map +1 -0
- 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/documents/address-source.d.ts +20 -0
- package/dist/documents/address-source.d.ts.map +1 -0
- package/dist/documents/address-source.js +44 -0
- package/dist/documents/address-source.js.map +1 -0
- package/dist/documents/definition.d.ts +84 -0
- package/dist/documents/definition.d.ts.map +1 -0
- package/dist/documents/definition.js +74 -0
- package/dist/documents/definition.js.map +1 -0
- package/dist/documents/documents.d.ts +126 -0
- package/dist/documents/documents.d.ts.map +1 -0
- package/dist/documents/documents.js +248 -0
- package/dist/documents/documents.js.map +1 -0
- package/dist/documents/fence.d.ts +9 -0
- package/dist/documents/fence.d.ts.map +1 -0
- package/dist/documents/fence.js +15 -0
- package/dist/documents/fence.js.map +1 -0
- package/dist/documents/handles.d.ts +76 -0
- package/dist/documents/handles.d.ts.map +1 -0
- package/dist/documents/handles.js +66 -0
- package/dist/documents/handles.js.map +1 -0
- package/dist/documents/index.d.ts +4 -0
- package/dist/documents/index.d.ts.map +1 -0
- package/dist/documents/index.js +3 -0
- package/dist/documents/index.js.map +1 -0
- package/dist/documents/internal.d.ts +9 -0
- package/dist/documents/internal.d.ts.map +1 -0
- package/dist/documents/internal.js +9 -0
- package/dist/documents/internal.js.map +1 -0
- package/dist/documents/keyed-slot.d.ts +103 -0
- package/dist/documents/keyed-slot.d.ts.map +1 -0
- package/dist/documents/keyed-slot.js +395 -0
- package/dist/documents/keyed-slot.js.map +1 -0
- package/dist/documents/line.d.ts +7 -0
- package/dist/documents/line.d.ts.map +1 -0
- package/dist/documents/line.js +14 -0
- package/dist/documents/line.js.map +1 -0
- package/dist/documents/persistence.d.ts +104 -0
- package/dist/documents/persistence.d.ts.map +1 -0
- package/dist/documents/persistence.js +129 -0
- package/dist/documents/persistence.js.map +1 -0
- package/dist/documents/residency.d.ts +31 -0
- package/dist/documents/residency.d.ts.map +1 -0
- package/dist/documents/residency.js +93 -0
- package/dist/documents/residency.js.map +1 -0
- package/dist/documents/slot.d.ts +109 -0
- package/dist/documents/slot.d.ts.map +1 -0
- package/dist/documents/slot.js +181 -0
- package/dist/documents/slot.js.map +1 -0
- package/dist/documents/transaction.d.ts +143 -0
- package/dist/documents/transaction.d.ts.map +1 -0
- package/dist/documents/transaction.js +442 -0
- package/dist/documents/transaction.js.map +1 -0
- package/dist/host/activity.d.ts +31 -0
- package/dist/host/activity.d.ts.map +1 -0
- package/dist/host/activity.js +40 -0
- package/dist/host/activity.js.map +1 -0
- package/dist/host/adapted.d.ts +49 -0
- package/dist/host/adapted.d.ts.map +1 -0
- package/dist/host/adapted.js +214 -0
- package/dist/host/adapted.js.map +1 -0
- package/dist/host/attempt.d.ts +308 -0
- package/dist/host/attempt.d.ts.map +1 -0
- package/dist/host/attempt.js +1199 -0
- package/dist/host/attempt.js.map +1 -0
- package/dist/host/backoff.d.ts +29 -0
- package/dist/host/backoff.d.ts.map +1 -0
- package/dist/host/backoff.js +69 -0
- package/dist/host/backoff.js.map +1 -0
- package/dist/host/ctx.d.ts +94 -0
- package/dist/host/ctx.d.ts.map +1 -0
- package/dist/host/ctx.js +200 -0
- package/dist/host/ctx.js.map +1 -0
- package/dist/host/deadline.d.ts +12 -0
- package/dist/host/deadline.d.ts.map +1 -0
- package/dist/host/deadline.js +40 -0
- package/dist/host/deadline.js.map +1 -0
- package/dist/host/dependencies.d.ts +65 -0
- package/dist/host/dependencies.d.ts.map +1 -0
- package/dist/host/dependencies.js +115 -0
- package/dist/host/dependencies.js.map +1 -0
- package/dist/host/destination.d.ts +48 -0
- package/dist/host/destination.d.ts.map +1 -0
- package/dist/host/destination.js +101 -0
- package/dist/host/destination.js.map +1 -0
- package/dist/host/facet.d.ts +84 -0
- package/dist/host/facet.d.ts.map +1 -0
- package/dist/host/facet.js +55 -0
- package/dist/host/facet.js.map +1 -0
- package/dist/host/follow.d.ts +52 -0
- package/dist/host/follow.d.ts.map +1 -0
- package/dist/host/follow.js +207 -0
- package/dist/host/follow.js.map +1 -0
- package/dist/host/host.d.ts +571 -0
- package/dist/host/host.d.ts.map +1 -0
- package/dist/host/host.js +1318 -0
- package/dist/host/host.js.map +1 -0
- package/dist/host/index.d.ts +17 -0
- package/dist/host/index.d.ts.map +1 -0
- package/dist/host/index.js +6 -0
- package/dist/host/index.js.map +1 -0
- package/dist/host/internal.d.ts +11 -0
- package/dist/host/internal.d.ts.map +1 -0
- package/dist/host/internal.js +9 -0
- package/dist/host/internal.js.map +1 -0
- package/dist/host/members.d.ts +50 -0
- package/dist/host/members.d.ts.map +1 -0
- package/dist/host/members.js +107 -0
- package/dist/host/members.js.map +1 -0
- package/dist/host/native.d.ts +64 -0
- package/dist/host/native.d.ts.map +1 -0
- package/dist/host/native.js +126 -0
- package/dist/host/native.js.map +1 -0
- package/dist/host/object.d.ts +331 -0
- package/dist/host/object.d.ts.map +1 -0
- package/dist/host/object.js +1296 -0
- package/dist/host/object.js.map +1 -0
- package/dist/host/old-work.d.ts +34 -0
- package/dist/host/old-work.d.ts.map +1 -0
- package/dist/host/old-work.js +52 -0
- package/dist/host/old-work.js.map +1 -0
- package/dist/host/parked.d.ts +23 -0
- package/dist/host/parked.d.ts.map +1 -0
- package/dist/host/parked.js +79 -0
- package/dist/host/parked.js.map +1 -0
- package/dist/host/presence.d.ts +34 -0
- package/dist/host/presence.d.ts.map +1 -0
- package/dist/host/presence.js +117 -0
- package/dist/host/presence.js.map +1 -0
- package/dist/host/readiness.d.ts +27 -0
- package/dist/host/readiness.d.ts.map +1 -0
- package/dist/host/readiness.js +134 -0
- package/dist/host/readiness.js.map +1 -0
- package/dist/host/ref-state.d.ts +53 -0
- package/dist/host/ref-state.d.ts.map +1 -0
- package/dist/host/ref-state.js +83 -0
- package/dist/host/ref-state.js.map +1 -0
- package/dist/host/reference-keys.d.ts +36 -0
- package/dist/host/reference-keys.d.ts.map +1 -0
- package/dist/host/reference-keys.js +168 -0
- package/dist/host/reference-keys.js.map +1 -0
- package/dist/host/reference-source.d.ts +65 -0
- package/dist/host/reference-source.d.ts.map +1 -0
- package/dist/host/reference-source.js +285 -0
- package/dist/host/reference-source.js.map +1 -0
- package/dist/host/reference.d.ts +321 -0
- package/dist/host/reference.d.ts.map +1 -0
- package/dist/host/reference.js +797 -0
- package/dist/host/reference.js.map +1 -0
- package/dist/host/reload-cycle.d.ts +16 -0
- package/dist/host/reload-cycle.d.ts.map +1 -0
- package/dist/host/reload-cycle.js +81 -0
- package/dist/host/reload-cycle.js.map +1 -0
- package/dist/host/retry-on.d.ts +28 -0
- package/dist/host/retry-on.d.ts.map +1 -0
- package/dist/host/retry-on.js +52 -0
- package/dist/host/retry-on.js.map +1 -0
- package/dist/host/revocation.d.ts +16 -0
- package/dist/host/revocation.d.ts.map +1 -0
- package/dist/host/revocation.js +27 -0
- package/dist/host/revocation.js.map +1 -0
- package/dist/host/root.d.ts +37 -0
- package/dist/host/root.d.ts.map +1 -0
- package/dist/host/root.js +68 -0
- package/dist/host/root.js.map +1 -0
- package/dist/host/route.d.ts +64 -0
- package/dist/host/route.d.ts.map +1 -0
- package/dist/host/route.js +227 -0
- package/dist/host/route.js.map +1 -0
- package/dist/host/routines.d.ts +78 -0
- package/dist/host/routines.d.ts.map +1 -0
- package/dist/host/routines.js +398 -0
- package/dist/host/routines.js.map +1 -0
- package/dist/host/sleep.d.ts +9 -0
- package/dist/host/sleep.d.ts.map +1 -0
- package/dist/host/sleep.js +40 -0
- package/dist/host/sleep.js.map +1 -0
- package/dist/host/staging.d.ts +94 -0
- package/dist/host/staging.d.ts.map +1 -0
- package/dist/host/staging.js +304 -0
- package/dist/host/staging.js.map +1 -0
- package/dist/host/unbound-clock.d.ts +23 -0
- package/dist/host/unbound-clock.d.ts.map +1 -0
- package/dist/host/unbound-clock.js +58 -0
- package/dist/host/unbound-clock.js.map +1 -0
- package/dist/host/unbound.d.ts +37 -0
- package/dist/host/unbound.d.ts.map +1 -0
- package/dist/host/unbound.js +88 -0
- package/dist/host/unbound.js.map +1 -0
- package/dist/host/uuid.d.ts +3 -0
- package/dist/host/uuid.d.ts.map +1 -0
- package/dist/host/uuid.js +38 -0
- package/dist/host/uuid.js.map +1 -0
- package/dist/index.d.ts +29 -18
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +20 -9
- package/dist/index.js.map +1 -1
- package/dist/jobs/definition.d.ts +96 -0
- package/dist/jobs/definition.d.ts.map +1 -0
- package/dist/jobs/definition.js +83 -0
- package/dist/jobs/definition.js.map +1 -0
- package/dist/jobs/index.d.ts +5 -0
- package/dist/jobs/index.d.ts.map +1 -0
- package/dist/jobs/index.js +3 -0
- package/dist/jobs/index.js.map +1 -0
- package/dist/jobs/internal.d.ts +3 -0
- package/dist/jobs/internal.d.ts.map +1 -0
- package/dist/jobs/internal.js +4 -0
- package/dist/jobs/internal.js.map +1 -0
- package/dist/jobs/job.d.ts +149 -0
- package/dist/jobs/job.d.ts.map +1 -0
- package/dist/jobs/job.js +387 -0
- package/dist/jobs/job.js.map +1 -0
- package/dist/jobs/persisted.d.ts +38 -0
- package/dist/jobs/persisted.d.ts.map +1 -0
- package/dist/jobs/persisted.js +95 -0
- package/dist/jobs/persisted.js.map +1 -0
- package/dist/jobs/records.d.ts +231 -0
- package/dist/jobs/records.d.ts.map +1 -0
- package/dist/jobs/records.js +871 -0
- package/dist/jobs/records.js.map +1 -0
- package/dist/jobs/run-states.d.ts +69 -0
- package/dist/jobs/run-states.d.ts.map +1 -0
- package/dist/jobs/run-states.js +228 -0
- package/dist/jobs/run-states.js.map +1 -0
- package/dist/jobs/run.d.ts +117 -0
- package/dist/jobs/run.d.ts.map +1 -0
- package/dist/jobs/run.js +204 -0
- package/dist/jobs/run.js.map +1 -0
- package/dist/jobs/running.d.ts +44 -0
- package/dist/jobs/running.d.ts.map +1 -0
- package/dist/jobs/running.js +117 -0
- package/dist/jobs/running.js.map +1 -0
- package/dist/jobs/stored.d.ts +63 -0
- package/dist/jobs/stored.d.ts.map +1 -0
- package/dist/jobs/stored.js +55 -0
- package/dist/jobs/stored.js.map +1 -0
- package/dist/link/binary.d.ts +4 -0
- package/dist/link/binary.d.ts.map +1 -0
- package/dist/link/binary.js +544 -0
- package/dist/link/binary.js.map +1 -0
- package/dist/link/channel.d.ts +68 -0
- package/dist/link/channel.d.ts.map +1 -0
- package/dist/link/channel.js +215 -0
- package/dist/link/channel.js.map +1 -0
- package/dist/link/errors.d.ts +7 -0
- package/dist/link/errors.d.ts.map +1 -0
- package/dist/link/errors.js +21 -0
- package/dist/link/errors.js.map +1 -0
- package/dist/link/index.d.ts +8 -0
- package/dist/link/index.d.ts.map +1 -0
- package/dist/link/index.js +8 -0
- package/dist/link/index.js.map +1 -0
- package/dist/link/internal.d.ts +9 -0
- package/dist/link/internal.d.ts.map +1 -0
- package/dist/link/internal.js +10 -0
- package/dist/link/internal.js.map +1 -0
- package/dist/link/ipc.d.ts +22 -0
- package/dist/link/ipc.d.ts.map +1 -0
- package/dist/link/ipc.js +64 -0
- package/dist/link/ipc.js.map +1 -0
- package/dist/link/link.d.ts +34 -0
- package/dist/link/link.d.ts.map +1 -0
- package/dist/link/link.js +87 -0
- package/dist/link/link.js.map +1 -0
- package/dist/link/message.d.ts +262 -0
- package/dist/link/message.d.ts.map +1 -0
- package/dist/link/message.js +156 -0
- package/dist/link/message.js.map +1 -0
- package/dist/link/part.d.ts +80 -0
- package/dist/link/part.d.ts.map +1 -0
- package/dist/link/part.js +165 -0
- package/dist/link/part.js.map +1 -0
- package/dist/link/text.d.ts +6 -0
- package/dist/link/text.d.ts.map +1 -0
- package/dist/link/text.js +355 -0
- package/dist/link/text.js.map +1 -0
- package/dist/link/values.d.ts +40 -0
- package/dist/link/values.d.ts.map +1 -0
- package/dist/link/values.js +121 -0
- package/dist/link/values.js.map +1 -0
- package/dist/link/websocket.d.ts +26 -0
- package/dist/link/websocket.d.ts.map +1 -0
- package/dist/link/websocket.js +91 -0
- package/dist/link/websocket.js.map +1 -0
- package/dist/node/app/app.d.ts +269 -0
- package/dist/node/app/app.d.ts.map +1 -0
- package/dist/node/app/app.js +513 -0
- package/dist/node/app/app.js.map +1 -0
- package/dist/node/app/archive.d.ts +37 -0
- package/dist/node/app/archive.d.ts.map +1 -0
- package/dist/node/app/archive.js +204 -0
- package/dist/node/app/archive.js.map +1 -0
- package/dist/node/app/blobs.d.ts +23 -0
- package/dist/node/app/blobs.d.ts.map +1 -0
- package/dist/node/app/blobs.js +64 -0
- package/dist/node/app/blobs.js.map +1 -0
- package/dist/node/app/data.d.ts +35 -0
- package/dist/node/app/data.d.ts.map +1 -0
- package/dist/node/app/data.js +44 -0
- package/dist/node/app/data.js.map +1 -0
- package/dist/node/app/ephemeral-sessions.d.ts +20 -0
- package/dist/node/app/ephemeral-sessions.d.ts.map +1 -0
- package/dist/node/app/ephemeral-sessions.js +69 -0
- package/dist/node/app/ephemeral-sessions.js.map +1 -0
- package/dist/node/app/ephemeral.d.ts +11 -0
- package/dist/node/app/ephemeral.d.ts.map +1 -0
- package/dist/node/app/ephemeral.js +34 -0
- package/dist/node/app/ephemeral.js.map +1 -0
- package/dist/node/app/files-copy.d.ts +13 -0
- package/dist/node/app/files-copy.d.ts.map +1 -0
- package/dist/node/app/files-copy.js +86 -0
- package/dist/node/app/files-copy.js.map +1 -0
- package/dist/node/app/files-entry.d.ts +4 -0
- package/dist/node/app/files-entry.d.ts.map +1 -0
- package/dist/node/app/files-entry.js +7 -0
- package/dist/node/app/files-entry.js.map +1 -0
- package/dist/node/app/files-index.d.ts +180 -0
- package/dist/node/app/files-index.d.ts.map +1 -0
- package/dist/node/app/files-index.js +535 -0
- package/dist/node/app/files-index.js.map +1 -0
- package/dist/node/app/files.d.ts +363 -0
- package/dist/node/app/files.d.ts.map +1 -0
- package/dist/node/app/files.js +368 -0
- package/dist/node/app/files.js.map +1 -0
- package/dist/node/app/folder-views.d.ts +21 -0
- package/dist/node/app/folder-views.d.ts.map +1 -0
- package/dist/node/app/folder-views.js +55 -0
- package/dist/node/app/folder-views.js.map +1 -0
- package/dist/node/app/index.d.ts +12 -0
- package/dist/node/app/index.d.ts.map +1 -0
- package/dist/node/app/index.js +15 -0
- package/dist/node/app/index.js.map +1 -0
- package/dist/node/app/info.d.ts +66 -0
- package/dist/node/app/info.d.ts.map +1 -0
- package/dist/node/app/info.js +37 -0
- package/dist/node/app/info.js.map +1 -0
- package/dist/node/app/invite.d.ts +5 -0
- package/dist/node/app/invite.d.ts.map +1 -0
- package/dist/node/app/invite.js +64 -0
- package/dist/node/app/invite.js.map +1 -0
- package/dist/node/app/layout.d.ts +36 -0
- package/dist/node/app/layout.d.ts.map +1 -0
- package/dist/node/app/layout.js +87 -0
- package/dist/node/app/layout.js.map +1 -0
- package/dist/node/app/owner.d.ts +31 -0
- package/dist/node/app/owner.d.ts.map +1 -0
- package/dist/node/app/owner.js +104 -0
- package/dist/node/app/owner.js.map +1 -0
- package/dist/node/app/pairing.d.ts +55 -0
- package/dist/node/app/pairing.d.ts.map +1 -0
- package/dist/node/app/pairing.js +183 -0
- package/dist/node/app/pairing.js.map +1 -0
- package/dist/node/app/secrets.d.ts +16 -0
- package/dist/node/app/secrets.d.ts.map +1 -0
- package/dist/node/app/secrets.js +72 -0
- package/dist/node/app/secrets.js.map +1 -0
- package/dist/node/app/sessions.d.ts +72 -0
- package/dist/node/app/sessions.d.ts.map +1 -0
- package/dist/node/app/sessions.js +222 -0
- package/dist/node/app/sessions.js.map +1 -0
- package/dist/node/app/tar.d.ts +24 -0
- package/dist/node/app/tar.d.ts.map +1 -0
- package/dist/node/app/tar.js +167 -0
- package/dist/node/app/tar.js.map +1 -0
- package/dist/node/app/uploads.d.ts +37 -0
- package/dist/node/app/uploads.d.ts.map +1 -0
- package/dist/node/app/uploads.js +157 -0
- package/dist/node/app/uploads.js.map +1 -0
- package/dist/node/app/users.d.ts +37 -0
- package/dist/node/app/users.d.ts.map +1 -0
- package/dist/node/app/users.js +62 -0
- package/dist/node/app/users.js.map +1 -0
- package/dist/node/app/worker.d.ts +18 -0
- package/dist/node/app/worker.d.ts.map +1 -0
- package/dist/node/app/worker.js +84 -0
- package/dist/node/app/worker.js.map +1 -0
- package/dist/node/compression.d.ts +7 -0
- package/dist/node/compression.d.ts.map +1 -0
- package/dist/node/compression.js +25 -0
- package/dist/node/compression.js.map +1 -0
- package/dist/node/http/admission.d.ts +63 -0
- package/dist/node/http/admission.d.ts.map +1 -0
- package/dist/node/http/admission.js +134 -0
- package/dist/node/http/admission.js.map +1 -0
- package/dist/node/http/authenticate.d.ts +21 -0
- package/dist/node/http/authenticate.d.ts.map +1 -0
- package/dist/node/http/authenticate.js +34 -0
- package/dist/node/http/authenticate.js.map +1 -0
- package/dist/node/http/cookies.d.ts +32 -0
- package/dist/node/http/cookies.d.ts.map +1 -0
- package/dist/node/http/cookies.js +70 -0
- package/dist/node/http/cookies.js.map +1 -0
- package/dist/node/http/file.d.ts +23 -0
- package/dist/node/http/file.d.ts.map +1 -0
- package/dist/node/http/file.js +94 -0
- package/dist/node/http/file.js.map +1 -0
- package/dist/node/http/headers.d.ts +37 -0
- package/dist/node/http/headers.d.ts.map +1 -0
- package/dist/node/http/headers.js +136 -0
- package/dist/node/http/headers.js.map +1 -0
- package/dist/node/http/http.d.ts +111 -0
- package/dist/node/http/http.d.ts.map +1 -0
- package/dist/node/http/http.js +524 -0
- package/dist/node/http/http.js.map +1 -0
- package/dist/node/http/incoming.d.ts +19 -0
- package/dist/node/http/incoming.d.ts.map +1 -0
- package/dist/node/http/incoming.js +31 -0
- package/dist/node/http/incoming.js.map +1 -0
- package/dist/node/http/index.d.ts +11 -0
- package/dist/node/http/index.d.ts.map +1 -0
- package/dist/node/http/index.js +12 -0
- package/dist/node/http/index.js.map +1 -0
- package/dist/node/http/node.d.ts +78 -0
- package/dist/node/http/node.d.ts.map +1 -0
- package/dist/node/http/node.js +291 -0
- package/dist/node/http/node.js.map +1 -0
- package/dist/node/http/request.d.ts +60 -0
- package/dist/node/http/request.d.ts.map +1 -0
- package/dist/node/http/request.js +118 -0
- package/dist/node/http/request.js.map +1 -0
- package/dist/node/http/response.d.ts +63 -0
- package/dist/node/http/response.d.ts.map +1 -0
- package/dist/node/http/response.js +202 -0
- package/dist/node/http/response.js.map +1 -0
- package/dist/node/http/router.d.ts +132 -0
- package/dist/node/http/router.d.ts.map +1 -0
- package/dist/node/http/router.js +267 -0
- package/dist/node/http/router.js.map +1 -0
- package/dist/node/http/upgrades.d.ts +61 -0
- package/dist/node/http/upgrades.d.ts.map +1 -0
- package/dist/node/http/upgrades.js +192 -0
- package/dist/node/http/upgrades.js.map +1 -0
- package/dist/node/plugins/base-inputs.d.ts +14 -0
- package/dist/node/plugins/base-inputs.d.ts.map +1 -0
- package/dist/node/plugins/base-inputs.js +33 -0
- package/dist/node/plugins/base-inputs.js.map +1 -0
- package/dist/node/plugins/build.d.ts +77 -0
- package/dist/node/plugins/build.d.ts.map +1 -0
- package/dist/node/plugins/build.js +576 -0
- package/dist/node/plugins/build.js.map +1 -0
- package/dist/node/plugins/css-modules.d.ts +13 -0
- package/dist/node/plugins/css-modules.d.ts.map +1 -0
- package/dist/node/plugins/css-modules.js +58 -0
- package/dist/node/plugins/css-modules.js.map +1 -0
- package/dist/node/plugins/discover.d.ts +67 -0
- package/dist/node/plugins/discover.d.ts.map +1 -0
- package/dist/node/plugins/discover.js +369 -0
- package/dist/node/plugins/discover.js.map +1 -0
- package/dist/node/plugins/evaluate.d.ts +33 -0
- package/dist/node/plugins/evaluate.d.ts.map +1 -0
- package/dist/node/plugins/evaluate.js +121 -0
- package/dist/node/plugins/evaluate.js.map +1 -0
- package/dist/node/plugins/index.d.ts +11 -0
- package/dist/node/plugins/index.d.ts.map +1 -0
- package/dist/node/plugins/index.js +13 -0
- package/dist/node/plugins/index.js.map +1 -0
- package/dist/node/plugins/install.d.ts +38 -0
- package/dist/node/plugins/install.d.ts.map +1 -0
- package/dist/node/plugins/install.js +213 -0
- package/dist/node/plugins/install.js.map +1 -0
- package/dist/node/plugins/plugins.d.ts +162 -0
- package/dist/node/plugins/plugins.d.ts.map +1 -0
- package/dist/node/plugins/plugins.js +244 -0
- package/dist/node/plugins/plugins.js.map +1 -0
- package/dist/node/plugins/runtime.d.ts +57 -0
- package/dist/node/plugins/runtime.d.ts.map +1 -0
- package/dist/node/plugins/runtime.js +92 -0
- package/dist/node/plugins/runtime.js.map +1 -0
- package/dist/node/plugins/stack.d.ts +16 -0
- package/dist/node/plugins/stack.d.ts.map +1 -0
- package/dist/node/plugins/stack.js +61 -0
- package/dist/node/plugins/stack.js.map +1 -0
- package/dist/node/plugins/testing.d.ts +58 -0
- package/dist/node/plugins/testing.d.ts.map +1 -0
- package/dist/node/plugins/testing.js +210 -0
- package/dist/node/plugins/testing.js.map +1 -0
- package/dist/node/plugins/watcher.d.ts +69 -0
- package/dist/node/plugins/watcher.d.ts.map +1 -0
- package/dist/node/plugins/watcher.js +622 -0
- package/dist/node/plugins/watcher.js.map +1 -0
- package/dist/node/surfaces/bundle.d.ts +31 -0
- package/dist/node/surfaces/bundle.d.ts.map +1 -0
- package/dist/node/surfaces/bundle.js +118 -0
- package/dist/node/surfaces/bundle.js.map +1 -0
- package/dist/node/surfaces/current.d.ts +17 -0
- package/dist/node/surfaces/current.d.ts.map +1 -0
- package/dist/node/surfaces/current.js +54 -0
- package/dist/node/surfaces/current.js.map +1 -0
- package/dist/node/surfaces/index.d.ts +6 -0
- package/dist/node/surfaces/index.d.ts.map +1 -0
- package/dist/node/surfaces/index.js +6 -0
- package/dist/node/surfaces/index.js.map +1 -0
- package/dist/node/surfaces/published.d.ts +27 -0
- package/dist/node/surfaces/published.d.ts.map +1 -0
- package/dist/node/surfaces/published.js +142 -0
- package/dist/node/surfaces/published.js.map +1 -0
- package/dist/node/surfaces/served.d.ts +15 -0
- package/dist/node/surfaces/served.d.ts.map +1 -0
- package/dist/node/surfaces/served.js +42 -0
- package/dist/node/surfaces/served.js.map +1 -0
- package/dist/node/surfaces/surface-build.d.ts +53 -0
- package/dist/node/surfaces/surface-build.d.ts.map +1 -0
- package/dist/node/surfaces/surface-build.js +105 -0
- package/dist/node/surfaces/surface-build.js.map +1 -0
- package/dist/node/surfaces/tui.d.ts +40 -0
- package/dist/node/surfaces/tui.d.ts.map +1 -0
- package/dist/node/surfaces/tui.js +55 -0
- package/dist/node/surfaces/tui.js.map +1 -0
- package/dist/node/surfaces/web.d.ts +56 -0
- package/dist/node/surfaces/web.d.ts.map +1 -0
- package/dist/node/surfaces/web.js +108 -0
- package/dist/node/surfaces/web.js.map +1 -0
- package/dist/node/tui/actions.d.ts +49 -0
- package/dist/node/tui/actions.d.ts.map +1 -0
- package/dist/node/tui/actions.js +195 -0
- package/dist/node/tui/actions.js.map +1 -0
- package/dist/node/tui/credentials.d.ts +17 -0
- package/dist/node/tui/credentials.d.ts.map +1 -0
- package/dist/node/tui/credentials.js +54 -0
- package/dist/node/tui/credentials.js.map +1 -0
- package/dist/node/tui/filter.d.ts +5 -0
- package/dist/node/tui/filter.d.ts.map +1 -0
- package/dist/node/tui/filter.js +79 -0
- package/dist/node/tui/filter.js.map +1 -0
- package/dist/node/tui/index.d.ts +6 -0
- package/dist/node/tui/index.d.ts.map +1 -0
- package/dist/node/tui/index.js +6 -0
- package/dist/node/tui/index.js.map +1 -0
- package/dist/node/tui/launcher.d.ts +40 -0
- package/dist/node/tui/launcher.d.ts.map +1 -0
- package/dist/node/tui/launcher.js +439 -0
- package/dist/node/tui/launcher.js.map +1 -0
- package/dist/node/tui/pipe.d.ts +18 -0
- package/dist/node/tui/pipe.d.ts.map +1 -0
- package/dist/node/tui/pipe.js +134 -0
- package/dist/node/tui/pipe.js.map +1 -0
- package/dist/node/tui/sandbox.d.ts +54 -0
- package/dist/node/tui/sandbox.d.ts.map +1 -0
- package/dist/node/tui/sandbox.js +431 -0
- package/dist/node/tui/sandbox.js.map +1 -0
- package/dist/node/workers/base.d.ts +30 -0
- package/dist/node/workers/base.d.ts.map +1 -0
- package/dist/node/workers/base.js +255 -0
- package/dist/node/workers/base.js.map +1 -0
- package/dist/node/workers/child.d.ts +4 -0
- package/dist/node/workers/child.d.ts.map +1 -0
- package/dist/node/workers/child.js +6 -0
- package/dist/node/workers/child.js.map +1 -0
- package/dist/node/workers/control.d.ts +83 -0
- package/dist/node/workers/control.d.ts.map +1 -0
- package/dist/node/workers/control.js +77 -0
- package/dist/node/workers/control.js.map +1 -0
- package/dist/node/workers/index.d.ts +4 -0
- package/dist/node/workers/index.d.ts.map +1 -0
- package/dist/node/workers/index.js +7 -0
- package/dist/node/workers/index.js.map +1 -0
- package/dist/node/workers/lock.d.ts +30 -0
- package/dist/node/workers/lock.d.ts.map +1 -0
- package/dist/node/workers/lock.js +180 -0
- package/dist/node/workers/lock.js.map +1 -0
- package/dist/node/workers/main.d.ts +46 -0
- package/dist/node/workers/main.d.ts.map +1 -0
- package/dist/node/workers/main.js +230 -0
- package/dist/node/workers/main.js.map +1 -0
- package/dist/node/workers/process.d.ts +42 -0
- package/dist/node/workers/process.d.ts.map +1 -0
- package/dist/node/workers/process.js +125 -0
- package/dist/node/workers/process.js.map +1 -0
- package/dist/node/workers/workers.d.ts +122 -0
- package/dist/node/workers/workers.d.ts.map +1 -0
- package/dist/node/workers/workers.js +677 -0
- package/dist/node/workers/workers.js.map +1 -0
- package/dist/output.d.ts +1 -1
- package/dist/output.d.ts.map +1 -1
- package/dist/output.js +4 -2
- package/dist/output.js.map +1 -1
- package/dist/react/hooks.d.ts +43 -0
- package/dist/react/hooks.d.ts.map +1 -0
- package/dist/react/hooks.js +82 -0
- package/dist/react/hooks.js.map +1 -0
- package/dist/react/index.d.ts +3 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +4 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/stores.d.ts +9 -0
- package/dist/react/stores.d.ts.map +1 -0
- package/dist/react/stores.js +37 -0
- package/dist/react/stores.js.map +1 -0
- package/dist/registries/contribution.d.ts +50 -0
- package/dist/registries/contribution.d.ts.map +1 -0
- package/dist/registries/contribution.js +129 -0
- package/dist/registries/contribution.js.map +1 -0
- package/dist/registries/entries.d.ts +18 -0
- package/dist/registries/entries.d.ts.map +1 -0
- package/dist/registries/entries.js +42 -0
- package/dist/registries/entries.js.map +1 -0
- package/dist/registries/index.d.ts +3 -0
- package/dist/registries/index.d.ts.map +1 -0
- package/dist/registries/index.js +5 -0
- package/dist/registries/index.js.map +1 -0
- package/dist/registries/internal.d.ts +4 -0
- package/dist/registries/internal.d.ts.map +1 -0
- package/dist/registries/internal.js +5 -0
- package/dist/registries/internal.js.map +1 -0
- package/dist/registries/record.d.ts +115 -0
- package/dist/registries/record.d.ts.map +1 -0
- package/dist/registries/record.js +283 -0
- package/dist/registries/record.js.map +1 -0
- package/dist/registries/registry.d.ts +74 -0
- package/dist/registries/registry.d.ts.map +1 -0
- package/dist/registries/registry.js +14 -0
- package/dist/registries/registry.js.map +1 -0
- package/dist/registries/value.d.ts +48 -0
- package/dist/registries/value.d.ts.map +1 -0
- package/dist/registries/value.js +224 -0
- package/dist/registries/value.js.map +1 -0
- package/dist/remote/calls.d.ts +25 -0
- package/dist/remote/calls.d.ts.map +1 -0
- package/dist/remote/calls.js +62 -0
- package/dist/remote/calls.js.map +1 -0
- package/dist/remote/consumer.d.ts +43 -0
- package/dist/remote/consumer.d.ts.map +1 -0
- package/dist/remote/consumer.js +350 -0
- package/dist/remote/consumer.js.map +1 -0
- package/dist/remote/hold.d.ts +141 -0
- package/dist/remote/hold.d.ts.map +1 -0
- package/dist/remote/hold.js +579 -0
- package/dist/remote/hold.js.map +1 -0
- package/dist/remote/host-link.d.ts +77 -0
- package/dist/remote/host-link.d.ts.map +1 -0
- package/dist/remote/host-link.js +184 -0
- package/dist/remote/host-link.js.map +1 -0
- package/dist/remote/internal.d.ts +6 -0
- package/dist/remote/internal.d.ts.map +1 -0
- package/dist/remote/internal.js +6 -0
- package/dist/remote/internal.js.map +1 -0
- package/dist/remote/path.d.ts +46 -0
- package/dist/remote/path.d.ts.map +1 -0
- package/dist/remote/path.js +73 -0
- package/dist/remote/path.js.map +1 -0
- package/dist/remote/provider.d.ts +89 -0
- package/dist/remote/provider.d.ts.map +1 -0
- package/dist/remote/provider.js +597 -0
- package/dist/remote/provider.js.map +1 -0
- package/dist/remote/relay.d.ts +69 -0
- package/dist/remote/relay.d.ts.map +1 -0
- package/dist/remote/relay.js +219 -0
- package/dist/remote/relay.js.map +1 -0
- package/dist/remote/remote-object.d.ts +138 -0
- package/dist/remote/remote-object.d.ts.map +1 -0
- package/dist/remote/remote-object.js +492 -0
- package/dist/remote/remote-object.js.map +1 -0
- package/dist/remote/replica.d.ts +59 -0
- package/dist/remote/replica.d.ts.map +1 -0
- package/dist/remote/replica.js +125 -0
- package/dist/remote/replica.js.map +1 -0
- package/dist/sqlite/cloudflare.d.ts +2 -0
- package/dist/sqlite/cloudflare.d.ts.map +1 -1
- package/dist/sqlite/cloudflare.js +10 -0
- package/dist/sqlite/cloudflare.js.map +1 -1
- package/dist/sqlite/database.d.ts +5 -2
- package/dist/sqlite/database.d.ts.map +1 -1
- package/dist/sqlite/database.js.map +1 -1
- package/dist/sqlite/node.d.ts +13 -2
- package/dist/sqlite/node.d.ts.map +1 -1
- package/dist/sqlite/node.js +31 -8
- package/dist/sqlite/node.js.map +1 -1
- package/dist/state/batch.d.ts +64 -0
- package/dist/state/batch.d.ts.map +1 -0
- package/dist/state/batch.js +164 -0
- package/dist/state/batch.js.map +1 -0
- package/dist/state/derive.d.ts +52 -0
- package/dist/state/derive.d.ts.map +1 -0
- package/dist/state/derive.js +182 -0
- package/dist/state/derive.js.map +1 -0
- package/dist/state/index.d.ts +6 -0
- package/dist/state/index.d.ts.map +1 -0
- package/dist/state/index.js +4 -0
- package/dist/state/index.js.map +1 -0
- package/dist/state/internal.d.ts +6 -0
- package/dist/state/internal.d.ts.map +1 -0
- package/dist/state/internal.js +8 -0
- package/dist/state/internal.js.map +1 -0
- package/dist/state/native-source.d.ts +106 -0
- package/dist/state/native-source.d.ts.map +1 -0
- package/dist/state/native-source.js +240 -0
- package/dist/state/native-source.js.map +1 -0
- package/dist/state/watchable.d.ts +114 -0
- package/dist/state/watchable.d.ts.map +1 -0
- package/dist/state/watchable.js +156 -0
- package/dist/state/watchable.js.map +1 -0
- package/dist/state/writable.d.ts +32 -0
- package/dist/state/writable.d.ts.map +1 -0
- package/dist/state/writable.js +49 -0
- package/dist/state/writable.js.map +1 -0
- package/dist/store/adapter.d.ts +67 -0
- package/dist/store/adapter.d.ts.map +1 -0
- package/dist/store/adapter.js +118 -0
- package/dist/store/adapter.js.map +1 -0
- package/dist/store/allocator.d.ts +17 -0
- package/dist/store/allocator.d.ts.map +1 -0
- package/dist/store/allocator.js +30 -0
- package/dist/store/allocator.js.map +1 -0
- package/dist/store/applier.d.ts +8 -0
- package/dist/store/applier.d.ts.map +1 -0
- package/dist/store/applier.js +375 -0
- package/dist/store/applier.js.map +1 -0
- package/dist/store/apply-batch.d.ts +12 -0
- package/dist/store/apply-batch.d.ts.map +1 -0
- package/dist/store/apply-batch.js +83 -0
- package/dist/store/apply-batch.js.map +1 -0
- package/dist/store/archive.d.ts +32 -0
- package/dist/store/archive.d.ts.map +1 -0
- package/dist/store/archive.js +130 -0
- package/dist/store/archive.js.map +1 -0
- package/dist/store/backend.d.ts +10 -0
- package/dist/store/backend.d.ts.map +1 -0
- package/dist/store/backend.js +15 -0
- package/dist/store/backend.js.map +1 -0
- package/dist/store/catalog.d.ts +24 -0
- package/dist/store/catalog.d.ts.map +1 -0
- package/dist/store/catalog.js +17 -0
- package/dist/store/catalog.js.map +1 -0
- package/dist/store/claims.d.ts +23 -0
- package/dist/store/claims.d.ts.map +1 -0
- package/dist/store/claims.js +65 -0
- package/dist/store/claims.js.map +1 -0
- package/dist/store/columns.d.ts +77 -0
- package/dist/store/columns.d.ts.map +1 -0
- package/dist/store/columns.js +77 -0
- package/dist/store/columns.js.map +1 -0
- package/dist/store/engine.d.ts +176 -0
- package/dist/store/engine.d.ts.map +1 -0
- package/dist/store/engine.js +283 -0
- package/dist/store/engine.js.map +1 -0
- package/dist/store/evaluate.d.ts +17 -0
- package/dist/store/evaluate.d.ts.map +1 -0
- package/dist/store/evaluate.js +128 -0
- package/dist/store/evaluate.js.map +1 -0
- package/dist/store/export.d.ts +17 -0
- package/dist/store/export.d.ts.map +1 -0
- package/dist/store/export.js +200 -0
- package/dist/store/export.js.map +1 -0
- package/dist/store/expression.d.ts +150 -0
- package/dist/store/expression.d.ts.map +1 -0
- package/dist/store/expression.js +268 -0
- package/dist/store/expression.js.map +1 -0
- package/dist/store/import.d.ts +10 -0
- package/dist/store/import.d.ts.map +1 -0
- package/dist/store/import.js +276 -0
- package/dist/store/import.js.map +1 -0
- package/dist/store/index.d.ts +16 -0
- package/dist/store/index.d.ts.map +1 -0
- package/dist/store/index.js +13 -0
- package/dist/store/index.js.map +1 -0
- package/dist/store/json-column.d.ts +33 -0
- package/dist/store/json-column.d.ts.map +1 -0
- package/dist/store/json-column.js +62 -0
- package/dist/store/json-column.js.map +1 -0
- package/dist/store/jsonl.d.ts +9 -0
- package/dist/store/jsonl.d.ts.map +1 -0
- package/dist/store/jsonl.js +61 -0
- package/dist/store/jsonl.js.map +1 -0
- package/dist/store/live-query.d.ts +108 -0
- package/dist/store/live-query.d.ts.map +1 -0
- package/dist/store/live-query.js +254 -0
- package/dist/store/live-query.js.map +1 -0
- package/dist/store/outbox.d.ts +26 -0
- package/dist/store/outbox.d.ts.map +1 -0
- package/dist/store/outbox.js +80 -0
- package/dist/store/outbox.js.map +1 -0
- package/dist/store/query.d.ts +39 -0
- package/dist/store/query.d.ts.map +1 -0
- package/dist/store/query.js +97 -0
- package/dist/store/query.js.map +1 -0
- package/dist/store/refusal.d.ts +15 -0
- package/dist/store/refusal.d.ts.map +1 -0
- package/dist/store/refusal.js +36 -0
- package/dist/store/refusal.js.map +1 -0
- package/dist/store/rows.d.ts +80 -0
- package/dist/store/rows.d.ts.map +1 -0
- package/dist/store/rows.js +183 -0
- package/dist/store/rows.js.map +1 -0
- package/dist/store/schema.d.ts +25 -0
- package/dist/store/schema.d.ts.map +1 -0
- package/dist/store/schema.js +115 -0
- package/dist/store/schema.js.map +1 -0
- package/dist/store/sql.d.ts +73 -0
- package/dist/store/sql.d.ts.map +1 -0
- package/dist/store/sql.js +234 -0
- package/dist/store/sql.js.map +1 -0
- package/dist/store/step.d.ts +50 -0
- package/dist/store/step.d.ts.map +1 -0
- package/dist/store/step.js +52 -0
- package/dist/store/step.js.map +1 -0
- package/dist/store/store.d.ts +171 -0
- package/dist/store/store.d.ts.map +1 -0
- package/dist/store/store.js +818 -0
- package/dist/store/store.js.map +1 -0
- package/dist/store/table-changes.d.ts +29 -0
- package/dist/store/table-changes.d.ts.map +1 -0
- package/dist/store/table-changes.js +102 -0
- package/dist/store/table-changes.js.map +1 -0
- package/dist/store/table-evolve.d.ts +74 -0
- package/dist/store/table-evolve.d.ts.map +1 -0
- package/dist/store/table-evolve.js +201 -0
- package/dist/store/table-evolve.js.map +1 -0
- package/dist/store/table-handle.d.ts +73 -0
- package/dist/store/table-handle.d.ts.map +1 -0
- package/dist/store/table-handle.js +101 -0
- package/dist/store/table-handle.js.map +1 -0
- package/dist/store/table-history.d.ts +75 -0
- package/dist/store/table-history.d.ts.map +1 -0
- package/dist/store/table-history.js +42 -0
- package/dist/store/table-history.js.map +1 -0
- package/dist/store/table-migration.d.ts +16 -0
- package/dist/store/table-migration.d.ts.map +1 -0
- package/dist/store/table-migration.js +202 -0
- package/dist/store/table-migration.js.map +1 -0
- package/dist/store/table-writes.d.ts +125 -0
- package/dist/store/table-writes.d.ts.map +1 -0
- package/dist/store/table-writes.js +170 -0
- package/dist/store/table-writes.js.map +1 -0
- package/dist/store/table.d.ts +80 -0
- package/dist/store/table.d.ts.map +1 -0
- package/dist/store/table.js +103 -0
- package/dist/store/table.js.map +1 -0
- package/dist/store/text.d.ts +14 -0
- package/dist/store/text.d.ts.map +1 -0
- package/dist/store/text.js +51 -0
- package/dist/store/text.js.map +1 -0
- package/dist/store/writes.d.ts +5 -0
- package/dist/store/writes.d.ts.map +1 -0
- package/dist/store/writes.js +4 -0
- package/dist/store/writes.js.map +1 -0
- package/dist/surfaces/active-language.d.ts +20 -0
- package/dist/surfaces/active-language.d.ts.map +1 -0
- package/dist/surfaces/active-language.js +78 -0
- package/dist/surfaces/active-language.js.map +1 -0
- package/dist/surfaces/active-theme.d.ts +16 -0
- package/dist/surfaces/active-theme.d.ts.map +1 -0
- package/dist/surfaces/active-theme.js +47 -0
- package/dist/surfaces/active-theme.js.map +1 -0
- package/dist/surfaces/client.d.ts +96 -0
- package/dist/surfaces/client.d.ts.map +1 -0
- package/dist/surfaces/client.js +264 -0
- package/dist/surfaces/client.js.map +1 -0
- package/dist/surfaces/connection.d.ts +49 -0
- package/dist/surfaces/connection.d.ts.map +1 -0
- package/dist/surfaces/connection.js +142 -0
- package/dist/surfaces/connection.js.map +1 -0
- package/dist/surfaces/format.d.ts +5 -0
- package/dist/surfaces/format.d.ts.map +1 -0
- package/dist/surfaces/format.js +37 -0
- package/dist/surfaces/format.js.map +1 -0
- package/dist/surfaces/index.d.ts +15 -0
- package/dist/surfaces/index.d.ts.map +1 -0
- package/dist/surfaces/index.js +18 -0
- package/dist/surfaces/index.js.map +1 -0
- package/dist/surfaces/language.d.ts +53 -0
- package/dist/surfaces/language.d.ts.map +1 -0
- package/dist/surfaces/language.js +74 -0
- package/dist/surfaces/language.js.map +1 -0
- package/dist/surfaces/loaded.d.ts +42 -0
- package/dist/surfaces/loaded.d.ts.map +1 -0
- package/dist/surfaces/loaded.js +116 -0
- package/dist/surfaces/loaded.js.map +1 -0
- package/dist/surfaces/locale-choice.d.ts +25 -0
- package/dist/surfaces/locale-choice.d.ts.map +1 -0
- package/dist/surfaces/locale-choice.js +14 -0
- package/dist/surfaces/locale-choice.js.map +1 -0
- package/dist/surfaces/messages.d.ts +67 -0
- package/dist/surfaces/messages.d.ts.map +1 -0
- package/dist/surfaces/messages.js +112 -0
- package/dist/surfaces/messages.js.map +1 -0
- package/dist/surfaces/page-state.d.ts +14 -0
- package/dist/surfaces/page-state.d.ts.map +1 -0
- package/dist/surfaces/page-state.js +43 -0
- package/dist/surfaces/page-state.js.map +1 -0
- package/dist/surfaces/preference.d.ts +32 -0
- package/dist/surfaces/preference.d.ts.map +1 -0
- package/dist/surfaces/preference.js +72 -0
- package/dist/surfaces/preference.js.map +1 -0
- package/dist/surfaces/registered.d.ts +33 -0
- package/dist/surfaces/registered.d.ts.map +1 -0
- package/dist/surfaces/registered.js +51 -0
- package/dist/surfaces/registered.js.map +1 -0
- package/dist/surfaces/scripts.d.ts +84 -0
- package/dist/surfaces/scripts.d.ts.map +1 -0
- package/dist/surfaces/scripts.js +28 -0
- package/dist/surfaces/scripts.js.map +1 -0
- package/dist/surfaces/theme-choice.d.ts +31 -0
- package/dist/surfaces/theme-choice.d.ts.map +1 -0
- package/dist/surfaces/theme-choice.js +18 -0
- package/dist/surfaces/theme-choice.js.map +1 -0
- package/dist/surfaces/themes.d.ts +43 -0
- package/dist/surfaces/themes.d.ts.map +1 -0
- package/dist/surfaces/themes.js +110 -0
- package/dist/surfaces/themes.js.map +1 -0
- package/dist/surfaces/translations.d.ts +29 -0
- package/dist/surfaces/translations.d.ts.map +1 -0
- package/dist/surfaces/translations.js +57 -0
- package/dist/surfaces/translations.js.map +1 -0
- package/dist/sync/batch.d.ts +18 -0
- package/dist/sync/batch.d.ts.map +1 -0
- package/dist/sync/batch.js +125 -0
- package/dist/sync/batch.js.map +1 -0
- package/dist/sync/client.d.ts +166 -0
- package/dist/sync/client.d.ts.map +1 -0
- package/dist/sync/client.js +438 -0
- package/dist/sync/client.js.map +1 -0
- package/dist/sync/files.d.ts +46 -0
- package/dist/sync/files.d.ts.map +1 -0
- package/dist/sync/files.js +13 -0
- package/dist/sync/files.js.map +1 -0
- package/dist/sync/filesystem.d.ts +37 -0
- package/dist/sync/filesystem.d.ts.map +1 -0
- package/dist/sync/filesystem.js +185 -0
- package/dist/sync/filesystem.js.map +1 -0
- package/dist/sync/index.d.ts +8 -0
- package/dist/sync/index.d.ts.map +1 -0
- package/dist/sync/index.js +9 -0
- package/dist/sync/index.js.map +1 -0
- package/dist/sync/lines.d.ts +18 -0
- package/dist/sync/lines.d.ts.map +1 -0
- package/dist/sync/lines.js +46 -0
- package/dist/sync/lines.js.map +1 -0
- package/dist/sync/remote.d.ts +130 -0
- package/dist/sync/remote.d.ts.map +1 -0
- package/dist/sync/remote.js +46 -0
- package/dist/sync/remote.js.map +1 -0
- package/dist/sync/state.d.ts +17 -0
- package/dist/sync/state.d.ts.map +1 -0
- package/dist/sync/state.js +40 -0
- package/dist/sync/state.js.map +1 -0
- package/dist/telemetry-ingest/batch.d.ts +70 -0
- package/dist/telemetry-ingest/batch.d.ts.map +1 -0
- package/dist/telemetry-ingest/batch.js +110 -0
- package/dist/telemetry-ingest/batch.js.map +1 -0
- package/dist/telemetry-ingest/facet.d.ts +21 -0
- package/dist/telemetry-ingest/facet.d.ts.map +1 -0
- package/dist/telemetry-ingest/facet.js +96 -0
- package/dist/telemetry-ingest/facet.js.map +1 -0
- package/dist/telemetry-ingest/index.d.ts +5 -0
- package/dist/telemetry-ingest/index.d.ts.map +1 -0
- package/dist/telemetry-ingest/index.js +8 -0
- package/dist/telemetry-ingest/index.js.map +1 -0
- package/dist/telemetry-ingest/recorder.d.ts +50 -0
- package/dist/telemetry-ingest/recorder.d.ts.map +1 -0
- package/dist/telemetry-ingest/recorder.js +298 -0
- package/dist/telemetry-ingest/recorder.js.map +1 -0
- package/dist/telemetry-ingest/sender.d.ts +14 -0
- package/dist/telemetry-ingest/sender.d.ts.map +1 -0
- package/dist/telemetry-ingest/sender.js +64 -0
- package/dist/telemetry-ingest/sender.js.map +1 -0
- package/dist/telemetry-sqlite/index.d.ts +13 -4
- package/dist/telemetry-sqlite/index.d.ts.map +1 -1
- package/dist/telemetry-sqlite/index.js +81 -241
- package/dist/telemetry-sqlite/index.js.map +1 -1
- package/dist/telemetry-sqlite/node.d.ts +13 -0
- package/dist/telemetry-sqlite/node.d.ts.map +1 -0
- package/dist/telemetry-sqlite/node.js +27 -0
- package/dist/telemetry-sqlite/node.js.map +1 -0
- package/dist/telemetry-sqlite/schema.d.ts +9 -0
- package/dist/telemetry-sqlite/schema.d.ts.map +1 -0
- package/dist/telemetry-sqlite/schema.js +61 -0
- package/dist/telemetry-sqlite/schema.js.map +1 -0
- package/dist/telemetry-sqlite/store.d.ts +3 -0
- package/dist/telemetry-sqlite/store.d.ts.map +1 -1
- package/dist/telemetry-sqlite/store.js +24 -13
- package/dist/telemetry-sqlite/store.js.map +1 -1
- package/dist/telemetry.d.ts +937 -0
- package/dist/telemetry.d.ts.map +1 -0
- package/dist/telemetry.js +470 -0
- package/dist/telemetry.js.map +1 -0
- package/dist/tui/bridge.d.ts +112 -0
- package/dist/tui/bridge.d.ts.map +1 -0
- package/dist/tui/bridge.js +9 -0
- package/dist/tui/bridge.js.map +1 -0
- package/dist/tui/channel.d.ts +44 -0
- package/dist/tui/channel.d.ts.map +1 -0
- package/dist/tui/channel.js +150 -0
- package/dist/tui/channel.js.map +1 -0
- package/dist/tui/frames.d.ts +5 -0
- package/dist/tui/frames.d.ts.map +1 -0
- package/dist/tui/frames.js +52 -0
- package/dist/tui/frames.js.map +1 -0
- package/dist/tui/index.d.ts +7 -0
- package/dist/tui/index.d.ts.map +1 -0
- package/dist/tui/index.js +8 -0
- package/dist/tui/index.js.map +1 -0
- package/dist/tui/runtime.d.ts +46 -0
- package/dist/tui/runtime.d.ts.map +1 -0
- package/dist/tui/runtime.js +101 -0
- package/dist/tui/runtime.js.map +1 -0
- package/dist/tui/scope.d.ts +46 -0
- package/dist/tui/scope.d.ts.map +1 -0
- package/dist/tui/scope.js +141 -0
- package/dist/tui/scope.js.map +1 -0
- package/dist/tui/terminal.d.ts +15 -0
- package/dist/tui/terminal.d.ts.map +1 -0
- package/dist/tui/terminal.js +37 -0
- package/dist/tui/terminal.js.map +1 -0
- package/dist/tui/theme.d.ts +17 -0
- package/dist/tui/theme.d.ts.map +1 -0
- package/dist/tui/theme.js +38 -0
- package/dist/tui/theme.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/web/environment.d.ts +4 -0
- package/dist/web/environment.d.ts.map +1 -0
- package/dist/web/environment.js +37 -0
- package/dist/web/environment.js.map +1 -0
- package/dist/web/index.d.ts +5 -0
- package/dist/web/index.d.ts.map +1 -0
- package/dist/web/index.js +7 -0
- package/dist/web/index.js.map +1 -0
- package/dist/web/language.d.ts +7 -0
- package/dist/web/language.d.ts.map +1 -0
- package/dist/web/language.js +21 -0
- package/dist/web/language.js.map +1 -0
- package/dist/web/page.d.ts +29 -0
- package/dist/web/page.d.ts.map +1 -0
- package/dist/web/page.js +92 -0
- package/dist/web/page.js.map +1 -0
- package/dist/web/scripts.d.ts +23 -0
- package/dist/web/scripts.d.ts.map +1 -0
- package/dist/web/scripts.js +50 -0
- package/dist/web/scripts.js.map +1 -0
- package/dist/web/styles.d.ts +17 -0
- package/dist/web/styles.d.ts.map +1 -0
- package/dist/web/styles.js +218 -0
- package/dist/web/styles.js.map +1 -0
- package/dist/web/themes.d.ts +6 -0
- package/dist/web/themes.d.ts.map +1 -0
- package/dist/web/themes.js +31 -0
- package/dist/web/themes.js.map +1 -0
- package/docs/benchmarks.md +1036 -0
- package/docs/decisions.md +3436 -0
- package/docs/dependencies/book.md +1671 -0
- package/docs/dependencies/index.html +2641 -0
- package/docs/dependencies/model.md +330 -0
- package/docs/design.md +3065 -0
- package/docs/durable-observers/book.md +432 -0
- package/docs/durable-observers/index.html +517 -0
- package/docs/flow-control/book.md +333 -0
- package/docs/flow-control/fold/index.html +265 -0
- package/docs/flow-control/index.html +548 -0
- package/docs/flow-control/window/index.html +228 -0
- package/docs/guide-plugins-hosts/book.md +957 -0
- package/docs/guide-plugins-hosts/index.html +952 -0
- package/docs/http-workers/book.md +378 -0
- package/docs/http-workers/index.html +515 -0
- package/docs/i18n/book.md +217 -0
- package/docs/i18n/index.html +344 -0
- package/docs/layer-1.md +311 -0
- package/docs/layer-2.md +216 -0
- package/docs/p3-features/README.md +6 -0
- package/docs/p3-features/book.md +478 -0
- package/docs/plugin-authoring.md +276 -0
- package/docs/plugin-model/book.md +186 -0
- package/docs/plugin-model/index.html +310 -0
- package/docs/plugin-primer/book.md +273 -0
- package/docs/plugin-primer/index.html +430 -0
- package/docs/slice-1.md +236 -0
- package/docs/slice-10.md +288 -0
- package/docs/slice-11.md +114 -0
- package/docs/slice-12.md +132 -0
- package/docs/slice-13.md +121 -0
- package/docs/slice-2.md +174 -0
- package/docs/slice-3a.md +296 -0
- package/docs/slice-3b.md +197 -0
- package/docs/slice-4.md +146 -0
- package/docs/slice-4a.md +418 -0
- package/docs/slice-4b.md +208 -0
- package/docs/slice-5.md +281 -0
- package/docs/slice-6a.md +676 -0
- package/docs/slice-6b.md +332 -0
- package/docs/slice-7a.md +130 -0
- package/docs/slice-7b/book.md +608 -0
- package/docs/slice-7b/index.html +842 -0
- package/docs/slice-7b.md +255 -0
- package/docs/slice-7c.md +165 -0
- package/docs/slice-8.md +194 -0
- package/docs/slice-9.md +110 -0
- package/docs/slices.md +241 -0
- package/docs/store/book.md +670 -0
- package/docs/store/index.html +861 -0
- package/docs/store/walkthrough.md +193 -0
- package/docs/theming/book.md +223 -0
- package/docs/theming/index.html +371 -0
- package/docs/tutorial/book.md +2169 -0
- package/docs/tutorial/index.html +2112 -0
- package/docs/tutorial/screens/click-after.png +0 -0
- package/docs/tutorial/screens/click-before.png +0 -0
- package/docs/tutorial/screens/edited.png +0 -0
- package/docs/tutorial/screens/french.png +0 -0
- package/docs/tutorial/screens/harbor.png +0 -0
- package/docs/tutorial/screens/page.png +0 -0
- package/docs/tutorial/screens/traces-ada.png +0 -0
- package/docs/tutorial/screens/traces.png +0 -0
- package/package.json +114 -20
- package/src/delta/README.md +69 -0
- package/dist/cell.d.ts +0 -122
- package/dist/cell.d.ts.map +0 -1
- package/dist/cell.js +0 -356
- package/dist/cell.js.map +0 -1
- package/dist/cluster.d.ts +0 -27
- package/dist/cluster.d.ts.map +0 -1
- package/dist/cluster.js +0 -230
- package/dist/cluster.js.map +0 -1
- package/dist/connection.d.ts +0 -270
- package/dist/connection.d.ts.map +0 -1
- package/dist/connection.js +0 -1216
- package/dist/connection.js.map +0 -1
- package/dist/contract.d.ts +0 -208
- package/dist/contract.d.ts.map +0 -1
- package/dist/contract.js +0 -246
- package/dist/contract.js.map +0 -1
- package/dist/declare.d.ts +0 -33
- package/dist/declare.d.ts.map +0 -1
- package/dist/declare.js +0 -2
- package/dist/declare.js.map +0 -1
- package/dist/errors.d.ts +0 -28
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -59
- package/dist/errors.js.map +0 -1
- package/dist/host.d.ts +0 -348
- package/dist/host.d.ts.map +0 -1
- package/dist/host.js +0 -1000
- package/dist/host.js.map +0 -1
- package/dist/link.d.ts +0 -107
- package/dist/link.d.ts.map +0 -1
- package/dist/link.js +0 -355
- package/dist/link.js.map +0 -1
- package/dist/loader.d.ts +0 -4
- package/dist/loader.d.ts.map +0 -1
- package/dist/loader.js +0 -73
- package/dist/loader.js.map +0 -1
- package/dist/manager.d.ts +0 -115
- package/dist/manager.d.ts.map +0 -1
- package/dist/manager.js +0 -345
- package/dist/manager.js.map +0 -1
- package/dist/node.d.ts +0 -4
- package/dist/node.d.ts.map +0 -1
- package/dist/node.js +0 -4
- package/dist/node.js.map +0 -1
- package/dist/object.d.ts +0 -438
- package/dist/object.d.ts.map +0 -1
- package/dist/object.js +0 -1571
- package/dist/object.js.map +0 -1
- package/dist/publish.d.ts +0 -5
- package/dist/publish.d.ts.map +0 -1
- package/dist/publish.js +0 -40
- package/dist/publish.js.map +0 -1
- package/dist/registry.d.ts +0 -25
- package/dist/registry.d.ts.map +0 -1
- package/dist/registry.js +0 -6
- package/dist/registry.js.map +0 -1
- package/dist/reload.d.ts +0 -126
- package/dist/reload.d.ts.map +0 -1
- package/dist/reload.js +0 -653
- package/dist/reload.js.map +0 -1
- package/dist/remote.d.ts +0 -165
- package/dist/remote.d.ts.map +0 -1
- package/dist/remote.js +0 -612
- package/dist/remote.js.map +0 -1
- package/dist/schema.d.ts +0 -21
- package/dist/schema.d.ts.map +0 -1
- package/dist/schema.js +0 -228
- package/dist/schema.js.map +0 -1
- package/dist/state.d.ts +0 -92
- package/dist/state.d.ts.map +0 -1
- package/dist/state.js +0 -287
- package/dist/state.js.map +0 -1
- package/dist/types.d.ts +0 -88
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
- package/dist/websocket.d.ts +0 -15
- package/dist/websocket.d.ts.map +0 -1
- package/dist/websocket.js +0 -16
- package/dist/websocket.js.map +0 -1
- package/dist/wire.d.ts +0 -216
- package/dist/wire.d.ts.map +0 -1
- package/dist/wire.js +0 -165
- package/dist/wire.js.map +0 -1
- package/docs/guide.md +0 -814
- package/docs/spec.md +0 -288
- package/docs/tutorial.md +0 -931
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ipc.js","sourceRoot":"","sources":["../../src/link/ipc.ts"],"names":[],"mappings":"AAAA,8GAA8G;AAC9G,iFAAiF;AAEjF,OAAO,EAAa,OAAO,EAAE,MAAM,WAAW,CAAC;AAgB/C;;;;;GAKG;AACH,MAAM,UAAU,OAAO,CAAC,IAAa;IACpC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CA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C,SAAS;YAAE,IAAI,CAAC,UAAU,EAAE,CAAC;IACvC,CAAC;IAED,kDAAkD;IAClD,IAAI;QACH,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;QACvB,IAAI,EAAE,cAAc,CAAC,SAAS,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QACjD,IAAI,EAAE,cAAc,CAAC,YAAY,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QACvD,IAAI,CAAC,KAAK,EAAE,CAAC;IACd,CAAC;CACD","sourcesContent":["// IPC links (§3): a link over a Node IPC channel, a forked child (`fork` with `serialization: \"advanced\"`) or\n// `process` in the child, typed structurally so Chord imports nothing from Node.\n\nimport { type Link, LinkEnd } from \"./link.ts\";\n\n/**\n * The part of a Node IPC channel a link uses: a `ChildProcess` or the child's `process`. `send` returning `false` is\n * backpressure (the message is queued by Node), not a failure.\n */\nexport interface IpcPort {\n\tsend(message: Uint8Array, callback: (error: Error | null) => void): boolean;\n\ton(event: \"message\", listener: (message: unknown) => void): unknown;\n\ton(event: \"disconnect\", listener: () => void): unknown;\n\tremoveListener(event: \"message\", listener: (message: unknown) => void): unknown;\n\tremoveListener(event: \"disconnect\", listener: () => void): unknown;\n\tdisconnect(): void;\n\treadonly connected: boolean;\n}\n\n/**\n * A link over `port`: each message one `Uint8Array` (V8 serialization keeps it one). It listens from the moment it is\n * made and queues messages until its listener is set, so a child makes it before awaiting its start message; messages\n * that are no `Uint8Array` (the app's own, such as that start message) are not the link's and are skipped. A thrown\n * `send`, an error in its callback or `disconnect` closes the link once; its listeners are removed then.\n */\nexport function ipcLink(port: IpcPort): Link {\n\treturn new IpcLink(port);\n}\n\nclass IpcLink extends LinkEnd {\n\t/** The port while the link is open. */\n\t#port: IpcPort | undefined;\n\treadonly #onMessage = (message: unknown): void => {\n\t\tif (message instanceof Uint8Array) this.deliver(message);\n\t};\n\treadonly #onDisconnect = (): void => this.#end();\n\treadonly #onSent = (error: Error | null): void => {\n\t\tif (error !== null) this.#end();\n\t};\n\n\tconstructor(port: IpcPort) {\n\t\tsuper();\n\t\tthis.#port = port;\n\t\tif (!port.connected) {\n\t\t\tthis.#end();\n\t\t\treturn;\n\t\t}\n\t\tport.on(\"message\", this.#onMessage);\n\t\tport.on(\"disconnect\", this.#onDisconnect);\n\t}\n\n\tsend(message: Uint8Array): void {\n\t\tconst port = this.#port;\n\t\tif (port === undefined) return;\n\t\ttry {\n\t\t\tport.send(message, this.#onSent);\n\t\t} catch {\n\t\t\tthis.#end();\n\t\t}\n\t}\n\n\tclose(): void {\n\t\tconst port = this.#port;\n\t\tif (port === undefined) return;\n\t\tthis.#end();\n\t\t// Disconnecting a channel that is gone already would emit an error.\n\t\tif (port.connected) port.disconnect();\n\t}\n\n\t/** Detaches from the port and closes this end. */\n\t#end(): void {\n\t\tconst port = this.#port;\n\t\tthis.#port = undefined;\n\t\tport?.removeListener(\"message\", this.#onMessage);\n\t\tport?.removeListener(\"disconnect\", this.#onDisconnect);\n\t\tthis.ended();\n\t}\n}\n"]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/** An ordered, bidirectional channel of `Uint8Array` messages between two hosts. Adapters only move bytes. */
|
|
2
|
+
export interface Link {
|
|
3
|
+
/** Sends one message; a no-op once closed. */
|
|
4
|
+
send(message: Uint8Array): void;
|
|
5
|
+
/**
|
|
6
|
+
* Sets the one listener for incoming messages; messages that arrived earlier are delivered to it first. On a closed
|
|
7
|
+
* link it is not kept.
|
|
8
|
+
*/
|
|
9
|
+
onMessage(listener: (message: Uint8Array) => void): void;
|
|
10
|
+
/** Closes both ends; messages not delivered yet are dropped. */
|
|
11
|
+
close(): void;
|
|
12
|
+
/** Sets the one listener for the close of either end; it runs at once when the link is closed already. */
|
|
13
|
+
onClose(listener: () => void): void;
|
|
14
|
+
}
|
|
15
|
+
/** Two ends of one link: what one sends, the other receives asynchronously (a microtask later), in order. */
|
|
16
|
+
export declare function memoryLinkPair(): [Link, Link];
|
|
17
|
+
/**
|
|
18
|
+
* What every link end shares: the one message listener (messages that arrived before it are queued for it), the one
|
|
19
|
+
* close listener, and closing once. Subclasses move the bytes: `deliver` what arrived, `ended` when the transport
|
|
20
|
+
* closed, and implement `send` and `close`.
|
|
21
|
+
*/
|
|
22
|
+
export declare abstract class LinkEnd implements Link {
|
|
23
|
+
#private;
|
|
24
|
+
abstract send(message: Uint8Array): void;
|
|
25
|
+
abstract close(): void;
|
|
26
|
+
get closed(): boolean;
|
|
27
|
+
onMessage(listener: (message: Uint8Array) => void): void;
|
|
28
|
+
onClose(listener: () => void): void;
|
|
29
|
+
/** A message arrived; dropped once closed. */
|
|
30
|
+
protected deliver(message: Uint8Array): void;
|
|
31
|
+
/** Closes this end (once): nothing is delivered any more, and nothing the listeners reach is kept. */
|
|
32
|
+
protected ended(): void;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=link.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../src/link/link.ts"],"names":[],"mappings":"AAEA,8GAA8G;AAC9G,MAAM,WAAW,IAAI;IACpB,8CAA8C;IAC9C,IAAI,CAAC,OAAO,EAAE,UAAU,GAAG,IAAI,CAAC;IAChC;;;OAGG;IACH,SAAS,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,UAAU,KAAK,IAAI,GAAG,IAAI,CAAC;IACzD,gEAAgE;IAChE,KAAK,IAAI,IAAI,CAAC;IACd,0GAA0G;IAC1G,OAAO,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;CACpC;AAED,6GAA6G;AAC7G,wBAAgB,cAAc,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAM7C;AAED;;;;GAIG;AACH,8BAAsB,OAAQ,YAAW,IAAI;;IAO5C,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,UAAU,GAAG,IAAI,CAAC;IAEzC,QAAQ,CAAC,KAAK,IAAI,IAAI,CAAC;IAEvB,IAAI,MAAM,IAAI,OAAO,CAEpB;IAED,SAAS,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,UAAU,KAAK,IAAI,GAAG,IAAI,CASvD;IAED,OAAO,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAGlC;IAED,8CAA8C;IAC9C,SAAS,CAAC,OAAO,CAAC,OAAO,EAAE,UAAU,GAAG,IAAI,CAI3C;IAED,sGAAsG;IACtG,SAAS,CAAC,KAAK,IAAI,IAAI,CAQtB;CACD"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// Links (§3): an ordered, bidirectional channel of messages between two hosts, and the in-memory pair.
|
|
2
|
+
/** Two ends of one link: what one sends, the other receives asynchronously (a microtask later), in order. */
|
|
3
|
+
export function memoryLinkPair() {
|
|
4
|
+
const a = new MemoryLink();
|
|
5
|
+
const b = new MemoryLink();
|
|
6
|
+
a.peer = b;
|
|
7
|
+
b.peer = a;
|
|
8
|
+
return [a, b];
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* What every link end shares: the one message listener (messages that arrived before it are queued for it), the one
|
|
12
|
+
* close listener, and closing once. Subclasses move the bytes: `deliver` what arrived, `ended` when the transport
|
|
13
|
+
* closed, and implement `send` and `close`.
|
|
14
|
+
*/
|
|
15
|
+
export class LinkEnd {
|
|
16
|
+
#closed = false;
|
|
17
|
+
#listener;
|
|
18
|
+
/** Messages that arrived before the listener was set. */
|
|
19
|
+
#queued = [];
|
|
20
|
+
#closeListener;
|
|
21
|
+
get closed() {
|
|
22
|
+
return this.#closed;
|
|
23
|
+
}
|
|
24
|
+
onMessage(listener) {
|
|
25
|
+
// A closed end delivers nothing: keeping the listener would keep its owner.
|
|
26
|
+
if (this.#closed)
|
|
27
|
+
return;
|
|
28
|
+
this.#listener = listener;
|
|
29
|
+
// A listener may close the link: what is still queued then is dropped.
|
|
30
|
+
for (const message of this.#queued.splice(0)) {
|
|
31
|
+
if (this.#closed)
|
|
32
|
+
return;
|
|
33
|
+
listener(message);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
onClose(listener) {
|
|
37
|
+
if (this.#closed)
|
|
38
|
+
listener();
|
|
39
|
+
else
|
|
40
|
+
this.#closeListener = listener;
|
|
41
|
+
}
|
|
42
|
+
/** A message arrived; dropped once closed. */
|
|
43
|
+
deliver(message) {
|
|
44
|
+
if (this.#closed)
|
|
45
|
+
return;
|
|
46
|
+
if (this.#listener === undefined)
|
|
47
|
+
this.#queued.push(message);
|
|
48
|
+
else
|
|
49
|
+
this.#listener(message);
|
|
50
|
+
}
|
|
51
|
+
/** Closes this end (once): nothing is delivered any more, and nothing the listeners reach is kept. */
|
|
52
|
+
ended() {
|
|
53
|
+
if (this.#closed)
|
|
54
|
+
return;
|
|
55
|
+
this.#closed = true;
|
|
56
|
+
const listener = this.#closeListener;
|
|
57
|
+
this.#listener = undefined;
|
|
58
|
+
this.#closeListener = undefined;
|
|
59
|
+
this.#queued = [];
|
|
60
|
+
listener?.();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* One end of a memory link. Closing it closes this end at once and the peer a microtask later, as a transport would.
|
|
65
|
+
* Portable: `queueMicrotask` only.
|
|
66
|
+
*/
|
|
67
|
+
class MemoryLink extends LinkEnd {
|
|
68
|
+
peer;
|
|
69
|
+
send(message) {
|
|
70
|
+
if (this.closed)
|
|
71
|
+
return;
|
|
72
|
+
const peer = this.peer;
|
|
73
|
+
queueMicrotask(() => peer.deliver(message));
|
|
74
|
+
}
|
|
75
|
+
close() {
|
|
76
|
+
if (this.closed)
|
|
77
|
+
return;
|
|
78
|
+
const peer = this.peer;
|
|
79
|
+
this.#end();
|
|
80
|
+
queueMicrotask(() => peer.#end());
|
|
81
|
+
}
|
|
82
|
+
#end() {
|
|
83
|
+
this.peer = undefined;
|
|
84
|
+
this.ended();
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
//# sourceMapp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I,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;;YACxD,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;IAED,sGAAsG;IAC5F,KAAK;QACd,IAAI,IAAI,CAAC,OAAO;YAAE,OAAO;QACzB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,MAAM,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC;QACrC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,cAAc,GAAG,SAAS,CAAC;QAChC,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;QAClB,QAAQ,EAAE,EAAE,CAAC;IACd,CAAC;CACD;AAED;;;GAGG;AACH,MAAM,UAAW,SAAQ,OAAO;IAC/B,IAAI,CAAyB;IAE7B,IAAI,CAAC,OAAmB;QACvB,IAAI,IAAI,CAAC,MAAM;YAAE,OAAO;QACxB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAK,CAAC;QACxB,cAAc,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IAC7C,CAAC;IAED,KAAK;QACJ,IAAI,IAAI,CAAC,MAAM;YAAE,OAAO;QACxB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAK,CAAC;QACxB,IAAI,CAAC,IAAI,EAAE,CAAC;QACZ,cAAc,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IACnC,CAAC;IAED,IAAI;QACH,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC;QACtB,IAAI,CAAC,KAAK,EAAE,CAAC;IACd,CAAC;CACD","sourcesContent":["// Links (§3): an ordered, bidirectional channel of messages between two hosts, and the in-memory pair.\n\n/** An ordered, bidirectional channel of `Uint8Array` messages between two hosts. Adapters only move bytes. */\nexport interface Link {\n\t/** Sends one message; a no-op once closed. */\n\tsend(message: Uint8Array): void;\n\t/**\n\t * Sets the one listener for incoming messages; messages that arrived earlier are delivered to it first. On a closed\n\t * link it is not kept.\n\t */\n\tonMessage(listener: (message: Uint8Array) => void): void;\n\t/** Closes both ends; messages not delivered yet are dropped. */\n\tclose(): void;\n\t/** Sets the one listener for the close of either end; it runs at once when the link is closed already. */\n\tonClose(listener: () => void): void;\n}\n\n/** Two ends of one link: what one sends, the other receives asynchronously (a microtask later), in order. */\nexport function memoryLinkPair(): [Link, Link] {\n\tconst a = new MemoryLink();\n\tconst b = new MemoryLink();\n\ta.peer = b;\n\tb.peer = a;\n\treturn [a, b];\n}\n\n/**\n * What every link end shares: the one message listener (messages that arrived before it are queued for it), the one\n * close listener, and closing once. Subclasses move the bytes: `deliver` what arrived, `ended` when the transport\n * closed, and implement `send` and `close`.\n */\nexport abstract class LinkEnd implements Link {\n\t#closed = false;\n\t#listener: ((message: Uint8Array) => void) | undefined;\n\t/** Messages that arrived before the listener was set. */\n\t#queued: Uint8Array[] = [];\n\t#closeListener: (() => void) | undefined;\n\n\tabstract send(message: Uint8Array): void;\n\n\tabstract close(): void;\n\n\tget closed(): boolean {\n\t\treturn this.#closed;\n\t}\n\n\tonMessage(listener: (message: Uint8Array) => void): void {\n\t\t// A closed end delivers nothing: keeping the listener would keep its owner.\n\t\tif (this.#closed) return;\n\t\tthis.#listener = listener;\n\t\t// A listener may close the link: what is still queued then is dropped.\n\t\tfor (const message of this.#queued.splice(0)) {\n\t\t\tif (this.#closed) return;\n\t\t\tlistener(message);\n\t\t}\n\t}\n\n\tonClose(listener: () => void): void {\n\t\tif (this.#closed) listener();\n\t\telse this.#closeListener = listener;\n\t}\n\n\t/** A message arrived; dropped once closed. */\n\tprotected deliver(message: Uint8Array): void {\n\t\tif (this.#closed) return;\n\t\tif (this.#listener === undefined) this.#queued.push(message);\n\t\telse this.#listener(message);\n\t}\n\n\t/** Closes this end (once): nothing is delivered any more, and nothing the listeners reach is kept. */\n\tprotected ended(): void {\n\t\tif (this.#closed) return;\n\t\tthis.#closed = true;\n\t\tconst listener = this.#closeListener;\n\t\tthis.#listener = undefined;\n\t\tthis.#closeListener = undefined;\n\t\tthis.#queued = [];\n\t\tlistener?.();\n\t}\n}\n\n/**\n * One end of a memory link. Closing it closes this end at once and the peer a microtask later, as a transport would.\n * Portable: `queueMicrotask` only.\n */\nclass MemoryLink extends LinkEnd {\n\tpeer: MemoryLink | undefined;\n\n\tsend(message: Uint8Array): void {\n\t\tif (this.closed) return;\n\t\tconst peer = this.peer!;\n\t\tqueueMicrotask(() => peer.deliver(message));\n\t}\n\n\tclose(): void {\n\t\tif (this.closed) return;\n\t\tconst peer = this.peer!;\n\t\tthis.#end();\n\t\tqueueMicrotask(() => peer.#end());\n\t}\n\n\t#end(): void {\n\t\tthis.peer = undefined;\n\t\tthis.ended();\n\t}\n}\n"]}
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import { type Schema } from "@earendil-works/pi-schema";
|
|
2
|
+
import type { Context } from "../context/index.ts";
|
|
3
|
+
import { type Static } from "../contracts/index.ts";
|
|
4
|
+
/** An error that may come from plugin code: a ChordError's JSON (checked by L1), or a plugin's code and message. */
|
|
5
|
+
declare const wireError: Schema<{
|
|
6
|
+
kind: "chord";
|
|
7
|
+
error: unknown;
|
|
8
|
+
} | {
|
|
9
|
+
kind: "plugin";
|
|
10
|
+
code: string;
|
|
11
|
+
message: string;
|
|
12
|
+
details?: unknown;
|
|
13
|
+
}>;
|
|
14
|
+
/** The members of a hold that failed with this message (W1). */
|
|
15
|
+
declare const failed: Schema<{
|
|
16
|
+
member: number;
|
|
17
|
+
error: {
|
|
18
|
+
kind: "chord";
|
|
19
|
+
error: unknown;
|
|
20
|
+
} | {
|
|
21
|
+
kind: "plugin";
|
|
22
|
+
code: string;
|
|
23
|
+
message: string;
|
|
24
|
+
details?: unknown;
|
|
25
|
+
};
|
|
26
|
+
}[]>;
|
|
27
|
+
/**
|
|
28
|
+
* The longest name a message carries (a type's, a host kind's): a relay records them in its spans unparsed, so a peer
|
|
29
|
+
* cannot hand it an unbounded string (slice 9 review M1).
|
|
30
|
+
*/
|
|
31
|
+
export declare const NAME_LENGTH = 256;
|
|
32
|
+
/** An address as a hold names it: its host kind and params, checked against the kind where it is routed. */
|
|
33
|
+
declare const address: Schema<{
|
|
34
|
+
kind: string;
|
|
35
|
+
params: unknown;
|
|
36
|
+
}>;
|
|
37
|
+
/** The most keys a trace carrier has, and the longest key or value (R5). */
|
|
38
|
+
export declare const CARRIER: {
|
|
39
|
+
readonly keys: 8;
|
|
40
|
+
readonly length: 256;
|
|
41
|
+
};
|
|
42
|
+
/** The longest activation chain a hold carries (Q5): a longer one keeps its last entries. */
|
|
43
|
+
export declare const CHAIN = 32;
|
|
44
|
+
/** A `retry`'s hop budget as the first host sends it (dependency model §3.7, audit A5): one less per host after it. */
|
|
45
|
+
export declare const RETRY_HOPS = 16;
|
|
46
|
+
/** The kinds of a `failed` message's cause, in their codes' order (the binary codec's byte, the text codec's letter). */
|
|
47
|
+
export declare const CAUSE_KINDS: ["transient", "broken", "waiting"];
|
|
48
|
+
/** The protocol's messages, one tagged union. Parts are opaque here (the owners parse them). */
|
|
49
|
+
declare const MESSAGE: Schema<{
|
|
50
|
+
kind: "hello";
|
|
51
|
+
protocol: number;
|
|
52
|
+
incarnation: string;
|
|
53
|
+
calls: number;
|
|
54
|
+
} | {
|
|
55
|
+
kind: "hold";
|
|
56
|
+
origin?: number | undefined;
|
|
57
|
+
hold: number;
|
|
58
|
+
type: string;
|
|
59
|
+
version: number;
|
|
60
|
+
fingerprint: string;
|
|
61
|
+
params: string | import("./part.ts").DeflatedPart | Uint8Array<ArrayBufferLike>;
|
|
62
|
+
address: {
|
|
63
|
+
kind: string;
|
|
64
|
+
params: unknown;
|
|
65
|
+
};
|
|
66
|
+
principal?: {
|
|
67
|
+
kind: string;
|
|
68
|
+
} | undefined;
|
|
69
|
+
incarnation?: string | undefined;
|
|
70
|
+
chain?: string[] | undefined;
|
|
71
|
+
limit?: number | undefined;
|
|
72
|
+
trace?: Record<string, string> | undefined;
|
|
73
|
+
} | {
|
|
74
|
+
kind: "release";
|
|
75
|
+
origin?: number | undefined;
|
|
76
|
+
hold: number;
|
|
77
|
+
} | {
|
|
78
|
+
kind: "call";
|
|
79
|
+
origin?: number | undefined;
|
|
80
|
+
call: number;
|
|
81
|
+
hold: number;
|
|
82
|
+
method: number;
|
|
83
|
+
args?: string | import("./part.ts").DeflatedPart | Uint8Array<ArrayBufferLike> | undefined;
|
|
84
|
+
segments?: readonly Uint8Array<ArrayBufferLike>[] | undefined;
|
|
85
|
+
trace?: Record<string, string> | undefined;
|
|
86
|
+
old?: true | undefined;
|
|
87
|
+
} | {
|
|
88
|
+
kind: "abort";
|
|
89
|
+
origin?: number | undefined;
|
|
90
|
+
call: number;
|
|
91
|
+
} | {
|
|
92
|
+
kind: "retry";
|
|
93
|
+
origin?: number | undefined;
|
|
94
|
+
hold: number;
|
|
95
|
+
hops: number;
|
|
96
|
+
} | {
|
|
97
|
+
kind: "bound";
|
|
98
|
+
origin?: number | undefined;
|
|
99
|
+
holds: {
|
|
100
|
+
hold: number;
|
|
101
|
+
variant: number;
|
|
102
|
+
members: {
|
|
103
|
+
member: number;
|
|
104
|
+
value: string | import("./part.ts").DeflatedPart | Uint8Array<ArrayBufferLike>;
|
|
105
|
+
}[];
|
|
106
|
+
failed: {
|
|
107
|
+
member: number;
|
|
108
|
+
error: {
|
|
109
|
+
kind: "chord";
|
|
110
|
+
error: unknown;
|
|
111
|
+
} | {
|
|
112
|
+
kind: "plugin";
|
|
113
|
+
code: string;
|
|
114
|
+
message: string;
|
|
115
|
+
details?: unknown;
|
|
116
|
+
};
|
|
117
|
+
}[];
|
|
118
|
+
}[];
|
|
119
|
+
} | {
|
|
120
|
+
kind: "state";
|
|
121
|
+
origin?: number | undefined;
|
|
122
|
+
holds: {
|
|
123
|
+
hold: number;
|
|
124
|
+
members: {
|
|
125
|
+
member: number;
|
|
126
|
+
ops: string | import("./part.ts").DeflatedPart | Uint8Array<ArrayBufferLike>;
|
|
127
|
+
}[];
|
|
128
|
+
failed: {
|
|
129
|
+
member: number;
|
|
130
|
+
error: {
|
|
131
|
+
kind: "chord";
|
|
132
|
+
error: unknown;
|
|
133
|
+
} | {
|
|
134
|
+
kind: "plugin";
|
|
135
|
+
code: string;
|
|
136
|
+
message: string;
|
|
137
|
+
details?: unknown;
|
|
138
|
+
};
|
|
139
|
+
}[];
|
|
140
|
+
retired: number[];
|
|
141
|
+
}[];
|
|
142
|
+
} | {
|
|
143
|
+
kind: "ack";
|
|
144
|
+
origin?: number | undefined;
|
|
145
|
+
} | {
|
|
146
|
+
kind: "closed";
|
|
147
|
+
origin: number;
|
|
148
|
+
} | {
|
|
149
|
+
kind: "revoke";
|
|
150
|
+
revocation: unknown;
|
|
151
|
+
} | {
|
|
152
|
+
kind: "ping";
|
|
153
|
+
} | {
|
|
154
|
+
kind: "pong";
|
|
155
|
+
} | {
|
|
156
|
+
kind: "failed";
|
|
157
|
+
origin?: number | undefined;
|
|
158
|
+
hold: number;
|
|
159
|
+
cause: {
|
|
160
|
+
kind: "broken" | "transient" | "waiting";
|
|
161
|
+
error: {
|
|
162
|
+
kind: "chord";
|
|
163
|
+
error: unknown;
|
|
164
|
+
} | {
|
|
165
|
+
kind: "plugin";
|
|
166
|
+
code: string;
|
|
167
|
+
message: string;
|
|
168
|
+
details?: unknown;
|
|
169
|
+
};
|
|
170
|
+
};
|
|
171
|
+
retryIn?: number | undefined;
|
|
172
|
+
} | {
|
|
173
|
+
kind: "loading";
|
|
174
|
+
origin?: number | undefined;
|
|
175
|
+
hold: number;
|
|
176
|
+
} | {
|
|
177
|
+
kind: "result";
|
|
178
|
+
origin?: number | undefined;
|
|
179
|
+
call: number;
|
|
180
|
+
value?: string | import("./part.ts").DeflatedPart | Uint8Array<ArrayBufferLike> | undefined;
|
|
181
|
+
segments?: readonly Uint8Array<ArrayBufferLike>[] | undefined;
|
|
182
|
+
} | {
|
|
183
|
+
kind: "error";
|
|
184
|
+
origin?: number | undefined;
|
|
185
|
+
call: number;
|
|
186
|
+
error: {
|
|
187
|
+
kind: "chord";
|
|
188
|
+
error: unknown;
|
|
189
|
+
} | {
|
|
190
|
+
kind: "plugin";
|
|
191
|
+
code: string;
|
|
192
|
+
message: string;
|
|
193
|
+
details?: unknown;
|
|
194
|
+
};
|
|
195
|
+
} | {
|
|
196
|
+
kind: "gone";
|
|
197
|
+
origin?: number | undefined;
|
|
198
|
+
hold: number;
|
|
199
|
+
error: {
|
|
200
|
+
kind: "chord";
|
|
201
|
+
error: unknown;
|
|
202
|
+
} | {
|
|
203
|
+
kind: "plugin";
|
|
204
|
+
code: string;
|
|
205
|
+
message: string;
|
|
206
|
+
details?: unknown;
|
|
207
|
+
};
|
|
208
|
+
}>;
|
|
209
|
+
/**
|
|
210
|
+
* A protocol message. `args` absent: a method without arguments; `value` absent: `null`. A `state` entry's `retired`
|
|
211
|
+
* list is read-only (the schema's type is mutable): entries without retirements share `NO_RETIRED`.
|
|
212
|
+
*/
|
|
213
|
+
export type Message = Exclude<WireMessage, WireState> | (Omit<WireState, "holds"> & {
|
|
214
|
+
readonly holds: readonly StateEntry[];
|
|
215
|
+
});
|
|
216
|
+
type WireMessage = Static<typeof MESSAGE>;
|
|
217
|
+
type WireState = Extract<WireMessage, {
|
|
218
|
+
readonly kind: "state";
|
|
219
|
+
}>;
|
|
220
|
+
/** An error as it crosses a link. */
|
|
221
|
+
export type WireError = Static<typeof wireError>;
|
|
222
|
+
/** A message that may carry an origin (every kind but `hello`, `revoke`, `ping` and `pong`). */
|
|
223
|
+
export type OriginMessage = Exclude<Message, {
|
|
224
|
+
readonly kind: "hello" | "revoke" | "ping" | "pong";
|
|
225
|
+
}>;
|
|
226
|
+
/** A message for a provider side: the direction from the consumer (`closed` is the link's). */
|
|
227
|
+
export type ProviderMessage = Extract<Message, {
|
|
228
|
+
readonly kind: "hold" | "release" | "call" | "abort" | "retry" | "ack";
|
|
229
|
+
}>;
|
|
230
|
+
/** A message for a consumer side: the direction from the provider. */
|
|
231
|
+
export type ConsumerMessage = Extract<Message, {
|
|
232
|
+
readonly kind: "bound" | "state" | "failed" | "loading" | "result" | "error" | "gone";
|
|
233
|
+
}>;
|
|
234
|
+
/** One hold's entry of a `bound` message. */
|
|
235
|
+
export type BoundEntry = Extract<Message, {
|
|
236
|
+
readonly kind: "bound";
|
|
237
|
+
}>["holds"][number];
|
|
238
|
+
/** One hold's entry of a `state` message. */
|
|
239
|
+
export type StateEntry = Omit<WireState["holds"][number], "retired"> & {
|
|
240
|
+
readonly retired: readonly number[];
|
|
241
|
+
};
|
|
242
|
+
/** The `retired` list of a state entry without retirements, shared (no allocation per message). */
|
|
243
|
+
export declare const NO_RETIRED: readonly number[];
|
|
244
|
+
/** An address as a `hold` carries it. */
|
|
245
|
+
export type WireAddress = Static<typeof address>;
|
|
246
|
+
/** A member of a hold that failed, by index, as `bound` and `state` list it. */
|
|
247
|
+
export type FailedMember = Static<typeof failed>[number];
|
|
248
|
+
/** How a link turns messages into bytes and back; both ends of a link use the same one. */
|
|
249
|
+
export interface Codec {
|
|
250
|
+
readonly name: string;
|
|
251
|
+
encode(message: Message): Uint8Array;
|
|
252
|
+
/** Throws on bytes that are no message of this codec (a protocol error); the envelope is checked afterwards. */
|
|
253
|
+
decode(bytes: Uint8Array): Message;
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Checks a decoded message's envelope with the compiled schema (the wire is a trust boundary, after any codec): kinds,
|
|
257
|
+
* ids and indexes, lists and error shapes; not the parts. Throws on a mismatch (a protocol error). Counted in
|
|
258
|
+
* `chord.link.checks`.
|
|
259
|
+
*/
|
|
260
|
+
export declare function checkMessage(message: unknown, context: Context): Message;
|
|
261
|
+
export {};
|
|
262
|
+
//# sourceMappingURL=message.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../src/link/message.ts"],"names":[],"mappings":"AAGA,OAAO,EAAuB,KAAK,MAAM,EAAE,MAA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,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,OAAO,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzD,2FAA2F;AAC3F,MAAM,WAAW,KAAK;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,OAAO,EAAE,OAAO,GAAG,UAAU,CAAC;IACrC,gHAAgH;IAChH,MAAM,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC;CACnC;AAID;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAKxE"}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
// Messages (§22, R1, R4, 2b): the one `Message` type every link carries, defined as a schema and checked after every
|
|
2
|
+
// decode, and the codecs that turn it into bytes.
|
|
3
|
+
import { map, obj as openObj } from "@earendil-works/pi-schema";
|
|
4
|
+
import { arr, int, lit, obj, oneOf, opt, str, union, unknown } from "../contracts/index.js";
|
|
5
|
+
import { validatorFor } from "../data/internal.js";
|
|
6
|
+
import { chordMetrics } from "../telemetry.js";
|
|
7
|
+
/** A link-local id, chosen by its origin: a counter, unique per link, direction and origin while in use. */
|
|
8
|
+
const id = int({ min: 0 });
|
|
9
|
+
/**
|
|
10
|
+
* Whose work a message is (decision "Relay flow control per origin"): a relay's number for one downstream link (and
|
|
11
|
+
* the origin that link's messages carried), never reused on a link; absent for the sender's own work. Holds, calls,
|
|
12
|
+
* windows and acks are keyed by (origin, id), and replies carry the origin of what they answer.
|
|
13
|
+
*/
|
|
14
|
+
const origin = int({ min: 1 });
|
|
15
|
+
/** A name as an index into the hold's bound version (each variant's names sorted). */
|
|
16
|
+
const index = int({ min: 0 });
|
|
17
|
+
/** An error that may come from plugin code: a ChordError's JSON (checked by L1), or a plugin's code and message. */
|
|
18
|
+
const wireError = union([
|
|
19
|
+
obj({ kind: lit("chord"), error: unknown() }),
|
|
20
|
+
obj({ kind: lit("plugin"), code: str(), message: str(), details: opt(unknown()) }),
|
|
21
|
+
]);
|
|
22
|
+
/** The members of a hold that failed with this message (W1). */
|
|
23
|
+
const failed = arr(obj({ member: index, error: wireError }));
|
|
24
|
+
/** A part's envelope: the codec built it, so any value passes (its content is the owner's to parse). */
|
|
25
|
+
const part = unknown();
|
|
26
|
+
/**
|
|
27
|
+
* The byte segments of a payload part whose method's schema has a `bytes()` leaf, referenced from its JSON by
|
|
28
|
+
* `{"$bytes": i}`; absent for every other payload. Built by the codec, like the part.
|
|
29
|
+
*/
|
|
30
|
+
const segments = opt(unknown());
|
|
31
|
+
/**
|
|
32
|
+
* The longest name a message carries (a type's, a host kind's): a relay records them in its spans unparsed, so a peer
|
|
33
|
+
* cannot hand it an unbounded string (slice 9 review M1).
|
|
34
|
+
*/
|
|
35
|
+
export const NAME_LENGTH = 256;
|
|
36
|
+
/** A type's or a host kind's name. */
|
|
37
|
+
const name = str({ max: NAME_LENGTH });
|
|
38
|
+
/** An address as a hold names it: its host kind and params, checked against the kind where it is routed. */
|
|
39
|
+
const address = obj({ kind: name, params: unknown() });
|
|
40
|
+
/** A principal on a hold: JSON with a `kind`, honoured only on a parent link. */
|
|
41
|
+
const principal = openObj({ kind: str() }, { open: true });
|
|
42
|
+
/** A uuidv7 as text. */
|
|
43
|
+
const incarnation = str({ pattern: "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$" });
|
|
44
|
+
/** The most keys a trace carrier has, and the longest key or value (R5). */
|
|
45
|
+
export const CARRIER = { keys: 8, length: 256 };
|
|
46
|
+
/**
|
|
47
|
+
* The caller's trace carrier on a `hold` or `call` (R5, slice 9): an adapter's opaque string record, bounded, of
|
|
48
|
+
* printable ASCII only (keys without spaces), as W3C's headers and Chord's adapters are; anything else fails this schema
|
|
49
|
+
* as any malformed header does, so no control character becomes a stored trace or span id (review M2). The provider
|
|
50
|
+
* extracts it with its own adapter (absent or unknown: the adapter's root).
|
|
51
|
+
*/
|
|
52
|
+
const trace = opt({
|
|
53
|
+
...map(str({ max: CARRIER.length, pattern: "^[\\x20-\\x7e]*$" })),
|
|
54
|
+
propertyNames: { maxLength: CARRIER.length, pattern: "^[\\x21-\\x7e]+$" },
|
|
55
|
+
maxProperties: CARRIER.keys,
|
|
56
|
+
});
|
|
57
|
+
/** The longest activation chain a hold carries (Q5): a longer one keeps its last entries. */
|
|
58
|
+
export const CHAIN = 32;
|
|
59
|
+
/** A `retry`'s hop budget as the first host sends it (dependency model §3.7, audit A5): one less per host after it. */
|
|
60
|
+
export const RETRY_HOPS = 16;
|
|
61
|
+
/** The kinds of a `failed` message's cause, in their codes' order (the binary codec's byte, the text codec's letter). */
|
|
62
|
+
export const CAUSE_KINDS = ["transient", "broken", "waiting"];
|
|
63
|
+
/** The protocol's messages, one tagged union. Parts are opaque here (the owners parse them). */
|
|
64
|
+
const MESSAGE = union([
|
|
65
|
+
// `calls`: how many concurrent calls this side accepts (the call window).
|
|
66
|
+
obj({ kind: lit("hello"), protocol: int({ min: 0 }), incarnation, calls: int({ min: 1 }) }),
|
|
67
|
+
obj({
|
|
68
|
+
kind: lit("hold"),
|
|
69
|
+
origin: opt(origin),
|
|
70
|
+
hold: id,
|
|
71
|
+
type: name,
|
|
72
|
+
version: int({ min: 1 }),
|
|
73
|
+
fingerprint: str({ pattern: "^[0-9a-f]{16}$" }),
|
|
74
|
+
params: part,
|
|
75
|
+
// The address the caller computed with the type's `hostAddress`: it routes the hold.
|
|
76
|
+
address,
|
|
77
|
+
// Whom the hold acts for and the origin's incarnation; read only on a parent link.
|
|
78
|
+
principal: opt(principal),
|
|
79
|
+
incarnation: opt(incarnation),
|
|
80
|
+
// The instance ids of the activations waiting for this hold (Q5); read only on a trusted link.
|
|
81
|
+
chain: opt(arr(incarnation, { max: CHAIN })),
|
|
82
|
+
// The decoded limit per part of the link the hold was admitted on (Q2); read only on a parent link.
|
|
83
|
+
limit: opt(int({ min: 0 })),
|
|
84
|
+
trace,
|
|
85
|
+
}),
|
|
86
|
+
obj({ kind: lit("release"), origin: opt(origin), hold: id }),
|
|
87
|
+
obj({
|
|
88
|
+
kind: lit("call"),
|
|
89
|
+
origin: opt(origin),
|
|
90
|
+
call: id,
|
|
91
|
+
hold: id,
|
|
92
|
+
method: index,
|
|
93
|
+
args: opt(part),
|
|
94
|
+
segments,
|
|
95
|
+
trace,
|
|
96
|
+
// Old work of a reload (decision "Reload restarts every affected object"): honoured only from a trusted link.
|
|
97
|
+
old: opt(lit(true)),
|
|
98
|
+
}),
|
|
99
|
+
obj({ kind: lit("abort"), origin: opt(origin), call: id }),
|
|
100
|
+
// Asks the provider for an attempt of a failed hold's object now (`ref.retry()`); `hops` is its budget: the host
|
|
101
|
+
// there passes it on to its remote dependencies with one less, never at 0, so a waiting ring of hosts stops. Relays
|
|
102
|
+
// forward it as it is.
|
|
103
|
+
obj({ kind: lit("retry"), origin: opt(origin), hold: id, hops: int({ min: 1, max: RETRY_HOPS }) }),
|
|
104
|
+
// Binds several holds at once (first bindings, re-holds), applied in one batch.
|
|
105
|
+
obj({
|
|
106
|
+
kind: lit("bound"),
|
|
107
|
+
origin: opt(origin),
|
|
108
|
+
holds: arr(obj({ hold: id, variant: index, members: arr(obj({ member: index, value: part })), failed })),
|
|
109
|
+
}),
|
|
110
|
+
obj({
|
|
111
|
+
kind: lit("state"),
|
|
112
|
+
origin: opt(origin),
|
|
113
|
+
// `retired`: the members whose document was retired since the hold's last message (decision "One retirement
|
|
114
|
+
// mechanism"); a `bound` snapshot carries no flag.
|
|
115
|
+
holds: arr(obj({ hold: id, members: arr(obj({ member: index, ops: part })), failed, retired: arr(index) })),
|
|
116
|
+
}),
|
|
117
|
+
// One per applied `bound` or `state` message of its origin (the window).
|
|
118
|
+
obj({ kind: lit("ack"), origin: opt(origin) }),
|
|
119
|
+
// A relay's downstream link closed: the origin's holds are released and its calls aborted.
|
|
120
|
+
obj({ kind: lit("closed"), origin }),
|
|
121
|
+
// A revocation from the parent, applied with this host's own `revokedBy` (no origin).
|
|
122
|
+
obj({ kind: lit("revoke"), revocation: unknown() }),
|
|
123
|
+
obj({ kind: lit("ping") }),
|
|
124
|
+
obj({ kind: lit("pong") }),
|
|
125
|
+
obj({
|
|
126
|
+
kind: lit("failed"),
|
|
127
|
+
origin: opt(origin),
|
|
128
|
+
hold: id,
|
|
129
|
+
// A failure cause's error in the wire error format (a ChordError, checked by L1's envelope check, or a plugin's).
|
|
130
|
+
// `waiting`: not the object's fault (no provider, no fitting version, a dependency failed); an event wakes it.
|
|
131
|
+
cause: obj({ kind: oneOf(...CAUSE_KINDS), error: wireError }),
|
|
132
|
+
// The rest of the object's backoff window in milliseconds: when it retries by itself (absent: broken, waiting).
|
|
133
|
+
retryIn: opt(int({ min: 0 })),
|
|
134
|
+
}),
|
|
135
|
+
// The failed object of a hold started a new attempt.
|
|
136
|
+
obj({ kind: lit("loading"), origin: opt(origin), hold: id }),
|
|
137
|
+
obj({ kind: lit("result"), origin: opt(origin), call: id, value: opt(part), segments }),
|
|
138
|
+
obj({ kind: lit("error"), origin: opt(origin), call: id, error: wireError }),
|
|
139
|
+
obj({ kind: lit("gone"), origin: opt(origin), hold: id, error: wireError }),
|
|
140
|
+
]);
|
|
141
|
+
/** The `retired` list of a state entry without retirements, shared (no allocation per message). */
|
|
142
|
+
export const NO_RETIRED = [];
|
|
143
|
+
const MESSAGE_SCHEMA = { schema: MESSAGE };
|
|
144
|
+
/**
|
|
145
|
+
* Checks a decoded message's envelope with the compiled schema (the wire is a trust boundary, after any codec): kinds,
|
|
146
|
+
* ids and indexes, lists and error shapes; not the parts. Throws on a mismatch (a protocol error). Counted in
|
|
147
|
+
* `chord.link.checks`.
|
|
148
|
+
*/
|
|
149
|
+
export function checkMessage(message, context) {
|
|
150
|
+
chordMetrics(context.telemetry.metrics).counter("chord.link.checks").add(1);
|
|
151
|
+
if (!validatorFor(MESSAGE_SCHEMA, context).check(message))
|
|
152
|
+
throw new Error("message: fails the message schema");
|
|
153
|
+
// The check above establishes the type.
|
|
154
|
+
return message;
|
|
155
|
+
}
|
|
156
|
+
//# sourceMappingURL=message.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../src/link/message.ts"],"names":[],"mappings":"AAAA,qHAAqH;AACrH,kDAAkD;AAElD,OAAO,EAAE,GAAG,EAAE,GAAG,IAAI,OAAO,EAAe,MAAM,2BAA2B,CAAC;AAE7E,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAe,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AACzG,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C,4GAA4G;AAC5G,MAAM,EAAE,GAAG,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;AAE3B;;;;GAIG;AACH,MAAM,MAAM,GAAG,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;AAE/B,sFAAsF;AACtF,MAAM,KAAK,GAAG,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;AAE9B,oHAAoH;AACpH,MAAM,SAAS,GAAG,KAAK,CAAC;IACvB,GAAG,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC;IAC7C,GAAG,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC;CAClF,CAAC,CAAC;AAEH,gEAAgE;AAChE,MAAM,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC,EAAE,MAAM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,IAAI,EAAE,EAAE,EAAE,CAAC;IAC5D,GAAG,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,CAAC;IACvF,GAAG,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;IAC5E,GAAG,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;CAC3E,CAAC,CAAC;AAsCH,mGAAmG;AACnG,MAAM,CAAC,MAAM,UAAU,GAAsB,EAAE,CAAC;AAgBhD,MAAM,cAAc,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AAE3C;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,OAAgB,EAAE,OAAgB;IAC9D,YAAY,CAAC,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAC5E,IAAI,CAAC,YAAY,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;IAChH,wCAAwC;IACxC,OAAO,OAAkB,CAAC;AAC3B,CAAC","sourcesContent":["// Messages (§22, R1, R4, 2b): the one `Message` type every link carries, defined as a schema and checked after every\n// decode, and the codecs that turn it into bytes.\n\nimport { map, obj as openObj, type Schema } from \"@earendil-works/pi-schema\";\nimport type { Context } from \"../context/index.ts\";\nimport { arr, int, lit, obj, oneOf, opt, type Static, str, union, unknown } from \"../contracts/index.ts\";\nimport { validatorFor } from \"../data/internal.ts\";\nimport { chordMetrics } from \"../telemetry.ts\";\nimport type { Part } from \"./part.ts\";\n\n/** A link-local id, chosen by its origin: a counter, unique per link, direction and origin while in use. */\nconst id = int({ min: 0 });\n\n/**\n * Whose work a message is (decision \"Relay flow control per origin\"): a relay's number for one downstream link (and\n * the origin that link's messages carried), never reused on a link; absent for the sender's own work. Holds, calls,\n * windows and acks are keyed by (origin, id), and replies carry the origin of what they answer.\n */\nconst origin = int({ min: 1 });\n\n/** A name as an index into the hold's bound version (each variant's names sorted). */\nconst index = int({ min: 0 });\n\n/** An error that may come from plugin code: a ChordError's JSON (checked by L1), or a plugin's code and message. */\nconst wireError = union([\n\tobj({ kind: lit(\"chord\"), error: unknown() }),\n\tobj({ kind: lit(\"plugin\"), code: str(), message: str(), details: opt(unknown()) }),\n]);\n\n/** The members of a hold that failed with this message (W1). */\nconst failed = arr(obj({ member: index, error: wireError }));\n\n/** A part's envelope: the codec built it, so any value passes (its content is the owner's to parse). */\nconst part = unknown() as Schema<Part>;\n\n/**\n * The byte segments of a payload part whose method's schema has a `bytes()` leaf, referenced from its JSON by\n * `{\"$bytes\": i}`; absent for every other payload. Built by the codec, like the part.\n */\nconst segments = opt(unknown() as Schema<readonly Uint8Array[]>);\n\n/**\n * The longest name a message carries (a type's, a host kind's): a relay records them in its spans unparsed, so a peer\n * cannot hand it an unbounded string (slice 9 review M1).\n */\nexport const NAME_LENGTH = 256;\n\n/** A type's or a host kind's name. */\nconst name = str({ max: NAME_LENGTH });\n\n/** An address as a hold names it: its host kind and params, checked against the kind where it is routed. */\nconst address = obj({ kind: name, params: unknown() });\n\n/** A principal on a hold: JSON with a `kind`, honoured only on a parent link. */\nconst principal = openObj({ kind: str() }, { open: true });\n\n/** A uuidv7 as text. */\nconst incarnation = str({ pattern: \"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$\" });\n\n/** The most keys a trace carrier has, and the longest key or value (R5). */\nexport const CARRIER = { keys: 8, length: 256 } as const;\n\n/**\n * The caller's trace carrier on a `hold` or `call` (R5, slice 9): an adapter's opaque string record, bounded, of\n * printable ASCII only (keys without spaces), as W3C's headers and Chord's adapters are; anything else fails this schema\n * as any malformed header does, so no control character becomes a stored trace or span id (review M2). The provider\n * extracts it with its own adapter (absent or unknown: the adapter's root).\n */\nconst trace = opt({\n\t...map(str({ max: CARRIER.length, pattern: \"^[\\\\x20-\\\\x7e]*$\" })),\n\tpropertyNames: { maxLength: CARRIER.length, pattern: \"^[\\\\x21-\\\\x7e]+$\" },\n\tmaxProperties: CARRIER.keys,\n} as Schema<Record<string, string>>);\n\n/** The longest activation chain a hold carries (Q5): a longer one keeps its last entries. */\nexport const CHAIN = 32;\n\n/** A `retry`'s hop budget as the first host sends it (dependency model §3.7, audit A5): one less per host after it. */\nexport const RETRY_HOPS = 16;\n\n/** The kinds of a `failed` message's cause, in their codes' order (the binary codec's byte, the text codec's letter). */\nexport const CAUSE_KINDS: [\"transient\", \"broken\", \"waiting\"] = [\"transient\", \"broken\", \"waiting\"];\n\n/** The protocol's messages, one tagged union. Parts are opaque here (the owners parse them). */\nconst MESSAGE = union([\n\t// `calls`: how many concurrent calls this side accepts (the call window).\n\tobj({ kind: lit(\"hello\"), protocol: int({ min: 0 }), incarnation, calls: int({ min: 1 }) }),\n\tobj({\n\t\tkind: lit(\"hold\"),\n\t\torigin: opt(origin),\n\t\thold: id,\n\t\ttype: name,\n\t\tversion: int({ min: 1 }),\n\t\tfingerprint: str({ pattern: \"^[0-9a-f]{16}$\" }),\n\t\tparams: part,\n\t\t// The address the caller computed with the type's `hostAddress`: it routes the hold.\n\t\taddress,\n\t\t// Whom the hold acts for and the origin's incarnation; read only on a parent link.\n\t\tprincipal: opt(principal),\n\t\tincarnation: opt(incarnation),\n\t\t// The instance ids of the activations waiting for this hold (Q5); read only on a trusted link.\n\t\tchain: opt(arr(incarnation, { max: CHAIN })),\n\t\t// The decoded limit per part of the link the hold was admitted on (Q2); read only on a parent link.\n\t\tlimit: opt(int({ min: 0 })),\n\t\ttrace,\n\t}),\n\tobj({ kind: lit(\"release\"), origin: opt(origin), hold: id }),\n\tobj({\n\t\tkind: lit(\"call\"),\n\t\torigin: opt(origin),\n\t\tcall: id,\n\t\thold: id,\n\t\tmethod: index,\n\t\targs: opt(part),\n\t\tsegments,\n\t\ttrace,\n\t\t// Old work of a reload (decision \"Reload restarts every affected object\"): honoured only from a trusted link.\n\t\told: opt(lit(true)),\n\t}),\n\tobj({ kind: lit(\"abort\"), origin: opt(origin), call: id }),\n\t// Asks the provider for an attempt of a failed hold's object now (`ref.retry()`); `hops` is its budget: the host\n\t// there passes it on to its remote dependencies with one less, never at 0, so a waiting ring of hosts stops. Relays\n\t// forward it as it is.\n\tobj({ kind: lit(\"retry\"), origin: opt(origin), hold: id, hops: int({ min: 1, max: RETRY_HOPS }) }),\n\t// Binds several holds at once (first bindings, re-holds), applied in one batch.\n\tobj({\n\t\tkind: lit(\"bound\"),\n\t\torigin: opt(origin),\n\t\tholds: arr(obj({ hold: id, variant: index, members: arr(obj({ member: index, value: part })), failed })),\n\t}),\n\tobj({\n\t\tkind: lit(\"state\"),\n\t\torigin: opt(origin),\n\t\t// `retired`: the members whose document was retired since the hold's last message (decision \"One retirement\n\t\t// mechanism\"); a `bound` snapshot carries no flag.\n\t\tholds: arr(obj({ hold: id, members: arr(obj({ member: index, ops: part })), failed, retired: arr(index) })),\n\t}),\n\t// One per applied `bound` or `state` message of its origin (the window).\n\tobj({ kind: lit(\"ack\"), origin: opt(origin) }),\n\t// A relay's downstream link closed: the origin's holds are released and its calls aborted.\n\tobj({ kind: lit(\"closed\"), origin }),\n\t// A revocation from the parent, applied with this host's own `revokedBy` (no origin).\n\tobj({ kind: lit(\"revoke\"), revocation: unknown() }),\n\tobj({ kind: lit(\"ping\") }),\n\tobj({ kind: lit(\"pong\") }),\n\tobj({\n\t\tkind: lit(\"failed\"),\n\t\torigin: opt(origin),\n\t\thold: id,\n\t\t// A failure cause's error in the wire error format (a ChordError, checked by L1's envelope check, or a plugin's).\n\t\t// `waiting`: not the object's fault (no provider, no fitting version, a dependency failed); an event wakes it.\n\t\tcause: obj({ kind: oneOf(...CAUSE_KINDS), error: wireError }),\n\t\t// The rest of the object's backoff window in milliseconds: when it retries by itself (absent: broken, waiting).\n\t\tretryIn: opt(int({ min: 0 })),\n\t}),\n\t// The failed object of a hold started a new attempt.\n\tobj({ kind: lit(\"loading\"), origin: opt(origin), hold: id }),\n\tobj({ kind: lit(\"result\"), origin: opt(origin), call: id, value: opt(part), segments }),\n\tobj({ kind: lit(\"error\"), origin: opt(origin), call: id, error: wireError }),\n\tobj({ kind: lit(\"gone\"), origin: opt(origin), hold: id, error: wireError }),\n]);\n\n/**\n * A protocol message. `args` absent: a method without arguments; `value` absent: `null`. A `state` entry's `retired`\n * list is read-only (the schema's type is mutable): entries without retirements share `NO_RETIRED`.\n */\nexport type Message =\n\t| Exclude<WireMessage, WireState>\n\t| (Omit<WireState, \"holds\"> & { readonly holds: readonly StateEntry[] });\n\ntype WireMessage = Static<typeof MESSAGE>;\n\ntype WireState = Extract<WireMessage, { readonly kind: \"state\" }>;\n\n/** An error as it crosses a link. */\nexport type WireError = Static<typeof wireError>;\n\n/** A message that may carry an origin (every kind but `hello`, `revoke`, `ping` and `pong`). */\nexport type OriginMessage = Exclude<Message, { readonly kind: \"hello\" | \"revoke\" | \"ping\" | \"pong\" }>;\n\n/** A message for a provider side: the direction from the consumer (`closed` is the link's). */\nexport type ProviderMessage = Extract<\n\tMessage,\n\t{ readonly kind: \"hold\" | \"release\" | \"call\" | \"abort\" | \"retry\" | \"ack\" }\n>;\n\n/** A message for a consumer side: the direction from the provider. */\nexport type ConsumerMessage = Extract<\n\tMessage,\n\t{ readonly kind: \"bound\" | \"state\" | \"failed\" | \"loading\" | \"result\" | \"error\" | \"gone\" }\n>;\n\n/** One hold's entry of a `bound` message. */\nexport type BoundEntry = Extract<Message, { readonly kind: \"bound\" }>[\"holds\"][number];\n\n/** One hold's entry of a `state` message. */\nexport type StateEntry = Omit<WireState[\"holds\"][number], \"retired\"> & { readonly retired: readonly number[] };\n\n/** The `retired` list of a state entry without retirements, shared (no allocation per message). */\nexport const NO_RETIRED: readonly number[] = [];\n\n/** An address as a `hold` carries it. */\nexport type WireAddress = Static<typeof address>;\n\n/** A member of a hold that failed, by index, as `bound` and `state` list it. */\nexport type FailedMember = Static<typeof failed>[number];\n\n/** How a link turns messages into bytes and back; both ends of a link use the same one. */\nexport interface Codec {\n\treadonly name: string;\n\tencode(message: Message): Uint8Array;\n\t/** Throws on bytes that are no message of this codec (a protocol error); the envelope is checked afterwards. */\n\tdecode(bytes: Uint8Array): Message;\n}\n\nconst MESSAGE_SCHEMA = { schema: MESSAGE };\n\n/**\n * Checks a decoded message's envelope with the compiled schema (the wire is a trust boundary, after any codec): kinds,\n * ids and indexes, lists and error shapes; not the parts. Throws on a mismatch (a protocol error). Counted in\n * `chord.link.checks`.\n */\nexport function checkMessage(message: unknown, context: Context): Message {\n\tchordMetrics(context.telemetry.metrics).counter(\"chord.link.checks\").add(1);\n\tif (!validatorFor(MESSAGE_SCHEMA, context).check(message)) throw new Error(\"message: fails the message schema\");\n\t// The check above establishes the type.\n\treturn message as Message;\n}\n"]}
|