thrustcurve-db 1.0.2 → 2.0.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.
package/README.md CHANGED
@@ -1,71 +1,49 @@
1
1
  # thrustcurve-db
2
2
 
3
- ThrustCurve.org model rocket motor data as a static data structure (plus misc.
4
- utility functions).
3
+ ThrustCurve.org model rocket motor data as a single JSON file.
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
+ 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.
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
+ 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).
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.
13
-
14
- See also, the included [TypeScript definition`](./thrustcurve.d.ts).
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.
15
10
 
11
+ See also, the included [TypeScript definition](./thrustcurve.d.ts).
16
12
 
17
13
  ## Installation
18
14
 
19
15
  ```
20
16
  npm i thrustcurve-db
21
- ```
22
-
23
- ... or with `yarn`:
24
- ```
25
17
  yarn add thrustcurve-db
26
18
  ```
27
19
 
28
20
  ## Usage
29
21
 
30
- ES Modules
31
-
32
- ```js
33
- import MOTORS from 'thrustcurve-db';
34
- ```
22
+ ### Import with ESM or CommonJS:
35
23
 
36
- ... or for CommonJS:
37
24
  ```js
38
- const MOTORS = require('thrustcurve-db');
25
+ import MOTORS from "thrustcurve-db"; // ESM
26
+ const MOTORS = require("thrustcurve-db"); // CommonJS
39
27
  ```
40
28
 
41
- ... or for CommonJS w/ `import()` (NodeJS):
29
+ Note: At present this requires you run `node` with the `--experimental-json-modules` flag
42
30
 
43
- Note: At present this requires you run `node` with the `--experimental-json-modules` flag
31
+ ### Fetch from JSDelivr CDN:
44
32
 
45
33
  ```js
46
- const MOTORS = await import('thrustcurve-db');
47
- ```
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());
34
+ const MOTORS = await fetch(
35
+ "https://cdn.jsdelivr.net/npm/thrustcurve-db@latest/thrustcurve-db.json"
36
+ ).then(res => res.json());
54
37
  ```
55
38
 
56
39
  ## Example
57
40
 
58
- After importing (above)...
59
-
60
41
  ```js
61
42
  // Find all J motors currently in production
62
- MOTORS.filter(m => m.availability === 'regular' && m.impulseClass === 'J');
43
+ MOTORS.filter(m => m.availability === "regular" && m.impulseClass === "J");
63
44
  ```
64
45
 
65
- ### Issues & Contributions
46
+ ## Issues & Contributions
66
47
 
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
48
+ 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
49
  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.2",
3
+ "version": "2.0.0",
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;