thrustcurve-db 1.0.1 → 2.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
@@ -1,71 +1,58 @@
1
1
  # thrustcurve-db
2
2
 
3
- ThrustCurve.org model rocket motor data as a static data structure (plus misc.
4
- utility functions).
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).
5
4
 
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.
5
+ See also, the included [TypeScript definitions](https://github.com/broofa/thrustcurve-db/blob/main/thrustcurve.d.ts).
9
6
 
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):
7
+ ### Alterations
11
8
 
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.
9
+ In addition to the `SearchResponse` data, the following alterations have been made:
13
10
 
14
- 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]`
15
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.
16
16
 
17
17
  ## Installation
18
18
 
19
19
  ```
20
20
  npm i thrustcurve-db
21
- ```
22
-
23
- ... or with `yarn`:
24
- ```
25
21
  yarn add thrustcurve-db
26
22
  ```
27
23
 
28
24
  ## Usage
29
25
 
30
- ES Modules
26
+ ### ESM
31
27
 
32
28
  ```js
33
29
  import MOTORS from 'thrustcurve-db';
34
30
  ```
35
31
 
36
- ... or for CommonJS:
32
+ ### CommonJS
33
+
37
34
  ```js
38
35
  const MOTORS = require('thrustcurve-db');
39
36
  ```
40
37
 
41
- ... or for CommonJS w/ `import()` (NodeJS):
42
-
43
- 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
44
39
 
45
- ```js
46
- const MOTORS = await import('thrustcurve-db');
47
- ```
48
-
49
- ... or to fetch from jsDelvr CDN:
40
+ ### Fetch from JSDelivr CDN:
50
41
 
51
42
  ```js
52
- const MOTORS = await fetch('https://cdn.jsdelivr.net/npm/thrustcurve-db@latest/thrustcurve-db.json')
53
- .then(res => res.json());
43
+ const MOTORS = await fetch(
44
+ 'https://cdn.jsdelivr.net/npm/thrustcurve-db@latest/thrustcurve-db.json'
45
+ ).then(res => res.json());
54
46
  ```
55
47
 
56
48
  ## Example
57
49
 
58
- After importing (above)...
59
-
60
50
  ```js
61
51
  // Find all J motors currently in production
62
52
  MOTORS.filter(m => m.availability === 'regular' && m.impulseClass === 'J');
63
53
  ```
64
54
 
65
- ### Issues & Contributions
55
+ ## Issues & Contributions
66
56
 
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
57
+ The data provided here is sourced from thrustcurve.org. Omissions and errors in rocket data should be directed there. Any systematic problems or suggestions for how the data here is presented may be [reported
70
58
  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.1",
3
+ "version": "2.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": {
@@ -15,8 +15,8 @@
15
15
  "thrustcurve-db.d.ts"
16
16
  ],
17
17
  "scripts": {
18
- "prepare": "node build/build.js > thrustcurve-db.json",
19
- "test": "node --experimental-json-modules build/test.js && exit 1"
18
+ "prepare": "build/build.js > thrustcurve-db.json",
19
+ "test": "echo \"no tests\" && exit 1"
20
20
  },
21
21
  "repository": {
22
22
  "type": "git",
@@ -1,31 +1,49 @@
1
- type ThrustPoint = [number, number];
1
+ type ThrustPoint = [
2
+ number, // time (seconds)
3
+ number // thrust (Newtons)
4
+ ];
2
5
 
3
6
  export declare type Motor = {
4
- availability : 'regular' | 'OOP';
5
- avgThrustN : number;
6
- burnTimeS : number;
7
- certOrg : string;
8
- commonName : string;
9
- dataFiles : number;
10
- delays : string;
11
- designation : string;
12
- diameter : number;
13
- impulseClass : 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' | 'I' | 'J' | 'K' | 'L' | 'M' | 'N' | 'O';
14
- infoUrl : string;
15
- length : number;
16
- manufacturer : string;
17
- manufacturerAbbrev : string;
18
- maxThrustN : number;
19
- motorId : string;
20
- propInfo : string;
21
- propWeightG : number;
22
- samples ?: ThrustPoint[];
23
- sparky ?: boolean;
24
- totImpulseNs : number;
25
- totalWeightG : number;
26
- type : 'SU' | 'hybrid' | 'reload';
27
- updatedOn : string;
28
- }
7
+ availability: 'regular' | 'OOP';
8
+ avgThrustN: number;
9
+ burnTimeS: number;
10
+ certOrg: string;
11
+ commonName: string;
12
+ dataFiles: number;
13
+ delays: string;
14
+ designation: string;
15
+ diameter: number;
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';
32
+ infoUrl: string;
33
+ length: number;
34
+ manufacturer: string;
35
+ manufacturerAbbrev: string;
36
+ maxThrustN: number;
37
+ motorId: string;
38
+ propInfo: string;
39
+ propWeightG: number;
40
+ samples?: ThrustPoint[];
41
+ sparky?: boolean;
42
+ totImpulseNs: number;
43
+ totalWeightG: number;
44
+ type: 'SU' | 'hybrid' | 'reload';
45
+ updatedOn: string;
46
+ };
29
47
 
30
- declare const MOTORS : Array<Motor>;
48
+ declare const MOTORS: Array<Motor>;
31
49
  export default MOTORS;