rocket-launch-live-client 1.0.3 → 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.
Files changed (42) hide show
  1. package/README.md +105 -61
  2. package/lib/{esm/types/Client.d.ts → Client.d.ts} +6 -8
  3. package/lib/Client.js +61 -0
  4. package/lib/fetcher.d.ts +5 -0
  5. package/lib/fetcher.js +146 -0
  6. package/lib/{cjs/types/index.d.ts → index.d.ts} +0 -1
  7. package/lib/index.js +4 -0
  8. package/lib/{cjs/types/types → types}/application.d.ts +41 -27
  9. package/lib/types/application.js +41 -0
  10. package/lib/types/standards.d.ts +8 -0
  11. package/lib/types/standards.js +314 -0
  12. package/lib/{cjs/types/utils.d.ts → utils.d.ts} +1 -4
  13. package/lib/{esm/utils.js → utils.js} +18 -4
  14. package/lib/{cjs/types → watcher}/Watcher.d.ts +16 -12
  15. package/lib/watcher/Watcher.js +145 -0
  16. package/lib/watcher/index.d.ts +25 -0
  17. package/lib/watcher/index.js +3 -0
  18. package/package.json +30 -26
  19. package/lib/cjs/Client.js +0 -233
  20. package/lib/cjs/Watcher.js +0 -172
  21. package/lib/cjs/fetcher.js +0 -61
  22. package/lib/cjs/index.js +0 -30
  23. package/lib/cjs/package.json +0 -3
  24. package/lib/cjs/types/Client.d.ts +0 -189
  25. package/lib/cjs/types/application.js +0 -46
  26. package/lib/cjs/types/fetcher.d.ts +0 -2
  27. package/lib/cjs/types/standards.js +0 -321
  28. package/lib/cjs/types/types/standards.d.ts +0 -316
  29. package/lib/cjs/utils.js +0 -266
  30. package/lib/esm/Client.js +0 -229
  31. package/lib/esm/Watcher.js +0 -168
  32. package/lib/esm/fetcher.js +0 -54
  33. package/lib/esm/index.mjs +0 -22
  34. package/lib/esm/package.json +0 -3
  35. package/lib/esm/types/Watcher.d.ts +0 -81
  36. package/lib/esm/types/application.js +0 -43
  37. package/lib/esm/types/fetcher.d.ts +0 -2
  38. package/lib/esm/types/index.d.ts +0 -24
  39. package/lib/esm/types/standards.js +0 -316
  40. package/lib/esm/types/types/application.d.ts +0 -206
  41. package/lib/esm/types/types/standards.d.ts +0 -316
  42. package/lib/esm/types/utils.d.ts +0 -12
