thrustcurve-db 2.0.0 → 2.0.3

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
@@ -1,14 +1,18 @@
1
1
  # thrustcurve-db
2
2
 
3
- ThrustCurve.org model rocket motor data as a single JSON file.
3
+ This module is a rebundling of the model rocket motor data available on John Coker's excellent [thrustcurve.org](https://thrustcurve.org) website ("TC") as a stand-alone JSON file. The data is an array of motor items consistent with TC's [`SearchResponse#results` schema](https://app.swaggerhub.com/apis/JCSW7/thrust-curve_org_api/1.0.3#/SearchResponse).
4
4
 
5
- This module is a rebundling of the model rocket motor data found at John Coker's [thrustcurve.org](https://thrustcurve.org) website ("TC"). It is available here in JSON format, or as an ESM or CommonJS module.
5
+ See also, the included [TypeScript definitions](https://github.com/broofa/thrustcurve-db/blob/main/thrustcurve.d.ts).
6
6
 
7
- Data is pulled from the TC [/api/v1/search response](https://github.com/JohnCoker/thrustcurve3/blob/8bd8571fe0791fb9a68a6a96eb36c276d58c339b/config/api_v1.yml#L428-L526) API. For brevity, not all fields are included in the dataset here, however they can be added if requested. (Just file an issue).
7
+ ### Alterations
8
8
 
9
- There is one additional field, `samples`, which is the actual thrust data as provided by the TC "/api/vi/download" endpoint. This is 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.
9
+ In addition to the `SearchResponse` data, the following alterations have been made:
10
10
 
11
- See also, the included [TypeScript definition](./thrustcurve.d.ts).
11
+ - All `number`s are rounded to a precision of 4 digits.
12
+ - Most (but not all) motors include a `samples` array containing the thrust data found in the TC `/api/vi/download` endpoint.
13
+ - `samples` data is normalized to insure the first data point is always `[0, 0]`
14
+
15
+ For full details of how this data set is compiled, please refer to the [`build/build.js`](https://github.com/broofa/thrustcurve-db/blob/main/build/build.js) script in this repository.
12
16
 
13
17
  ## Installation
14
18
 
@@ -19,20 +23,25 @@ yarn add thrustcurve-db
19
23
 
20
24
  ## Usage
21
25
 
22
- ### Import with ESM or CommonJS:
26
+ ### ESM
27
+
28
+ ```js
29
+ import MOTORS from 'thrustcurve-db';
30
+ ```
31
+
32
+ ### CommonJS
23
33
 
24
34
  ```js
25
- import MOTORS from "thrustcurve-db"; // ESM
26
- const MOTORS = require("thrustcurve-db"); // CommonJS
35
+ const MOTORS = require('thrustcurve-db');
27
36
  ```
28
37
 
29
- Note: At present this requires you run `node` with the `--experimental-json-modules` flag
38
+ Note: Users running `node` may need to supply the [`--experimental-json-modules`](https://nodejs.org/docs/latest-v12.x/api/all.html#esm_experimental_json_modules) flag
30
39
 
31
40
  ### Fetch from JSDelivr CDN:
32
41
 
33
42
  ```js
34
43
  const MOTORS = await fetch(
35
- "https://cdn.jsdelivr.net/npm/thrustcurve-db@latest/thrustcurve-db.json"
44
+ 'https://cdn.jsdelivr.net/npm/thrustcurve-db@latest/thrustcurve-db.json'
36
45
  ).then(res => res.json());
37
46
  ```
38
47
 
@@ -40,7 +49,7 @@ const MOTORS = await fetch(
40
49
 
41
50
  ```js
42
51
  // Find all J motors currently in production
43
- MOTORS.filter(m => m.availability === "regular" && m.impulseClass === "J");
52
+ MOTORS.filter(m => m.availability === 'regular' && m.impulseClass === 'J');
44
53
  ```
45
54
 
46
55
  ## Issues & Contributions
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thrustcurve-db",
3
- "version": "2.0.0",
3
+ "version": "2.0.3",
4
4
  "type": "module",
5
5
  "description": "ThrustCurve.org model rocket motor and thrust curve data as a single JSON file",
6
6
  "exports": {
@@ -1,10 +1,10 @@
1
1
  type ThrustPoint = [
2
2
  number, // time (seconds)
3
- number // thrust (Newtons)
3
+ number // thrust (Newtons)
4
4
  ];
5
5
 
6
6
  export declare type Motor = {
7
- availability: "regular" | "OOP";
7
+ availability: 'regular' | 'OOP';
8
8
  avgThrustN: number;
9
9
  burnTimeS: number;
10
10
  certOrg: string;
@@ -14,21 +14,21 @@ export declare type Motor = {
14
14
  designation: string;
15
15
  diameter: number;
16
16
  impulseClass:
17
- | "A"
18
- | "B"
19
- | "C"
20
- | "D"
21
- | "E"
22
- | "F"
23
- | "G"
24
- | "H"
25
- | "I"
26
- | "J"
27
- | "K"
28
- | "L"
29
- | "M"
30
- | "N"
31
- | "O";
17
+ | 'A'
18
+ | 'B'
19
+ | 'C'
20
+ | 'D'
21
+ | 'E'
22
+ | 'F'
23
+ | 'G'
24
+ | 'H'
25
+ | 'I'
26
+ | 'J'
27
+ | 'K'
28
+ | 'L'
29
+ | 'M'
30
+ | 'N'
31
+ | 'O';
32
32
  infoUrl: string;
33
33
  length: number;
34
34
  manufacturer: string;
@@ -41,7 +41,7 @@ export declare type Motor = {
41
41
  sparky?: boolean;
42
42
  totImpulseNs: number;
43
43
  totalWeightG: number;
44
- type: "SU" | "hybrid" | "reload";
44
+ type: 'SU' | 'hybrid' | 'reload';
45
45
  updatedOn: string;
46
46
  };
47
47