@rybosome/tspice 0.0.3 → 0.0.8
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 +145 -84
- package/backend-contract/dist/.tsbuildinfo +1 -1
- package/backend-contract/dist/domains/cells-windows.d.ts +94 -0
- package/backend-contract/dist/domains/cells-windows.js +10 -0
- package/backend-contract/dist/domains/coords-vectors.d.ts +53 -3
- package/backend-contract/dist/domains/dsk.d.ts +49 -0
- package/backend-contract/dist/domains/dsk.js +2 -0
- package/backend-contract/dist/domains/ek.d.ts +186 -0
- package/backend-contract/dist/domains/ek.js +8 -0
- package/backend-contract/dist/domains/ephemeris.d.ts +141 -3
- package/backend-contract/dist/domains/error.d.ts +42 -0
- package/backend-contract/dist/domains/error.js +33 -0
- package/backend-contract/dist/domains/file-io.d.ts +114 -0
- package/backend-contract/dist/domains/file-io.js +8 -0
- package/backend-contract/dist/domains/frames.d.ts +44 -4
- package/backend-contract/dist/domains/geometry-gf.d.ts +44 -0
- package/backend-contract/dist/domains/geometry-gf.js +14 -0
- package/backend-contract/dist/domains/geometry.d.ts +21 -1
- package/backend-contract/dist/domains/ids-names-normalize.d.ts +3 -0
- package/backend-contract/dist/domains/ids-names-normalize.js +74 -0
- package/backend-contract/dist/domains/ids-names.d.ts +37 -0
- package/backend-contract/dist/domains/kernel-pool.d.ts +134 -0
- package/backend-contract/dist/domains/kernel-pool.js +2 -0
- package/backend-contract/dist/domains/kernels-utils.d.ts +44 -0
- package/backend-contract/dist/domains/kernels-utils.js +265 -0
- package/backend-contract/dist/domains/kernels.d.ts +39 -3
- package/backend-contract/dist/domains/time.d.ts +102 -0
- package/backend-contract/dist/index.d.ts +34 -15
- package/backend-contract/dist/index.js +15 -1
- package/backend-contract/dist/shared/errors.d.ts +6 -0
- package/backend-contract/dist/shared/errors.js +8 -0
- package/backend-contract/dist/shared/mat3.d.ts +52 -0
- package/backend-contract/dist/shared/mat3.js +150 -0
- package/backend-contract/dist/shared/mat6.d.ts +34 -0
- package/backend-contract/dist/shared/mat6.js +116 -0
- package/backend-contract/dist/shared/spice-handles.d.ts +20 -0
- package/backend-contract/dist/shared/spice-handles.js +82 -0
- package/backend-contract/dist/shared/spice-int.d.ts +32 -0
- package/backend-contract/dist/shared/spice-int.js +41 -0
- package/backend-contract/dist/shared/types.d.ts +136 -5
- package/backend-contract/dist/shared/types.js +1 -1
- package/backend-contract/dist/shared/vec.d.ts +54 -0
- package/backend-contract/dist/shared/vec.js +162 -0
- package/backend-fake/dist/.tsbuildinfo +1 -1
- package/backend-fake/dist/index.d.ts +21 -1
- package/backend-fake/dist/index.js +1112 -33
- package/backend-node/dist/.tsbuildinfo +1 -1
- package/backend-node/dist/codec/arrays.d.ts +9 -0
- package/backend-node/dist/codec/arrays.js +36 -0
- package/backend-node/dist/codec/errors.d.ts +6 -6
- package/backend-node/dist/codec/errors.js +6 -6
- package/backend-node/dist/domains/cells-windows.d.ts +5 -0
- package/backend-node/dist/domains/cells-windows.js +112 -0
- package/backend-node/dist/domains/coords-vectors.d.ts +1 -0
- package/backend-node/dist/domains/coords-vectors.js +66 -0
- package/backend-node/dist/domains/dsk.d.ts +6 -0
- package/backend-node/dist/domains/dsk.js +108 -0
- package/backend-node/dist/domains/ek.d.ts +10 -0
- package/backend-node/dist/domains/ek.js +100 -0
- package/backend-node/dist/domains/ephemeris.d.ts +5 -1
- package/backend-node/dist/domains/ephemeris.js +150 -1
- package/backend-node/dist/domains/error.d.ts +5 -0
- package/backend-node/dist/domains/error.js +34 -0
- package/backend-node/dist/domains/file-io.d.ts +7 -0
- package/backend-node/dist/domains/file-io.js +105 -0
- package/backend-node/dist/domains/frames.d.ts +1 -0
- package/backend-node/dist/domains/frames.js +58 -6
- package/backend-node/dist/domains/geometry-gf.d.ts +5 -0
- package/backend-node/dist/domains/geometry-gf.js +74 -0
- package/backend-node/dist/domains/geometry.d.ts +1 -0
- package/backend-node/dist/domains/geometry.js +62 -0
- package/backend-node/dist/domains/ids-names.d.ts +2 -1
- package/backend-node/dist/domains/ids-names.js +30 -0
- package/backend-node/dist/domains/kernel-pool.d.ts +5 -0
- package/backend-node/dist/domains/kernel-pool.js +74 -0
- package/backend-node/dist/domains/kernels.d.ts +1 -0
- package/backend-node/dist/domains/kernels.js +100 -13
- package/backend-node/dist/domains/time.d.ts +1 -0
- package/backend-node/dist/domains/time.js +75 -1
- package/backend-node/dist/index.d.ts +5 -1
- package/backend-node/dist/index.js +62 -1
- package/backend-node/dist/lowlevel/binding.d.ts +3 -0
- package/backend-node/dist/lowlevel/binding.js +115 -0
- package/backend-node/dist/runtime/addon.d.ts +273 -2
- package/backend-node/dist/runtime/addon.js +3 -0
- package/backend-node/dist/runtime/kernel-staging.d.ts +17 -0
- package/backend-node/dist/runtime/kernel-staging.js +80 -7
- package/backend-node/dist/runtime/spice-handles.d.ts +3 -0
- package/backend-node/dist/runtime/spice-handles.js +2 -0
- package/backend-node/dist/runtime/virtual-output-staging.d.ts +16 -0
- package/backend-node/dist/runtime/virtual-output-staging.js +148 -0
- package/backend-wasm/dist/.tsbuildinfo +1 -1
- package/backend-wasm/dist/codec/alloc.d.ts +19 -0
- package/backend-wasm/dist/codec/alloc.js +64 -0
- package/backend-wasm/dist/codec/calls.d.ts +2 -0
- package/backend-wasm/dist/codec/calls.js +13 -24
- package/backend-wasm/dist/codec/errors.d.ts +6 -0
- package/backend-wasm/dist/codec/errors.js +34 -2
- package/backend-wasm/dist/codec/found.d.ts +2 -0
- package/backend-wasm/dist/codec/found.js +20 -43
- package/backend-wasm/dist/codec/strings.d.ts +31 -1
- package/backend-wasm/dist/codec/strings.js +93 -6
- package/backend-wasm/dist/domains/cells-windows.d.ts +9 -0
- package/backend-wasm/dist/domains/cells-windows.js +392 -0
- package/backend-wasm/dist/domains/coords-vectors.d.ts +1 -0
- package/backend-wasm/dist/domains/coords-vectors.js +377 -184
- package/backend-wasm/dist/domains/dsk.d.ts +6 -0
- package/backend-wasm/dist/domains/dsk.js +179 -0
- package/backend-wasm/dist/domains/ek.d.ts +6 -0
- package/backend-wasm/dist/domains/ek.js +543 -0
- package/backend-wasm/dist/domains/ephemeris.d.ts +4 -1
- package/backend-wasm/dist/domains/ephemeris.js +405 -46
- package/backend-wasm/dist/domains/error.d.ts +5 -0
- package/backend-wasm/dist/domains/error.js +109 -0
- package/backend-wasm/dist/domains/file-io.d.ts +7 -0
- package/backend-wasm/dist/domains/file-io.js +462 -0
- package/backend-wasm/dist/domains/frames.d.ts +1 -0
- package/backend-wasm/dist/domains/frames.js +139 -6
- package/backend-wasm/dist/domains/geometry-gf.d.ts +5 -0
- package/backend-wasm/dist/domains/geometry-gf.js +178 -0
- package/backend-wasm/dist/domains/geometry.d.ts +1 -0
- package/backend-wasm/dist/domains/geometry.js +210 -0
- package/backend-wasm/dist/domains/ids-names.d.ts +2 -1
- package/backend-wasm/dist/domains/ids-names.js +89 -0
- package/backend-wasm/dist/domains/kernel-pool.d.ts +5 -0
- package/backend-wasm/dist/domains/kernel-pool.js +357 -0
- package/backend-wasm/dist/domains/kernels.d.ts +1 -0
- package/backend-wasm/dist/domains/kernels.js +108 -4
- package/backend-wasm/dist/domains/time.d.ts +2 -0
- package/backend-wasm/dist/domains/time.js +235 -133
- package/backend-wasm/dist/index.d.ts +4 -2
- package/backend-wasm/dist/lowlevel/exports.d.ts +215 -1
- package/backend-wasm/dist/lowlevel/exports.js +217 -38
- package/backend-wasm/dist/runtime/create-backend-options.d.ts +21 -0
- package/backend-wasm/dist/runtime/create-backend.node.d.ts +11 -2
- package/backend-wasm/dist/runtime/create-backend.node.js +283 -14
- package/backend-wasm/dist/runtime/create-backend.web.d.ts +5 -2
- package/backend-wasm/dist/runtime/create-backend.web.js +40 -6
- package/backend-wasm/dist/runtime/fs.d.ts +6 -0
- package/backend-wasm/dist/runtime/fs.js +29 -3
- package/backend-wasm/dist/runtime/spice-handles.d.ts +3 -0
- package/backend-wasm/dist/runtime/spice-handles.js +2 -0
- package/backend-wasm/dist/runtime/virtual-outputs.d.ts +16 -0
- package/backend-wasm/dist/runtime/virtual-outputs.js +35 -0
- package/backend-wasm/dist/tspice_backend_wasm.node.js +3 -3
- package/backend-wasm/dist/tspice_backend_wasm.wasm +0 -0
- package/backend-wasm/dist/tspice_backend_wasm.web.js +1 -1
- package/core/dist/.tsbuildinfo +1 -1
- package/core/dist/index.d.ts +21 -0
- package/core/dist/index.js +57 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/backend.d.ts +15 -6
- package/dist/backend.js +3 -6
- package/dist/clients/createSpiceAsyncFromTransport.d.ts +5 -0
- package/dist/clients/createSpiceAsyncFromTransport.js +90 -0
- package/dist/clients/createSpiceSyncFromTransport.d.ts +5 -0
- package/dist/clients/createSpiceSyncFromTransport.js +88 -0
- package/dist/clients/spiceClients.d.ts +59 -0
- package/dist/clients/spiceClients.js +292 -0
- package/dist/errors.d.ts +4 -0
- package/dist/errors.js +4 -0
- package/dist/index.d.ts +12 -7
- package/dist/index.js +5 -2
- package/dist/kernels/defaultKernelPathFromUrl.d.ts +8 -0
- package/dist/kernels/defaultKernelPathFromUrl.js +32 -0
- package/dist/kernels/kernelPack.d.ts +88 -0
- package/dist/kernels/kernelPack.js +122 -0
- package/dist/kernels/kernels.d.ts +98 -0
- package/dist/kernels/kernels.js +217 -0
- package/dist/kernels/naifKernelId.d.ts +2 -0
- package/dist/kernels/naifKernelId.js +2 -0
- package/dist/kit/index.d.ts +4 -0
- package/dist/kit/index.js +3 -0
- package/dist/kit/math/mat3.d.ts +31 -0
- package/dist/kit/math/mat3.js +82 -0
- package/dist/kit/spice/create-kit.d.ts +12 -0
- package/dist/kit/spice/create-kit.js +23 -0
- package/dist/kit/spice/frames.d.ts +8 -0
- package/dist/kit/spice/frames.js +16 -0
- package/dist/kit/spice/kernels.d.ts +14 -0
- package/dist/kit/spice/kernels.js +39 -0
- package/dist/kit/spice/state.d.ts +7 -0
- package/dist/kit/spice/state.js +36 -0
- package/dist/kit/spice/time.d.ts +9 -0
- package/dist/kit/spice/time.js +31 -0
- package/dist/kit/types/spice-types.d.ts +51 -0
- package/dist/spice.d.ts +10 -1
- package/dist/spice.js +84 -72
- package/dist/transport/caching/policy.d.ts +16 -0
- package/dist/transport/caching/policy.js +77 -0
- package/dist/transport/caching/withCaching.d.ts +125 -0
- package/dist/transport/caching/withCaching.js +335 -0
- package/dist/transport/caching/withCachingSync.d.ts +24 -0
- package/dist/transport/caching/withCachingSync.js +161 -0
- package/dist/transport/rpc/protocol.d.ts +35 -0
- package/dist/transport/rpc/protocol.js +56 -0
- package/dist/transport/rpc/taskScheduling.d.ts +20 -0
- package/dist/transport/rpc/taskScheduling.js +98 -0
- package/dist/transport/rpc/valueCodec.d.ts +5 -0
- package/dist/transport/rpc/valueCodec.js +106 -0
- package/dist/transport/types.d.ts +7 -0
- package/dist/transport/types.js +2 -0
- package/dist/types.d.ts +8 -17
- package/dist/types.js +2 -1
- package/dist/worker/browser/createSpiceWorker.d.ts +22 -0
- package/dist/worker/browser/createSpiceWorker.js +41 -0
- package/dist/worker/browser/createSpiceWorkerClient.d.ts +40 -0
- package/dist/worker/browser/createSpiceWorkerClient.js +99 -0
- package/dist/worker/browser/spiceWorkerEntry.d.ts +2 -0
- package/dist/worker/browser/spiceWorkerEntry.js +129 -0
- package/dist/worker/browser/spiceWorkerInlineSource.d.ts +2 -0
- package/dist/worker/browser/spiceWorkerInlineSource.js +4 -0
- package/dist/worker/index.d.ts +10 -0
- package/dist/worker/index.js +7 -0
- package/dist/worker/transport/createWorkerTransport.d.ts +69 -0
- package/dist/worker/transport/createWorkerTransport.js +398 -0
- package/dist/worker/transport/exposeTransportToWorker.d.ts +51 -0
- package/dist/worker/transport/exposeTransportToWorker.js +196 -0
- package/package.json +4 -4
- package/dist/spice-types.d.ts +0 -36
- /package/dist/{spice-types.js → kit/types/spice-types.js} +0 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Low-level SPICE "cells" and DP windows.
|
|
3
|
+
*
|
|
4
|
+
* Contract notes:
|
|
5
|
+
* - Cells/windows are **opaque handles** created by the backend and mutated in-place.
|
|
6
|
+
* - Capacity is fixed at creation time; overflow should throw (CSPICE-like).
|
|
7
|
+
* - Inspection is done via the raw operations here (no `.data` exposure).
|
|
8
|
+
*/
|
|
9
|
+
declare const __spiceIntCellBrand: unique symbol;
|
|
10
|
+
declare const __spiceDoubleCellBrand: unique symbol;
|
|
11
|
+
declare const __spiceCharCellBrand: unique symbol;
|
|
12
|
+
declare const __spiceWindowBrand: unique symbol;
|
|
13
|
+
/** Opaque handle to a CSPICE `SpiceCell` of type `SPICE_INT`. */
|
|
14
|
+
export type SpiceIntCell = number & {
|
|
15
|
+
readonly [__spiceIntCellBrand]: true;
|
|
16
|
+
};
|
|
17
|
+
/** Opaque handle to a CSPICE `SpiceCell` of type `SPICE_DP`. */
|
|
18
|
+
export type SpiceDoubleCell = number & {
|
|
19
|
+
readonly [__spiceDoubleCellBrand]: true;
|
|
20
|
+
};
|
|
21
|
+
/** Opaque handle to a CSPICE `SpiceCell` of type `SPICE_CHR`. */
|
|
22
|
+
export type SpiceCharCell = number & {
|
|
23
|
+
readonly [__spiceCharCellBrand]: true;
|
|
24
|
+
};
|
|
25
|
+
/** Opaque handle to a CSPICE DP window (a `SPICE_DP` cell interpreted as intervals). */
|
|
26
|
+
export type SpiceWindow = number & {
|
|
27
|
+
readonly [__spiceWindowBrand]: true;
|
|
28
|
+
};
|
|
29
|
+
/** Backend contract for low-level SPICE cell/window operations. */
|
|
30
|
+
export interface CellsWindowsApi {
|
|
31
|
+
/** Create an empty integer set cell with the given capacity. */
|
|
32
|
+
newIntCell(size: number): SpiceIntCell;
|
|
33
|
+
/** Create an empty double-precision set cell with the given capacity. */
|
|
34
|
+
newDoubleCell(size: number): SpiceDoubleCell;
|
|
35
|
+
/**
|
|
36
|
+
* Create an empty character set cell.
|
|
37
|
+
*
|
|
38
|
+
* `length` is the maximum string length (including trailing NUL). CSPICE
|
|
39
|
+
* generally expects `length >= 2` and recommends `length >= 5`.
|
|
40
|
+
*/
|
|
41
|
+
newCharCell(size: number, length: number): SpiceCharCell;
|
|
42
|
+
/** Create an empty DP window with capacity for `maxIntervals` intervals. */
|
|
43
|
+
newWindow(maxIntervals: number): SpiceWindow;
|
|
44
|
+
/** Free a previously-created cell handle. */
|
|
45
|
+
freeCell(cell: SpiceIntCell | SpiceDoubleCell | SpiceCharCell): void;
|
|
46
|
+
/** Free a previously-created window handle. */
|
|
47
|
+
freeWindow(window: SpiceWindow): void;
|
|
48
|
+
/** Set the maximum cardinality of a cell. (`ssize_c`) */
|
|
49
|
+
ssize(size: number, cell: SpiceIntCell | SpiceDoubleCell | SpiceCharCell | SpiceWindow): void;
|
|
50
|
+
/** Set the cardinality of a cell. (`scard_c`) */
|
|
51
|
+
scard(card: number, cell: SpiceIntCell | SpiceDoubleCell | SpiceCharCell | SpiceWindow): void;
|
|
52
|
+
/** Get the cardinality of a cell. (`card_c`) */
|
|
53
|
+
card(cell: SpiceIntCell | SpiceDoubleCell | SpiceCharCell | SpiceWindow): number;
|
|
54
|
+
/** Get the maximum cardinality of a cell. (`size_c`) */
|
|
55
|
+
size(cell: SpiceIntCell | SpiceDoubleCell | SpiceCharCell | SpiceWindow): number;
|
|
56
|
+
/** Validate and normalize a set cell. (`valid_c`) */
|
|
57
|
+
valid(size: number, n: number, cell: SpiceIntCell | SpiceDoubleCell | SpiceCharCell | SpiceWindow): void;
|
|
58
|
+
/** Insert an integer into an integer set cell. (`insrti_c`) */
|
|
59
|
+
insrti(item: number, cell: SpiceIntCell): void;
|
|
60
|
+
/** Insert a double into a double set cell. (`insrtd_c`) */
|
|
61
|
+
insrtd(item: number, cell: SpiceDoubleCell): void;
|
|
62
|
+
/** Insert a string into a character set cell. (`insrtc_c`) */
|
|
63
|
+
insrtc(item: string, cell: SpiceCharCell): void;
|
|
64
|
+
/**
|
|
65
|
+
* Element inspection helpers.
|
|
66
|
+
*
|
|
67
|
+
* These are intentionally part of the public backend contract so callers can
|
|
68
|
+
* write tests / diagnostics without exposing raw memory views.
|
|
69
|
+
*
|
|
70
|
+
* Notes:
|
|
71
|
+
* - These methods **copy** data out of the underlying cell.
|
|
72
|
+
* - They are not intended as a high-performance bulk read API.
|
|
73
|
+
*/
|
|
74
|
+
/** Fetch the `index`th element of an integer cell. */
|
|
75
|
+
cellGeti(cell: SpiceIntCell, index: number): number;
|
|
76
|
+
/** Fetch the `index`th element of a double cell. */
|
|
77
|
+
cellGetd(cell: SpiceDoubleCell, index: number): number;
|
|
78
|
+
/**
|
|
79
|
+
* Fetch the `index`th element of a character cell.
|
|
80
|
+
*
|
|
81
|
+
* Backends may right-trim whitespace to match common CSPICE string handling.
|
|
82
|
+
*/
|
|
83
|
+
cellGetc(cell: SpiceCharCell, index: number): string;
|
|
84
|
+
/** Insert an interval into a DP window, merging overlaps. (`wninsd_c`) */
|
|
85
|
+
wninsd(left: number, right: number, window: SpiceWindow): void;
|
|
86
|
+
/** Return the number of intervals in a DP window. (`wncard_c`) */
|
|
87
|
+
wncard(window: SpiceWindow): number;
|
|
88
|
+
/** Fetch the `index`th interval from a DP window. (`wnfetd_c`) */
|
|
89
|
+
wnfetd(window: SpiceWindow, index: number): readonly [left: number, right: number];
|
|
90
|
+
/** Validate and normalize a DP window. (`wnvald_c`) */
|
|
91
|
+
wnvald(size: number, n: number, window: SpiceWindow): void;
|
|
92
|
+
}
|
|
93
|
+
export {};
|
|
94
|
+
//# sourceMappingURL=cells-windows.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Low-level SPICE "cells" and DP windows.
|
|
3
|
+
*
|
|
4
|
+
* Contract notes:
|
|
5
|
+
* - Cells/windows are **opaque handles** created by the backend and mutated in-place.
|
|
6
|
+
* - Capacity is fixed at creation time; overflow should throw (CSPICE-like).
|
|
7
|
+
* - Inspection is done via the raw operations here (no `.data` exposure).
|
|
8
|
+
*/
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=cells-windows.js.map
|
|
@@ -1,17 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Contract conventions:
|
|
3
|
+
* - Inputs are assumed validated at the backend boundary; the contract itself is primarily type-level.
|
|
4
|
+
* - Methods throw on invalid arguments or SPICE errors.
|
|
5
|
+
* - Lookups that may legitimately miss return `Found<T>` (`{ found: false }`) instead of throwing.
|
|
6
|
+
*/
|
|
7
|
+
import type { Mat3RowMajor, SpiceVector3 } from "../shared/types.js";
|
|
8
|
+
/** Backend contract for basic coordinate transforms and vector/matrix math. */
|
|
2
9
|
export interface CoordsVectorsApi {
|
|
10
|
+
/** SPICE `reclat_c`: rectangular -> latitudinal coordinates. */
|
|
3
11
|
reclat(rect: SpiceVector3): {
|
|
4
12
|
radius: number;
|
|
5
13
|
lon: number;
|
|
6
14
|
lat: number;
|
|
7
15
|
};
|
|
16
|
+
/** SPICE `latrec_c`: latitudinal -> rectangular coordinates. */
|
|
8
17
|
latrec(radius: number, lon: number, lat: number): SpiceVector3;
|
|
18
|
+
/** SPICE `recsph_c`: rectangular -> spherical coordinates. */
|
|
9
19
|
recsph(rect: SpiceVector3): {
|
|
10
20
|
radius: number;
|
|
11
21
|
colat: number;
|
|
12
22
|
lon: number;
|
|
13
23
|
};
|
|
24
|
+
/** SPICE `sphrec_c`: spherical -> rectangular coordinates. */
|
|
14
25
|
sphrec(radius: number, colat: number, lon: number): SpiceVector3;
|
|
26
|
+
/** SPICE `vnorm_c`: vector magnitude (Euclidean norm). */
|
|
15
27
|
vnorm(v: SpiceVector3): number;
|
|
16
28
|
/**
|
|
17
29
|
* Compute the unit vector of `v`.
|
|
@@ -22,9 +34,47 @@ export interface CoordsVectorsApi {
|
|
|
22
34
|
* This matches the NAIF CSPICE `vhat_c` definition.
|
|
23
35
|
*/
|
|
24
36
|
vhat(v: SpiceVector3): SpiceVector3;
|
|
37
|
+
/** SPICE `vdot_c`: dot product of two vectors. */
|
|
25
38
|
vdot(a: SpiceVector3, b: SpiceVector3): number;
|
|
39
|
+
/** SPICE `vcrss_c`: cross product of two vectors. */
|
|
26
40
|
vcrss(a: SpiceVector3, b: SpiceVector3): SpiceVector3;
|
|
27
|
-
|
|
28
|
-
|
|
41
|
+
/** SPICE `vadd_c`: vector addition. */
|
|
42
|
+
vadd(a: SpiceVector3, b: SpiceVector3): SpiceVector3;
|
|
43
|
+
/** SPICE `vsub_c`: vector subtraction. */
|
|
44
|
+
vsub(a: SpiceVector3, b: SpiceVector3): SpiceVector3;
|
|
45
|
+
/** SPICE `vminus_c`: negate a vector. */
|
|
46
|
+
vminus(v: SpiceVector3): SpiceVector3;
|
|
47
|
+
/** SPICE `vscl_c`: multiply vector by scalar. */
|
|
48
|
+
vscl(s: number, v: SpiceVector3): SpiceVector3;
|
|
49
|
+
/** SPICE `mxm_c`: matrix-matrix multiplication. */
|
|
50
|
+
mxm(a: Mat3RowMajor, b: Mat3RowMajor): Mat3RowMajor;
|
|
51
|
+
/**
|
|
52
|
+
* Generate a rotation matrix representing a rotation about a coordinate axis.
|
|
53
|
+
*
|
|
54
|
+
* Axis is 1=x, 2=y, 3=z.
|
|
55
|
+
*/
|
|
56
|
+
rotate(angle: number, axis: number): Mat3RowMajor;
|
|
57
|
+
/**
|
|
58
|
+
* Rotate a matrix about a coordinate axis.
|
|
59
|
+
*
|
|
60
|
+
* Axis is 1=x, 2=y, 3=z.
|
|
61
|
+
*/
|
|
62
|
+
rotmat(m: Mat3RowMajor, angle: number, axis: number): Mat3RowMajor;
|
|
63
|
+
/**
|
|
64
|
+
* Convert an axis and angle to a rotation matrix.
|
|
65
|
+
*/
|
|
66
|
+
axisar(axis: SpiceVector3, angle: number): Mat3RowMajor;
|
|
67
|
+
/** SPICE `georec_c`: geodetic lon/lat/alt -> rectangular coordinates. */
|
|
68
|
+
georec(lon: number, lat: number, alt: number, re: number, f: number): SpiceVector3;
|
|
69
|
+
/** SPICE `recgeo_c`: rectangular -> geodetic lon/lat/alt coordinates. */
|
|
70
|
+
recgeo(rect: SpiceVector3, re: number, f: number): {
|
|
71
|
+
lon: number;
|
|
72
|
+
lat: number;
|
|
73
|
+
alt: number;
|
|
74
|
+
};
|
|
75
|
+
/** SPICE `mxv_c`: multiply matrix by vector. */
|
|
76
|
+
mxv(m: Mat3RowMajor, v: SpiceVector3): SpiceVector3;
|
|
77
|
+
/** SPICE `mtxv_c`: multiply transpose(matrix) by vector. */
|
|
78
|
+
mtxv(m: Mat3RowMajor, v: SpiceVector3): SpiceVector3;
|
|
29
79
|
}
|
|
30
80
|
//# sourceMappingURL=coords-vectors.d.ts.map
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { SpiceHandle, SpiceVector3 } from "../shared/types.js";
|
|
2
|
+
import type { SpiceIntCell } from "./cells-windows.js";
|
|
3
|
+
import type { DlaDescriptor } from "./file-io.js";
|
|
4
|
+
/** Segment descriptor returned by `dskgd` (CSPICE: `SpiceDSKDescr`). */
|
|
5
|
+
export type DskDescriptor = {
|
|
6
|
+
surfce: number;
|
|
7
|
+
center: number;
|
|
8
|
+
dclass: number;
|
|
9
|
+
dtype: number;
|
|
10
|
+
frmcde: number;
|
|
11
|
+
corsys: number;
|
|
12
|
+
/** Coordinate system parameters (CSPICE: `corpar[SPICE_DSK_NSYPAR]`). */
|
|
13
|
+
corpar: number[];
|
|
14
|
+
co1min: number;
|
|
15
|
+
co1max: number;
|
|
16
|
+
co2min: number;
|
|
17
|
+
co2max: number;
|
|
18
|
+
co3min: number;
|
|
19
|
+
co3max: number;
|
|
20
|
+
start: number;
|
|
21
|
+
stop: number;
|
|
22
|
+
};
|
|
23
|
+
/** Summary bookkeeping parameters for a type 2 DSK segment (CSPICE: `dskb02_c`). */
|
|
24
|
+
export type DskType2Bookkeeping = {
|
|
25
|
+
nv: number;
|
|
26
|
+
np: number;
|
|
27
|
+
nvxtot: number;
|
|
28
|
+
/** Vertex bounds: `[[xmin,xmax],[ymin,ymax],[zmin,zmax]]` (CSPICE: `vtxbds[3][2]`). */
|
|
29
|
+
vtxbds: [[number, number], [number, number], [number, number]];
|
|
30
|
+
voxsiz: number;
|
|
31
|
+
voxori: SpiceVector3;
|
|
32
|
+
vgrext: SpiceVector3;
|
|
33
|
+
cgscal: number;
|
|
34
|
+
vtxnpl: number;
|
|
35
|
+
voxnpt: number;
|
|
36
|
+
voxnpl: number;
|
|
37
|
+
};
|
|
38
|
+
/** Backend contract for DSK (Digital Shape Kernel) segment queries. */
|
|
39
|
+
export interface DskApi {
|
|
40
|
+
/** Return the set of body IDs for which the specified DSK has segments. */
|
|
41
|
+
dskobj(dsk: string, bodids: SpiceIntCell): void;
|
|
42
|
+
/** Return the set of surface IDs for which the specified DSK has segments. */
|
|
43
|
+
dsksrf(dsk: string, bodyid: number, srfids: SpiceIntCell): void;
|
|
44
|
+
/** Return the descriptor of a DSK segment. */
|
|
45
|
+
dskgd(handle: SpiceHandle, dladsc: DlaDescriptor): DskDescriptor;
|
|
46
|
+
/** Return the type 2 DSK segment bookkeeping parameters. */
|
|
47
|
+
dskb02(handle: SpiceHandle, dladsc: DlaDescriptor): DskType2Bookkeeping;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=dsk.d.ts.map
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contract conventions:
|
|
3
|
+
* - Inputs are assumed validated at the backend boundary; the contract itself is primarily type-level.
|
|
4
|
+
* - Methods throw on invalid arguments or SPICE errors.
|
|
5
|
+
* - Lookups that may legitimately miss return `Found<T>` (`{ found: false }`) instead of throwing.
|
|
6
|
+
*/
|
|
7
|
+
import type { SpiceHandle } from "../shared/types.js";
|
|
8
|
+
/**
|
|
9
|
+
* Result of running an EK query via `ekfind`.
|
|
10
|
+
*
|
|
11
|
+
* Notes:
|
|
12
|
+
* - `ekfind` has a *non-standard* error reporting mechanism: query parse/semantic
|
|
13
|
+
* failures are returned via an `error/errmsg` output pair rather than SPICE's
|
|
14
|
+
* global error state.
|
|
15
|
+
* - Backend implementations should surface that query-specific failure via this
|
|
16
|
+
* return type (no throw).
|
|
17
|
+
* - SPICE-signaled failures (e.g. no loaded EKs) should still throw.
|
|
18
|
+
*/
|
|
19
|
+
export type EkFindResult = {
|
|
20
|
+
ok: true;
|
|
21
|
+
/** Number of matching rows. */
|
|
22
|
+
nmrows: number;
|
|
23
|
+
} | {
|
|
24
|
+
ok: false;
|
|
25
|
+
/** Query language parse/semantic error message returned by `ekfind_c`. */
|
|
26
|
+
errmsg: string;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Result of fetching an element from an EK query result set.
|
|
30
|
+
*
|
|
31
|
+
* This is a tri-state:
|
|
32
|
+
* - `{ found: false }`: the requested element doesn't exist (commonly `elment`
|
|
33
|
+
* is out of range for the entry).
|
|
34
|
+
* - `{ found: true, isNull: true }`: the entry exists but is SQL NULL.
|
|
35
|
+
* - `{ found: true, isNull: false, value: T }`: a concrete value.
|
|
36
|
+
*/
|
|
37
|
+
export type EkGetResult<T> = {
|
|
38
|
+
found: false;
|
|
39
|
+
} | {
|
|
40
|
+
found: true;
|
|
41
|
+
isNull: true;
|
|
42
|
+
} | {
|
|
43
|
+
found: true;
|
|
44
|
+
isNull: false;
|
|
45
|
+
value: T;
|
|
46
|
+
};
|
|
47
|
+
/** Backend contract for EK (Events Kernel) file/query operations. */
|
|
48
|
+
export interface EkApi {
|
|
49
|
+
/** Open an existing EK file for read (see `ekopr_c`). */
|
|
50
|
+
ekopr(path: string): SpiceHandle;
|
|
51
|
+
/** Open an existing EK file for write (see `ekopw_c`). */
|
|
52
|
+
ekopw(path: string): SpiceHandle;
|
|
53
|
+
/**
|
|
54
|
+
* Create and open a new EK file for write (see `ekopn_c`).
|
|
55
|
+
*
|
|
56
|
+
* `ncomch` is the number of comment characters to allocate for the EK.
|
|
57
|
+
*/
|
|
58
|
+
ekopn(path: string, ifname: string, ncomch: number): SpiceHandle;
|
|
59
|
+
/**
|
|
60
|
+
* Close an EK file opened via `ekopr` / `ekopw` / `ekopn` (see `ekcls_c`).
|
|
61
|
+
*
|
|
62
|
+
* Notes:
|
|
63
|
+
* - EK handles are explicit resources and are not automatically closed by `unload()` / `kclear()`.
|
|
64
|
+
* - If `path` was backed by byte-staged temp bytes, close EK handles before calling
|
|
65
|
+
* `unload()` / `kclear()` to allow best-effort temp file deletion (especially on Windows).
|
|
66
|
+
*/
|
|
67
|
+
ekcls(handle: SpiceHandle): void;
|
|
68
|
+
/**
|
|
69
|
+
* Number of EK tables currently loaded (see `ekntab_c`).
|
|
70
|
+
*
|
|
71
|
+
* Postconditions:
|
|
72
|
+
* - Returns an integer count `n` with `0 <= n <= 2_147_483_647`.
|
|
73
|
+
* - Backends should validate this postcondition and throw if violated.
|
|
74
|
+
*/
|
|
75
|
+
ekntab(): number;
|
|
76
|
+
/**
|
|
77
|
+
* Retrieve the EK table name by 0-based index (see `ektnam_c`).
|
|
78
|
+
*
|
|
79
|
+
* `n` must be in the range `0..ekntab()-1`.
|
|
80
|
+
*/
|
|
81
|
+
ektnam(n: number): string;
|
|
82
|
+
/**
|
|
83
|
+
* Number of segments in an EK file opened via handle (see `eknseg_c`).
|
|
84
|
+
*
|
|
85
|
+
* Postconditions:
|
|
86
|
+
* - Returns an integer count `n` with `0 <= n <= 2_147_483_647`.
|
|
87
|
+
* - Backends should validate this postcondition and throw if violated.
|
|
88
|
+
*/
|
|
89
|
+
eknseg(handle: SpiceHandle): number;
|
|
90
|
+
/**
|
|
91
|
+
* Execute an EK query (see `ekfind_c`).
|
|
92
|
+
*
|
|
93
|
+
* Notes:
|
|
94
|
+
* - EK query results live in CSPICE global state.
|
|
95
|
+
* - Beginning fast-write via `ekifld` can invalidate the active selection/result set.
|
|
96
|
+
* Avoid interleaving `ekfind`/`ekg*` reads with fast-write; rerun `ekfind` after fast-write
|
|
97
|
+
* if you need to read again.
|
|
98
|
+
*/
|
|
99
|
+
ekfind(query: string): EkFindResult;
|
|
100
|
+
/**
|
|
101
|
+
* Fetch a character-valued element from the active query result set (see `ekgc_c`).
|
|
102
|
+
*
|
|
103
|
+
* Indices are 0-based per NAIF:
|
|
104
|
+
* - `selidx`: 0-based index of the selected item in the query's `SELECT` clause.
|
|
105
|
+
* - `row`: 0-based row index in the result set (`0..nmrows-1` from the last successful `ekfind`).
|
|
106
|
+
* - `elment`: 0-based element index within the cell entry (`0` for scalar entries).
|
|
107
|
+
*/
|
|
108
|
+
ekgc(selidx: number, row: number, elment: number): EkGetResult<string>;
|
|
109
|
+
/**
|
|
110
|
+
* Fetch a double-valued element from the active query result set (see `ekgd_c`).
|
|
111
|
+
*
|
|
112
|
+
* Indices are 0-based per NAIF:
|
|
113
|
+
* - `selidx`: 0-based index of the selected item in the query's `SELECT` clause.
|
|
114
|
+
* - `row`: 0-based row index in the result set (`0..nmrows-1` from the last successful `ekfind`).
|
|
115
|
+
* - `elment`: 0-based element index within the cell entry (`0` for scalar entries).
|
|
116
|
+
*/
|
|
117
|
+
ekgd(selidx: number, row: number, elment: number): EkGetResult<number>;
|
|
118
|
+
/**
|
|
119
|
+
* Fetch an integer-valued element from the active query result set (see `ekgi_c`).
|
|
120
|
+
*
|
|
121
|
+
* Indices are 0-based per NAIF:
|
|
122
|
+
* - `selidx`: 0-based index of the selected item in the query's `SELECT` clause.
|
|
123
|
+
* - `row`: 0-based row index in the result set (`0..nmrows-1` from the last successful `ekfind`).
|
|
124
|
+
* - `elment`: 0-based element index within the cell entry (`0` for scalar entries).
|
|
125
|
+
*/
|
|
126
|
+
ekgi(selidx: number, row: number, elment: number): EkGetResult<number>;
|
|
127
|
+
/**
|
|
128
|
+
* Begin fast-write for a new EK segment (see `ekifld_c`).
|
|
129
|
+
*
|
|
130
|
+
* Returns `segno` (new segment number) and the `rcptrs` workspace array.
|
|
131
|
+
* `rcptrs` must be passed to the subsequent column-add calls and to `ekffld`.
|
|
132
|
+
*
|
|
133
|
+
* Notes:
|
|
134
|
+
* - Calling `ekifld` may invalidate the active EK query selection (from `ekfind`). If you need
|
|
135
|
+
* to read query results after starting fast-write, rerun `ekfind`.
|
|
136
|
+
*/
|
|
137
|
+
ekifld(handle: SpiceHandle, tabnam: string, nrows: number, cnames: readonly string[], decls: readonly string[]): {
|
|
138
|
+
segno: number;
|
|
139
|
+
rcptrs: number[];
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* Add an integer column's data to a fast-write segment (see `ekacli_c`).
|
|
143
|
+
*
|
|
144
|
+
* Packing:
|
|
145
|
+
* - `entszs`, `nlflgs`, and `rcptrs` are per-row arrays and must have the same length
|
|
146
|
+
* `nrows` (the `nrows` passed to `ekifld`, i.e. `rcptrs.length`).
|
|
147
|
+
* - `ivals` is a packed array containing exactly `sum(entszs)` values.
|
|
148
|
+
*
|
|
149
|
+
* NULL rows (`nlflgs[i] === true`):
|
|
150
|
+
* - Variable-size columns: set `entszs[i] = 0` and do not include any values for that row.
|
|
151
|
+
* - Fixed-size columns (`SIZE = N`): include/pad `N` placeholder values for that row and set
|
|
152
|
+
* `entszs[i] = N` so `ivals.length === sum(entszs)` remains true.
|
|
153
|
+
*/
|
|
154
|
+
ekacli(handle: SpiceHandle, segno: number, column: string, ivals: readonly number[], entszs: readonly number[], nlflgs: readonly boolean[], rcptrs: readonly number[]): void;
|
|
155
|
+
/**
|
|
156
|
+
* Add a double-precision column's data to a fast-write segment (see `ekacld_c`).
|
|
157
|
+
*
|
|
158
|
+
* Packing:
|
|
159
|
+
* - `entszs`, `nlflgs`, and `rcptrs` are per-row arrays and must have the same length
|
|
160
|
+
* `nrows` (the `nrows` passed to `ekifld`, i.e. `rcptrs.length`).
|
|
161
|
+
* - `dvals` is a packed array containing exactly `sum(entszs)` values.
|
|
162
|
+
*
|
|
163
|
+
* NULL rows (`nlflgs[i] === true`):
|
|
164
|
+
* - Variable-size columns: set `entszs[i] = 0` and do not include any values for that row.
|
|
165
|
+
* - Fixed-size columns (`SIZE = N`): include/pad `N` placeholder values for that row and set
|
|
166
|
+
* `entszs[i] = N` so `dvals.length === sum(entszs)` remains true.
|
|
167
|
+
*/
|
|
168
|
+
ekacld(handle: SpiceHandle, segno: number, column: string, dvals: readonly number[], entszs: readonly number[], nlflgs: readonly boolean[], rcptrs: readonly number[]): void;
|
|
169
|
+
/**
|
|
170
|
+
* Add a character column's data to a fast-write segment (see `ekaclc_c`).
|
|
171
|
+
*
|
|
172
|
+
* Packing:
|
|
173
|
+
* - `entszs`, `nlflgs`, and `rcptrs` are per-row arrays and must have the same length
|
|
174
|
+
* `nrows` (the `nrows` passed to `ekifld`, i.e. `rcptrs.length`).
|
|
175
|
+
* - `cvals` is a packed array containing exactly `sum(entszs)` values.
|
|
176
|
+
*
|
|
177
|
+
* NULL rows (`nlflgs[i] === true`):
|
|
178
|
+
* - Variable-size columns: set `entszs[i] = 0` and do not include any values for that row.
|
|
179
|
+
* - Fixed-size columns (`SIZE = N`): include/pad `N` placeholder values for that row and set
|
|
180
|
+
* `entszs[i] = N` so `cvals.length === sum(entszs)` remains true.
|
|
181
|
+
*/
|
|
182
|
+
ekaclc(handle: SpiceHandle, segno: number, column: string, cvals: readonly string[], entszs: readonly number[], nlflgs: readonly boolean[], rcptrs: readonly number[]): void;
|
|
183
|
+
/** Complete a fast-write segment (see `ekffld_c`). */
|
|
184
|
+
ekffld(handle: SpiceHandle, segno: number, rcptrs: readonly number[]): void;
|
|
185
|
+
}
|
|
186
|
+
//# sourceMappingURL=ek.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contract conventions:
|
|
3
|
+
* - Inputs are assumed validated at the backend boundary; the contract itself is primarily type-level.
|
|
4
|
+
* - Methods throw on invalid arguments or SPICE errors.
|
|
5
|
+
* - Lookups that may legitimately miss return `Found<T>` (`{ found: false }`) instead of throwing.
|
|
6
|
+
*/
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=ek.js.map
|
|
@@ -1,8 +1,146 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Contract conventions:
|
|
3
|
+
* - Inputs are assumed validated at the backend boundary; the contract itself is primarily type-level.
|
|
4
|
+
* - Methods throw on invalid arguments or SPICE errors.
|
|
5
|
+
* - Lookups that may legitimately miss return `Found<T>` (`{ found: false }`) instead of throwing.
|
|
6
|
+
*/
|
|
7
|
+
import type { AbCorr, Found, SpiceHandle, SpiceStateVector, SpkezrResult, SpkposResult, VirtualOutput } from "../shared/types.js";
|
|
8
|
+
import type { SpiceIntCell, SpiceWindow } from "./cells-windows.js";
|
|
9
|
+
/**
|
|
10
|
+
* Packed SPK segment descriptor (DAF summary) as a 5-double array.
|
|
11
|
+
*
|
|
12
|
+
* This is the packed form returned by `spksfs` and accepted by `spkuds`.
|
|
13
|
+
*/
|
|
14
|
+
export type SpkPackedDescriptor = readonly [number, number, number, number, number];
|
|
15
|
+
/** Unpacked SPK segment descriptor (see `spkuds_c`). */
|
|
16
|
+
export type SpkUnpackedDescriptor = {
|
|
17
|
+
body: number;
|
|
18
|
+
center: number;
|
|
19
|
+
frame: number;
|
|
20
|
+
type: number;
|
|
21
|
+
first: number;
|
|
22
|
+
last: number;
|
|
23
|
+
baddr: number;
|
|
24
|
+
eaddr: number;
|
|
25
|
+
};
|
|
26
|
+
/** Backend contract for SPK/ephemeris computations (positions, states, segment inspection). */
|
|
2
27
|
export interface EphemerisApi {
|
|
3
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* Compute state relative to observer using loaded kernels (see `spkezr_c`).
|
|
30
|
+
*
|
|
31
|
+
* Note: `abcorr` is a known set of SPICE aberration correction strings, but we allow arbitrary
|
|
32
|
+
* strings for forward-compatibility.
|
|
33
|
+
*/
|
|
4
34
|
spkezr(target: string, et: number, ref: string, abcorr: AbCorr | string, observer: string): SpkezrResult;
|
|
5
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* Compute position relative to observer using loaded kernels (see `spkpos_c`).
|
|
37
|
+
*/
|
|
6
38
|
spkpos(target: string, et: number, ref: string, abcorr: AbCorr | string, observer: string): SpkposResult;
|
|
39
|
+
/** Compute state (6-vector) and light time via `spkez` (numeric IDs). */
|
|
40
|
+
spkez(target: number, et: number, ref: string, abcorr: AbCorr | string, observer: number): SpkezrResult;
|
|
41
|
+
/** Compute position (3-vector) and light time via `spkezp` (numeric IDs). */
|
|
42
|
+
spkezp(target: number, et: number, ref: string, abcorr: AbCorr | string, observer: number): SpkposResult;
|
|
43
|
+
/** Compute geometric state (6-vector) and light time via `spkgeo` (numeric IDs). */
|
|
44
|
+
spkgeo(target: number, et: number, ref: string, observer: number): SpkezrResult;
|
|
45
|
+
/** Compute geometric position (3-vector) and light time via `spkgps` (numeric IDs). */
|
|
46
|
+
spkgps(target: number, et: number, ref: string, observer: number): SpkposResult;
|
|
47
|
+
/** Compute state (6-vector) of `target` relative to the solar system barycenter via `spkssb`. */
|
|
48
|
+
spkssb(target: number, et: number, ref: string): SpiceStateVector;
|
|
49
|
+
/**
|
|
50
|
+
* Compute the coverage window for an object in an SPK via `spkcov`.
|
|
51
|
+
*
|
|
52
|
+
* **Path semantics (backend-dependent):**
|
|
53
|
+
* - Node backend: `spk` is a host filesystem path.
|
|
54
|
+
* - WASM backend: `spk` is an Emscripten FS (virtual) path/id (typically the
|
|
55
|
+
* `path` you used in `furnsh({ path, bytes })`).
|
|
56
|
+
*
|
|
57
|
+
* **Output window requirements:** `cover` must be a valid, initialized window
|
|
58
|
+
* handle created by the backend (e.g. `newWindow(maxIntervals)`) and must have
|
|
59
|
+
* sufficient capacity for the merged output.
|
|
60
|
+
*
|
|
61
|
+
* **Error safety note:** Like CSPICE `spkcov_c`, if this routine throws while
|
|
62
|
+
* updating `cover` (including due to insufficient capacity), the contents of
|
|
63
|
+
* `cover` may be left in a corrupted/undefined state. If an error is thrown,
|
|
64
|
+
* do **not** keep using `cover`; free it and create a fresh window.
|
|
65
|
+
*
|
|
66
|
+
* **Window semantics:** `cover` is updated in place. Like CSPICE `spkcov_c`,
|
|
67
|
+
* coverage is **merged** with any intervals already present in `cover`.
|
|
68
|
+
* Clear the window first (e.g. `scard(0, cover)`) if you want to avoid
|
|
69
|
+
* accumulation.
|
|
70
|
+
*/
|
|
71
|
+
spkcov(spk: string, idcode: number, cover: SpiceWindow): void;
|
|
72
|
+
/**
|
|
73
|
+
* Find the set of objects present in an SPK via `spkobj`.
|
|
74
|
+
*
|
|
75
|
+
* **Path semantics (backend-dependent):**
|
|
76
|
+
* - Node backend: `spk` is a host filesystem path.
|
|
77
|
+
* - WASM backend: `spk` is an Emscripten FS (virtual) path/id (typically the
|
|
78
|
+
* `path` you used in `furnsh({ path, bytes })`).
|
|
79
|
+
*
|
|
80
|
+
* **Output cell requirements:** `ids` must be a valid, initialized set cell
|
|
81
|
+
* handle created by the backend (e.g. `newIntCell(size)`) and must have
|
|
82
|
+
* sufficient capacity for the unioned output.
|
|
83
|
+
*
|
|
84
|
+
* **Error safety note:** Like CSPICE `spkobj_c`, if this routine throws while
|
|
85
|
+
* updating `ids` (including due to insufficient capacity), the contents of
|
|
86
|
+
* `ids` may be left in a corrupted/undefined state. If an error is thrown, do
|
|
87
|
+
* **not** keep using `ids`; free it and create a fresh cell.
|
|
88
|
+
*
|
|
89
|
+
* **Cell semantics:** `ids` is updated in place. Like CSPICE `spkobj_c`, the
|
|
90
|
+
* output is the **union** of the IDs already present in `ids` and the IDs
|
|
91
|
+
* found in `spk`.
|
|
92
|
+
* Clear the cell first (e.g. `scard(0, ids)`) if you want to
|
|
93
|
+
* avoid accumulation.
|
|
94
|
+
*/
|
|
95
|
+
spkobj(spk: string, ids: SpiceIntCell): void;
|
|
96
|
+
/**
|
|
97
|
+
* Search loaded SPK files for the highest-priority segment applicable to `body` and `et`.
|
|
98
|
+
*
|
|
99
|
+
* Note: `handle` is the native SPICE DAF handle for the file containing the segment.
|
|
100
|
+
*/
|
|
101
|
+
spksfs(body: number, et: number): Found<{
|
|
102
|
+
handle: number;
|
|
103
|
+
descr: SpkPackedDescriptor;
|
|
104
|
+
ident: string;
|
|
105
|
+
}>;
|
|
106
|
+
/** Pack an SPK segment descriptor via `spkpds`. */
|
|
107
|
+
spkpds(body: number, center: number, frame: string, type: number, first: number, last: number): SpkPackedDescriptor;
|
|
108
|
+
/** Unpack a packed SPK segment descriptor via `spkuds`. */
|
|
109
|
+
spkuds(descr: SpkPackedDescriptor): SpkUnpackedDescriptor;
|
|
110
|
+
/**
|
|
111
|
+
* Open a new SPK file for write (see `spkopn_c`).
|
|
112
|
+
*
|
|
113
|
+
* `file` interpretation is backend-dependent:
|
|
114
|
+
* - Node: OS filesystem path
|
|
115
|
+
* - WASM: virtual id under the backend's virtual filesystem (currently
|
|
116
|
+
* normalized into `/kernels/...`).
|
|
117
|
+
*
|
|
118
|
+
* In other words, for the WASM backend, `file: string` is **not** a raw
|
|
119
|
+
* Emscripten absolute path. It is treated like other "kernel-ish" paths and
|
|
120
|
+
* is normalized into `/kernels`.
|
|
121
|
+
*
|
|
122
|
+
* Examples (WASM backend):
|
|
123
|
+
* - `spkopn("out.bsp", ...)` writes to `/kernels/out.bsp`
|
|
124
|
+
* - `spkopn("/kernels/out.bsp", ...)` refers to the same file
|
|
125
|
+
* - `spkopn("/tmp/out.bsp", ...)` throws (OS paths/URLs are rejected)
|
|
126
|
+
*
|
|
127
|
+
* When `file` is a `VirtualOutput`, backends should allow reading bytes back
|
|
128
|
+
* via `readVirtualOutput()` after closing the file handle.
|
|
129
|
+
*
|
|
130
|
+
* Callers should retain the `VirtualOutput` they passed to `spkopn`/`spkopa`.
|
|
131
|
+
* It is the identifier used to read bytes back later.
|
|
132
|
+
*/
|
|
133
|
+
spkopn(file: string | VirtualOutput, ifname: string, ncomch: number): SpiceHandle;
|
|
134
|
+
/** Open an existing SPK for append (see `spkopa_c`). Same `file` semantics as `spkopn`. */
|
|
135
|
+
spkopa(file: string | VirtualOutput): SpiceHandle;
|
|
136
|
+
/** Close an SPK file previously opened by `spkopn`/`spkopa` (see `spkcls_c`). */
|
|
137
|
+
spkcls(handle: SpiceHandle): void;
|
|
138
|
+
/**
|
|
139
|
+
* Write a type 8 SPK segment (see `spkw08_c`).
|
|
140
|
+
*
|
|
141
|
+
* `states` is a flat array with layout `[x,y,z, dx,dy,dz]` for each record.
|
|
142
|
+
* The number of records `n` is derived as `states.length / 6`.
|
|
143
|
+
*/
|
|
144
|
+
spkw08(handle: SpiceHandle, body: number, center: number, frame: string, first: number, last: number, segid: string, degree: number, states: readonly number[] | Float64Array, epoch1: number, step: number): void;
|
|
7
145
|
}
|
|
8
146
|
//# sourceMappingURL=ephemeris.d.ts.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contract conventions:
|
|
3
|
+
* - Inputs are assumed validated at the backend boundary; the contract itself is primarily type-level.
|
|
4
|
+
* - Methods throw on invalid arguments or SPICE errors.
|
|
5
|
+
* - Lookups that may legitimately miss return `Found<T>` (`{ found: false }`) instead of throwing.
|
|
6
|
+
*
|
|
7
|
+
* Error policy:
|
|
8
|
+
* - Backend methods throw for SPICE-signaled failures.
|
|
9
|
+
* - "Found-style" routines (e.g. `bodn2c`, `bodc2n`, `namfrm`, ...) must **not** throw when
|
|
10
|
+
* SPICE reports "not found" via a `found` output flag; they return `{ found: false }`.
|
|
11
|
+
*/
|
|
12
|
+
/** Subset of CSPICE error/status utilities exposed by tspice backends. */
|
|
13
|
+
export declare const GETMSG_WHICH_VALUES: readonly ["SHORT", "LONG", "EXPLAIN"];
|
|
14
|
+
export type GetmsgWhich = (typeof GETMSG_WHICH_VALUES)[number];
|
|
15
|
+
/** Type guard for {@link GetmsgWhich}. */
|
|
16
|
+
export declare function isGetmsgWhich(which: unknown): which is GetmsgWhich;
|
|
17
|
+
/**
|
|
18
|
+
* Runtime validation for `getmsg(which)`.
|
|
19
|
+
*
|
|
20
|
+
* Even though `which` is a narrow union type, callers may still pass arbitrary
|
|
21
|
+
* values at runtime (e.g. JS consumers, `as any`, etc.). Backends must reject
|
|
22
|
+
* invalid selectors rather than forwarding them to CSPICE.
|
|
23
|
+
*/
|
|
24
|
+
export declare function assertGetmsgWhich(which: unknown): asserts which is GetmsgWhich;
|
|
25
|
+
/** Backend contract for SPICE error/status utilities (failed/reset/getmsg/etc). */
|
|
26
|
+
export interface ErrorApi {
|
|
27
|
+
/** Return `true` if the CSPICE error status is currently set. */
|
|
28
|
+
failed(): boolean;
|
|
29
|
+
/** Reset/clear the CSPICE error status and messages. */
|
|
30
|
+
reset(): void;
|
|
31
|
+
/** Get a CSPICE error message component. */
|
|
32
|
+
getmsg(which: GetmsgWhich): string;
|
|
33
|
+
/** Set the long error message text used by `sigerr()`. */
|
|
34
|
+
setmsg(message: string): void;
|
|
35
|
+
/** Signal a CSPICE error with the provided short error code (e.g. `"SPICE(BADTIME)"`). */
|
|
36
|
+
sigerr(short: string): void;
|
|
37
|
+
/** Add `name` to the CSPICE traceback stack. */
|
|
38
|
+
chkin(name: string): void;
|
|
39
|
+
/** Remove `name` from the CSPICE traceback stack. */
|
|
40
|
+
chkout(name: string): void;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=error.d.ts.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contract conventions:
|
|
3
|
+
* - Inputs are assumed validated at the backend boundary; the contract itself is primarily type-level.
|
|
4
|
+
* - Methods throw on invalid arguments or SPICE errors.
|
|
5
|
+
* - Lookups that may legitimately miss return `Found<T>` (`{ found: false }`) instead of throwing.
|
|
6
|
+
*
|
|
7
|
+
* Error policy:
|
|
8
|
+
* - Backend methods throw for SPICE-signaled failures.
|
|
9
|
+
* - "Found-style" routines (e.g. `bodn2c`, `bodc2n`, `namfrm`, ...) must **not** throw when
|
|
10
|
+
* SPICE reports "not found" via a `found` output flag; they return `{ found: false }`.
|
|
11
|
+
*/
|
|
12
|
+
/** Subset of CSPICE error/status utilities exposed by tspice backends. */
|
|
13
|
+
export const GETMSG_WHICH_VALUES = ["SHORT", "LONG", "EXPLAIN"];
|
|
14
|
+
/** Type guard for {@link GetmsgWhich}. */
|
|
15
|
+
export function isGetmsgWhich(which) {
|
|
16
|
+
return (which === "SHORT" ||
|
|
17
|
+
which === "LONG" ||
|
|
18
|
+
which === "EXPLAIN");
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Runtime validation for `getmsg(which)`.
|
|
22
|
+
*
|
|
23
|
+
* Even though `which` is a narrow union type, callers may still pass arbitrary
|
|
24
|
+
* values at runtime (e.g. JS consumers, `as any`, etc.). Backends must reject
|
|
25
|
+
* invalid selectors rather than forwarding them to CSPICE.
|
|
26
|
+
*/
|
|
27
|
+
export function assertGetmsgWhich(which) {
|
|
28
|
+
if (isGetmsgWhich(which))
|
|
29
|
+
return;
|
|
30
|
+
const allowed = GETMSG_WHICH_VALUES.map((v) => JSON.stringify(v)).join(" | ");
|
|
31
|
+
throw new TypeError(`getmsg(which) expected one of ${allowed} (got ${JSON.stringify(which)})`);
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=error.js.map
|