@zodiacs/engine 1.0.0 → 1.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.
Files changed (70) hide show
  1. package/CHANGELOG.md +1020 -0
  2. package/LICENSING.md +168 -27
  3. package/NOTICE +78 -12
  4. package/README.md +288 -44
  5. package/dist/{api-WbxJ4Wj-.d.ts → api-ChL1N2Sr.d.ts} +33 -2
  6. package/dist/{ayanamsa--YQ46fET.d.ts → ayanamsa-ClFzkKmV.d.ts} +2 -1
  7. package/dist/calc.d.ts +90 -4
  8. package/dist/calc.js +360 -126
  9. package/dist/chunk-2PZYJQV5.js +83 -0
  10. package/dist/{chunk-7TRLIFFI.js → chunk-4XOYTBLS.js} +1 -1
  11. package/dist/chunk-767FTO7O.js +48 -0
  12. package/dist/{chunk-YIITY7Q7.js → chunk-7Y2F2IWN.js} +19 -17
  13. package/dist/{chunk-OG4OYTJJ.js → chunk-B4M2Y7FT.js} +1 -129
  14. package/dist/{chunk-PFGUCNOK.js → chunk-BMDASNPB.js} +6 -6
  15. package/dist/chunk-I3L4POY7.js +18 -0
  16. package/dist/{chunk-CHSYDKBL.js → chunk-LNGURVNH.js} +3 -3
  17. package/dist/{chunk-DMGHYCDI.js → chunk-NNOSOOWS.js} +1 -1
  18. package/dist/chunk-OVXQQEXL.js +41 -0
  19. package/dist/{chunk-SRXBTP5H.js → chunk-QLIEEICB.js} +201 -190
  20. package/dist/chunk-RMBWKZI2.js +130 -0
  21. package/dist/{chunk-FTX3JDJA.js → chunk-TZVPZHZM.js} +42 -23
  22. package/dist/{chunk-WS3TDSP3.js → chunk-WBTWY2OB.js} +7 -3
  23. package/dist/chunk-Y4E3WJU5.js +87 -0
  24. package/dist/chunk-YPU3MDNI.js +852 -0
  25. package/dist/conventions.d.ts +70 -0
  26. package/dist/conventions.js +26 -0
  27. package/dist/crossings.d.ts +15 -4
  28. package/dist/de440-pack.d.ts +43 -0
  29. package/dist/de440-pack.js +16 -0
  30. package/dist/de440.d.ts +113 -0
  31. package/dist/de440.js +19 -0
  32. package/dist/ephemeris-exTSqBgb.d.ts +60 -0
  33. package/dist/geo.d.ts +16 -4
  34. package/dist/geo.js +2 -2
  35. package/dist/{houses-CFERsAlK.d.ts → houses-Bh7GCnPi.d.ts} +3 -3
  36. package/dist/houses-extra.d.ts +5 -4
  37. package/dist/index.d.ts +8 -6
  38. package/dist/index.js +40 -28
  39. package/dist/{internal-math-DJJ8BYex.d.ts → internal-math-CxenuGfm.d.ts} +2 -2
  40. package/dist/internal-math.d.ts +4 -3
  41. package/dist/internal-math.js +14 -12
  42. package/dist/internal.d.ts +16 -7
  43. package/dist/internal.js +25 -4
  44. package/dist/lite-composite.js +114 -0
  45. package/dist/lite-declinations.js +253 -0
  46. package/dist/lite-dignities.js +333 -0
  47. package/dist/lite-sect.js +72 -0
  48. package/dist/lite.d.ts +82 -0
  49. package/dist/lite.js +4 -0
  50. package/dist/receipt.d.ts +3 -2
  51. package/dist/receipt.js +143 -65
  52. package/dist/{rulers-Dla6h_Sm.d.ts → rulers-CSSWtiWF.d.ts} +1 -1
  53. package/dist/sky.d.ts +4 -3
  54. package/dist/sky.js +17 -10
  55. package/dist/techniques.d.ts +102 -6
  56. package/dist/techniques.js +131 -56
  57. package/dist/time-bands-CZA9AlLg.d.ts +36 -0
  58. package/dist/time-scale-DIFNa0gz.d.ts +47 -0
  59. package/dist/time.d.ts +81 -0
  60. package/dist/time.js +74 -0
  61. package/dist/timing.d.ts +6 -5
  62. package/dist/timing.js +24 -17
  63. package/dist/types-DpPdtXgO.d.ts +335 -0
  64. package/dist/vedic.d.ts +112 -4
  65. package/dist/vedic.js +369 -14
  66. package/dist/window.d.ts +22 -2
  67. package/dist/window.js +86 -28
  68. package/dist/{zone-history-ghdyO0Sc.d.ts → zone-history-BxmDCcTK.d.ts} +32 -10
  69. package/package.json +24 -3
  70. package/dist/types-B-yb_tGL.d.ts +0 -240
package/dist/receipt.js CHANGED
@@ -1,10 +1,13 @@
1
- import {
2
- julianToGregorian,
3
- parseCalendarDate
4
- } from "./chunk-KFTJMMG7.js";
5
1
  import {
6
2
  dateFrom
7
3
  } from "./chunk-CPALRSPC.js";
4
+ import {
5
+ ASPECTS,
6
+ ASPECT_BODY_SET,
7
+ ASPECT_TYPES,
8
+ EPHEMERIS,
9
+ aspectMotion
10
+ } from "./chunk-B4M2Y7FT.js";
8
11
  import {
9
12
  DELTA_T_IERS_MODEL,
10
13
  TIME_SCALE_NAMES,
@@ -12,19 +15,21 @@ import {
12
15
  outsideReferenceSpan,
13
16
  timeBasis
14
17
  } from "./chunk-B5LKF437.js";
18
+ import {
19
+ natalConventionIds
20
+ } from "./chunk-OVXQQEXL.js";
21
+ import {
22
+ SIGNS
23
+ } from "./chunk-RMBWKZI2.js";
15
24
  import {
16
25
  DELTA_T_MODEL,
17
26
  DELTA_T_TABLE,
18
27
  deltaTAt
19
28
  } from "./chunk-BHJXUY67.js";
20
29
  import {
21
- ASPECTS,
22
- ASPECT_BODY_SET,
23
- ASPECT_TYPES,
24
- EPHEMERIS,
25
- SIGNS,
26
- aspectMotion
27
- } from "./chunk-OG4OYTJJ.js";
30
+ julianToGregorian,
31
+ parseCalendarDate
32
+ } from "./chunk-KFTJMMG7.js";
28
33
 
