@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
package/dist/host.js
DELETED
|
@@ -1,1000 +0,0 @@
|
|
|
1
|
-
import { ChildReloads, reconcileChild, runClusterReload } from "./cluster.js";
|
|
2
|
-
import { Connection } from "./connection.js";
|
|
3
|
-
import { bind, contractFromDescription, placedOn, placementText, resolveHost, } from "./contract.js";
|
|
4
|
-
import { ChordError, invalid, runAll } from "./errors.js";
|
|
5
|
-
import { awaitReady, CtxImpl, hostLifetime, makeService, ObjectImpl, RefImpl, } from "./object.js";
|
|
6
|
-
import { enqueue } from "./publish.js";
|
|
7
|
-
import { runReload } from "./reload.js";
|
|
8
|
-
import { RemoteBinding, RemoteRef } from "./remote.js";
|
|
9
|
-
import { canonicalIdentity, canonicalJson, deepEqual, normalize } from "./schema.js";
|
|
10
|
-
/** `defineFacet<P>(…)`: an app passes its principal type, so factories and contexts see `P`. */
|
|
11
|
-
export const defineFacet = (setup, options = {}) => ({ setup, uses: options.uses });
|
|
12
|
-
const isFacet = (ref) => typeof ref === "object" && !(ref instanceof URL);
|
|
13
|
-
const EMPTY_TABLE = new Map();
|
|
14
|
-
/** A host whose principals are `P` (the app's type; `unknown` if not given). */
|
|
15
|
-
export function createHost(options) {
|
|
16
|
-
return new HostImpl(options);
|
|
17
|
-
}
|
|
18
|
-
export class HostImpl {
|
|
19
|
-
name;
|
|
20
|
-
dev;
|
|
21
|
-
principal;
|
|
22
|
-
inFactory = 0;
|
|
23
|
-
failed;
|
|
24
|
-
objects = new Map();
|
|
25
|
-
codeVersions = new Map();
|
|
26
|
-
facets = new Map();
|
|
27
|
-
/** The host's own references to its `lifetime: "host"` objects, by type name. */
|
|
28
|
-
hostObjects = new Map();
|
|
29
|
-
kind;
|
|
30
|
-
connections = new Set();
|
|
31
|
-
upstream;
|
|
32
|
-
/** Shared bindings of this host's remote references, by key (re-held after an upstream reconnect). */
|
|
33
|
-
bindings = new Map();
|
|
34
|
-
/** Bindings without references that linger, least recently released first. */
|
|
35
|
-
#lingering = new Map();
|
|
36
|
-
#lingerTypes;
|
|
37
|
-
#lingerCap;
|
|
38
|
-
#originSeq = 0;
|
|
39
|
-
#routes = new Map();
|
|
40
|
-
#childReloads = new ChildReloads(this);
|
|
41
|
-
/** Child facet modules by host-name prefix, from every committed cluster reload (for reconciling children). */
|
|
42
|
-
remoteModules = {};
|
|
43
|
-
/** Removal tombstones also reconcile children that connected during a transaction. */
|
|
44
|
-
remoteRemoved = {};
|
|
45
|
-
/** Highest code version the parent has retired. */
|
|
46
|
-
#retireAllowed = 0;
|
|
47
|
-
/** Roots that came over a link, by the link they came from. */
|
|
48
|
-
/** Foreign roots (started on another host), by the links they came over. */
|
|
49
|
-
#foreign = new Map();
|
|
50
|
-
/** Roots started on this host that have not ended. */
|
|
51
|
-
#local = new Set();
|
|
52
|
-
#incarnation = Math.random().toString(36).slice(2, 8);
|
|
53
|
-
/** Links each root's calls went out on. */
|
|
54
|
-
#rootLinks = new Map();
|
|
55
|
-
current;
|
|
56
|
-
previous;
|
|
57
|
-
/** The code version a running reload will commit; new types activated during prepare install their implementation for it. */
|
|
58
|
-
pending;
|
|
59
|
-
/** Activations of these types wait (reload gate). */
|
|
60
|
-
/** Types behind a reload gate: new objects of these types are rejected `upgrade_conflict` until commit/abort. */
|
|
61
|
-
gating;
|
|
62
|
-
reloading = false;
|
|
63
|
-
taskStopDeadline;
|
|
64
|
-
readyTimeout;
|
|
65
|
-
#principalKey;
|
|
66
|
-
/** `principalKey(self)`: an equal principal is the host's own, whatever object carries it. */
|
|
67
|
-
#selfKey;
|
|
68
|
-
/** Called when a root ends, the parent allows a retirement, or the previous code version retires. */
|
|
69
|
-
#retirementWatchers = new Set();
|
|
70
|
-
/** Child hosts whose hello arrived while a reload ran: synced or reconciled once it ends. */
|
|
71
|
-
#deferredHellos = new Map();
|
|
72
|
-
/** Resolved when the running reload ends. */
|
|
73
|
-
#reloadWaiters = [];
|
|
74
|
-
/** Aborted when the installed run of a facet (by name) is replaced, removed, or the host closes. */
|
|
75
|
-
#facetRuns = new Map();
|
|
76
|
-
#onError;
|
|
77
|
-
#loader;
|
|
78
|
-
#dying = new Map();
|
|
79
|
-
#touches = new Map();
|
|
80
|
-
#order = new Map();
|
|
81
|
-
#subscribers = new Map();
|
|
82
|
-
#codeVersionSeq = 1;
|
|
83
|
-
#rootSeq = 0;
|
|
84
|
-
constructor(options) {
|
|
85
|
-
this.name = options.name ?? "host";
|
|
86
|
-
this.dev = options.dev ?? false;
|
|
87
|
-
if (!("self" in options))
|
|
88
|
-
throw new TypeError("createHost needs `self`: the principal of the host's own code");
|
|
89
|
-
this.principal = options.self;
|
|
90
|
-
this.#principalKey = options.principalKey ?? canonicalJson;
|
|
91
|
-
this.#selfKey = this.#principalKey(options.self);
|
|
92
|
-
this.#onError = options.onError ?? ((error) => console.error("chord:", error));
|
|
93
|
-
this.#loader = options.loader;
|
|
94
|
-
this.taskStopDeadline = options.taskStopDeadline ?? 5000;
|
|
95
|
-
this.readyTimeout = options.readyTimeout ?? 60_000;
|
|
96
|
-
this.#lingerTypes = options.linger?.types ?? {};
|
|
97
|
-
this.#lingerCap = options.linger?.cap ?? 4;
|
|
98
|
-
this.current = {
|
|
99
|
-
id: this.#codeVersionSeq,
|
|
100
|
-
services: new Map(),
|
|
101
|
-
tables: new Map(),
|
|
102
|
-
roots: new Map(),
|
|
103
|
-
abort: new AbortController(),
|
|
104
|
-
};
|
|
105
|
-
this.codeVersions.set(this.current.id, this.current);
|
|
106
|
-
this.kind = options.kind ?? "host";
|
|
107
|
-
if (options.upstream !== undefined)
|
|
108
|
-
this.connect(options.upstream.link, options.upstream);
|
|
109
|
-
}
|
|
110
|
-
/** Whether `principal` is the host's own: the same key as `self`. */
|
|
111
|
-
isSelf(principal) {
|
|
112
|
-
return principal === this.principal || this.#principalKey(principal) === this.#selfKey;
|
|
113
|
-
}
|
|
114
|
-
get codeVersion() {
|
|
115
|
-
return this.current.id;
|
|
116
|
-
}
|
|
117
|
-
get previousCodeVersion() {
|
|
118
|
-
return this.previous?.id;
|
|
119
|
-
}
|
|
120
|
-
/** Allocates the next code version id, or adopts one issued by the coordinating server. */
|
|
121
|
-
nextCodeVersionId(given) {
|
|
122
|
-
if (given !== undefined && given <= this.current.id)
|
|
123
|
-
throw new Error(`code version ${given} is not newer than ${this.current.id}`);
|
|
124
|
-
this.#codeVersionSeq = given ?? this.#codeVersionSeq + 1;
|
|
125
|
-
return this.#codeVersionSeq;
|
|
126
|
-
}
|
|
127
|
-
report(error) {
|
|
128
|
-
this.#onError(error);
|
|
129
|
-
}
|
|
130
|
-
// ─── serving ───
|
|
131
|
-
serve = ((type, factory, options = {}) => {
|
|
132
|
-
if (this.reloading)
|
|
133
|
-
throw new Error("host.serve during a reload; serve from a facet passed to reload()");
|
|
134
|
-
this.serveInto(this.current.services, makeService(type, factory, options, ""));
|
|
135
|
-
if (options.lifetime === "host")
|
|
136
|
-
this.startHostObject(this.current.services.get(type.name));
|
|
137
|
-
});
|
|
138
|
-
install(facet, options = {}) {
|
|
139
|
-
if (this.reloading)
|
|
140
|
-
throw new Error("host.install during a reload");
|
|
141
|
-
if (this.facets.has(facet.name))
|
|
142
|
-
throw new Error(`facet ${facet.name} is already installed; use reload()`);
|
|
143
|
-
const added = [];
|
|
144
|
-
const run = new AbortController();
|
|
145
|
-
try {
|
|
146
|
-
facet.setup(this.facetApi(((type, factory, options = {}) => {
|
|
147
|
-
const service = makeService(type, factory, options, facet.name);
|
|
148
|
-
this.serveInto(this.current.services, service);
|
|
149
|
-
added.push(service);
|
|
150
|
-
}), run.signal));
|
|
151
|
-
}
|
|
152
|
-
catch (error) {
|
|
153
|
-
run.abort(error);
|
|
154
|
-
throw error;
|
|
155
|
-
}
|
|
156
|
-
this.facets.set(facet.name, facet);
|
|
157
|
-
this.facetRunChanged(facet.name, run);
|
|
158
|
-
const refs = added.filter(hostLifetime).map((service) => this.startHostObject(service));
|
|
159
|
-
return options.awaitHostObjects === false ? Promise.resolve() : this.#hostObjectsReady(refs);
|
|
160
|
-
}
|
|
161
|
-
async load(plugins, options = {}) {
|
|
162
|
-
const facets = await this.resolve(plugins);
|
|
163
|
-
// No await between installs: a host object's factory may consume a type served by a later facet.
|
|
164
|
-
await Promise.all(facets.map((facet) => this.install(facet, options)));
|
|
165
|
-
}
|
|
166
|
-
ready() {
|
|
167
|
-
return this.#hostObjectsReady(this.hostObjects.values());
|
|
168
|
-
}
|
|
169
|
-
#hostObjectsReady(refs) {
|
|
170
|
-
const ready = Promise.all([...refs].map((ref) => ref.ready)).then(() => { });
|
|
171
|
-
// Ignoring install's return still reports through onError without an unhandled rejection.
|
|
172
|
-
ready.catch(() => { });
|
|
173
|
-
return ready;
|
|
174
|
-
}
|
|
175
|
-
/** Turns plugin references into facets, importing modules through the loader. */
|
|
176
|
-
async resolve(plugins) {
|
|
177
|
-
const modules = plugins.filter((ref) => !isFacet(ref));
|
|
178
|
-
if (modules.length > 0 && this.#loader === undefined) {
|
|
179
|
-
throw new Error("loading modules needs createHost({ loader }), e.g. nodeLoader from @earendil-works/chord/node");
|
|
180
|
-
}
|
|
181
|
-
const loaded = modules.length > 0 && this.#loader !== undefined ? await this.#loader(modules) : [];
|
|
182
|
-
return plugins.map((ref) => (isFacet(ref) ? ref : loaded.shift()));
|
|
183
|
-
}
|
|
184
|
-
facetApi(serve, signal) {
|
|
185
|
-
return {
|
|
186
|
-
serve,
|
|
187
|
-
name: this.name,
|
|
188
|
-
root: (fn, options) => this.root(fn, options),
|
|
189
|
-
registry: (registry) => this.registry(registry),
|
|
190
|
-
signal,
|
|
191
|
-
};
|
|
192
|
-
}
|
|
193
|
-
/** The installed run of facet `name` is now `run` (or none): the run it replaces is aborted. */
|
|
194
|
-
facetRunChanged(name, run) {
|
|
195
|
-
const replaced = this.#facetRuns.get(name);
|
|
196
|
-
if (run === undefined)
|
|
197
|
-
this.#facetRuns.delete(name);
|
|
198
|
-
else
|
|
199
|
-
this.#facetRuns.set(name, run);
|
|
200
|
-
if (replaced !== run)
|
|
201
|
-
replaced?.abort(new ChordError("gone", `facet ${name} was replaced or removed`));
|
|
202
|
-
}
|
|
203
|
-
serveInto(services, service) {
|
|
204
|
-
if (services.has(service.contract.name))
|
|
205
|
-
throw new Error(`${service.contract.name} is already served`);
|
|
206
|
-
const placement = service.contract.description.host;
|
|
207
|
-
if (placement !== undefined && !placedOn(placement, this.name)) {
|
|
208
|
-
throw new TypeError(`${service.contract.name} is declared for ${placementText(placement)}, but ${this.name} serves it`);
|
|
209
|
-
}
|
|
210
|
-
services.set(service.contract.name, service);
|
|
211
|
-
}
|
|
212
|
-
startHostObject(service) {
|
|
213
|
-
const ref = this.acquire(service.contract, {}, undefined, "host");
|
|
214
|
-
this.hostObjects.set(service.contract.name, ref);
|
|
215
|
-
ref.ready.catch((error) => this.report(error));
|
|
216
|
-
return ref;
|
|
217
|
-
}
|
|
218
|
-
// ─── HostCore ───
|
|
219
|
-
currentCodeVersion() {
|
|
220
|
-
return this.current.id;
|
|
221
|
-
}
|
|
222
|
-
hasCodeVersion(codeVersion) {
|
|
223
|
-
return this.codeVersions.has(codeVersion);
|
|
224
|
-
}
|
|
225
|
-
*retainedCodeVersions() {
|
|
226
|
-
for (const [id, state] of this.codeVersions)
|
|
227
|
-
yield [id, state.services];
|
|
228
|
-
if (this.pending !== undefined)
|
|
229
|
-
yield [this.pending.id, this.pending.services];
|
|
230
|
-
}
|
|
231
|
-
pendingCodeVersion() {
|
|
232
|
-
return this.pending?.id;
|
|
233
|
-
}
|
|
234
|
-
/** The current code for a type; a type a running reload adds is served from the pending code version. */
|
|
235
|
-
service(typeName) {
|
|
236
|
-
return this.current.services.get(typeName) ?? this.pending?.services.get(typeName);
|
|
237
|
-
}
|
|
238
|
-
addressOf(type, input, principal, candidate = false) {
|
|
239
|
-
const elsewhere = this.#elsewhere(type, input);
|
|
240
|
-
if (elsewhere !== undefined)
|
|
241
|
-
return this.#remoteKey(type, elsewhere.input, principal);
|
|
242
|
-
const service = this.#bindingService(type.name, candidate);
|
|
243
|
-
if (service === undefined)
|
|
244
|
-
throw unknownType(type.name, this.name);
|
|
245
|
-
return this.#locate(service, input, principal).address;
|
|
246
|
-
}
|
|
247
|
-
/**
|
|
248
|
-
* Where an object of a remote type lives when that is another host: its name and the input normalized with the
|
|
249
|
-
* caller's contract (the placement is read from it). `undefined`: here (and every local type).
|
|
250
|
-
*/
|
|
251
|
-
#elsewhere(type, input) {
|
|
252
|
-
const placement = type.description.host;
|
|
253
|
-
if (type.scope !== "remote" || placement === undefined)
|
|
254
|
-
return undefined;
|
|
255
|
-
const normalized = normalize(type.input, input, `${type.name} input`);
|
|
256
|
-
const at = resolveHost(type.name, placement, normalized);
|
|
257
|
-
return at === this.name ? undefined : { at, input: normalized };
|
|
258
|
-
}
|
|
259
|
-
/**
|
|
260
|
-
* The address of `input` for `principal`, normalized. A `lifetime: "host"` type has one object: the empty input, for
|
|
261
|
-
* the host principal, whoever asks; another input is invalid.
|
|
262
|
-
*/
|
|
263
|
-
#locate(service, input, principal) {
|
|
264
|
-
const { name, input: schema } = service.contract;
|
|
265
|
-
const normalized = normalize(schema, input, `${name} input`);
|
|
266
|
-
const identity = canonicalIdentity(schema, normalized);
|
|
267
|
-
if (hostLifetime(service)) {
|
|
268
|
-
if (identity !== canonicalIdentity(schema, normalize(schema, {}, `${name} input`)))
|
|
269
|
-
throw invalid("input", `${name} has lifetime "host": its one object has the empty input`);
|
|
270
|
-
principal = this.principal;
|
|
271
|
-
}
|
|
272
|
-
return { address: `${name}\u0000${identity}\u0000${this.#principalPart(principal)}`, normalized, principal };
|
|
273
|
-
}
|
|
274
|
-
#principalPart(principal) {
|
|
275
|
-
return this.isSelf(principal) ? "host" : `p:${this.#principalKey(principal)}`;
|
|
276
|
-
}
|
|
277
|
-
/**
|
|
278
|
-
* The key of a remote binding: type, input identity (fields equal to their defaults omitted, as for local objects),
|
|
279
|
-
* principal key and the consumer's contract fingerprint. No host name: the type and the input decide where it lives.
|
|
280
|
-
*/
|
|
281
|
-
#remoteKey(type, normalized, principal) {
|
|
282
|
-
const identity = canonicalIdentity(type.input, normalized);
|
|
283
|
-
return `@${type.name}\u0000${identity}\u0000${this.#principalPart(principal)}\u0000${type.fingerprint}`;
|
|
284
|
-
}
|
|
285
|
-
acquire(type, input, options, owner, from, candidate = false) {
|
|
286
|
-
const elsewhere = this.#elsewhere(type, input);
|
|
287
|
-
if (elsewhere !== undefined)
|
|
288
|
-
return this.#acquireRemote(type, elsewhere.at, elsewhere.input, options, owner);
|
|
289
|
-
const service = this.#bindingService(type.name, candidate);
|
|
290
|
-
if (service === undefined)
|
|
291
|
-
throw unknownType(type.name, this.name);
|
|
292
|
-
bind(service.contract, service.options.accepts, type);
|
|
293
|
-
const { address, normalized, principal } = this.#locate(service, input, options?.principal ?? this.principal);
|
|
294
|
-
// The provider's own placement decides, never where a request says it is going (a client picks that).
|
|
295
|
-
const placement = service.contract.description.host;
|
|
296
|
-
if (placement !== undefined && resolveHost(type.name, placement, normalized) !== this.name) {
|
|
297
|
-
throw invalid("placement", `${type.name} with this input lives on ${resolveHost(type.name, placement, normalized)}, not ${this.name}`);
|
|
298
|
-
}
|
|
299
|
-
let object = this.objects.get(address);
|
|
300
|
-
if (from !== undefined && object !== undefined && (object === from || reaches(object, from))) {
|
|
301
|
-
throw invalid("cycle", `${from.address} -> ${address} would create a ref cycle`);
|
|
302
|
-
}
|
|
303
|
-
if (object === undefined) {
|
|
304
|
-
if (this.gating?.has(type.name)) {
|
|
305
|
-
throw new ChordError("upgrade_conflict", `${type.name} is being upgraded; retry`, { reason: "gate" });
|
|
306
|
-
}
|
|
307
|
-
const dying = this.#dying.get(address);
|
|
308
|
-
if (dying?.status === "disposed")
|
|
309
|
-
this.#dying.delete(address);
|
|
310
|
-
object = new ObjectImpl(this, {
|
|
311
|
-
address,
|
|
312
|
-
typeName: type.name,
|
|
313
|
-
input: normalized,
|
|
314
|
-
principal,
|
|
315
|
-
hostLifetime: hostLifetime(service),
|
|
316
|
-
});
|
|
317
|
-
this.objects.set(address, object);
|
|
318
|
-
// A new object for an address still being disposed waits for that cleanup (exclusive resources).
|
|
319
|
-
object.start(dying?.status === "disposing" ? dying.dispose(false) : undefined);
|
|
320
|
-
}
|
|
321
|
-
const ref = new RefImpl(object, type, owner);
|
|
322
|
-
object.addRef(ref);
|
|
323
|
-
return ref;
|
|
324
|
-
}
|
|
325
|
-
forget(object) {
|
|
326
|
-
if (this.objects.get(object.address) === object)
|
|
327
|
-
this.objects.delete(object.address);
|
|
328
|
-
if (object.status === "disposing")
|
|
329
|
-
this.#dying.set(object.address, object);
|
|
330
|
-
}
|
|
331
|
-
disposed(object) {
|
|
332
|
-
if (this.#dying.get(object.address) === object)
|
|
333
|
-
this.#dying.delete(object.address);
|
|
334
|
-
}
|
|
335
|
-
touch(rootId, object) {
|
|
336
|
-
let touched = this.#touches.get(rootId);
|
|
337
|
-
if (touched === undefined) {
|
|
338
|
-
touched = new Set();
|
|
339
|
-
this.#touches.set(rootId, touched);
|
|
340
|
-
}
|
|
341
|
-
touched.add(object);
|
|
342
|
-
}
|
|
343
|
-
// ─── roots ───
|
|
344
|
-
async root(fn, options = {}) {
|
|
345
|
-
// The incarnation keeps root ids unique across restarts of a host with the same name.
|
|
346
|
-
const rootId = `${this.name}#${this.#incarnation}:${++this.#rootSeq}`;
|
|
347
|
-
this.#local.add(rootId);
|
|
348
|
-
return this.joinRoot(rootId, options.codeVersion ?? this.current.id, fn, options);
|
|
349
|
-
}
|
|
350
|
-
/**
|
|
351
|
-
* Runs `fn` inside root `rootId` of `codeVersion`. A root counts as running here (for retirement) while any of its
|
|
352
|
-
* calls runs here. A root that started here ends when its last call here settles, even if it went out and came back
|
|
353
|
-
* over a link meanwhile. A foreign root (started elsewhere, arriving `from` a link) keeps its leases on objects
|
|
354
|
-
* until every link it came over announced its end (`root_end`) or closed, so its re-entry stays grandfathered.
|
|
355
|
-
*/
|
|
356
|
-
async joinRoot(rootId, codeVersionId, fn, options = {}) {
|
|
357
|
-
const codeVersion = this.codeVersions.get(codeVersionId);
|
|
358
|
-
if (codeVersion === undefined) {
|
|
359
|
-
this.#local.delete(rootId);
|
|
360
|
-
throw new ChordError("superseded", `code version ${codeVersionId} is not retained by ${this.name}`);
|
|
361
|
-
}
|
|
362
|
-
if (options.from !== undefined && !this.#local.has(rootId)) {
|
|
363
|
-
let links = this.#foreign.get(rootId);
|
|
364
|
-
if (links === undefined) {
|
|
365
|
-
links = new Set();
|
|
366
|
-
this.#foreign.set(rootId, links);
|
|
367
|
-
}
|
|
368
|
-
links.add(options.from);
|
|
369
|
-
}
|
|
370
|
-
codeVersion.roots.set(rootId, (codeVersion.roots.get(rootId) ?? 0) + 1);
|
|
371
|
-
const ctx = new CtxImpl(this, {
|
|
372
|
-
// Forced retirement aborts what still runs on a code version before closing what only it used.
|
|
373
|
-
signals: options.signal === undefined ? [codeVersion.abort.signal] : [options.signal, codeVersion.abort.signal],
|
|
374
|
-
rootId,
|
|
375
|
-
codeVersion: codeVersion.id,
|
|
376
|
-
principal: options.principal ?? this.principal,
|
|
377
|
-
});
|
|
378
|
-
try {
|
|
379
|
-
return await fn(ctx);
|
|
380
|
-
}
|
|
381
|
-
finally {
|
|
382
|
-
ctx.close();
|
|
383
|
-
const count = (codeVersion.roots.get(rootId) ?? 1) - 1;
|
|
384
|
-
if (count > 0)
|
|
385
|
-
codeVersion.roots.set(rootId, count);
|
|
386
|
-
else {
|
|
387
|
-
codeVersion.roots.delete(rootId);
|
|
388
|
-
if (!this.#foreign.has(rootId))
|
|
389
|
-
this.endRoot(rootId);
|
|
390
|
-
this.maybeRetire();
|
|
391
|
-
this.#retirementChanged();
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
/** Remembers that calls of `rootId` went out on `connection`, which must hear when the root ends. */
|
|
396
|
-
rootSent(rootId, connection) {
|
|
397
|
-
let links = this.#rootLinks.get(rootId);
|
|
398
|
-
if (links === undefined) {
|
|
399
|
-
links = new Set();
|
|
400
|
-
this.#rootLinks.set(rootId, links);
|
|
401
|
-
}
|
|
402
|
-
links.add(connection);
|
|
403
|
-
}
|
|
404
|
-
/** A root ended (here, or announced by its origin): end its leases and tell the links it went out on. */
|
|
405
|
-
endRoot(rootId) {
|
|
406
|
-
this.#local.delete(rootId);
|
|
407
|
-
this.#foreign.delete(rootId);
|
|
408
|
-
for (const object of this.#touches.get(rootId) ?? [])
|
|
409
|
-
object.rootEnded(rootId);
|
|
410
|
-
this.#touches.delete(rootId);
|
|
411
|
-
for (const connection of this.#rootLinks.get(rootId) ?? [])
|
|
412
|
-
connection.send({ t: "root_end", rootId });
|
|
413
|
-
this.#rootLinks.delete(rootId);
|
|
414
|
-
}
|
|
415
|
-
/**
|
|
416
|
-
* `from` announced the end of a foreign root (or closed). Honored only if the root came over `from`: a peer cannot
|
|
417
|
-
* end leases of roots it never carried. The root ends when no link that brought it remains.
|
|
418
|
-
*/
|
|
419
|
-
foreignRootEnded(rootId, from) {
|
|
420
|
-
const links = this.#foreign.get(rootId);
|
|
421
|
-
if (links === undefined || !links.delete(from) || links.size > 0)
|
|
422
|
-
return;
|
|
423
|
-
const running = [...this.codeVersions.values()].some((codeVersion) => codeVersion.roots.has(rootId));
|
|
424
|
-
// Still running here (a call in flight): the lease ends when it settles.
|
|
425
|
-
if (running)
|
|
426
|
-
this.#foreign.delete(rootId);
|
|
427
|
-
else
|
|
428
|
-
this.endRoot(rootId);
|
|
429
|
-
}
|
|
430
|
-
/**
|
|
431
|
-
* Retires the previous code version once no local roots of it remain. A child also waits for its parent to retire
|
|
432
|
-
* it: roots span hosts, and an old root on the server may still call in.
|
|
433
|
-
*/
|
|
434
|
-
maybeRetire() {
|
|
435
|
-
if (this.retirable())
|
|
436
|
-
this.retire();
|
|
437
|
-
}
|
|
438
|
-
/** The previous code version has no roots left here and, on a child host, the parent has retired it. */
|
|
439
|
-
retirable() {
|
|
440
|
-
const previous = this.previous;
|
|
441
|
-
if (previous === undefined || previous.roots.size > 0)
|
|
442
|
-
return false;
|
|
443
|
-
return this.kind === "client" || this.upstream === undefined || previous.id <= this.#retireAllowed;
|
|
444
|
-
}
|
|
445
|
-
allowRetire(codeVersion) {
|
|
446
|
-
this.#retireAllowed = Math.max(this.#retireAllowed, codeVersion);
|
|
447
|
-
this.maybeRetire();
|
|
448
|
-
this.#retirementChanged();
|
|
449
|
-
}
|
|
450
|
-
/** Calls `watcher` whenever a root ends, the parent allows a retirement, or a code version retires. */
|
|
451
|
-
watchRetirement(watcher) {
|
|
452
|
-
this.#retirementWatchers.add(watcher);
|
|
453
|
-
return () => this.#retirementWatchers.delete(watcher);
|
|
454
|
-
}
|
|
455
|
-
#retirementChanged() {
|
|
456
|
-
for (const watcher of [...this.#retirementWatchers])
|
|
457
|
-
watcher();
|
|
458
|
-
}
|
|
459
|
-
/**
|
|
460
|
-
* Tells a child that is now in step which code versions this host retired before: every id below the oldest one it
|
|
461
|
-
* retains (ids only grow). Without it, a child reconciled after those retirements would never hear a `retire` frame for
|
|
462
|
-
* its own previous code version and would wait for the retire deadline at every reload.
|
|
463
|
-
*/
|
|
464
|
-
announceRetired(connection) {
|
|
465
|
-
const retired = (this.previous ?? this.current).id - 1;
|
|
466
|
-
if (retired > 0)
|
|
467
|
-
connection.send({ t: "retire", codeVersion: retired });
|
|
468
|
-
}
|
|
469
|
-
/** Drops the previous code version: its implementations and the declarations only it used. */
|
|
470
|
-
retire() {
|
|
471
|
-
const previous = this.previous;
|
|
472
|
-
if (previous === undefined)
|
|
473
|
-
return;
|
|
474
|
-
this.previous = undefined;
|
|
475
|
-
this.codeVersions.delete(previous.id);
|
|
476
|
-
for (const object of [...this.objects.values()])
|
|
477
|
-
this.retireImplementation(object, previous.id);
|
|
478
|
-
for (const connection of this.connections) {
|
|
479
|
-
if (connection.role === "downstream" && connection.peer?.kind === "host")
|
|
480
|
-
connection.send({ t: "retire", codeVersion: previous.id });
|
|
481
|
-
}
|
|
482
|
-
this.#retirementChanged();
|
|
483
|
-
}
|
|
484
|
-
/**
|
|
485
|
-
* Drops an object's implementation for `codeVersion` and what only that implementation declared, in disposal order:
|
|
486
|
-
* resources close (reverse open order) before its references are released.
|
|
487
|
-
*/
|
|
488
|
-
retireImplementation(object, codeVersion) {
|
|
489
|
-
const installed = object.implementations.get(codeVersion);
|
|
490
|
-
object.implementations.delete(codeVersion);
|
|
491
|
-
if (installed === undefined || installed.decls === object.decls)
|
|
492
|
-
return;
|
|
493
|
-
const kept = object.allDecls();
|
|
494
|
-
const keep = (pick) => new Set([...kept].flatMap((decls) => [...pick(decls)]));
|
|
495
|
-
const refs = keep((decls) => decls.refs.values());
|
|
496
|
-
const resources = keep((decls) => decls.resources.values());
|
|
497
|
-
const derives = keep((decls) => decls.derives.values());
|
|
498
|
-
for (const derived of installed.decls.derives.values())
|
|
499
|
-
if (!derives.has(derived))
|
|
500
|
-
derived.detach();
|
|
501
|
-
const closing = [...installed.decls.resources.values()]
|
|
502
|
-
.filter((resource) => !resources.has(resource))
|
|
503
|
-
.sort((a, b) => object.openOrder.indexOf(b) - object.openOrder.indexOf(a));
|
|
504
|
-
const releasing = [...installed.decls.refs.values()].filter((ref) => !refs.has(ref));
|
|
505
|
-
object.refreshSchemas();
|
|
506
|
-
runAll([
|
|
507
|
-
...closing.map((resource) => () => resource.close(object.openOrder)),
|
|
508
|
-
...releasing.map((ref) => () => ref.release()),
|
|
509
|
-
], `${object.address}: retiring code version ${codeVersion} failed`).catch((error) => this.report(error));
|
|
510
|
-
}
|
|
511
|
-
// ─── registries ───
|
|
512
|
-
registry(registry) {
|
|
513
|
-
const table = (ctx) => {
|
|
514
|
-
const codeVersion = ctx === undefined ? this.current : this.codeVersions.get(ctx.codeVersion);
|
|
515
|
-
if (codeVersion === undefined)
|
|
516
|
-
throw new ChordError("superseded", `code version ${ctx?.codeVersion} is retired`);
|
|
517
|
-
return (codeVersion.tables.get(registry.name) ?? EMPTY_TABLE);
|
|
518
|
-
};
|
|
519
|
-
return {
|
|
520
|
-
table,
|
|
521
|
-
get: (key, ctx) => table(ctx).get(key),
|
|
522
|
-
subscribe: (listener) => {
|
|
523
|
-
let set = this.#subscribers.get(registry.name);
|
|
524
|
-
if (set === undefined) {
|
|
525
|
-
set = new Set();
|
|
526
|
-
this.#subscribers.set(registry.name, set);
|
|
527
|
-
}
|
|
528
|
-
const wrapped = listener;
|
|
529
|
-
set.add(wrapped);
|
|
530
|
-
wrapped(table(), this.current.id);
|
|
531
|
-
return () => set.delete(wrapped);
|
|
532
|
-
},
|
|
533
|
-
};
|
|
534
|
-
}
|
|
535
|
-
/** Builds registry tables from (object, declarations) pairs. Throws registry_conflict. */
|
|
536
|
-
buildTables(entries) {
|
|
537
|
-
const byRegistry = new Map();
|
|
538
|
-
for (const [object, decls] of entries) {
|
|
539
|
-
for (const { registry, key, value } of decls.registrations.values()) {
|
|
540
|
-
let entries = byRegistry.get(registry.name);
|
|
541
|
-
if (entries === undefined) {
|
|
542
|
-
entries = new Map();
|
|
543
|
-
byRegistry.set(registry.name, entries);
|
|
544
|
-
}
|
|
545
|
-
const existing = entries.get(key);
|
|
546
|
-
if (existing !== undefined && existing.object !== object && registry.conflict === "error") {
|
|
547
|
-
throw invalid("registry_conflict", `${registry.name}: ${key} registered by ${existing.object.address} and ${object.address}`);
|
|
548
|
-
}
|
|
549
|
-
entries.set(key, { value, object });
|
|
550
|
-
let order = this.#order.get(registry.name);
|
|
551
|
-
if (order === undefined) {
|
|
552
|
-
order = new Map();
|
|
553
|
-
this.#order.set(registry.name, order);
|
|
554
|
-
}
|
|
555
|
-
if (!order.has(key))
|
|
556
|
-
order.set(key, order.size);
|
|
557
|
-
}
|
|
558
|
-
}
|
|
559
|
-
const tables = new Map();
|
|
560
|
-
for (const [name, entries] of byRegistry) {
|
|
561
|
-
const order = this.#order.get(name);
|
|
562
|
-
const sorted = [...entries].sort(([a], [b]) => order.get(a) - order.get(b));
|
|
563
|
-
tables.set(name, new Map(sorted.map(([key, entry]) => [key, entry.value])));
|
|
564
|
-
}
|
|
565
|
-
return tables;
|
|
566
|
-
}
|
|
567
|
-
/**
|
|
568
|
-
* The service a reference binds against: the current one, or for a prepare rerun (`candidate`) the running reload's
|
|
569
|
-
* pending one, so consumer and provider of a breaking change can reload in one batch.
|
|
570
|
-
*/
|
|
571
|
-
#bindingService(typeName, candidate) {
|
|
572
|
-
return (candidate ? this.pending?.services.get(typeName) : undefined) ?? this.service(typeName);
|
|
573
|
-
}
|
|
574
|
-
/** Live objects with their current declarations; objects waiting for a reload's commit only with `candidates`. */
|
|
575
|
-
liveDecls(candidates = false) {
|
|
576
|
-
return [...this.objects.values()]
|
|
577
|
-
.filter((object) => object.status === "live" && (candidates || !object.deferredRuntime))
|
|
578
|
-
.map((object) => [object, object.decls]);
|
|
579
|
-
}
|
|
580
|
-
checkRegistrations(object, decls) {
|
|
581
|
-
if (decls.registrations.size === 0)
|
|
582
|
-
return;
|
|
583
|
-
this.buildTables([...this.liveDecls().filter(([other]) => other !== object), [object, decls]]);
|
|
584
|
-
}
|
|
585
|
-
registriesChanged(including) {
|
|
586
|
-
const entries = this.liveDecls().filter(([object]) => object !== including);
|
|
587
|
-
if (including !== undefined)
|
|
588
|
-
entries.push([including, including.decls]);
|
|
589
|
-
this.installTables(this.current, this.buildTables(entries));
|
|
590
|
-
}
|
|
591
|
-
/** A commit failed midway: from now on this host admits no work (calls fail `unavailable/host_failed`). */
|
|
592
|
-
fail(error) {
|
|
593
|
-
this.failed ??= error;
|
|
594
|
-
this.report(error);
|
|
595
|
-
}
|
|
596
|
-
/** Installs tables for `codeVersion`; subscribers hear about changed tables of the current code version (all tables when `all`). */
|
|
597
|
-
installTables(codeVersion, tables, all = false) {
|
|
598
|
-
const before = codeVersion.tables;
|
|
599
|
-
codeVersion.tables = tables;
|
|
600
|
-
if (codeVersion !== this.current)
|
|
601
|
-
return;
|
|
602
|
-
for (const [name, listeners] of this.#subscribers) {
|
|
603
|
-
const next = tables.get(name) ?? EMPTY_TABLE;
|
|
604
|
-
if (!all && sameTable(before.get(name) ?? EMPTY_TABLE, next))
|
|
605
|
-
continue;
|
|
606
|
-
const current = [...listeners];
|
|
607
|
-
enqueue(() => {
|
|
608
|
-
for (const listener of current) {
|
|
609
|
-
try {
|
|
610
|
-
listener(next, codeVersion.id);
|
|
611
|
-
}
|
|
612
|
-
catch (error) {
|
|
613
|
-
this.report(error);
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
});
|
|
617
|
-
}
|
|
618
|
-
}
|
|
619
|
-
// ─── public API ───
|
|
620
|
-
async get(type, input, options) {
|
|
621
|
-
const ref = this.acquire(type, input, options, "external");
|
|
622
|
-
await awaitReady(ref, options?.signal === undefined ? [] : [options.signal], this.readyTimeout);
|
|
623
|
-
return ref.proxy;
|
|
624
|
-
}
|
|
625
|
-
hold(type, input, options) {
|
|
626
|
-
return this.acquire(type, input, options, "external").proxy;
|
|
627
|
-
}
|
|
628
|
-
async invalidatePrincipal(match) {
|
|
629
|
-
const matches = typeof match === "function" ? match : (principal) => matchesPattern(match, principal);
|
|
630
|
-
const reason = new ChordError("gone", "principal invalidated");
|
|
631
|
-
// Links acting as a matching principal are re-stamped (if the acceptor can) or closed.
|
|
632
|
-
for (const connection of [...this.connections]) {
|
|
633
|
-
if (connection.role !== "downstream" || !matches(connection.principal))
|
|
634
|
-
continue;
|
|
635
|
-
// Relays under the old principal close at once, including those still resolving their route.
|
|
636
|
-
connection.revoke(connection.restamp?.(connection.principal));
|
|
637
|
-
}
|
|
638
|
-
// Patterns propagate to child hosts, which dispose their own matching objects (e.g. relayed guests).
|
|
639
|
-
if (typeof match !== "function") {
|
|
640
|
-
for (const connection of this.connections) {
|
|
641
|
-
if (connection.role === "downstream" && connection.peer.kind === "host") {
|
|
642
|
-
connection.send({ t: "invalidate", pattern: match });
|
|
643
|
-
}
|
|
644
|
-
}
|
|
645
|
-
}
|
|
646
|
-
const matching = [...this.objects.values()].filter((object) => !this.isSelf(object.principal) && matches(object.principal));
|
|
647
|
-
await disposeHoldersFirst(matching, reason, "invalidatePrincipal: disposal failed");
|
|
648
|
-
}
|
|
649
|
-
// ─── links ───
|
|
650
|
-
accept(link, options) {
|
|
651
|
-
const kind = options.kind ?? "client";
|
|
652
|
-
if (kind === "host" && options.name === undefined)
|
|
653
|
-
throw new TypeError("accepting a host link needs its name");
|
|
654
|
-
this.#addConnection(link, {
|
|
655
|
-
...options,
|
|
656
|
-
role: "downstream",
|
|
657
|
-
principal: options.principal,
|
|
658
|
-
peer: { kind, name: kind === "host" ? options.name : undefined },
|
|
659
|
-
// Holds over a client link carry its id as their origin (also when relayed), so hosts can tell clients apart.
|
|
660
|
-
...(kind === "client" ? { originId: `${this.#incarnation}:${++this.#originSeq}` } : {}),
|
|
661
|
-
});
|
|
662
|
-
}
|
|
663
|
-
connect(link, options) {
|
|
664
|
-
if (!("principal" in options))
|
|
665
|
-
throw new TypeError("connect needs `principal`: what the parent's own requests act as");
|
|
666
|
-
if (this.upstream?.open)
|
|
667
|
-
this.upstream.link.close("replaced");
|
|
668
|
-
const connection = this.#addConnection(link, {
|
|
669
|
-
...options,
|
|
670
|
-
role: "upstream",
|
|
671
|
-
principal: options.principal,
|
|
672
|
-
peer: { kind: "host", name: undefined },
|
|
673
|
-
});
|
|
674
|
-
this.upstream = connection;
|
|
675
|
-
// Bindings that lost their link re-hold over the new one (`again`: they keep their values meanwhile).
|
|
676
|
-
for (const binding of this.bindings.values())
|
|
677
|
-
if (binding.hold === undefined && !binding.ended)
|
|
678
|
-
connection.hold(binding, binding.applied);
|
|
679
|
-
}
|
|
680
|
-
#addConnection(link, config) {
|
|
681
|
-
const connection = new Connection(this, link, config);
|
|
682
|
-
// A link that was already closed closed the connection in its constructor: keeping it would route to it forever.
|
|
683
|
-
if (connection.open)
|
|
684
|
-
this.connections.add(connection);
|
|
685
|
-
return connection;
|
|
686
|
-
}
|
|
687
|
-
route(prefix, route) {
|
|
688
|
-
if (typeof route.principal !== "function")
|
|
689
|
-
throw new TypeError(`route ${prefix} needs \`principal\`: what the routed hosts act as when they call back`);
|
|
690
|
-
this.#routes.set(prefix, route);
|
|
691
|
-
}
|
|
692
|
-
/**
|
|
693
|
-
* A child host announced its code version. In step: usable. Behind: fenced (nothing is routed to it) and reconciled
|
|
694
|
-
* by a reload of its modules to this host's code version, never by renumbering what it runs. Ahead: impossible,
|
|
695
|
-
* refused.
|
|
696
|
-
*/
|
|
697
|
-
peerHello(connection, codeVersion) {
|
|
698
|
-
if (codeVersion > this.current.id) {
|
|
699
|
-
this.report(new ChordError("invalid", `${connection.name} runs code version ${codeVersion}, ahead of ${this.current.id}`));
|
|
700
|
-
connection.link.close("code version ahead of parent");
|
|
701
|
-
return;
|
|
702
|
-
}
|
|
703
|
-
if (this.reloading) {
|
|
704
|
-
// Not a participant of the running reload (participants are fixed when it starts): in step now, it would miss
|
|
705
|
-
// the commit. Decided when the reload ends. A child already behind is fenced now, so the calls its roots make
|
|
706
|
-
// meanwhile are admitted in this host's code version (never relabeled) instead of being `superseded`.
|
|
707
|
-
connection.peerCodeVersion = codeVersion;
|
|
708
|
-
if (codeVersion < this.current.id)
|
|
709
|
-
connection.fencedCodeVersions.add(codeVersion);
|
|
710
|
-
this.#deferredHellos.set(connection, codeVersion);
|
|
711
|
-
return;
|
|
712
|
-
}
|
|
713
|
-
if (codeVersion === this.current.id) {
|
|
714
|
-
connection.markSynced(codeVersion);
|
|
715
|
-
this.announceRetired(connection);
|
|
716
|
-
return;
|
|
717
|
-
}
|
|
718
|
-
connection.peerCodeVersion = codeVersion;
|
|
719
|
-
connection.fencedCodeVersions.add(codeVersion);
|
|
720
|
-
reconcileChild(this, connection).catch((error) => {
|
|
721
|
-
this.report(error);
|
|
722
|
-
connection.link.close("reconciliation failed");
|
|
723
|
-
});
|
|
724
|
-
}
|
|
725
|
-
/** The host's reload slot was freed: children that said hello meanwhile are synced or reconciled now. */
|
|
726
|
-
reloadEnded() {
|
|
727
|
-
this.reloading = false;
|
|
728
|
-
const deferred = [...this.#deferredHellos];
|
|
729
|
-
this.#deferredHellos.clear();
|
|
730
|
-
for (const [connection, codeVersion] of deferred)
|
|
731
|
-
if (connection.open)
|
|
732
|
-
this.peerHello(connection, codeVersion);
|
|
733
|
-
for (const resolve of this.#reloadWaiters.splice(0))
|
|
734
|
-
resolve();
|
|
735
|
-
this.maybeRetire();
|
|
736
|
-
}
|
|
737
|
-
/** Resolves once no reload runs on this host. */
|
|
738
|
-
whenReloadEnded() {
|
|
739
|
-
if (!this.reloading)
|
|
740
|
-
return Promise.resolve();
|
|
741
|
-
return new Promise((resolve) => this.#reloadWaiters.push(resolve));
|
|
742
|
-
}
|
|
743
|
-
connectionClosed(connection) {
|
|
744
|
-
this.connections.delete(connection);
|
|
745
|
-
this.#deferredHellos.delete(connection);
|
|
746
|
-
// Foreign roots that came over this link will never announce their end over it.
|
|
747
|
-
for (const [rootId, links] of [...this.#foreign])
|
|
748
|
-
if (links.has(connection))
|
|
749
|
-
this.foreignRootEnded(rootId, connection);
|
|
750
|
-
for (const links of this.#rootLinks.values())
|
|
751
|
-
links.delete(connection);
|
|
752
|
-
if (this.upstream === connection) {
|
|
753
|
-
this.upstream = undefined;
|
|
754
|
-
this.#childReloads.parentLost();
|
|
755
|
-
}
|
|
756
|
-
}
|
|
757
|
-
/** The last reference to `binding` was released: it lingers if its type does (`HostOptions.linger`), else closes. */
|
|
758
|
-
bindingIdle(binding) {
|
|
759
|
-
const ms = Object.hasOwn(this.#lingerTypes, binding.contract.name)
|
|
760
|
-
? this.#lingerTypes[binding.contract.name]
|
|
761
|
-
: 0;
|
|
762
|
-
// A binding that never had a shape has nothing worth keeping.
|
|
763
|
-
if (ms <= 0 || binding.ended || !binding.applied || this.#lingerCap <= 0) {
|
|
764
|
-
binding.close();
|
|
765
|
-
return;
|
|
766
|
-
}
|
|
767
|
-
binding.lingerTimer = setTimeout(() => binding.close(), ms);
|
|
768
|
-
binding.lingerTimer.unref?.();
|
|
769
|
-
this.#lingering.set(binding.key, binding);
|
|
770
|
-
for (const oldest of this.#lingering.values()) {
|
|
771
|
-
if (this.#lingering.size <= this.#lingerCap)
|
|
772
|
-
break;
|
|
773
|
-
oldest.close();
|
|
774
|
-
}
|
|
775
|
-
}
|
|
776
|
-
forgetBinding(binding) {
|
|
777
|
-
if (this.bindings.get(binding.key) === binding)
|
|
778
|
-
this.bindings.delete(binding.key);
|
|
779
|
-
if (this.#lingering.get(binding.key) === binding)
|
|
780
|
-
this.#lingering.delete(binding.key);
|
|
781
|
-
}
|
|
782
|
-
/** A downstream host connection by its configured name (never by what a peer announced). */
|
|
783
|
-
#childNamed(name) {
|
|
784
|
-
return [...this.connections].find((connection) => connection.open &&
|
|
785
|
-
connection.role === "downstream" &&
|
|
786
|
-
connection.peer.kind === "host" &&
|
|
787
|
-
connection.peer.name === name);
|
|
788
|
-
}
|
|
789
|
-
/**
|
|
790
|
-
* A reference to an object on host `at`: a view onto the binding for its key, created (and held) if there is none.
|
|
791
|
-
* `input` is normalized with `type` (the hold carries it so).
|
|
792
|
-
*/
|
|
793
|
-
#acquireRemote(type, at, input, options, owner) {
|
|
794
|
-
const principal = options?.principal === undefined || this.isSelf(options.principal) ? undefined : options.principal;
|
|
795
|
-
const key = this.#remoteKey(type, input, principal ?? this.principal);
|
|
796
|
-
let binding = this.bindings.get(key);
|
|
797
|
-
const fresh = binding === undefined || binding.ended;
|
|
798
|
-
if (binding === undefined || binding.ended) {
|
|
799
|
-
binding = new RemoteBinding(this, { key, contract: type, at, input, principal });
|
|
800
|
-
this.bindings.set(key, binding);
|
|
801
|
-
}
|
|
802
|
-
const ref = new RemoteRef(binding, owner, options?.state !== false);
|
|
803
|
-
this.#lingering.delete(key);
|
|
804
|
-
binding.addView(ref);
|
|
805
|
-
if (fresh)
|
|
806
|
-
this.#hold(binding);
|
|
807
|
-
return ref;
|
|
808
|
-
}
|
|
809
|
-
/** Holds `binding` over the link to its host: the parent's, a child's, or one a route resolves. */
|
|
810
|
-
#hold(binding) {
|
|
811
|
-
const bindWhenSynced = (connection) => {
|
|
812
|
-
connection.then((target) => {
|
|
813
|
-
if (!binding.ended && binding.hold === undefined)
|
|
814
|
-
target.hold(binding, false);
|
|
815
|
-
}, (error) => binding.gone(error));
|
|
816
|
-
};
|
|
817
|
-
const direct = this.#childNamed(binding.at);
|
|
818
|
-
if (this.upstream !== undefined)
|
|
819
|
-
this.upstream.hold(binding, false);
|
|
820
|
-
else if (direct !== undefined)
|
|
821
|
-
bindWhenSynced(direct.whenSynced().then(() => direct));
|
|
822
|
-
else {
|
|
823
|
-
const route = this.#routeFor(binding.at);
|
|
824
|
-
if (route === undefined)
|
|
825
|
-
binding.gone(new ChordError("unavailable", `no route to ${binding.at}`));
|
|
826
|
-
else
|
|
827
|
-
bindWhenSynced(this.#resolve(route, binding.at, binding.principal ?? this.principal));
|
|
828
|
-
}
|
|
829
|
-
}
|
|
830
|
-
#routeFor(hostName) {
|
|
831
|
-
let best;
|
|
832
|
-
for (const entry of this.#routes) {
|
|
833
|
-
if (hostName.startsWith(entry[0]) && (best === undefined || entry[0].length > best[0].length))
|
|
834
|
-
best = entry;
|
|
835
|
-
}
|
|
836
|
-
return best?.[1];
|
|
837
|
-
}
|
|
838
|
-
/** Authorize, resolve (maybe spawn), authorize again; returns the synced connection to the host. */
|
|
839
|
-
async #resolve(route, hostName, principal, still = () => true) {
|
|
840
|
-
const refuse = () => new ChordError("forbidden", `${hostName} refused for this principal`);
|
|
841
|
-
const revoked = () => new ChordError("gone", "principal invalidated while resolving");
|
|
842
|
-
if (!(await route.authorize(principal, hostName)))
|
|
843
|
-
throw refuse();
|
|
844
|
-
if (!still())
|
|
845
|
-
throw revoked();
|
|
846
|
-
const link = await route.resolve(hostName);
|
|
847
|
-
if (!still())
|
|
848
|
-
throw revoked();
|
|
849
|
-
if (!(await route.authorize(principal, hostName)))
|
|
850
|
-
throw refuse();
|
|
851
|
-
if (!still())
|
|
852
|
-
throw revoked();
|
|
853
|
-
let connection = [...this.connections].find((candidate) => candidate.link === link);
|
|
854
|
-
connection ??= this.#addConnection(link, {
|
|
855
|
-
role: "downstream",
|
|
856
|
-
principal: route.principal(hostName),
|
|
857
|
-
peer: { kind: "host", name: hostName },
|
|
858
|
-
});
|
|
859
|
-
await connection.whenSynced();
|
|
860
|
-
if (!still())
|
|
861
|
-
throw revoked();
|
|
862
|
-
return connection;
|
|
863
|
-
}
|
|
864
|
-
/**
|
|
865
|
-
* Relays a reference from `relay.origin` to the host it names. Relaying needs a route: it is where authorization
|
|
866
|
-
* lives. The origin's authorization generation is re-checked after every await and right before forwarding, so a
|
|
867
|
-
* revocation during resolution wins.
|
|
868
|
-
*/
|
|
869
|
-
async relay(relay) {
|
|
870
|
-
const at = relay.frame.at;
|
|
871
|
-
// The hold names its target; its contract token says where the type lives. They must agree.
|
|
872
|
-
const placement = contractFromDescription(relay.frame.token).description.host;
|
|
873
|
-
if (placement === undefined || resolveHost(relay.frame.token.name, placement, relay.frame.input) !== at)
|
|
874
|
-
throw invalid("placement", `${relay.frame.token.name} with this input does not live on ${at}`);
|
|
875
|
-
const route = this.#routeFor(at);
|
|
876
|
-
if (route === undefined) {
|
|
877
|
-
throw this.#childNamed(at) === undefined
|
|
878
|
-
? new ChordError("unavailable", `no route to ${at}`)
|
|
879
|
-
: new ChordError("forbidden", `no route authorizes ${at}`);
|
|
880
|
-
}
|
|
881
|
-
const down = await this.#resolve(route, at, relay.principal, () => relay.current);
|
|
882
|
-
if (!relay.current)
|
|
883
|
-
return;
|
|
884
|
-
relay.open(down);
|
|
885
|
-
}
|
|
886
|
-
reload(plugins, options = {}) {
|
|
887
|
-
// Client-local facet code versions never cross the parent link; only child hosts require cluster coordination.
|
|
888
|
-
if (this.kind !== "client" && this.upstream !== undefined) {
|
|
889
|
-
return Promise.reject(new ChordError("unavailable", "reloads are coordinated by the server", { reason: "not_coordinator" }));
|
|
890
|
-
}
|
|
891
|
-
const children = [...this.connections].some((connection) => connection.role === "downstream" && connection.peer.kind === "host");
|
|
892
|
-
return children || options.remote !== undefined || options.remoteRemove !== undefined
|
|
893
|
-
? runClusterReload(this, plugins, options)
|
|
894
|
-
: runReload(this, plugins, options);
|
|
895
|
-
}
|
|
896
|
-
onReloadFrame(connection, frame) {
|
|
897
|
-
this.#childReloads.handle(connection, frame);
|
|
898
|
-
}
|
|
899
|
-
rememberRemoteModules(remote, remove) {
|
|
900
|
-
for (const prefix of new Set([...Object.keys(remote ?? {}), ...Object.keys(remove ?? {})])) {
|
|
901
|
-
const modules = remote?.[prefix] ?? [];
|
|
902
|
-
const removed = remove?.[prefix] ?? [];
|
|
903
|
-
this.remoteModules[prefix] = [...new Set([...(this.remoteModules[prefix] ?? []), ...modules])].filter((module) => !removed.includes(module));
|
|
904
|
-
this.remoteRemoved[prefix] = [...new Set([...(this.remoteRemoved[prefix] ?? []), ...removed])].filter((module) => !modules.includes(module));
|
|
905
|
-
}
|
|
906
|
-
}
|
|
907
|
-
/** The code version id the next reload would commit. */
|
|
908
|
-
peekNextCodeVersion() {
|
|
909
|
-
return this.#codeVersionSeq + 1;
|
|
910
|
-
}
|
|
911
|
-
/**
|
|
912
|
-
* Disposes every object, holders before what they reference (a resource's `close` may still use the objects its object
|
|
913
|
-
* references, local or remote), then closes the links.
|
|
914
|
-
*/
|
|
915
|
-
async close() {
|
|
916
|
-
for (const binding of [...this.#lingering.values()])
|
|
917
|
-
binding.close();
|
|
918
|
-
this.hostObjects.clear();
|
|
919
|
-
for (const name of [...this.#facetRuns.keys()])
|
|
920
|
-
this.facetRunChanged(name, undefined);
|
|
921
|
-
const reason = new ChordError("gone", `host ${this.name} closed`);
|
|
922
|
-
try {
|
|
923
|
-
await disposeHoldersFirst([...this.objects.values()], reason, "host close: disposal failed");
|
|
924
|
-
}
|
|
925
|
-
finally {
|
|
926
|
-
for (const connection of [...this.connections])
|
|
927
|
-
connection.link.close("host closed");
|
|
928
|
-
}
|
|
929
|
-
}
|
|
930
|
-
}
|
|
931
|
-
/**
|
|
932
|
-
* Force-disposes `objects` in waves: an object goes once no object of the set that references it is left, so holders are
|
|
933
|
-
* disposed (and their resources closed) while what they reference is still live. In-host references are acyclic. Errors of
|
|
934
|
-
* every disposal are collected.
|
|
935
|
-
*/
|
|
936
|
-
async function disposeHoldersFirst(objects, reason, message) {
|
|
937
|
-
const remaining = new Set(objects);
|
|
938
|
-
const held = (object) => {
|
|
939
|
-
const result = new Set();
|
|
940
|
-
for (const decls of object.allDecls()) {
|
|
941
|
-
for (const ref of decls.refs.values())
|
|
942
|
-
if (ref.object !== undefined)
|
|
943
|
-
result.add(ref.object);
|
|
944
|
-
}
|
|
945
|
-
return result;
|
|
946
|
-
};
|
|
947
|
-
const refs = new Map(objects.map((object) => [object, held(object)]));
|
|
948
|
-
const errors = [];
|
|
949
|
-
while (remaining.size > 0) {
|
|
950
|
-
const heldByRemaining = new Set();
|
|
951
|
-
for (const object of remaining)
|
|
952
|
-
for (const target of refs.get(object) ?? [])
|
|
953
|
-
heldByRemaining.add(target);
|
|
954
|
-
let wave = [...remaining].filter((object) => !heldByRemaining.has(object));
|
|
955
|
-
// A cycle cannot happen in-host; dispose the rest together rather than loop.
|
|
956
|
-
if (wave.length === 0)
|
|
957
|
-
wave = [...remaining];
|
|
958
|
-
for (const object of wave)
|
|
959
|
-
remaining.delete(object);
|
|
960
|
-
const results = await Promise.allSettled(wave.map((object) => object.dispose(true, reason)));
|
|
961
|
-
for (const result of results)
|
|
962
|
-
if (result.status === "rejected")
|
|
963
|
-
errors.push(result.reason);
|
|
964
|
-
}
|
|
965
|
-
if (errors.length === 1)
|
|
966
|
-
throw errors[0];
|
|
967
|
-
if (errors.length > 1)
|
|
968
|
-
throw new AggregateError(errors, message);
|
|
969
|
-
}
|
|
970
|
-
function sameTable(a, b) {
|
|
971
|
-
if (a.size !== b.size)
|
|
972
|
-
return false;
|
|
973
|
-
const keys = [...a.keys()];
|
|
974
|
-
return [...b].every(([key, value], index) => keys[index] === key && a.get(key) === value);
|
|
975
|
-
}
|
|
976
|
-
const matchesPattern = (pattern, principal) => principal !== null &&
|
|
977
|
-
typeof principal === "object" &&
|
|
978
|
-
Object.entries(pattern).every(([key, value]) => deepEqual(principal[key], value));
|
|
979
|
-
const unknownType = (type, host) => new ChordError("unavailable", `${type} is not served by ${host}`, { reason: "unknown_type" });
|
|
980
|
-
/** True if `from` references `to`, directly or transitively, through object-owned references on this host. */
|
|
981
|
-
function reaches(from, to) {
|
|
982
|
-
const seen = new Set();
|
|
983
|
-
const stack = [from];
|
|
984
|
-
while (stack.length > 0) {
|
|
985
|
-
const object = stack.pop();
|
|
986
|
-
if (object === to)
|
|
987
|
-
return true;
|
|
988
|
-
if (seen.has(object))
|
|
989
|
-
continue;
|
|
990
|
-
seen.add(object);
|
|
991
|
-
// Remote references have no object here: cycles across hosts are avoided by convention.
|
|
992
|
-
for (const decls of object.allDecls()) {
|
|
993
|
-
for (const ref of decls.refs.values())
|
|
994
|
-
if (ref.object !== undefined)
|
|
995
|
-
stack.push(ref.object);
|
|
996
|
-
}
|
|
997
|
-
}
|
|
998
|
-
return false;
|
|
999
|
-
}
|
|
1000
|
-
//# sourceMappingURL=host.js.map
|