package/lib/esm/Client.js DELETED
@@ -1,229 +0,0 @@
1
- import { RLLEndPoint, } from "./types/application.js";
2
- import { fetcher } from "./fetcher.js";
3
- import { apiKeyValidator, optionsValidator, queryOptionsValidator, } from "./utils.js";
4
- import { RLLWatcher } from "./Watcher.js";
5
- /**
6
- * Class representing a RocketLaunch.Live client
7
- * @class
8
- */
9
- export class RLLClient {
10
- /**
11
- * Create a new RocketLaunch.live Client
12
- *
13
- * @param {string} apiKey - Your RocketLaunch.Live API Key
14
- * @param {Object} [options] - Optional Client Configuration options
15
- * @param {boolean} options.keyInQueryParams - Set to true to send your API Key via Query parameters instead of Authorization Header (not recommended)
16
- *
17
- */
18
- constructor(apiKey, options) {
19
- this.config = {
20
- keyInQueryParams: false,
21
- };
22
- // Validate API Key is a valid UUID format
23
- // Constructor throws if not
24
- this.apiKey = apiKeyValidator(apiKey);
25
- if (!options) {
26
- return;
27
- }
28
- // Validate Options with warnings or throws
29
- optionsValidator(options);
30
- if (options.keyInQueryParams) {
31
- this.config.keyInQueryParams = options.keyInQueryParams;
32
- }
33
- }
34
- /**
35
- * Used internally to make API query
36
- *
37
- * @private
38
- *
39
- * @template T
40
- *
41
- * @param {string} endpoint - API endpoint (ie. "/launches")
42
- * @param {URLSearchParams} params - API Search Params
43
- *
44
- * @returns {Promise<T>}
45
- */
46
- query(endpoint, params) {
47
- return fetcher(this.apiKey, endpoint, params, this.config.keyInQueryParams);
48
- }
49
- /**
50
- * Instantiate a new RLL Watcher which will continually query the API for changes to the launches endpoint
51
- *
52
- * @public
53
- *
54
- * @param {number} interval - Interval in minutes to query the API for changes. Defaults to 5 minutes, cannot be less than 1 minute
55
- * @param {RLLQueryConfig.Launches} options - Query options, same as calling the launches method
56
- *
57
- * @returns {RLLWatcher}
58
- */
59
- watch(interval, options) {
60
- return new RLLWatcher((params) => this.query(RLLEndPoint.LAUNCHES, params), interval, options);
61
- }
62
- /**
63
- * Fetch launch companies
64
- *
65
- * @public
66
- * @function
67
- *
68
- * @param {Object} [options] - Launch Company Search Options
69
- * @param {number | string} options.id - Company id
70
- * @param {number | string} options.page - Page number of results
71
- * @param {number | string} options.name - Company name
72
- * @param {ISO3166Alpha2.CountryCode} options.country_code - ISO 3166 Alpha 2 Country Code
73
- * @param {boolean} options.inactive - Company inactive status
74
- *
75
- * @returns {Promise<RLLResponse<RLLEntity.Company[]>>} Array of companies wrapped in a standard RLL Response
76
- *
77
- * @example
78
- *
79
- * const response = await client.companies({ country_code: "US" })
80
- */
81
- companies(options) {
82
- const params = queryOptionsValidator(RLLEndPoint.COMPANIES, options);
83
- return this.query(RLLEndPoint.COMPANIES, params);
84
- }
85
- /**
86
- * Fetch launches
87
- *
88
- * @public
89
- * @function
90
- *
91
- * @param {Object} [options] - Launch Search Options
92
- * @param {number | string} options.id - Launch id
93
- * @param {number | string} options.page - Page number of results
94
- * @param {string} options.cospar_id - Launch COSPAR ID (ie. 2022-123)
95
- * @param {Date | string} options.before_date - Only return launches before this date
96
- * @param {Date | string} options.after_date - Only return launches after this date
97
- * @param {Date | string} options.modified_since - Only return launches with API changes after this date
98
- * @param {number | string} options.location_id - Launches from this Location
99
- * @param {number | string} options.pad_id - Launches from this Pad
100
- * @param {number | string} options.provider_id - Launches from this Company
101
- * @param {number | string} options.tag_id - Launches with this Tag
102
- * @param {number | string} options.vehicle_id - Launches on this Vehicle
103
- * @param {ISO3166Alpha2.StateCodeUS} options.state_abbr - ISO 3166 Alpha 2 US State Code
104
- * @param {ISO3166Alpha2.CountryCode} options.country_code - ISO 3166 Alpha 2 Country Code
105
- * @param {number | string} options.search - Launches matching this search string
106
- * @param {number | string} options.slug - Launches matching this unique slug
107
- * @param {number | string} options.limit - Limit results (default 25, max 25)
108
- * @param {'asc' | 'desc'} options.direction - Launches matching this unique slug
109
- *
110
- * @returns {Promise<RLLResponse<RLLEntity.Launch[]>>} Array of companies wrapped in a standard RLL Response
111
- *
112
- * @example
113
- *
114
- * const response = await client.launches({ after_date: new Date("2022-10-10") })
115
- */
116
- launches(options) {
117
- const params = queryOptionsValidator(RLLEndPoint.LAUNCHES, options);
118
- return this.query(RLLEndPoint.LAUNCHES, params);
119
- }
120
- /**
121
- * Fetch launch locations
122
- *
123
- * @public
124
- * @function
125
- *
126
- * @param {Object} [options] - Launch Location Search Options
127
- * @param {number | string} options.id - Location id
128
- * @param {number | string} options.page - Page number of results
129
- * @param {number | string} options.name - Location name
130
- * @param {ISO3166Alpha2.StateCodeUS} options.state_abbr - ISO 3166 Alpha 2 US State Code
131
- * @param {ISO3166Alpha2.CountryCode} options.country_code - ISO 3166 Alpha 2 Country Code
132
- *
133
- * @returns {Promise<RLLResponse<RLLEntity.Location[]>>} Array of companies wrapped in a standard RLL Response
134
- *
135
- * @example
136
- *
137
- * const response = await client.locations({ country_code: "US" })
138
- */
139
- locations(options) {
140
- const params = queryOptionsValidator(RLLEndPoint.LOCATIONS, options);
141
- return this.query(RLLEndPoint.LOCATIONS, params);
142
- }
143
- /**
144
- * Fetch launch Missions
145
- *
146
- * @public
147
- * @function
148
- *
149
- * @param {Object} [options] - Launch Mission Search Options
150
- * @param {number | string} options.id - Mission id
151
- * @param {number | string} options.page - Page number of results
152
- * @param {number | string} options.name - Mission name
153
- *
154
- * @returns {Promise<RLLResponse<RLLEntity.Mission[]>>} Array of companies wrapped in a standard RLL Response
155
- *
156
- * @example
157
- *
158
- * const response = await client.missions({ name: "Mars 2020" })
159
- */
160
- missions(options) {
161
- const params = queryOptionsValidator(RLLEndPoint.MISSIONS, options);
162
- return this.query(RLLEndPoint.MISSIONS, params);
163
- }
164
- /**
165
- * Fetch launch pads
166
- *
167
- * @public
168
- * @function
169
- *
170
- * @param {Object} [options] - Launch Pad Search Options
171
- * @param {number | string} options.id - Pad id
172
- * @param {number | string} options.page - Page number of results
173
- * @param {number | string} options.name - Pad name
174
- * @param {ISO3166Alpha2.StateCodeUS} options.state_abbr - ISO 3166 Alpha 2 US State Code
175
- * @param {ISO3166Alpha2.CountryCode} options.country_code - ISO 3166 Alpha 2 Country Code
176
- *
177
- * @returns {Promise<RLLResponse<RLLEntity.Pad[]>>} Array of companies wrapped in a standard RLL Response
178
- *
179
- * @example
180
- *
181
- * const response = await client.pads({ country_code: "US" })
182
- */
183
- pads(options) {
184
- const params = queryOptionsValidator(RLLEndPoint.PADS, options);
185
- return this.query(RLLEndPoint.PADS, params);
186
- }
187
- /**
188
- * Fetch launch tags
189
- *
190
- * @public
191
- * @function
192
- *
193
- * @param {Object} [options] - Launch Tag Search Options
194
- * @param {number | string} options.id - Tag id
195
- * @param {number | string} options.page - Page number of results
196
- * @param {number | string} options.text - Tag text
197
- *
198
- * @returns {Promise<RLLResponse<RLLEntity.Tag[]>>} Array of companies wrapped in a standard RLL Response
199
- *
200
- * @example
201
- *
202
- * const response = await client.tags({ text: "Crewed" })
203
- */
204
- tags(options) {
205
- const params = queryOptionsValidator(RLLEndPoint.TAGS, options);
206
- return this.query(RLLEndPoint.TAGS, params);
207
- }
208
- /**
209
- * Fetch launch Vehicles
210
- *
211
- * @public
212
- * @function
213
- *
214
- * @param {Object} [options] - Launch Vehicles Search Options
215
- * @param {number | string} options.id - Vehicle id
216
- * @param {number | string} options.page - Page number of results
217
- * @param {number | string} options.name - Vehicle name
218
- *
219
- * @returns {Promise<RLLResponse<RLLEntity.Vehicle[]>>} Array of companies wrapped in a standard RLL Response
220
- *
221
- * @example
222
- *
223
- * const response = await client.vehicles({ name: "Falcon 9" })
224
- */
225
- vehicles(options) {
226
- const params = queryOptionsValidator(RLLEndPoint.VEHICLES, options);
227
- return this.query(RLLEndPoint.VEHICLES, params);
228
- }
229
- }
@@ -1,168 +0,0 @@
1
- import { EventEmitter } from "events";
2
- import { RLLEndPoint, } from "./types/application.js";
3
- import { error, warn, queryOptionsValidator, formatToRLLISODate, } from "./utils.js";
4
- const DEFAULT_INTERVAL_IN_MINS = 5;
5
- const MS_IN_MIN = 60000;
6
- const intervalValidator = (interval) => {
7
- if (typeof interval !== "number" && typeof interval !== "string") {
8
- error("RLLWatcher interval must be a number.");
9
- return DEFAULT_INTERVAL_IN_MINS;
10
- }
11
- if (typeof interval === "string" &&
12
- (isNaN(Number(interval)) || interval === "")) {
13
- error("RLLWatcher interval must be a number.", "type");
14
- return DEFAULT_INTERVAL_IN_MINS;
15
- }
16
- const typedInterval = Number(interval);
17
- if (typedInterval <= 0) {
18
- error("RLLWatcher interval cannot be a negative number or zero. Watcher intervals should be greater than or equal to 1 minute.");
19
- return DEFAULT_INTERVAL_IN_MINS;
20
- }
21
- if (typedInterval < 1) {
22
- warn("RLLWatcher does not accept intervals less than 1. Your watcher will default to 5 minute intervals unless corrected.");
23
- return DEFAULT_INTERVAL_IN_MINS;
24
- }
25
- return typedInterval;
26
- };
27
- /**
28
- * Class representing a RocketLaunch.Live Client Watcher
29
- * @class
30
- */
31
- export class RLLWatcher extends EventEmitter {
32
- /**
33
- * Create a new RocketLaunch.live Client Watcher
34
- *
35
- * @param {function(params: URLSearchParams): Promise<RLLResponse<RLLEntity.Launch[]>>} fetcher - fetcher function to make API calls
36
- * @param {number | string} [interval] - Optional Client Configuration options
37
- * @param {Object} [options] - Launch Search Options
38
- * @param {number | string} options.id - Launch id
39
- * @param {number | string} options.page - Page number of results
40
- * @param {string} options.cospar_id - Launch COSPAR ID (ie. 2022-123)
41
- * @param {Date | string} options.before_date - Only return launches before this date
42
- * @param {Date | string} options.after_date - Only return launches after this date
43
- * @param {Date | string} options.modified_since - Only return launches with API changes after this date
44
- * @param {number | string} options.location_id - Launches from this Location
45
- * @param {number | string} options.pad_id - Launches from this Pad
46
- * @param {number | string} options.provider_id - Launches from this Company
47
- * @param {number | string} options.tag_id - Launches with this Tag
48
- * @param {number | string} options.vehicle_id - Launches on this Vehicle
49
- * @param {ISO3166Alpha2.StateCodeUS} options.state_abbr - ISO 3166 Alpha 2 US State Code
50
- * @param {ISO3166Alpha2.CountryCode} options.country_code - ISO 3166 Alpha 2 Country Code
51
- * @param {number | string} options.search - Launches matching this search string
52
- * @param {number | string} options.slug - Launches matching this unique slug
53
- *
54
- */
55
- constructor(fetcher, interval = DEFAULT_INTERVAL_IN_MINS, options) {
56
- super();
57
- this.launches = new Map();
58
- /**
59
- * Recursive API Caller to iterate through pages
60
- *
61
- * @private
62
- * @function
63
- *
64
- * @param {URLSearchParams} params - Search parameters
65
- * @param {function(results: RLLResponse<RLLEntity.Launch[]>)} callback - To execute on each page
66
- *
67
- * @returns {Promise<void>}
68
- */
69
- this.recursivelyFetch = (params, callback) => {
70
- let page = 1;
71
- const recursiveFetcher = () => {
72
- this.emit("call", params);
73
- return this.fetcher(params).then((results) => {
74
- callback(results);
75
- if (results.last_page > page) {
76
- page++;
77
- params.set("page", page.toString());
78
- return recursiveFetcher();
79
- }
80
- return;
81
- });
82
- };
83
- return recursiveFetcher();
84
- };
85
- // Reassign default Event Emitter methods
86
- this._untypedOn = this.on;
87
- this._untypedEmit = this.emit;
88
- // Methord Overide for type safety
89
- this.on = (event, listener) => this._untypedOn(event, listener);
90
- this.emit = (event, ...args) => this._untypedEmit(event, ...args);
91
- this.last_call = new Date();
92
- this.fetcher = fetcher;
93
- this.interval = intervalValidator(interval);
94
- this.params = queryOptionsValidator(RLLEndPoint.LAUNCHES, options);
95
- // ignore any limit params as these cause unnecessary API calls and do not serve the Watcher role
96
- this.params.delete("limit");
97
- }
98
- /**
99
- * Query wrapper to trigger events
100
- *
101
- * @private
102
- * @function
103
- *
104
- * @returns {void}
105
- */
106
- query() {
107
- const notify = (response) => {
108
- for (const changedLaunch of response.result) {
109
- const { id } = changedLaunch;
110
- const oldLaunch = this.launches.get(id);
111
- if (oldLaunch) {
112
- this.emit("change", oldLaunch, changedLaunch);
113
- }
114
- else {
115
- this.emit("new", changedLaunch);
116
- }
117
- this.launches.set(changedLaunch.id, changedLaunch);
118
- }
119
- };
120
- this.params.set("modified_since", formatToRLLISODate(this.last_call));
121
- this.recursivelyFetch(new URLSearchParams(this.params), notify)
122
- .then(() => {
123
- this.last_call = new Date();
124
- })
125
- .catch((err) => {
126
- this.emit("error", err);
127
- });
128
- }
129
- /**
130
- * Begin monitoring API using the configured query parameters.
131
- *
132
- * @public
133
- * @function
134
- *
135
- * @returns {void}
136
- */
137
- start() {
138
- const buildCache = (response) => {
139
- for (const launch of response.result) {
140
- this.launches.set(launch.id, launch);
141
- }
142
- };
143
- this.recursivelyFetch(new URLSearchParams(this.params), buildCache)
144
- .then(() => {
145
- this.emit("ready", this.launches);
146
- this.last_call = new Date();
147
- this.timer = setInterval(() => {
148
- this.query();
149
- }, this.interval * MS_IN_MIN);
150
- })
151
- .catch((err) => {
152
- this.emit("init_error", err);
153
- });
154
- }
155
- /**
156
- * Stop monitoring API
157
- *
158
- * @public
159
- * @function
160
- *
161
- * @returns {void}
162
- */
163
- stop() {
164
- if (this.timer) {
165
- clearInterval(this.timer);
166
- }
167
- }
168
- }
@@ -1,54 +0,0 @@
1
- import https from "https";
2
- const BASE_URL = "https://fdo.rocketlaunch.live";
3
- export const fetcher = (apiKey, endpoint, params, keyInQueryParams) => {
4
- const url = new URL("json/" + endpoint, BASE_URL);
5
- let headers;
6
- if (keyInQueryParams) {
7
- params.set("key", apiKey);
8
- }
9
- else {
10
- headers = { authorization: `Bearer ${apiKey}` };
11
- }
12
- params.forEach((v, k) => url.searchParams.set(k, v));
13
- return query(url, headers);
14
- };
15
- const query = (url, headers) => {
16
- return new Promise((resolve, reject) => {
17
- const req = https.get(url, { headers }, (res) => {
18
- let data = [];
19
- res.on("data", (chunk) => data.push(chunk));
20
- res.on("end", () => {
21
- var _a;
22
- const response = Buffer.concat(data).toString();
23
- let server_response;
24
- try {
25
- server_response = JSON.parse(response);
26
- }
27
- catch (e) {
28
- server_response = response;
29
- }
30
- if (res.statusCode === 200) {
31
- resolve(server_response);
32
- }
33
- else {
34
- const error = {
35
- error: "API Call Failed",
36
- statusCode: (_a = res.statusCode) !== null && _a !== void 0 ? _a : null,
37
- message: "RLLC recieved a response from the server but it did not complete as expected.",
38
- server_response,
39
- };
40
- reject(error);
41
- }
42
- });
43
- });
44
- req.on("error", () => {
45
- const error = {
46
- error: "Unknown error",
47
- statusCode: null,
48
- message: "RLLC recieved an unknown error. This usually means that the HTTP request did not complete",
49
- server_response: null,
50
- };
51
- reject(error);
52
- });
53
- });
54
- };
package/lib/esm/index.mjs DELETED
@@ -1,22 +0,0 @@
1
- import { RLLClient } from "./Client.js";
2
- export { RLLEndPoint, RLLEntity, } from "./types/application.js";
3
- export { RLLClient } from "./Client.js";
4
- export { RLLWatcher } from "./Watcher.js";
5
- /**
6
- * Generate a RocketLaunch.Live client
7
- *
8
- * @public
9
- * @function
10
- *
11
- * @param {string} apiKey - Your RocketLaunch.Live API Key
12
- * @param {Object} [options] - Optional Client Configuration options
13
- * @param {boolean} options.keyInQueryParams - Set to true to send your API Key via Query parameters instead of Authorization Header (not recommended)
14
- *
15
- * @returns {RLLCLient}
16
- *
17
- * @example
18
- *
19
- * const MY_KEY = process.env.ROCKETLAUNCH_LIVE_API_KEY
20
- * const client = rllc(MY_KEY, { keyInQueryParams: true })
21
- */
22
- export const rllc = (apiKey, options) => new RLLClient(apiKey, options);
@@ -1,3 +0,0 @@
1
- {
2
- "type": "module"
3
- }
@@ -1,81 +0,0 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
- import { EventEmitter } from "events";
4
- import { RLLEntity, RLLQueryConfig, RLLResponse } from "./types/application.js";
5
- /**
6
- * Class representing a RocketLaunch.Live Client Watcher
7
- * @class
8
- */
9
- export declare class RLLWatcher extends EventEmitter {
10
- private _untypedOn;
11
- private _untypedEmit;
12
- private last_call;
13
- launches: Map<number, RLLEntity.Launch>;
14
- private interval;
15
- private params;
16
- private timer;
17
- private fetcher;
18
- /**
19
- * Create a new RocketLaunch.live Client Watcher
20
- *
21
- * @param {function(params: URLSearchParams): Promise<RLLResponse<RLLEntity.Launch[]>>} fetcher - fetcher function to make API calls
22
- * @param {number | string} [interval] - Optional Client Configuration options
23
- * @param {Object} [options] - Launch Search Options
24
- * @param {number | string} options.id - Launch id
25
- * @param {number | string} options.page - Page number of results
26
- * @param {string} options.cospar_id - Launch COSPAR ID (ie. 2022-123)
27
- * @param {Date | string} options.before_date - Only return launches before this date
28
- * @param {Date | string} options.after_date - Only return launches after this date
29
- * @param {Date | string} options.modified_since - Only return launches with API changes after this date
30
- * @param {number | string} options.location_id - Launches from this Location
31
- * @param {number | string} options.pad_id - Launches from this Pad
32
- * @param {number | string} options.provider_id - Launches from this Company
33
- * @param {number | string} options.tag_id - Launches with this Tag
34
- * @param {number | string} options.vehicle_id - Launches on this Vehicle
35
- * @param {ISO3166Alpha2.StateCodeUS} options.state_abbr - ISO 3166 Alpha 2 US State Code
36
- * @param {ISO3166Alpha2.CountryCode} options.country_code - ISO 3166 Alpha 2 Country Code
37
- * @param {number | string} options.search - Launches matching this search string
38
- * @param {number | string} options.slug - Launches matching this unique slug
39
- *
40
- */
41
- constructor(fetcher: (params: URLSearchParams) => Promise<RLLResponse<RLLEntity.Launch[]>>, interval?: number | string, options?: RLLQueryConfig.Launches);
42
- /**
43
- * Recursive API Caller to iterate through pages
44
- *
45
- * @private
46
- * @function
47
- *
48
- * @param {URLSearchParams} params - Search parameters
49
- * @param {function(results: RLLResponse<RLLEntity.Launch[]>)} callback - To execute on each page
50
- *
51
- * @returns {Promise<void>}
52
- */
53
- private recursivelyFetch;
54
- /**
55
- * Query wrapper to trigger events
56
- *
57
- * @private
58
- * @function
59
- *
60
- * @returns {void}
61
- */
62
- private query;
63
- /**
64
- * Begin monitoring API using the configured query parameters.
65
- *
66
- * @public
67
- * @function
68
- *
69
- * @returns {void}
70
- */
71
- start(): void;
72
- /**
73
- * Stop monitoring API
74
- *
75
- * @public
76
- * @function
77
- *
78
- * @returns {void}
79
- */
80
- stop(): void;
81
- }
@@ -1,43 +0,0 @@
1
- export var RLLEndPoint;
2
- (function (RLLEndPoint) {
3
- RLLEndPoint["COMPANIES"] = "companies";
4
- RLLEndPoint["LAUNCHES"] = "launches";
5
- RLLEndPoint["LOCATIONS"] = "locations";
6
- RLLEndPoint["MISSIONS"] = "missions";
7
- RLLEndPoint["PADS"] = "pads";
8
- RLLEndPoint["TAGS"] = "tags";
9
- RLLEndPoint["VEHICLES"] = "vehicles";
10
- })(RLLEndPoint || (RLLEndPoint = {}));
11
- export var RLLEntity;
12
- (function (RLLEntity) {
13
- let LaunchResult;
14
- (function (LaunchResult) {
15
- LaunchResult[LaunchResult["NOT_SET"] = -1] = "NOT_SET";
16
- LaunchResult[LaunchResult["FAILURE"] = 0] = "FAILURE";
17
- LaunchResult[LaunchResult["SUCCESS"] = 1] = "SUCCESS";
18
- LaunchResult[LaunchResult["PARTIAL_FAILURE"] = 2] = "PARTIAL_FAILURE";
19
- LaunchResult[LaunchResult["IN_FLIGHT_ABORT_CREWED"] = 3] = "IN_FLIGHT_ABORT_CREWED";
20
- })(LaunchResult = RLLEntity.LaunchResult || (RLLEntity.LaunchResult = {}));
21
- })(RLLEntity || (RLLEntity = {}));
22
- export const RLLQueryParams = {
23
- id: true,
24
- page: true,
25
- name: true,
26
- country_code: true,
27
- inactive: true,
28
- cospar_id: true,
29
- after_date: true,
30
- before_date: true,
31
- modified_since: true,
32
- location_id: true,
33
- pad_id: true,
34
- provider_id: true,
35
- tag_id: true,
36
- vehicle_id: true,
37
- state_abbr: true,
38
- search: true,
39
- slug: true,
40
- text: true,
41
- limit: true,
42
- direction: true,
43
- };
@@ -1,2 +0,0 @@
1
- /// <reference types="node" />
2
- export declare const fetcher: <T>(apiKey: string, endpoint: string, params: URLSearchParams, keyInQueryParams: boolean) => Promise<T>;
@@ -1,24 +0,0 @@
1
- import { RLLClient } from "./Client.js";
2
- import { RLLClientOptions } from "./types/application.js";
3
- export { RLLEndPoint, RLLResponse, RLLClientOptions, RLLQueryConfig, RLLEntity, RLLError, } from "./types/application.js";
4
- export { ISO3166Alpha2 } from "./types/standards.js";
5
- export { RLLClient } from "./Client.js";
6
- export { RLLWatcher } from "./Watcher.js";
7
- /**
8
- * Generate a RocketLaunch.Live client
9
- *
10
- * @public
11
- * @function
12
- *
13
- * @param {string} apiKey - Your RocketLaunch.Live API Key
14
- * @param {Object} [options] - Optional Client Configuration options
15
- * @param {boolean} options.keyInQueryParams - Set to true to send your API Key via Query parameters instead of Authorization Header (not recommended)
16
- *
17
- * @returns {RLLCLient}
18
- *
19
- * @example
20
- *
21
- * const MY_KEY = process.env.ROCKETLAUNCH_LIVE_API_KEY
22
- * const client = rllc(MY_KEY, { keyInQueryParams: true })
23
- */
24
- export declare const rllc: (apiKey: string, options?: RLLClientOptions) => RLLClient;