29
34
  // src/receipt-json.ts
30
35
  function parseReceiptJson(json, limits) {
@@ -211,17 +216,29 @@ var CONVENTIONS_RC15 = /* @__PURE__ */ (() => Object.freeze({
211
216
  timeScale: "tt-from-leap-seconds-and-ut1-from-iers-1972-to-table-end;delta-t-model-otherwise;in-result",
212
217
  localTime: "tzdb-shards-before-1970;host-intl-from-1970;flags-from-transition-record"
213
218
  }))();
214
- var CONVENTIONS = /* @__PURE__ */ (() => Object.freeze({
219
+ var CONVENTIONS_RC16 = /* @__PURE__ */ (() => Object.freeze({
215
220
  ...CONVENTIONS_RC15,
216
221
  moonPosition: "astronomy-engine-geo-moon;no-light-time;no-aberration",
217
222
  nutation: "iau2000b;equation-of-equinoxes-with-two-complementary-terms"
218
223
  }))();
224
+ var CONVENTIONS = /* @__PURE__ */ (() => Object.freeze({
225
+ ...CONVENTIONS_RC16,
226
+ conventionIds: "zodiacs-conventions-registry;receipt-and-result;sorted-unique;in-receipt"
227
+ }))();
228
+ var CONVENTIONS_DE440 = /* @__PURE__ */ (() => Object.freeze({
229
+ ...CONVENTIONS,
230
+ planetPositions: "apparent-geocentric-ecliptic-of-date;light-time;solar-deflection;relativistic-aberration;barycentres-mars-to-pluto",
231
+ moonPosition: "ephemeris-geocentric-moon;light-time;solar-deflection;relativistic-aberration",
232
+ positionFrame: "icrf-to-true-ecliptic-of-date;iau2006-precession-with-bias;iau2000b-nutation-p03;tdb-three-term"
233
+ }))();
219
234
  var NATAL_RECEIPT_CONVENTION_SETS = /* @__PURE__ */ Object.freeze([
220
235
  CONVENTIONS,
236
+ CONVENTIONS_RC16,
221
237
  CONVENTIONS_RC15,
222
238
  CONVENTIONS_RC8,
223
239
  CONVENTIONS_RC7,
224
- CONVENTIONS_RC3
240
+ CONVENTIONS_RC3,
241
+ CONVENTIONS_DE440
225
242
  ]);
226
243
  var RC3_TO_RC6 = /^0\.1\.1-rc\.[3-6](?:\+[A-Za-z0-9.-]+)?$/;
227
244
  var RC7 = /^0\.1\.1-rc\.7(?:\+[A-Za-z0-9.-]+)?$/;
@@ -229,6 +246,11 @@ var RC8_TO_RC14 = /^0\.1\.1-rc\.(?:[89]|1[0-4])(?:\+[A-Za-z0-9.-]+)?$/;
229
246
  var RC15 = /^0\.1\.1-rc\.15(?:\+[A-Za-z0-9.-]+)?$/;
230
247
  var before = (version2, release) => compareVersions(version2, release) < 0;
231
248
  var NUTATION_RELEASE = "0.1.1-rc.16";
249
+ var IDS_FEATURE = "convention-ids";
250
+ var DE440_FEATURE = "ephemeris-jpl-de440";
251
+ var DE440_EPHEMERIS = "jpl-de440";
252
+ var DE440_RELEASE = "1.1.0-rc.3";
253
+ var SHA256_HEX = /^[0-9a-f]{64}$/;
232
254
  var RC9_RELEASE = "0.1.1-rc.9";
233
255
  var RC10_RELEASE = "0.1.1-rc.10";
234
256
  var COVERAGE = /* @__PURE__ */ Object.freeze({
@@ -253,6 +275,8 @@ var BODIES = [
253
275
  ];
254
276
  var FLAGS_RC7 = ["dst-gap", "dst-fold", "lmt", "no-time", "polar-fallback"];
255
277
  var FLAGS = [...FLAGS_RC7, "outside-reference-span"];
278
+ var FLAGS_TIME_BASIS = [...FLAGS, "delta-t-extrapolated", "de440-unavailable", "outside-de440-span"];
279
+ var FALLBACK_FLAGS = ["de440-unavailable", "outside-de440-span"];
256
280
  var TIME_FLAGS = ["dst-gap", "dst-fold", "lmt"];
257
281
  var HOUSE_SYSTEMS = [
258
282
  "whole",
@@ -674,16 +698,22 @@ function validateLocal(value, receipt, timeBasis2) {
674
698
  fail("invalid_context");
675
699
  if (wall + Math.round(shiftMs) - Math.round(offsetMs) !== dateFrom(receipt.instant, "instant").getTime())
676
700
  fail("invalid_context");
677
- fixedFields(local.policy, { fold: "earlier", gap: "shift-forward" });
701
+ const policy = record(local.policy);
702
+ fields(policy, ["fold", "gap"]);
703
+ if (policy.fold !== "earlier" && policy.fold !== "later" || policy.gap !== "shift-forward")
704
+ fail("unsupported_feature");
705
+ const later = policy.fold === "later";
706
+ if (later && !timeBasis2) fail("unsupported_feature");
707
+ if (later && !receipt.inputFlags.includes("dst-fold")) fail("invalid_context");
678
708
  if (receipt.inputFlags.includes("dst-gap") !== shift > 0) fail("invalid_context");
679
709
  if (receipt.reference === "local-noon" && time !== "12:00") fail("invalid_context");
680
710
  if (!timeBasis2) {
681
711
  if (receipt.inputFlags.includes("lmt") !== Math.abs(offset % 1) > 1e-9) fail("invalid_context");
682
712
  return;
683
713
  }
684
- validateLocalRecord(local, receipt, date, offset, shift);
714
+ validateLocalRecord(local, receipt, date, offset, shift, later);
685
715
  }
686
- function validateLocalRecord(local, receipt, date, offset, shift) {
716
+ function validateLocalRecord(local, receipt, date, offset, shift, later) {
687
717
  const has = (key) => Object.hasOwn(local, key);
688
718
  const calendar = has("calendar") ? choice(local.calendar, ["gregorian", "julian"]) : "gregorian";
689
719
  const written = has("writtenDate") ? text(local.writtenDate, 10) : null;
@@ -711,7 +741,10 @@ function validateLocalRecord(local, receipt, date, offset, shift) {
711
741
  const near = (a, b) => Math.abs(a - b) <= 1e-9;
712
742
  if (
713
743
  // A change of half a day or more moves the date: a move across the date line.
714
- choice(transition.cause, ["dst", "legal-change", "date-line"]) === "date-line" !== Math.abs(after - before2) >= 720 || !(gap ? after > before2 && near(after - before2, shift) && near(offset, after) && at <= instant : fold ? after < before2 && near(offset, before2) && at > instant : near(offset, after) && at <= instant)
744
+ choice(transition.cause, ["dst", "legal-change", "date-line"]) === "date-line" !== Math.abs(after - before2) >= 720 || !(gap ? after > before2 && near(after - before2, shift) && near(offset, after) && at <= instant : fold ? after < before2 && // The first pass is before the clock went back, on the offset it
745
+ // left; the second is after it, within the repeated span, on the
746
+ // offset it took.
747
+ (later ? near(offset, after) && at <= instant && instant - at < (before2 - after) * 6e4 : near(offset, before2) && at > instant) : near(offset, after) && at <= instant)
715
748
  )
716
749
  fail("invalid_context");
717
750
  }
@@ -740,7 +773,7 @@ function commit(value) {
740
773
  if (typeof value !== "string" || !/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/.test(value))
741
774
  fail("invalid_value");
742
775
  }
743
- function validateProvenance(value, engineVersion) {
776
+ function validateProvenance(value, engineVersion, de440Version) {
744
777
  if (value === null) return;
745
778
  const facts = record(value);
746
779
  fields(facts, ["status"], ["source", "artifact", "runtime", "ephemeris"]);
@@ -776,16 +809,20 @@ function validateProvenance(value, engineVersion) {
776
809
  if (facts.ephemeris !== void 0) {
777
810
  const ephemeris = record(facts.ephemeris);
778
811
  fields(ephemeris, ["name", "version"]);
779
- if (ephemeris.name !== "astronomy-engine") fail("unsupported_feature");
780
- version(ephemeris.version);
812
+ if (de440Version !== null) {
813
+ if (ephemeris.name !== DE440_EPHEMERIS || ephemeris.version !== de440Version) fail("invalid_context");
814
+ } else {
815
+ if (ephemeris.name !== "astronomy-engine") fail("unsupported_feature");
816
+ version(ephemeris.version);
817
+ }
781
818
  }
782
819
  }
783
820
  function validateEnvelope(input) {
784
821
  const envelope = record(input);
785
822
  if (envelope.schema !== NATAL_ENVELOPE_SCHEMA) fail("unsupported_version");
786
823
  fields(envelope, ["schema", "requiredFeatures", "receipt", "result"], ["extensions"]);
787
- if (!Array.isArray(envelope.requiredFeatures)) fail("invalid_shape");
788
- if (envelope.requiredFeatures.length !== 0) fail("unsupported_feature");
824
+ const features = list(envelope.requiredFeatures);
825
+ if (features.some((feature) => feature !== IDS_FEATURE && feature !== DE440_FEATURE)) fail("unsupported_feature");
789
826
  const receipt = record(envelope.receipt);
790
827
  if (receipt.schema !== NATAL_RECEIPT_SCHEMA) fail("unsupported_version");
791
828
  fields(receipt, [
@@ -803,7 +840,7 @@ function validateEnvelope(input) {
803
840
  "provenance",
804
841
  "conventions",
805
842
  "coverage"
806
- ], ["timeScale"]);
843
+ ], ["timeScale", "conventionIds"]);
807
844
  canonicalInstant(receipt.instant);
808
845
  if (receipt.sourceInstant !== null) {
809
846
  if (typeof receipt.sourceInstant !== "string" || receipt.sourceInstant.length > 40)
@@ -828,9 +865,15 @@ function validateEnvelope(input) {
828
865
  if (timeKnown && Math.abs(coords.latitude) === 90) fail("unsupported_feature");
829
866
  }
830
867
  const conventions = conventionSet(receipt.conventions);
831
- const timeBasis2 = conventions === CONVENTIONS || conventions === CONVENTIONS_RC15;
868
+ const de440 = conventions === CONVENTIONS_DE440;
869
+ const withIds = conventions === CONVENTIONS || de440;
870
+ const timeBasis2 = withIds || conventions === CONVENTIONS_RC16 || conventions === CONVENTIONS_RC15;
832
871
  const current = timeBasis2 || conventions === CONVENTIONS_RC8;
833
872
  if (timeBasis2 !== Object.hasOwn(receipt, "timeScale")) fail("invalid_shape");
873
+ if (withIds !== Object.hasOwn(receipt, "conventionIds")) fail("invalid_shape");
874
+ const expectedFeatures = de440 ? [IDS_FEATURE, DE440_FEATURE] : withIds ? [IDS_FEATURE] : [];
875
+ if (features.length !== expectedFeatures.length || features.some((feature, index) => feature !== expectedFeatures[index]))
876
+ fail("inconsistent_result");
834
877
  const scale = timeBasis2 ? choice(receipt.timeScale, TIME_SCALE_NAMES) : null;
835
878
  const result = validateResult(
836
879
  envelope.result,
@@ -850,29 +893,46 @@ function validateEnvelope(input) {
850
893
  if (result.houses && result.angles && TURNING_WITH_ASCENDANT.includes(result.houses.system) && !angularClose(result.houses.cusps[9], result.angles.mc) && Math.abs(receipt.coordinates.latitude) < 65)
851
894
  fail("inconsistent_result");
852
895
  const inputFlags = flagList(receipt.inputFlags, TIME_FLAGS);
853
- const resultFlags = flagList(receipt.resultFlags, current ? FLAGS : FLAGS_RC7);
896
+ const resultFlags = flagList(receipt.resultFlags, timeBasis2 ? FLAGS_TIME_BASIS : current ? FLAGS : FLAGS_RC7);
854
897
  const expected = [...inputFlags];
855
898
  if (!timeKnown) expected.push("no-time");
856
899
  if (POLAR_UNDEFINED.includes(requested) && result.houses?.system === "whole")
857
900
  expected.push("polar-fallback");
858
901
  if (current && outsideReferenceSpan(new Date(receipt.instant)))
859
902
  expected.push("outside-reference-span");
860
- if (!sameFlags(expected, resultFlags)) fail("inconsistent_result");
861
903
  const engine = record(receipt.engine);
862
904
  fields(engine, current ? ["name", "version", "ephemeris"] : ["name", "version"]);
863
905
  if (engine.name !== "@zodiacs/engine") fail("unsupported_feature");
864
906
  const engineVersion = version(engine.version);
907
+ if (timeBasis2 && (scale !== "tt" || result.houses) && result.timeScale?.basis === "delta-t" && result.deltaT?.segment === "extrapolated" && (resultFlags.includes("delta-t-extrapolated") || compareVersions(engineVersion, "1.1.0-rc.9") > 0))
908
+ expected.push("delta-t-extrapolated");
909
+ if (!de440) {
910
+ for (const reason2 of FALLBACK_FLAGS) if (resultFlags.includes(reason2)) expected.push(reason2);
911
+ }
912
+ if (!sameFlags(expected, resultFlags)) fail("inconsistent_result");
865
913
  if (current) {
866
914
  const ephemeris = record(engine.ephemeris);
867
915
  fields(ephemeris, ["name", "version"]);
868
- if (ephemeris.name !== "astronomy-engine") fail("unsupported_feature");
869
- version(ephemeris.version);
916
+ if (de440) {
917
+ if (ephemeris.name !== DE440_EPHEMERIS) fail("unsupported_feature");
918
+ if (typeof ephemeris.version !== "string" || !SHA256_HEX.test(ephemeris.version)) fail("invalid_value");
919
+ } else {
920
+ if (ephemeris.name !== "astronomy-engine") fail("unsupported_feature");
921
+ version(ephemeris.version);
922
+ }
870
923
  }
871
- validateProvenance(receipt.provenance, engineVersion);
924
+ validateProvenance(receipt.provenance, engineVersion, de440 ? record(engine.ephemeris).version : null);
872
925
  validateLocal(receipt.localResolution, receipt, timeBasis2);
873
- if (conventions === CONVENTIONS_RC3 && !RC3_TO_RC6.test(engineVersion) || conventions === CONVENTIONS_RC7 && !RC7.test(engineVersion) || conventions === CONVENTIONS_RC8 && !RC8_TO_RC14.test(engineVersion) || conventions === CONVENTIONS_RC15 && !RC15.test(engineVersion) || conventions === CONVENTIONS && before(engineVersion, NUTATION_RELEASE) || !HOUSE_SYSTEMS_BEFORE_RC9.includes(requested) && before(engineVersion, RC9_RELEASE) || !HOUSE_SYSTEMS_BEFORE_RC10.includes(requested) && before(engineVersion, RC10_RELEASE))
926
+ if (conventions === CONVENTIONS_RC3 && !RC3_TO_RC6.test(engineVersion) || conventions === CONVENTIONS_RC7 && !RC7.test(engineVersion) || conventions === CONVENTIONS_RC8 && !RC8_TO_RC14.test(engineVersion) || conventions === CONVENTIONS_RC15 && !RC15.test(engineVersion) || (conventions === CONVENTIONS || conventions === CONVENTIONS_RC16) && before(engineVersion, NUTATION_RELEASE) || de440 && before(engineVersion, DE440_RELEASE) || !HOUSE_SYSTEMS_BEFORE_RC9.includes(requested) && before(engineVersion, RC9_RELEASE) || !HOUSE_SYSTEMS_BEFORE_RC10.includes(requested) && before(engineVersion, RC10_RELEASE))
874
927
  fail("inconsistent_result");
875
928
  fixedFields(receipt.coverage, COVERAGE);
929
+ if (withIds) {
930
+ const ids = list(receipt.conventionIds);
931
+ if (ids.some((id) => typeof id !== "string")) fail("invalid_value");
932
+ const named = natalConventionIds({ receipt, result });
933
+ if (ids.length !== named.length || ids.some((id, index) => id !== named[index]))
934
+ fail("inconsistent_result");
935
+ }
876
936
  if (envelope.extensions !== void 0) record(envelope.extensions);
877
937
  return envelope;
878
938
  }
@@ -908,6 +968,18 @@ function createNatalEnvelope(chart, context = {}) {
908
968
  ["latitude", "longitude", "flags", "deltaT", "timeScale"]
909
969
  );
910
970
  if (!(input.utc instanceof Date)) fail("invalid_value");
971
+ const ephemerisNamed = source.ephemeris === void 0 ? null : record(source.ephemeris);
972
+ let de440 = false;
973
+ if (ephemerisNamed !== null) {
974
+ fields(ephemerisNamed, ["name", "version"]);
975
+ if (ephemerisNamed.name === EPHEMERIS.name) {
976
+ if (ephemerisNamed.version !== EPHEMERIS.version) fail("unsupported_feature");
977
+ } else {
978
+ if (ephemerisNamed.name !== DE440_EPHEMERIS) fail("unsupported_feature");
979
+ if (typeof ephemerisNamed.version !== "string" || !SHA256_HEX.test(ephemerisNamed.version)) fail("invalid_value");
980
+ de440 = true;
981
+ }
982
+ }
911
983
  const supplied = record(cloneData(context));
912
984
  fields(
913
985
  supplied,
@@ -918,43 +990,49 @@ function createNatalEnvelope(chart, context = {}) {
918
990
  fields(record(supplied.provenance), [], ["source", "artifact", "runtime", "ephemeris"]);
919
991
  if (input.latitude === void 0 !== (input.longitude === void 0)) fail("invalid_value");
920
992
  const houses = source.houses === null ? null : record(source.houses);
921
- const envelope = {
922
- schema: NATAL_ENVELOPE_SCHEMA,
923
- requiredFeatures: [],
924
- receipt: {
925
- schema: NATAL_RECEIPT_SCHEMA,
926
- instant: Date.prototype.toISOString.call(input.utc),
927
- timeScale: input.timeScale ?? "utc",
928
- sourceInstant: supplied.sourceInstant === void 0 ? null : supplied.sourceInstant,
929
- timeKnown: input.timeKnown,
930
- reference: supplied.reference === void 0 ? "supplied-instant" : supplied.reference,
931
- localResolution: supplied.localResolution ?? null,
932
- coordinates: input.latitude === void 0 ? null : { latitude: input.latitude, longitude: input.longitude },
933
- houses: {
934
- requested: input.houseSystem,
935
- actual: houses?.system ?? null,
936
- absenceReason: !input.timeKnown ? "unknown-time" : input.latitude === void 0 ? "missing-location" : null
937
- },
938
- inputFlags: input.flags ?? [],
939
- resultFlags: source.flags,
940
- engine: {
941
- name: "@zodiacs/engine",
942
- version: source.engineVersion,
943
- ephemeris: { ...EPHEMERIS }
944
- },
945
- provenance: supplied.provenance === void 0 ? null : { ...record(supplied.provenance), status: "claimed" },
946
- conventions: { ...CONVENTIONS },
947
- coverage: { ...COVERAGE }
993
+ const receipt = {
994
+ schema: NATAL_RECEIPT_SCHEMA,
995
+ instant: Date.prototype.toISOString.call(input.utc),
996
+ timeScale: input.timeScale ?? "utc",
997
+ sourceInstant: supplied.sourceInstant === void 0 ? null : supplied.sourceInstant,
998
+ timeKnown: input.timeKnown,
999
+ reference: supplied.reference === void 0 ? "supplied-instant" : supplied.reference,
1000
+ localResolution: supplied.localResolution ?? null,
1001
+ coordinates: input.latitude === void 0 ? null : { latitude: input.latitude, longitude: input.longitude },
1002
+ houses: {
1003
+ requested: input.houseSystem,
1004
+ actual: houses?.system ?? null,
1005
+ absenceReason: !input.timeKnown ? "unknown-time" : input.latitude === void 0 ? "missing-location" : null
948
1006
  },
949
- // The fields the record's conventions set names, and only those.
950
- result: {
951
- bodies: list(source.bodies).map((body) => kept(body, BODY_RECORD)),
952
- angles: source.angles === null ? null : kept(source.angles, ANGLES_RECORD),
953
- houses: houses === null ? null : kept(houses, HOUSES_RECORD),
954
- aspects: list(source.aspects).map((aspect) => kept(aspect, ASPECT_RECORD)),
955
- deltaT: kept(source.deltaT, DELTA_T_RECORD),
956
- timeScale: timeScaleKept(source.timeScale)
1007
+ inputFlags: input.flags ?? [],
1008
+ resultFlags: source.flags,
1009
+ engine: {
1010
+ name: "@zodiacs/engine",
1011
+ version: source.engineVersion,
1012
+ ephemeris: de440 ? { name: DE440_EPHEMERIS, version: ephemerisNamed.version } : { ...EPHEMERIS }
957
1013
  },
1014
+ provenance: supplied.provenance === void 0 ? null : { ...record(supplied.provenance), status: "claimed" },
1015
+ conventions: { ...de440 ? CONVENTIONS_DE440 : CONVENTIONS },
1016
+ coverage: { ...COVERAGE }
1017
+ };
1018
+ const result = {
1019
+ bodies: list(source.bodies).map((body) => kept(body, BODY_RECORD)),
1020
+ angles: source.angles === null ? null : kept(source.angles, ANGLES_RECORD),
1021
+ houses: houses === null ? null : kept(houses, HOUSES_RECORD),
1022
+ aspects: list(source.aspects).map((aspect) => kept(aspect, ASPECT_RECORD)),
1023
+ deltaT: kept(source.deltaT, DELTA_T_RECORD),
1024
+ timeScale: timeScaleKept(source.timeScale)
1025
+ };
1026
+ let conventionIds = [];
1027
+ try {
1028
+ conventionIds = natalConventionIds({ receipt, result });
1029
+ } catch {
1030
+ }
1031
+ const envelope = {
1032
+ schema: NATAL_ENVELOPE_SCHEMA,
1033
+ requiredFeatures: de440 ? [IDS_FEATURE, DE440_FEATURE] : [IDS_FEATURE],
1034
+ receipt: { ...receipt, conventionIds },
1035
+ result,
958
1036
  ...supplied.extensions === void 0 ? {} : { extensions: supplied.extensions }
959
1037
  };
960
1038
  return checked(envelope);
@@ -1,4 +1,4 @@
1
- import { Z as ZodiacSign } from './types-B-yb_tGL.js';
1
+ import { Z as ZodiacSign } from './types-DpPdtXgO.js';
2
2
 
3
3
  /** The seven visible planets of the traditional rulership scheme. */
4
4
  type TraditionalPlanet = "Sun" | "Moon" | "Mercury" | "Venus" | "Mars" | "Jupiter" | "Saturn";
package/dist/sky.d.ts CHANGED
@@ -1,7 +1,8 @@
1
- import { B as BodyName, D as DateInput } from './types-B-yb_tGL.js';
2
- import { T as TraditionalPlanet } from './rulers-Dla6h_Sm.js';
3
- export { C as CHALDEAN_ORDER } from './rulers-Dla6h_Sm.js';
1
+ import { B as BodyName, e as DateInput } from './types-DpPdtXgO.js';
2
+ import { T as TraditionalPlanet } from './rulers-CSSWtiWF.js';
3
+ export { C as CHALDEAN_ORDER } from './rulers-CSSWtiWF.js';
4
4
  import './deltat.js';
5
+ import './time-scale-DIFNa0gz.js';
5
6
 
6
7
  /** A body the sky functions accept: the Sun, the Moon and the planets. */
7
8
  type SkyBody = Exclude<BodyName, "North Node" | "South Node">;
package/dist/sky.js CHANGED
@@ -4,23 +4,29 @@ import {
4
4
  import {
5
5
  equatorRows,
6
6
  turn
7
- } from "./chunk-7TRLIFFI.js";
7
+ } from "./chunk-4XOYTBLS.js";
8
+ import {
9
+ gastHours,
10
+ onChartClock,
11
+ refuseUnderSource
12
+ } from "./chunk-QLIEEICB.js";
8
13
  import {
9
14
  dateFrom
10
15
  } from "./chunk-CPALRSPC.js";
11
- import {
12
- searchLongitudeCrossingsWith
13
- } from "./chunk-TSS2SZWQ.js";
14
- import {
15
- gastHours,
16
- onChartClock
17
- } from "./chunk-SRXBTP5H.js";
16
+ import "./chunk-B4M2Y7FT.js";
17
+ import "./chunk-2PZYJQV5.js";
18
18
  import {
19
19
  outsideReferenceSpan
20
20
  } from "./chunk-B5LKF437.js";
21
+ import {
22
+ searchLongitudeCrossingsWith
23
+ } from "./chunk-TSS2SZWQ.js";
24
+ import "./chunk-767FTO7O.js";
25
+ import "./chunk-YPU3MDNI.js";
26
+ import "./chunk-Y4E3WJU5.js";
27
+ import "./chunk-NNOSOOWS.js";
28
+ import "./chunk-RMBWKZI2.js";
21
29
  import "./chunk-BHJXUY67.js";
22
- import "./chunk-DMGHYCDI.js";
23
- import "./chunk-OG4OYTJJ.js";
24
30
 
25
31
  // src/sky/riseset.ts
26
32
  import { Body, GeoVector } from "astronomy-engine";
@@ -125,6 +131,7 @@ function conventionsOf(body, input) {
125
131
  return Object.freeze({ limb, refraction, refractionArcmin: refraction === "standard" ? STANDARD_REFRACTION_ARCMIN : 0 });
126
132
  }
127
133
  function stateAt(body, site, conventions, ms) {
134
+ refuseUnderSource("@zodiacs/engine/sky's rising and setting");
128
135
  return onChartClock(ms, "utc", void 0, (time) => {
129
136
  const g = GeoVector(BODIES[body], time, true);
130
137
  const [vx, vy, vz] = turn(equatorRows(time.tt, "true"), g.x, g.y, g.z);
@@ -1,15 +1,26 @@
1
- import { N as NatalSource } from './api-WbxJ4Wj-.js';
2
- import { d as Chart, H as HouseSystem, D as DateInput, B as BodyName, f as AspectType, Z as ZodiacSign, E as Element, k as Sect } from './types-B-yb_tGL.js';
1
+ import { E as EphemerisFallback, d as Chart, H as HouseSystem, e as DateInput, D as DetailedResult, B as BodyName, f as AspectType, Z as ZodiacSign, l as Element, j as Sect } from './types-DpPdtXgO.js';
2
+ import { N as NatalSource } from './api-ChL1N2Sr.js';
3
3
  import './deltat.js';
4
+ import './time-scale-DIFNa0gz.js';
4
5
  import './crossings.js';
5
6
 
6
- /** `"outside-reference-span"`: the ephemeris was read outside 1800–2200 (`REFERENCE_SPAN`). */
7
- type TechniqueFlag = "outside-reference-span";
7
+ /**
8
+ * `"outside-reference-span"`: the ephemeris was read outside 1800 to 2200
9
+ * (`REFERENCE_SPAN`). `"de440-unavailable"` and `"outside-de440-span"`: a
10
+ * position was astronomy-engine's as a fallback from the shipped DE440 pack
11
+ * (the root entry's `EphemerisFallback`).
12
+ */
13
+ type TechniqueFlag = "outside-reference-span" | EphemerisFallback;
8
14
  /** Latitude in [−90, 90] and longitude east in [−180, 180], degrees. */
9
15
  interface GeoPlace {
10
16
  readonly latitude: number;
11
17
  readonly longitude: number;
12
18
  }
19
+ /** The ephemeris a result names: `{ name: "jpl-de440", version }` on the shipped pack, astronomy-engine's otherwise. */
20
+ interface TechniqueEphemeris {
21
+ readonly name: string;
22
+ readonly version: string;
23
+ }
13
24
 
14
25
  /** Half-width of the solar return search around its date, days. */
15
26
  declare const SOLAR_RETURN_WINDOW_DAYS: number;
@@ -64,13 +75,24 @@ interface LunarReturn extends ReturnChart {
64
75
  * crossing solver at 1-day steps over ±200 days; a tie goes to the earlier.
65
76
  */
66
77
  declare function solarReturnInstant(natalSunLongitude: number, near: DateInput): Date;
78
+ /**
79
+ * `solarReturnInstant`'s instant as `value`, with the ephemeris the Sun's
80
+ * longitudes came from and the flags that say why that is astronomy-engine
81
+ * where the shipped DE440 pack was the default (`DetailedResult`), over the
82
+ * whole window searched.
83
+ */
84
+ declare function solarReturnInstantDetailed(natalSunLongitude: number, near: DateInput): DetailedResult<Date, TechniqueFlag>;
67
85
  /** The latest instant at or before `at` when the apparent Sun is at `natalSunLongitude`, within 370 days. */
68
86
  declare function mostRecentSolarReturnInstant(natalSunLongitude: number, at: DateInput): Date;
87
+ /** `mostRecentSolarReturnInstant`'s instant as `value`, labelled as `solarReturnInstantDetailed`'s is. */
88
+ declare function mostRecentSolarReturnInstantDetailed(natalSunLongitude: number, at: DateInput): DetailedResult<Date, TechniqueFlag>;
69
89
  /**
70
90
  * The first instant in (after, after + 40 days] when the apparent Moon is at
71
91
  * `natalMoonLongitude`: the crossing solver at 6-hour steps.
72
92
  */
73
93
  declare function lunarReturnInstant(natalMoonLongitude: number, after: DateInput): Date;
94
+ /** `lunarReturnInstant`'s instant as `value`, labelled over the 40 days searched as `solarReturnInstantDetailed`'s is. */
95
+ declare function lunarReturnInstantDetailed(natalMoonLongitude: number, after: DateInput): DetailedResult<Date, TechniqueFlag>;
74
96
  /**
75
97
  * The solar return of a natal chart or birth nearest `date` (or the latest at
76
98
  * or before it), and its chart. The natal Sun is the chart's own.
@@ -98,6 +120,20 @@ interface CompositeAspect {
98
120
  interface CompositeChart {
99
121
  readonly bodies: readonly CompositePosition[];
100
122
  readonly aspects: readonly CompositeAspect[];
123
+ /**
124
+ * The ephemeris both charts name (`chart.ephemeris`): `{ name: "jpl-de440", version }` on the shipped DE440
125
+ * pack, astronomy-engine's name and version otherwise; null where the two do not name one and the same, or a
126
+ * supplied chart from an earlier release names none. Set by `compositeChart` from 1.1.0-rc.11.
127
+ */
128
+ readonly ephemeris: {
129
+ readonly name: string;
130
+ readonly version: string;
131
+ } | null;
132
+ /**
133
+ * The flags among `"outside-reference-span"`, `"de440-unavailable"` and `"outside-de440-span"` that either
134
+ * chart carries, in that order. Set by `compositeChart` from 1.1.0-rc.11.
135
+ */
136
+ readonly flags: readonly ("outside-reference-span" | "de440-unavailable" | "outside-de440-span")[];
101
137
  }
102
138
  /**
103
139
  * The composite positions of the bodies in both lists, in the first list's
@@ -113,6 +149,7 @@ declare function compositeMidpoints(first: readonly {
113
149
  }[]): readonly CompositePosition[];
114
150
  /** The major aspects among the composite Sun to Pluto, with the natal orbs of `ASPECTS`, by orb. */
115
151
  declare function compositeAspects(points: readonly CompositePosition[]): readonly CompositeAspect[];
152
+
116
153
  /** The composite of two charts or births: every body's midpoint and their aspects. No angles or houses. */
117
154
  declare function compositeChart(first: NatalSource, second: NatalSource): CompositeChart;
118
155
  /**
@@ -195,6 +232,16 @@ declare const VOID_OF_COURSE_CONVENTION: Readonly<{
195
232
  interface MoonIngress {
196
233
  readonly at: Date;
197
234
  readonly sign: ZodiacSign;
235
+ /**
236
+ * The ephemeris the Moon's and the bodies' longitudes behind it came from: `{ name: "jpl-de440", version }` on
237
+ * the shipped DE440 pack, astronomy-engine's name and version otherwise. From 1.1.0-rc.11.
238
+ */
239
+ readonly ephemeris: TechniqueEphemeris;
240
+ /**
241
+ * `"de440-unavailable"` or `"outside-de440-span"` where those longitudes were astronomy-engine's as a fallback
242
+ * from the pack, `"outside-reference-span"` where one was read outside 1800 to 2200; none otherwise. From 1.1.0-rc.11.
243
+ */
244
+ readonly flags: readonly TechniqueFlag[];
198
245
  }
199
246
  interface MoonAspect {
200
247
  readonly at: Date;
@@ -202,6 +249,16 @@ interface MoonAspect {
202
249
  readonly aspect: AspectType;
203
250
  /** The Moon's longitude at `at`, degrees. */
204
251
  readonly moonLon: number;
252
+ /**
253
+ * The ephemeris the Moon's and the bodies' longitudes behind it came from: `{ name: "jpl-de440", version }` on
254
+ * the shipped DE440 pack, astronomy-engine's name and version otherwise. From 1.1.0-rc.11.
255
+ */
256
+ readonly ephemeris: TechniqueEphemeris;
257
+ /**
258
+ * `"de440-unavailable"` or `"outside-de440-span"` where those longitudes were astronomy-engine's as a fallback
259
+ * from the pack, `"outside-reference-span"` where one was read outside 1800 to 2200; none otherwise. From 1.1.0-rc.11.
260
+ */
261
+ readonly flags: readonly TechniqueFlag[];
205
262
  }
206
263
  interface VoidOfCourseWindow {
207
264
  /** The last aspect in the sign, or the entry into it when `lastAspect` is null. */
@@ -211,6 +268,16 @@ interface VoidOfCourseWindow {
211
268
  readonly lastAspect: MoonAspect | null;
212
269
  readonly sign: ZodiacSign;
213
270
  readonly nextSign: ZodiacSign;
271
+ /**
272
+ * The ephemeris the Moon's and the bodies' longitudes behind it came from: `{ name: "jpl-de440", version }` on
273
+ * the shipped DE440 pack, astronomy-engine's name and version otherwise. From 1.1.0-rc.11.
274
+ */
275
+ readonly ephemeris: TechniqueEphemeris;
276
+ /**
277
+ * `"de440-unavailable"` or `"outside-de440-span"` where those longitudes were astronomy-engine's as a fallback
278
+ * from the pack, `"outside-reference-span"` where one was read outside 1800 to 2200; none otherwise. From 1.1.0-rc.11.
279
+ */
280
+ readonly flags: readonly TechniqueFlag[];
214
281
  }
215
282
  interface VoidOfCourseStatus {
216
283
  readonly at: Date;
@@ -219,6 +286,16 @@ interface VoidOfCourseStatus {
219
286
  readonly current: VoidOfCourseWindow | null;
220
287
  /** The next period to begin after `at`. */
221
288
  readonly next: VoidOfCourseWindow | null;
289
+ /**
290
+ * The ephemeris the Moon's and the bodies' longitudes behind it came from: `{ name: "jpl-de440", version }` on
291
+ * the shipped DE440 pack, astronomy-engine's name and version otherwise. From 1.1.0-rc.11.
292
+ */
293
+ readonly ephemeris: TechniqueEphemeris;
294
+ /**
295
+ * `"de440-unavailable"` or `"outside-de440-span"` where those longitudes were astronomy-engine's as a fallback
296
+ * from the pack, `"outside-reference-span"` where one was read outside 1800 to 2200; none otherwise. From 1.1.0-rc.11.
297
+ */
298
+ readonly flags: readonly TechniqueFlag[];
222
299
  }
223
300
  interface VoidOfCourseOptions {
224
301
  /** `"modern"` by default. */
@@ -287,6 +364,19 @@ interface AspectPatterns {
287
364
  /** Every pattern, sorted by id. */
288
365
  readonly patterns: readonly AspectPattern[];
289
366
  }
367
+ /** `chartAspectPatterns`'s result: the patterns, and the chart's label (from 1.1.0-rc.11). */
368
+ interface ChartAspectPatterns extends AspectPatterns {
369
+ /**
370
+ * The chart's `ephemeris`: `{ name: "jpl-de440", version }` on the shipped DE440 pack, astronomy-engine's name
371
+ * and version otherwise; null where a supplied chart from an earlier release names none.
372
+ */
373
+ readonly ephemeris: {
374
+ readonly name: string;
375
+ readonly version: string;
376
+ } | null;
377
+ /** The flags among `"outside-reference-span"`, `"de440-unavailable"` and `"outside-de440-span"` the chart carries, in that order. */
378
+ readonly flags: readonly TechniqueFlag[];
379
+ }
290
380
  /**
291
381
  * The grand trines, T-squares, grand crosses and kites (Hand, 1981) that the
292
382
  * aspect records form among the Sun to Pluto. Every aspect of a pattern must
@@ -295,7 +385,7 @@ interface AspectPatterns {
295
385
  */
296
386
  declare function aspectPatterns(points: readonly PatternPoint[], aspects: readonly PatternEdgeInput[]): AspectPatterns;
297
387
  /** The aspect patterns of a chart or birth, from its own bodies and aspects. */
298
- declare function chartAspectPatterns(natal: NatalSource): AspectPatterns;
388
+ declare function chartAspectPatterns(natal: NatalSource): ChartAspectPatterns;
299
389
  /** `roots`: the patterns inside no other. `included[id]`: those inside `id`. */
300
390
  interface PatternContainment {
301
391
  readonly roots: readonly AspectPattern[];
@@ -440,6 +530,12 @@ interface MoonSignOptions {
440
530
  }
441
531
  /** Every sign the apparent Moon is in during [from, to], at most 20 days, in order. */
442
532
  declare function moonSignsBetween(from: DateInput, to: DateInput): readonly ZodiacSign[];
533
+ /**
534
+ * `moonSignsBetween`'s signs as `value`, with the ephemeris the Moon's two
535
+ * longitudes came from and the flags that say why that is astronomy-engine
536
+ * where the shipped DE440 pack was the default (`DetailedResult`).
537
+ */
538
+ declare function moonSignsBetweenDetailed(from: DateInput, to: DateInput): DetailedResult<readonly ZodiacSign[], TechniqueFlag>;
443
539
  /**
444
540
  * The Moon signs possible over a civil date with an unknown birth time. With
445
541
  * `timeZone`, from local midnight to local midnight, read as
@@ -450,4 +546,4 @@ declare function moonSignsBetween(from: DateInput, to: DateInput): readonly Zodi
450
546
  */
451
547
  declare function moonSignCandidates(date: string, options?: MoonSignOptions): MoonSignCandidates;
452
548
 
453
- export { type AspectPattern, type AspectPatterns, CHALDEAN_FACES, CLASSICAL_PLANETS, type ClassicalPlanet, type CompositeAspect, type CompositeChart, type CompositePosition, DOMICILE_RULERS, type DavisonChart, type DavisonOptions, type DavisonPlaceConvention, type Debility, type DignityRulers, type DignitySpan, EGYPTIAN_TERMS, EVERY_ZONE_OFFSETS, EXALTATIONS, type EssentialDignity, type GeoPlace, LUNAR_RETURN_HORIZON_DAYS, LUNAR_RETURN_STEP_DAYS, type LunarReturn, MOON_SIGN_MAX_SPAN_DAYS, type MoonAspect, type MoonIngress, type MoonSignCandidates, type MoonSignOptions, type MutualReception, PATTERN_BODIES, type PatternBody, type PatternContainment, type PatternEdge, type PatternEdgeInput, type PatternKind, type PatternPoint, type PlanetDignities, type PlanetaryReturn, type ReceptionOptions, type ReturnChart, type ReturnOptions, SOLAR_RETURN_LOOKBACK_DAYS, SOLAR_RETURN_STEP_DAYS, SOLAR_RETURN_WINDOW_DAYS, type SignDignity, type SolarReturn, type SolarReturnOptions, type SolarReturnSelection, TRIPLICITY_LORDS, type TechniqueFlag, VOID_BODIES, VOID_OF_COURSE_CONVENTION, VOID_OF_COURSE_MAX_DAYS, type VoidBodies, type VoidBody, type VoidOfCourseOptions, type VoidOfCourseStatus, type VoidOfCourseWindow, aspectPatterns, chartAspectPatterns, compositeAspects, compositeChart, compositeMidpoints, davisonChart, davisonPlace, dignitiesFor, dignityFor, dignityRulersAt, essentialDignities, hasClassicalDignities, lunarReturn, lunarReturnInstant, moonAspects, moonIngresses, moonSignCandidates, moonSignsBetween, mostRecentSolarReturnInstant, mutualReceptions, patternContainment, solarReturn, solarReturnInstant, voidOfCourseAt, voidOfCourseWindows };
549
+ export { type AspectPattern, type AspectPatterns, CHALDEAN_FACES, CLASSICAL_PLANETS, type ChartAspectPatterns, type ClassicalPlanet, type CompositeAspect, type CompositeChart, type CompositePosition, DOMICILE_RULERS, type DavisonChart, type DavisonOptions, type DavisonPlaceConvention, type Debility, DetailedResult, type DignityRulers, type DignitySpan, EGYPTIAN_TERMS, EVERY_ZONE_OFFSETS, EXALTATIONS, type EssentialDignity, type GeoPlace, LUNAR_RETURN_HORIZON_DAYS, LUNAR_RETURN_STEP_DAYS, type LunarReturn, MOON_SIGN_MAX_SPAN_DAYS, type MoonAspect, type MoonIngress, type MoonSignCandidates, type MoonSignOptions, type MutualReception, PATTERN_BODIES, type PatternBody, type PatternContainment, type PatternEdge, type PatternEdgeInput, type PatternKind, type PatternPoint, type PlanetDignities, type PlanetaryReturn, type ReceptionOptions, type ReturnChart, type ReturnOptions, SOLAR_RETURN_LOOKBACK_DAYS, SOLAR_RETURN_STEP_DAYS, SOLAR_RETURN_WINDOW_DAYS, type SignDignity, type SolarReturn, type SolarReturnOptions, type SolarReturnSelection, TRIPLICITY_LORDS, type TechniqueEphemeris, type TechniqueFlag, VOID_BODIES, VOID_OF_COURSE_CONVENTION, VOID_OF_COURSE_MAX_DAYS, type VoidBodies, type VoidBody, type VoidOfCourseOptions, type VoidOfCourseStatus, type VoidOfCourseWindow, aspectPatterns, chartAspectPatterns, compositeAspects, compositeChart, compositeMidpoints, davisonChart, davisonPlace, dignitiesFor, dignityFor, dignityRulersAt, essentialDignities, hasClassicalDignities, lunarReturn, lunarReturnInstant, lunarReturnInstantDetailed, moonAspects, moonIngresses, moonSignCandidates, moonSignsBetween, moonSignsBetweenDetailed, mostRecentSolarReturnInstant, mostRecentSolarReturnInstantDetailed, mutualReceptions, patternContainment, solarReturn, solarReturnInstant, solarReturnInstantDetailed, voidOfCourseAt, voidOfCourseWindows };