@earendil-works/chord 1.4.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +92 -0
- package/README.md +115 -90
- package/dist/context/index.d.ts +1 -1
- package/dist/context/index.d.ts.map +1 -1
- package/dist/context/index.js +1 -1
- package/dist/context/index.js.map +1 -1
- package/dist/contracts/accepts.d.ts +81 -0
- package/dist/contracts/accepts.d.ts.map +1 -0
- package/dist/contracts/accepts.js +123 -0
- package/dist/contracts/accepts.js.map +1 -0
- package/dist/contracts/contract.d.ts +121 -0
- package/dist/contracts/contract.d.ts.map +1 -0
- package/dist/contracts/contract.js +50 -0
- package/dist/contracts/contract.js.map +1 -0
- package/dist/contracts/declare.d.ts +107 -0
- package/dist/contracts/declare.d.ts.map +1 -0
- package/dist/contracts/declare.js +136 -0
- package/dist/contracts/declare.js.map +1 -0
- package/dist/contracts/evolve.d.ts +92 -0
- package/dist/contracts/evolve.d.ts.map +1 -0
- package/dist/contracts/evolve.js +179 -0
- package/dist/contracts/evolve.js.map +1 -0
- package/dist/contracts/fingerprint.d.ts +16 -0
- package/dist/contracts/fingerprint.d.ts.map +1 -0
- package/dist/contracts/fingerprint.js +50 -0
- package/dist/contracts/fingerprint.js.map +1 -0
- package/dist/contracts/history.d.ts +71 -0
- package/dist/contracts/history.d.ts.map +1 -0
- package/dist/contracts/history.js +3 -0
- package/dist/contracts/history.js.map +1 -0
- package/dist/contracts/host-kind.d.ts +40 -0
- package/dist/contracts/host-kind.d.ts.map +1 -0
- package/dist/contracts/host-kind.js +37 -0
- package/dist/contracts/host-kind.js.map +1 -0
- package/dist/contracts/index.d.ts +7 -0
- package/dist/contracts/index.d.ts.map +1 -0
- package/dist/contracts/index.js +6 -0
- package/dist/contracts/index.js.map +1 -0
- package/dist/contracts/internal.d.ts +10 -0
- package/dist/contracts/internal.d.ts.map +1 -0
- package/dist/contracts/internal.js +9 -0
- package/dist/contracts/internal.js.map +1 -0
- package/dist/contracts/names.d.ts +3 -0
- package/dist/contracts/names.d.ts.map +1 -0
- package/dist/contracts/names.js +13 -0
- package/dist/contracts/names.js.map +1 -0
- package/dist/contracts/params.d.ts +28 -0
- package/dist/contracts/params.d.ts.map +1 -0
- package/dist/contracts/params.js +50 -0
- package/dist/contracts/params.js.map +1 -0
- package/dist/contracts/schema.d.ts +102 -0
- package/dist/contracts/schema.d.ts.map +1 -0
- package/dist/contracts/schema.js +103 -0
- package/dist/contracts/schema.js.map +1 -0
- package/dist/contracts/snapshot.d.ts +16 -0
- package/dist/contracts/snapshot.d.ts.map +1 -0
- package/dist/contracts/snapshot.js +167 -0
- package/dist/contracts/snapshot.js.map +1 -0
- package/dist/data/args.d.ts +50 -0
- package/dist/data/args.d.ts.map +1 -0
- package/dist/data/args.js +83 -0
- package/dist/data/args.js.map +1 -0
- package/dist/data/errors.d.ts +80 -0
- package/dist/data/errors.d.ts.map +1 -0
- package/dist/data/errors.js +116 -0
- package/dist/data/errors.js.map +1 -0
- package/dist/data/failure.d.ts +26 -0
- package/dist/data/failure.d.ts.map +1 -0
- package/dist/data/failure.js +77 -0
- package/dist/data/failure.js.map +1 -0
- package/dist/data/index.d.ts +4 -0
- package/dist/data/index.d.ts.map +1 -0
- package/dist/data/index.js +5 -0
- package/dist/data/index.js.map +1 -0
- package/dist/data/internal.d.ts +7 -0
- package/dist/data/internal.d.ts.map +1 -0
- package/dist/data/internal.js +8 -0
- package/dist/data/internal.js.map +1 -0
- package/dist/data/params.d.ts +20 -0
- package/dist/data/params.d.ts.map +1 -0
- package/dist/data/params.js +31 -0
- package/dist/data/params.js.map +1 -0
- package/dist/data/principal.d.ts +22 -0
- package/dist/data/principal.d.ts.map +1 -0
- package/dist/data/principal.js +49 -0
- package/dist/data/principal.js.map +1 -0
- package/dist/data/validator.d.ts +12 -0
- package/dist/data/validator.d.ts.map +1 -0
- package/dist/data/validator.js +35 -0
- package/dist/data/validator.js.map +1 -0
- package/dist/delta/apply-immutable-trusted.js +3 -4
- package/dist/delta/apply-immutable-trusted.js.map +1 -1
- package/dist/delta/diff.d.ts.map +1 -1
- package/dist/delta/diff.js +5 -3
- package/dist/delta/diff.js.map +1 -1
- package/dist/delta/index.d.ts +9 -1
- package/dist/delta/index.d.ts.map +1 -1
- package/dist/delta/index.js +15 -11
- package/dist/delta/index.js.map +1 -1
- package/dist/delta/pending.d.ts +36 -0
- package/dist/delta/pending.d.ts.map +1 -0
- package/dist/delta/pending.js +143 -0
- package/dist/delta/pending.js.map +1 -0
- package/dist/delta/tracker.d.ts +12 -0
- package/dist/delta/tracker.d.ts.map +1 -1
- package/dist/delta/tracker.js +109 -39
- package/dist/delta/tracker.js.map +1 -1
- package/dist/documents/address-source.d.ts +20 -0
- package/dist/documents/address-source.d.ts.map +1 -0
- package/dist/documents/address-source.js +44 -0
- package/dist/documents/address-source.js.map +1 -0
- package/dist/documents/definition.d.ts +84 -0
- package/dist/documents/definition.d.ts.map +1 -0
- package/dist/documents/definition.js +74 -0
- package/dist/documents/definition.js.map +1 -0
- package/dist/documents/documents.d.ts +126 -0
- package/dist/documents/documents.d.ts.map +1 -0
- package/dist/documents/documents.js +248 -0
- package/dist/documents/documents.js.map +1 -0
- package/dist/documents/fence.d.ts +9 -0
- package/dist/documents/fence.d.ts.map +1 -0
- package/dist/documents/fence.js +15 -0
- package/dist/documents/fence.js.map +1 -0
- package/dist/documents/handles.d.ts +76 -0
- package/dist/documents/handles.d.ts.map +1 -0
- package/dist/documents/handles.js +66 -0
- package/dist/documents/handles.js.map +1 -0
- package/dist/documents/index.d.ts +4 -0
- package/dist/documents/index.d.ts.map +1 -0
- package/dist/documents/index.js +3 -0
- package/dist/documents/index.js.map +1 -0
- package/dist/documents/internal.d.ts +9 -0
- package/dist/documents/internal.d.ts.map +1 -0
- package/dist/documents/internal.js +9 -0
- package/dist/documents/internal.js.map +1 -0
- package/dist/documents/keyed-slot.d.ts +103 -0
- package/dist/documents/keyed-slot.d.ts.map +1 -0
- package/dist/documents/keyed-slot.js +395 -0
- package/dist/documents/keyed-slot.js.map +1 -0
- package/dist/documents/line.d.ts +7 -0
- package/dist/documents/line.d.ts.map +1 -0
- package/dist/documents/line.js +14 -0
- package/dist/documents/line.js.map +1 -0
- package/dist/documents/persistence.d.ts +104 -0
- package/dist/documents/persistence.d.ts.map +1 -0
- package/dist/documents/persistence.js +129 -0
- package/dist/documents/persistence.js.map +1 -0
- package/dist/documents/residency.d.ts +31 -0
- package/dist/documents/residency.d.ts.map +1 -0
- package/dist/documents/residency.js +93 -0
- package/dist/documents/residency.js.map +1 -0
- package/dist/documents/slot.d.ts +109 -0
- package/dist/documents/slot.d.ts.map +1 -0
- package/dist/documents/slot.js +181 -0
- package/dist/documents/slot.js.map +1 -0
- package/dist/documents/transaction.d.ts +143 -0
- package/dist/documents/transaction.d.ts.map +1 -0
- package/dist/documents/transaction.js +442 -0
- package/dist/documents/transaction.js.map +1 -0
- package/dist/host/activity.d.ts +31 -0
- package/dist/host/activity.d.ts.map +1 -0
- package/dist/host/activity.js +40 -0
- package/dist/host/activity.js.map +1 -0
- package/dist/host/adapted.d.ts +49 -0
- package/dist/host/adapted.d.ts.map +1 -0
- package/dist/host/adapted.js +214 -0
- package/dist/host/adapted.js.map +1 -0
- package/dist/host/attempt.d.ts +308 -0
- package/dist/host/attempt.d.ts.map +1 -0
- package/dist/host/attempt.js +1199 -0
- package/dist/host/attempt.js.map +1 -0
- package/dist/host/backoff.d.ts +29 -0
- package/dist/host/backoff.d.ts.map +1 -0
- package/dist/host/backoff.js +69 -0
- package/dist/host/backoff.js.map +1 -0
- package/dist/host/ctx.d.ts +94 -0
- package/dist/host/ctx.d.ts.map +1 -0
- package/dist/host/ctx.js +200 -0
- package/dist/host/ctx.js.map +1 -0
- package/dist/host/deadline.d.ts +12 -0
- package/dist/host/deadline.d.ts.map +1 -0
- package/dist/host/deadline.js +40 -0
- package/dist/host/deadline.js.map +1 -0
- package/dist/host/dependencies.d.ts +65 -0
- package/dist/host/dependencies.d.ts.map +1 -0
- package/dist/host/dependencies.js +115 -0
- package/dist/host/dependencies.js.map +1 -0
- package/dist/host/destination.d.ts +48 -0
- package/dist/host/destination.d.ts.map +1 -0
- package/dist/host/destination.js +101 -0
- package/dist/host/destination.js.map +1 -0
- package/dist/host/facet.d.ts +84 -0
- package/dist/host/facet.d.ts.map +1 -0
- package/dist/host/facet.js +55 -0
- package/dist/host/facet.js.map +1 -0
- package/dist/host/follow.d.ts +52 -0
- package/dist/host/follow.d.ts.map +1 -0
- package/dist/host/follow.js +207 -0
- package/dist/host/follow.js.map +1 -0
- package/dist/host/host.d.ts +571 -0
- package/dist/host/host.d.ts.map +1 -0
- package/dist/host/host.js +1318 -0
- package/dist/host/host.js.map +1 -0
- package/dist/host/index.d.ts +17 -0
- package/dist/host/index.d.ts.map +1 -0
- package/dist/host/index.js +6 -0
- package/dist/host/index.js.map +1 -0
- package/dist/host/internal.d.ts +11 -0
- package/dist/host/internal.d.ts.map +1 -0
- package/dist/host/internal.js +9 -0
- package/dist/host/internal.js.map +1 -0
- package/dist/host/members.d.ts +50 -0
- package/dist/host/members.d.ts.map +1 -0
- package/dist/host/members.js +107 -0
- package/dist/host/members.js.map +1 -0
- package/dist/host/native.d.ts +64 -0
- package/dist/host/native.d.ts.map +1 -0
- package/dist/host/native.js +126 -0
- package/dist/host/native.js.map +1 -0
- package/dist/host/object.d.ts +331 -0
- package/dist/host/object.d.ts.map +1 -0
- package/dist/host/object.js +1296 -0
- package/dist/host/object.js.map +1 -0
- package/dist/host/old-work.d.ts +34 -0
- package/dist/host/old-work.d.ts.map +1 -0
- package/dist/host/old-work.js +52 -0
- package/dist/host/old-work.js.map +1 -0
- package/dist/host/parked.d.ts +23 -0
- package/dist/host/parked.d.ts.map +1 -0
- package/dist/host/parked.js +79 -0
- package/dist/host/parked.js.map +1 -0
- package/dist/host/presence.d.ts +34 -0
- package/dist/host/presence.d.ts.map +1 -0
- package/dist/host/presence.js +117 -0
- package/dist/host/presence.js.map +1 -0
- package/dist/host/readiness.d.ts +27 -0
- package/dist/host/readiness.d.ts.map +1 -0
- package/dist/host/readiness.js +134 -0
- package/dist/host/readiness.js.map +1 -0
- package/dist/host/ref-state.d.ts +53 -0
- package/dist/host/ref-state.d.ts.map +1 -0
- package/dist/host/ref-state.js +83 -0
- package/dist/host/ref-state.js.map +1 -0
- package/dist/host/reference-keys.d.ts +36 -0
- package/dist/host/reference-keys.d.ts.map +1 -0
- package/dist/host/reference-keys.js +168 -0
- package/dist/host/reference-keys.js.map +1 -0
- package/dist/host/reference-source.d.ts +65 -0
- package/dist/host/reference-source.d.ts.map +1 -0
- package/dist/host/reference-source.js +285 -0
- package/dist/host/reference-source.js.map +1 -0
- package/dist/host/reference.d.ts +321 -0
- package/dist/host/reference.d.ts.map +1 -0
- package/dist/host/reference.js +797 -0
- package/dist/host/reference.js.map +1 -0
- package/dist/host/reload-cycle.d.ts +16 -0
- package/dist/host/reload-cycle.d.ts.map +1 -0
- package/dist/host/reload-cycle.js +81 -0
- package/dist/host/reload-cycle.js.map +1 -0
- package/dist/host/retry-on.d.ts +28 -0
- package/dist/host/retry-on.d.ts.map +1 -0
- package/dist/host/retry-on.js +52 -0
- package/dist/host/retry-on.js.map +1 -0
- package/dist/host/revocation.d.ts +16 -0
- package/dist/host/revocation.d.ts.map +1 -0
- package/dist/host/revocation.js +27 -0
- package/dist/host/revocation.js.map +1 -0
- package/dist/host/root.d.ts +37 -0
- package/dist/host/root.d.ts.map +1 -0
- package/dist/host/root.js +68 -0
- package/dist/host/root.js.map +1 -0
- package/dist/host/route.d.ts +64 -0
- package/dist/host/route.d.ts.map +1 -0
- package/dist/host/route.js +227 -0
- package/dist/host/route.js.map +1 -0
- package/dist/host/routines.d.ts +78 -0
- package/dist/host/routines.d.ts.map +1 -0
- package/dist/host/routines.js +398 -0
- package/dist/host/routines.js.map +1 -0
- package/dist/host/sleep.d.ts +9 -0
- package/dist/host/sleep.d.ts.map +1 -0
- package/dist/host/sleep.js +40 -0
- package/dist/host/sleep.js.map +1 -0
- package/dist/host/staging.d.ts +94 -0
- package/dist/host/staging.d.ts.map +1 -0
- package/dist/host/staging.js +304 -0
- package/dist/host/staging.js.map +1 -0
- package/dist/host/unbound-clock.d.ts +23 -0
- package/dist/host/unbound-clock.d.ts.map +1 -0
- package/dist/host/unbound-clock.js +58 -0
- package/dist/host/unbound-clock.js.map +1 -0
- package/dist/host/unbound.d.ts +37 -0
- package/dist/host/unbound.d.ts.map +1 -0
- package/dist/host/unbound.js +88 -0
- package/dist/host/unbound.js.map +1 -0
- package/dist/host/uuid.d.ts +3 -0
- package/dist/host/uuid.d.ts.map +1 -0
- package/dist/host/uuid.js +38 -0
- package/dist/host/uuid.js.map +1 -0
- package/dist/index.d.ts +29 -18
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +20 -9
- package/dist/index.js.map +1 -1
- package/dist/jobs/definition.d.ts +96 -0
- package/dist/jobs/definition.d.ts.map +1 -0
- package/dist/jobs/definition.js +83 -0
- package/dist/jobs/definition.js.map +1 -0
- package/dist/jobs/index.d.ts +5 -0
- package/dist/jobs/index.d.ts.map +1 -0
- package/dist/jobs/index.js +3 -0
- package/dist/jobs/index.js.map +1 -0
- package/dist/jobs/internal.d.ts +3 -0
- package/dist/jobs/internal.d.ts.map +1 -0
- package/dist/jobs/internal.js +4 -0
- package/dist/jobs/internal.js.map +1 -0
- package/dist/jobs/job.d.ts +149 -0
- package/dist/jobs/job.d.ts.map +1 -0
- package/dist/jobs/job.js +387 -0
- package/dist/jobs/job.js.map +1 -0
- package/dist/jobs/persisted.d.ts +38 -0
- package/dist/jobs/persisted.d.ts.map +1 -0
- package/dist/jobs/persisted.js +95 -0
- package/dist/jobs/persisted.js.map +1 -0
- package/dist/jobs/records.d.ts +231 -0
- package/dist/jobs/records.d.ts.map +1 -0
- package/dist/jobs/records.js +871 -0
- package/dist/jobs/records.js.map +1 -0
- package/dist/jobs/run-states.d.ts +69 -0
- package/dist/jobs/run-states.d.ts.map +1 -0
- package/dist/jobs/run-states.js +228 -0
- package/dist/jobs/run-states.js.map +1 -0
- package/dist/jobs/run.d.ts +117 -0
- package/dist/jobs/run.d.ts.map +1 -0
- package/dist/jobs/run.js +204 -0
- package/dist/jobs/run.js.map +1 -0
- package/dist/jobs/running.d.ts +44 -0
- package/dist/jobs/running.d.ts.map +1 -0
- package/dist/jobs/running.js +117 -0
- package/dist/jobs/running.js.map +1 -0
- package/dist/jobs/stored.d.ts +63 -0
- package/dist/jobs/stored.d.ts.map +1 -0
- package/dist/jobs/stored.js +55 -0
- package/dist/jobs/stored.js.map +1 -0
- package/dist/link/binary.d.ts +4 -0
- package/dist/link/binary.d.ts.map +1 -0
- package/dist/link/binary.js +544 -0
- package/dist/link/binary.js.map +1 -0
- package/dist/link/channel.d.ts +68 -0
- package/dist/link/channel.d.ts.map +1 -0
- package/dist/link/channel.js +215 -0
- package/dist/link/channel.js.map +1 -0
- package/dist/link/errors.d.ts +7 -0
- package/dist/link/errors.d.ts.map +1 -0
- package/dist/link/errors.js +21 -0
- package/dist/link/errors.js.map +1 -0
- package/dist/link/index.d.ts +8 -0
- package/dist/link/index.d.ts.map +1 -0
- package/dist/link/index.js +8 -0
- package/dist/link/index.js.map +1 -0
- package/dist/link/internal.d.ts +9 -0
- package/dist/link/internal.d.ts.map +1 -0
- package/dist/link/internal.js +10 -0
- package/dist/link/internal.js.map +1 -0
- package/dist/link/ipc.d.ts +22 -0
- package/dist/link/ipc.d.ts.map +1 -0
- package/dist/link/ipc.js +64 -0
- package/dist/link/ipc.js.map +1 -0
- package/dist/link/link.d.ts +34 -0
- package/dist/link/link.d.ts.map +1 -0
- package/dist/link/link.js +87 -0
- package/dist/link/link.js.map +1 -0
- package/dist/link/message.d.ts +262 -0
- package/dist/link/message.d.ts.map +1 -0
- package/dist/link/message.js +156 -0
- package/dist/link/message.js.map +1 -0
- package/dist/link/part.d.ts +80 -0
- package/dist/link/part.d.ts.map +1 -0
- package/dist/link/part.js +165 -0
- package/dist/link/part.js.map +1 -0
- package/dist/link/text.d.ts +6 -0
- package/dist/link/text.d.ts.map +1 -0
- package/dist/link/text.js +355 -0
- package/dist/link/text.js.map +1 -0
- package/dist/link/values.d.ts +40 -0
- package/dist/link/values.d.ts.map +1 -0
- package/dist/link/values.js +121 -0
- package/dist/link/values.js.map +1 -0
- package/dist/link/websocket.d.ts +26 -0
- package/dist/link/websocket.d.ts.map +1 -0
- package/dist/link/websocket.js +91 -0
- package/dist/link/websocket.js.map +1 -0
- package/dist/node/app/app.d.ts +269 -0
- package/dist/node/app/app.d.ts.map +1 -0
- package/dist/node/app/app.js +513 -0
- package/dist/node/app/app.js.map +1 -0
- package/dist/node/app/archive.d.ts +37 -0
- package/dist/node/app/archive.d.ts.map +1 -0
- package/dist/node/app/archive.js +204 -0
- package/dist/node/app/archive.js.map +1 -0
- package/dist/node/app/blobs.d.ts +23 -0
- package/dist/node/app/blobs.d.ts.map +1 -0
- package/dist/node/app/blobs.js +64 -0
- package/dist/node/app/blobs.js.map +1 -0
- package/dist/node/app/data.d.ts +35 -0
- package/dist/node/app/data.d.ts.map +1 -0
- package/dist/node/app/data.js +44 -0
- package/dist/node/app/data.js.map +1 -0
- package/dist/node/app/ephemeral-sessions.d.ts +20 -0
- package/dist/node/app/ephemeral-sessions.d.ts.map +1 -0
- package/dist/node/app/ephemeral-sessions.js +69 -0
- package/dist/node/app/ephemeral-sessions.js.map +1 -0
- package/dist/node/app/ephemeral.d.ts +11 -0
- package/dist/node/app/ephemeral.d.ts.map +1 -0
- package/dist/node/app/ephemeral.js +34 -0
- package/dist/node/app/ephemeral.js.map +1 -0
- package/dist/node/app/files-copy.d.ts +13 -0
- package/dist/node/app/files-copy.d.ts.map +1 -0
- package/dist/node/app/files-copy.js +86 -0
- package/dist/node/app/files-copy.js.map +1 -0
- package/dist/node/app/files-entry.d.ts +4 -0
- package/dist/node/app/files-entry.d.ts.map +1 -0
- package/dist/node/app/files-entry.js +7 -0
- package/dist/node/app/files-entry.js.map +1 -0
- package/dist/node/app/files-index.d.ts +180 -0
- package/dist/node/app/files-index.d.ts.map +1 -0
- package/dist/node/app/files-index.js +535 -0
- package/dist/node/app/files-index.js.map +1 -0
- package/dist/node/app/files.d.ts +363 -0
- package/dist/node/app/files.d.ts.map +1 -0
- package/dist/node/app/files.js +368 -0
- package/dist/node/app/files.js.map +1 -0
- package/dist/node/app/folder-views.d.ts +21 -0
- package/dist/node/app/folder-views.d.ts.map +1 -0
- package/dist/node/app/folder-views.js +55 -0
- package/dist/node/app/folder-views.js.map +1 -0
- package/dist/node/app/index.d.ts +12 -0
- package/dist/node/app/index.d.ts.map +1 -0
- package/dist/node/app/index.js +15 -0
- package/dist/node/app/index.js.map +1 -0
- package/dist/node/app/info.d.ts +66 -0
- package/dist/node/app/info.d.ts.map +1 -0
- package/dist/node/app/info.js +37 -0
- package/dist/node/app/info.js.map +1 -0
- package/dist/node/app/invite.d.ts +5 -0
- package/dist/node/app/invite.d.ts.map +1 -0
- package/dist/node/app/invite.js +64 -0
- package/dist/node/app/invite.js.map +1 -0
- package/dist/node/app/layout.d.ts +36 -0
- package/dist/node/app/layout.d.ts.map +1 -0
- package/dist/node/app/layout.js +87 -0
- package/dist/node/app/layout.js.map +1 -0
- package/dist/node/app/owner.d.ts +31 -0
- package/dist/node/app/owner.d.ts.map +1 -0
- package/dist/node/app/owner.js +104 -0
- package/dist/node/app/owner.js.map +1 -0
- package/dist/node/app/pairing.d.ts +55 -0
- package/dist/node/app/pairing.d.ts.map +1 -0
- package/dist/node/app/pairing.js +183 -0
- package/dist/node/app/pairing.js.map +1 -0
- package/dist/node/app/secrets.d.ts +16 -0
- package/dist/node/app/secrets.d.ts.map +1 -0
- package/dist/node/app/secrets.js +72 -0
- package/dist/node/app/secrets.js.map +1 -0
- package/dist/node/app/sessions.d.ts +72 -0
- package/dist/node/app/sessions.d.ts.map +1 -0
- package/dist/node/app/sessions.js +222 -0
- package/dist/node/app/sessions.js.map +1 -0
- package/dist/node/app/tar.d.ts +24 -0
- package/dist/node/app/tar.d.ts.map +1 -0
- package/dist/node/app/tar.js +167 -0
- package/dist/node/app/tar.js.map +1 -0
- package/dist/node/app/uploads.d.ts +37 -0
- package/dist/node/app/uploads.d.ts.map +1 -0
- package/dist/node/app/uploads.js +157 -0
- package/dist/node/app/uploads.js.map +1 -0
- package/dist/node/app/users.d.ts +37 -0
- package/dist/node/app/users.d.ts.map +1 -0
- package/dist/node/app/users.js +62 -0
- package/dist/node/app/users.js.map +1 -0
- package/dist/node/app/worker.d.ts +18 -0
- package/dist/node/app/worker.d.ts.map +1 -0
- package/dist/node/app/worker.js +84 -0
- package/dist/node/app/worker.js.map +1 -0
- package/dist/node/compression.d.ts +7 -0
- package/dist/node/compression.d.ts.map +1 -0
- package/dist/node/compression.js +25 -0
- package/dist/node/compression.js.map +1 -0
- package/dist/node/http/admission.d.ts +63 -0
- package/dist/node/http/admission.d.ts.map +1 -0
- package/dist/node/http/admission.js +134 -0
- package/dist/node/http/admission.js.map +1 -0
- package/dist/node/http/authenticate.d.ts +21 -0
- package/dist/node/http/authenticate.d.ts.map +1 -0
- package/dist/node/http/authenticate.js +34 -0
- package/dist/node/http/authenticate.js.map +1 -0
- package/dist/node/http/cookies.d.ts +32 -0
- package/dist/node/http/cookies.d.ts.map +1 -0
- package/dist/node/http/cookies.js +70 -0
- package/dist/node/http/cookies.js.map +1 -0
- package/dist/node/http/file.d.ts +23 -0
- package/dist/node/http/file.d.ts.map +1 -0
- package/dist/node/http/file.js +94 -0
- package/dist/node/http/file.js.map +1 -0
- package/dist/node/http/headers.d.ts +37 -0
- package/dist/node/http/headers.d.ts.map +1 -0
- package/dist/node/http/headers.js +136 -0
- package/dist/node/http/headers.js.map +1 -0
- package/dist/node/http/http.d.ts +111 -0
- package/dist/node/http/http.d.ts.map +1 -0
- package/dist/node/http/http.js +524 -0
- package/dist/node/http/http.js.map +1 -0
- package/dist/node/http/incoming.d.ts +19 -0
- package/dist/node/http/incoming.d.ts.map +1 -0
- package/dist/node/http/incoming.js +31 -0
- package/dist/node/http/incoming.js.map +1 -0
- package/dist/node/http/index.d.ts +11 -0
- package/dist/node/http/index.d.ts.map +1 -0
- package/dist/node/http/index.js +12 -0
- package/dist/node/http/index.js.map +1 -0
- package/dist/node/http/node.d.ts +78 -0
- package/dist/node/http/node.d.ts.map +1 -0
- package/dist/node/http/node.js +291 -0
- package/dist/node/http/node.js.map +1 -0
- package/dist/node/http/request.d.ts +60 -0
- package/dist/node/http/request.d.ts.map +1 -0
- package/dist/node/http/request.js +118 -0
- package/dist/node/http/request.js.map +1 -0
- package/dist/node/http/response.d.ts +63 -0
- package/dist/node/http/response.d.ts.map +1 -0
- package/dist/node/http/response.js +202 -0
- package/dist/node/http/response.js.map +1 -0
- package/dist/node/http/router.d.ts +132 -0
- package/dist/node/http/router.d.ts.map +1 -0
- package/dist/node/http/router.js +267 -0
- package/dist/node/http/router.js.map +1 -0
- package/dist/node/http/upgrades.d.ts +61 -0
- package/dist/node/http/upgrades.d.ts.map +1 -0
- package/dist/node/http/upgrades.js +192 -0
- package/dist/node/http/upgrades.js.map +1 -0
- package/dist/node/plugins/base-inputs.d.ts +14 -0
- package/dist/node/plugins/base-inputs.d.ts.map +1 -0
- package/dist/node/plugins/base-inputs.js +33 -0
- package/dist/node/plugins/base-inputs.js.map +1 -0
- package/dist/node/plugins/build.d.ts +77 -0
- package/dist/node/plugins/build.d.ts.map +1 -0
- package/dist/node/plugins/build.js +576 -0
- package/dist/node/plugins/build.js.map +1 -0
- package/dist/node/plugins/css-modules.d.ts +13 -0
- package/dist/node/plugins/css-modules.d.ts.map +1 -0
- package/dist/node/plugins/css-modules.js +58 -0
- package/dist/node/plugins/css-modules.js.map +1 -0
- package/dist/node/plugins/discover.d.ts +67 -0
- package/dist/node/plugins/discover.d.ts.map +1 -0
- package/dist/node/plugins/discover.js +369 -0
- package/dist/node/plugins/discover.js.map +1 -0
- package/dist/node/plugins/evaluate.d.ts +33 -0
- package/dist/node/plugins/evaluate.d.ts.map +1 -0
- package/dist/node/plugins/evaluate.js +121 -0
- package/dist/node/plugins/evaluate.js.map +1 -0
- package/dist/node/plugins/index.d.ts +11 -0
- package/dist/node/plugins/index.d.ts.map +1 -0
- package/dist/node/plugins/index.js +13 -0
- package/dist/node/plugins/index.js.map +1 -0
- package/dist/node/plugins/install.d.ts +38 -0
- package/dist/node/plugins/install.d.ts.map +1 -0
- package/dist/node/plugins/install.js +213 -0
- package/dist/node/plugins/install.js.map +1 -0
- package/dist/node/plugins/plugins.d.ts +162 -0
- package/dist/node/plugins/plugins.d.ts.map +1 -0
- package/dist/node/plugins/plugins.js +244 -0
- package/dist/node/plugins/plugins.js.map +1 -0
- package/dist/node/plugins/runtime.d.ts +57 -0
- package/dist/node/plugins/runtime.d.ts.map +1 -0
- package/dist/node/plugins/runtime.js +92 -0
- package/dist/node/plugins/runtime.js.map +1 -0
- package/dist/node/plugins/stack.d.ts +16 -0
- package/dist/node/plugins/stack.d.ts.map +1 -0
- package/dist/node/plugins/stack.js +61 -0
- package/dist/node/plugins/stack.js.map +1 -0
- package/dist/node/plugins/testing.d.ts +58 -0
- package/dist/node/plugins/testing.d.ts.map +1 -0
- package/dist/node/plugins/testing.js +210 -0
- package/dist/node/plugins/testing.js.map +1 -0
- package/dist/node/plugins/watcher.d.ts +69 -0
- package/dist/node/plugins/watcher.d.ts.map +1 -0
- package/dist/node/plugins/watcher.js +622 -0
- package/dist/node/plugins/watcher.js.map +1 -0
- package/dist/node/surfaces/bundle.d.ts +31 -0
- package/dist/node/surfaces/bundle.d.ts.map +1 -0
- package/dist/node/surfaces/bundle.js +118 -0
- package/dist/node/surfaces/bundle.js.map +1 -0
- package/dist/node/surfaces/current.d.ts +17 -0
- package/dist/node/surfaces/current.d.ts.map +1 -0
- package/dist/node/surfaces/current.js +54 -0
- package/dist/node/surfaces/current.js.map +1 -0
- package/dist/node/surfaces/index.d.ts +6 -0
- package/dist/node/surfaces/index.d.ts.map +1 -0
- package/dist/node/surfaces/index.js +6 -0
- package/dist/node/surfaces/index.js.map +1 -0
- package/dist/node/surfaces/published.d.ts +27 -0
- package/dist/node/surfaces/published.d.ts.map +1 -0
- package/dist/node/surfaces/published.js +142 -0
- package/dist/node/surfaces/published.js.map +1 -0
- package/dist/node/surfaces/served.d.ts +15 -0
- package/dist/node/surfaces/served.d.ts.map +1 -0
- package/dist/node/surfaces/served.js +42 -0
- package/dist/node/surfaces/served.js.map +1 -0
- package/dist/node/surfaces/surface-build.d.ts +53 -0
- package/dist/node/surfaces/surface-build.d.ts.map +1 -0
- package/dist/node/surfaces/surface-build.js +105 -0
- package/dist/node/surfaces/surface-build.js.map +1 -0
- package/dist/node/surfaces/tui.d.ts +40 -0
- package/dist/node/surfaces/tui.d.ts.map +1 -0
- package/dist/node/surfaces/tui.js +55 -0
- package/dist/node/surfaces/tui.js.map +1 -0
- package/dist/node/surfaces/web.d.ts +56 -0
- package/dist/node/surfaces/web.d.ts.map +1 -0
- package/dist/node/surfaces/web.js +108 -0
- package/dist/node/surfaces/web.js.map +1 -0
- package/dist/node/tui/actions.d.ts +49 -0
- package/dist/node/tui/actions.d.ts.map +1 -0
- package/dist/node/tui/actions.js +195 -0
- package/dist/node/tui/actions.js.map +1 -0
- package/dist/node/tui/credentials.d.ts +17 -0
- package/dist/node/tui/credentials.d.ts.map +1 -0
- package/dist/node/tui/credentials.js +54 -0
- package/dist/node/tui/credentials.js.map +1 -0
- package/dist/node/tui/filter.d.ts +5 -0
- package/dist/node/tui/filter.d.ts.map +1 -0
- package/dist/node/tui/filter.js +79 -0
- package/dist/node/tui/filter.js.map +1 -0
- package/dist/node/tui/index.d.ts +6 -0
- package/dist/node/tui/index.d.ts.map +1 -0
- package/dist/node/tui/index.js +6 -0
- package/dist/node/tui/index.js.map +1 -0
- package/dist/node/tui/launcher.d.ts +40 -0
- package/dist/node/tui/launcher.d.ts.map +1 -0
- package/dist/node/tui/launcher.js +439 -0
- package/dist/node/tui/launcher.js.map +1 -0
- package/dist/node/tui/pipe.d.ts +18 -0
- package/dist/node/tui/pipe.d.ts.map +1 -0
- package/dist/node/tui/pipe.js +134 -0
- package/dist/node/tui/pipe.js.map +1 -0
- package/dist/node/tui/sandbox.d.ts +54 -0
- package/dist/node/tui/sandbox.d.ts.map +1 -0
- package/dist/node/tui/sandbox.js +431 -0
- package/dist/node/tui/sandbox.js.map +1 -0
- package/dist/node/workers/base.d.ts +30 -0
- package/dist/node/workers/base.d.ts.map +1 -0
- package/dist/node/workers/base.js +255 -0
- package/dist/node/workers/base.js.map +1 -0
- package/dist/node/workers/child.d.ts +4 -0
- package/dist/node/workers/child.d.ts.map +1 -0
- package/dist/node/workers/child.js +6 -0
- package/dist/node/workers/child.js.map +1 -0
- package/dist/node/workers/control.d.ts +83 -0
- package/dist/node/workers/control.d.ts.map +1 -0
- package/dist/node/workers/control.js +77 -0
- package/dist/node/workers/control.js.map +1 -0
- package/dist/node/workers/index.d.ts +4 -0
- package/dist/node/workers/index.d.ts.map +1 -0
- package/dist/node/workers/index.js +7 -0
- package/dist/node/workers/index.js.map +1 -0
- package/dist/node/workers/lock.d.ts +30 -0
- package/dist/node/workers/lock.d.ts.map +1 -0
- package/dist/node/workers/lock.js +180 -0
- package/dist/node/workers/lock.js.map +1 -0
- package/dist/node/workers/main.d.ts +46 -0
- package/dist/node/workers/main.d.ts.map +1 -0
- package/dist/node/workers/main.js +230 -0
- package/dist/node/workers/main.js.map +1 -0
- package/dist/node/workers/process.d.ts +42 -0
- package/dist/node/workers/process.d.ts.map +1 -0
- package/dist/node/workers/process.js +125 -0
- package/dist/node/workers/process.js.map +1 -0
- package/dist/node/workers/workers.d.ts +122 -0
- package/dist/node/workers/workers.d.ts.map +1 -0
- package/dist/node/workers/workers.js +677 -0
- package/dist/node/workers/workers.js.map +1 -0
- package/dist/output.d.ts +1 -1
- package/dist/output.d.ts.map +1 -1
- package/dist/output.js +4 -2
- package/dist/output.js.map +1 -1
- package/dist/react/hooks.d.ts +43 -0
- package/dist/react/hooks.d.ts.map +1 -0
- package/dist/react/hooks.js +82 -0
- package/dist/react/hooks.js.map +1 -0
- package/dist/react/index.d.ts +3 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +4 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/stores.d.ts +9 -0
- package/dist/react/stores.d.ts.map +1 -0
- package/dist/react/stores.js +37 -0
- package/dist/react/stores.js.map +1 -0
- package/dist/registries/contribution.d.ts +50 -0
- package/dist/registries/contribution.d.ts.map +1 -0
- package/dist/registries/contribution.js +129 -0
- package/dist/registries/contribution.js.map +1 -0
- package/dist/registries/entries.d.ts +18 -0
- package/dist/registries/entries.d.ts.map +1 -0
- package/dist/registries/entries.js +42 -0
- package/dist/registries/entries.js.map +1 -0
- package/dist/registries/index.d.ts +3 -0
- package/dist/registries/index.d.ts.map +1 -0
- package/dist/registries/index.js +5 -0
- package/dist/registries/index.js.map +1 -0
- package/dist/registries/internal.d.ts +4 -0
- package/dist/registries/internal.d.ts.map +1 -0
- package/dist/registries/internal.js +5 -0
- package/dist/registries/internal.js.map +1 -0
- package/dist/registries/record.d.ts +115 -0
- package/dist/registries/record.d.ts.map +1 -0
- package/dist/registries/record.js +283 -0
- package/dist/registries/record.js.map +1 -0
- package/dist/registries/registry.d.ts +74 -0
- package/dist/registries/registry.d.ts.map +1 -0
- package/dist/registries/registry.js +14 -0
- package/dist/registries/registry.js.map +1 -0
- package/dist/registries/value.d.ts +48 -0
- package/dist/registries/value.d.ts.map +1 -0
- package/dist/registries/value.js +224 -0
- package/dist/registries/value.js.map +1 -0
- package/dist/remote/calls.d.ts +25 -0
- package/dist/remote/calls.d.ts.map +1 -0
- package/dist/remote/calls.js +62 -0
- package/dist/remote/calls.js.map +1 -0
- package/dist/remote/consumer.d.ts +43 -0
- package/dist/remote/consumer.d.ts.map +1 -0
- package/dist/remote/consumer.js +350 -0
- package/dist/remote/consumer.js.map +1 -0
- package/dist/remote/hold.d.ts +141 -0
- package/dist/remote/hold.d.ts.map +1 -0
- package/dist/remote/hold.js +579 -0
- package/dist/remote/hold.js.map +1 -0
- package/dist/remote/host-link.d.ts +77 -0
- package/dist/remote/host-link.d.ts.map +1 -0
- package/dist/remote/host-link.js +184 -0
- package/dist/remote/host-link.js.map +1 -0
- package/dist/remote/internal.d.ts +6 -0
- package/dist/remote/internal.d.ts.map +1 -0
- package/dist/remote/internal.js +6 -0
- package/dist/remote/internal.js.map +1 -0
- package/dist/remote/path.d.ts +46 -0
- package/dist/remote/path.d.ts.map +1 -0
- package/dist/remote/path.js +73 -0
- package/dist/remote/path.js.map +1 -0
- package/dist/remote/provider.d.ts +89 -0
- package/dist/remote/provider.d.ts.map +1 -0
- package/dist/remote/provider.js +597 -0
- package/dist/remote/provider.js.map +1 -0
- package/dist/remote/relay.d.ts +69 -0
- package/dist/remote/relay.d.ts.map +1 -0
- package/dist/remote/relay.js +219 -0
- package/dist/remote/relay.js.map +1 -0
- package/dist/remote/remote-object.d.ts +138 -0
- package/dist/remote/remote-object.d.ts.map +1 -0
- package/dist/remote/remote-object.js +492 -0
- package/dist/remote/remote-object.js.map +1 -0
- package/dist/remote/replica.d.ts +59 -0
- package/dist/remote/replica.d.ts.map +1 -0
- package/dist/remote/replica.js +125 -0
- package/dist/remote/replica.js.map +1 -0
- package/dist/sqlite/cloudflare.d.ts +2 -0
- package/dist/sqlite/cloudflare.d.ts.map +1 -1
- package/dist/sqlite/cloudflare.js +10 -0
- package/dist/sqlite/cloudflare.js.map +1 -1
- package/dist/sqlite/database.d.ts +5 -2
- package/dist/sqlite/database.d.ts.map +1 -1
- package/dist/sqlite/database.js.map +1 -1
- package/dist/sqlite/node.d.ts +13 -2
- package/dist/sqlite/node.d.ts.map +1 -1
- package/dist/sqlite/node.js +31 -8
- package/dist/sqlite/node.js.map +1 -1
- package/dist/state/batch.d.ts +64 -0
- package/dist/state/batch.d.ts.map +1 -0
- package/dist/state/batch.js +164 -0
- package/dist/state/batch.js.map +1 -0
- package/dist/state/derive.d.ts +52 -0
- package/dist/state/derive.d.ts.map +1 -0
- package/dist/state/derive.js +182 -0
- package/dist/state/derive.js.map +1 -0
- package/dist/state/index.d.ts +6 -0
- package/dist/state/index.d.ts.map +1 -0
- package/dist/state/index.js +4 -0
- package/dist/state/index.js.map +1 -0
- package/dist/state/internal.d.ts +6 -0
- package/dist/state/internal.d.ts.map +1 -0
- package/dist/state/internal.js +8 -0
- package/dist/state/internal.js.map +1 -0
- package/dist/state/native-source.d.ts +106 -0
- package/dist/state/native-source.d.ts.map +1 -0
- package/dist/state/native-source.js +240 -0
- package/dist/state/native-source.js.map +1 -0
- package/dist/state/watchable.d.ts +114 -0
- package/dist/state/watchable.d.ts.map +1 -0
- package/dist/state/watchable.js +156 -0
- package/dist/state/watchable.js.map +1 -0
- package/dist/state/writable.d.ts +32 -0
- package/dist/state/writable.d.ts.map +1 -0
- package/dist/state/writable.js +49 -0
- package/dist/state/writable.js.map +1 -0
- package/dist/store/adapter.d.ts +67 -0
- package/dist/store/adapter.d.ts.map +1 -0
- package/dist/store/adapter.js +118 -0
- package/dist/store/adapter.js.map +1 -0
- package/dist/store/allocator.d.ts +17 -0
- package/dist/store/allocator.d.ts.map +1 -0
- package/dist/store/allocator.js +30 -0
- package/dist/store/allocator.js.map +1 -0
- package/dist/store/applier.d.ts +8 -0
- package/dist/store/applier.d.ts.map +1 -0
- package/dist/store/applier.js +375 -0
- package/dist/store/applier.js.map +1 -0
- package/dist/store/apply-batch.d.ts +12 -0
- package/dist/store/apply-batch.d.ts.map +1 -0
- package/dist/store/apply-batch.js +83 -0
- package/dist/store/apply-batch.js.map +1 -0
- package/dist/store/archive.d.ts +32 -0
- package/dist/store/archive.d.ts.map +1 -0
- package/dist/store/archive.js +130 -0
- package/dist/store/archive.js.map +1 -0
- package/dist/store/backend.d.ts +10 -0
- package/dist/store/backend.d.ts.map +1 -0
- package/dist/store/backend.js +15 -0
- package/dist/store/backend.js.map +1 -0
- package/dist/store/catalog.d.ts +24 -0
- package/dist/store/catalog.d.ts.map +1 -0
- package/dist/store/catalog.js +17 -0
- package/dist/store/catalog.js.map +1 -0
- package/dist/store/claims.d.ts +23 -0
- package/dist/store/claims.d.ts.map +1 -0
- package/dist/store/claims.js +65 -0
- package/dist/store/claims.js.map +1 -0
- package/dist/store/columns.d.ts +77 -0
- package/dist/store/columns.d.ts.map +1 -0
- package/dist/store/columns.js +77 -0
- package/dist/store/columns.js.map +1 -0
- package/dist/store/engine.d.ts +176 -0
- package/dist/store/engine.d.ts.map +1 -0
- package/dist/store/engine.js +283 -0
- package/dist/store/engine.js.map +1 -0
- package/dist/store/evaluate.d.ts +17 -0
- package/dist/store/evaluate.d.ts.map +1 -0
- package/dist/store/evaluate.js +128 -0
- package/dist/store/evaluate.js.map +1 -0
- package/dist/store/export.d.ts +17 -0
- package/dist/store/export.d.ts.map +1 -0
- package/dist/store/export.js +200 -0
- package/dist/store/export.js.map +1 -0
- package/dist/store/expression.d.ts +150 -0
- package/dist/store/expression.d.ts.map +1 -0
- package/dist/store/expression.js +268 -0
- package/dist/store/expression.js.map +1 -0
- package/dist/store/import.d.ts +10 -0
- package/dist/store/import.d.ts.map +1 -0
- package/dist/store/import.js +276 -0
- package/dist/store/import.js.map +1 -0
- package/dist/store/index.d.ts +16 -0
- package/dist/store/index.d.ts.map +1 -0
- package/dist/store/index.js +13 -0
- package/dist/store/index.js.map +1 -0
- package/dist/store/json-column.d.ts +33 -0
- package/dist/store/json-column.d.ts.map +1 -0
- package/dist/store/json-column.js +62 -0
- package/dist/store/json-column.js.map +1 -0
- package/dist/store/jsonl.d.ts +9 -0
- package/dist/store/jsonl.d.ts.map +1 -0
- package/dist/store/jsonl.js +61 -0
- package/dist/store/jsonl.js.map +1 -0
- package/dist/store/live-query.d.ts +108 -0
- package/dist/store/live-query.d.ts.map +1 -0
- package/dist/store/live-query.js +254 -0
- package/dist/store/live-query.js.map +1 -0
- package/dist/store/outbox.d.ts +26 -0
- package/dist/store/outbox.d.ts.map +1 -0
- package/dist/store/outbox.js +80 -0
- package/dist/store/outbox.js.map +1 -0
- package/dist/store/query.d.ts +39 -0
- package/dist/store/query.d.ts.map +1 -0
- package/dist/store/query.js +97 -0
- package/dist/store/query.js.map +1 -0
- package/dist/store/refusal.d.ts +15 -0
- package/dist/store/refusal.d.ts.map +1 -0
- package/dist/store/refusal.js +36 -0
- package/dist/store/refusal.js.map +1 -0
- package/dist/store/rows.d.ts +80 -0
- package/dist/store/rows.d.ts.map +1 -0
- package/dist/store/rows.js +183 -0
- package/dist/store/rows.js.map +1 -0
- package/dist/store/schema.d.ts +25 -0
- package/dist/store/schema.d.ts.map +1 -0
- package/dist/store/schema.js +115 -0
- package/dist/store/schema.js.map +1 -0
- package/dist/store/sql.d.ts +73 -0
- package/dist/store/sql.d.ts.map +1 -0
- package/dist/store/sql.js +234 -0
- package/dist/store/sql.js.map +1 -0
- package/dist/store/step.d.ts +50 -0
- package/dist/store/step.d.ts.map +1 -0
- package/dist/store/step.js +52 -0
- package/dist/store/step.js.map +1 -0
- package/dist/store/store.d.ts +171 -0
- package/dist/store/store.d.ts.map +1 -0
- package/dist/store/store.js +818 -0
- package/dist/store/store.js.map +1 -0
- package/dist/store/table-changes.d.ts +29 -0
- package/dist/store/table-changes.d.ts.map +1 -0
- package/dist/store/table-changes.js +102 -0
- package/dist/store/table-changes.js.map +1 -0
- package/dist/store/table-evolve.d.ts +74 -0
- package/dist/store/table-evolve.d.ts.map +1 -0
- package/dist/store/table-evolve.js +201 -0
- package/dist/store/table-evolve.js.map +1 -0
- package/dist/store/table-handle.d.ts +73 -0
- package/dist/store/table-handle.d.ts.map +1 -0
- package/dist/store/table-handle.js +101 -0
- package/dist/store/table-handle.js.map +1 -0
- package/dist/store/table-history.d.ts +75 -0
- package/dist/store/table-history.d.ts.map +1 -0
- package/dist/store/table-history.js +42 -0
- package/dist/store/table-history.js.map +1 -0
- package/dist/store/table-migration.d.ts +16 -0
- package/dist/store/table-migration.d.ts.map +1 -0
- package/dist/store/table-migration.js +202 -0
- package/dist/store/table-migration.js.map +1 -0
- package/dist/store/table-writes.d.ts +125 -0
- package/dist/store/table-writes.d.ts.map +1 -0
- package/dist/store/table-writes.js +170 -0
- package/dist/store/table-writes.js.map +1 -0
- package/dist/store/table.d.ts +80 -0
- package/dist/store/table.d.ts.map +1 -0
- package/dist/store/table.js +103 -0
- package/dist/store/table.js.map +1 -0
- package/dist/store/text.d.ts +14 -0
- package/dist/store/text.d.ts.map +1 -0
- package/dist/store/text.js +51 -0
- package/dist/store/text.js.map +1 -0
- package/dist/store/writes.d.ts +5 -0
- package/dist/store/writes.d.ts.map +1 -0
- package/dist/store/writes.js +4 -0
- package/dist/store/writes.js.map +1 -0
- package/dist/surfaces/active-language.d.ts +20 -0
- package/dist/surfaces/active-language.d.ts.map +1 -0
- package/dist/surfaces/active-language.js +78 -0
- package/dist/surfaces/active-language.js.map +1 -0
- package/dist/surfaces/active-theme.d.ts +16 -0
- package/dist/surfaces/active-theme.d.ts.map +1 -0
- package/dist/surfaces/active-theme.js +47 -0
- package/dist/surfaces/active-theme.js.map +1 -0
- package/dist/surfaces/client.d.ts +96 -0
- package/dist/surfaces/client.d.ts.map +1 -0
- package/dist/surfaces/client.js +264 -0
- package/dist/surfaces/client.js.map +1 -0
- package/dist/surfaces/connection.d.ts +49 -0
- package/dist/surfaces/connection.d.ts.map +1 -0
- package/dist/surfaces/connection.js +142 -0
- package/dist/surfaces/connection.js.map +1 -0
- package/dist/surfaces/format.d.ts +5 -0
- package/dist/surfaces/format.d.ts.map +1 -0
- package/dist/surfaces/format.js +37 -0
- package/dist/surfaces/format.js.map +1 -0
- package/dist/surfaces/index.d.ts +15 -0
- package/dist/surfaces/index.d.ts.map +1 -0
- package/dist/surfaces/index.js +18 -0
- package/dist/surfaces/index.js.map +1 -0
- package/dist/surfaces/language.d.ts +53 -0
- package/dist/surfaces/language.d.ts.map +1 -0
- package/dist/surfaces/language.js +74 -0
- package/dist/surfaces/language.js.map +1 -0
- package/dist/surfaces/loaded.d.ts +42 -0
- package/dist/surfaces/loaded.d.ts.map +1 -0
- package/dist/surfaces/loaded.js +116 -0
- package/dist/surfaces/loaded.js.map +1 -0
- package/dist/surfaces/locale-choice.d.ts +25 -0
- package/dist/surfaces/locale-choice.d.ts.map +1 -0
- package/dist/surfaces/locale-choice.js +14 -0
- package/dist/surfaces/locale-choice.js.map +1 -0
- package/dist/surfaces/messages.d.ts +67 -0
- package/dist/surfaces/messages.d.ts.map +1 -0
- package/dist/surfaces/messages.js +112 -0
- package/dist/surfaces/messages.js.map +1 -0
- package/dist/surfaces/page-state.d.ts +14 -0
- package/dist/surfaces/page-state.d.ts.map +1 -0
- package/dist/surfaces/page-state.js +43 -0
- package/dist/surfaces/page-state.js.map +1 -0
- package/dist/surfaces/preference.d.ts +32 -0
- package/dist/surfaces/preference.d.ts.map +1 -0
- package/dist/surfaces/preference.js +72 -0
- package/dist/surfaces/preference.js.map +1 -0
- package/dist/surfaces/registered.d.ts +33 -0
- package/dist/surfaces/registered.d.ts.map +1 -0
- package/dist/surfaces/registered.js +51 -0
- package/dist/surfaces/registered.js.map +1 -0
- package/dist/surfaces/scripts.d.ts +84 -0
- package/dist/surfaces/scripts.d.ts.map +1 -0
- package/dist/surfaces/scripts.js +28 -0
- package/dist/surfaces/scripts.js.map +1 -0
- package/dist/surfaces/theme-choice.d.ts +31 -0
- package/dist/surfaces/theme-choice.d.ts.map +1 -0
- package/dist/surfaces/theme-choice.js +18 -0
- package/dist/surfaces/theme-choice.js.map +1 -0
- package/dist/surfaces/themes.d.ts +43 -0
- package/dist/surfaces/themes.d.ts.map +1 -0
- package/dist/surfaces/themes.js +110 -0
- package/dist/surfaces/themes.js.map +1 -0
- package/dist/surfaces/translations.d.ts +29 -0
- package/dist/surfaces/translations.d.ts.map +1 -0
- package/dist/surfaces/translations.js +57 -0
- package/dist/surfaces/translations.js.map +1 -0
- package/dist/sync/batch.d.ts +18 -0
- package/dist/sync/batch.d.ts.map +1 -0
- package/dist/sync/batch.js +125 -0
- package/dist/sync/batch.js.map +1 -0
- package/dist/sync/client.d.ts +166 -0
- package/dist/sync/client.d.ts.map +1 -0
- package/dist/sync/client.js +438 -0
- package/dist/sync/client.js.map +1 -0
- package/dist/sync/files.d.ts +46 -0
- package/dist/sync/files.d.ts.map +1 -0
- package/dist/sync/files.js +13 -0
- package/dist/sync/files.js.map +1 -0
- package/dist/sync/filesystem.d.ts +37 -0
- package/dist/sync/filesystem.d.ts.map +1 -0
- package/dist/sync/filesystem.js +185 -0
- package/dist/sync/filesystem.js.map +1 -0
- package/dist/sync/index.d.ts +8 -0
- package/dist/sync/index.d.ts.map +1 -0
- package/dist/sync/index.js +9 -0
- package/dist/sync/index.js.map +1 -0
- package/dist/sync/lines.d.ts +18 -0
- package/dist/sync/lines.d.ts.map +1 -0
- package/dist/sync/lines.js +46 -0
- package/dist/sync/lines.js.map +1 -0
- package/dist/sync/remote.d.ts +130 -0
- package/dist/sync/remote.d.ts.map +1 -0
- package/dist/sync/remote.js +46 -0
- package/dist/sync/remote.js.map +1 -0
- package/dist/sync/state.d.ts +17 -0
- package/dist/sync/state.d.ts.map +1 -0
- package/dist/sync/state.js +40 -0
- package/dist/sync/state.js.map +1 -0
- package/dist/telemetry-ingest/batch.d.ts +70 -0
- package/dist/telemetry-ingest/batch.d.ts.map +1 -0
- package/dist/telemetry-ingest/batch.js +110 -0
- package/dist/telemetry-ingest/batch.js.map +1 -0
- package/dist/telemetry-ingest/facet.d.ts +21 -0
- package/dist/telemetry-ingest/facet.d.ts.map +1 -0
- package/dist/telemetry-ingest/facet.js +96 -0
- package/dist/telemetry-ingest/facet.js.map +1 -0
- package/dist/telemetry-ingest/index.d.ts +5 -0
- package/dist/telemetry-ingest/index.d.ts.map +1 -0
- package/dist/telemetry-ingest/index.js +8 -0
- package/dist/telemetry-ingest/index.js.map +1 -0
- package/dist/telemetry-ingest/recorder.d.ts +50 -0
- package/dist/telemetry-ingest/recorder.d.ts.map +1 -0
- package/dist/telemetry-ingest/recorder.js +298 -0
- package/dist/telemetry-ingest/recorder.js.map +1 -0
- package/dist/telemetry-ingest/sender.d.ts +14 -0
- package/dist/telemetry-ingest/sender.d.ts.map +1 -0
- package/dist/telemetry-ingest/sender.js +64 -0
- package/dist/telemetry-ingest/sender.js.map +1 -0
- package/dist/telemetry-sqlite/index.d.ts +13 -4
- package/dist/telemetry-sqlite/index.d.ts.map +1 -1
- package/dist/telemetry-sqlite/index.js +81 -241
- package/dist/telemetry-sqlite/index.js.map +1 -1
- package/dist/telemetry-sqlite/node.d.ts +13 -0
- package/dist/telemetry-sqlite/node.d.ts.map +1 -0
- package/dist/telemetry-sqlite/node.js +27 -0
- package/dist/telemetry-sqlite/node.js.map +1 -0
- package/dist/telemetry-sqlite/schema.d.ts +9 -0
- package/dist/telemetry-sqlite/schema.d.ts.map +1 -0
- package/dist/telemetry-sqlite/schema.js +61 -0
- package/dist/telemetry-sqlite/schema.js.map +1 -0
- package/dist/telemetry-sqlite/store.d.ts +3 -0
- package/dist/telemetry-sqlite/store.d.ts.map +1 -1
- package/dist/telemetry-sqlite/store.js +24 -13
- package/dist/telemetry-sqlite/store.js.map +1 -1
- package/dist/telemetry.d.ts +937 -0
- package/dist/telemetry.d.ts.map +1 -0
- package/dist/telemetry.js +470 -0
- package/dist/telemetry.js.map +1 -0
- package/dist/tui/bridge.d.ts +112 -0
- package/dist/tui/bridge.d.ts.map +1 -0
- package/dist/tui/bridge.js +9 -0
- package/dist/tui/bridge.js.map +1 -0
- package/dist/tui/channel.d.ts +44 -0
- package/dist/tui/channel.d.ts.map +1 -0
- package/dist/tui/channel.js +150 -0
- package/dist/tui/channel.js.map +1 -0
- package/dist/tui/frames.d.ts +5 -0
- package/dist/tui/frames.d.ts.map +1 -0
- package/dist/tui/frames.js +52 -0
- package/dist/tui/frames.js.map +1 -0
- package/dist/tui/index.d.ts +7 -0
- package/dist/tui/index.d.ts.map +1 -0
- package/dist/tui/index.js +8 -0
- package/dist/tui/index.js.map +1 -0
- package/dist/tui/runtime.d.ts +46 -0
- package/dist/tui/runtime.d.ts.map +1 -0
- package/dist/tui/runtime.js +101 -0
- package/dist/tui/runtime.js.map +1 -0
- package/dist/tui/scope.d.ts +46 -0
- package/dist/tui/scope.d.ts.map +1 -0
- package/dist/tui/scope.js +141 -0
- package/dist/tui/scope.js.map +1 -0
- package/dist/tui/terminal.d.ts +15 -0
- package/dist/tui/terminal.d.ts.map +1 -0
- package/dist/tui/terminal.js +37 -0
- package/dist/tui/terminal.js.map +1 -0
- package/dist/tui/theme.d.ts +17 -0
- package/dist/tui/theme.d.ts.map +1 -0
- package/dist/tui/theme.js +38 -0
- package/dist/tui/theme.js.map +1 -0
- package/dist/watch.d.ts +194 -0
- package/dist/watch.d.ts.map +1 -0
- package/dist/watch.js +383 -0
- package/dist/watch.js.map +1 -0
- package/dist/web/environment.d.ts +4 -0
- package/dist/web/environment.d.ts.map +1 -0
- package/dist/web/environment.js +37 -0
- package/dist/web/environment.js.map +1 -0
- package/dist/web/index.d.ts +5 -0
- package/dist/web/index.d.ts.map +1 -0
- package/dist/web/index.js +7 -0
- package/dist/web/index.js.map +1 -0
- package/dist/web/language.d.ts +7 -0
- package/dist/web/language.d.ts.map +1 -0
- package/dist/web/language.js +21 -0
- package/dist/web/language.js.map +1 -0
- package/dist/web/page.d.ts +29 -0
- package/dist/web/page.d.ts.map +1 -0
- package/dist/web/page.js +92 -0
- package/dist/web/page.js.map +1 -0
- package/dist/web/scripts.d.ts +23 -0
- package/dist/web/scripts.d.ts.map +1 -0
- package/dist/web/scripts.js +50 -0
- package/dist/web/scripts.js.map +1 -0
- package/dist/web/styles.d.ts +17 -0
- package/dist/web/styles.d.ts.map +1 -0
- package/dist/web/styles.js +218 -0
- package/dist/web/styles.js.map +1 -0
- package/dist/web/themes.d.ts +6 -0
- package/dist/web/themes.d.ts.map +1 -0
- package/dist/web/themes.js +31 -0
- package/dist/web/themes.js.map +1 -0
- package/docs/benchmarks.md +1036 -0
- package/docs/decisions.md +3436 -0
- package/docs/dependencies/book.md +1671 -0
- package/docs/dependencies/index.html +2641 -0
- package/docs/dependencies/model.md +330 -0
- package/docs/design.md +3065 -0
- package/docs/durable-observers/book.md +432 -0
- package/docs/durable-observers/index.html +517 -0
- package/docs/flow-control/book.md +333 -0
- package/docs/flow-control/fold/index.html +265 -0
- package/docs/flow-control/index.html +548 -0
- package/docs/flow-control/window/index.html +228 -0
- package/docs/guide-plugins-hosts/book.md +957 -0
- package/docs/guide-plugins-hosts/index.html +952 -0
- package/docs/http-workers/book.md +378 -0
- package/docs/http-workers/index.html +515 -0
- package/docs/i18n/book.md +217 -0
- package/docs/i18n/index.html +344 -0
- package/docs/layer-1.md +311 -0
- package/docs/layer-2.md +216 -0
- package/docs/p3-features/README.md +6 -0
- package/docs/p3-features/book.md +478 -0
- package/docs/plugin-authoring.md +276 -0
- package/docs/plugin-model/book.md +186 -0
- package/docs/plugin-model/index.html +310 -0
- package/docs/plugin-primer/book.md +273 -0
- package/docs/plugin-primer/index.html +430 -0
- package/docs/slice-1.md +236 -0
- package/docs/slice-10.md +288 -0
- package/docs/slice-11.md +114 -0
- package/docs/slice-12.md +132 -0
- package/docs/slice-13.md +121 -0
- package/docs/slice-2.md +174 -0
- package/docs/slice-3a.md +296 -0
- package/docs/slice-3b.md +197 -0
- package/docs/slice-4.md +146 -0
- package/docs/slice-4a.md +418 -0
- package/docs/slice-4b.md +208 -0
- package/docs/slice-5.md +281 -0
- package/docs/slice-6a.md +676 -0
- package/docs/slice-6b.md +332 -0
- package/docs/slice-7a.md +130 -0
- package/docs/slice-7b/book.md +608 -0
- package/docs/slice-7b/index.html +842 -0
- package/docs/slice-7b.md +255 -0
- package/docs/slice-7c.md +165 -0
- package/docs/slice-8.md +194 -0
- package/docs/slice-9.md +110 -0
- package/docs/slices.md +241 -0
- package/docs/store/book.md +670 -0
- package/docs/store/index.html +861 -0
- package/docs/store/walkthrough.md +193 -0
- package/docs/theming/book.md +223 -0
- package/docs/theming/index.html +371 -0
- package/docs/tutorial/book.md +2169 -0
- package/docs/tutorial/index.html +2112 -0
- package/docs/tutorial/screens/click-after.png +0 -0
- package/docs/tutorial/screens/click-before.png +0 -0
- package/docs/tutorial/screens/edited.png +0 -0
- package/docs/tutorial/screens/french.png +0 -0
- package/docs/tutorial/screens/harbor.png +0 -0
- package/docs/tutorial/screens/page.png +0 -0
- package/docs/tutorial/screens/traces-ada.png +0 -0
- package/docs/tutorial/screens/traces.png +0 -0
- package/package.json +114 -20
- package/src/delta/README.md +69 -0
- package/dist/cell.d.ts +0 -122
- package/dist/cell.d.ts.map +0 -1
- package/dist/cell.js +0 -356
- package/dist/cell.js.map +0 -1
- package/dist/cluster.d.ts +0 -27
- package/dist/cluster.d.ts.map +0 -1
- package/dist/cluster.js +0 -230
- package/dist/cluster.js.map +0 -1
- package/dist/connection.d.ts +0 -270
- package/dist/connection.d.ts.map +0 -1
- package/dist/connection.js +0 -1216
- package/dist/connection.js.map +0 -1
- package/dist/contract.d.ts +0 -208
- package/dist/contract.d.ts.map +0 -1
- package/dist/contract.js +0 -246
- package/dist/contract.js.map +0 -1
- package/dist/declare.d.ts +0 -33
- package/dist/declare.d.ts.map +0 -1
- package/dist/declare.js +0 -2
- package/dist/declare.js.map +0 -1
- package/dist/errors.d.ts +0 -28
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -59
- package/dist/errors.js.map +0 -1
- package/dist/host.d.ts +0 -348
- package/dist/host.d.ts.map +0 -1
- package/dist/host.js +0 -1000
- package/dist/host.js.map +0 -1
- package/dist/link.d.ts +0 -107
- package/dist/link.d.ts.map +0 -1
- package/dist/link.js +0 -355
- package/dist/link.js.map +0 -1
- package/dist/loader.d.ts +0 -4
- package/dist/loader.d.ts.map +0 -1
- package/dist/loader.js +0 -73
- package/dist/loader.js.map +0 -1
- package/dist/manager.d.ts +0 -115
- package/dist/manager.d.ts.map +0 -1
- package/dist/manager.js +0 -345
- package/dist/manager.js.map +0 -1
- package/dist/node.d.ts +0 -4
- package/dist/node.d.ts.map +0 -1
- package/dist/node.js +0 -4
- package/dist/node.js.map +0 -1
- package/dist/object.d.ts +0 -438
- package/dist/object.d.ts.map +0 -1
- package/dist/object.js +0 -1571
- package/dist/object.js.map +0 -1
- package/dist/publish.d.ts +0 -5
- package/dist/publish.d.ts.map +0 -1
- package/dist/publish.js +0 -40
- package/dist/publish.js.map +0 -1
- package/dist/registry.d.ts +0 -25
- package/dist/registry.d.ts.map +0 -1
- package/dist/registry.js +0 -6
- package/dist/registry.js.map +0 -1
- package/dist/reload.d.ts +0 -126
- package/dist/reload.d.ts.map +0 -1
- package/dist/reload.js +0 -653
- package/dist/reload.js.map +0 -1
- package/dist/remote.d.ts +0 -165
- package/dist/remote.d.ts.map +0 -1
- package/dist/remote.js +0 -612
- package/dist/remote.js.map +0 -1
- package/dist/schema.d.ts +0 -21
- package/dist/schema.d.ts.map +0 -1
- package/dist/schema.js +0 -228
- package/dist/schema.js.map +0 -1
- package/dist/state.d.ts +0 -92
- package/dist/state.d.ts.map +0 -1
- package/dist/state.js +0 -287
- package/dist/state.js.map +0 -1
- package/dist/types.d.ts +0 -88
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
- package/dist/websocket.d.ts +0 -15
- package/dist/websocket.d.ts.map +0 -1
- package/dist/websocket.js +0 -16
- package/dist/websocket.js.map +0 -1
- package/dist/wire.d.ts +0 -216
- package/dist/wire.d.ts.map +0 -1
- package/dist/wire.js +0 -165
- package/dist/wire.js.map +0 -1
- package/docs/guide.md +0 -814
- package/docs/spec.md +0 -288
- package/docs/tutorial.md +0 -931
|
@@ -0,0 +1,677 @@
|
|
|
1
|
+
// The workers component (slice 10 §3, §4; decision "Slice 10's points"): a forked worker process per address of one
|
|
2
|
+
// host kind, started on demand by the route it owns, stopped when idle, never restarted by itself (R2): a crash, a
|
|
3
|
+
// `fatal` or a failed start leaves the address failed until `retry` or a rollout. A running worker's lost link is a
|
|
4
|
+
// stop its holders start a new worker after, once a minute (decision "A lost worker link is recovered from").
|
|
5
|
+
// Per address, a child's events are recorded on that child as they happen; starts and stops run one after another.
|
|
6
|
+
// Every worker is forked from the kind's worker base, bundled once by `build` (the kit: right after the server
|
|
7
|
+
// listens; a start waits for it, and fails when it did not build; decision "Workers start from the base code the server
|
|
8
|
+
// booted with").
|
|
9
|
+
import { awaitWithContext, BACKGROUND_CONTEXT, withAbortSignal } from "../../context/index.js";
|
|
10
|
+
import { ChordError } from "../../data/index.js";
|
|
11
|
+
import { Batch, Source } from "../../state/internal.js";
|
|
12
|
+
import { buildWorkerBase } from "./base.js";
|
|
13
|
+
import { uncrossed, uncrossedReport } from "./control.js";
|
|
14
|
+
import { clearStaleLock } from "./lock.js";
|
|
15
|
+
import { WorkerProcess } from "./process.js";
|
|
16
|
+
/**
|
|
17
|
+
* Creates the workers component on `host`: it routes `Kind` itself (`host.route`, before `load`). Its worker base is
|
|
18
|
+
* not built yet (`build`).
|
|
19
|
+
*/
|
|
20
|
+
export function createWorkers(host, Kind, options, context) {
|
|
21
|
+
// Its addresses are `Address<HostKind<N, Q>>`, as the route hands them over.
|
|
22
|
+
const component = new WorkersComponent(options, context);
|
|
23
|
+
const route = host.route(Kind, {
|
|
24
|
+
authorize: (principal, address) => {
|
|
25
|
+
// A throw would reach the holder as the hold's failure: the app's error stays private.
|
|
26
|
+
try {
|
|
27
|
+
return options.authorize(principal, address);
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
options.onError({ kind: "authorize_failed", address: address.key, error });
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
// The address is the route's, of `Kind` (the component works on any kind's); the principal is
|
|
35
|
+
// `options.principal`'s, a `P`.
|
|
36
|
+
resolve: (address, routing) => component.resolve(address, routing),
|
|
37
|
+
}, context);
|
|
38
|
+
component.route = route;
|
|
39
|
+
return component;
|
|
40
|
+
}
|
|
41
|
+
/** Starts a worker may take until `started` (fork, lock, connect): 60 s. */
|
|
42
|
+
const START_TIMEOUT = 60_000;
|
|
43
|
+
/** How long a stopping worker (or one whose link is gone) gets before its tree is killed: 5 s. */
|
|
44
|
+
const GRACE = 5_000;
|
|
45
|
+
/** How often idle workers are looked for: every second. */
|
|
46
|
+
const IDLE_CHECK = 1_000;
|
|
47
|
+
/** How long a worker idles before it is stopped unless `idleMs` says otherwise: 5 minutes. */
|
|
48
|
+
const IDLE_MS = 5 * 60_000;
|
|
49
|
+
/** How long after a recovered lost link another one fails the address: 1 minute. */
|
|
50
|
+
const RECOVERY_WINDOW = 60_000;
|
|
51
|
+
/** The public error of a start that failed. */
|
|
52
|
+
const START_FAILED = { message: "worker failed to start", code: "unavailable" };
|
|
53
|
+
/** `base` as callers see it. */
|
|
54
|
+
function builtOf(base) {
|
|
55
|
+
return base.kind === "built" ? { kind: "built", inputs: base.base.inputs } : base;
|
|
56
|
+
}
|
|
57
|
+
class WorkersComponent {
|
|
58
|
+
/** Set by `createWorkers` once the route exists. */
|
|
59
|
+
route;
|
|
60
|
+
state;
|
|
61
|
+
#state;
|
|
62
|
+
#options;
|
|
63
|
+
/** What every fork's environment adds to the server's: the app's `env`, the compile cache's directory. */
|
|
64
|
+
#environment;
|
|
65
|
+
/** The worker base's build, started once; its outcome once it ended. */
|
|
66
|
+
#building;
|
|
67
|
+
#base;
|
|
68
|
+
#addresses = new Map();
|
|
69
|
+
/** Aborted at `close`: starts waiting in the app's `start` or for `started` end. */
|
|
70
|
+
#closing = new AbortController();
|
|
71
|
+
/** `#closing`'s signal as a context: what a start's waits are bounded by. */
|
|
72
|
+
#closingContext = withAbortSignal(this.#closing.signal, BACKGROUND_CONTEXT);
|
|
73
|
+
/** Whether the route's context closes it already (its first `resolve` attached that). */
|
|
74
|
+
#routing = false;
|
|
75
|
+
#idleTimer;
|
|
76
|
+
constructor(options, context) {
|
|
77
|
+
this.#options = options;
|
|
78
|
+
const { compileCache, env } = options;
|
|
79
|
+
this.#environment = compileCache === undefined ? env : { NODE_COMPILE_CACHE: compileCache, ...env };
|
|
80
|
+
this.#state = new WorkersState(this.#addresses, new Batch((error) => options.onError(error), undefined));
|
|
81
|
+
// Its value is a `Record<string, WorkerState>`.
|
|
82
|
+
this.state = this.#state;
|
|
83
|
+
this.#closeWith(context);
|
|
84
|
+
}
|
|
85
|
+
build() {
|
|
86
|
+
return this.#built().then(builtOf);
|
|
87
|
+
}
|
|
88
|
+
get built() {
|
|
89
|
+
return this.#base === undefined ? undefined : builtOf(this.#base);
|
|
90
|
+
}
|
|
91
|
+
/** The worker base's build, started once. */
|
|
92
|
+
#built() {
|
|
93
|
+
const { entry, execArgv = [], baseDir } = this.#options;
|
|
94
|
+
this.#building ??= buildWorkerBase(entry, execArgv, baseDir)
|
|
95
|
+
.then(
|
|
96
|
+
// Nothing is written until a fork (`file()`): a build that ends after the close touches no file.
|
|
97
|
+
(base) => ({ kind: "built", base }), (error) => ({ kind: "failed", error }))
|
|
98
|
+
.then((outcome) => {
|
|
99
|
+
this.#base = outcome;
|
|
100
|
+
return outcome;
|
|
101
|
+
});
|
|
102
|
+
return this.#building;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* The route's `resolve`: a failed address rejects at once with its (public) failure, nothing forks; otherwise a
|
|
106
|
+
* start, after the previous child's exit.
|
|
107
|
+
*/
|
|
108
|
+
resolve(address, routing) {
|
|
109
|
+
if (!this.#routing) {
|
|
110
|
+
this.#routing = true;
|
|
111
|
+
this.#closeWith(routing);
|
|
112
|
+
}
|
|
113
|
+
const routed = this.#routed(address);
|
|
114
|
+
if (routed.failure !== undefined)
|
|
115
|
+
return Promise.reject(uncrossed(routed.failure.error));
|
|
116
|
+
if (this.#closing.signal.aborted)
|
|
117
|
+
return Promise.reject(closed());
|
|
118
|
+
const started = this.#enqueue(routed, () => this.#start(routed, routing));
|
|
119
|
+
routed.starting = started;
|
|
120
|
+
void started.then(() => this.#settled(routed, started), () => this.#settled(routed, started));
|
|
121
|
+
return started;
|
|
122
|
+
}
|
|
123
|
+
async stop(address, context) {
|
|
124
|
+
this.route.suspend(address);
|
|
125
|
+
const routed = this.#addresses.get(address.key);
|
|
126
|
+
if (routed === undefined)
|
|
127
|
+
return;
|
|
128
|
+
await awaitWithContext(this.#enqueue(routed, () => this.#stop(routed)), context);
|
|
129
|
+
}
|
|
130
|
+
async retry(address, _context) {
|
|
131
|
+
const routed = this.#addresses.get(address.key);
|
|
132
|
+
if (routed !== undefined) {
|
|
133
|
+
routed.failure = undefined;
|
|
134
|
+
this.#state.refresh();
|
|
135
|
+
this.#forget(routed);
|
|
136
|
+
}
|
|
137
|
+
this.route.retry(address);
|
|
138
|
+
}
|
|
139
|
+
step(name) {
|
|
140
|
+
return { name, kinds: [this.#options.kind], reload: (_built, context) => this.#rollout(context) };
|
|
141
|
+
}
|
|
142
|
+
async close(context) {
|
|
143
|
+
if (!this.#closing.signal.aborted)
|
|
144
|
+
this.#closing.abort(closed());
|
|
145
|
+
clearInterval(this.#idleTimer);
|
|
146
|
+
this.#idleTimer = undefined;
|
|
147
|
+
// Each stop, then what its exit queued (the clear of a killed child's lock file).
|
|
148
|
+
const stops = [...this.#addresses.values()].map((routed) => this.#enqueue(routed, () => this.#stop(routed)).then(() => routed.queue));
|
|
149
|
+
// The base's files stay until every child exited or was killed (a stopping worker's closers may import a lazy
|
|
150
|
+
// chunk), also when `context` ends the wait first: nothing forks once closing, and only files this component
|
|
151
|
+
// wrote go. The kit releases the data directory's lock only after this close resolved.
|
|
152
|
+
const exited = Promise.all(stops).then(() => {
|
|
153
|
+
if (this.#base?.kind === "built")
|
|
154
|
+
this.#base.base.remove();
|
|
155
|
+
});
|
|
156
|
+
await awaitWithContext(exited, context);
|
|
157
|
+
}
|
|
158
|
+
/** `context`'s abort closes the component (the route's is aborted when the host closes). */
|
|
159
|
+
#closeWith(context) {
|
|
160
|
+
const signal = context.abortSignal;
|
|
161
|
+
if (signal === undefined || signal.aborted)
|
|
162
|
+
return;
|
|
163
|
+
signal.addEventListener("abort", () => void this.close(BACKGROUND_CONTEXT).catch(() => { }), { once: true });
|
|
164
|
+
}
|
|
165
|
+
/** The record of `address`, made by its first use. */
|
|
166
|
+
#routed(address) {
|
|
167
|
+
let routed = this.#addresses.get(address.key);
|
|
168
|
+
if (routed === undefined) {
|
|
169
|
+
routed = {
|
|
170
|
+
address,
|
|
171
|
+
queue: Promise.resolve(),
|
|
172
|
+
pending: 0,
|
|
173
|
+
child: undefined,
|
|
174
|
+
failure: undefined,
|
|
175
|
+
starting: undefined,
|
|
176
|
+
recovered: undefined,
|
|
177
|
+
};
|
|
178
|
+
this.#addresses.set(address.key, routed);
|
|
179
|
+
}
|
|
180
|
+
return routed;
|
|
181
|
+
}
|
|
182
|
+
/** Runs `operation` after the address's earlier ones. */
|
|
183
|
+
#enqueue(routed, operation) {
|
|
184
|
+
routed.pending++;
|
|
185
|
+
const run = routed.queue.then(operation);
|
|
186
|
+
routed.queue = run.then(() => this.#done(routed), () => this.#done(routed));
|
|
187
|
+
return run;
|
|
188
|
+
}
|
|
189
|
+
/** An operation ended. */
|
|
190
|
+
#done(routed) {
|
|
191
|
+
routed.pending--;
|
|
192
|
+
this.#forget(routed);
|
|
193
|
+
}
|
|
194
|
+
/** A start settled: no longer starting. */
|
|
195
|
+
#settled(routed, started) {
|
|
196
|
+
if (routed.starting === started)
|
|
197
|
+
routed.starting = undefined;
|
|
198
|
+
}
|
|
199
|
+
/** Forgets an address with no operation, no child and no failure. */
|
|
200
|
+
#forget(routed) {
|
|
201
|
+
if (routed.pending === 0 && routed.child === undefined && routed.failure === undefined) {
|
|
202
|
+
this.#addresses.delete(routed.address.key);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* A start: the app's start data, the fork, the start message with the kind's current set, then `started` within the
|
|
207
|
+
* start timer (fork, lock and connect only). Its failure fails the address; `close` ends it at any of its waits (an
|
|
208
|
+
* app's `start` that ignores its signal too), a forked child is stopped.
|
|
209
|
+
*/
|
|
210
|
+
async #start(routed, routing) {
|
|
211
|
+
const { address } = routed;
|
|
212
|
+
// After the previous child's exit (its link may close first): a crash recorded meanwhile rejects this start.
|
|
213
|
+
await routed.child?.process.exited;
|
|
214
|
+
const crashed = routed.failure;
|
|
215
|
+
if (crashed !== undefined)
|
|
216
|
+
throw uncrossed(crashed.error);
|
|
217
|
+
if (this.#closing.signal.aborted)
|
|
218
|
+
throw closed();
|
|
219
|
+
// The kind's worker base: a start waits for its build, and fails while it failed.
|
|
220
|
+
const base = await awaitWithContext(this.#built(), this.#closingContext).catch(() => {
|
|
221
|
+
// `#built` never rejects: the close ended the wait.
|
|
222
|
+
throw closed();
|
|
223
|
+
});
|
|
224
|
+
if (this.#closing.signal.aborted)
|
|
225
|
+
throw closed();
|
|
226
|
+
if (base.kind === "failed")
|
|
227
|
+
throw this.#fail(routed, { error: base.error, public: START_FAILED }, undefined);
|
|
228
|
+
const context = withAbortSignal(this.#closing.signal, routing);
|
|
229
|
+
let data;
|
|
230
|
+
try {
|
|
231
|
+
data = await awaitWithContext(Promise.resolve(this.#options.start(address, context)), this.#closingContext);
|
|
232
|
+
}
|
|
233
|
+
catch (error) {
|
|
234
|
+
if (this.#closing.signal.aborted)
|
|
235
|
+
throw closed();
|
|
236
|
+
throw this.#fail(routed, { error, public: START_FAILED }, undefined);
|
|
237
|
+
}
|
|
238
|
+
// Checked in the same synchronous step as the fork, which writes the base's files (`file()`): never after the
|
|
239
|
+
// close (the kit releases the data directory's lock after it; a later start owns `baseDir` then).
|
|
240
|
+
if (this.#closing.signal.aborted)
|
|
241
|
+
throw closed();
|
|
242
|
+
let child;
|
|
243
|
+
try {
|
|
244
|
+
child = this.#fork(routed, base.base);
|
|
245
|
+
}
|
|
246
|
+
catch (error) {
|
|
247
|
+
throw this.#fail(routed, { error, public: START_FAILED }, undefined);
|
|
248
|
+
}
|
|
249
|
+
const timer = setTimeout(() => {
|
|
250
|
+
const error = new Error(`worker ${address.key}: did not start within ${START_TIMEOUT / 1000} s`);
|
|
251
|
+
child.cause ??= { error, killed: true };
|
|
252
|
+
child.process.kill();
|
|
253
|
+
}, START_TIMEOUT);
|
|
254
|
+
// Every app hook of the start runs in here: what one throws stays private (`worker_failed`), its holders and
|
|
255
|
+
// `state` get the fixed public message (Astra's recheck R3: `principal` threw through to a guest).
|
|
256
|
+
try {
|
|
257
|
+
const scripts = await this.#options.plugins.scripts(this.#options.kind, context);
|
|
258
|
+
child.shipped = keyOf(scripts);
|
|
259
|
+
const lock = this.#options.lock(address);
|
|
260
|
+
// A worker killed without its exit hooks (SIGKILL), maybe by an earlier server, left its socket file, which fails
|
|
261
|
+
// its successors closed. The component is the one clearer of its addresses' locks, in the address's queue: one
|
|
262
|
+
// clear at a time (decision "Stale lock files are cleared by the starter"). A live holder (an old worker still
|
|
263
|
+
// exiting) is kept and waited for.
|
|
264
|
+
await clearStaleLock(lock, context);
|
|
265
|
+
child.lock = lock;
|
|
266
|
+
child.process.send({ kind: "start", address, start: data, scripts, lock });
|
|
267
|
+
await awaitWithContext(child.started.promise, this.#closingContext);
|
|
268
|
+
return { link: child.process.link, principal: this.#options.principal(address), trusted: true };
|
|
269
|
+
}
|
|
270
|
+
catch (error) {
|
|
271
|
+
// Closing is a stop (no failure); anything else fails the start.
|
|
272
|
+
if (this.#closing.signal.aborted)
|
|
273
|
+
child.stopping = true;
|
|
274
|
+
else
|
|
275
|
+
child.cause ??= { error, public: START_FAILED, killed: true };
|
|
276
|
+
child.process.kill();
|
|
277
|
+
await child.process.exited;
|
|
278
|
+
if (this.#closing.signal.aborted)
|
|
279
|
+
throw closed();
|
|
280
|
+
throw uncrossed(routed.failure?.error ?? START_FAILED);
|
|
281
|
+
}
|
|
282
|
+
finally {
|
|
283
|
+
clearTimeout(timer);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
/** Forks the address's worker and records its events on it as they happen. */
|
|
287
|
+
#fork(routed, base) {
|
|
288
|
+
const { address } = routed;
|
|
289
|
+
const onOutput = this.#options.onOutput;
|
|
290
|
+
let child;
|
|
291
|
+
const process = new WorkerProcess({
|
|
292
|
+
entry: base.file(),
|
|
293
|
+
// Stack traces name the base code's files; the app's flags come after (`--no-enable-source-maps` wins).
|
|
294
|
+
execArgv: ["--enable-source-maps", ...(this.#options.execArgv ?? [])],
|
|
295
|
+
...(this.#environment === undefined ? {} : { env: this.#environment }),
|
|
296
|
+
...(onOutput === undefined ? {} : { onOutput: (stream, chunk) => onOutput(address, stream, chunk) }),
|
|
297
|
+
}, {
|
|
298
|
+
control: (message) => this.#control(routed, child, message),
|
|
299
|
+
linkLost: () => this.#linkLost(child),
|
|
300
|
+
linkClosed: () => this.#linkClosed(child),
|
|
301
|
+
exited: (exit) => this.#exited(routed, child, exit),
|
|
302
|
+
});
|
|
303
|
+
child = {
|
|
304
|
+
process,
|
|
305
|
+
status: "starting",
|
|
306
|
+
stopping: false,
|
|
307
|
+
cause: undefined,
|
|
308
|
+
started: Promise.withResolvers(),
|
|
309
|
+
ready: Promise.withResolvers(),
|
|
310
|
+
idleSince: undefined,
|
|
311
|
+
idleStop: false,
|
|
312
|
+
shipped: "",
|
|
313
|
+
reloading: Promise.resolve(),
|
|
314
|
+
reloaded: undefined,
|
|
315
|
+
ended: undefined,
|
|
316
|
+
grace: undefined,
|
|
317
|
+
lock: undefined,
|
|
318
|
+
};
|
|
319
|
+
// Nobody may wait for them.
|
|
320
|
+
child.started.promise.catch(() => { });
|
|
321
|
+
child.ready.promise.catch(() => { });
|
|
322
|
+
routed.child = child;
|
|
323
|
+
this.#state.refresh();
|
|
324
|
+
this.#watchIdle();
|
|
325
|
+
return child;
|
|
326
|
+
}
|
|
327
|
+
/** A control message of `child`. */
|
|
328
|
+
#control(routed, child, message) {
|
|
329
|
+
switch (message.kind) {
|
|
330
|
+
case "started":
|
|
331
|
+
child.started.resolve();
|
|
332
|
+
return;
|
|
333
|
+
case "ready":
|
|
334
|
+
child.status = "running";
|
|
335
|
+
child.idleSince = message.idle ? Date.now() : undefined;
|
|
336
|
+
child.ready.resolve(message.report);
|
|
337
|
+
if (routed.child === child)
|
|
338
|
+
this.#state.refresh();
|
|
339
|
+
return;
|
|
340
|
+
case "idle":
|
|
341
|
+
child.idleSince = message.idle ? (child.idleSince ?? Date.now()) : undefined;
|
|
342
|
+
return;
|
|
343
|
+
case "fatal":
|
|
344
|
+
// Redacted by the child's `redact`: public as it is.
|
|
345
|
+
child.cause ??= { error: uncrossed(message.error), public: message.error };
|
|
346
|
+
child.started.reject(uncrossed(message.error));
|
|
347
|
+
child.process.kill();
|
|
348
|
+
return;
|
|
349
|
+
case "reloaded":
|
|
350
|
+
child.reloaded?.(message);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
/** This side closed `child`'s link (the heartbeat, a protocol error): its child is stopped, its exit a lost link. */
|
|
354
|
+
#linkLost(child) {
|
|
355
|
+
this.#ended(child);
|
|
356
|
+
if (child.stopping)
|
|
357
|
+
return;
|
|
358
|
+
child.cause ??= lostLink(child);
|
|
359
|
+
this.#shutdown(child);
|
|
360
|
+
this.#state.refresh();
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* The child's side closed its link (it is exiting, or it closed its IPC and lives on): its reloads end; one that does
|
|
364
|
+
* not exit within the grace is killed, its exit a lost link.
|
|
365
|
+
*/
|
|
366
|
+
#linkClosed(child) {
|
|
367
|
+
this.#ended(child);
|
|
368
|
+
if (child.stopping || child.grace !== undefined)
|
|
369
|
+
return;
|
|
370
|
+
const lost = lostLink(child);
|
|
371
|
+
child.grace = setTimeout(() => {
|
|
372
|
+
child.cause ??= lost;
|
|
373
|
+
child.process.kill();
|
|
374
|
+
}, GRACE);
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* `child` exited: a stop's exit forgets it, as does a lost link the address recovers from (`worker_link_lost`: its
|
|
378
|
+
* holders' route resolves again, a start after this exit); any other is a crash that fails the address
|
|
379
|
+
* (`worker_exited` and `worker_failed` once, the full error and stderr tail for the app's logs only), except once the
|
|
380
|
+
* component closes.
|
|
381
|
+
*/
|
|
382
|
+
#exited(routed, child, exit) {
|
|
383
|
+
clearTimeout(child.grace);
|
|
384
|
+
const clean = child.stopping && child.cause === undefined;
|
|
385
|
+
const cause = child.cause ?? { error: exitError(routed.address, exit, child) };
|
|
386
|
+
const error = cause.public ?? publicExit(exit, child);
|
|
387
|
+
child.started.reject(uncrossed(error));
|
|
388
|
+
child.ready.reject(uncrossed(error));
|
|
389
|
+
this.#ended(child);
|
|
390
|
+
const lock = child.lock;
|
|
391
|
+
// A child a signal ended (SIGKILL) ran no exit hooks: its socket file would stay until the address's next start.
|
|
392
|
+
// Cleared in the queue, like a start's clear; a failure here is the next start's to report (it clears again).
|
|
393
|
+
if (lock !== undefined && exit.signal !== null) {
|
|
394
|
+
void this.#enqueue(routed, () => clearStaleLock(lock, BACKGROUND_CONTEXT)).catch(() => { });
|
|
395
|
+
}
|
|
396
|
+
if (routed.child !== child)
|
|
397
|
+
return;
|
|
398
|
+
routed.child = undefined;
|
|
399
|
+
if (!clean && !this.#closing.signal.aborted) {
|
|
400
|
+
if (cause.lost === true && this.#recovers(routed)) {
|
|
401
|
+
this.#options.onError({ kind: "worker_link_lost", address: routed.address.key, error: cause.error });
|
|
402
|
+
}
|
|
403
|
+
else {
|
|
404
|
+
const { code, signal } = exit;
|
|
405
|
+
// A failed start's kill is the component's own act (Opus's second recheck): only `worker_failed`.
|
|
406
|
+
if (cause.killed !== true) {
|
|
407
|
+
this.#options.onError({ kind: "worker_exited", address: routed.address.key, code, signal });
|
|
408
|
+
}
|
|
409
|
+
this.#fail(routed, { ...cause, public: error }, child.process.stderrTail);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
this.#state.refresh();
|
|
413
|
+
this.#forget(routed);
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* Whether `routed` recovers from its running child's lost link, recorded when it does: not within a minute of the
|
|
417
|
+
* last recovery, so a worker that loses every link fails instead of restarting in a loop.
|
|
418
|
+
*/
|
|
419
|
+
#recovers(routed) {
|
|
420
|
+
const now = Date.now();
|
|
421
|
+
if (routed.recovered !== undefined && now - routed.recovered < RECOVERY_WINDOW)
|
|
422
|
+
return false;
|
|
423
|
+
routed.recovered = now;
|
|
424
|
+
return true;
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* `child`'s link is gone or it exited (the first of these): its outstanding reload and every one queued behind it
|
|
428
|
+
* settle, `stopped` when a stop asked for it, else failed.
|
|
429
|
+
*/
|
|
430
|
+
#ended(child) {
|
|
431
|
+
if (child.ended !== undefined)
|
|
432
|
+
return;
|
|
433
|
+
child.ended =
|
|
434
|
+
child.stopping && child.cause === undefined
|
|
435
|
+
? { kind: "stopped" }
|
|
436
|
+
: { kind: "failed", error: new ChordError({ code: "unavailable", message: "worker: its link is gone" }) };
|
|
437
|
+
child.reloaded?.({ kind: "reloaded", error: { message: "worker: its link is gone" } });
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* Fails `routed` with `cause` (`worker_failed` once, with the full error and `stderrTail`); returns the public error
|
|
441
|
+
* a start rejects with.
|
|
442
|
+
*/
|
|
443
|
+
#fail(routed, cause, stderrTail) {
|
|
444
|
+
routed.failure = { error: cause.public, at: Date.now() };
|
|
445
|
+
this.#options.onError({
|
|
446
|
+
kind: "worker_failed",
|
|
447
|
+
address: routed.address.key,
|
|
448
|
+
error: cause.error,
|
|
449
|
+
...(stderrTail === undefined ? {} : { stderrTail }),
|
|
450
|
+
});
|
|
451
|
+
this.#state.refresh();
|
|
452
|
+
return uncrossed(cause.public);
|
|
453
|
+
}
|
|
454
|
+
/** A stop: `shutdown`, the grace, then the tree killed; resolves at its exit. */
|
|
455
|
+
async #stop(routed) {
|
|
456
|
+
const child = routed.child;
|
|
457
|
+
if (child === undefined)
|
|
458
|
+
return;
|
|
459
|
+
child.stopping = true;
|
|
460
|
+
this.#shutdown(child);
|
|
461
|
+
this.#state.refresh();
|
|
462
|
+
await child.process.exited;
|
|
463
|
+
}
|
|
464
|
+
/** Asks `child` to shut down and kills its tree after the grace. */
|
|
465
|
+
#shutdown(child) {
|
|
466
|
+
child.status = "stopping";
|
|
467
|
+
child.process.send({ kind: "shutdown" });
|
|
468
|
+
clearTimeout(child.grace);
|
|
469
|
+
child.grace = setTimeout(() => child.process.kill(), GRACE);
|
|
470
|
+
}
|
|
471
|
+
/** Starts the idle check (every second) while any worker exists. */
|
|
472
|
+
#watchIdle() {
|
|
473
|
+
if (this.#idleTimer !== undefined)
|
|
474
|
+
return;
|
|
475
|
+
this.#idleTimer = setInterval(() => this.#checkIdle(), IDLE_CHECK);
|
|
476
|
+
this.#idleTimer.unref();
|
|
477
|
+
}
|
|
478
|
+
/** Queues a stop for every worker idle since `idleMs()`; stops checking once no worker is left. */
|
|
479
|
+
#checkIdle() {
|
|
480
|
+
const idleMs = this.#idleMs();
|
|
481
|
+
const now = Date.now();
|
|
482
|
+
let workers = 0;
|
|
483
|
+
for (const routed of this.#addresses.values()) {
|
|
484
|
+
const child = routed.child;
|
|
485
|
+
if (child === undefined)
|
|
486
|
+
continue;
|
|
487
|
+
workers++;
|
|
488
|
+
if (child.idleStop || child.status !== "running")
|
|
489
|
+
continue;
|
|
490
|
+
if (child.idleSince === undefined || now - child.idleSince < idleMs)
|
|
491
|
+
continue;
|
|
492
|
+
child.idleStop = true;
|
|
493
|
+
void this.#enqueue(routed, () => this.#idleStop(routed, child));
|
|
494
|
+
}
|
|
495
|
+
if (workers === 0) {
|
|
496
|
+
clearInterval(this.#idleTimer);
|
|
497
|
+
this.#idleTimer = undefined;
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
/** An idle stop when it runs: only if `child` is still the address's and still idle (a hold may have come since). */
|
|
501
|
+
async #idleStop(routed, child) {
|
|
502
|
+
child.idleStop = false;
|
|
503
|
+
if (routed.child !== child || child.idleSince === undefined)
|
|
504
|
+
return;
|
|
505
|
+
if (Date.now() - child.idleSince < this.#idleMs())
|
|
506
|
+
return;
|
|
507
|
+
await this.#stop(routed);
|
|
508
|
+
}
|
|
509
|
+
/** How long a worker idles before it is stopped. */
|
|
510
|
+
#idleMs() {
|
|
511
|
+
return this.#options.idleMs?.() ?? IDLE_MS;
|
|
512
|
+
}
|
|
513
|
+
/**
|
|
514
|
+
* The rollout step (§4): the set as this rollout applied it, read now (before another rollout changes it); the
|
|
515
|
+
* failures recorded before it cleared and the held ones retried (listed once ready or failed); the set shipped to
|
|
516
|
+
* every worker whose last applied set differs, in parallel. `context`'s abort ends only this wait: the entries
|
|
517
|
+
* still waiting are listed with its error.
|
|
518
|
+
*/
|
|
519
|
+
async #rollout(context) {
|
|
520
|
+
const { kind, plugins } = this.#options;
|
|
521
|
+
const scripts = plugins.current(kind) ?? (await plugins.scripts(kind, context));
|
|
522
|
+
const key = keyOf(scripts);
|
|
523
|
+
const entries = [];
|
|
524
|
+
for (const routed of [...this.#addresses.values()]) {
|
|
525
|
+
if (routed.failure === undefined)
|
|
526
|
+
continue;
|
|
527
|
+
routed.failure = undefined;
|
|
528
|
+
this.#state.refresh();
|
|
529
|
+
this.route.retry(routed.address);
|
|
530
|
+
const started = routed.starting;
|
|
531
|
+
if (started === undefined)
|
|
532
|
+
this.#forget(routed);
|
|
533
|
+
else
|
|
534
|
+
entries.push({ host: routed.address.key, entry: this.#retried(routed, started) });
|
|
535
|
+
}
|
|
536
|
+
for (const routed of this.#addresses.values()) {
|
|
537
|
+
const child = routed.child;
|
|
538
|
+
if (child === undefined || child.status === "stopping" || child.shipped === key)
|
|
539
|
+
continue;
|
|
540
|
+
entries.push({ host: routed.address.key, entry: this.#reload(routed.address.key, child, scripts, key) });
|
|
541
|
+
}
|
|
542
|
+
return { hosts: await Promise.all(entries.map(({ host, entry }) => bounded(host, entry, context))) };
|
|
543
|
+
}
|
|
544
|
+
/** A retried address's entry: its start's load report once ready, or its error. */
|
|
545
|
+
async #retried(routed, started) {
|
|
546
|
+
const host = routed.address.key;
|
|
547
|
+
try {
|
|
548
|
+
await started;
|
|
549
|
+
const child = routed.child;
|
|
550
|
+
if (child === undefined)
|
|
551
|
+
throw new Error("worker: exited");
|
|
552
|
+
return { host, report: uncrossedReport(await child.ready.promise) };
|
|
553
|
+
}
|
|
554
|
+
catch (error) {
|
|
555
|
+
return { host, error };
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
/**
|
|
559
|
+
* Ships `scripts` to `child` after its outstanding reload; settles on `reloaded`, its link's loss or its exit. Only a
|
|
560
|
+
* reload that applied without failures marks the set shipped (a failed plugin is shipped again next time).
|
|
561
|
+
*/
|
|
562
|
+
#reload(host, child, scripts, key) {
|
|
563
|
+
const reload = child.reloading.then(() => new Promise((resolve) => {
|
|
564
|
+
const settle = (ended) => {
|
|
565
|
+
resolve(ended.kind === "stopped" ? { host, stopped: true } : { host, error: ended.error });
|
|
566
|
+
};
|
|
567
|
+
if (child.ended !== undefined) {
|
|
568
|
+
settle(child.ended);
|
|
569
|
+
return;
|
|
570
|
+
}
|
|
571
|
+
child.reloaded = (reply) => {
|
|
572
|
+
child.reloaded = undefined;
|
|
573
|
+
if ("report" in reply) {
|
|
574
|
+
if (reply.report.failed.length === 0)
|
|
575
|
+
child.shipped = key;
|
|
576
|
+
resolve({ host, report: uncrossedReport(reply.report) });
|
|
577
|
+
}
|
|
578
|
+
else if (child.ended !== undefined) {
|
|
579
|
+
settle(child.ended);
|
|
580
|
+
}
|
|
581
|
+
else {
|
|
582
|
+
resolve({ host, error: uncrossed(reply.error) });
|
|
583
|
+
}
|
|
584
|
+
};
|
|
585
|
+
child.process.send({ kind: "reload", scripts });
|
|
586
|
+
}));
|
|
587
|
+
child.reloading = reload.then(() => { }, () => { });
|
|
588
|
+
return reload;
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
/** What new starts reject with once the component closes. */
|
|
592
|
+
function closed() {
|
|
593
|
+
return new ChordError({ code: "released", reason: "closed", message: "workers: closed" });
|
|
594
|
+
}
|
|
595
|
+
/** The public error of a running worker's lost link that fails its address (a second one within the window). */
|
|
596
|
+
const LINK_LOST = { message: "worker lost its link", code: "unavailable" };
|
|
597
|
+
/**
|
|
598
|
+
* The cause of `child`'s lost link (the heartbeat, a protocol error, its own close of its link) while it lives: after
|
|
599
|
+
* `ready`, one its address may recover from; before it, a failed start.
|
|
600
|
+
*/
|
|
601
|
+
function lostLink(child) {
|
|
602
|
+
const error = new Error("worker: link lost");
|
|
603
|
+
return child.status === "running" ? { error, public: LINK_LOST, lost: true } : { error };
|
|
604
|
+
}
|
|
605
|
+
/** The full error of an exit nobody asked for (the app's logs). */
|
|
606
|
+
function exitError(address, { code, signal }, child) {
|
|
607
|
+
const how = signal === null ? `code ${code}` : `signal ${signal}`;
|
|
608
|
+
const when = child.status === "starting" ? "exited before it was ready" : "exited";
|
|
609
|
+
return new ChordError({ code: "unavailable", message: `worker ${address.key}: ${when} (${how})` });
|
|
610
|
+
}
|
|
611
|
+
/** The public error of an exit: a start that failed, or the exit's code or signal. */
|
|
612
|
+
function publicExit({ code, signal }, child) {
|
|
613
|
+
if (child.status === "starting")
|
|
614
|
+
return START_FAILED;
|
|
615
|
+
return { message: `worker exited (${signal ?? `code ${code}`})`, code: "unavailable" };
|
|
616
|
+
}
|
|
617
|
+
/** A set's identity: its plugins and digests. */
|
|
618
|
+
function keyOf(scripts) {
|
|
619
|
+
return scripts
|
|
620
|
+
.map(({ plugin, built }) => `${plugin.name}@${built.kind === "script" ? built.digest : "failed"}`)
|
|
621
|
+
.sort()
|
|
622
|
+
.join("\n");
|
|
623
|
+
}
|
|
624
|
+
/** `entry`, or `host` listed with the abort's error once `context` aborts first (the entry goes on). */
|
|
625
|
+
async function bounded(host, entry, context) {
|
|
626
|
+
try {
|
|
627
|
+
return await awaitWithContext(entry, context);
|
|
628
|
+
}
|
|
629
|
+
catch (error) {
|
|
630
|
+
return { host, error };
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
/** The workers' state: a JSON watchable of every address's `WorkerState`, published once per microtask turn. */
|
|
634
|
+
class WorkersState extends Source {
|
|
635
|
+
#addresses;
|
|
636
|
+
#value;
|
|
637
|
+
#scheduled = false;
|
|
638
|
+
constructor(addresses, batch) {
|
|
639
|
+
super(batch);
|
|
640
|
+
this.#addresses = addresses;
|
|
641
|
+
}
|
|
642
|
+
get value() {
|
|
643
|
+
this.#value ??= stateOf(this.#addresses);
|
|
644
|
+
// Plain JSON: statuses, numbers and crossed errors.
|
|
645
|
+
return this.#value;
|
|
646
|
+
}
|
|
647
|
+
deliver(context) {
|
|
648
|
+
const value = this.value;
|
|
649
|
+
this.publish(value, [["r", value]], false, context);
|
|
650
|
+
}
|
|
651
|
+
/** Something changed: published with the turn's other changes while someone watches or derives from it. */
|
|
652
|
+
refresh() {
|
|
653
|
+
this.#value = undefined;
|
|
654
|
+
if (this.#scheduled || (!this.watched && this.dependents.size === 0))
|
|
655
|
+
return;
|
|
656
|
+
this.#scheduled = true;
|
|
657
|
+
queueMicrotask(() => {
|
|
658
|
+
this.#scheduled = false;
|
|
659
|
+
this.batch.within(() => this.changed(), BACKGROUND_CONTEXT);
|
|
660
|
+
});
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
/** Every address's state: its child's, or its failure; none for an address with neither. */
|
|
664
|
+
function stateOf(addresses) {
|
|
665
|
+
const state = {};
|
|
666
|
+
for (const [key, { child, failure }] of addresses) {
|
|
667
|
+
if (failure !== undefined) {
|
|
668
|
+
state[key] = { status: "failed", ...failure };
|
|
669
|
+
}
|
|
670
|
+
else if (child !== undefined) {
|
|
671
|
+
const { pid, startedAt } = child.process;
|
|
672
|
+
state[key] = { status: child.status, pid, startedAt };
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
return state;
|
|
676
|
+
}
|
|
677
|
+
//# sourceMappingURL=workers.js.map
|