thrustcurve-db 1.0.0 → 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,59 +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 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.
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.
10
6
 
11
- **License & Support**
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).
12
8
 
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.
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.
17
10
 
18
- ## Installation
11
+ See also, the included [TypeScript definition](./thrustcurve.d.ts).
19
12
 
20
- ### NPM
13
+ ## Installation
21
14
 
22
15
  ```
23
16
  npm i thrustcurve-db
24
- ```
25
-
26
- ### Yarn
27
- ```
28
17
  yarn add thrustcurve-db
29
18
  ```
30
19
 
31
20
  ## Usage
32
21
 
33
- ### ES Modules
22
+ ### Import with ESM or CommonJS:
34
23
 
35
24
  ```js
36
- import MOTORS from 'thrustcurve-db';
25
+ import MOTORS from "thrustcurve-db"; // ESM
26
+ const MOTORS = require("thrustcurve-db"); // CommonJS
37
27
  ```
38
28
 
39
- ### CommonJS
40
- ```js
41
- const MOTORS = require('thrustcurve-db');
42
- ```
43
-
44
- ### CommonJS w/ `import()` (NodeJS)
29
+ Note: At present this requires you run `node` with the `--experimental-json-modules` flag
45
30
 
46
- Note: At present this requires you run `node` with the `--experimental-json-modules` flag
31
+ ### Fetch from JSDelivr CDN:
47
32
 
48
33
  ```js
49
- const MOTORS = await import('thrustcurve-db');
34
+ const MOTORS = await fetch(
35
+ "https://cdn.jsdelivr.net/npm/thrustcurve-db@latest/thrustcurve-db.json"
36
+ ).then(res => res.json());
50
37
  ```
51
38
 
52
39
  ## Example
53
40
 
54
- After importing (above)...
55
-
56
41
  ```js
57
42
  // Find all J motors currently in production
58
- MOTORS.filter(m => m.availability === 'regular' && m.impulseClass === 'J');
43
+ MOTORS.filter(m => m.availability === "regular" && m.impulseClass === "J");
59
44
  ```
45
+
46
+ ## Issues & Contributions
47
+
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
49
+ here](https://github.com/broofa/thrustcurve-db/issues).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thrustcurve-db",
3
- "version": "1.0.0",
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 : string;
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 : string;
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;