astromansion 0.1.0-alpha.7 → 0.1.0-alpha.9
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 +29 -0
- package/dist/index.cjs +26 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.js +26 -7
- package/dist/index.js.map +1 -1
- package/package.json +22 -6
package/README.md
CHANGED
|
@@ -17,6 +17,21 @@ It is the JavaScript twin of the
|
|
|
17
17
|
methods under the same names, written in camelCase, the same arguments, the
|
|
18
18
|
same answers, and the same errors.
|
|
19
19
|
|
|
20
|
+
## Accuracy
|
|
21
|
+
|
|
22
|
+
The server computes the planets' and the Moon's positions from NASA JPL data.
|
|
23
|
+
We compared them with NASA JPL Horizons every three months from 1900 to 2100.
|
|
24
|
+
|
|
25
|
+
| Measure | Result |
|
|
26
|
+
| ---------------------------------------------------------------- | ------ |
|
|
27
|
+
| Largest RMS deviation of any body, same Terrestrial Time instant | 0.19″ |
|
|
28
|
+
| Largest single deviation, same Terrestrial Time instant | 0.44″ |
|
|
29
|
+
| Largest single deviation in Universal Time, 1900 to 2026 | 0.44″ |
|
|
30
|
+
|
|
31
|
+
One arcsecond (″) is a 3600th of a degree. The figures were measured on
|
|
32
|
+
22 August 2026. The method, each body's figures and the time-scale comparison
|
|
33
|
+
are on the [accuracy page](https://astromansion.com/en/accuracy).
|
|
34
|
+
|
|
20
35
|
## Install
|
|
21
36
|
|
|
22
37
|
```bash
|
|
@@ -127,6 +142,13 @@ Fields: `date` as `YYYY-MM-DD`, `time` as `HH:MM` (leave it out if unknown),
|
|
|
127
142
|
zone name, `houses` for a house system. The client checks them before
|
|
128
143
|
anything is sent, so a malformed date is reported by the field you wrote.
|
|
129
144
|
|
|
145
|
+
Without a `time` the chart is cast at local noon, and the natal answer says so
|
|
146
|
+
with `time_known` set to `false`. Only the time decides the Ascendant, the
|
|
147
|
+
Midheaven and the houses, so that answer leaves them out, along with every
|
|
148
|
+
aspect to the two angles. `summary` then holds the Sun and the Moon alone, and
|
|
149
|
+
no planet has a `house`. Never show a rising sign for a birth whose time is
|
|
150
|
+
unknown.
|
|
151
|
+
|
|
130
152
|
JavaScript has no keyword arguments, so a method takes one object where the
|
|
131
153
|
Python SDK takes keywords. The method's other arguments, such as `options`,
|
|
132
154
|
may stand beside the birth fields or come in a second object:
|
|
@@ -927,6 +949,13 @@ The client retries only failures that carry no result. These are connection
|
|
|
927
949
|
errors, 429 and 5xx. It retries them twice by default and honours
|
|
928
950
|
`Retry-After`. A refusal you must fix is never retried.
|
|
929
951
|
|
|
952
|
+
A retry never waits in silence. Before each wait the server's answer asked
|
|
953
|
+
for, the client writes a warning with `console.warn`, naming the status, the
|
|
954
|
+
wait, and the retry it comes before. A visitor and the Free plan may send 3
|
|
955
|
+
requests a minute, so the fourth request in a minute waits for the window to
|
|
956
|
+
reopen, up to 8 seconds a retry. With `maxRetries: 0` the call throws
|
|
957
|
+
`RateLimitError` at once, and its `retryAfter` says how long to wait.
|
|
958
|
+
|
|
930
959
|
```js
|
|
931
960
|
const client = new AstroMansion({ timeout: 60, maxRetries: 0 });
|
|
932
961
|
```
|
package/dist/index.cjs
CHANGED
|
@@ -404,7 +404,7 @@ var KEY_MASK = Object.freeze({
|
|
|
404
404
|
|
|
405
405
|
// package.json
|
|
406
406
|
var name = "astromansion";
|
|
407
|
-
var version = "0.1.0-alpha.
|
|
407
|
+
var version = "0.1.0-alpha.9";
|
|
408
408
|
|
|
409
409
|
// src/models/constants/package.ts
|
|
410
410
|
var PACKAGE_IDENTITY = Object.freeze({
|
|
@@ -1037,7 +1037,7 @@ function isMoonPhasesResponse(value) {
|
|
|
1037
1037
|
return isJsonObject(value) && Number.isInteger(value["year"]) && (value["timezone"] === void 0 || typeof value["timezone"] === "string") && isJsonArrayOf(value["events"], (item0) => isMoonPhaseEvent(item0));
|
|
1038
1038
|
}
|
|
1039
1039
|
function isNatalResponse(value) {
|
|
1040
|
-
return isJsonObject(value) && isJsonRecordOf(value["summary"], (member0) => isSummaryRow(member0)) && isJsonArrayOf(value["planets"], (item0) => isBodyRow(item0)) && isJsonArrayOf(value["aspects"], (item0) => isAspectRow(item0)) && (value["wheel"] === void 0 || typeof value["wheel"] === "string" || value["wheel"] === null);
|
|
1040
|
+
return isJsonObject(value) && typeof value["time_known"] === "boolean" && isJsonRecordOf(value["summary"], (member0) => isSummaryRow(member0)) && isJsonArrayOf(value["planets"], (item0) => isBodyRow(item0)) && isJsonArrayOf(value["aspects"], (item0) => isAspectRow(item0)) && (value["wheel"] === void 0 || typeof value["wheel"] === "string" || value["wheel"] === null);
|
|
1041
1041
|
}
|
|
1042
1042
|
function isParentcentricFrame(value) {
|
|
1043
1043
|
return isJsonObject(value) && typeof value["frame_id"] === "string" && typeof value["correction"] === "string" && Number.isInteger(value["center"]) && isFramePole(value["pole"]) && typeof value["has_houses"] === "boolean";
|
|
@@ -3466,6 +3466,12 @@ var RETRY_AFTER = Object.freeze({
|
|
|
3466
3466
|
*/
|
|
3467
3467
|
SECONDS_PATTERN: /^-?\d+(?:\.\d+)?$/
|
|
3468
3468
|
});
|
|
3469
|
+
var RETRY_NOTICE = Object.freeze({
|
|
3470
|
+
/** The notice, with {status}, {seconds}, {retry}, and {retries} filled in. */
|
|
3471
|
+
TEMPLATE: "The AstroMansion API answered {status}, so the client waits {seconds} s before retry {retry} of {retries}. Set maxRetries: 0 to get the error at once.",
|
|
3472
|
+
/** The decimals the wait's seconds are written with. */
|
|
3473
|
+
SECONDS_DECIMALS: 1
|
|
3474
|
+
});
|
|
3469
3475
|
|
|
3470
3476
|
// src/transport/backoff.ts
|
|
3471
3477
|
function parseRetryAfterSeconds(value) {
|
|
@@ -3715,7 +3721,7 @@ var Transport = class {
|
|
|
3715
3721
|
* @throws The caller's abort reason, when the caller's signal aborts.
|
|
3716
3722
|
*/
|
|
3717
3723
|
async send(request2) {
|
|
3718
|
-
const { maxRetries, random, wait } = this.#config;
|
|
3724
|
+
const { maxRetries, random, wait, warn } = this.#config;
|
|
3719
3725
|
const call = {
|
|
3720
3726
|
url: this.#url(request2),
|
|
3721
3727
|
body: serializeBody(request2.json)
|
|
@@ -3737,10 +3743,13 @@ var Transport = class {
|
|
|
3737
3743
|
if (isLast || !ErrorPolicy.isRetryable(response.status, errorCodeOf(response))) {
|
|
3738
3744
|
return response;
|
|
3739
3745
|
}
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
3746
|
+
const pauseMs = backoffDelayMs(
|
|
3747
|
+
attempt,
|
|
3748
|
+
retryAfterSeconds(response.headers),
|
|
3749
|
+
random
|
|
3743
3750
|
);
|
|
3751
|
+
warn(retryNotice(response.status, pauseMs, attempt + 1, maxRetries));
|
|
3752
|
+
await wait(pauseMs, request2.signal);
|
|
3744
3753
|
}
|
|
3745
3754
|
}
|
|
3746
3755
|
/**
|
|
@@ -3822,6 +3831,15 @@ function serializeBody(json) {
|
|
|
3822
3831
|
);
|
|
3823
3832
|
}
|
|
3824
3833
|
}
|
|
3834
|
+
function retryNotice(status, pauseMs, retry, retries) {
|
|
3835
|
+
const seconds = (pauseMs / TRANSPORT_TIMING.MS_PER_SECOND).toFixed(
|
|
3836
|
+
RETRY_NOTICE.SECONDS_DECIMALS
|
|
3837
|
+
);
|
|
3838
|
+
return RETRY_NOTICE.TEMPLATE.replace("{status}", String(status)).replace("{seconds}", seconds).replace("{retry}", String(retry)).replace("{retries}", String(retries));
|
|
3839
|
+
}
|
|
3840
|
+
function warnOnConsole(message) {
|
|
3841
|
+
console.warn(message);
|
|
3842
|
+
}
|
|
3825
3843
|
function waitFor(durationMs, signal) {
|
|
3826
3844
|
return new Promise((resolve, reject) => {
|
|
3827
3845
|
if (signal === void 0) {
|
|
@@ -3915,7 +3933,8 @@ var AstroMansion = class extends EndpointMethods {
|
|
|
3915
3933
|
maxRetries: this.maxRetries,
|
|
3916
3934
|
fetch: options2.fetch ?? globalThis.fetch,
|
|
3917
3935
|
wait: waitFor,
|
|
3918
|
-
random: () => Math.random()
|
|
3936
|
+
random: () => Math.random(),
|
|
3937
|
+
warn: warnOnConsole
|
|
3919
3938
|
});
|
|
3920
3939
|
}
|
|
3921
3940
|
/**
|