thrustcurve-db 1.0.0 → 1.0.1

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 CHANGED
@@ -3,45 +3,42 @@
3
3
  ThrustCurve.org model rocket motor data as a static data structure (plus misc.
4
4
  utility functions).
5
5
 
6
- This module is a rebundling of the rocket motor data available on John Coker's
7
- [thrustcurve.org](https://thrustcurve.org) website ("TC"). The dataset includes data for all motors in the [ThrustCurve API](https://www.thrustcurve.org/info/api.html) ("search" endpoint), and is a field-by-field translation of what is found in the "search" endpoint, with the following changes:
8
- * Motor "availability" is exposed as the `discontinued` field (see https://github.com/JohnCoker/thrustcurve3/issues/35)
9
- * Where available, thrust curve data (from the "download" endpoint) is included as a `samples` array. These are normalized to always have `[0, 0]` as the first data point. In cases where more than one sample file is available for a motor, the first "cert"(ified) file found is used. Otherwise the samples are from whichever file the API return first.
6
+ This module is a rebundling of the model rocket motor data found at John Coker's
7
+ [thrustcurve.org](https://thrustcurve.org) website ("TC"). It is available here
8
+ in JSON format, or as an ESM or CommonJS module.
10
9
 
11
- **License & Support**
10
+ The format of this data is identical to that of the TC [/api/v1/search response](https://github.com/JohnCoker/thrustcurve3/blob/8bd8571fe0791fb9a68a6a96eb36c276d58c339b/config/api_v1.yml#L428-L526), with one additional field (where available):
12
11
 
13
- * Please read and understand [the ThrustCurve.org license](https://www.thrustcurve.org/info/contribute.html#license)
14
- * This is a *snapshot* of the TC data. It may be out of date. File an issue here if you think it needs to be updated.
15
- * Issues with how motor data is translated into JSON should be filed here.
16
- * Issues with incorrect motor data should be directed to the TC site.
12
+ * `samples`: `Array[[number, number]]` of thrust`samples`. This is the `samples` data from the TC "/api/vi/download" endpoint normalized to always have `[0, 0]` as the first data point. in cases where more than one sample file is available for a motor, the first "cert"(ified) data file is used. Otherwise it will be whichever data file the API returns first.
13
+
14
+ See also, the included [TypeScript definition`](./thrustcurve.d.ts).
17
15
 
18
- ## Installation
19
16
 
20
- ### NPM
17
+ ## Installation
21
18
 
22
19
  ```
23
20
  npm i thrustcurve-db
24
21
  ```
25
22
 
26
- ### Yarn
23
+ ... or with `yarn`:
27
24
  ```
28
25
  yarn add thrustcurve-db
29
26
  ```
30
27
 
31
28
  ## Usage
32
29
 
33
- ### ES Modules
30
+ ES Modules
34
31
 
35
32
  ```js
36
33
  import MOTORS from 'thrustcurve-db';
37
34
  ```
38
35
 
39
- ### CommonJS
36
+ ... or for CommonJS:
40
37
  ```js
41
38
  const MOTORS = require('thrustcurve-db');
42
39
  ```
43
40
 
44
- ### CommonJS w/ `import()` (NodeJS)
41
+ ... or for CommonJS w/ `import()` (NodeJS):
45
42
 
46
43
  Note: At present this requires you run `node` with the `--experimental-json-modules` flag
47
44
 
@@ -49,6 +46,13 @@ Note: At present this requires you run `node` with the `--experimental-json-mod
49
46
  const MOTORS = await import('thrustcurve-db');
50
47
  ```
51
48
 
49
+ ... or to fetch from jsDelvr CDN:
50
+
51
+ ```js
52
+ const MOTORS = await fetch('https://cdn.jsdelivr.net/npm/thrustcurve-db@latest/thrustcurve-db.json')
53
+ .then(res => res.json());
54
+ ```
55
+
52
56
  ## Example
53
57
 
54
58
  After importing (above)...
@@ -57,3 +61,11 @@ After importing (above)...
57
61
  // Find all J motors currently in production
58
62
  MOTORS.filter(m => m.availability === 'regular' && m.impulseClass === 'J');
59
63
  ```
64
+
65
+ ### Issues & Contributions
66
+
67
+ The data provided here is sourced from thrustcurve.org. Omissions and errors in
68
+ rocket data should be directed there. Any systematic problems or suggestions
69
+ for how the data here is presented may be [reported
70
+ here](https://github.com/broofa/thrustcurve-db/issues).
71
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thrustcurve-db",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "type": "module",
5
5
  "description": "ThrustCurve.org model rocket motor and thrust curve data as a single JSON file",
6
6
  "exports": {
@@ -10,7 +10,7 @@ export declare type Motor = {
10
10
  delays : string;
11
11
  designation : string;
12
12
  diameter : number;
13
- impulseClass : string;
13
+ impulseClass : 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' | 'I' | 'J' | 'K' | 'L' | 'M' | 'N' | 'O';
14
14
  infoUrl : string;
15
15
  length : number;
16
16
  manufacturer : string;
@@ -23,7 +23,7 @@ export declare type Motor = {
23
23
  sparky ?: boolean;
24
24
  totImpulseNs : number;
25
25
  totalWeightG : number;
26
- type : string;
26
+ type : 'SU' | 'hybrid' | 'reload';
27
27
  updatedOn : string;
28
28
  }
29
29