sweph 2.10.0-1 → 2.10.0-11

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 (81) hide show
  1. package/README.md +48 -16
  2. package/binding.gyp +25 -23
  3. package/index.d.ts +438 -428
  4. package/index.js +16 -6
  5. package/index.mjs +108 -0
  6. package/package.json +45 -15
  7. package/prebuilds/darwin-arm64/sweph.node +0 -0
  8. package/prebuilds/linux-arm64/sweph.node +0 -0
  9. package/prebuilds/linux-x64/sweph.node +0 -0
  10. package/prebuilds/win32-x64/sweph.node +0 -0
  11. package/src/functions/azalt.cpp +2 -2
  12. package/src/functions/azalt_rev.cpp +2 -2
  13. package/src/functions/calc.cpp +1 -1
  14. package/src/functions/calc_pctr.cpp +1 -1
  15. package/src/functions/calc_ut.cpp +1 -1
  16. package/src/functions/cotrans.cpp +1 -1
  17. package/src/functions/cotrans_sp.cpp +1 -1
  18. package/src/functions/deltat_ex.cpp +1 -1
  19. package/src/functions/fixstar.cpp +1 -1
  20. package/src/functions/fixstar2.cpp +1 -1
  21. package/src/functions/fixstar2_mag.cpp +1 -1
  22. package/src/functions/fixstar2_ut.cpp +1 -1
  23. package/src/functions/fixstar_mag.cpp +1 -1
  24. package/src/functions/fixstar_ut.cpp +1 -1
  25. package/src/functions/gauquelin_sector.cpp +2 -2
  26. package/src/functions/get_ayanamsa_ex.cpp +1 -1
  27. package/src/functions/get_ayanamsa_ex_ut.cpp +1 -1
  28. package/src/functions/get_orbital_elements.cpp +1 -1
  29. package/src/functions/heliacal_pheno_ut.cpp +4 -4
  30. package/src/functions/heliacal_ut.cpp +4 -4
  31. package/src/functions/house_name.cpp +3 -2
  32. package/src/functions/house_pos.cpp +2 -2
  33. package/src/functions/houses.cpp +1 -1
  34. package/src/functions/houses_armc_ex2.cpp +1 -1
  35. package/src/functions/houses_ex.cpp +1 -1
  36. package/src/functions/houses_ex2.cpp +2 -2
  37. package/src/functions/lat_to_lmt.cpp +1 -1
  38. package/src/functions/lmt_to_lat.cpp +1 -1
  39. package/src/functions/lun_eclipse_how.cpp +2 -2
  40. package/src/functions/lun_eclipse_when.cpp +1 -1
  41. package/src/functions/lun_eclipse_when_loc.cpp +2 -2
  42. package/src/functions/lun_occult_when_glob.cpp +1 -1
  43. package/src/functions/lun_occult_when_loc.cpp +2 -2
  44. package/src/functions/lun_occult_where.cpp +1 -1
  45. package/src/functions/nod_aps.cpp +1 -1
  46. package/src/functions/nod_aps_ut.cpp +1 -1
  47. package/src/functions/orbit_max_min_true_distance.cpp +1 -1
  48. package/src/functions/pheno.cpp +1 -1
  49. package/src/functions/pheno_ut.cpp +1 -1
  50. package/src/functions/rise_trans.cpp +2 -2
  51. package/src/functions/rise_trans_true_hor.cpp +2 -2
  52. package/src/functions/sol_eclipse_how.cpp +2 -2
  53. package/src/functions/sol_eclipse_when_glob.cpp +1 -1
  54. package/src/functions/sol_eclipse_when_loc.cpp +2 -2
  55. package/src/functions/sol_eclipse_where.cpp +1 -1
  56. package/src/functions/time_equ.cpp +1 -1
  57. package/src/functions/utc_to_jd.cpp +1 -1
  58. package/src/functions/vis_limit_mag.cpp +4 -4
  59. package/src/sweph.cpp +3 -3
  60. package/src/sweph.h +1 -1
  61. package/{deps/swisseph → swisseph}/swehouse.c +3046 -3046
  62. package/{deps/swisseph → swisseph}/sweph.c +8401 -8401
  63. package/.github/FUNDING.yml +0 -5
  64. package/deps/swisseph.gyp +0 -43
  65. package/docs.gif +0 -0
  66. /package/{deps/swisseph → swisseph}/swecl.c +0 -0
  67. /package/{deps/swisseph → swisseph}/swedate.c +0 -0
  68. /package/{deps/swisseph → swisseph}/swedate.h +0 -0
  69. /package/{deps/swisseph → swisseph}/swehel.c +0 -0
  70. /package/{deps/swisseph → swisseph}/swehouse.h +0 -0
  71. /package/{deps/swisseph → swisseph}/swejpl.c +0 -0
  72. /package/{deps/swisseph → swisseph}/swejpl.h +0 -0
  73. /package/{deps/swisseph → swisseph}/swemmoon.c +0 -0
  74. /package/{deps/swisseph → swisseph}/swemplan.c +0 -0
  75. /package/{deps/swisseph → swisseph}/swemptab.h +0 -0
  76. /package/{deps/swisseph → swisseph}/swenut2000a.h +0 -0
  77. /package/{deps/swisseph → swisseph}/sweodef.h +0 -0
  78. /package/{deps/swisseph → swisseph}/sweph.h +0 -0
  79. /package/{deps/swisseph → swisseph}/swephexp.h +0 -0
  80. /package/{deps/swisseph → swisseph}/swephlib.c +0 -0
  81. /package/{deps/swisseph → swisseph}/swephlib.h +0 -0
