@ksp-gonogo/sitrep-sdk 1.0.0-rc.45 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +48 -93
- package/dist/__generated__/command-map.d.ts +247 -2
- package/dist/__generated__/command-map.d.ts.map +1 -1
- package/dist/__generated__/command-map.js +91 -19
- package/dist/__generated__/command-map.js.map +1 -1
- package/dist/__generated__/contract.d.ts +3062 -352
- package/dist/__generated__/contract.d.ts.map +1 -1
- package/dist/__generated__/contract.js +187 -3
- package/dist/__generated__/contract.js.map +1 -1
- package/dist/__generated__/delay-roles.d.ts +2 -2
- package/dist/__generated__/delay-roles.d.ts.map +1 -1
- package/dist/__generated__/delay-roles.js +12 -0
- package/dist/__generated__/delay-roles.js.map +1 -1
- package/dist/__generated__/error-codes.d.ts +11 -11
- package/dist/__generated__/error-codes.d.ts.map +1 -1
- package/dist/__generated__/error-codes.js +12 -12
- package/dist/__generated__/error-codes.js.map +1 -1
- package/dist/__generated__/frames.d.ts +40 -4
- package/dist/__generated__/frames.d.ts.map +1 -1
- package/dist/__generated__/frames.js +20 -4
- package/dist/__generated__/frames.js.map +1 -1
- package/dist/__generated__/reckonability.d.ts +3 -1
- package/dist/__generated__/reckonability.d.ts.map +1 -1
- package/dist/__generated__/reckonability.js +1 -1
- package/dist/__generated__/reckonability.js.map +1 -1
- package/dist/__generated__/sample-kinds.d.ts +18 -2
- package/dist/__generated__/sample-kinds.d.ts.map +1 -1
- package/dist/__generated__/sample-kinds.js +18 -2
- package/dist/__generated__/sample-kinds.js.map +1 -1
- package/dist/__generated__/topic-map.d.ts +41 -17
- package/dist/__generated__/topic-map.d.ts.map +1 -1
- package/dist/__generated__/topic-map.js +16 -3
- package/dist/__generated__/topic-map.js.map +1 -1
- package/dist/__generated__/units.d.ts +247 -6
- package/dist/__generated__/units.d.ts.map +1 -1
- package/dist/__generated__/units.js +949 -76
- package/dist/__generated__/units.js.map +1 -1
- package/dist/api/command-rejection.d.ts +2 -2
- package/dist/api/command-rejection.js +1 -1
- package/dist/api/contribution-slots.d.ts +122 -21
- package/dist/api/contribution-slots.d.ts.map +1 -1
- package/dist/api/contribution-slots.js +4 -4
- package/dist/api/contribution-slots.js.map +1 -1
- package/dist/api/error-codes.d.ts +3 -2
- package/dist/api/error-codes.d.ts.map +1 -1
- package/dist/api/error-codes.js +3 -2
- package/dist/api/error-codes.js.map +1 -1
- package/dist/api/framework-reads.d.ts +2 -2
- package/dist/api/framework-reads.d.ts.map +1 -1
- package/dist/api/framework-reads.js +6 -1
- package/dist/api/framework-reads.js.map +1 -1
- package/dist/api/host.d.ts +14 -6
- package/dist/api/host.d.ts.map +1 -1
- package/dist/api/host.js.map +1 -1
- package/dist/api/index.d.ts +70 -60
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +66 -54
- package/dist/api/index.js.map +1 -1
- package/dist/api/logger-contract.d.ts +2 -1
- package/dist/api/logger-contract.d.ts.map +1 -1
- package/dist/api/logger.d.ts +6 -3
- package/dist/api/logger.d.ts.map +1 -1
- package/dist/api/logger.js +6 -3
- package/dist/api/logger.js.map +1 -1
- package/dist/api/part-panels.d.ts +143 -0
- package/dist/api/part-panels.d.ts.map +1 -0
- package/dist/api/part-panels.js +104 -0
- package/dist/api/part-panels.js.map +1 -0
- package/dist/api/plot-layers.d.ts +1 -1
- package/dist/api/plot-layers.js +1 -1
- package/dist/api/registry.d.ts +4 -2
- package/dist/api/registry.d.ts.map +1 -1
- package/dist/api/registry.js +4 -2
- package/dist/api/registry.js.map +1 -1
- package/dist/api/settings/store.d.ts +1 -1
- package/dist/api/settings/store.d.ts.map +1 -1
- package/dist/api/settings/store.js +7 -2
- package/dist/api/settings/store.js.map +1 -1
- package/dist/api/slots.d.ts +150 -70
- package/dist/api/slots.d.ts.map +1 -1
- package/dist/api/station-brokers.d.ts +24 -15
- package/dist/api/station-brokers.d.ts.map +1 -1
- package/dist/api/station-brokers.js +24 -15
- package/dist/api/station-brokers.js.map +1 -1
- package/dist/api/tiny-size.d.ts +2 -1
- package/dist/api/tiny-size.d.ts.map +1 -1
- package/dist/api/tiny-size.js +2 -1
- package/dist/api/tiny-size.js.map +1 -1
- package/dist/api/tone.d.ts +1 -1
- package/dist/api/transport.d.ts +9 -0
- package/dist/api/transport.d.ts.map +1 -1
- package/dist/api/types.d.ts +356 -68
- package/dist/api/types.d.ts.map +1 -1
- package/dist/api/uplink-banner.d.ts +113 -0
- package/dist/api/uplink-banner.d.ts.map +1 -0
- package/dist/api/uplink-banner.js +69 -0
- package/dist/api/uplink-banner.js.map +1 -0
- package/dist/api/uplink-handles.d.ts +2 -12
- package/dist/api/uplink-handles.d.ts.map +1 -1
- package/dist/api/uplink-handles.js +2 -1
- package/dist/api/uplink-handles.js.map +1 -1
- package/dist/binary-frame.d.ts +4 -4
- package/dist/binary-frame.js +2 -2
- package/dist/combine-readings.d.ts +4 -3
- package/dist/combine-readings.d.ts.map +1 -1
- package/dist/combine-readings.js +4 -3
- package/dist/combine-readings.js.map +1 -1
- package/dist/command-delay.d.ts +81 -2
- package/dist/command-delay.d.ts.map +1 -1
- package/dist/command-delay.js +51 -8
- package/dist/command-delay.js.map +1 -1
- package/dist/command-value.d.ts +98 -0
- package/dist/command-value.d.ts.map +1 -0
- package/dist/command-value.js +87 -0
- package/dist/command-value.js.map +1 -0
- package/dist/commands.d.ts +1 -1
- package/dist/commands.d.ts.map +1 -1
- package/dist/compat-versions.d.ts +1 -1
- package/dist/compat-versions.d.ts.map +1 -1
- package/dist/compat-versions.js +3 -3
- package/dist/compat-versions.js.map +1 -1
- package/dist/contract-enum-names.d.ts +2 -2
- package/dist/contract-enum-names.js +2 -2
- package/dist/contract-tags.d.ts +33 -2
- package/dist/contract-tags.d.ts.map +1 -1
- package/dist/contract-tags.js +54 -5
- package/dist/contract-tags.js.map +1 -1
- package/dist/data-rate.d.ts +84 -0
- package/dist/data-rate.d.ts.map +1 -0
- package/dist/data-rate.js +133 -0
- package/dist/data-rate.js.map +1 -0
- package/dist/delay-roles.d.ts +14 -1
- package/dist/delay-roles.d.ts.map +1 -1
- package/dist/delay-roles.js +5 -1
- package/dist/delay-roles.js.map +1 -1
- package/dist/dock-markers.d.ts +126 -0
- package/dist/dock-markers.d.ts.map +1 -0
- package/dist/dock-markers.js +100 -0
- package/dist/dock-markers.js.map +1 -0
- package/dist/envelope.d.ts +2 -2
- package/dist/envelope.d.ts.map +1 -1
- package/dist/flight/types.d.ts +31 -2
- package/dist/flight/types.d.ts.map +1 -1
- package/dist/flight/types.js.map +1 -1
- package/dist/frames/index.d.ts +1 -4
- package/dist/frames/index.d.ts.map +1 -1
- package/dist/frames/index.js +0 -3
- package/dist/frames/index.js.map +1 -1
- package/dist/go-no-go-countdown.d.ts +65 -0
- package/dist/go-no-go-countdown.d.ts.map +1 -0
- package/dist/go-no-go-countdown.js +71 -0
- package/dist/go-no-go-countdown.js.map +1 -0
- package/dist/index.d.ts +13 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -4
- package/dist/index.js.map +1 -1
- package/dist/ksp-enum-names.d.ts +35 -4
- package/dist/ksp-enum-names.d.ts.map +1 -1
- package/dist/ksp-enum-names.js +31 -4
- package/dist/ksp-enum-names.js.map +1 -1
- package/dist/locked.d.ts +1 -1
- package/dist/locked.js +1 -1
- package/dist/media/delayed-playout-buffer.d.ts +29 -4
- package/dist/media/delayed-playout-buffer.d.ts.map +1 -1
- package/dist/media/delayed-playout-buffer.js +12 -5
- package/dist/media/delayed-playout-buffer.js.map +1 -1
- package/dist/media/encoded-frame-delay.d.ts +21 -16
- package/dist/media/encoded-frame-delay.d.ts.map +1 -1
- package/dist/media/encoded-frame-delay.js +21 -14
- package/dist/media/encoded-frame-delay.js.map +1 -1
- package/dist/media/frame-delay.d.ts +119 -5
- package/dist/media/frame-delay.d.ts.map +1 -1
- package/dist/media/frame-delay.js +201 -15
- package/dist/media/frame-delay.js.map +1 -1
- package/dist/media/frame-stamp-timeline.d.ts +119 -0
- package/dist/media/frame-stamp-timeline.d.ts.map +1 -0
- package/dist/media/frame-stamp-timeline.js +194 -0
- package/dist/media/frame-stamp-timeline.js.map +1 -0
- package/dist/media/index.d.ts +4 -3
- package/dist/media/index.d.ts.map +1 -1
- package/dist/media/index.js +1 -1
- package/dist/media/index.js.map +1 -1
- package/dist/media/radio-support.d.ts +8 -7
- package/dist/media/radio-support.d.ts.map +1 -1
- package/dist/media/radio-support.js +5 -6
- package/dist/media/radio-support.js.map +1 -1
- package/dist/media/worker/delay-worker-client.d.ts +27 -1
- package/dist/media/worker/delay-worker-client.d.ts.map +1 -1
- package/dist/media/worker/delay-worker-client.js +53 -5
- package/dist/media/worker/delay-worker-client.js.map +1 -1
- package/dist/media/worker/delay-worker.d.ts +45 -8
- package/dist/media/worker/delay-worker.d.ts.map +1 -1
- package/dist/media/worker/delay-worker.js +644 -56
- package/dist/media/worker/delay-worker.js.map +4 -4
- package/dist/media/worker/frame-delay-report.d.ts +25 -0
- package/dist/media/worker/frame-delay-report.d.ts.map +1 -0
- package/dist/media/worker/frame-delay-report.js +112 -0
- package/dist/media/worker/frame-delay-report.js.map +1 -0
- package/dist/media/worker/lead-limit-report.d.ts +13 -0
- package/dist/media/worker/lead-limit-report.d.ts.map +1 -0
- package/dist/media/worker/lead-limit-report.js +19 -0
- package/dist/media/worker/lead-limit-report.js.map +1 -0
- package/dist/media/worker/presentation-pacer.d.ts +70 -1
- package/dist/media/worker/presentation-pacer.d.ts.map +1 -1
- package/dist/media/worker/presentation-pacer.js +167 -9
- package/dist/media/worker/presentation-pacer.js.map +1 -1
- package/dist/media/worker/worker-delay-clock.d.ts +4 -5
- package/dist/media/worker/worker-delay-clock.d.ts.map +1 -1
- package/dist/media/worker/worker-delay-clock.js +6 -2
- package/dist/media/worker/worker-delay-clock.js.map +1 -1
- package/dist/perf/PerfBudget.d.ts +2 -2
- package/dist/perf/PerfBudget.js +2 -2
- package/dist/rail-tags.d.ts +7 -0
- package/dist/rail-tags.d.ts.map +1 -1
- package/dist/rail-tags.js.map +1 -1
- package/dist/raw-field-split.d.ts +1 -1
- package/dist/raw-field-split.js +1 -1
- package/dist/reading.d.ts +6 -6
- package/dist/reading.js +5 -5
- package/dist/reads-index.json +446 -37
- package/dist/resource-transfer.d.ts +177 -0
- package/dist/resource-transfer.d.ts.map +1 -0
- package/dist/resource-transfer.js +190 -0
- package/dist/resource-transfer.js.map +1 -0
- package/dist/runtime-topic-registry.d.ts +2 -2
- package/dist/runtime-topic-registry.d.ts.map +1 -1
- package/dist/runtime-topic-registry.js +23 -2
- package/dist/runtime-topic-registry.js.map +1 -1
- package/dist/sample-step-tracker.d.ts +17 -0
- package/dist/sample-step-tracker.d.ts.map +1 -0
- package/dist/sample-step-tracker.js +38 -0
- package/dist/sample-step-tracker.js.map +1 -0
- package/dist/sha256-fallback.d.ts +6 -0
- package/dist/sha256-fallback.d.ts.map +1 -0
- package/dist/sha256-fallback.js +68 -0
- package/dist/sha256-fallback.js.map +1 -0
- package/dist/spine/arrival-deadline.d.ts +7 -0
- package/dist/spine/arrival-deadline.d.ts.map +1 -1
- package/dist/spine/arrival-deadline.js +12 -0
- package/dist/spine/arrival-deadline.js.map +1 -1
- package/dist/spine/bound-command.d.ts +58 -0
- package/dist/spine/bound-command.d.ts.map +1 -0
- package/dist/spine/bound-command.js +162 -0
- package/dist/spine/bound-command.js.map +1 -0
- package/dist/spine/capability-lock.d.ts +6 -1
- package/dist/spine/capability-lock.d.ts.map +1 -1
- package/dist/spine/capability-lock.js +56 -5
- package/dist/spine/capability-lock.js.map +1 -1
- package/dist/spine/catalog-fallback.d.ts +28 -0
- package/dist/spine/catalog-fallback.d.ts.map +1 -0
- package/dist/spine/catalog-fallback.js +120 -0
- package/dist/spine/catalog-fallback.js.map +1 -0
- package/dist/spine/celestial-facts.d.ts.map +1 -1
- package/dist/spine/celestial-facts.js +5 -2
- package/dist/spine/celestial-facts.js.map +1 -1
- package/dist/spine/centre-commands.d.ts +84 -0
- package/dist/spine/centre-commands.d.ts.map +1 -0
- package/dist/spine/centre-commands.js +236 -0
- package/dist/spine/centre-commands.js.map +1 -0
- package/dist/spine/client-reading.js +1 -1
- package/dist/spine/client-timeline.d.ts +48 -1
- package/dist/spine/client-timeline.d.ts.map +1 -1
- package/dist/spine/client-timeline.js +151 -3
- package/dist/spine/client-timeline.js.map +1 -1
- package/dist/spine/client.d.ts +154 -4
- package/dist/spine/client.d.ts.map +1 -1
- package/dist/spine/client.js +530 -34
- package/dist/spine/client.js.map +1 -1
- package/dist/spine/command-gate.d.ts +8 -0
- package/dist/spine/command-gate.d.ts.map +1 -1
- package/dist/spine/command-gate.js +36 -3
- package/dist/spine/command-gate.js.map +1 -1
- package/dist/spine/command-outcomes.d.ts +60 -0
- package/dist/spine/command-outcomes.d.ts.map +1 -0
- package/dist/spine/command-outcomes.js +256 -0
- package/dist/spine/command-outcomes.js.map +1 -0
- package/dist/spine/connectivity-history.d.ts +5 -3
- package/dist/spine/connectivity-history.d.ts.map +1 -1
- package/dist/spine/connectivity-history.js.map +1 -1
- package/dist/spine/context.d.ts +62 -11
- package/dist/spine/context.d.ts.map +1 -1
- package/dist/spine/context.js +125 -39
- package/dist/spine/context.js.map +1 -1
- package/dist/spine/core-reckoners.d.ts.map +1 -1
- package/dist/spine/core-reckoners.js +16 -39
- package/dist/spine/core-reckoners.js.map +1 -1
- package/dist/spine/delay-authority-context.d.ts +5 -0
- package/dist/spine/delay-authority-context.d.ts.map +1 -0
- package/dist/spine/delay-authority-context.js +7 -0
- package/dist/spine/delay-authority-context.js.map +1 -0
- package/dist/spine/delay-authority.d.ts +76 -1
- package/dist/spine/delay-authority.d.ts.map +1 -1
- package/dist/spine/delay-authority.js +217 -3
- package/dist/spine/delay-authority.js.map +1 -1
- package/dist/spine/delay-estimate.d.ts +41 -0
- package/dist/spine/delay-estimate.d.ts.map +1 -0
- package/dist/spine/delay-estimate.js +70 -0
- package/dist/spine/delay-estimate.js.map +1 -0
- package/dist/spine/delta-v-budget.js +2 -2
- package/dist/spine/delta-v-budget.js.map +1 -1
- package/dist/spine/dv-stage-resources.d.ts +32 -17
- package/dist/spine/dv-stage-resources.d.ts.map +1 -1
- package/dist/spine/dv-stage-resources.js +44 -37
- package/dist/spine/dv-stage-resources.js.map +1 -1
- package/dist/spine/index.d.ts +7 -1
- package/dist/spine/index.d.ts.map +1 -1
- package/dist/spine/index.js +11 -5
- package/dist/spine/index.js.map +1 -1
- package/dist/spine/kepler-reckoning.d.ts +56 -0
- package/dist/spine/kepler-reckoning.d.ts.map +1 -1
- package/dist/spine/kepler-reckoning.js +179 -3
- package/dist/spine/kepler-reckoning.js.map +1 -1
- package/dist/spine/kepler.d.ts +1 -1
- package/dist/spine/kepler.js +1 -1
- package/dist/spine/known-holds.d.ts +8 -0
- package/dist/spine/known-holds.d.ts.map +1 -0
- package/dist/spine/known-holds.js +78 -0
- package/dist/spine/known-holds.js.map +1 -0
- package/dist/spine/lagrange.d.ts +9 -34
- package/dist/spine/lagrange.d.ts.map +1 -1
- package/dist/spine/lagrange.js +4 -24
- package/dist/spine/lagrange.js.map +1 -1
- package/dist/spine/lifecycle.d.ts +21 -0
- package/dist/spine/lifecycle.d.ts.map +1 -1
- package/dist/spine/lifecycle.js.map +1 -1
- package/dist/spine/lock-scope.d.ts +2 -2
- package/dist/spine/map-topic.d.ts +3 -3
- package/dist/spine/map-topic.js +3 -3
- package/dist/spine/never-reckonable.js +1 -1
- package/dist/spine/never-reckonable.js.map +1 -1
- package/dist/spine/orbit-patches.d.ts +6 -4
- package/dist/spine/orbit-patches.d.ts.map +1 -1
- package/dist/spine/orbit-patches.js +45 -10
- package/dist/spine/orbit-patches.js.map +1 -1
- package/dist/spine/orbital-solve.d.ts +1 -1
- package/dist/spine/orbital-solve.d.ts.map +1 -1
- package/dist/spine/orbital-solve.js +35 -0
- package/dist/spine/orbital-solve.js.map +1 -1
- package/dist/spine/powered-reckoning.d.ts +5 -0
- package/dist/spine/powered-reckoning.d.ts.map +1 -1
- package/dist/spine/powered-reckoning.js.map +1 -1
- package/dist/spine/processorEvaluator.d.ts +29 -0
- package/dist/spine/processorEvaluator.d.ts.map +1 -1
- package/dist/spine/processorEvaluator.js +94 -71
- package/dist/spine/processorEvaluator.js.map +1 -1
- package/dist/spine/processors.d.ts +56 -4
- package/dist/spine/processors.d.ts.map +1 -1
- package/dist/spine/processors.js +110 -0
- package/dist/spine/processors.js.map +1 -1
- package/dist/spine/rail-registry.d.ts +1 -1
- package/dist/spine/rail-registry.d.ts.map +1 -1
- package/dist/spine/reckoner-generation.d.ts +5 -0
- package/dist/spine/reckoner-generation.d.ts.map +1 -0
- package/dist/spine/reckoner-generation.js +10 -0
- package/dist/spine/reckoner-generation.js.map +1 -0
- package/dist/spine/reckoners.d.ts.map +1 -1
- package/dist/spine/reckoners.js +3 -0
- package/dist/spine/reckoners.js.map +1 -1
- package/dist/spine/replay-session-controller.d.ts +1 -1
- package/dist/spine/replay-session-controller.d.ts.map +1 -1
- package/dist/spine/replay-session-controller.js +4 -6
- package/dist/spine/replay-session-controller.js.map +1 -1
- package/dist/spine/resolve-tracked.d.ts +20 -2
- package/dist/spine/resolve-tracked.d.ts.map +1 -1
- package/dist/spine/resolve-tracked.js +32 -2
- package/dist/spine/resolve-tracked.js.map +1 -1
- package/dist/spine/send-status.d.ts +2 -0
- package/dist/spine/send-status.d.ts.map +1 -1
- package/dist/spine/send-status.js.map +1 -1
- package/dist/spine/settings-registry.d.ts +7 -0
- package/dist/spine/settings-registry.d.ts.map +1 -1
- package/dist/spine/settings-registry.js.map +1 -1
- package/dist/spine/slot-ids.d.ts +1 -1
- package/dist/spine/slot-ids.d.ts.map +1 -1
- package/dist/spine/slot-ids.js +6 -3
- package/dist/spine/slot-ids.js.map +1 -1
- package/dist/spine/space-center-state.d.ts +17 -9
- package/dist/spine/space-center-state.d.ts.map +1 -1
- package/dist/spine/space-center-state.js +14 -15
- package/dist/spine/space-center-state.js.map +1 -1
- package/dist/spine/stage-countdown-store.d.ts +38 -0
- package/dist/spine/stage-countdown-store.d.ts.map +1 -0
- package/dist/spine/stage-countdown-store.js +53 -0
- package/dist/spine/stage-countdown-store.js.map +1 -0
- package/dist/spine/stream-status.d.ts +3 -3
- package/dist/spine/stream-status.js +3 -3
- package/dist/spine/subscribe-read.d.ts +1 -1
- package/dist/spine/subscribe-read.js +2 -2
- package/dist/spine/system-state.d.ts +13 -13
- package/dist/spine/system-state.d.ts.map +1 -1
- package/dist/spine/system-state.js +18 -18
- package/dist/spine/system-state.js.map +1 -1
- package/dist/spine/timeline-store.d.ts +304 -113
- package/dist/spine/timeline-store.d.ts.map +1 -1
- package/dist/spine/timeline-store.js +921 -223
- package/dist/spine/timeline-store.js.map +1 -1
- package/dist/spine/uplink-clients.d.ts +32 -16
- package/dist/spine/uplink-clients.d.ts.map +1 -1
- package/dist/spine/uplink-clients.js +8 -4
- package/dist/spine/uplink-clients.js.map +1 -1
- package/dist/spine/uplink-delays.d.ts +31 -0
- package/dist/spine/uplink-delays.d.ts.map +1 -0
- package/dist/spine/uplink-delays.js +46 -0
- package/dist/spine/uplink-delays.js.map +1 -0
- package/dist/spine/uplink-health.d.ts +109 -14
- package/dist/spine/uplink-health.d.ts.map +1 -1
- package/dist/spine/uplink-health.js +21 -17
- package/dist/spine/uplink-health.js.map +1 -1
- package/dist/spine/use-action-input.d.ts.map +1 -1
- package/dist/spine/use-action-input.js +14 -9
- package/dist/spine/use-action-input.js.map +1 -1
- package/dist/spine/use-body-states.d.ts.map +1 -1
- package/dist/spine/use-body-states.js +3 -3
- package/dist/spine/use-body-states.js.map +1 -1
- package/dist/spine/use-command.d.ts +94 -31
- package/dist/spine/use-command.d.ts.map +1 -1
- package/dist/spine/use-command.js +409 -197
- package/dist/spine/use-command.js.map +1 -1
- package/dist/spine/use-last-known-path.d.ts +36 -0
- package/dist/spine/use-last-known-path.d.ts.map +1 -0
- package/dist/spine/use-last-known-path.js +46 -0
- package/dist/spine/use-last-known-path.js.map +1 -0
- package/dist/spine/use-observed-vantage.d.ts +13 -0
- package/dist/spine/use-observed-vantage.d.ts.map +1 -0
- package/dist/spine/use-observed-vantage.js +20 -0
- package/dist/spine/use-observed-vantage.js.map +1 -0
- package/dist/spine/use-orbit-trajectory.d.ts +1 -1
- package/dist/spine/use-orbit-trajectory.d.ts.map +1 -1
- package/dist/spine/use-orbit-trajectory.js +17 -3
- package/dist/spine/use-orbit-trajectory.js.map +1 -1
- package/dist/spine/use-stream-connected.d.ts +8 -0
- package/dist/spine/use-stream-connected.d.ts.map +1 -0
- package/dist/spine/use-stream-connected.js +16 -0
- package/dist/spine/use-stream-connected.js.map +1 -0
- package/dist/spine/use-stream-event.d.ts +6 -1
- package/dist/spine/use-stream-event.d.ts.map +1 -1
- package/dist/spine/use-stream-event.js +5 -1
- package/dist/spine/use-stream-event.js.map +1 -1
- package/dist/spine/use-stream.d.ts +5 -2
- package/dist/spine/use-stream.d.ts.map +1 -1
- package/dist/spine/use-stream.js +7 -4
- package/dist/spine/use-stream.js.map +1 -1
- package/dist/spine/use-telemetry.d.ts +5 -1
- package/dist/spine/use-telemetry.d.ts.map +1 -1
- package/dist/spine/use-telemetry.js.map +1 -1
- package/dist/spine/use-topic-clock.d.ts +54 -0
- package/dist/spine/use-topic-clock.d.ts.map +1 -0
- package/dist/spine/use-topic-clock.js +137 -0
- package/dist/spine/use-topic-clock.js.map +1 -0
- package/dist/spine/use-transmissions.d.ts.map +1 -1
- package/dist/spine/use-transmissions.js +9 -4
- package/dist/spine/use-transmissions.js.map +1 -1
- package/dist/spine/vantage.d.ts +6 -0
- package/dist/spine/vantage.d.ts.map +1 -1
- package/dist/spine/vantage.js +6 -0
- package/dist/spine/vantage.js.map +1 -1
- package/dist/spine/view-clock.d.ts +23 -3
- package/dist/spine/view-clock.d.ts.map +1 -1
- package/dist/spine/view-clock.js +80 -2
- package/dist/spine/view-clock.js.map +1 -1
- package/dist/testing/fake-command.d.ts +48 -0
- package/dist/testing/fake-command.d.ts.map +1 -0
- package/dist/testing/fake-command.js +63 -0
- package/dist/testing/fake-command.js.map +1 -0
- package/dist/testing/index.d.ts +5 -1
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +6 -0
- package/dist/testing/index.js.map +1 -1
- package/dist/testing/install-act-gate-stretch.d.ts +1 -2
- package/dist/testing/install-act-gate-stretch.d.ts.map +1 -1
- package/dist/testing/install-act-gate-stretch.js +1 -2
- package/dist/testing/install-act-gate-stretch.js.map +1 -1
- package/dist/testing/install-dom-stubs.d.ts +2 -5
- package/dist/testing/install-dom-stubs.d.ts.map +1 -1
- package/dist/testing/install-dom-stubs.js +2 -34
- package/dist/testing/install-dom-stubs.js.map +1 -1
- package/dist/testing/install-real-test-host.d.ts.map +1 -1
- package/dist/testing/install-real-test-host.js +7 -6
- package/dist/testing/install-real-test-host.js.map +1 -1
- package/dist/testing/recorded-uplink-banners.d.ts +49 -0
- package/dist/testing/recorded-uplink-banners.d.ts.map +1 -0
- package/dist/testing/recorded-uplink-banners.js +45 -0
- package/dist/testing/recorded-uplink-banners.js.map +1 -0
- package/dist/testing/render.d.ts +16 -3
- package/dist/testing/render.d.ts.map +1 -1
- package/dist/testing/render.js +16 -3
- package/dist/testing/render.js.map +1 -1
- package/dist/testing/stream-fixture.js +3 -3
- package/dist/testing/stream-fixture.js.map +1 -1
- package/dist/testing/stub-transport.d.ts +6 -0
- package/dist/testing/stub-transport.d.ts.map +1 -1
- package/dist/testing/stub-transport.js +3 -0
- package/dist/testing/stub-transport.js.map +1 -1
- package/dist/timeline.d.ts +2 -98
- package/dist/timeline.d.ts.map +1 -1
- package/dist/topics.d.ts +68 -28
- package/dist/topics.d.ts.map +1 -1
- package/dist/topics.js +21 -18
- package/dist/topics.js.map +1 -1
- package/dist/unit-system/index.d.ts +1 -1
- package/dist/unit-system/index.d.ts.map +1 -1
- package/dist/unit-system/index.js +1 -1
- package/dist/unit-system/index.js.map +1 -1
- package/dist/unit-system/value.d.ts +26 -5
- package/dist/unit-system/value.d.ts.map +1 -1
- package/dist/unit-system/value.js +41 -21
- package/dist/unit-system/value.js.map +1 -1
- package/dist/units.d.ts.map +1 -1
- package/dist/units.js +2 -1
- package/dist/units.js.map +1 -1
- package/dist/uplink-externals.d.ts +17 -7
- package/dist/uplink-externals.d.ts.map +1 -1
- package/dist/uplink-externals.js +17 -7
- package/dist/uplink-externals.js.map +1 -1
- package/dist/uplink-load.d.ts +3 -2
- package/dist/uplink-load.d.ts.map +1 -1
- package/dist/uplink-load.js +9 -6
- package/dist/uplink-load.js.map +1 -1
- package/dist/uplink-manifest.d.ts +8 -3
- package/dist/uplink-manifest.d.ts.map +1 -1
- package/dist/uplink-manifest.js +5 -1
- package/dist/uplink-manifest.js.map +1 -1
- package/dist/wrap-units.d.ts.map +1 -1
- package/dist/wrap-units.js +3 -2
- package/dist/wrap-units.js.map +1 -1
- package/package.json +1 -1
- package/src/__generated__/command-map.ts +215 -19
- package/src/__generated__/contract.ts +3102 -330
- package/src/__generated__/delay-roles.ts +12 -0
- package/src/__generated__/error-codes.ts +13 -13
- package/src/__generated__/frames.ts +20 -4
- package/src/__generated__/reckonability.ts +3 -1
- package/src/__generated__/sample-kinds.ts +18 -2
- package/src/__generated__/topic-map.ts +68 -19
- package/src/__generated__/units.json +958 -94
- package/src/__generated__/units.ts +949 -76
- package/src/api/command-rejection.ts +2 -2
- package/src/api/contribution-slots.ts +128 -25
- package/src/api/error-codes.ts +3 -2
- package/src/api/framework-reads.ts +6 -1
- package/src/api/host.ts +14 -6
- package/src/api/index.ts +127 -67
- package/src/api/logger-contract.ts +2 -1
- package/src/api/logger.ts +6 -3
- package/src/api/part-panels.ts +221 -0
- package/src/api/plot-layers.ts +1 -1
- package/src/api/registry.ts +4 -2
- package/src/api/settings/store.ts +7 -2
- package/src/api/slots.ts +153 -70
- package/src/api/station-brokers.ts +24 -15
- package/src/api/tiny-size.ts +2 -1
- package/src/api/tone.ts +1 -1
- package/src/api/transport.ts +13 -0
- package/src/api/types.ts +388 -68
- package/src/api/uplink-banner.ts +128 -0
- package/src/api/uplink-handles.ts +4 -1
- package/src/binary-frame.ts +4 -4
- package/src/combine-readings.ts +4 -3
- package/src/command-delay.ts +144 -11
- package/src/command-value.ts +181 -0
- package/src/compat-versions.ts +3 -3
- package/src/contract-enum-names.ts +2 -2
- package/src/contract-tags.ts +67 -5
- package/src/data-rate.ts +178 -0
- package/src/delay-roles.ts +19 -2
- package/src/dock-markers.ts +182 -0
- package/src/envelope.ts +4 -0
- package/src/flight/types.ts +31 -2
- package/src/frames/index.ts +0 -4
- package/src/go-no-go-countdown.ts +116 -0
- package/src/index.ts +64 -4
- package/src/ksp-enum-names.ts +48 -3
- package/src/locked.ts +1 -1
- package/src/media/__fixtures__/hull-after-revert.json +1506 -0
- package/src/media/delayed-playout-buffer.ts +41 -9
- package/src/media/encoded-frame-delay.ts +29 -17
- package/src/media/frame-delay.ts +328 -22
- package/src/media/frame-stamp-timeline.ts +270 -0
- package/src/media/index.ts +5 -0
- package/src/media/radio-support.ts +8 -7
- package/src/media/worker/delay-worker-client.ts +104 -6
- package/src/media/worker/delay-worker.ts +228 -27
- package/src/media/worker/frame-delay-report.ts +141 -0
- package/src/media/worker/lead-limit-report.ts +27 -0
- package/src/media/worker/presentation-pacer.ts +216 -9
- package/src/media/worker/worker-delay-clock.ts +9 -6
- package/src/perf/PerfBudget.ts +2 -2
- package/src/rail-tags.ts +8 -0
- package/src/raw-field-split.ts +1 -1
- package/src/reading.ts +6 -6
- package/src/resource-transfer.ts +352 -0
- package/src/runtime-topic-registry.ts +23 -2
- package/src/sample-step-tracker.ts +38 -0
- package/src/sha256-fallback.ts +69 -0
- package/src/spine/__fixtures__/crash/crash-eva.json +224 -0
- package/src/spine/__fixtures__/crash/crash-separated-pod-pod-root.json +144 -0
- package/src/spine/__fixtures__/crash/crash-separated-pod.json +111 -0
- package/src/spine/__fixtures__/switch/back-to-craft.jsonl +101 -0
- package/src/spine/__fixtures__/switch/late-sent-frame.jsonl +16 -0
- package/src/spine/__fixtures__/switch/linked-craft.jsonl +63 -0
- package/src/spine/__fixtures__/switch/station-trim.jsonl +229 -0
- package/src/spine/__fixtures__/switch/switch-with-scene.jsonl +110 -0
- package/src/spine/__fixtures__/switch/unlinked-craft.jsonl +46 -0
- package/src/spine/arrival-deadline.ts +15 -0
- package/src/spine/bound-command.ts +243 -0
- package/src/spine/capability-lock.ts +65 -6
- package/src/spine/catalog-fallback.ts +152 -0
- package/src/spine/celestial-facts.ts +4 -2
- package/src/spine/centre-commands.ts +314 -0
- package/src/spine/client-reading.ts +1 -1
- package/src/spine/client-timeline.ts +165 -4
- package/src/spine/client.ts +615 -32
- package/src/spine/command-gate.ts +44 -3
- package/src/spine/command-outcomes.ts +303 -0
- package/src/spine/connectivity-history.ts +5 -3
- package/src/spine/context.tsx +154 -50
- package/src/spine/core-reckoners.ts +31 -50
- package/src/spine/delay-authority-context.ts +9 -0
- package/src/spine/delay-authority.ts +227 -3
- package/src/spine/delay-estimate.ts +88 -0
- package/src/spine/delta-v-budget.ts +2 -2
- package/src/spine/dv-stage-resources.ts +55 -43
- package/src/spine/index.ts +11 -5
- package/src/spine/kepler-reckoning.ts +245 -3
- package/src/spine/kepler.ts +1 -1
- package/src/spine/known-holds.ts +96 -0
- package/src/spine/lagrange.ts +10 -46
- package/src/spine/lifecycle.ts +22 -0
- package/src/spine/lock-scope.ts +2 -2
- package/src/spine/map-topic.ts +3 -3
- package/src/spine/never-reckonable.ts +1 -1
- package/src/spine/orbit-patches.ts +54 -10
- package/src/spine/orbital-solve.ts +53 -1
- package/src/spine/powered-reckoning.ts +5 -1
- package/src/spine/processorEvaluator.ts +106 -72
- package/src/spine/processors.ts +144 -4
- package/src/spine/rail-registry.ts +1 -1
- package/src/spine/reckoner-generation.ts +11 -0
- package/src/spine/reckoners.ts +3 -0
- package/src/spine/replay-session-controller.ts +4 -6
- package/src/spine/resolve-tracked.ts +50 -1
- package/src/spine/send-status.ts +2 -0
- package/src/spine/settings-registry.ts +7 -0
- package/src/spine/slot-ids.ts +6 -3
- package/src/spine/space-center-state.ts +17 -20
- package/src/spine/stage-countdown-store.ts +76 -0
- package/src/spine/stream-status.ts +4 -4
- package/src/spine/subscribe-read.ts +2 -2
- package/src/spine/system-state.ts +19 -21
- package/src/spine/timeline-store.ts +1119 -247
- package/src/spine/uplink-clients.ts +44 -22
- package/src/spine/uplink-delays.ts +57 -0
- package/src/spine/uplink-health.ts +59 -27
- package/src/spine/use-action-input.ts +13 -9
- package/src/spine/use-body-states.ts +5 -4
- package/src/spine/use-command.ts +620 -239
- package/src/spine/use-last-known-path.ts +75 -0
- package/src/spine/use-observed-vantage.ts +24 -0
- package/src/spine/use-orbit-trajectory.ts +22 -3
- package/src/spine/use-stream-connected.ts +23 -0
- package/src/spine/use-stream-event.ts +6 -2
- package/src/spine/use-stream.ts +7 -4
- package/src/spine/use-telemetry.ts +5 -1
- package/src/spine/use-topic-clock.ts +196 -0
- package/src/spine/use-transmissions.ts +37 -18
- package/src/spine/vantage.ts +7 -0
- package/src/spine/view-clock.ts +89 -3
- package/src/testing/fake-command.ts +109 -0
- package/src/testing/index.ts +12 -1
- package/src/testing/install-act-gate-stretch.ts +1 -2
- package/src/testing/install-dom-stubs.ts +2 -38
- package/src/testing/install-real-test-host.ts +10 -6
- package/src/testing/recorded-uplink-banners.ts +71 -0
- package/src/testing/render.tsx +16 -3
- package/src/testing/stream-fixture.tsx +3 -3
- package/src/testing/stub-transport.ts +9 -0
- package/src/timeline.ts +2 -103
- package/src/topics.ts +87 -26
- package/src/unit-system/index.ts +2 -0
- package/src/unit-system/value.ts +61 -21
- package/src/units.ts +2 -1
- package/src/uplink-externals.ts +17 -7
- package/src/uplink-load.ts +9 -8
- package/src/uplink-manifest.ts +8 -3
- package/src/wrap-units.ts +3 -9
- package/dist/spine/contributed-channels.d.ts +0 -56
- package/dist/spine/contributed-channels.d.ts.map +0 -1
- package/dist/spine/contributed-channels.js +0 -108
- package/dist/spine/contributed-channels.js.map +0 -1
- package/src/spine/contributed-channels.ts +0 -134
package/src/timeline.ts
CHANGED
|
@@ -1,28 +1,12 @@
|
|
|
1
1
|
import type { Meta } from "./__generated__/contract";
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* The derived-channel authoring contract.
|
|
5
|
-
*
|
|
6
|
-
* An Uplink contributes derived channels: it declares a topic, the inputs it reads,
|
|
7
|
-
* and a pure `derive` that answers for one view time. Writing one means naming a
|
|
8
|
-
* `TimelinePoint` and a `DerivedGet`, so both belong on the surface a
|
|
9
|
-
* third-party author actually has.
|
|
10
|
-
*
|
|
11
|
-
* They lived in `@ksp-gonogo/sitrep-client` until the Uplink isolation rule made the
|
|
12
|
-
* consequence visible: a bundled Uplink contributes a resource-projection channel
|
|
13
|
-
* and could only do it by importing app-internal types, which is precisely the thing
|
|
14
|
-
* an outside author cannot do. Nothing here needs the store; it is the
|
|
15
|
-
* vocabulary for talking to it, and the store itself stays app-side.
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
3
|
/**
|
|
19
4
|
* One received sample of a Topic: its value, when it is valid, and what is
|
|
20
5
|
* known about where it came from. Useful for working out a figure for the
|
|
21
6
|
* operator from what the vessel last sent. A reckoner (the model that carries a
|
|
22
7
|
* Topic forward between samples, registered with
|
|
23
|
-
* {@link UplinkClientHandle.registerReckoner}) and
|
|
24
|
-
*
|
|
25
|
-
* read a series of samples for a plot read them.
|
|
8
|
+
* {@link UplinkClientHandle.registerReckoner}) receives these, and the app's
|
|
9
|
+
* hooks that read a series of samples for a plot read them.
|
|
26
10
|
*
|
|
27
11
|
* @typeParam Payload - The Topic's payload type, as the reader expects it.
|
|
28
12
|
*
|
|
@@ -38,88 +22,3 @@ export interface TimelinePoint<Payload = unknown> {
|
|
|
38
22
|
/** The timeline generation it was received in; loading a save starts a new one. */
|
|
39
23
|
epoch: number;
|
|
40
24
|
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* The function a derived channel's `derive` reads its inputs with.
|
|
44
|
-
* `get(topic)` returns that Topic's sample at the view time `derive` was called
|
|
45
|
-
* for, including its `meta`, so a derived figure is built from inputs of one
|
|
46
|
-
* instant. Useful for combining several Topics into a figure shown to the
|
|
47
|
-
* operator. Used by the app's own derived channels, such as the one that
|
|
48
|
-
* computes the delta-v of each stage.
|
|
49
|
-
*
|
|
50
|
-
* `Payload` is the input Topic's payload type, which the caller names:
|
|
51
|
-
* `get<VesselOrbit>("vessel.orbit")`. A time other than the view time cannot be
|
|
52
|
-
* asked for. Another derived channel can be read the same way.
|
|
53
|
-
*
|
|
54
|
-
* @category Processors
|
|
55
|
-
*/
|
|
56
|
-
export type DerivedGet = <Payload = unknown>(
|
|
57
|
-
topic: string,
|
|
58
|
-
) => TimelinePoint<Payload> | undefined;
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* A Topic computed on the client from other Topics, registered with
|
|
62
|
-
* {@link UplinkClientHandle.registerDerivedChannel}. Useful for showing the
|
|
63
|
-
* operator a figure that needs more than one Topic, such as a state worked out
|
|
64
|
-
* from several readings. It joins the timeline store, the app's record of every
|
|
65
|
-
* Topic's samples over game time. A widget reads it by its id with
|
|
66
|
-
* {@link useStream}, which takes any string. {@link useTelemetry} and a widget's
|
|
67
|
-
* `channels` accept only a {@link TopicId} or one of the {@link
|
|
68
|
-
* DERIVED_CHANNEL_IDS}, which is the app's own list, so an Uplink's channel is
|
|
69
|
-
* not listed in `channels` and is read with `useStream`. The app registers its
|
|
70
|
-
* own derived channels from a list of these.
|
|
71
|
-
*
|
|
72
|
-
* @example A channel that says whether the vessel is descending
|
|
73
|
-
* ```ts
|
|
74
|
-
* import {
|
|
75
|
-
* defineUplinkClient,
|
|
76
|
-
* type TopicPayload,
|
|
77
|
-
* } from "@ksp-gonogo/sitrep-sdk";
|
|
78
|
-
*
|
|
79
|
-
* const DESCENT = defineUplinkClient({
|
|
80
|
-
* id: "descent",
|
|
81
|
-
* version: "1.0.0",
|
|
82
|
-
* name: "Descent",
|
|
83
|
-
* description: "Derives descent facts from the vessel's flight state.",
|
|
84
|
-
* });
|
|
85
|
-
*
|
|
86
|
-
* DESCENT.registerDerivedChannel<{ descending: boolean }>({
|
|
87
|
-
* topic: "descent.state",
|
|
88
|
-
* inputs: ["vessel.flight"],
|
|
89
|
-
* derive: (get) => {
|
|
90
|
-
* const flight = get<TopicPayload<"vessel.flight">>("vessel.flight");
|
|
91
|
-
* // Not arrived yet: say nothing, so readers show "waiting".
|
|
92
|
-
* if (flight === undefined) return undefined;
|
|
93
|
-
* // The game confirmed there is no flight data.
|
|
94
|
-
* if (flight.payload === null) return null;
|
|
95
|
-
* return { descending: flight.payload.verticalSpeed.isNegative() };
|
|
96
|
-
* },
|
|
97
|
-
* });
|
|
98
|
-
*
|
|
99
|
-
* // A widget then reads it by id:
|
|
100
|
-
* // useStream<{ descending: boolean }>("descent.state")
|
|
101
|
-
* ```
|
|
102
|
-
*
|
|
103
|
-
* @category Processors
|
|
104
|
-
*/
|
|
105
|
-
export interface DerivedChannelDefinition<Payload> {
|
|
106
|
-
/** The topic this channel registers as, e.g. `"system.state"`. */
|
|
107
|
-
topic: string;
|
|
108
|
-
/**
|
|
109
|
-
* Every Topic `derive` reads through `get`. The channel is delayed as little
|
|
110
|
-
* as the least current of them allows, its status is the worst of theirs, and
|
|
111
|
-
* its history is built from theirs, so list all of them. Listing a Topic here
|
|
112
|
-
* does not subscribe to it.
|
|
113
|
-
*/
|
|
114
|
-
inputs: string[];
|
|
115
|
-
/**
|
|
116
|
-
* Computes the channel's value at `viewUt`, the game time the screen is
|
|
117
|
-
* showing, which trails the game by the signal delay. The same inputs must give
|
|
118
|
-
* the same result, so a replay draws the same thing. Return `undefined` while an
|
|
119
|
-
* input has not arrived yet, and `null` when the value is confirmed absent;
|
|
120
|
-
* never a made-up zero.
|
|
121
|
-
*/
|
|
122
|
-
derive: (get: DerivedGet, viewUt: number) => Payload | null | undefined;
|
|
123
|
-
/** Whether each field of the value can also be read as its own Topic, such as `system.state.bodyCount`. */
|
|
124
|
-
fields?: boolean;
|
|
125
|
-
}
|
package/src/topics.ts
CHANGED
|
@@ -49,7 +49,9 @@
|
|
|
49
49
|
import type {
|
|
50
50
|
ChannelEmissionReport,
|
|
51
51
|
CommandGateReport,
|
|
52
|
+
DataRateReport,
|
|
52
53
|
PendingUplinkQueue,
|
|
54
|
+
UplinkDelayReport,
|
|
53
55
|
} from "./__generated__/contract";
|
|
54
56
|
import type { GeneratedTopicPayloadMap } from "./__generated__/topic-map";
|
|
55
57
|
import {
|
|
@@ -149,7 +151,8 @@ export interface SystemUplinksTopicPayloadMap {
|
|
|
149
151
|
/**
|
|
150
152
|
* How every registered Topic is delayed, core and Uplink alike, each list
|
|
151
153
|
* sorted. `trueNow` and `heldAtHome` name Topics; `trueNowPrefixes` names
|
|
152
|
-
* namespaces whose Topics are all true now and
|
|
154
|
+
* namespaces whose Topics are all true now and `heldAtHomePrefixes` those
|
|
155
|
+
* whose Topics are all held at home, neither listed one by one.
|
|
153
156
|
* `addressed` names Topics whose samples are each sent to a named audience
|
|
154
157
|
* and arrive already delayed by their own journey. A Topic in none of the
|
|
155
158
|
* lists is delayed by the link's signal delay. Absent when the running
|
|
@@ -159,6 +162,7 @@ export interface SystemUplinksTopicPayloadMap {
|
|
|
159
162
|
trueNow: string[];
|
|
160
163
|
heldAtHome: string[];
|
|
161
164
|
trueNowPrefixes: string[];
|
|
165
|
+
heldAtHomePrefixes?: string[];
|
|
162
166
|
addressed?: string[];
|
|
163
167
|
};
|
|
164
168
|
/**
|
|
@@ -201,10 +205,48 @@ export interface SystemUplinkPendingTopicPayloadMap {
|
|
|
201
205
|
* control that would be refused.
|
|
202
206
|
*/
|
|
203
207
|
export interface SystemUplinkGatesTopicPayloadMap {
|
|
204
|
-
/** Each gated command and whether it would be accepted now. */
|
|
208
|
+
/** Each instant gated command and whether it would be accepted now, and each gated channel. */
|
|
205
209
|
"system.uplink.gates": CommandGateReport;
|
|
206
210
|
}
|
|
207
211
|
|
|
212
|
+
/**
|
|
213
|
+
* `system.uplink.gates.home`: the verdicts of the delayed commands that act on
|
|
214
|
+
* what the home command holds, the career orders. They reach a command centre
|
|
215
|
+
* after its delay to home, as the career figures beside them do, so a control
|
|
216
|
+
* never knows more than the figures it sits next to. `ChannelEngine` declares it
|
|
217
|
+
* directly, so like `system.uplink.gates` it is hand-mapped here. Useful for
|
|
218
|
+
* advising the operator that a delayed career command is likely to be refused.
|
|
219
|
+
*/
|
|
220
|
+
export interface SystemUplinkGatesHomeTopicPayloadMap {
|
|
221
|
+
/** Each delayed career command and whether it would be accepted, as the home command stood. */
|
|
222
|
+
"system.uplink.gates.home": CommandGateReport;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* `system.uplink.gates.craft`: the verdicts of every other delayed command,
|
|
227
|
+
* which reach a command centre after its delay to the active craft, as the
|
|
228
|
+
* telemetry those commands act on does. `ChannelEngine` declares it directly, so
|
|
229
|
+
* like `system.uplink.gates` it is hand-mapped here. Useful for advising the
|
|
230
|
+
* operator that a delayed vessel command is likely to be refused.
|
|
231
|
+
*/
|
|
232
|
+
export interface SystemUplinkGatesCraftTopicPayloadMap {
|
|
233
|
+
/** Each delayed vessel command and whether it would be accepted, as the craft stood. */
|
|
234
|
+
"system.uplink.gates.craft": CommandGateReport;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* `system.uplink.delays`: which delayed commands go to the active craft, and
|
|
239
|
+
* the delay each of the others takes from this session's command centre to
|
|
240
|
+
* its own target. `ChannelEngine` declares it directly, so like
|
|
241
|
+
* `system.uplink.gates` it is hand-mapped here. Useful for showing the
|
|
242
|
+
* operator how long a command sent somewhere other than the craft being flown
|
|
243
|
+
* takes to arrive.
|
|
244
|
+
*/
|
|
245
|
+
export interface SystemUplinkDelaysTopicPayloadMap {
|
|
246
|
+
/** Each delayed command's target, and its delay where the target is not the active craft. */
|
|
247
|
+
"system.uplink.delays": UplinkDelayReport;
|
|
248
|
+
}
|
|
249
|
+
|
|
208
250
|
/**
|
|
209
251
|
* `system.units`: the contract's own unit knowledge, so the stream describes
|
|
210
252
|
* itself.
|
|
@@ -250,6 +292,18 @@ export interface SystemChannelsTopicPayloadMap {
|
|
|
250
292
|
"system.channels": ChannelEmissionReport;
|
|
251
293
|
}
|
|
252
294
|
|
|
295
|
+
/**
|
|
296
|
+
* `system.dataRates`: what each rate tier stands for in samples a game second,
|
|
297
|
+
* and every Topic sent above the base tier now. A Topic not listed arrives at
|
|
298
|
+
* the base tier's rate. Useful for sizing how many samples of a Topic to keep so
|
|
299
|
+
* a plot spans the same time at any rate. Hand-mapped here because the mod
|
|
300
|
+
* declares it itself, like `system.channels`.
|
|
301
|
+
*/
|
|
302
|
+
export interface SystemDataRatesTopicPayloadMap {
|
|
303
|
+
/** Each tier's rate and the Topics above the base tier. */
|
|
304
|
+
"system.dataRates": DataRateReport;
|
|
305
|
+
}
|
|
306
|
+
|
|
253
307
|
/**
|
|
254
308
|
* The SDK's own Topic map: the generated entries plus the engine-owned tail
|
|
255
309
|
* (`system.uplinks`, `system.uplink.pending`). Deliberately distinct from the
|
|
@@ -267,8 +321,12 @@ interface SdkOwnedTopicPayloadMap
|
|
|
267
321
|
SystemUplinksTopicPayloadMap,
|
|
268
322
|
SystemUplinkPendingTopicPayloadMap,
|
|
269
323
|
SystemUplinkGatesTopicPayloadMap,
|
|
324
|
+
SystemUplinkGatesHomeTopicPayloadMap,
|
|
325
|
+
SystemUplinkGatesCraftTopicPayloadMap,
|
|
326
|
+
SystemUplinkDelaysTopicPayloadMap,
|
|
270
327
|
SystemUnitsTopicPayloadMap,
|
|
271
|
-
SystemChannelsTopicPayloadMap
|
|
328
|
+
SystemChannelsTopicPayloadMap,
|
|
329
|
+
SystemDataRatesTopicPayloadMap {}
|
|
272
330
|
|
|
273
331
|
/**
|
|
274
332
|
* Every Topic id mapped to the type of its payload. {@link TopicId} and
|
|
@@ -322,11 +380,11 @@ export type TopicPayload<Topic extends TopicId> = TopicPayloadMap[Topic];
|
|
|
322
380
|
* {@link getAllKnownTopicIds} and {@link isTopicId} include them. Topics whose
|
|
323
381
|
* id is built at runtime, such as one per celestial body,
|
|
324
382
|
* `vessel.partActions.<flightId>` or an Uplink's own `settings.<uplink id>`, are
|
|
325
|
-
* in neither, and are read with {@link useStream}. Nor are the
|
|
326
|
-
* in {@link
|
|
383
|
+
* in neither, and are read with {@link useStream}. Nor are the Topics Gonogo
|
|
384
|
+
* publishes from processors, in {@link PUBLISHED_TOPIC_IDS}, such as `system.uplinkHealth` and
|
|
327
385
|
* `spaceCenter.state`, which the app works out from Topics and a widget reads
|
|
328
|
-
* by id with {@link
|
|
329
|
-
* audio rather than a typed payload.
|
|
386
|
+
* by id with {@link useStream}, or the binary Topic `commcast.radio`, which
|
|
387
|
+
* carries audio rather than a typed payload.
|
|
330
388
|
*
|
|
331
389
|
* @category Reading telemetry
|
|
332
390
|
*/
|
|
@@ -335,8 +393,12 @@ export const TOPIC_IDS = [
|
|
|
335
393
|
"system.uplinks",
|
|
336
394
|
"system.uplink.pending",
|
|
337
395
|
"system.uplink.gates",
|
|
396
|
+
"system.uplink.gates.home",
|
|
397
|
+
"system.uplink.gates.craft",
|
|
398
|
+
"system.uplink.delays",
|
|
338
399
|
"system.units",
|
|
339
400
|
"system.channels",
|
|
401
|
+
"system.dataRates",
|
|
340
402
|
] as const satisfies readonly TopicId[];
|
|
341
403
|
|
|
342
404
|
const TOPIC_ID_SET: ReadonlySet<string> = new Set(TOPIC_IDS);
|
|
@@ -358,10 +420,8 @@ const barePrimitiveTopicIds = new Set<string>();
|
|
|
358
420
|
* the Uplink's client package loads, beside its `declare module` entry in
|
|
359
421
|
* {@link TopicPayloadMap}. Registering an id twice does nothing.
|
|
360
422
|
*
|
|
361
|
-
* Register every Topic your Uplink adds through this function, whatever
|
|
362
|
-
*
|
|
363
|
-
* payload shape and not only one whose payload is a bare boolean or number. A
|
|
364
|
-
* Topic with numeric fields also needs {@link registerTopicUnits}. Useful for
|
|
423
|
+
* Register every Topic your Uplink adds through this function, whatever the
|
|
424
|
+
* shape of its payload. A Topic with numeric fields also needs {@link registerTopicUnits}. Useful for
|
|
365
425
|
* letting the operator read and pick an Uplink's Topics as they do the SDK's
|
|
366
426
|
* own.
|
|
367
427
|
*
|
|
@@ -454,15 +514,16 @@ export function isCollectionTopic(id: string): boolean {
|
|
|
454
514
|
}
|
|
455
515
|
|
|
456
516
|
/**
|
|
457
|
-
* The
|
|
458
|
-
* Topics, rather than ones the game publishes. A widget
|
|
459
|
-
*
|
|
517
|
+
* The Topics Gonogo itself publishes from processors: values it computes in the browser from other
|
|
518
|
+
* Topics, rather than ones the game publishes. A widget lists one in its
|
|
519
|
+
* `channels` like a Topic and reads it with {@link useStream}, since it is not
|
|
520
|
+
* a {@link TopicId} and {@link useTelemetry} takes only those. Useful for
|
|
460
521
|
* listing the channels the operator can read that no Uplink publishes.
|
|
461
522
|
*
|
|
462
523
|
* @category Reading telemetry
|
|
463
524
|
*/
|
|
464
|
-
//
|
|
465
|
-
export const
|
|
525
|
+
// published-topic-ids.test.ts holds this list equal to CORE_PUBLISHED_PROCESSORS.
|
|
526
|
+
export const PUBLISHED_TOPIC_IDS = [
|
|
466
527
|
"system.state",
|
|
467
528
|
"system.uplinkHealth",
|
|
468
529
|
"spaceCenter.state",
|
|
@@ -471,36 +532,36 @@ export const DERIVED_CHANNEL_IDS = [
|
|
|
471
532
|
] as const;
|
|
472
533
|
|
|
473
534
|
/**
|
|
474
|
-
* One of the
|
|
535
|
+
* One of the Topics Gonogo publishes from a processor. See {@link PUBLISHED_TOPIC_IDS}.
|
|
475
536
|
* Useful for telling the Topics the app computes from the Topics the mod sends.
|
|
476
537
|
*
|
|
477
538
|
* @category Reading telemetry
|
|
478
539
|
*/
|
|
479
|
-
export type
|
|
540
|
+
export type PublishedTopicId = (typeof PUBLISHED_TOPIC_IDS)[number];
|
|
480
541
|
|
|
481
|
-
const
|
|
482
|
-
|
|
542
|
+
const PUBLISHED_TOPIC_ID_SET: ReadonlySet<string> = new Set(
|
|
543
|
+
PUBLISHED_TOPIC_IDS,
|
|
483
544
|
);
|
|
484
545
|
|
|
485
546
|
/**
|
|
486
|
-
* Returns whether `value` is a {@link
|
|
547
|
+
* Returns whether `value` is a {@link PublishedTopicId}. Useful for telling a
|
|
487
548
|
* channel the app computes in the browser from one the mod publishes.
|
|
488
549
|
*
|
|
489
550
|
* @category Reading telemetry
|
|
490
551
|
*/
|
|
491
|
-
|
|
492
|
-
return
|
|
552
|
+
function isPublishedTopicId(value: string): value is PublishedTopicId {
|
|
553
|
+
return PUBLISHED_TOPIC_ID_SET.has(value);
|
|
493
554
|
}
|
|
494
555
|
|
|
495
556
|
/**
|
|
496
557
|
* What a widget may list in `channels` and `optionalChannels`: a
|
|
497
|
-
* {@link TopicId} or a {@link
|
|
558
|
+
* {@link TopicId} or a {@link PublishedTopicId}. Any other string does not
|
|
498
559
|
* compile, and neither does a field path; list the channel that carries the
|
|
499
560
|
* field. Useful for catching a misspelt channel in a widget's declaration.
|
|
500
561
|
*
|
|
501
562
|
* @category Reading telemetry
|
|
502
563
|
*/
|
|
503
|
-
export type WidgetChannelId = TopicId |
|
|
564
|
+
export type WidgetChannelId = TopicId | PublishedTopicId;
|
|
504
565
|
|
|
505
566
|
/**
|
|
506
567
|
* Returns whether `value` is a {@link WidgetChannelId}. Useful for checking a
|
|
@@ -509,7 +570,7 @@ export type WidgetChannelId = TopicId | DerivedChannelId;
|
|
|
509
570
|
* @category Reading telemetry
|
|
510
571
|
*/
|
|
511
572
|
export function isWidgetChannelId(value: string): value is WidgetChannelId {
|
|
512
|
-
return isTopicId(value) ||
|
|
573
|
+
return isTopicId(value) || isPublishedTopicId(value);
|
|
513
574
|
}
|
|
514
575
|
|
|
515
576
|
/**
|
package/src/unit-system/index.ts
CHANGED
package/src/unit-system/value.ts
CHANGED
|
@@ -535,7 +535,7 @@ function baseMagnitude(value: Value): number {
|
|
|
535
535
|
* receiver's, which is the same rule `plus`/`minus` already follow on their result.
|
|
536
536
|
*/
|
|
537
537
|
function inThisUnit(self: Value, baseMagnitudeOfOther: number): Value {
|
|
538
|
-
return
|
|
538
|
+
return dynamicValue(self.unit, baseMagnitudeOfOther / ratioOf(self.unit));
|
|
539
539
|
}
|
|
540
540
|
|
|
541
541
|
function baseOperandOf(
|
|
@@ -627,7 +627,7 @@ const prototype = {
|
|
|
627
627
|
},
|
|
628
628
|
|
|
629
629
|
plus(this: Value, other: Value | number): Value {
|
|
630
|
-
return
|
|
630
|
+
return dynamicValue(
|
|
631
631
|
this.unit,
|
|
632
632
|
(baseMagnitude(this) + baseOperandOf(this, other, "add")) /
|
|
633
633
|
ratioOf(this.unit),
|
|
@@ -638,7 +638,7 @@ const prototype = {
|
|
|
638
638
|
baseMagnitude(this) - baseOperandOf(this, other, "subtract");
|
|
639
639
|
// A bare operand is a plain amount, so it can never be the point-minus-point case below: only the affine pair of two INSTANTS lands in the vector.
|
|
640
640
|
if (typeof other === "number") {
|
|
641
|
-
return
|
|
641
|
+
return dynamicValue(this.unit, difference / ratioOf(this.unit));
|
|
642
642
|
}
|
|
643
643
|
// Point minus point is a VECTOR, and the runtime has to agree with the type
|
|
644
644
|
// that says so. Returning `this.unit` here would tag the gap between two
|
|
@@ -647,33 +647,33 @@ const prototype = {
|
|
|
647
647
|
// rendered token would read `ut`.
|
|
648
648
|
const vector = affineVectorUnitFor(this.unit);
|
|
649
649
|
if (vector !== undefined && affineVectorUnitFor(other.unit) !== undefined) {
|
|
650
|
-
return
|
|
650
|
+
return dynamicValue(vector, difference / ratioOf(vector));
|
|
651
651
|
}
|
|
652
|
-
return
|
|
652
|
+
return dynamicValue(this.unit, difference / ratioOf(this.unit));
|
|
653
653
|
},
|
|
654
654
|
|
|
655
655
|
times(this: Value, other: Value | number): Value {
|
|
656
656
|
if (typeof other === "number") {
|
|
657
|
-
return
|
|
657
|
+
return dynamicValue(this.unit, this.magnitude * other);
|
|
658
658
|
}
|
|
659
659
|
const dimension = Dim.multiply(
|
|
660
660
|
dimensionOf(this.unit),
|
|
661
661
|
dimensionOf(other.unit),
|
|
662
662
|
);
|
|
663
|
-
return
|
|
663
|
+
return dynamicValue(
|
|
664
664
|
symbolForDimension(dimension),
|
|
665
665
|
baseMagnitude(this) * baseMagnitude(other),
|
|
666
666
|
);
|
|
667
667
|
},
|
|
668
668
|
dividedBy(this: Value, other: Value | number): Value {
|
|
669
669
|
if (typeof other === "number") {
|
|
670
|
-
return
|
|
670
|
+
return dynamicValue(this.unit, this.magnitude / other);
|
|
671
671
|
}
|
|
672
672
|
const dimension = Dim.divide(
|
|
673
673
|
dimensionOf(this.unit),
|
|
674
674
|
dimensionOf(other.unit),
|
|
675
675
|
);
|
|
676
|
-
return
|
|
676
|
+
return dynamicValue(
|
|
677
677
|
symbolForDimension(dimension),
|
|
678
678
|
baseMagnitude(this) / baseMagnitude(other),
|
|
679
679
|
);
|
|
@@ -683,11 +683,11 @@ const prototype = {
|
|
|
683
683
|
},
|
|
684
684
|
|
|
685
685
|
scaled(this: Value, factor: number): Value {
|
|
686
|
-
return
|
|
686
|
+
return dynamicValue(this.unit, this.magnitude * factor);
|
|
687
687
|
},
|
|
688
688
|
in(this: Value, unit: string): Value {
|
|
689
|
-
requireSameDimension(this,
|
|
690
|
-
return
|
|
689
|
+
requireSameDimension(this, dynamicValue(unit, 0), "convert");
|
|
690
|
+
return dynamicValue(unit, baseMagnitude(this) / ratioOf(unit));
|
|
691
691
|
},
|
|
692
692
|
|
|
693
693
|
equals(this: Value, other: Value | number): boolean {
|
|
@@ -741,7 +741,7 @@ const prototype = {
|
|
|
741
741
|
return this.magnitude < 0;
|
|
742
742
|
},
|
|
743
743
|
abs(this: Value): Value {
|
|
744
|
-
return this.magnitude < 0 ?
|
|
744
|
+
return this.magnitude < 0 ? dynamicValue(this.unit, -this.magnitude) : this;
|
|
745
745
|
},
|
|
746
746
|
min(this: Value, other: Value | number): Value {
|
|
747
747
|
// Returns the OPERAND, not a new value, so the unit each was expressed in
|
|
@@ -756,17 +756,46 @@ const prototype = {
|
|
|
756
756
|
},
|
|
757
757
|
};
|
|
758
758
|
|
|
759
|
+
/**
|
|
760
|
+
* The unit symbol when it names a declared unit, and `never` otherwise. Useful
|
|
761
|
+
* for refusing a mistyped or invented unit at compile time. Taken by
|
|
762
|
+
* {@link value} and {@link staticValue}; an Uplink's own units join it by
|
|
763
|
+
* augmenting {@link UnitDeclarations}.
|
|
764
|
+
*
|
|
765
|
+
* @category Units and values
|
|
766
|
+
*/
|
|
767
|
+
export type CheckedUnit<Unit extends string> = Unit extends DeclaredUnit
|
|
768
|
+
? Unit
|
|
769
|
+
: never;
|
|
770
|
+
|
|
759
771
|
/**
|
|
760
772
|
* A {@link Value} of `magnitude` in `unit`: `value("m/s", 12)`. Useful for
|
|
761
773
|
* making a figure to show the operator or to compare with telemetry.
|
|
762
774
|
*
|
|
763
|
-
*
|
|
764
|
-
*
|
|
765
|
-
*
|
|
775
|
+
* The unit must be declared, so a misspelt or invented unit such as
|
|
776
|
+
* `value("Klevin", 300)` does not compile, and declared units autocomplete. A
|
|
777
|
+
* rate is a unit of its own and needs its own declaration. An Uplink's units
|
|
778
|
+
* are declared by augmenting {@link UnitDeclarations}.
|
|
766
779
|
*
|
|
767
780
|
* @category Units and values
|
|
768
781
|
*/
|
|
769
782
|
export function value<Unit extends string>(
|
|
783
|
+
unit: Unit & CheckedUnit<Unit>,
|
|
784
|
+
magnitude: number,
|
|
785
|
+
): Value<Unit> {
|
|
786
|
+
return dynamicValue(unit, magnitude);
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
/**
|
|
790
|
+
* A {@link Value} of `magnitude` in a unit known only at runtime, such as one
|
|
791
|
+
* read from a settings field or passed through a generic component. Useful for
|
|
792
|
+
* making a figure whose unit the compiler cannot check, which {@link value}
|
|
793
|
+
* refuses. Used by the kit's unit input to rebuild a value in the unit it was
|
|
794
|
+
* given. A unit nothing declares combines with nothing but itself.
|
|
795
|
+
*
|
|
796
|
+
* @category Units and values
|
|
797
|
+
*/
|
|
798
|
+
export function dynamicValue<Unit extends string>(
|
|
770
799
|
unit: Unit,
|
|
771
800
|
magnitude: number,
|
|
772
801
|
): Value<Unit> {
|
|
@@ -786,6 +815,17 @@ export function value<Unit extends string>(
|
|
|
786
815
|
* @category Units and values
|
|
787
816
|
*/
|
|
788
817
|
export function staticValue<Unit extends string>(
|
|
818
|
+
unit: Unit & CheckedUnit<Unit>,
|
|
819
|
+
magnitude: number,
|
|
820
|
+
): Value<Unit> {
|
|
821
|
+
return dynamicStaticValue(unit, magnitude);
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
/*
|
|
825
|
+
* {@link staticValue} without the compile-time unit check, for the runtime
|
|
826
|
+
* paths that mint a static value from a unit they were handed.
|
|
827
|
+
*/
|
|
828
|
+
export function dynamicStaticValue<Unit extends string>(
|
|
789
829
|
unit: Unit,
|
|
790
830
|
magnitude: number,
|
|
791
831
|
): Value<Unit> {
|
|
@@ -805,7 +845,7 @@ export function staticValue<Unit extends string>(
|
|
|
805
845
|
export function asStatic<Unit extends string>(
|
|
806
846
|
figure: Value<Unit>,
|
|
807
847
|
): Value<Unit> {
|
|
808
|
-
return
|
|
848
|
+
return dynamicStaticValue(figure.unit, figure.magnitude);
|
|
809
849
|
}
|
|
810
850
|
|
|
811
851
|
/**
|
|
@@ -925,14 +965,14 @@ export function hydrate<Candidate>(candidate: Candidate): Candidate {
|
|
|
925
965
|
return candidate;
|
|
926
966
|
}
|
|
927
967
|
if (candidate.static === true) {
|
|
928
|
-
return
|
|
968
|
+
return dynamicStaticValue(candidate.unit, candidate.magnitude) as Candidate;
|
|
929
969
|
}
|
|
930
970
|
if (candidate.deterministic === true) {
|
|
931
971
|
return asDeterministic(
|
|
932
|
-
|
|
972
|
+
dynamicValue(candidate.unit, candidate.magnitude),
|
|
933
973
|
) as Candidate;
|
|
934
974
|
}
|
|
935
|
-
return
|
|
975
|
+
return dynamicValue(candidate.unit, candidate.magnitude) as Candidate;
|
|
936
976
|
}
|
|
937
977
|
|
|
938
978
|
/**
|
|
@@ -962,7 +1002,7 @@ export interface Vector3<Unit extends string = string> {
|
|
|
962
1002
|
export function vectorMagnitude<Unit extends string>(
|
|
963
1003
|
v: Vector3<Unit>,
|
|
964
1004
|
): Value<Unit> {
|
|
965
|
-
return
|
|
1005
|
+
return dynamicValue(
|
|
966
1006
|
v.x.unit,
|
|
967
1007
|
Math.hypot(v.x.magnitude, v.y.magnitude, v.z.magnitude),
|
|
968
1008
|
);
|
package/src/units.ts
CHANGED
|
@@ -111,6 +111,7 @@ export function shapeTypeName(entry: string): string {
|
|
|
111
111
|
const HAND_DECLARED_PAYLOAD_TYPES: Readonly<Record<string, string>> =
|
|
112
112
|
Object.freeze({
|
|
113
113
|
"system.uplink.pending": "PendingUplinkQueue",
|
|
114
|
+
"system.dataRates": "DataRateReport",
|
|
114
115
|
});
|
|
115
116
|
|
|
116
117
|
/**
|
|
@@ -158,7 +159,7 @@ export function registerTopicUnits(
|
|
|
158
159
|
registeredTopicStatics.set(topic, statics);
|
|
159
160
|
registeredTopicEnums.set(topic, enums);
|
|
160
161
|
// Changes what the Topic ENUMERATES without vouching that anything sends it:
|
|
161
|
-
// a
|
|
162
|
+
// a published processor declares its fields here too, and nothing puts one
|
|
162
163
|
// on the wire. Which Topics are real is `registerUplinkTopic`'s
|
|
163
164
|
// answer; see `runtime-topic-registry.ts`.
|
|
164
165
|
noteRuntimeTopicMetadata();
|
package/src/uplink-externals.ts
CHANGED
|
@@ -86,13 +86,23 @@ export const UPLINK_EXTERNAL_NO_CHUNK: readonly string[] = [
|
|
|
86
86
|
/**
|
|
87
87
|
* Everything an Uplink's bundler marks `external`: {@link
|
|
88
88
|
* UPLINK_EXTERNAL_SPECIFIERS} and {@link UPLINK_EXTERNAL_NO_CHUNK} together,
|
|
89
|
-
* and the one to use. [`uplink-tools
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
89
|
+
* and the one to use. [`uplink-tools bundle`](/reference/tools/command-line#bundle)
|
|
90
|
+
* passes it for you. A build of your own imports it from this package's
|
|
91
|
+
* `uplink-externals` subpath and passes it as the bundler's list of externals. Useful for building an Uplink's client
|
|
92
|
+
* so that the app supplies the shared packages the operator's screen already
|
|
93
|
+
* holds. Used by `uplink-tools bundle` and by the app's own bundle build.
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* ```ts
|
|
97
|
+
* // UPLINK_BUNDLE_EXTERNALS comes from the sitrep-sdk `uplink-externals` subpath.
|
|
98
|
+
* await build({
|
|
99
|
+
* entryPoints: ["src/index.ts"],
|
|
100
|
+
* bundle: true,
|
|
101
|
+
* format: "esm",
|
|
102
|
+
* external: [...UPLINK_BUNDLE_EXTERNALS],
|
|
103
|
+
* outfile: "dist/client.js",
|
|
104
|
+
* });
|
|
105
|
+
* ```
|
|
96
106
|
*
|
|
97
107
|
* @category Bundling
|
|
98
108
|
* @categoryDescription Bundling
|
package/src/uplink-load.ts
CHANGED
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
* touches the filesystem or the DOM, so it loads in a browser and in Node.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
import { sha256HexFallback } from "./sha256-fallback";
|
|
9
|
+
|
|
8
10
|
/**
|
|
9
11
|
* One `major.minor.patch` version, with any pre-release suffix dropped. Useful
|
|
10
12
|
* for comparing the numbers a manifest and a host state. Returned by
|
|
@@ -253,7 +255,9 @@ export function checkUplinkCompat(
|
|
|
253
255
|
const rebuild =
|
|
254
256
|
`The Uplink needs rebuilding against @ksp-gonogo/sitrep-sdk and @ksp-gonogo/ui-kit ` +
|
|
255
257
|
`${app.appVersion}, the versions this app was released with, and re-releasing; ` +
|
|
256
|
-
"nothing can be changed app-side to load it."
|
|
258
|
+
"nothing can be changed app-side to load it. If you just rebuilt and still see this, the " +
|
|
259
|
+
"client's node_modules holds older packages than the app: reinstall them " +
|
|
260
|
+
"(npm install, or npm install @ksp-gonogo/sitrep-sdk @ksp-gonogo/ui-kit at that version) and build again.";
|
|
257
261
|
const updateApp =
|
|
258
262
|
"The app is older than the Uplink, so update the app; the Uplink is not at fault.";
|
|
259
263
|
if (clientApi.major !== appApi.major) {
|
|
@@ -315,18 +319,15 @@ export function checkUplinkCompat(
|
|
|
315
319
|
/**
|
|
316
320
|
* The `sha256-<hex>` of a bundle's bytes, in the form a manifest's `integrity`
|
|
317
321
|
* holds. Useful for checking fetched bytes against the manifest before running
|
|
318
|
-
* them.
|
|
319
|
-
* http
|
|
322
|
+
* them. Uses Web Crypto where the page has it and a built-in SHA-256 where it
|
|
323
|
+
* does not, as on a page served over plain http from a LAN address, so the
|
|
324
|
+
* result is the same on both.
|
|
320
325
|
*
|
|
321
326
|
* @category Loading
|
|
322
327
|
*/
|
|
323
328
|
export async function sha256Integrity(bytes: ArrayBuffer): Promise<string> {
|
|
324
329
|
const subtle = globalThis.crypto?.subtle;
|
|
325
|
-
if (!subtle) {
|
|
326
|
-
throw new Error(
|
|
327
|
-
"cannot verify integrity: crypto.subtle unavailable (non-secure origin), serve the page over https or localhost",
|
|
328
|
-
);
|
|
329
|
-
}
|
|
330
|
+
if (!subtle) return `sha256-${sha256HexFallback(new Uint8Array(bytes))}`;
|
|
330
331
|
const digest = await subtle.digest("SHA-256", bytes);
|
|
331
332
|
const hex = Array.from(new Uint8Array(digest))
|
|
332
333
|
.map((b) => b.toString(16).padStart(2, "0"))
|