@diffra-ai/chord 0.0.0-stage → 0.2.2
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 +235 -0
- package/README.md +227 -2
- package/dist/context/index.d.ts +43 -0
- package/dist/context/index.d.ts.map +1 -0
- package/dist/context/index.js +112 -0
- package/dist/context/index.js.map +1 -0
- package/dist/contracts/accepts.d.ts +91 -0
- package/dist/contracts/accepts.d.ts.map +1 -0
- package/dist/contracts/accepts.js +145 -0
- package/dist/contracts/accepts.js.map +1 -0
- package/dist/contracts/contract.d.ts +238 -0
- package/dist/contracts/contract.d.ts.map +1 -0
- package/dist/contracts/contract.js +69 -0
- package/dist/contracts/contract.js.map +1 -0
- package/dist/contracts/declare.d.ts +144 -0
- package/dist/contracts/declare.d.ts.map +1 -0
- package/dist/contracts/declare.js +207 -0
- package/dist/contracts/declare.js.map +1 -0
- package/dist/contracts/evolve.d.ts +142 -0
- package/dist/contracts/evolve.d.ts.map +1 -0
- package/dist/contracts/evolve.js +216 -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 +61 -0
- package/dist/contracts/fingerprint.js.map +1 -0
- package/dist/contracts/history.d.ts +79 -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 +58 -0
- package/dist/contracts/host-kind.d.ts.map +1 -0
- package/dist/contracts/host-kind.js +122 -0
- package/dist/contracts/host-kind.js.map +1 -0
- package/dist/contracts/index.d.ts +8 -0
- package/dist/contracts/index.d.ts.map +1 -0
- package/dist/contracts/index.js +7 -0
- package/dist/contracts/index.js.map +1 -0
- package/dist/contracts/internal.d.ts +12 -0
- package/dist/contracts/internal.d.ts.map +1 -0
- package/dist/contracts/internal.js +11 -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 +55 -0
- package/dist/contracts/params.js.map +1 -0
- package/dist/contracts/schema.d.ts +144 -0
- package/dist/contracts/schema.d.ts.map +1 -0
- package/dist/contracts/schema.js +144 -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 +31 -0
- package/dist/data/failure.d.ts.map +1 -0
- package/dist/data/failure.js +78 -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 +28 -0
- package/dist/data/principal.d.ts.map +1 -0
- package/dist/data/principal.js +64 -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.d.ts +4 -0
- package/dist/delta/apply-immutable-trusted.d.ts.map +1 -0
- package/dist/delta/apply-immutable-trusted.js +126 -0
- package/dist/delta/apply-immutable-trusted.js.map +1 -0
- package/dist/delta/diff.d.ts +5 -0
- package/dist/delta/diff.d.ts.map +1 -0
- package/dist/delta/diff.js +435 -0
- package/dist/delta/diff.js.map +1 -0
- package/dist/delta/draft.d.ts +5 -0
- package/dist/delta/draft.d.ts.map +1 -0
- package/dist/delta/draft.js +2 -0
- package/dist/delta/draft.js.map +1 -0
- package/dist/delta/index.d.ts +120 -0
- package/dist/delta/index.d.ts.map +1 -0
- package/dist/delta/index.js +697 -0
- package/dist/delta/index.js.map +1 -0
- 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/revision-validator.d.ts +7 -0
- package/dist/delta/revision-validator.d.ts.map +1 -0
- package/dist/delta/revision-validator.js +71 -0
- package/dist/delta/revision-validator.js.map +1 -0
- package/dist/delta/tracker.d.ts +38 -0
- package/dist/delta/tracker.d.ts.map +1 -0
- package/dist/delta/tracker.js +2175 -0
- package/dist/delta/tracker.js.map +1 -0
- 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 +92 -0
- package/dist/documents/definition.d.ts.map +1 -0
- package/dist/documents/definition.js +81 -0
- package/dist/documents/definition.js.map +1 -0
- package/dist/documents/documents.d.ts +129 -0
- package/dist/documents/documents.d.ts.map +1 -0
- package/dist/documents/documents.js +258 -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 +81 -0
- package/dist/documents/handles.d.ts.map +1 -0
- package/dist/documents/handles.js +74 -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 +139 -0
- package/dist/documents/keyed-slot.d.ts.map +1 -0
- package/dist/documents/keyed-slot.js +478 -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 +120 -0
- package/dist/documents/persistence.d.ts.map +1 -0
- package/dist/documents/persistence.js +156 -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 +112 -0
- package/dist/documents/slot.d.ts.map +1 -0
- package/dist/documents/slot.js +190 -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 +445 -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 +63 -0
- package/dist/host/adapted.d.ts.map +1 -0
- package/dist/host/adapted.js +298 -0
- package/dist/host/adapted.js.map +1 -0
- package/dist/host/admission.d.ts +137 -0
- package/dist/host/admission.d.ts.map +1 -0
- package/dist/host/admission.js +290 -0
- package/dist/host/admission.js.map +1 -0
- package/dist/host/attempt.d.ts +417 -0
- package/dist/host/attempt.d.ts.map +1 -0
- package/dist/host/attempt.js +1490 -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 +97 -0
- package/dist/host/dependencies.d.ts.map +1 -0
- package/dist/host/dependencies.js +148 -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/events.d.ts +114 -0
- package/dist/host/events.d.ts.map +1 -0
- package/dist/host/events.js +191 -0
- package/dist/host/events.js.map +1 -0
- package/dist/host/facet.d.ts +106 -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-data.d.ts +62 -0
- package/dist/host/host-data.d.ts.map +1 -0
- package/dist/host/host-data.js +229 -0
- package/dist/host/host-data.js.map +1 -0
- package/dist/host/host.d.ts +641 -0
- package/dist/host/host.d.ts.map +1 -0
- package/dist/host/host.js +1449 -0
- package/dist/host/host.js.map +1 -0
- package/dist/host/index.d.ts +20 -0
- package/dist/host/index.d.ts.map +1 -0
- package/dist/host/index.js +7 -0
- package/dist/host/index.js.map +1 -0
- package/dist/host/internal.d.ts +13 -0
- package/dist/host/internal.d.ts.map +1 -0
- package/dist/host/internal.js +11 -0
- package/dist/host/internal.js.map +1 -0
- package/dist/host/list.d.ts +52 -0
- package/dist/host/list.d.ts.map +1 -0
- package/dist/host/list.js +149 -0
- package/dist/host/list.js.map +1 -0
- package/dist/host/members.d.ts +58 -0
- package/dist/host/members.d.ts.map +1 -0
- package/dist/host/members.js +178 -0
- package/dist/host/members.js.map +1 -0
- package/dist/host/named-query.d.ts +67 -0
- package/dist/host/named-query.d.ts.map +1 -0
- package/dist/host/named-query.js +166 -0
- package/dist/host/named-query.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 +388 -0
- package/dist/host/object.d.ts.map +1 -0
- package/dist/host/object.js +1527 -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/query-reader.d.ts +80 -0
- package/dist/host/query-reader.d.ts.map +1 -0
- package/dist/host/query-reader.js +182 -0
- package/dist/host/query-reader.js.map +1 -0
- package/dist/host/read-declarations.d.ts +75 -0
- package/dist/host/read-declarations.d.ts.map +1 -0
- package/dist/host/read-declarations.js +152 -0
- package/dist/host/read-declarations.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-events.d.ts +51 -0
- package/dist/host/reference-events.d.ts.map +1 -0
- package/dist/host/reference-events.js +133 -0
- package/dist/host/reference-events.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 +77 -0
- package/dist/host/reference-source.d.ts.map +1 -0
- package/dist/host/reference-source.js +326 -0
- package/dist/host/reference-source.js.map +1 -0
- package/dist/host/reference.d.ts +377 -0
- package/dist/host/reference.d.ts.map +1 -0
- package/dist/host/reference.js +986 -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-admission.d.ts +24 -0
- package/dist/host/route-admission.d.ts.map +1 -0
- package/dist/host/route-admission.js +238 -0
- package/dist/host/route-admission.js.map +1 -0
- package/dist/host/route.d.ts +88 -0
- package/dist/host/route.d.ts.map +1 -0
- package/dist/host/route.js +247 -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 +100 -0
- package/dist/host/staging.d.ts.map +1 -0
- package/dist/host/staging.js +413 -0
- package/dist/host/staging.js.map +1 -0
- package/dist/host/tiling.d.ts +57 -0
- package/dist/host/tiling.d.ts.map +1 -0
- package/dist/host/tiling.js +269 -0
- package/dist/host/tiling.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 +28 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- 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/json.d.ts +18 -0
- package/dist/json.d.ts.map +1 -0
- package/dist/json.js +124 -0
- package/dist/json.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 +574 -0
- package/dist/link/binary.js.map +1 -0
- package/dist/link/channel.d.ts +78 -0
- package/dist/link/channel.d.ts.map +1 -0
- package/dist/link/channel.js +252 -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 +278 -0
- package/dist/link/message.d.ts.map +1 -0
- package/dist/link/message.js +179 -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 +383 -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 +283 -0
- package/dist/node/app/app.d.ts.map +1 -0
- package/dist/node/app/app.js +598 -0
- package/dist/node/app/app.js.map +1 -0
- package/dist/node/app/archive.d.ts +44 -0
- package/dist/node/app/archive.d.ts.map +1 -0
- package/dist/node/app/archive.js +212 -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 +40 -0
- package/dist/node/app/data.d.ts.map +1 -0
- package/dist/node/app/data.js +47 -0
- package/dist/node/app/data.js.map +1 -0
- package/dist/node/app/ephemeral-sign-ins.d.ts +20 -0
- package/dist/node/app/ephemeral-sign-ins.d.ts.map +1 -0
- package/dist/node/app/ephemeral-sign-ins.js +69 -0
- package/dist/node/app/ephemeral-sign-ins.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 +388 -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 +70 -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/sign-ins.d.ts +74 -0
- package/dist/node/app/sign-ins.d.ts.map +1 -0
- package/dist/node/app/sign-ins.js +222 -0
- package/dist/node/app/sign-ins.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 +39 -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 +64 -0
- package/dist/node/http/admission.d.ts.map +1 -0
- package/dist/node/http/admission.js +137 -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 +114 -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 +62 -0
- package/dist/node/http/upgrades.d.ts.map +1 -0
- package/dist/node/http/upgrades.js +194 -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 +577 -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 +40 -0
- package/dist/node/plugins/install.d.ts.map +1 -0
- package/dist/node/plugins/install.js +215 -0
- package/dist/node/plugins/install.js.map +1 -0
- package/dist/node/plugins/plugins.d.ts +165 -0
- package/dist/node/plugins/plugins.d.ts.map +1 -0
- package/dist/node/plugins/plugins.js +268 -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 +70 -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 +40 -0
- package/dist/node/surfaces/bundle.d.ts.map +1 -0
- package/dist/node/surfaces/bundle.js +121 -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 +17 -0
- package/dist/node/surfaces/served.d.ts.map +1 -0
- package/dist/node/surfaces/served.js +44 -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 +42 -0
- package/dist/node/surfaces/tui.d.ts.map +1 -0
- package/dist/node/surfaces/tui.js +59 -0
- package/dist/node/surfaces/tui.js.map +1 -0
- package/dist/node/surfaces/web.d.ts +82 -0
- package/dist/node/surfaces/web.d.ts.map +1 -0
- package/dist/node/surfaces/web.js +122 -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 +260 -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 +43 -0
- package/dist/node/workers/process.d.ts.map +1 -0
- package/dist/node/workers/process.js +137 -0
- package/dist/node/workers/process.js.map +1 -0
- package/dist/node/workers/workers.d.ts +144 -0
- package/dist/node/workers/workers.d.ts.map +1 -0
- package/dist/node/workers/workers.js +723 -0
- package/dist/node/workers/workers.js.map +1 -0
- package/dist/output.d.ts +91 -0
- package/dist/output.d.ts.map +1 -0
- package/dist/output.js +362 -0
- package/dist/output.js.map +1 -0
- package/dist/react/hooks.d.ts +61 -0
- package/dist/react/hooks.d.ts.map +1 -0
- package/dist/react/hooks.js +119 -0
- package/dist/react/hooks.js.map +1 -0
- package/dist/react/index.d.ts +4 -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 +34 -0
- package/dist/remote/calls.d.ts.map +1 -0
- package/dist/remote/calls.js +75 -0
- package/dist/remote/calls.js.map +1 -0
- package/dist/remote/consumer.d.ts +59 -0
- package/dist/remote/consumer.d.ts.map +1 -0
- package/dist/remote/consumer.js +468 -0
- package/dist/remote/consumer.js.map +1 -0
- package/dist/remote/hold.d.ts +147 -0
- package/dist/remote/hold.d.ts.map +1 -0
- package/dist/remote/hold.js +653 -0
- package/dist/remote/hold.js.map +1 -0
- package/dist/remote/host-link.d.ts +81 -0
- package/dist/remote/host-link.d.ts.map +1 -0
- package/dist/remote/host-link.js +198 -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 +105 -0
- package/dist/remote/path.d.ts.map +1 -0
- package/dist/remote/path.js +197 -0
- package/dist/remote/path.js.map +1 -0
- package/dist/remote/provider.d.ts +113 -0
- package/dist/remote/provider.d.ts.map +1 -0
- package/dist/remote/provider.js +787 -0
- package/dist/remote/provider.js.map +1 -0
- package/dist/remote/relay.d.ts +126 -0
- package/dist/remote/relay.d.ts.map +1 -0
- package/dist/remote/relay.js +334 -0
- package/dist/remote/relay.js.map +1 -0
- package/dist/remote/remote-object.d.ts +181 -0
- package/dist/remote/remote-object.d.ts.map +1 -0
- package/dist/remote/remote-object.js +683 -0
- package/dist/remote/remote-object.js.map +1 -0
- package/dist/remote/replica.d.ts +66 -0
- package/dist/remote/replica.d.ts.map +1 -0
- package/dist/remote/replica.js +148 -0
- package/dist/remote/replica.js.map +1 -0
- package/dist/sqlite/cloudflare.d.ts +54 -0
- package/dist/sqlite/cloudflare.d.ts.map +1 -0
- package/dist/sqlite/cloudflare.js +144 -0
- package/dist/sqlite/cloudflare.js.map +1 -0
- package/dist/sqlite/database.d.ts +40 -0
- package/dist/sqlite/database.d.ts.map +1 -0
- package/dist/sqlite/database.js +2 -0
- package/dist/sqlite/database.js.map +1 -0
- package/dist/sqlite/index.d.ts +4 -0
- package/dist/sqlite/index.d.ts.map +1 -0
- package/dist/sqlite/index.js +3 -0
- package/dist/sqlite/index.js.map +1 -0
- package/dist/sqlite/migrations.d.ts +10 -0
- package/dist/sqlite/migrations.d.ts.map +1 -0
- package/dist/sqlite/migrations.js +33 -0
- package/dist/sqlite/migrations.js.map +1 -0
- package/dist/sqlite/node.d.ts +49 -0
- package/dist/sqlite/node.d.ts.map +1 -0
- package/dist/sqlite/node.js +197 -0
- package/dist/sqlite/node.js.map +1 -0
- package/dist/sqlite/schema.d.ts +3 -0
- package/dist/sqlite/schema.d.ts.map +1 -0
- package/dist/sqlite/schema.js +10 -0
- package/dist/sqlite/schema.js.map +1 -0
- package/dist/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 +56 -0
- package/dist/state/derive.d.ts.map +1 -0
- package/dist/state/derive.js +192 -0
- package/dist/state/derive.js.map +1 -0
- package/dist/state/framed.d.ts +43 -0
- package/dist/state/framed.d.ts.map +1 -0
- package/dist/state/framed.js +121 -0
- package/dist/state/framed.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 +7 -0
- package/dist/state/internal.d.ts.map +1 -0
- package/dist/state/internal.js +9 -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 +390 -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 +36 -0
- package/dist/store/archive.d.ts.map +1 -0
- package/dist/store/archive.js +140 -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/column-set.d.ts +64 -0
- package/dist/store/column-set.d.ts.map +1 -0
- package/dist/store/column-set.js +96 -0
- package/dist/store/column-set.js.map +1 -0
- package/dist/store/columns.d.ts +93 -0
- package/dist/store/columns.d.ts.map +1 -0
- package/dist/store/columns.js +87 -0
- package/dist/store/columns.js.map +1 -0
- package/dist/store/engine.d.ts +182 -0
- package/dist/store/engine.d.ts.map +1 -0
- package/dist/store/engine.js +290 -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 +131 -0
- package/dist/store/evaluate.js.map +1 -0
- package/dist/store/export.d.ts +30 -0
- package/dist/store/export.d.ts.map +1 -0
- package/dist/store/export.js +221 -0
- package/dist/store/export.js.map +1 -0
- package/dist/store/expression.d.ts +254 -0
- package/dist/store/expression.d.ts.map +1 -0
- package/dist/store/expression.js +577 -0
- package/dist/store/expression.js.map +1 -0
- package/dist/store/host-column.d.ts +22 -0
- package/dist/store/host-column.d.ts.map +1 -0
- package/dist/store/host-column.js +36 -0
- package/dist/store/host-column.js.map +1 -0
- package/dist/store/host-data.d.ts +100 -0
- package/dist/store/host-data.d.ts.map +1 -0
- package/dist/store/host-data.js +397 -0
- package/dist/store/host-data.js.map +1 -0
- package/dist/store/import-migration.d.ts +19 -0
- package/dist/store/import-migration.d.ts.map +1 -0
- package/dist/store/import-migration.js +124 -0
- package/dist/store/import-migration.js.map +1 -0
- package/dist/store/import.d.ts +12 -0
- package/dist/store/import.d.ts.map +1 -0
- package/dist/store/import.js +279 -0
- package/dist/store/import.js.map +1 -0
- package/dist/store/index.d.ts +19 -0
- package/dist/store/index.d.ts.map +1 -0
- package/dist/store/index.js +16 -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 +72 -0
- package/dist/store/live-query.d.ts.map +1 -0
- package/dist/store/live-query.js +162 -0
- package/dist/store/live-query.js.map +1 -0
- package/dist/store/open-query.d.ts +90 -0
- package/dist/store/open-query.d.ts.map +1 -0
- package/dist/store/open-query.js +201 -0
- package/dist/store/open-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/page.d.ts +14 -0
- package/dist/store/page.d.ts.map +1 -0
- package/dist/store/page.js +26 -0
- package/dist/store/page.js.map +1 -0
- package/dist/store/query.d.ts +65 -0
- package/dist/store/query.d.ts.map +1 -0
- package/dist/store/query.js +193 -0
- package/dist/store/query.js.map +1 -0
- package/dist/store/read-plan.d.ts +74 -0
- package/dist/store/read-plan.d.ts.map +1 -0
- package/dist/store/read-plan.js +324 -0
- package/dist/store/read-plan.js.map +1 -0
- package/dist/store/read.d.ts +81 -0
- package/dist/store/read.d.ts.map +1 -0
- package/dist/store/read.js +113 -0
- package/dist/store/read.js.map +1 -0
- package/dist/store/reads.d.ts +79 -0
- package/dist/store/reads.d.ts.map +1 -0
- package/dist/store/reads.js +255 -0
- package/dist/store/reads.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 +96 -0
- package/dist/store/rows.d.ts.map +1 -0
- package/dist/store/rows.js +222 -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 +123 -0
- package/dist/store/schema.js.map +1 -0
- package/dist/store/skip.d.ts +26 -0
- package/dist/store/skip.d.ts.map +1 -0
- package/dist/store/skip.js +66 -0
- package/dist/store/skip.js.map +1 -0
- package/dist/store/sql.d.ts +78 -0
- package/dist/store/sql.d.ts.map +1 -0
- package/dist/store/sql.js +244 -0
- package/dist/store/sql.js.map +1 -0
- package/dist/store/step.d.ts +52 -0
- package/dist/store/step.d.ts.map +1 -0
- package/dist/store/step.js +59 -0
- package/dist/store/step.js.map +1 -0
- package/dist/store/store.d.ts +192 -0
- package/dist/store/store.d.ts.map +1 -0
- package/dist/store/store.js +863 -0
- package/dist/store/store.js.map +1 -0
- package/dist/store/table-changes.d.ts +35 -0
- package/dist/store/table-changes.d.ts.map +1 -0
- package/dist/store/table-changes.js +127 -0
- package/dist/store/table-changes.js.map +1 -0
- package/dist/store/table-evolve.d.ts +82 -0
- package/dist/store/table-evolve.d.ts.map +1 -0
- package/dist/store/table-evolve.js +208 -0
- package/dist/store/table-evolve.js.map +1 -0
- package/dist/store/table-handle.d.ts +69 -0
- package/dist/store/table-handle.d.ts.map +1 -0
- package/dist/store/table-handle.js +92 -0
- package/dist/store/table-handle.js.map +1 -0
- package/dist/store/table-history.d.ts +78 -0
- package/dist/store/table-history.d.ts.map +1 -0
- package/dist/store/table-history.js +43 -0
- package/dist/store/table-history.js.map +1 -0
- package/dist/store/table-migration.d.ts +28 -0
- package/dist/store/table-migration.d.ts.map +1 -0
- package/dist/store/table-migration.js +212 -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 +91 -0
- package/dist/store/table.d.ts.map +1 -0
- package/dist/store/table.js +133 -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 +106 -0
- package/dist/surfaces/client.d.ts.map +1 -0
- package/dist/surfaces/client.js +280 -0
- package/dist/surfaces/client.js.map +1 -0
- package/dist/surfaces/connection.d.ts +53 -0
- package/dist/surfaces/connection.d.ts.map +1 -0
- package/dist/surfaces/connection.js +161 -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 +26 -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 +33 -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 +86 -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 +32 -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/surfaces/variant.d.ts +23 -0
- package/dist/surfaces/variant.d.ts.map +1 -0
- package/dist/surfaces/variant.js +18 -0
- package/dist/surfaces/variant.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 +169 -0
- package/dist/sync/client.d.ts.map +1 -0
- package/dist/sync/client.js +459 -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 +205 -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 +145 -0
- package/dist/sync/remote.d.ts.map +1 -0
- package/dist/sync/remote.js +59 -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 +73 -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 +26 -0
- package/dist/telemetry-ingest/facet.d.ts.map +1 -0
- package/dist/telemetry-ingest/facet.js +100 -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 +33 -0
- package/dist/telemetry-sqlite/index.d.ts.map +1 -0
- package/dist/telemetry-sqlite/index.js +113 -0
- package/dist/telemetry-sqlite/index.js.map +1 -0
- 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 +12 -0
- package/dist/telemetry-sqlite/store.d.ts.map +1 -0
- package/dist/telemetry-sqlite/store.js +121 -0
- package/dist/telemetry-sqlite/store.js.map +1 -0
- package/dist/telemetry.d.ts +1013 -0
- package/dist/telemetry.d.ts.map +1 -0
- package/dist/telemetry.js +518 -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 +8 -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 +62 -0
- package/dist/tui/scope.d.ts.map +1 -0
- package/dist/tui/scope.js +173 -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 +42 -0
- package/dist/web/page.d.ts.map +1 -0
- package/dist/web/page.js +96 -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/admission/design.md +178 -0
- package/docs/benchmarks.md +1182 -0
- package/docs/decisions.md +3760 -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 +3691 -0
- package/docs/durable-observers/book.md +432 -0
- package/docs/durable-observers/index.html +517 -0
- package/docs/events/spec.md +438 -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 +958 -0
- package/docs/guide-plugins-hosts/index.html +952 -0
- package/docs/host-keyed/spec.md +343 -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 +389 -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/shared-holds/design.md +339 -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-14-design.md +213 -0
- package/docs/slice-14.md +861 -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 +380 -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 +2170 -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 +200 -5
- package/src/delta/README.md +262 -0
|
@@ -0,0 +1,1490 @@
|
|
|
1
|
+
// Attempts (§6, §13, §14, §15): one activation of an object, a fresh instance each time. It is the `self` its factory
|
|
2
|
+
// declares with (handles to the object's documents and jobs, under its seal token); it runs the activation steps,
|
|
3
|
+
// each failing with its own kind; it takes the live object's calls and starts its routines and jobs; and it ends with
|
|
4
|
+
// its seal (slice 6a §1.3), the drain and the closes of its natives. A reload's restart drains it (decision "Reload
|
|
5
|
+
// restarts every affected object; old work finishes on old code"): its routines stop, it serves old work under its
|
|
6
|
+
// own contract, and it is sealed once that work settled. An attempt of an admitted type first runs its admission
|
|
7
|
+
// (`admission.ts`): it parks on the decision as on a dependency, hands its factory the admitted value, and follows
|
|
8
|
+
// the decision until its seal.
|
|
9
|
+
import { awaitWithContext, withAbortSignal, withContextValue, withTelemetry } from "../context/index.js";
|
|
10
|
+
import { contractData } from "../contracts/internal.js";
|
|
11
|
+
import { ChordError } from "../data/index.js";
|
|
12
|
+
import { asChordError, checkArgs, checkParams, invalid, openFailure } from "../data/internal.js";
|
|
13
|
+
import { SealToken, } from "../documents/internal.js";
|
|
14
|
+
import { Job } from "../jobs/internal.js";
|
|
15
|
+
import { Derive, WritableSource } from "../state/internal.js";
|
|
16
|
+
import { checkExposedOnce } from "../store/column-set.js";
|
|
17
|
+
import { checkLiveQuery, LiveQuery } from "../store/live-query.js";
|
|
18
|
+
import { tableSqlName } from "../store/sql.js";
|
|
19
|
+
import { TableHandle } from "../store/table-handle.js";
|
|
20
|
+
import { prepareTables } from "../store/table-migration.js";
|
|
21
|
+
import { capped, MAX_MESSAGE, OpenSpan, spanFailed, untraced } from "../telemetry.js";
|
|
22
|
+
import { AdaptedMembers } from "./adapted.js";
|
|
23
|
+
import { Decision, refuseAdmittedJob } from "./admission.js";
|
|
24
|
+
import { CallContext, withLinkedAbortSignal } from "./ctx.js";
|
|
25
|
+
import { Deadline } from "./deadline.js";
|
|
26
|
+
import { checkDependencies, ParkedLong, parkedCause, pinKeys } from "./dependencies.js";
|
|
27
|
+
import { OwnEventSource } from "./events.js";
|
|
28
|
+
import { FollowSource } from "./follow.js";
|
|
29
|
+
import { attachDerives, checkImplementation, contributionOf, } from "./members.js";
|
|
30
|
+
import { NamedQueryHandle, OwnQuery } from "./named-query.js";
|
|
31
|
+
import { drained, NativeHandle, } from "./native.js";
|
|
32
|
+
import { OPENING } from "./old-work.js";
|
|
33
|
+
import { firstOf, listName, listReader, liveReader, namedBuilders, oneSource, openReaders, readerSite, rowsReader, tableExpected, undeclaredTable, } from "./read-declarations.js";
|
|
34
|
+
import { ReexposedEvents } from "./reference-events.js";
|
|
35
|
+
import { retrySource } from "./retry-on.js";
|
|
36
|
+
import { Routines, } from "./routines.js";
|
|
37
|
+
/** A parked attempt whose check found nothing to wait for: the shared answer. */
|
|
38
|
+
const READY = { kind: "ready" };
|
|
39
|
+
/** No declarations of a kind: the shared empty list. */
|
|
40
|
+
const NONE = [];
|
|
41
|
+
/** A first dependency check that did not park: the shared answer. */
|
|
42
|
+
const NOT_PARKED = { done: true, cause: undefined };
|
|
43
|
+
/** No running work: the shared empty map. */
|
|
44
|
+
const NO_WORK = new Map();
|
|
45
|
+
/** Runs the bookkeeping of the work still in `work` (stuck past the drain) and forgets it. */
|
|
46
|
+
function cleanUp(work) {
|
|
47
|
+
if (work === undefined)
|
|
48
|
+
return;
|
|
49
|
+
for (const [running, cleanup] of work) {
|
|
50
|
+
work.delete(running);
|
|
51
|
+
cleanup?.();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/** The error of an object, or a getter, that waited `ms` without the object going live. */
|
|
55
|
+
export function notLive(label, ms) {
|
|
56
|
+
return new ChordError({ code: "unavailable", message: `${label}: did not become live within ${ms} ms` });
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* One attempt of an object. Activation: factory, documents hydrated (the object's slots), tables prepared and live
|
|
60
|
+
* queries run, references bound, then parked until every dependency is live (no timer: the deadline paused), then its
|
|
61
|
+
* own steps: natives opened one after another, followed sources attached, members checked, derives computed; bounded
|
|
62
|
+
* by the host's `readyTimeout`. Ending: sealed at once (calls aborted, its transactions refused and the one holding the
|
|
63
|
+
* line discarded, its job invocations cut off), then the drain, the closes in reverse, derives and live queries
|
|
64
|
+
* detached; its object releases its references. Documents and job runs stay on the object.
|
|
65
|
+
*/
|
|
66
|
+
export class Attempt {
|
|
67
|
+
#object;
|
|
68
|
+
/** The type its object was served as when it was made: its provider's `accepts` map its older consumers. */
|
|
69
|
+
#served;
|
|
70
|
+
/** Its shared mappings for the consumers of older versions (Q10), by version; made by the first. */
|
|
71
|
+
#adapted;
|
|
72
|
+
/** The object's context: the natives' closes run under it. */
|
|
73
|
+
#context;
|
|
74
|
+
/** Aborted when the attempt is abandoned or ends: openers, activation's waits and calls run under its signal. */
|
|
75
|
+
#abort = new AbortController();
|
|
76
|
+
/** The object's context under this attempt's signal, and its activation span while one is recorded. */
|
|
77
|
+
#opening;
|
|
78
|
+
#trace;
|
|
79
|
+
/** Its activation span while it runs (none when the host records nothing); a parked attempt resumes in a new one. */
|
|
80
|
+
#activation;
|
|
81
|
+
/** When it parked (`performance.now()`), while it is parked: `chord.park.duration` once it leaves. */
|
|
82
|
+
#parkedAt;
|
|
83
|
+
/** The seal token its handles and transactions carry (the seal fence). */
|
|
84
|
+
#token = new SealToken();
|
|
85
|
+
/** Its routines once they started (most attempts have none). */
|
|
86
|
+
#routineRun;
|
|
87
|
+
/** The documents it declared, by name: "declared twice" is per attempt. */
|
|
88
|
+
#declared = new Map();
|
|
89
|
+
/** Its factory's `at(key)` pins: the object holds them from its factory's return to the next one's (rule 6). */
|
|
90
|
+
#pins = [];
|
|
91
|
+
#declaring = false;
|
|
92
|
+
/** Set once it went live: its derives' failures are reported from then on (`derive_failed`). */
|
|
93
|
+
#isLive = false;
|
|
94
|
+
/** The checked implementation and, for a remote object, its variant, once activation checked them. */
|
|
95
|
+
#members;
|
|
96
|
+
#variant;
|
|
97
|
+
#derives = [];
|
|
98
|
+
/** Its followed sources, attached in declaration order after the natives. */
|
|
99
|
+
#follows = [];
|
|
100
|
+
#routines = new Routines();
|
|
101
|
+
#jobs = new Map();
|
|
102
|
+
/** The tables it declared, by name. */
|
|
103
|
+
#tables = new Map();
|
|
104
|
+
/** Its own live queries with what each reads, run at activation (after the tables are prepared), detached at its end. */
|
|
105
|
+
#queries = [];
|
|
106
|
+
/** Its readers of named queries (`self.liveQuery`, `self.count`), opened once its dependencies are live. */
|
|
107
|
+
#readers = [];
|
|
108
|
+
/** The names of the lists its factory declared: one list per name. */
|
|
109
|
+
#listed = new Set();
|
|
110
|
+
/** Follows a reader this attempt is parked on: its next adoption (a good run heals it) checks again. */
|
|
111
|
+
#readerWake = { invalidate: () => this.dependencyMoved(), sourceRetired: () => { } };
|
|
112
|
+
/** References this attempt declared with `self.get` (params checked), bound during activation. */
|
|
113
|
+
#references = [];
|
|
114
|
+
/**
|
|
115
|
+
* Its dependencies (`self.get` references and `self.registry` values) in declaration order: the parked cause and
|
|
116
|
+
* `parked_long` name the first that blocks. Made by the first; let go after the dependency check (a live attempt
|
|
117
|
+
* keeps none).
|
|
118
|
+
*/
|
|
119
|
+
#dependencies;
|
|
120
|
+
#natives = [];
|
|
121
|
+
/**
|
|
122
|
+
* Running calls' handlers, routine calls and job runs, each with its bookkeeping (call counts, `ctx.get`
|
|
123
|
+
* references): an ending attempt waits for them (the drain); the bookkeeping runs once, when its work settles or at
|
|
124
|
+
* teardown for work stuck past the drain (decision "The seal fence" (4)). One map and one reaction per piece of work:
|
|
125
|
+
* the call path costs no more than before the cleanups.
|
|
126
|
+
*/
|
|
127
|
+
#running = new Map();
|
|
128
|
+
/**
|
|
129
|
+
* Its running job invocations, as `#running`: the drain at its end waits for them (a restart's drain does not: they
|
|
130
|
+
* are cut at its seal). Made by the first.
|
|
131
|
+
*/
|
|
132
|
+
#runs;
|
|
133
|
+
/** What activation returns once the attempt was abandoned: a timeout, a cycle through its object, or its end. */
|
|
134
|
+
#abandoned;
|
|
135
|
+
/** Its dependencies while it is parked on them (the dependency check); `undefined` otherwise. */
|
|
136
|
+
#parked;
|
|
137
|
+
/** A dependency changed since the last check: the parked attempt checks again (one check per batch of changes). */
|
|
138
|
+
#moved = false;
|
|
139
|
+
/** What a parked attempt waiting for a change waits on; resolved after the change's batch. */
|
|
140
|
+
#changed;
|
|
141
|
+
/** A followed source's end while this attempt activated: it fails as it goes live (if its activation returned). */
|
|
142
|
+
#endedEarly;
|
|
143
|
+
/** Its registry reads, contributions, wake signals and writables, made by the first: most attempts have none. */
|
|
144
|
+
#registryDeclarations;
|
|
145
|
+
/** What its own event sources check (its seal) and count with, made by the first `self.events()`. */
|
|
146
|
+
#sourceOwner;
|
|
147
|
+
/** Its own event sources, detached at its end; made by the first. */
|
|
148
|
+
#sources;
|
|
149
|
+
/**
|
|
150
|
+
* Its first dependency check, for a reload (its report, its predecessor's references): waited for by someone, or
|
|
151
|
+
* done with why it parked (`undefined`: it did not). Made by the first who asks or by the check.
|
|
152
|
+
*/
|
|
153
|
+
#check;
|
|
154
|
+
/** What a reload did to it, made by the first such step (most attempts never meet one). */
|
|
155
|
+
#reloaded;
|
|
156
|
+
/** An admitted type's decision, from its `admit` until its object releases it (`releaseAdmission`). */
|
|
157
|
+
#decision;
|
|
158
|
+
/** What its decision allowed, from its first allow on: its factory's value. */
|
|
159
|
+
#admitted;
|
|
160
|
+
/** What its object was last told of its decision, from the allow on: the same object means nothing changed. */
|
|
161
|
+
#followed;
|
|
162
|
+
constructor(object, context, trace) {
|
|
163
|
+
this.#object = object;
|
|
164
|
+
this.#served = object.served;
|
|
165
|
+
this.#context = context;
|
|
166
|
+
// Its opener's calls are known as its object's: their gate waits are the object's edges for reload cycles.
|
|
167
|
+
this.#opening = withContextValue(OPENING, object, withAbortSignal(this.#abort.signal, context));
|
|
168
|
+
this.#trace = trace;
|
|
169
|
+
}
|
|
170
|
+
state(definition) {
|
|
171
|
+
this.#assertDeclaring("state");
|
|
172
|
+
const what = `state "${definition.name}"`;
|
|
173
|
+
if (this.#declared.has(definition.name))
|
|
174
|
+
throw new Error(`${this.#object.label}: ${what} is declared twice`);
|
|
175
|
+
if (definition.persist) {
|
|
176
|
+
this.#assertPersistable(what);
|
|
177
|
+
this.#object.claimDocuments("chord");
|
|
178
|
+
}
|
|
179
|
+
this.#declared.set(definition.name, definition);
|
|
180
|
+
return this.#object.documents.declare(definition, this.#token, this);
|
|
181
|
+
}
|
|
182
|
+
/** `handle.at(key)`: pins `key` of `slot` while this attempt's factory's pins are held, and returns its source. */
|
|
183
|
+
at(slot, key) {
|
|
184
|
+
this.#assertDeclaring("state(...).at");
|
|
185
|
+
this.#pins.push(slot.pin(key, this.#opening));
|
|
186
|
+
return slot.source(key);
|
|
187
|
+
}
|
|
188
|
+
table(definition) {
|
|
189
|
+
this.#assertDeclaring("table");
|
|
190
|
+
const object = this.#object;
|
|
191
|
+
const { served, label } = object;
|
|
192
|
+
const store = this.#assertPersistable(`table "${definition.name}"`);
|
|
193
|
+
if (this.#tables.has(definition.name))
|
|
194
|
+
throw new Error(`${label}: table "${definition.name}" is declared twice`);
|
|
195
|
+
checkExposedOnce(definition, [...this.#tables.values()].map((declared) => declared.definition), label);
|
|
196
|
+
const sqlName = tableSqlName(served.contract.name, definition.name);
|
|
197
|
+
object.claimTable(sqlName);
|
|
198
|
+
const owner = {
|
|
199
|
+
label,
|
|
200
|
+
scope: object.documents,
|
|
201
|
+
assertLive: () => object.documents.assertLive(),
|
|
202
|
+
fail: (error) => object.failLive(this, { kind: "broken", error }),
|
|
203
|
+
};
|
|
204
|
+
// The handle's rows are the definition's, typed by `C` and `K`.
|
|
205
|
+
const handle = new TableHandle(definition, sqlName, store, owner);
|
|
206
|
+
this.#tables.set(definition.name, handle);
|
|
207
|
+
return handle;
|
|
208
|
+
}
|
|
209
|
+
query(table, q, limit) {
|
|
210
|
+
this.#assertDeclaring("query");
|
|
211
|
+
const { host, label } = this.#object;
|
|
212
|
+
// Plugin code may pass any table: only a handle this attempt declared is taken (its object's own table).
|
|
213
|
+
const handle = table;
|
|
214
|
+
if (handle instanceof NamedQueryHandle)
|
|
215
|
+
throw tableExpected(label);
|
|
216
|
+
if (!(handle instanceof TableHandle) || this.#tables.get(handle.definition.name) !== handle) {
|
|
217
|
+
throw undeclaredTable(label, "query");
|
|
218
|
+
}
|
|
219
|
+
checkLiveQuery(handle.definition, q, limit, label);
|
|
220
|
+
const owner = {
|
|
221
|
+
label,
|
|
222
|
+
report: (error) => host.report({ kind: "query_failed", object: label, query: handle.definition.name, error }),
|
|
223
|
+
};
|
|
224
|
+
const { rows } = handle.definition;
|
|
225
|
+
// The owner's window: its value the rows themselves.
|
|
226
|
+
const live = new LiveQuery({ store: handle.store, batch: host.batch }, owner, {
|
|
227
|
+
kind: "rows",
|
|
228
|
+
// Checked above: a positive integer.
|
|
229
|
+
range: { limit: limit },
|
|
230
|
+
present: (items) => items,
|
|
231
|
+
});
|
|
232
|
+
const target = {
|
|
233
|
+
// The query is of `handle`'s table (checked above); every column of the row is read.
|
|
234
|
+
spec: { query: q, table: handle.sql.table, projection: {}, owner: handle },
|
|
235
|
+
// A table's rows hold its columns' values: scalars and JSON.
|
|
236
|
+
decode: (stored, context) => rows.decode(stored, context),
|
|
237
|
+
};
|
|
238
|
+
this.#queries.push({ live, target });
|
|
239
|
+
// Its rows are the table's, typed by `C`.
|
|
240
|
+
return live;
|
|
241
|
+
}
|
|
242
|
+
queries(table, options, builders) {
|
|
243
|
+
this.#assertDeclaring("queries");
|
|
244
|
+
const { label } = this.#object;
|
|
245
|
+
// Plugin code may pass any table: only a handle this attempt declared is taken (its object's own table).
|
|
246
|
+
const handle = table;
|
|
247
|
+
if (!(handle instanceof TableHandle) || this.#tables.get(handle.definition.name) !== handle) {
|
|
248
|
+
throw undeclaredTable(label, "queries");
|
|
249
|
+
}
|
|
250
|
+
// The mapping is the plugin's, typed by the table's rows; Chord hands it decoded rows.
|
|
251
|
+
const mapped = options;
|
|
252
|
+
const named = namedBuilders(label, builders).map(({ name, builder, args }) => [name, new OwnQuery(label, name, handle, builder, mapped, args)]);
|
|
253
|
+
// One named query per builder, typed by the mapping's items and the builders' arguments.
|
|
254
|
+
return Object.fromEntries(named);
|
|
255
|
+
}
|
|
256
|
+
liveQuery(query, args, range) {
|
|
257
|
+
this.#assertDeclaring("liveQuery");
|
|
258
|
+
const { reader, source } = rowsReader(this.#readerSite(), query, args, range);
|
|
259
|
+
this.#readers.push(reader);
|
|
260
|
+
// Its value is what `present` builds from the query's items.
|
|
261
|
+
return source;
|
|
262
|
+
}
|
|
263
|
+
count(query, args) {
|
|
264
|
+
this.#assertDeclaring("count");
|
|
265
|
+
const { reader, source } = liveReader(this.#readerSite(), "count", query, args, { kind: "count" });
|
|
266
|
+
this.#readers.push(reader);
|
|
267
|
+
// A count's value is its number.
|
|
268
|
+
return source;
|
|
269
|
+
}
|
|
270
|
+
list(name, sources, options) {
|
|
271
|
+
this.#assertDeclaring("list");
|
|
272
|
+
const at = this.#readerSite();
|
|
273
|
+
const first = firstOf(at.label, "list", options);
|
|
274
|
+
const source = oneSource(at.label, sources);
|
|
275
|
+
// Checked last: a list refused for another reason does not take its name.
|
|
276
|
+
const listed = listName(at.label, name, this.#listed);
|
|
277
|
+
const { reader, list } = listReader(at, listed, source, first, this.#object.listMemory(listed));
|
|
278
|
+
this.#readers.push(reader);
|
|
279
|
+
// Its value is `{ rows, moreAfter }` of the query's items.
|
|
280
|
+
return { value: list, more: (ctx) => list.more(ctx) };
|
|
281
|
+
}
|
|
282
|
+
/** Where this attempt's readers live. */
|
|
283
|
+
#readerSite() {
|
|
284
|
+
const { host, label } = this.#object;
|
|
285
|
+
return readerSite(host, label, () => this.dependencyMoved());
|
|
286
|
+
}
|
|
287
|
+
derive(sources, compute) {
|
|
288
|
+
this.#assertDeclaring("derive");
|
|
289
|
+
// The values are the sources' values, in order; the result is `T`.
|
|
290
|
+
const derive = new Derive(sources, compute, this.#object.host.batch);
|
|
291
|
+
this.#derives.push(derive);
|
|
292
|
+
return derive;
|
|
293
|
+
}
|
|
294
|
+
get(Type, params) {
|
|
295
|
+
this.#assertDeclaring("get");
|
|
296
|
+
const { host } = this.#object;
|
|
297
|
+
const checked = checkParams(Type, params, this.#opening);
|
|
298
|
+
const binding = host.reference(Type, this.#object, this.#caller(), {});
|
|
299
|
+
this.#references.push({ binding, contract: Type, params: checked });
|
|
300
|
+
this.#dependencies ??= [];
|
|
301
|
+
this.#dependencies.push({ kind: "reference", binding });
|
|
302
|
+
// The binding was built from `Type`'s members.
|
|
303
|
+
return binding.reference;
|
|
304
|
+
}
|
|
305
|
+
registry(R) {
|
|
306
|
+
this.#assertDeclaring("registry");
|
|
307
|
+
const value = this.#object.host.registryRecord(R.name).value(R.version);
|
|
308
|
+
this.#dependencies ??= [];
|
|
309
|
+
this.#dependencies.push({ kind: "registry", value });
|
|
310
|
+
// Its values are the composition as `R`'s version has it, `V`.
|
|
311
|
+
return value;
|
|
312
|
+
}
|
|
313
|
+
writable(initial) {
|
|
314
|
+
this.#assertDeclaring("writable");
|
|
315
|
+
const owner = {
|
|
316
|
+
context: this.#context,
|
|
317
|
+
assertUsable: () => {
|
|
318
|
+
if (this.#token.sealed)
|
|
319
|
+
throw this.#object.ended();
|
|
320
|
+
},
|
|
321
|
+
};
|
|
322
|
+
const writable = new WritableSource(initial, owner, this.#object.host.batch);
|
|
323
|
+
this.#declarations().writables.push(writable);
|
|
324
|
+
return writable;
|
|
325
|
+
}
|
|
326
|
+
events() {
|
|
327
|
+
this.#assertDeclaring("events");
|
|
328
|
+
const object = this.#object;
|
|
329
|
+
this.#sourceOwner ??= {
|
|
330
|
+
events: object.host.events,
|
|
331
|
+
sealed: () => (this.#token.sealed ? object.ended() : undefined),
|
|
332
|
+
};
|
|
333
|
+
const source = new OwnEventSource(this.#sourceOwner);
|
|
334
|
+
this.#sources ??= [];
|
|
335
|
+
this.#sources.push(source);
|
|
336
|
+
// Its values are `T`: JSON the object emits, never validated (as state).
|
|
337
|
+
return source;
|
|
338
|
+
}
|
|
339
|
+
retryOn(...sources) {
|
|
340
|
+
this.#assertDeclaring("retryOn");
|
|
341
|
+
const { retrySources } = this.#declarations();
|
|
342
|
+
for (const source of sources)
|
|
343
|
+
retrySources.push(retrySource(source, this.#object.label));
|
|
344
|
+
}
|
|
345
|
+
contribute(R, value) {
|
|
346
|
+
this.#assertDeclaring("contribute");
|
|
347
|
+
const { served, label } = this.#object;
|
|
348
|
+
// R21: the types allow it only to host-lifetime objects; plugin code is bundled without type checks.
|
|
349
|
+
if (served.kind !== "local" || !served.hostLifetime) {
|
|
350
|
+
throw new Error(`${label}: self.contribute is valid only in a local type with empty params`);
|
|
351
|
+
}
|
|
352
|
+
const { declared } = this.#declarations();
|
|
353
|
+
if (declared.some(({ registry }) => registry.name === R.name)) {
|
|
354
|
+
throw new Error(`${label}: registry ${R.name} is contributed to twice`);
|
|
355
|
+
}
|
|
356
|
+
declared.push({ registry: R, value });
|
|
357
|
+
}
|
|
358
|
+
open(open, close, options = {}) {
|
|
359
|
+
this.#assertDeclaring("open");
|
|
360
|
+
const { host, label } = this.#object;
|
|
361
|
+
const closeTimeout = options.closeTimeout ?? host.timeouts.close;
|
|
362
|
+
const owner = {
|
|
363
|
+
object: label,
|
|
364
|
+
type: this.#object.served.contract.name,
|
|
365
|
+
position: this.#natives.length + 1,
|
|
366
|
+
context: this.#context,
|
|
367
|
+
telemetry: host.telemetry,
|
|
368
|
+
host: host.spanHost,
|
|
369
|
+
report: (error) => host.report(error),
|
|
370
|
+
};
|
|
371
|
+
const native = new NativeHandle(open, close, closeTimeout, owner);
|
|
372
|
+
this.#natives.push(native);
|
|
373
|
+
return native;
|
|
374
|
+
}
|
|
375
|
+
tx(fn, context) {
|
|
376
|
+
return this.#object.documents.tx(fn, this.#token, context);
|
|
377
|
+
}
|
|
378
|
+
follow(attach) {
|
|
379
|
+
this.#assertDeclaring("follow");
|
|
380
|
+
const object = this.#object;
|
|
381
|
+
const owner = { label: object.label, context: this.#context, ended: (end) => this.#followEnded(end) };
|
|
382
|
+
// The source holds what the runtime gives it, `T`, as Chord's JSON sources do.
|
|
383
|
+
const source = new FollowSource(attach, owner, object.host.batch);
|
|
384
|
+
this.#follows.push(source);
|
|
385
|
+
return source;
|
|
386
|
+
}
|
|
387
|
+
on(source, fn) {
|
|
388
|
+
this.#assertDeclaring("on");
|
|
389
|
+
this.#routines.on(source, fn);
|
|
390
|
+
}
|
|
391
|
+
onLive(fn) {
|
|
392
|
+
this.#assertDeclaring("onLive");
|
|
393
|
+
this.#routines.onLive(fn);
|
|
394
|
+
}
|
|
395
|
+
job(definition, implementation) {
|
|
396
|
+
this.#assertDeclaring("job");
|
|
397
|
+
const object = this.#object;
|
|
398
|
+
refuseAdmittedJob(this.#served, object.label);
|
|
399
|
+
if (this.#jobs.has(definition.name)) {
|
|
400
|
+
throw new Error(`${object.label}: job "${definition.name}" is declared twice`);
|
|
401
|
+
}
|
|
402
|
+
if (definition.persist !== undefined) {
|
|
403
|
+
this.#assertPersistable(`job "${definition.name}"`);
|
|
404
|
+
object.claimDocuments("chord.jobs");
|
|
405
|
+
object.claimDocuments("chord.job-states");
|
|
406
|
+
}
|
|
407
|
+
const owner = {
|
|
408
|
+
host: object.host,
|
|
409
|
+
caller: this.#caller(),
|
|
410
|
+
context: this.#context,
|
|
411
|
+
signal: this.#abort.signal,
|
|
412
|
+
token: this.#token,
|
|
413
|
+
documents: object.documents,
|
|
414
|
+
admit: (running, cleanup) => this.#admit(this.#running, running, cleanup),
|
|
415
|
+
admitRun: (running, cleanup) => {
|
|
416
|
+
this.#runs ??= new Map();
|
|
417
|
+
this.#admit(this.#runs, running, cleanup);
|
|
418
|
+
},
|
|
419
|
+
};
|
|
420
|
+
// The job keeps its runs as JSON and calls the implementation with them; the handle types them again.
|
|
421
|
+
const records = object.jobRecords(definition);
|
|
422
|
+
const job = new Job(records, implementation, owner);
|
|
423
|
+
this.#jobs.set(definition.name, job);
|
|
424
|
+
return job;
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* Activates once `ending` (the previous instance's) has finished; `readyTimeout` bounds both (an attempt abandoned
|
|
428
|
+
* while it waits has opened nothing). An admitted type's admission runs before that wait (slice 14 §2.2): only its
|
|
429
|
+
* factory waits for the previous instance's teardown.
|
|
430
|
+
*/
|
|
431
|
+
async activate(ending) {
|
|
432
|
+
this.#startActivation(this.#trace.trigger);
|
|
433
|
+
const { ready } = this.#object.host.timeouts;
|
|
434
|
+
const deadline = new Deadline(ready, () => {
|
|
435
|
+
this.abandon({ kind: "failed", cause: { kind: "transient", error: notLive(this.#object.label, ready) } });
|
|
436
|
+
});
|
|
437
|
+
try {
|
|
438
|
+
const served = this.#served;
|
|
439
|
+
if (served.kind === "remote" && served.admission !== undefined) {
|
|
440
|
+
const refused = await this.#runAdmission(served.admission, deadline);
|
|
441
|
+
if (refused !== undefined)
|
|
442
|
+
return refused;
|
|
443
|
+
this.#activation?.span.addEvent("chord.admit", { outcome: "allow" });
|
|
444
|
+
}
|
|
445
|
+
if (ending !== undefined) {
|
|
446
|
+
try {
|
|
447
|
+
await awaitWithContext(ending, this.#opening);
|
|
448
|
+
}
|
|
449
|
+
catch {
|
|
450
|
+
// An ending never rejects: only an abandonment (the deadline) ends this wait early.
|
|
451
|
+
return this.#abandoned;
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
return await this.#activate(deadline);
|
|
455
|
+
}
|
|
456
|
+
finally {
|
|
457
|
+
deadline.clear();
|
|
458
|
+
// Ended before its first dependency check (its factory threw, it was abandoned): nothing parked.
|
|
459
|
+
this.#settleCheck(undefined);
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* The admission phase (slice 14 §2.2): one microtask after its start (a seal's flush has ended by then), `admit`
|
|
464
|
+
* declares against this attempt's decision, whose requests are bound at once (its object then lets its
|
|
465
|
+
* predecessors' go). The attempt parks on them, and on a denial showing `failed { denied }`, with no timer, and goes
|
|
466
|
+
* on with the first allow. Resolves `undefined` once allowed, else with how the attempt ends.
|
|
467
|
+
*/
|
|
468
|
+
async #runAdmission(admission, deadline) {
|
|
469
|
+
await undefined;
|
|
470
|
+
if (this.#abandoned !== undefined)
|
|
471
|
+
return this.#abandoned;
|
|
472
|
+
const object = this.#object;
|
|
473
|
+
const decision = new Decision({
|
|
474
|
+
host: object.host,
|
|
475
|
+
label: object.label,
|
|
476
|
+
caller: this.#caller(),
|
|
477
|
+
dependent: object,
|
|
478
|
+
moved: () => this.#admissionMoved(),
|
|
479
|
+
});
|
|
480
|
+
try {
|
|
481
|
+
// A remote object's identity has its principal.
|
|
482
|
+
decision.declare((self) => admission.admit(object.params, object.principal, self), this.#opening);
|
|
483
|
+
}
|
|
484
|
+
catch (error) {
|
|
485
|
+
decision.release();
|
|
486
|
+
return this.#broken(error);
|
|
487
|
+
}
|
|
488
|
+
this.#decision = decision;
|
|
489
|
+
object.admitting(this);
|
|
490
|
+
return this.#park(decision.dependencies, (long) => this.#decide(decision, long), deadline);
|
|
491
|
+
}
|
|
492
|
+
/** One check of its admission while it parks on it: allowed, it goes on; denied, it shows `failed { denied }`. */
|
|
493
|
+
async #decide(decision, long) {
|
|
494
|
+
this.#admitted = undefined;
|
|
495
|
+
const verdict = await decision.settle(long, this.#opening);
|
|
496
|
+
if (verdict.kind === "allow") {
|
|
497
|
+
this.#admitted = verdict;
|
|
498
|
+
this.#followed = verdict;
|
|
499
|
+
return READY;
|
|
500
|
+
}
|
|
501
|
+
if (verdict.kind !== "deny")
|
|
502
|
+
return verdict;
|
|
503
|
+
const cause = { kind: "denied", error: verdict.error };
|
|
504
|
+
const activation = this.#activation;
|
|
505
|
+
if (activation !== undefined && !activation.ended)
|
|
506
|
+
activation.span.addEvent("chord.admit", { outcome: "deny" });
|
|
507
|
+
return { kind: "parked", shown: { kind: "failed", cause, retryAt: undefined }, firstPass: true, cause };
|
|
508
|
+
}
|
|
509
|
+
/**
|
|
510
|
+
* Something its admission reads changed. While it still decides, its parked check runs again. From its allow on it
|
|
511
|
+
* follows the decision (slice 14 §2.2, "Watch"), live, opening its natives or draining for a reload alike: an equal
|
|
512
|
+
* decision changes nothing; anything else (another value, a denial, a source that failed or ended) is its object's
|
|
513
|
+
* to act on, which seals it at once and admits afresh. It goes on following after its own failure, so its failed
|
|
514
|
+
* object still shows a denial; a later attempt's admission takes over once it bound.
|
|
515
|
+
*/
|
|
516
|
+
#admissionMoved() {
|
|
517
|
+
if (this.#admitted === undefined) {
|
|
518
|
+
this.dependencyMoved();
|
|
519
|
+
return;
|
|
520
|
+
}
|
|
521
|
+
const verdict = this.#decision.now(this.#opening);
|
|
522
|
+
if (verdict === this.#followed)
|
|
523
|
+
return;
|
|
524
|
+
this.#followed = verdict;
|
|
525
|
+
this.#object.readmit(this, verdict);
|
|
526
|
+
}
|
|
527
|
+
/** What its admission allowed (its factory's value); `undefined` before its first allow and without an admission. */
|
|
528
|
+
get admitted() {
|
|
529
|
+
return this.#admitted;
|
|
530
|
+
}
|
|
531
|
+
/** Whether it was sealed: its object lets a sealed attempt's admission go once a later one bound its requests. */
|
|
532
|
+
get sealed() {
|
|
533
|
+
return this.#token.sealed;
|
|
534
|
+
}
|
|
535
|
+
/** Releases what its admission declared (its references, registry reads, derives and live queries); once. */
|
|
536
|
+
releaseAdmission() {
|
|
537
|
+
this.#decision?.release();
|
|
538
|
+
}
|
|
539
|
+
/** Its current (or last) activation span; `undefined` when the host records nothing. */
|
|
540
|
+
get activationSpan() {
|
|
541
|
+
return this.#activation?.span;
|
|
542
|
+
}
|
|
543
|
+
/**
|
|
544
|
+
* Its activation's outcome, as its object took it: its span ends with it (a failure's error and a transient one's
|
|
545
|
+
* backoff an event). An attempt still parked (its span ended `parked`) that fails or ends there records it in a short
|
|
546
|
+
* span linked to the parked one, as its resumed steps would run in one (review L4).
|
|
547
|
+
*/
|
|
548
|
+
activated(outcome) {
|
|
549
|
+
const current = this.#activation;
|
|
550
|
+
if (current === undefined)
|
|
551
|
+
return;
|
|
552
|
+
if (current.ended) {
|
|
553
|
+
if (outcome.kind === "live")
|
|
554
|
+
return;
|
|
555
|
+
this.#startActivation(current.span);
|
|
556
|
+
}
|
|
557
|
+
const activation = this.#activation;
|
|
558
|
+
const { span } = activation;
|
|
559
|
+
if (outcome.kind === "failed") {
|
|
560
|
+
spanFailed(span, "activation_failed", outcome.cause.error);
|
|
561
|
+
if (outcome.retryAt !== undefined)
|
|
562
|
+
span.addEvent("chord.retry", { backoff: Math.max(0, outcome.retryAt - Date.now()) });
|
|
563
|
+
}
|
|
564
|
+
span.setAttributes({ outcome: outcome.kind });
|
|
565
|
+
activation.end();
|
|
566
|
+
}
|
|
567
|
+
/**
|
|
568
|
+
* Starts an activation span on the host's adapter linked to `link` (none when it records nothing); the activation's
|
|
569
|
+
* steps (its natives' opens, its references' holds) run under it.
|
|
570
|
+
*/
|
|
571
|
+
#startActivation(link) {
|
|
572
|
+
const { host, served, label } = this.#object;
|
|
573
|
+
if (untraced(host.telemetry))
|
|
574
|
+
return;
|
|
575
|
+
const attributes = {
|
|
576
|
+
"chord.host": host.spanHost,
|
|
577
|
+
type: served.contract.name,
|
|
578
|
+
object: capped(label),
|
|
579
|
+
attempt: this.#trace.attempt,
|
|
580
|
+
};
|
|
581
|
+
const activation = new OpenSpan(host.telemetry, "chord.activate", attributes);
|
|
582
|
+
if (!untraced(link))
|
|
583
|
+
activation.span.addLink({ context: link });
|
|
584
|
+
this.#activation = activation;
|
|
585
|
+
this.#opening = withTelemetry(activation.span, this.#opening);
|
|
586
|
+
}
|
|
587
|
+
/** It parked showing `shown`: its activation span ends `parked` with the cause as an event. */
|
|
588
|
+
#parkedOn(shown) {
|
|
589
|
+
this.#parkedAt ??= performance.now();
|
|
590
|
+
const activation = this.#activation;
|
|
591
|
+
if (activation === undefined || activation.ended)
|
|
592
|
+
return;
|
|
593
|
+
const cause = shown.kind === "failed" ? shown.cause.error.message.slice(0, MAX_MESSAGE) : "loading";
|
|
594
|
+
activation.span.addEvent("chord.park", { cause });
|
|
595
|
+
activation.span.setAttributes({ outcome: "parked" });
|
|
596
|
+
activation.end();
|
|
597
|
+
}
|
|
598
|
+
/** It leaves its parking (its dependencies live, or abandoned): its park's duration is recorded. */
|
|
599
|
+
#parkEnded() {
|
|
600
|
+
if (this.#parkedAt === undefined)
|
|
601
|
+
return;
|
|
602
|
+
this.#object.host.metrics.histogram("chord.park.duration").record(performance.now() - this.#parkedAt);
|
|
603
|
+
this.#parkedAt = undefined;
|
|
604
|
+
}
|
|
605
|
+
/** Abandons the activation with `outcome` (once): its waits stop and the openers' contexts are aborted. */
|
|
606
|
+
abandon(outcome) {
|
|
607
|
+
if (this.#abandoned !== undefined)
|
|
608
|
+
return;
|
|
609
|
+
this.#abandoned = outcome;
|
|
610
|
+
const reason = outcome.kind === "ended" ? outcome.error : outcome.cause.error;
|
|
611
|
+
this.#abort.abort(reason);
|
|
612
|
+
this.#stopRoutines(reason);
|
|
613
|
+
}
|
|
614
|
+
/**
|
|
615
|
+
* A followed runtime ended its observer (R4): `failed` fails this attempt `transient`, live or activating; `ended`
|
|
616
|
+
* does only while it activates (it would go live over a source that ended). An activation that already returned
|
|
617
|
+
* fails as it goes live.
|
|
618
|
+
*/
|
|
619
|
+
#followEnded(end) {
|
|
620
|
+
if (end.kind === "ended" && this.#isLive)
|
|
621
|
+
return;
|
|
622
|
+
const { label } = this.#object;
|
|
623
|
+
const error = end.kind === "failed"
|
|
624
|
+
? asChordError(end.error, label)
|
|
625
|
+
: new ChordError({ code: "unavailable", message: `${label}: a followed source ended while it activated` });
|
|
626
|
+
if (this.#isLive) {
|
|
627
|
+
this.#object.failLive(this, { kind: "transient", error });
|
|
628
|
+
return;
|
|
629
|
+
}
|
|
630
|
+
this.#endedEarly ??= error;
|
|
631
|
+
this.abandon({ kind: "failed", cause: { kind: "transient", error } });
|
|
632
|
+
}
|
|
633
|
+
/** The object went live: its jobs take starts and its routines start, in this turn; both stop when it is sealed. */
|
|
634
|
+
live() {
|
|
635
|
+
this.#isLive = true;
|
|
636
|
+
const early = this.#endedEarly;
|
|
637
|
+
if (early !== undefined) {
|
|
638
|
+
this.#object.failLive(this, { kind: "transient", error: early });
|
|
639
|
+
return;
|
|
640
|
+
}
|
|
641
|
+
for (const job of this.#jobs.values())
|
|
642
|
+
job.live();
|
|
643
|
+
if (!this.#routines.empty)
|
|
644
|
+
this.#startRoutines();
|
|
645
|
+
}
|
|
646
|
+
/** Starts its routines, unless it was sealed meanwhile. */
|
|
647
|
+
#startRoutines() {
|
|
648
|
+
if (this.#abandoned !== undefined || this.#reloaded?.routinesStopped === true)
|
|
649
|
+
return;
|
|
650
|
+
const { host, label } = this.#object;
|
|
651
|
+
const run = { abort: new AbortController(), calls: new Map() };
|
|
652
|
+
this.#routineRun = run;
|
|
653
|
+
this.#routines.start({
|
|
654
|
+
label,
|
|
655
|
+
type: this.#object.served.contract.name,
|
|
656
|
+
host,
|
|
657
|
+
caller: this.#caller(),
|
|
658
|
+
context: withAbortSignal(run.abort.signal, this.#context),
|
|
659
|
+
admit: (running, cleanup) => this.#admit(run.calls, running, cleanup),
|
|
660
|
+
});
|
|
661
|
+
}
|
|
662
|
+
/** Its routines stop with `reason` (or may not start any more: `#startRoutines` asks the abandonment too). */
|
|
663
|
+
#stopRoutines(reason) {
|
|
664
|
+
this.#routineRun?.abort.abort(reason);
|
|
665
|
+
}
|
|
666
|
+
/** Its routines stop (their ctx aborted); their running calls are waited for by the drain. */
|
|
667
|
+
stopRoutines() {
|
|
668
|
+
this.#reload().routinesStopped = true;
|
|
669
|
+
this.#stopRoutines(new ChordError({ code: "released", reason: "ended", message: `${this.#object.label}: reloaded` }));
|
|
670
|
+
}
|
|
671
|
+
/**
|
|
672
|
+
* A restart drains it: from now on it serves old work (calls caused by calls on old attempts, routed by its object)
|
|
673
|
+
* until its seal, counted as the host's old work.
|
|
674
|
+
*/
|
|
675
|
+
beginDrain() {
|
|
676
|
+
this.#reload().callsDrained = true;
|
|
677
|
+
this.#object.host.oldWork.open();
|
|
678
|
+
}
|
|
679
|
+
/** Whether a restart drains it and it is not sealed yet: old work runs on it. */
|
|
680
|
+
get draining() {
|
|
681
|
+
return this.#reloaded?.callsDrained === true && this.#abandoned === undefined;
|
|
682
|
+
}
|
|
683
|
+
/**
|
|
684
|
+
* Waits until no call or routine call runs on it, routed old work included (it joins while the drain runs), or until
|
|
685
|
+
* `due` (`Date.now()` time; `drain_timeout` reported). Its end's drain then waits for them no more.
|
|
686
|
+
*/
|
|
687
|
+
async drainCalls(due) {
|
|
688
|
+
const { host, label } = this.#object;
|
|
689
|
+
for (;;) {
|
|
690
|
+
const calls = [...this.#running.keys(), ...(this.#routineRun?.calls ?? NO_WORK).keys()];
|
|
691
|
+
if (calls.length === 0)
|
|
692
|
+
return;
|
|
693
|
+
const left = due - Date.now();
|
|
694
|
+
if (left <= 0 || (await drained(calls, calls.length, left)) === "timeout") {
|
|
695
|
+
host.report({ kind: "drain_timeout", object: label });
|
|
696
|
+
return;
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
/** The type it was made with: its contract and provider (old work and its consumers use it by that contract). */
|
|
701
|
+
get served() {
|
|
702
|
+
return this.#served;
|
|
703
|
+
}
|
|
704
|
+
/** A reload started it: once live, its object retries its blocked job runs (slice 7b §8). */
|
|
705
|
+
startedByReload() {
|
|
706
|
+
this.#reload().started = true;
|
|
707
|
+
}
|
|
708
|
+
/** Whether a reload started it. */
|
|
709
|
+
get reloadStarted() {
|
|
710
|
+
return this.#reloaded?.started === true;
|
|
711
|
+
}
|
|
712
|
+
/** What a reload did to it, made by the first such step. */
|
|
713
|
+
#reload() {
|
|
714
|
+
this.#reloaded ??= { started: false, callsDrained: false, routinesStopped: false };
|
|
715
|
+
return this.#reloaded;
|
|
716
|
+
}
|
|
717
|
+
/** Whether its factory declared job `name`. */
|
|
718
|
+
declaresJob(name) {
|
|
719
|
+
return this.#jobs.has(name);
|
|
720
|
+
}
|
|
721
|
+
/** Whether its factory opens natives (`self.open`): a restart's contributions then leave at its seal (F-b). */
|
|
722
|
+
get opensNatives() {
|
|
723
|
+
return this.#natives.length > 0;
|
|
724
|
+
}
|
|
725
|
+
/**
|
|
726
|
+
* Its first dependency check: why it parked (`parkedCause`), `undefined` when it went on (its dependencies live) or
|
|
727
|
+
* its activation ended before (its predecessor's references are released once it is done).
|
|
728
|
+
*/
|
|
729
|
+
get checked() {
|
|
730
|
+
const check = this.#check;
|
|
731
|
+
if (check?.done === true)
|
|
732
|
+
return Promise.resolve(check.cause);
|
|
733
|
+
if (check !== undefined)
|
|
734
|
+
return check.waiting.promise;
|
|
735
|
+
const waiting = Promise.withResolvers();
|
|
736
|
+
this.#check = { done: false, waiting };
|
|
737
|
+
return waiting.promise;
|
|
738
|
+
}
|
|
739
|
+
/** Its first dependency check is done: parked for `cause`, or not (once). */
|
|
740
|
+
#settleCheck(cause) {
|
|
741
|
+
const check = this.#check;
|
|
742
|
+
if (check?.done === true)
|
|
743
|
+
return;
|
|
744
|
+
// Not parked (most attempts): the shared answer, nothing made.
|
|
745
|
+
this.#check = cause === undefined ? NOT_PARKED : { done: true, cause };
|
|
746
|
+
check?.waiting.resolve(cause);
|
|
747
|
+
}
|
|
748
|
+
/** Whether it is parked on its dependencies (the dependency check runs). */
|
|
749
|
+
get isParked() {
|
|
750
|
+
return this.#parked !== undefined;
|
|
751
|
+
}
|
|
752
|
+
/** Its contributions, resolved by its activation: in the registries' tables while its object is live. */
|
|
753
|
+
get contributions() {
|
|
754
|
+
return this.#registryDeclarations?.contributions ?? NONE;
|
|
755
|
+
}
|
|
756
|
+
/** The variant a remote object's factory chose; `undefined` for a local object. */
|
|
757
|
+
get variant() {
|
|
758
|
+
return this.#variant;
|
|
759
|
+
}
|
|
760
|
+
/** The state members, as Chord follows them. */
|
|
761
|
+
get stateMembers() {
|
|
762
|
+
return this.#members.state;
|
|
763
|
+
}
|
|
764
|
+
/**
|
|
765
|
+
* Calls a method for `caller`, bound at `version`: a method outside the variant fails `invalid/member` first (for an
|
|
766
|
+
* older version after its table's checks), then the arguments are checked against that version (L1) and, for an
|
|
767
|
+
* older one (Q10), mapped forwards, the handler's result mapped back, or the provider's replacement of a removed
|
|
768
|
+
* method run instead; a refused method fails `contract_mismatch`. The handler runs under a ctx aborted by the caller
|
|
769
|
+
* and by this attempt's end, admitted to the drain before it runs. Either rejects the caller at once; the handler
|
|
770
|
+
* runs on, its transactions refused, and the drain waits for it. Its `ctx.get` references are released when it
|
|
771
|
+
* settles. Measured choices (fix round 2): one body for every version (with the shared part in a helper method, a
|
|
772
|
+
* call over a link was about 10% slower in the links benchmark), and no `async` (a check's throw is returned as a
|
|
773
|
+
* rejection; as an async function a local call allocated about 250 B more).
|
|
774
|
+
*/
|
|
775
|
+
call(method, args, context, caller, version, parent) {
|
|
776
|
+
let checked;
|
|
777
|
+
let handler;
|
|
778
|
+
try {
|
|
779
|
+
context.abortSignal?.throwIfAborted();
|
|
780
|
+
// Its own served type: an old attempt answers old work by the contract it was made with.
|
|
781
|
+
const served = this.#served;
|
|
782
|
+
const own = this.#members.methods.get(method);
|
|
783
|
+
if (own === undefined && version === served.contract.version)
|
|
784
|
+
throw this.#noMethod(method);
|
|
785
|
+
checked = checkArgs(served.provider, method, args, version, context);
|
|
786
|
+
const call = checked.kind === "call" ? checked.call : undefined;
|
|
787
|
+
handler = call !== undefined ? (callArgs, ctx) => call(callArgs, ctx) : own;
|
|
788
|
+
if (handler === undefined)
|
|
789
|
+
throw this.#noMethod(method);
|
|
790
|
+
}
|
|
791
|
+
catch (error) {
|
|
792
|
+
return Promise.reject(error);
|
|
793
|
+
}
|
|
794
|
+
const { host, served } = this.#object;
|
|
795
|
+
const linked = withLinkedAbortSignal(this.#abort.signal, context);
|
|
796
|
+
const callContext = linked.context;
|
|
797
|
+
// A local object's handlers act as the host, its principal and its incarnation (§4); a remote one's as their
|
|
798
|
+
// caller. The caller stays the reference's (presence, §19).
|
|
799
|
+
const acting = served.kind === "remote" ? caller : { principal: host.principal, incarnation: host.incarnation };
|
|
800
|
+
// Its span only when something records (§30: nothing else is made per call).
|
|
801
|
+
const span = !served.traced || untraced(parent) ? undefined : this.#methodSpan(parent, method, acting, context);
|
|
802
|
+
const ctx = new CallContext(span === undefined ? callContext : withTelemetry(span.span, callContext), acting, host, this);
|
|
803
|
+
// Admitted to the drain before the handler runs: the handler may end its own object before it returns.
|
|
804
|
+
const running = Promise.withResolvers();
|
|
805
|
+
host.count("calls", 1);
|
|
806
|
+
host.metrics.upDownCounter("chord.calls.in_flight").add(1);
|
|
807
|
+
this.#admit(this.#running, running.promise, () => {
|
|
808
|
+
host.count("calls", -1);
|
|
809
|
+
host.metrics.upDownCounter("chord.calls.in_flight").add(-1);
|
|
810
|
+
linked.release();
|
|
811
|
+
ctx.settle();
|
|
812
|
+
});
|
|
813
|
+
span?.endWhen(running.promise, "method_failed", callContext.abortSignal);
|
|
814
|
+
// Plugin code, not type-checked: a synchronous throw or a plain value becomes the promise. Constants: the closure
|
|
815
|
+
// captures them, not the `let`s above.
|
|
816
|
+
const run = handler;
|
|
817
|
+
const runArgs = checked.args;
|
|
818
|
+
(async () => run(runArgs, ctx))().then(running.resolve, running.reject);
|
|
819
|
+
const settled = awaitWithContext(running.promise, callContext);
|
|
820
|
+
if (checked.kind === "call" || checked.result === undefined)
|
|
821
|
+
return settled;
|
|
822
|
+
// The handler's result is the current version's: its mapping back is the provider's (results are not validated).
|
|
823
|
+
const back = checked.result;
|
|
824
|
+
return settled.then((result) => back(result));
|
|
825
|
+
}
|
|
826
|
+
/** The `chord.method` span of a call of `method` acting as `acting`, under `parent`. */
|
|
827
|
+
#methodSpan(parent, method, acting, context) {
|
|
828
|
+
const { host, served, label } = this.#object;
|
|
829
|
+
return new OpenSpan(parent, "chord.method", {
|
|
830
|
+
"chord.host": host.spanHost,
|
|
831
|
+
type: served.contract.name,
|
|
832
|
+
member: method,
|
|
833
|
+
object: capped(label),
|
|
834
|
+
"principal.kind": capped(acting.principal?.kind ?? "none"),
|
|
835
|
+
...host.principalAttributes(acting.principal, context),
|
|
836
|
+
});
|
|
837
|
+
}
|
|
838
|
+
/** The `invalid/member` error of a method outside the variant. */
|
|
839
|
+
#noMethod(method) {
|
|
840
|
+
return invalid("member", `${this.#object.label}${this.#inVariant()} has no method "${method}"`);
|
|
841
|
+
}
|
|
842
|
+
/**
|
|
843
|
+
* The keyed member `member`'s ultimate slot (slice 6a §12, rule 22: through re-exposures); an unknown one fails
|
|
844
|
+
* `invalid/member`.
|
|
845
|
+
*/
|
|
846
|
+
keyedMember(member) {
|
|
847
|
+
const keyed = this.#members.keyed.get(member);
|
|
848
|
+
if (keyed === undefined)
|
|
849
|
+
throw invalid("member", `${this.#object.label} has no keyed member "${member}"`);
|
|
850
|
+
return keyed.kind === "own" ? keyed.slot : keyed.binding.keyedSlot(keyed.member);
|
|
851
|
+
}
|
|
852
|
+
/** The named query `name` of its `queries` member `member`; an unknown one fails `invalid/member`. */
|
|
853
|
+
queryMember(member, name) {
|
|
854
|
+
const query = this.#members.queries.get(member)?.get(name);
|
|
855
|
+
if (query === undefined)
|
|
856
|
+
throw invalid("member", `${this.#object.label} has no query "${member}.${name}"`);
|
|
857
|
+
return query;
|
|
858
|
+
}
|
|
859
|
+
/** The keyed members as checked: what each is (`KeyedBinding`), for the keys its object holds across attempts. */
|
|
860
|
+
get keyedMembers() {
|
|
861
|
+
return this.#members.keyed;
|
|
862
|
+
}
|
|
863
|
+
/**
|
|
864
|
+
* State member `member` as a consumer of `version` follows it: its own member at its version, else its shared mapping
|
|
865
|
+
* for that version (`AdaptedMembers`); `invalid/member` outside the variant, `contract_mismatch` for a version or
|
|
866
|
+
* member its provider refuses.
|
|
867
|
+
*/
|
|
868
|
+
memberAt(member, version) {
|
|
869
|
+
if (version === this.#served.contract.version)
|
|
870
|
+
return this.member(member);
|
|
871
|
+
return this.#adaptedAt(version).member(member);
|
|
872
|
+
}
|
|
873
|
+
/** How a consumer of `version` reads keyed member `member`'s documents: mapped when older (`undefined`: as they are). */
|
|
874
|
+
keyMapping(member, version) {
|
|
875
|
+
if (version === this.#served.contract.version)
|
|
876
|
+
return undefined;
|
|
877
|
+
return this.#adaptedAt(version).keyed(member);
|
|
878
|
+
}
|
|
879
|
+
/**
|
|
880
|
+
* Pins `key` of keyed member `member` on this instance, loaded (its own slot's document, or the re-exposed reference's
|
|
881
|
+
* key), as a consumer of `version` reads it (mapped when older); `release` lets it go.
|
|
882
|
+
*/
|
|
883
|
+
async pinKey(member, key, version, context) {
|
|
884
|
+
const keyed = this.#members.keyed.get(member);
|
|
885
|
+
if (keyed === undefined)
|
|
886
|
+
throw invalid("member", `${this.#object.label} has no keyed member "${member}"`);
|
|
887
|
+
const raw = keyed.kind === "own"
|
|
888
|
+
? await pinned(keyed.slot, key, context)
|
|
889
|
+
: await keyed.binding.pinKey(keyed.member, key, context);
|
|
890
|
+
if (version === this.#served.contract.version)
|
|
891
|
+
return raw;
|
|
892
|
+
try {
|
|
893
|
+
const mapped = this.#adaptedAt(version).key(member, raw.source);
|
|
894
|
+
return {
|
|
895
|
+
source: mapped.source,
|
|
896
|
+
release: () => {
|
|
897
|
+
mapped.release();
|
|
898
|
+
raw.release();
|
|
899
|
+
},
|
|
900
|
+
};
|
|
901
|
+
}
|
|
902
|
+
catch (error) {
|
|
903
|
+
raw.release();
|
|
904
|
+
throw error;
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
/** No consumer of `version` is left: its shared mapping goes. */
|
|
908
|
+
dropVersion(version) {
|
|
909
|
+
const adapted = this.#adapted?.get(version);
|
|
910
|
+
if (adapted === undefined)
|
|
911
|
+
return;
|
|
912
|
+
this.#adapted.delete(version);
|
|
913
|
+
adapted.detach(this.#object.ended());
|
|
914
|
+
}
|
|
915
|
+
/** Its mapping for `version`, made by the first use, reading this instance's own members and provider. */
|
|
916
|
+
#adaptedAt(version) {
|
|
917
|
+
this.#adapted ??= new Map();
|
|
918
|
+
let adapted = this.#adapted.get(version);
|
|
919
|
+
if (adapted === undefined) {
|
|
920
|
+
const { host, label } = this.#object;
|
|
921
|
+
adapted = new AdaptedMembers({
|
|
922
|
+
served: this.#served,
|
|
923
|
+
variant: this.#variant,
|
|
924
|
+
label,
|
|
925
|
+
batch: host.batch,
|
|
926
|
+
member: (name) => this.member(name),
|
|
927
|
+
event: (name) => this.#members?.events.get(name),
|
|
928
|
+
report: (member, error) => host.report({ kind: "derive_failed", object: label, member, error }),
|
|
929
|
+
reportEvent: (member, error) => host.report({ kind: "event_mapping_failed", object: label, member, version, error }),
|
|
930
|
+
metrics: host.metrics,
|
|
931
|
+
}, version);
|
|
932
|
+
this.#adapted.set(version, adapted);
|
|
933
|
+
}
|
|
934
|
+
return adapted;
|
|
935
|
+
}
|
|
936
|
+
/**
|
|
937
|
+
* Event member `member`'s node as a binding of `version` taps it: its own at its version, else its shared mapping for
|
|
938
|
+
* that version; `undefined` outside the variant (or removed since that version), before the members check, and for a
|
|
939
|
+
* version its provider does not serve.
|
|
940
|
+
*/
|
|
941
|
+
eventNode(member, version) {
|
|
942
|
+
if (version === this.#served.contract.version)
|
|
943
|
+
return this.#members?.events.get(member);
|
|
944
|
+
return this.#adaptedAt(version).event(member);
|
|
945
|
+
}
|
|
946
|
+
/** The state member `member`, as Chord follows it; one outside the variant fails `invalid/member`. */
|
|
947
|
+
member(member) {
|
|
948
|
+
const source = this.#members.state.get(member);
|
|
949
|
+
if (source === undefined) {
|
|
950
|
+
throw invalid("member", `${this.#object.label}${this.#inVariant()} has no state member "${member}"`);
|
|
951
|
+
}
|
|
952
|
+
return source;
|
|
953
|
+
}
|
|
954
|
+
/**
|
|
955
|
+
* Ends the attempt at once (the seal fence): calls, openers and routines aborted with `error` (their callers
|
|
956
|
+
* rejected with it), its transactions refused and the one holding the line discarded, its job invocations cut off
|
|
957
|
+
* (an in-memory run ends `aborted` with `runs` as its reason: `reload` for a native restart, slice 7b §8); documents
|
|
958
|
+
* stay readable.
|
|
959
|
+
*/
|
|
960
|
+
seal(error, runs = "restart") {
|
|
961
|
+
// A drained old attempt stops counting as old work at its seal (once: an abandoned attempt is not draining).
|
|
962
|
+
if (this.draining)
|
|
963
|
+
this.#object.host.oldWork.close();
|
|
964
|
+
this.abandon({ kind: "ended", error });
|
|
965
|
+
const { documents } = this.#object;
|
|
966
|
+
documents.fence(this.#token);
|
|
967
|
+
for (const job of this.#jobs.values())
|
|
968
|
+
job.seal(error, runs);
|
|
969
|
+
}
|
|
970
|
+
/**
|
|
971
|
+
* Tears a sealed attempt down: waits for its running handlers, routine calls and runs up to the host's
|
|
972
|
+
* `closeTimeout` (the drain), then closes its natives in reverse with `reason`. Resolves with the closes that threw.
|
|
973
|
+
*/
|
|
974
|
+
async close(reason) {
|
|
975
|
+
const { host, label } = this.#object;
|
|
976
|
+
if ((await this.#drained()) === "timeout")
|
|
977
|
+
host.report({ kind: "drain_timeout", object: label });
|
|
978
|
+
// The close writer: the persisted runs the seal stopped, and the held state changes (slice 6b §4.2).
|
|
979
|
+
for (const job of this.#jobs.values())
|
|
980
|
+
await job.writeAtClose(this.#context);
|
|
981
|
+
// Work stuck past the drain keeps running, but no longer counts as a call or holds its `ctx.get` references.
|
|
982
|
+
cleanUp(this.#running);
|
|
983
|
+
cleanUp(this.#routineRun?.calls);
|
|
984
|
+
cleanUp(this.#runs);
|
|
985
|
+
const failures = [];
|
|
986
|
+
for (const native of [...this.#natives].reverse()) {
|
|
987
|
+
const failure = await native.close(reason);
|
|
988
|
+
if (failure !== undefined)
|
|
989
|
+
failures.push(failure);
|
|
990
|
+
}
|
|
991
|
+
return failures;
|
|
992
|
+
}
|
|
993
|
+
/**
|
|
994
|
+
* The drain at its end, bounded by `closeTimeout`: its running calls (unless a restart's `drainCalls` waited for them
|
|
995
|
+
* already), routine calls and job invocations.
|
|
996
|
+
*/
|
|
997
|
+
#drained() {
|
|
998
|
+
const { close } = this.#object.host.timeouts;
|
|
999
|
+
const running = this.#reloaded?.callsDrained === true ? NO_WORK : this.#running;
|
|
1000
|
+
const runs = this.#runs;
|
|
1001
|
+
const routineCalls = this.#routineRun?.calls;
|
|
1002
|
+
// Most attempts have only calls: no list is made for them.
|
|
1003
|
+
if (routineCalls === undefined && runs === undefined)
|
|
1004
|
+
return drained(running.keys(), running.size, close);
|
|
1005
|
+
const all = [...running.keys(), ...(routineCalls ?? NO_WORK).keys(), ...(runs ?? NO_WORK).keys()];
|
|
1006
|
+
return drained(all, all.length, close);
|
|
1007
|
+
}
|
|
1008
|
+
/**
|
|
1009
|
+
* Detaches its derives and live queries (once their object no longer needs them: reads throw `released`, their
|
|
1010
|
+
* watches end; no commit re-runs the queries), its followed sources (their observers detached, their watches ended)
|
|
1011
|
+
* and its writables (their watches ended).
|
|
1012
|
+
*/
|
|
1013
|
+
detach() {
|
|
1014
|
+
const ended = this.#object.ended();
|
|
1015
|
+
for (const adapted of this.#adapted?.values() ?? [])
|
|
1016
|
+
adapted.detach(ended);
|
|
1017
|
+
this.#adapted = undefined;
|
|
1018
|
+
for (const derive of this.#derives)
|
|
1019
|
+
derive.detach(ended);
|
|
1020
|
+
for (const { live } of this.#queries)
|
|
1021
|
+
live.detach(ended);
|
|
1022
|
+
for (const reader of this.#readers)
|
|
1023
|
+
reader.close(ended);
|
|
1024
|
+
// The named queries it offered are offered no more (slice 14 §3.2): their readers' reads leave the store's
|
|
1025
|
+
// index before a successor prepares the tables, and read the successor's queries when it is live.
|
|
1026
|
+
for (const handle of this.#tables.values())
|
|
1027
|
+
handle.store.reads.retire(handle);
|
|
1028
|
+
for (const follow of this.#follows)
|
|
1029
|
+
follow.detach();
|
|
1030
|
+
for (const source of this.#sources ?? [])
|
|
1031
|
+
source.detach();
|
|
1032
|
+
for (const node of this.#members?.events.values() ?? [])
|
|
1033
|
+
if (node instanceof ReexposedEvents)
|
|
1034
|
+
node.detach();
|
|
1035
|
+
const declarations = this.#registryDeclarations;
|
|
1036
|
+
if (declarations !== undefined)
|
|
1037
|
+
for (const writable of declarations.writables)
|
|
1038
|
+
writable.detach(ended);
|
|
1039
|
+
}
|
|
1040
|
+
/** Releases its references and registry reads. */
|
|
1041
|
+
releaseReferences() {
|
|
1042
|
+
for (const { binding } of this.#references)
|
|
1043
|
+
binding.release();
|
|
1044
|
+
const declarations = this.#registryDeclarations;
|
|
1045
|
+
if (declarations !== undefined)
|
|
1046
|
+
for (const release of declarations.reads.splice(0))
|
|
1047
|
+
release();
|
|
1048
|
+
}
|
|
1049
|
+
/** Its declaration of table `table` (SQL name), if it declared one. */
|
|
1050
|
+
declaredTable(table) {
|
|
1051
|
+
for (const handle of this.#tables.values())
|
|
1052
|
+
if (handle.sql.table === table)
|
|
1053
|
+
return handle.definition;
|
|
1054
|
+
return undefined;
|
|
1055
|
+
}
|
|
1056
|
+
/** The activation steps; each catches its own failures with their kind (the table in slice 2's spec). */
|
|
1057
|
+
async #activate(deadline) {
|
|
1058
|
+
let implementation;
|
|
1059
|
+
let dependencies = NONE;
|
|
1060
|
+
try {
|
|
1061
|
+
implementation = this.#declare();
|
|
1062
|
+
// Right after the factory, before anything can fail: a failed attempt keeps its wake signals.
|
|
1063
|
+
this.#object.retryOn(this.#registryDeclarations?.retrySources ?? NONE);
|
|
1064
|
+
const { documents, host } = this.#object;
|
|
1065
|
+
// The load phase: no host data operation of the host runs meanwhile (its gate), so what loads is current.
|
|
1066
|
+
const entering = host.hostData.enter();
|
|
1067
|
+
if (entering !== undefined)
|
|
1068
|
+
await entering;
|
|
1069
|
+
try {
|
|
1070
|
+
// The object holds the pins from now on.
|
|
1071
|
+
documents.hydrate(this.#declared, this.#pins.splice(0), this.#opening);
|
|
1072
|
+
const loading = documents.load(this.#opening);
|
|
1073
|
+
if (loading !== undefined)
|
|
1074
|
+
await loading;
|
|
1075
|
+
// Awaited only with tables: an object without any takes no extra turn here.
|
|
1076
|
+
if (this.#tables.size > 0)
|
|
1077
|
+
await this.#prepareTables(deadline);
|
|
1078
|
+
else if (host.store !== undefined)
|
|
1079
|
+
this.#bindSets(NONE, host.store);
|
|
1080
|
+
for (const { live, target } of this.#queries)
|
|
1081
|
+
await live.load(target, this.#opening);
|
|
1082
|
+
}
|
|
1083
|
+
finally {
|
|
1084
|
+
host.hostData.leave();
|
|
1085
|
+
}
|
|
1086
|
+
// A persisted job's runs, loaded once per object: rebuilt before anything runs.
|
|
1087
|
+
for (const job of this.#jobs.values())
|
|
1088
|
+
await job.load(this.#opening);
|
|
1089
|
+
for (const { binding, contract, params } of this.#references) {
|
|
1090
|
+
host.bind(binding, contract, params, this.#opening);
|
|
1091
|
+
}
|
|
1092
|
+
// Once all are bound: a dependency made here may have bound back to this object meanwhile.
|
|
1093
|
+
for (const { binding } of this.#references) {
|
|
1094
|
+
const { target } = binding;
|
|
1095
|
+
if (target !== undefined)
|
|
1096
|
+
this.#object.assertNoCycle(target, this.#opening);
|
|
1097
|
+
}
|
|
1098
|
+
// Needed only up to the dependency check: a live attempt keeps none.
|
|
1099
|
+
dependencies = this.#dependencies ?? NONE;
|
|
1100
|
+
this.#dependencies = undefined;
|
|
1101
|
+
for (const dependency of dependencies) {
|
|
1102
|
+
// Read from here until its references are released: an older version's mapping is kept meanwhile.
|
|
1103
|
+
if (dependency.kind === "registry")
|
|
1104
|
+
this.#declarations().reads.push(dependency.value.read());
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
catch (error) {
|
|
1108
|
+
return this.#broken(error);
|
|
1109
|
+
}
|
|
1110
|
+
// Parked only when something is not live yet (most activations find their dependencies live).
|
|
1111
|
+
if ((dependencies.length > 0 && checkDependencies(dependencies).kind !== "live") || this.#pinsKeys()) {
|
|
1112
|
+
const parked = await this.#park(dependencies, (long) => this.#checkDependencies(dependencies, long), deadline);
|
|
1113
|
+
if (parked !== undefined)
|
|
1114
|
+
return parked;
|
|
1115
|
+
}
|
|
1116
|
+
else {
|
|
1117
|
+
this.#settleCheck(undefined);
|
|
1118
|
+
// Its own steps start in a later turn: an object ended in the turn it was made opens nothing.
|
|
1119
|
+
await undefined;
|
|
1120
|
+
}
|
|
1121
|
+
return this.#ownSteps(implementation, deadline);
|
|
1122
|
+
}
|
|
1123
|
+
/**
|
|
1124
|
+
* Parks until `step` finds nothing to wait for (dependency model §3), with no timer: the deadline paused,
|
|
1125
|
+
* `parked_long`'s report the only clock. `step` runs at every change of what the attempt waits on (after its batch):
|
|
1126
|
+
* its `dependencies`, a pinned key, its admission; what it finds is shown on its object. Resolves `undefined` once
|
|
1127
|
+
* the attempt may go on, else with how it ends: abandoned, or broken (a cycle, an ended dependency).
|
|
1128
|
+
*/
|
|
1129
|
+
async #park(dependencies, step, deadline) {
|
|
1130
|
+
const object = this.#object;
|
|
1131
|
+
deadline.pause();
|
|
1132
|
+
this.#parked = dependencies;
|
|
1133
|
+
object.waitsFor(dependencies);
|
|
1134
|
+
// Waiters on a registry are woken when its value turns usable or its failure changes.
|
|
1135
|
+
const waits = [];
|
|
1136
|
+
for (const each of dependencies)
|
|
1137
|
+
if (each.kind === "registry")
|
|
1138
|
+
waits.push(each.value.wait(this));
|
|
1139
|
+
const long = new ParkedLong(object);
|
|
1140
|
+
try {
|
|
1141
|
+
for (;;) {
|
|
1142
|
+
this.#moved = false;
|
|
1143
|
+
const parking = await step(long);
|
|
1144
|
+
if (this.#abandoned !== undefined)
|
|
1145
|
+
return this.#abandoned;
|
|
1146
|
+
if (parking.kind === "broken")
|
|
1147
|
+
return { kind: "failed", cause: { kind: "broken", error: parking.error } };
|
|
1148
|
+
// Changed while it checked (its keys loaded, its admission settled): checked again.
|
|
1149
|
+
if (parking.kind === "ready" && !this.#moved) {
|
|
1150
|
+
// Its own steps follow: `loading` until its outcome (a failure shows as the failure, not this).
|
|
1151
|
+
object.unparked(this);
|
|
1152
|
+
this.#unparked();
|
|
1153
|
+
return undefined;
|
|
1154
|
+
}
|
|
1155
|
+
if (parking.kind === "parked") {
|
|
1156
|
+
object.parked(this, parking.shown, parking.firstPass);
|
|
1157
|
+
if (parking.cause !== undefined)
|
|
1158
|
+
this.#settleCheck(parking.cause);
|
|
1159
|
+
this.#parkedOn(parking.shown);
|
|
1160
|
+
}
|
|
1161
|
+
if (!(await this.#nextChange()))
|
|
1162
|
+
return this.#abandoned;
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
finally {
|
|
1166
|
+
this.#parkEnded();
|
|
1167
|
+
long.stop();
|
|
1168
|
+
for (const release of waits)
|
|
1169
|
+
release();
|
|
1170
|
+
this.#parked = undefined;
|
|
1171
|
+
object.waitsFor(NONE);
|
|
1172
|
+
deadline.resume();
|
|
1173
|
+
}
|
|
1174
|
+
}
|
|
1175
|
+
/**
|
|
1176
|
+
* One check of its factory's dependencies while it parks on them: once all are live, the keys the factory pinned on
|
|
1177
|
+
* them are loaded (a failed load parks it `waiting` until the next change or a retry).
|
|
1178
|
+
*/
|
|
1179
|
+
async #checkDependencies(dependencies, long) {
|
|
1180
|
+
const check = checkDependencies(dependencies);
|
|
1181
|
+
if (check.kind !== "parked")
|
|
1182
|
+
this.#settleCheck(undefined);
|
|
1183
|
+
if (check.kind === "broken")
|
|
1184
|
+
return check;
|
|
1185
|
+
if (check.kind === "parked") {
|
|
1186
|
+
long.blockedBy(check.blocker);
|
|
1187
|
+
return { kind: "parked", shown: check.shown, firstPass: check.firstPass, cause: parkedCause(check) };
|
|
1188
|
+
}
|
|
1189
|
+
const pinned = await pinKeys(this.#bindings(), long, this.#opening);
|
|
1190
|
+
return pinned === undefined ? READY : { kind: "parked", shown: pinned, firstPass: true, cause: undefined };
|
|
1191
|
+
}
|
|
1192
|
+
/** The references its factory declared. */
|
|
1193
|
+
#bindings() {
|
|
1194
|
+
return this.#references.map(({ binding }) => binding);
|
|
1195
|
+
}
|
|
1196
|
+
/** Its dependencies are live after it parked: its own steps run in a new activation span, linked to the parked one. */
|
|
1197
|
+
#unparked() {
|
|
1198
|
+
this.#parkEnded();
|
|
1199
|
+
const parked = this.#activation;
|
|
1200
|
+
if (parked?.ended)
|
|
1201
|
+
this.#startActivation(parked.span);
|
|
1202
|
+
}
|
|
1203
|
+
/**
|
|
1204
|
+
* Waits for the next change of a dependency (at once when one came during the check); `false` when the attempt was
|
|
1205
|
+
* abandoned meanwhile (its end, the only thing that stops the wait).
|
|
1206
|
+
*/
|
|
1207
|
+
async #nextChange() {
|
|
1208
|
+
if (this.#moved)
|
|
1209
|
+
return true;
|
|
1210
|
+
this.#changed = Promise.withResolvers();
|
|
1211
|
+
try {
|
|
1212
|
+
await awaitWithContext(this.#changed.promise, this.#opening);
|
|
1213
|
+
return true;
|
|
1214
|
+
}
|
|
1215
|
+
catch {
|
|
1216
|
+
return false;
|
|
1217
|
+
}
|
|
1218
|
+
finally {
|
|
1219
|
+
this.#changed = undefined;
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
/**
|
|
1223
|
+
* Opens its readers of named queries and waits until each has a value (slice 14 §3.2), after its derives are
|
|
1224
|
+
* attached (the ones computing arguments are computed here) and before the others are computed (they may read a
|
|
1225
|
+
* live query). A reader that cannot read yet, or whose first run failed, parks the attempt on it (`loading`, or
|
|
1226
|
+
* `failed { waiting }`): its next adoption (`#readerWake`) or a move of what it reads checks again. Arguments its
|
|
1227
|
+
* provider refuses and a builder that throws fail the attempt `broken`. Resolves `undefined` once all have
|
|
1228
|
+
* values, else with how the attempt ends.
|
|
1229
|
+
*/
|
|
1230
|
+
async #awaitReaders(deadline) {
|
|
1231
|
+
const label = `${this.#object.label}: a live query`;
|
|
1232
|
+
const open = (long) => openReaders(this.#readers, this.#readerWake, long, label, this.#opening);
|
|
1233
|
+
try {
|
|
1234
|
+
return await this.#park(NONE, open, deadline);
|
|
1235
|
+
}
|
|
1236
|
+
finally {
|
|
1237
|
+
for (const reader of this.#readers)
|
|
1238
|
+
reader.source.dependents.delete(this.#readerWake);
|
|
1239
|
+
}
|
|
1240
|
+
}
|
|
1241
|
+
/**
|
|
1242
|
+
* A dependency of this parked attempt changed (its state, its cause, its first outcome): it checks again after the
|
|
1243
|
+
* batch that changed it, once however many changed. A change while it checks or loads pinned keys is remembered
|
|
1244
|
+
* (`#moved`); one outside parking costs a flag.
|
|
1245
|
+
*/
|
|
1246
|
+
dependencyMoved() {
|
|
1247
|
+
if (this.#moved)
|
|
1248
|
+
return;
|
|
1249
|
+
this.#moved = true;
|
|
1250
|
+
if (this.#changed !== undefined)
|
|
1251
|
+
queueMicrotask(() => this.#changed?.resolve());
|
|
1252
|
+
}
|
|
1253
|
+
/** A registry it is parked on closed with its host: the parked attempt ends with `error`. */
|
|
1254
|
+
closed(error) {
|
|
1255
|
+
this.abandon({ kind: "ended", error });
|
|
1256
|
+
}
|
|
1257
|
+
/** Whether its factory pinned keys on its dependencies' keyed members (`at(key)`), which load while it is parked. */
|
|
1258
|
+
#pinsKeys() {
|
|
1259
|
+
for (const { binding } of this.#references)
|
|
1260
|
+
if (binding.pinsKeys)
|
|
1261
|
+
return true;
|
|
1262
|
+
return false;
|
|
1263
|
+
}
|
|
1264
|
+
/**
|
|
1265
|
+
* `ref.retry()` on its parked object (`failed { waiting }`): passed on to every failed dependency (a broken or
|
|
1266
|
+
* transient one retries, a parked one passes it on, a request waiting in an index is left alone), as a step of
|
|
1267
|
+
* `walk`; then it checks again (a key that failed to load is loaded again).
|
|
1268
|
+
*/
|
|
1269
|
+
retryDependencies(walk) {
|
|
1270
|
+
for (const dependency of this.#parked ?? NONE) {
|
|
1271
|
+
if (dependency.kind === "reference" && dependency.binding.refState.kind === "failed") {
|
|
1272
|
+
dependency.binding.retry(walk);
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1275
|
+
this.dependencyMoved();
|
|
1276
|
+
}
|
|
1277
|
+
/**
|
|
1278
|
+
* The steps after the dependency check (its own: the member check, derives attached, the readers of named queries,
|
|
1279
|
+
* natives, followed sources, derives computed, the keys references pin on its keyed members), under the deadline. A dependency that leaves `live` meanwhile changes
|
|
1280
|
+
* nothing (R18 after live).
|
|
1281
|
+
*/
|
|
1282
|
+
async #ownSteps(implementation, deadline) {
|
|
1283
|
+
let members;
|
|
1284
|
+
try {
|
|
1285
|
+
const checked = checkImplementation(this.#object.served.contract, implementation, this.#sourceOwner);
|
|
1286
|
+
members = checked.members;
|
|
1287
|
+
this.#members = members;
|
|
1288
|
+
this.#variant = checked.variant;
|
|
1289
|
+
// Fed by their references from now on (the object's bindings tap them once it is live).
|
|
1290
|
+
for (const node of members.events.values())
|
|
1291
|
+
if (node instanceof ReexposedEvents)
|
|
1292
|
+
node.attach();
|
|
1293
|
+
if (this.#registryDeclarations !== undefined)
|
|
1294
|
+
this.#registryDeclarations.contributions = this.#resolveContributions(this.#registryDeclarations);
|
|
1295
|
+
const { host, label } = this.#object;
|
|
1296
|
+
attachDerives(this.#derives, members.state, (member) => (error) => {
|
|
1297
|
+
// During activation a throwing derive fails the attempt, which `activation_failed` reports alone.
|
|
1298
|
+
if (!this.#isLive)
|
|
1299
|
+
return;
|
|
1300
|
+
host.report({ kind: "derive_failed", object: label, ...(member === undefined ? {} : { member }), error });
|
|
1301
|
+
});
|
|
1302
|
+
}
|
|
1303
|
+
catch (error) {
|
|
1304
|
+
return this.#broken(error);
|
|
1305
|
+
}
|
|
1306
|
+
// Before the natives: an attempt that waits on a reader holds none (design §6), as one parked on a dependency.
|
|
1307
|
+
// Awaited only with readers: an attempt without any takes no extra turn before its natives open.
|
|
1308
|
+
if (this.#readers.length > 0) {
|
|
1309
|
+
const reading = await this.#awaitReaders(deadline);
|
|
1310
|
+
if (reading !== undefined)
|
|
1311
|
+
return reading;
|
|
1312
|
+
}
|
|
1313
|
+
for (const native of this.#natives) {
|
|
1314
|
+
// An attempt abandoned before this open (ended while it waited) closed its natives already: none opens late.
|
|
1315
|
+
if (this.#abandoned !== undefined)
|
|
1316
|
+
return this.#abandoned;
|
|
1317
|
+
try {
|
|
1318
|
+
await awaitWithContext(native.open(this.#opening), this.#opening);
|
|
1319
|
+
}
|
|
1320
|
+
catch (error) {
|
|
1321
|
+
return this.#abandoned ?? { kind: "failed", cause: openFailure(error, this.#object.label) };
|
|
1322
|
+
}
|
|
1323
|
+
}
|
|
1324
|
+
for (const follow of this.#follows) {
|
|
1325
|
+
if (this.#abandoned !== undefined)
|
|
1326
|
+
return this.#abandoned;
|
|
1327
|
+
try {
|
|
1328
|
+
await awaitWithContext(follow.attach(this.#opening), this.#opening);
|
|
1329
|
+
}
|
|
1330
|
+
catch (error) {
|
|
1331
|
+
const cause = { kind: "transient", error: asChordError(error, this.#object.label) };
|
|
1332
|
+
return this.#abandoned ?? { kind: "failed", cause };
|
|
1333
|
+
}
|
|
1334
|
+
}
|
|
1335
|
+
try {
|
|
1336
|
+
for (const derive of this.#derives)
|
|
1337
|
+
void derive.value;
|
|
1338
|
+
}
|
|
1339
|
+
catch (error) {
|
|
1340
|
+
return this.#broken(error);
|
|
1341
|
+
}
|
|
1342
|
+
return this.#abandoned ?? { kind: "live" };
|
|
1343
|
+
}
|
|
1344
|
+
/** Its declared contributions, as Chord follows them (its references are live now), by its plugin and type. */
|
|
1345
|
+
#resolveContributions({ declared }) {
|
|
1346
|
+
const { served, host } = this.#object;
|
|
1347
|
+
const contributor = { plugin: served.plugin, type: served.contract.name };
|
|
1348
|
+
return declared.map(({ registry, value }) => contributionOf(host.registryRecord(registry.name), contributor, registry.version, value));
|
|
1349
|
+
}
|
|
1350
|
+
/**
|
|
1351
|
+
* Brings the declared tables to their definitions before the references are bound (slice 6a §9): created fresh or
|
|
1352
|
+
* migrated eagerly, with the `readyTimeout` deadline paused meanwhile (resumed with the budget it had left).
|
|
1353
|
+
*/
|
|
1354
|
+
async #prepareTables(deadline) {
|
|
1355
|
+
const handles = [...this.#tables.values()];
|
|
1356
|
+
const tables = handles.map(({ definition, sql }) => ({ definition, table: sql.table }));
|
|
1357
|
+
const fence = { admit: () => !this.#token.sealed && this.#abandoned === undefined, adopt: () => { } };
|
|
1358
|
+
const { store } = handles[0];
|
|
1359
|
+
// Every read over a table that is created or migrated now waits until it is ready (slice 14 §5): a migration's
|
|
1360
|
+
// chunks are not one commit, and a failed one leaves the table held.
|
|
1361
|
+
for (const { definition, sql } of handles) {
|
|
1362
|
+
const recorded = store.table(sql.table);
|
|
1363
|
+
if (recorded?.version !== definition.version || recorded.state !== "ready")
|
|
1364
|
+
store.reads.hold(sql.table);
|
|
1365
|
+
}
|
|
1366
|
+
deadline.pause();
|
|
1367
|
+
try {
|
|
1368
|
+
await prepareTables(tables, store, fence, this.#object.label, this.#opening);
|
|
1369
|
+
}
|
|
1370
|
+
finally {
|
|
1371
|
+
deadline.resume();
|
|
1372
|
+
}
|
|
1373
|
+
this.#bindSets(handles, store);
|
|
1374
|
+
}
|
|
1375
|
+
/**
|
|
1376
|
+
* The bindings of column sets follow this attempt's declarations (the committed code, slice 14 §5): each set a
|
|
1377
|
+
* table exposes is bound to it, a set its object bound before and no table exposes now is dropped; then the tables
|
|
1378
|
+
* are ready, and the reads over them compile again and run once. An attempt that declares no table drops what
|
|
1379
|
+
* its object had bound.
|
|
1380
|
+
*/
|
|
1381
|
+
#bindSets(handles, store) {
|
|
1382
|
+
const object = this.#object;
|
|
1383
|
+
const { reads } = store;
|
|
1384
|
+
const exposed = new Set();
|
|
1385
|
+
for (const { definition, sql } of handles) {
|
|
1386
|
+
const set = definition.exposes?.name;
|
|
1387
|
+
if (set === undefined)
|
|
1388
|
+
continue;
|
|
1389
|
+
exposed.add(set);
|
|
1390
|
+
reads.bind(set, { table: sql.table, definition }, object);
|
|
1391
|
+
}
|
|
1392
|
+
for (const set of reads.boundBy(object))
|
|
1393
|
+
if (!exposed.has(set))
|
|
1394
|
+
reads.unbind(set, object);
|
|
1395
|
+
for (const { sql } of handles)
|
|
1396
|
+
reads.ready(sql.table);
|
|
1397
|
+
}
|
|
1398
|
+
/**
|
|
1399
|
+
* Runs the factory with declarations open; the member check establishes what it returned. A throwing factory
|
|
1400
|
+
* releases its pins.
|
|
1401
|
+
*/
|
|
1402
|
+
#declare() {
|
|
1403
|
+
this.#declaring = true;
|
|
1404
|
+
try {
|
|
1405
|
+
const { served, params, principal } = this.#object;
|
|
1406
|
+
if (served.kind === "local")
|
|
1407
|
+
return served.factory(params, this);
|
|
1408
|
+
// A remote object's identity has its principal; an admitted one's factory gets what its admission allowed.
|
|
1409
|
+
const admitted = this.#admitted;
|
|
1410
|
+
if (admitted === undefined)
|
|
1411
|
+
return served.factory(params, principal, this);
|
|
1412
|
+
return served.factory(params, principal, admitted.value, this);
|
|
1413
|
+
}
|
|
1414
|
+
catch (error) {
|
|
1415
|
+
for (const release of this.#pins)
|
|
1416
|
+
release();
|
|
1417
|
+
throw error;
|
|
1418
|
+
}
|
|
1419
|
+
finally {
|
|
1420
|
+
this.#declaring = false;
|
|
1421
|
+
}
|
|
1422
|
+
}
|
|
1423
|
+
/**
|
|
1424
|
+
* Persisted data needs a stable identity (P3: a `local` type with empty params, also checked by the types) and the
|
|
1425
|
+
* host's store; returns the store.
|
|
1426
|
+
*/
|
|
1427
|
+
#assertPersistable(what) {
|
|
1428
|
+
const { host, served, label } = this.#object;
|
|
1429
|
+
if (served.kind !== "local" || contractData(served.contract).params.fields.length > 0) {
|
|
1430
|
+
throw new Error(`${label}: ${what}: persist needs a stable identity (a local type with empty params)`);
|
|
1431
|
+
}
|
|
1432
|
+
if (host.store === undefined)
|
|
1433
|
+
throw new Error(`${label}: ${what}: persist needs a store`);
|
|
1434
|
+
return host.store;
|
|
1435
|
+
}
|
|
1436
|
+
/**
|
|
1437
|
+
* Adds `running` to `work` (its calls, routine calls or job invocations: the drain), with `cleanup` run once: when
|
|
1438
|
+
* it settles, or at teardown if it never does.
|
|
1439
|
+
*/
|
|
1440
|
+
#admit(work, running, cleanup) {
|
|
1441
|
+
work.set(running, cleanup);
|
|
1442
|
+
// Out of the map already: the teardown ran the cleanup.
|
|
1443
|
+
const settled = () => {
|
|
1444
|
+
if (work.delete(running))
|
|
1445
|
+
cleanup?.();
|
|
1446
|
+
};
|
|
1447
|
+
running.then(settled, settled);
|
|
1448
|
+
}
|
|
1449
|
+
/** Whom this object's own work acts for: a remote object as its principal, a local one as the host; from this host. */
|
|
1450
|
+
#caller() {
|
|
1451
|
+
const { host, served, principal } = this.#object;
|
|
1452
|
+
return { principal: served.kind === "remote" ? principal : host.principal, incarnation: host.incarnation };
|
|
1453
|
+
}
|
|
1454
|
+
/** ` (variant reader)` for a remote object, for errors. */
|
|
1455
|
+
#inVariant() {
|
|
1456
|
+
return this.#variant === undefined ? "" : ` (variant ${this.#variant})`;
|
|
1457
|
+
}
|
|
1458
|
+
#broken(error) {
|
|
1459
|
+
const cause = { kind: "broken", error: asChordError(error, this.#object.label) };
|
|
1460
|
+
return this.#abandoned ?? { kind: "failed", cause };
|
|
1461
|
+
}
|
|
1462
|
+
#declarations() {
|
|
1463
|
+
this.#registryDeclarations ??= {
|
|
1464
|
+
reads: [],
|
|
1465
|
+
retrySources: [],
|
|
1466
|
+
writables: [],
|
|
1467
|
+
declared: [],
|
|
1468
|
+
contributions: NONE,
|
|
1469
|
+
};
|
|
1470
|
+
return this.#registryDeclarations;
|
|
1471
|
+
}
|
|
1472
|
+
#assertDeclaring(declaration) {
|
|
1473
|
+
if (!this.#declaring) {
|
|
1474
|
+
throw new Error(`${this.#object.label}: self.${declaration} is valid only in the factory`);
|
|
1475
|
+
}
|
|
1476
|
+
}
|
|
1477
|
+
}
|
|
1478
|
+
/** Pins `key` on `slot` and loads it when it is not in memory; a failed load releases the pin. */
|
|
1479
|
+
async function pinned(slot, key, context) {
|
|
1480
|
+
const release = slot.pin(key, context);
|
|
1481
|
+
try {
|
|
1482
|
+
await slot.ensure(key, context);
|
|
1483
|
+
}
|
|
1484
|
+
catch (error) {
|
|
1485
|
+
release();
|
|
1486
|
+
throw error;
|
|
1487
|
+
}
|
|
1488
|
+
return { source: slot.source(key), release };
|
|
1489
|
+
}
|
|
1490
|
+
//# sourceMappingURL=attempt.js.map
|