package/README.md CHANGED
@@ -1,16 +1,18 @@
1
1
  # Sweph
2
2
 
3
3
  The definitive Swiss Ephemeris bindings for Node.js
4
- Everything you need to create Astrology and Astronomy applications with javascript and node.js
4
+ Everything you need to create Astrology and Astronomy applications with JavaScript and Node.JS
5
5
 
6
6
  * 100% API coverage
7
- * Built-in Typescript declarations
7
+ * Built-in Typescript declarations and ESM exports
8
8
  * Built-in intellisense documentation
9
- * Version matching
10
- * Made with the N-API
9
+ * Version matched
10
+ * Built with Node's N-API
11
11
 
12
- [Official documentation for the Swiss Ephemeris by Astrodienst AG](https://www.astro.com/swisseph/swephprg.htm)
13
- [Sweph on NPM](http://npm.com/package/sweph)
12
+ [Official programmer's documentation for the Swiss Ephemeris by Astrodienst AG](https://www.astro.com/swisseph/swephprg.htm)
13
+ [Official guide for the Swiss Ephemeris by Astrodienst AG](https://www.astro.com/ftp/swisseph/doc/swisseph.htm)
14
+ [Sweph on GitHub](https://github.com/timotejroiko/sweph)
15
+ [Sweph on NPM](https://npmjs.com/package/sweph)
14
16
 
15
17
  ## Installation and Licensing
16
18
 
@@ -19,12 +21,12 @@ This library follows the licensing requirements for the Swiss Ephemeris by Astro
19
21
  ### - GPL
20
22
 
21
23
  Up to and including version `2.10.0`, this library is licensed under `GPL-2.0`.
22
- To install and use this library under GPL, use `npm install sweph@2.10.0`.
24
+ To install and use this library under GPL, use `npm install sweph@gpl` or `npm install sweph@2.10.0`.
23
25
 
24
26
  ### - AGPL
25
27
 
26
28
  Starting from version `2.10.1` and later, this library is licensed under `AGPL-3.0`.
27
- To install and use the latest version of this library under AGPL, use `npm install sweph`.
29
+ To install and use the latest version of this library under AGPL, use `npm install sweph` or `npm install sweph@latest`.
28
30
 
29
31
  ### - LGPL
30
32
 
@@ -34,23 +36,53 @@ If you own a professional license for the Swiss Ephemeris, you may use any versi
34
36
 
35
37
  This library is version locked to the Swiss Ephemeris in addition to its own revisions. For example, version `2.10.1-1` corresponds to the Swiss Ephemeris version `2.10.1` and this library's revision `1`.
36
38
 
37
- Updates to this library will be released under new revisions, while updates to the upstream Swiss Ephemeris will be released under matching semver versions.
39
+ Updates to this library will be released under new revisions, while updates to Swiss Ephemeris will be released under matching SemVer versions.
38
40
 
39
41
  ## Documentation
40
42
 
41
- This library is fully typed and documented via intellisense. To access its documentation simply hover over its functions:
43
+ This library is fully typed and documented via intellisense. To access its documentation simply hover over its functions in your favorite code editor:
42
44
 
43
45
  ![docs_example](docs.gif)
44
46
 
47
+ ## Ephemeris files
48
+
49
+ Ephemeris files are required to enable high precision calculations for planets and asteroids. This library does not include any ephemeris files by default, but you can download them from the official Swiss Ephemeris Github repository (main planets only) or the official Astrodienst Dropox folder (all files):
50
+
51
+ * Swiss Ephemeris Github: [https://github.com/aloistr/swisseph/tree/master/ephe](https://github.com/aloistr/swisseph/tree/master/ephe)
52
+ * Astrodienst Dropbox [https://www.dropbox.com/scl/fo/y3naz62gy6f6qfrhquu7u/h?rlkey=ejltdhb262zglm7eo6yfj2940&dl=0](https://www.dropbox.com/scl/fo/y3naz62gy6f6qfrhquu7u/h?rlkey=ejltdhb262zglm7eo6yfj2940&dl=0)
53
+
54
+ Each main ephemeris file covers a range of 600 years starting from the century indicated in its name, for example the file `sepl_18.se1` is valid from year 1800 until year 2400. The following files are available:
55
+
56
+ * sepl files - planets
57
+ * seplm files - planets (BC)
58
+ * semo files - moon
59
+ * semom files - moon (BC)
60
+ * seas files - main asteroids
61
+ * seasm files - main asteroids (BC)
62
+
63
+ For advanced usage, the following files and folders can also be found in the dropbox link:
64
+
65
+ * all_ast - files for all asteroids (600 years range)
66
+ * long_ast - files for named asteroids (6000 years range)
67
+ * jpl binary files - files for NASA's JPL ephemerides
68
+ * ephe/sat folder - files for planetary moons
69
+
70
+ To use the files, download them, store them in some folder, then call `set_ephe_path()` to point the library to that folder. Asteroid files should be placed in `astxxx` subfolders, the same way they appear in the dropbox asteroids section. Files for planetary moons should be placed in a `sat` subfolder.
71
+
72
+ More information can be found in the files sections of the [Swiss Ephemeris documentation](https://www.astro.com/ftp/swisseph/doc/swisseph.htm).
73
+
45
74
  ## Contributing
46
75
 
47
- If you find any innacuracy or bug in this library, or if you find an update that is not yet included in this library, feel free to open an issue or a pull request.
76
+ If you find any inaccuracy or bug in this library, or if you find an upstream update that is not yet included in this library, feel free to open an issue or a pull request.
77
+
78
+ ## Limitations
79
+
80
+ * While worker_threads are supported, the underlying C library is single threaded and contains process-wide settings. Functions such as `set_ephe_path()` or `set_sid_mode()` will affect the entire process, including all worker_threads. While you can still use worker_threads as long as you don't change settings from other threads in the middle of calculations, true thread-safe multithreading can only be achieved using child_process.
48
81
 
49
- ## Known Issues and Caveats
82
+ * This library is a C/C++ add-on designed for Node.JS only, it will not work in browsers, other JS engines or in any other environment that does not support native C/C++ add-ons made with Node's N-API. In order to install this library, the target system must have the necessary build tools installed, such as `python`, `make` and `gcc` on Linux, `xcode` on Mac, `visual c++ build tools` on Windows, and/or other equivalent solutions.
50
83
 
51
- * Due to how the underlying C library operates, you may find that the `error` field returned by some functions will contain data even if there is no actual error. This can happen when existing memory buffers are recycled and the user must handle it by also checking the returned flag values as per the Swiss Ephemeris documentation.
52
- * While worker_threads are supported, the underlying C library is single threaded and its settings are global. Functions such as `set_ephe_path()` will affect the entire process, including worker_threads. While you can still use worker_threads as long as you dont change settings from other threads in the middle of calculations, true thead-safe multithreading can be achieved using child_process instead.
84
+ ## Copyright
53
85
 
54
- ## Author
86
+ Copyright © 2021-2023, Timotej Valentin Rojko
55
87
 
56
- Copyright © 2021, Timotej Valentin Rojko
88
+ This library is offered free of charge for any type of use, including commercial use, however, if you're an individual or a company using this library in commercial products and/or services, consider subscribing to the appropriate sponsorship level [here](https://github.com/sponsors/timotejroiko) and get priority support for your business.
package/binding.gyp CHANGED
@@ -4,36 +4,38 @@
4
4
  "target_name": "sweph",
5
5
  "sources": [
6
6
  "src/sweph.cpp",
7
- "<!@(node -p \"const { readdirSync, readFileSync, writeFileSync } = require(`fs`); const file = readdirSync(`./src/functions`).map((x,i) => readFileSync(`./src/functions/${x}`, `utf8`).replace(/args/g, `args${i}`).replace(`#include <sweph.h>`, ``)).reduce((a,b) => a + b,`#include <sweph.h>`); writeFileSync(`./src/functions.cpp`, file, `utf8`); `src/functions.cpp`\")"
7
+ "src/functions.cpp"
8
8
  ],
9
9
  "include_dirs": [
10
10
  "<!(node -p \"require('node-addon-api').include_dir\")",
11
11
  "src"
12
12
  ],
13
- 'dependencies': [
14
- 'deps/swisseph.gyp:swisseph'
15
- ],
16
- "defines": [
17
- "NAPI_DISABLE_CPP_EXCEPTIONS"
18
- ],
19
- "cflags": [
20
- "-flto",
21
- "-Ofast",
22
- "-pipe"
13
+ "dependencies": [
14
+ "swisseph"
23
15
  ],
24
- "cflags_cc": [
25
- "-flto",
26
- "-Ofast",
27
- "-pipe"
16
+ "defines": [
17
+ "NAPI_DISABLE_CPP_EXCEPTIONS",
18
+ 'NAPI_VERSION=6'
19
+ ]
20
+ },
21
+ {
22
+ "target_name": "swisseph",
23
+ 'type': "static_library",
24
+ "sources": [
25
+ "swisseph/swecl.c",
26
+ "swisseph/swedate.c",
27
+ "swisseph/swehel.c",
28
+ "swisseph/swehouse.c",
29
+ "swisseph/swejpl.c",
30
+ "swisseph/swemmoon.c",
31
+ "swisseph/swemplan.c",
32
+ "swisseph/sweph.c",
33
+ "swisseph/swephlib.c"
28
34
  ],
29
- "msvs_settings": {
30
- "VCCLCompilerTool": {
31
- "AdditionalOptions": [
32
- "/O2",
33
- "/GL",
34
- "/Gw"
35
- ]
36
- }
35
+ "direct_dependent_settings": {
36
+ "include_dirs": [
37
+ "swisseph"
38
+ ]
37
39
  }
38
40
  }
39
41
  ]