siderust-js 0.1.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/.github/workflows/ci.yml +166 -0
- package/.gitmodules +9 -0
- package/CHANGELOG.md +26 -0
- package/LICENSE +661 -0
- package/README.md +138 -0
- package/package.json +12 -0
- package/qtty-js/.github/workflows/ci.yml +151 -0
- package/qtty-js/.gitmodules +3 -0
- package/qtty-js/CHANGELOG.md +31 -0
- package/qtty-js/LICENSE +661 -0
- package/qtty-js/README.md +132 -0
- package/qtty-js/package.json +20 -0
- package/qtty-js/qtty/.github/workflows/ci.yml +155 -0
- package/qtty-js/qtty/CHANGELOG.md +120 -0
- package/qtty-js/qtty/Cargo.lock +1462 -0
- package/qtty-js/qtty/Cargo.toml +12 -0
- package/qtty-js/qtty/LICENSE +661 -0
- package/qtty-js/qtty/README.md +9 -0
- package/qtty-js/qtty/qtty/Cargo.toml +41 -0
- package/qtty-js/qtty/qtty/README.md +8 -0
- package/qtty-js/qtty/qtty/examples/angles.rs +14 -0
- package/qtty-js/qtty/qtty/examples/astronomy.rs +17 -0
- package/qtty-js/qtty/qtty/examples/dimensional_arithmetic.rs +83 -0
- package/qtty-js/qtty/qtty/examples/python_integration.rs +61 -0
- package/qtty-js/qtty/qtty/examples/quickstart.rs +15 -0
- package/qtty-js/qtty/qtty/examples/ratios.rs +12 -0
- package/qtty-js/qtty/qtty/examples/serde_with_unit.rs +234 -0
- package/qtty-js/qtty/qtty/examples/serialization.rs +141 -0
- package/qtty-js/qtty/qtty/examples/serialization_advanced.rs +155 -0
- package/qtty-js/qtty/qtty/src/f32.rs +108 -0
- package/qtty-js/qtty/qtty/src/f64.rs +30 -0
- package/qtty-js/qtty/qtty/src/i128.rs +111 -0
- package/qtty-js/qtty/qtty/src/i16.rs +111 -0
- package/qtty-js/qtty/qtty/src/i32.rs +111 -0
- package/qtty-js/qtty/qtty/src/i64.rs +111 -0
- package/qtty-js/qtty/qtty/src/i8.rs +111 -0
- package/qtty-js/qtty/qtty/src/lib.rs +238 -0
- package/qtty-js/qtty/qtty/tests/fixtures/qtty-vec-no-std/Cargo.lock +83 -0
- package/qtty-js/qtty/qtty/tests/fixtures/qtty-vec-no-std/Cargo.toml +10 -0
- package/qtty-js/qtty/qtty/tests/fixtures/qtty-vec-no-std/src/lib.rs +7 -0
- package/qtty-js/qtty/qtty/tests/fixtures/qtty-vec-no-std-alloc/Cargo.lock +83 -0
- package/qtty-js/qtty/qtty/tests/fixtures/qtty-vec-no-std-alloc/Cargo.toml +10 -0
- package/qtty-js/qtty/qtty/tests/fixtures/qtty-vec-no-std-alloc/src/lib.rs +7 -0
- package/qtty-js/qtty/qtty/tests/fixtures/qtty-vec-std/Cargo.lock +83 -0
- package/qtty-js/qtty/qtty/tests/fixtures/qtty-vec-std/Cargo.toml +10 -0
- package/qtty-js/qtty/qtty/tests/fixtures/qtty-vec-std/src/lib.rs +5 -0
- package/qtty-js/qtty/qtty/tests/integration_tests.rs +529 -0
- package/qtty-js/qtty/qtty/tests/qtty_vec_feature_matrix.rs +58 -0
- package/qtty-js/qtty/qtty-core/Cargo.toml +41 -0
- package/qtty-js/qtty/qtty-core/README.md +8 -0
- package/qtty-js/qtty/qtty-core/examples/diesel_integration.rs +145 -0
- package/qtty-js/qtty/qtty-core/examples/quantity_db_serde.rs +215 -0
- package/qtty-js/qtty/qtty-core/src/dimension.rs +249 -0
- package/qtty-js/qtty/qtty-core/src/feature_diesel.rs +318 -0
- package/qtty-js/qtty/qtty-core/src/feature_pyo3.rs +27 -0
- package/qtty-js/qtty/qtty-core/src/feature_serde.rs +203 -0
- package/qtty-js/qtty/qtty-core/src/feature_tiberius.rs +28 -0
- package/qtty-js/qtty/qtty-core/src/lib.rs +744 -0
- package/qtty-js/qtty/qtty-core/src/macros.rs +93 -0
- package/qtty-js/qtty/qtty-core/src/quantity.rs +810 -0
- package/qtty-js/qtty/qtty-core/src/scalar.rs +1742 -0
- package/qtty-js/qtty/qtty-core/src/unit.rs +332 -0
- package/qtty-js/qtty/qtty-core/src/units/angular.rs +1228 -0
- package/qtty-js/qtty/qtty-core/src/units/area.rs +243 -0
- package/qtty-js/qtty/qtty-core/src/units/frequency.rs +179 -0
- package/qtty-js/qtty/qtty-core/src/units/length.rs +1270 -0
- package/qtty-js/qtty/qtty-core/src/units/mass.rs +488 -0
- package/qtty-js/qtty/qtty-core/src/units/mod.rs +26 -0
- package/qtty-js/qtty/qtty-core/src/units/power.rs +324 -0
- package/qtty-js/qtty/qtty-core/src/units/time.rs +667 -0
- package/qtty-js/qtty/qtty-core/src/units/unitless.rs +212 -0
- package/qtty-js/qtty/qtty-core/src/units/velocity.rs +210 -0
- package/qtty-js/qtty/qtty-core/src/units/volume.rs +269 -0
- package/qtty-js/qtty/qtty-core/tests/core.rs +628 -0
- package/qtty-js/qtty/qtty-core/tests/diesel.rs +461 -0
- package/qtty-js/qtty/qtty-core/tests/integers.rs +632 -0
- package/qtty-js/qtty/qtty-core/tests/no_cross_unit_ops.rs +35 -0
- package/qtty-js/qtty/qtty-core/tests/pyo3.rs +334 -0
- package/qtty-js/qtty/qtty-core/tests/quantity_f32.rs +276 -0
- package/qtty-js/qtty/qtty-core/tests/scalar_decimal.rs +258 -0
- package/qtty-js/qtty/qtty-core/tests/scalar_f32.rs +286 -0
- package/qtty-js/qtty/qtty-core/tests/scalar_f64_real.rs +287 -0
- package/qtty-js/qtty/qtty-core/tests/scalar_rational.rs +260 -0
- package/qtty-js/qtty/qtty-core/tests/serde.rs +256 -0
- package/qtty-js/qtty/qtty-core/tests/tiberius.rs +208 -0
- package/qtty-js/qtty/qtty-derive/Cargo.toml +23 -0
- package/qtty-js/qtty/qtty-derive/README.md +8 -0
- package/qtty-js/qtty/qtty-derive/src/lib.rs +340 -0
- package/qtty-js/qtty/qtty-ffi/ARCHITECTURE.md +3 -0
- package/qtty-js/qtty/qtty-ffi/Cargo.toml +31 -0
- package/qtty-js/qtty/qtty-ffi/README.md +9 -0
- package/qtty-js/qtty/qtty-ffi/build.rs +326 -0
- package/qtty-js/qtty/qtty-ffi/cbindgen.toml +105 -0
- package/qtty-js/qtty/qtty-ffi/include/qtty_ffi.h +1126 -0
- package/qtty-js/qtty/qtty-ffi/src/ffi.rs +1251 -0
- package/qtty-js/qtty/qtty-ffi/src/ffi_serde.rs +294 -0
- package/qtty-js/qtty/qtty-ffi/src/helpers.rs +310 -0
- package/qtty-js/qtty/qtty-ffi/src/lib.rs +229 -0
- package/qtty-js/qtty/qtty-ffi/src/macros.rs +121 -0
- package/qtty-js/qtty/qtty-ffi/src/registry.rs +274 -0
- package/qtty-js/qtty/qtty-ffi/src/types.rs +620 -0
- package/qtty-js/qtty/qtty-ffi/tests/integration_tests.rs +842 -0
- package/qtty-js/qtty/qtty-ffi/units.csv +156 -0
- package/qtty-js/qtty/qtty-ffi/units.csv.md +3 -0
- package/qtty-js/qtty-node/.prettierignore +6 -0
- package/qtty-js/qtty-node/.prettierrc.json +6 -0
- package/qtty-js/qtty-node/README.md +250 -0
- package/qtty-js/qtty-node/c8.config.json +11 -0
- package/qtty-js/qtty-node/eslint.config.js +31 -0
- package/qtty-js/qtty-node/examples/arithmetic.mjs +64 -0
- package/qtty-js/qtty-node/examples/astronomy.mjs +90 -0
- package/qtty-js/qtty-node/examples/quickstart.mjs +36 -0
- package/qtty-js/qtty-node/examples/serialization.mjs +125 -0
- package/qtty-js/qtty-node/examples/unit_factories.mjs +74 -0
- package/qtty-js/qtty-node/index.d.ts +219 -0
- package/qtty-js/qtty-node/index.js +323 -0
- package/qtty-js/qtty-node/lib/DerivedQuantity.js +122 -0
- package/qtty-js/qtty-node/lib/Quantity.js +151 -0
- package/qtty-js/qtty-node/lib/backend.js +25 -0
- package/qtty-js/qtty-node/native.cjs +306 -0
- package/qtty-js/qtty-node/package-lock.json +3223 -0
- package/qtty-js/qtty-node/package.json +70 -0
- package/qtty-js/qtty-node/units.d.ts +299 -0
- package/qtty-js/qtty-node/units.js +210 -0
- package/qtty-js/qtty-web/Cargo.lock +767 -0
- package/qtty-js/qtty-web/Cargo.toml +21 -0
- package/qtty-js/qtty-web/index.d.ts +140 -0
- package/qtty-js/qtty-web/index.js +20 -0
- package/qtty-js/qtty-web/lib/DerivedQuantity.js +58 -0
- package/qtty-js/qtty-web/lib/Quantity.js +75 -0
- package/qtty-js/qtty-web/lib/backend.js +80 -0
- package/qtty-js/qtty-web/package.json +45 -0
- package/qtty-js/qtty-web/src/lib.rs +111 -0
- package/qtty-js/scripts/ci.sh +73 -0
- package/scripts/ci.sh +123 -0
- package/siderust-core/Cargo.lock +787 -0
- package/siderust-core/Cargo.toml +18 -0
- package/siderust-core/DEDUPLICATION.md +124 -0
- package/siderust-core/src/body.rs +120 -0
- package/siderust-core/src/events.rs +184 -0
- package/siderust-core/src/lib.rs +20 -0
- package/siderust-core/src/observer.rs +55 -0
- package/siderust-core/src/position.rs +213 -0
- package/siderust-node/.prettierignore +7 -0
- package/siderust-node/.prettierrc.json +6 -0
- package/siderust-node/Cargo.lock +906 -0
- package/siderust-node/Cargo.toml +29 -0
- package/siderust-node/README.md +109 -0
- package/siderust-node/__test__/index.test.mjs +248 -0
- package/siderust-node/build.rs +5 -0
- package/siderust-node/c8.config.json +3 -0
- package/siderust-node/eslint.config.js +31 -0
- package/siderust-node/examples/01_basic_coordinates.mjs +24 -0
- package/siderust-node/examples/02_coordinate_transformations.mjs +25 -0
- package/siderust-node/examples/03_all_frames_conversions.mjs +26 -0
- package/siderust-node/examples/04_all_center_conversions.mjs +24 -0
- package/siderust-node/examples/05_target_tracking.mjs +22 -0
- package/siderust-node/examples/06_night_events.mjs +18 -0
- package/siderust-node/examples/07_moon_properties.mjs +21 -0
- package/siderust-node/examples/08_solar_system.mjs +19 -0
- package/siderust-node/examples/09_star_observability.mjs +22 -0
- package/siderust-node/examples/10_time_periods.mjs +9 -0
- package/siderust-node/examples/11_serialization.mjs +31 -0
- package/siderust-node/examples/12_runtime_ephemeris.mjs +27 -0
- package/siderust-node/examples/13_coordinate_operations.mjs +20 -0
- package/siderust-node/index.d.ts +623 -0
- package/siderust-node/index.js +79 -0
- package/siderust-node/lib/Observer.js +112 -0
- package/siderust-node/lib/Star.js +118 -0
- package/siderust-node/lib/backend.js +63 -0
- package/siderust-node/lib/wrappers.js +566 -0
- package/siderust-node/main.js +20 -0
- package/siderust-node/native.cjs +360 -0
- package/siderust-node/package-lock.json +3261 -0
- package/siderust-node/package.json +71 -0
- package/siderust-node/src/body.rs +74 -0
- package/siderust-node/src/coordinates.rs +372 -0
- package/siderust-node/src/ephemeris.rs +462 -0
- package/siderust-node/src/events.rs +577 -0
- package/siderust-node/src/lib.rs +43 -0
- package/siderust-node/src/observer.rs +132 -0
- package/siderust-node/src/phase.rs +218 -0
- package/siderust-node/src/position.rs +292 -0
- package/siderust-node/src/star.rs +200 -0
- package/siderust-web/Cargo.lock +855 -0
- package/siderust-web/Cargo.toml +34 -0
- package/siderust-web/README.md +100 -0
- package/siderust-web/__test__/index.test.mjs +118 -0
- package/siderust-web/examples/github-pages/README.md +31 -0
- package/siderust-web/examples/github-pages/index.html +135 -0
- package/siderust-web/index.d.ts +311 -0
- package/siderust-web/index.js +66 -0
- package/siderust-web/lib/Observer.js +103 -0
- package/siderust-web/lib/Star.js +116 -0
- package/siderust-web/lib/backend.js +400 -0
- package/siderust-web/lib/wrappers.js +512 -0
- package/siderust-web/package.json +55 -0
- package/siderust-web/src/body.rs +69 -0
- package/siderust-web/src/coordinates.rs +302 -0
- package/siderust-web/src/ephemeris.rs +456 -0
- package/siderust-web/src/events.rs +520 -0
- package/siderust-web/src/lib.rs +51 -0
- package/siderust-web/src/observer.rs +117 -0
- package/siderust-web/src/phase.rs +190 -0
- package/siderust-web/src/position.rs +291 -0
- package/siderust-web/src/star.rs +178 -0
- package/tempoch-js/.github/workflows/ci.yml +142 -0
- package/tempoch-js/.gitmodules +3 -0
- package/tempoch-js/CHANGELOG.md +25 -0
- package/tempoch-js/LICENSE +661 -0
- package/tempoch-js/README.md +126 -0
- package/tempoch-js/package.json +20 -0
- package/tempoch-js/scripts/ci.sh +73 -0
- package/tempoch-js/tempoch/.github/workflows/ci.yml +113 -0
- package/tempoch-js/tempoch/CHANGELOG.md +82 -0
- package/tempoch-js/tempoch/Cargo.lock +947 -0
- package/tempoch-js/tempoch/Cargo.toml +3 -0
- package/tempoch-js/tempoch/LICENSE +661 -0
- package/tempoch-js/tempoch/README.md +76 -0
- package/tempoch-js/tempoch/tempoch/Cargo.toml +27 -0
- package/tempoch-js/tempoch/tempoch/examples/periods.rs +45 -0
- package/tempoch-js/tempoch/tempoch/examples/quickstart.rs +13 -0
- package/tempoch-js/tempoch/tempoch/src/lib.rs +49 -0
- package/tempoch-js/tempoch/tempoch/tests/integration.rs +57 -0
- package/tempoch-js/tempoch/tempoch-core/Cargo.toml +24 -0
- package/tempoch-js/tempoch/tempoch-core/src/delta_t.rs +345 -0
- package/tempoch-js/tempoch/tempoch-core/src/instant.rs +811 -0
- package/tempoch-js/tempoch/tempoch-core/src/julian_date_ext.rs +142 -0
- package/tempoch-js/tempoch/tempoch-core/src/lib.rs +81 -0
- package/tempoch-js/tempoch/tempoch-core/src/period.rs +1168 -0
- package/tempoch-js/tempoch/tempoch-core/src/scales.rs +779 -0
- package/tempoch-js/tempoch/tempoch-ffi/Cargo.lock +889 -0
- package/tempoch-js/tempoch/tempoch-ffi/Cargo.toml +26 -0
- package/tempoch-js/tempoch/tempoch-ffi/build.rs +24 -0
- package/tempoch-js/tempoch/tempoch-ffi/cbindgen.toml +30 -0
- package/tempoch-js/tempoch/tempoch-ffi/src/error.rs +19 -0
- package/tempoch-js/tempoch/tempoch-ffi/src/lib.rs +82 -0
- package/tempoch-js/tempoch/tempoch-ffi/src/period.rs +101 -0
- package/tempoch-js/tempoch/tempoch-ffi/src/time.rs +711 -0
- package/tempoch-js/tempoch/tempoch-ffi/tests/ffi.rs +265 -0
- package/tempoch-js/tempoch-node/.prettierignore +6 -0
- package/tempoch-js/tempoch-node/.prettierrc.json +6 -0
- package/tempoch-js/tempoch-node/Cargo.lock +496 -0
- package/tempoch-js/tempoch-node/Cargo.toml +29 -0
- package/tempoch-js/tempoch-node/README.md +265 -0
- package/tempoch-js/tempoch-node/__test__/index.test.mjs +598 -0
- package/tempoch-js/tempoch-node/build.rs +5 -0
- package/tempoch-js/tempoch-node/c8.config.json +3 -0
- package/tempoch-js/tempoch-node/eslint.config.js +31 -0
- package/tempoch-js/tempoch-node/examples/periods.mjs +79 -0
- package/tempoch-js/tempoch-node/examples/quickstart.mjs +71 -0
- package/tempoch-js/tempoch-node/examples/timescales.mjs +92 -0
- package/tempoch-js/tempoch-node/index.d.ts +280 -0
- package/tempoch-js/tempoch-node/index.js +32 -0
- package/tempoch-js/tempoch-node/lib/JulianDate.js +176 -0
- package/tempoch-js/tempoch-node/lib/ModifiedJulianDate.js +156 -0
- package/tempoch-js/tempoch-node/lib/Period.js +133 -0
- package/tempoch-js/tempoch-node/lib/backend.js +38 -0
- package/tempoch-js/tempoch-node/lib/qttyCompat.js +92 -0
- package/tempoch-js/tempoch-node/native.cjs +317 -0
- package/tempoch-js/tempoch-node/package-lock.json +3223 -0
- package/tempoch-js/tempoch-node/package.json +56 -0
- package/tempoch-js/tempoch-node/src/lib.rs +573 -0
- package/tempoch-js/tempoch-web/Cargo.toml +23 -0
- package/tempoch-js/tempoch-web/index.d.ts +95 -0
- package/tempoch-js/tempoch-web/index.js +27 -0
- package/tempoch-js/tempoch-web/lib/JulianDate.js +170 -0
- package/tempoch-js/tempoch-web/lib/ModifiedJulianDate.js +145 -0
- package/tempoch-js/tempoch-web/lib/Period.js +121 -0
- package/tempoch-js/tempoch-web/lib/backend.js +118 -0
- package/tempoch-js/tempoch-web/package.json +46 -0
- package/tempoch-js/tempoch-web/src/lib.rs +184 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# tempoch-js workspace
|
|
2
|
+
|
|
3
|
+
JavaScript and WebAssembly bindings for
|
|
4
|
+
[tempoch](./tempoch/README.md), the Siderust astronomical time library.
|
|
5
|
+
|
|
6
|
+
This repository is the publishable JS workspace. It contains the npm packages,
|
|
7
|
+
the thin Rust transport layers for Node and Web, and the vendored `tempoch`
|
|
8
|
+
workspace that provides the canonical time-scale, epoch, and period logic.
|
|
9
|
+
|
|
10
|
+
## Packages
|
|
11
|
+
|
|
12
|
+
| Package | Target | Status | Notes |
|
|
13
|
+
| --- | --- | --- | --- |
|
|
14
|
+
| [`@siderust/tempoch`](./tempoch-node/README.md) | Node.js | `0.1.0` | Native addon built with `napi-rs`; uses `@siderust/qtty@^0.1.0` for quantity objects in the JS API. |
|
|
15
|
+
| `@siderust/tempoch-web` | Browsers / bundlers | `0.1.0` | WebAssembly build with `wasm-bindgen`; requires `await init()` and uses `@siderust/qtty-web@^0.1.0` for quantity objects in the API. |
|
|
16
|
+
|
|
17
|
+
The Rust crates under `tempoch-node/` and `tempoch-web/` are transport layers
|
|
18
|
+
only. All astronomical time semantics come from the vendored
|
|
19
|
+
[`tempoch`](./tempoch) workspace.
|
|
20
|
+
|
|
21
|
+
## Repository layout
|
|
22
|
+
|
|
23
|
+
```text
|
|
24
|
+
tempoch-js/
|
|
25
|
+
├── tempoch/ Vendored Rust workspace (canonical time logic)
|
|
26
|
+
├── tempoch-node/ Node package: @siderust/tempoch
|
|
27
|
+
├── tempoch-web/ Browser package: @siderust/tempoch-web
|
|
28
|
+
└── scripts/ CI helpers for the Node package
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## What ships in 0.1.0
|
|
32
|
+
|
|
33
|
+
- A Node package exposing `JulianDate`, `ModifiedJulianDate`, `Period`, UTC
|
|
34
|
+
conversion helpers, and epoch arithmetic utilities.
|
|
35
|
+
- A browser/WASM package exposing the same core time model with explicit async
|
|
36
|
+
initialization via `init()`.
|
|
37
|
+
- JS APIs that interoperate with the published `qtty-js` `0.1.0` line, using
|
|
38
|
+
`@siderust/qtty` and `@siderust/qtty-web` quantity objects for durations and
|
|
39
|
+
day-count results.
|
|
40
|
+
- TypeScript declarations for both packages matching the runtime surface.
|
|
41
|
+
- Node examples, tests, and CI for format, lint, build, test, and coverage.
|
|
42
|
+
|
|
43
|
+
## Install
|
|
44
|
+
|
|
45
|
+
### Node.js
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
npm install @siderust/tempoch @siderust/qtty
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
```js
|
|
52
|
+
const { JulianDate } = require('@siderust/tempoch');
|
|
53
|
+
const { Hours } = require('@siderust/qtty/units');
|
|
54
|
+
|
|
55
|
+
const jd = JulianDate.j2000();
|
|
56
|
+
const later = jd.add(Hours(6));
|
|
57
|
+
console.log(later.toDate().toISOString());
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Browser / WebAssembly
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
npm install @siderust/tempoch-web @siderust/qtty-web
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
```js
|
|
67
|
+
import { init, JulianDate } from '@siderust/tempoch-web';
|
|
68
|
+
import { Quantity } from '@siderust/qtty-web';
|
|
69
|
+
|
|
70
|
+
await init();
|
|
71
|
+
|
|
72
|
+
const jd = JulianDate.j2000();
|
|
73
|
+
const later = jd.add(new Quantity(6, 'Hour'));
|
|
74
|
+
console.log(later.toDate().toISOString());
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Development
|
|
78
|
+
|
|
79
|
+
Clone the repository with submodules so the vendored Rust workspace is present:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
git clone --recurse-submodules git@github.com:Siderust/tempoch-js.git
|
|
83
|
+
cd tempoch-js
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
If you already cloned without submodules:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
git submodule update --init --recursive
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Node package workflow
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
cd tempoch-node
|
|
96
|
+
npm ci
|
|
97
|
+
npm run build:debug
|
|
98
|
+
npm test
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
The repository also exposes CI helpers:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
./scripts/ci.sh all
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Web package workflow
|
|
108
|
+
|
|
109
|
+
`tempoch-web` uses `wasm-pack`:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
cd tempoch-web
|
|
113
|
+
wasm-pack build --target web --out-dir pkg --release --scope siderust
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Related documentation
|
|
117
|
+
|
|
118
|
+
- [`tempoch-node/README.md`](./tempoch-node/README.md) for the Node package API
|
|
119
|
+
and examples.
|
|
120
|
+
- [`tempoch/README.md`](./tempoch/README.md) for the vendored Rust workspace.
|
|
121
|
+
- [`tempoch/CHANGELOG.md`](./tempoch/CHANGELOG.md) for backend/library changes
|
|
122
|
+
that feed these bindings.
|
|
123
|
+
|
|
124
|
+
## License
|
|
125
|
+
|
|
126
|
+
AGPL-3.0. See [LICENSE](./LICENSE).
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "tempoch-js",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": " high-precision, type-safe time computations. Provides strongly-typed time units, durations, and arithmetic with compile-time guarantees, enabling robust temporal calculations for scientific and systems software. ",
|
|
5
|
+
"homepage": "https://github.com/Siderust/tempoch-js#readme",
|
|
6
|
+
"bugs": {
|
|
7
|
+
"url": "https://github.com/Siderust/tempoch-js/issues"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/Siderust/tempoch-js.git"
|
|
12
|
+
},
|
|
13
|
+
"license": "AGPL-3.0-or-later",
|
|
14
|
+
"author": "VPRamon",
|
|
15
|
+
"type": "commonjs",
|
|
16
|
+
"main": "index.js",
|
|
17
|
+
"scripts": {
|
|
18
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
5
|
+
PACKAGE_DIR="$ROOT_DIR/tempoch-node"
|
|
6
|
+
STEP="${1:-all}"
|
|
7
|
+
|
|
8
|
+
run_install() {
|
|
9
|
+
cd "$PACKAGE_DIR"
|
|
10
|
+
npm ci
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
run_format() {
|
|
14
|
+
cd "$PACKAGE_DIR"
|
|
15
|
+
npm run format:check
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
run_lint() {
|
|
19
|
+
cd "$PACKAGE_DIR"
|
|
20
|
+
npm run lint
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
run_build() {
|
|
24
|
+
cd "$PACKAGE_DIR"
|
|
25
|
+
if [[ "${BUILD_MODE:-debug}" == "release" ]]; then
|
|
26
|
+
npm run build
|
|
27
|
+
else
|
|
28
|
+
npm run build:debug
|
|
29
|
+
fi
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
run_test() {
|
|
33
|
+
cd "$PACKAGE_DIR"
|
|
34
|
+
npm test
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
run_coverage() {
|
|
38
|
+
cd "$PACKAGE_DIR"
|
|
39
|
+
npm run test:coverage
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
case "$STEP" in
|
|
43
|
+
install)
|
|
44
|
+
run_install
|
|
45
|
+
;;
|
|
46
|
+
format)
|
|
47
|
+
run_format
|
|
48
|
+
;;
|
|
49
|
+
lint)
|
|
50
|
+
run_lint
|
|
51
|
+
;;
|
|
52
|
+
build)
|
|
53
|
+
run_build
|
|
54
|
+
;;
|
|
55
|
+
test)
|
|
56
|
+
run_test
|
|
57
|
+
;;
|
|
58
|
+
coverage)
|
|
59
|
+
run_coverage
|
|
60
|
+
;;
|
|
61
|
+
all)
|
|
62
|
+
run_install
|
|
63
|
+
run_format
|
|
64
|
+
run_lint
|
|
65
|
+
run_build
|
|
66
|
+
run_test
|
|
67
|
+
run_coverage
|
|
68
|
+
;;
|
|
69
|
+
*)
|
|
70
|
+
echo "Usage: $0 [install|format|lint|build|test|coverage|all]" >&2
|
|
71
|
+
exit 1
|
|
72
|
+
;;
|
|
73
|
+
esac
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
name: tempoch CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main, master]
|
|
6
|
+
pull_request:
|
|
7
|
+
types: [opened, synchronize, reopened, ready_for_review]
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
checks: write
|
|
12
|
+
pull-requests: write
|
|
13
|
+
|
|
14
|
+
concurrency:
|
|
15
|
+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
16
|
+
cancel-in-progress: true
|
|
17
|
+
|
|
18
|
+
env:
|
|
19
|
+
CARGO_TERM_COLOR: always
|
|
20
|
+
|
|
21
|
+
jobs:
|
|
22
|
+
check:
|
|
23
|
+
name: Check
|
|
24
|
+
runs-on: ubuntu-latest
|
|
25
|
+
steps:
|
|
26
|
+
- uses: actions/checkout@v4
|
|
27
|
+
- uses: dtolnay/rust-toolchain@stable
|
|
28
|
+
- run: cargo check --all-targets
|
|
29
|
+
|
|
30
|
+
fmt:
|
|
31
|
+
name: Format
|
|
32
|
+
runs-on: ubuntu-latest
|
|
33
|
+
steps:
|
|
34
|
+
- uses: actions/checkout@v4
|
|
35
|
+
- uses: dtolnay/rust-toolchain@stable
|
|
36
|
+
with:
|
|
37
|
+
components: rustfmt
|
|
38
|
+
- run: cargo fmt --check
|
|
39
|
+
|
|
40
|
+
clippy:
|
|
41
|
+
name: Clippy
|
|
42
|
+
runs-on: ubuntu-latest
|
|
43
|
+
steps:
|
|
44
|
+
- uses: actions/checkout@v4
|
|
45
|
+
- uses: dtolnay/rust-toolchain@stable
|
|
46
|
+
with:
|
|
47
|
+
components: clippy
|
|
48
|
+
- run: cargo clippy --all-targets -- -D warnings
|
|
49
|
+
|
|
50
|
+
test:
|
|
51
|
+
name: Test
|
|
52
|
+
runs-on: ubuntu-latest
|
|
53
|
+
steps:
|
|
54
|
+
- uses: actions/checkout@v4
|
|
55
|
+
- uses: dtolnay/rust-toolchain@stable
|
|
56
|
+
- run: cargo test --all-targets
|
|
57
|
+
- run: cargo test --doc
|
|
58
|
+
|
|
59
|
+
coverage:
|
|
60
|
+
name: Test & Coverage
|
|
61
|
+
if: ${{ github.event_name == 'push' || github.event.pull_request.draft == false }}
|
|
62
|
+
runs-on: ubuntu-latest
|
|
63
|
+
steps:
|
|
64
|
+
- uses: actions/checkout@v4
|
|
65
|
+
|
|
66
|
+
- name: Set up Rust (nightly + llvm-tools)
|
|
67
|
+
uses: dtolnay/rust-toolchain@v1
|
|
68
|
+
with:
|
|
69
|
+
toolchain: nightly
|
|
70
|
+
components: llvm-tools-preview
|
|
71
|
+
|
|
72
|
+
- name: Install cargo-llvm-cov
|
|
73
|
+
uses: taiki-e/install-action@v2
|
|
74
|
+
with:
|
|
75
|
+
tool: cargo-llvm-cov
|
|
76
|
+
|
|
77
|
+
- name: Coverage (run, no report)
|
|
78
|
+
run: cargo +nightly llvm-cov --workspace --all-features --doctests --no-report
|
|
79
|
+
|
|
80
|
+
- name: Coverage (Cobertura XML)
|
|
81
|
+
run: cargo +nightly llvm-cov report --cobertura --output-path coverage.xml
|
|
82
|
+
|
|
83
|
+
- name: Coverage (HTML)
|
|
84
|
+
run: cargo +nightly llvm-cov report --html --output-dir coverage_html
|
|
85
|
+
|
|
86
|
+
- name: Build coverage summary (Markdown)
|
|
87
|
+
uses: irongut/CodeCoverageSummary@v1.3.0
|
|
88
|
+
with:
|
|
89
|
+
filename: coverage.xml
|
|
90
|
+
badge: true
|
|
91
|
+
format: markdown
|
|
92
|
+
output: file
|
|
93
|
+
|
|
94
|
+
- name: Publish to Job Summary
|
|
95
|
+
run: cat code-coverage-results.md >> "$GITHUB_STEP_SUMMARY"
|
|
96
|
+
|
|
97
|
+
- name: Post coverage as PR comment
|
|
98
|
+
if: github.event_name == 'pull_request'
|
|
99
|
+
uses: mshick/add-pr-comment@v2
|
|
100
|
+
with:
|
|
101
|
+
message-path: code-coverage-results.md
|
|
102
|
+
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
103
|
+
|
|
104
|
+
- name: Coverage gate (>=90% lines)
|
|
105
|
+
run: cargo +nightly llvm-cov --workspace --all-features --doctests --no-run --fail-under-lines 90
|
|
106
|
+
|
|
107
|
+
- name: Upload coverage HTML
|
|
108
|
+
if: always()
|
|
109
|
+
uses: actions/upload-artifact@v4
|
|
110
|
+
with:
|
|
111
|
+
name: coverage-html
|
|
112
|
+
path: coverage_html
|
|
113
|
+
retention-days: 7
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Time scale conversion functions in FFI (`tempoch_jd_to_tt`, `tempoch_tt_to_jd`, `tempoch_jd_to_mjd`, `tempoch_mjd_to_jd`, `tempoch_jd_to_tai`, `tempoch_tai_to_jd`, `tempoch_jd_to_tdb`, `tempoch_tdb_to_jd`, `tempoch_jd_to_tcg`, `tempoch_tcg_to_jd`, `tempoch_jd_to_tcb`, `tempoch_tcb_to_jd`, `tempoch_jd_to_gps`, `tempoch_gps_to_jd`, `tempoch_jd_to_jde`, `tempoch_jde_to_jd`, `tempoch_jd_to_unix`, `tempoch_unix_to_jd`, `tempoch_jd_add_days`, `tempoch_jd_difference`, `tempoch_jd_difference_qty`, `tempoch_jd_add_qty`).
|
|
13
|
+
- `TempochScale` enum in FFI to enumerate all supported time scales.
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
|
|
17
|
+
- Improved formatting and consistency in FFI time conversion implementations.
|
|
18
|
+
|
|
19
|
+
## [0.3.0 - 2026-02-19]
|
|
20
|
+
|
|
21
|
+
### Added
|
|
22
|
+
|
|
23
|
+
- `Time::try_new` and `Time::try_from_days` validated constructors that reject `NaN`/`±∞`.
|
|
24
|
+
- `Interval::try_new` validated constructor that rejects `start > end` (and `NaN` endpoints).
|
|
25
|
+
- `NonFiniteTimeError`, `InvalidIntervalError`, `PeriodListError` error types.
|
|
26
|
+
- `validate_period_list` — checks sorted/non-overlapping invariants on a period slice.
|
|
27
|
+
- `normalize_periods` — sorts and merges overlapping intervals into a valid list.
|
|
28
|
+
- FFI: generated C header is now also written to `tempoch-ffi/include/tempoch_ffi.h`.
|
|
29
|
+
|
|
30
|
+
### Changed
|
|
31
|
+
|
|
32
|
+
- `Time::new` and `Interval::new` now carry documentation warnings about
|
|
33
|
+
accepting unchecked input; prefer the new `try_*` constructors for
|
|
34
|
+
untrusted data.
|
|
35
|
+
- Serde deserialization of `Time<S>`, `Period<MJD>`, and `Period<JD>` now
|
|
36
|
+
rejects non-finite values and invalid intervals (start > end).
|
|
37
|
+
- `Time::<JD>::tt_to_tdb` now delegates to the shared `tdb_minus_tt_days`
|
|
38
|
+
function (previously duplicated the Fairhead & Bretagnon math).
|
|
39
|
+
|
|
40
|
+
### Fixed
|
|
41
|
+
|
|
42
|
+
- Eliminated duplicated TDB correction logic between `scales.rs` and
|
|
43
|
+
`julian_date_ext.rs`, reducing drift risk.
|
|
44
|
+
|
|
45
|
+
## [0.2.1 - 2026-02-19]
|
|
46
|
+
|
|
47
|
+
### Added
|
|
48
|
+
|
|
49
|
+
- FFI support
|
|
50
|
+
|
|
51
|
+
### Fixed
|
|
52
|
+
|
|
53
|
+
- Preserve sub-second precision in `Interval<DateTime<Utc>>::duration_days()` by computing from nanoseconds instead of truncating via whole seconds.
|
|
54
|
+
|
|
55
|
+
## [0.2.0 - 2026-02-16]
|
|
56
|
+
|
|
57
|
+
### Added
|
|
58
|
+
|
|
59
|
+
- New coordinate time scales: `TCG` (Geocentric Coordinate Time) and `TCB` (Barycentric Coordinate Time).
|
|
60
|
+
- Crate-root exports for `TCG` and `TCB` (`tempoch::TCG`, `tempoch::TCB`).
|
|
61
|
+
- Additional conversion tests covering `TDB`, `TCG`, `TCB`, and leap-second-aware Unix conversions.
|
|
62
|
+
|
|
63
|
+
### Changed
|
|
64
|
+
|
|
65
|
+
- `TDB` conversions no longer treat `TT` as strictly identical; they now apply periodic Fairhead & Bretagnon correction terms.
|
|
66
|
+
- `UnixTime` conversions now apply leap-second-aware UTC/TAI/TT offsets from an IERS Bulletin C table (1972–2017).
|
|
67
|
+
- `ΔT` now uses observed annual values for 1992–2025 and linear near-term extrapolation after 2026, replacing the prior modern-year approximation.
|
|
68
|
+
|
|
69
|
+
## [0.1.0 - 2026-02-12]
|
|
70
|
+
|
|
71
|
+
### Added
|
|
72
|
+
|
|
73
|
+
- Initial standalone release extracted from `siderust::time`.
|
|
74
|
+
- Generic time instants and scales via `Time<S>` and `TimeScale`.
|
|
75
|
+
- Marker scales: `JD`, `JDE`, `MJD`, `TDB`, `TT`, `TAI`, `GPS`, `UnixTime`, `UT`.
|
|
76
|
+
- `JulianDate`, `JulianEphemerisDay`, `ModifiedJulianDate`, `UniversalTime` aliases.
|
|
77
|
+
- UTC conversion helpers (`from_utc`, `to_utc`) using `chrono`.
|
|
78
|
+
- Automatic `ΔT` correction layer for `UT` conversions.
|
|
79
|
+
- Generic intervals (`Interval<T>`) and scale-based periods (`Period<S>`).
|
|
80
|
+
- Set-like period utilities: `intersect_periods` and `complement_within`.
|
|
81
|
+
- GitHub Actions CI workflow with check/fmt/clippy/test/doctest/coverage jobs.
|
|
82
|
+
- Runnable examples and integration tests.
|