rocket-launch-live-client 0.2.1 → 0.3.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 +182 -1
- package/lib/cjs/Client.js +35 -14
- package/lib/cjs/Watcher.js +171 -0
- package/lib/cjs/fetcher.js +18 -10
- package/lib/cjs/index.js +3 -1
- package/lib/cjs/types/Client.d.ts +19 -7
- package/lib/cjs/types/Client.d.ts.map +1 -1
- package/lib/cjs/types/Watcher.d.ts +92 -0
- package/lib/cjs/types/Watcher.d.ts.map +1 -0
- package/lib/cjs/types/fetcher.d.ts.map +1 -1
- package/lib/cjs/types/index.d.ts +2 -1
- package/lib/cjs/types/index.d.ts.map +1 -1
- package/lib/cjs/types/types/application.d.ts +33 -14
- package/lib/cjs/types/types/application.d.ts.map +1 -1
- package/lib/cjs/types/utils.d.ts +2 -1
- package/lib/cjs/types/utils.d.ts.map +1 -1
- package/lib/cjs/utils.js +97 -101
- package/lib/esm/Client.js +35 -14
- package/lib/esm/Watcher.js +169 -0
- package/lib/esm/fetcher.js +17 -10
- package/lib/esm/index.mjs +1 -0
- package/lib/esm/types/Client.d.ts +19 -7
- package/lib/esm/types/Client.d.ts.map +1 -1
- package/lib/esm/types/Watcher.d.ts +92 -0
- package/lib/esm/types/Watcher.d.ts.map +1 -0
- package/lib/esm/types/fetcher.d.ts.map +1 -1
- package/lib/esm/types/index.d.ts +2 -1
- package/lib/esm/types/index.d.ts.map +1 -1
- package/lib/esm/types/types/application.d.ts +33 -14
- package/lib/esm/types/types/application.d.ts.map +1 -1
- package/lib/esm/types/utils.d.ts +2 -1
- package/lib/esm/types/utils.d.ts.map +1 -1
- package/lib/esm/utils.js +95 -100
- package/package.json +1 -4
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import EventEmitter from "events";
|
|
3
|
+
import { RLLEntity, RLLError, RLLQueryConfig, RLLResponse } from "./types/application";
|
|
4
|
+
interface IRLLWatcherEvent {
|
|
5
|
+
new: (launch: RLLEntity.Launch) => void;
|
|
6
|
+
change: (oldLaunch: RLLEntity.Launch, newLaunch: RLLEntity.Launch) => void;
|
|
7
|
+
error: (error: RLLError) => void;
|
|
8
|
+
ready: (launches: Map<number, RLLEntity.Launch>) => void;
|
|
9
|
+
init_error: (error: RLLError) => void;
|
|
10
|
+
call: (params: URLSearchParams) => void;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Class representing a RocketLaunch.Live Client Watcher
|
|
14
|
+
* @class
|
|
15
|
+
*/
|
|
16
|
+
export declare class RLLWatcher extends EventEmitter {
|
|
17
|
+
private _untypedOn;
|
|
18
|
+
private _untypedEmit;
|
|
19
|
+
on: <K extends keyof IRLLWatcherEvent>(event: K, listener: IRLLWatcherEvent[K]) => this;
|
|
20
|
+
emit: <K extends keyof IRLLWatcherEvent>(event: K, ...args: Parameters<IRLLWatcherEvent[K]>) => boolean;
|
|
21
|
+
private last_call;
|
|
22
|
+
launches: Map<number, RLLEntity.Launch>;
|
|
23
|
+
private interval;
|
|
24
|
+
private params;
|
|
25
|
+
private timer;
|
|
26
|
+
private fetcher;
|
|
27
|
+
/**
|
|
28
|
+
* Create a new RocketLaunch.live Client Watcher
|
|
29
|
+
*
|
|
30
|
+
* @param {function(params: URLSearchParams): Promise<RLLResponse<RLLEntity.Launch[]>>} fetcher - fetcher function to make API calls
|
|
31
|
+
* @param {number | string} [interval] - Optional Client Configuration options
|
|
32
|
+
* @param {Object} [options] - Launch Search Options
|
|
33
|
+
* @param {number | string} options.id - Launch id
|
|
34
|
+
* @param {number | string} options.page - Page number of results
|
|
35
|
+
* @param {string} options.cospar_id - Launch COSPAR ID (ie. 2022-123)
|
|
36
|
+
* @param {Date | string} options.before_date - Only return launches before this date
|
|
37
|
+
* @param {Date | string} options.after_date - Only return launches after this date
|
|
38
|
+
* @param {Date | string} options.modified_since - Only return launches with API changes after this date
|
|
39
|
+
* @param {number | string} options.location_id - Launches from this Location
|
|
40
|
+
* @param {number | string} options.pad_id - Launches from this Pad
|
|
41
|
+
* @param {number | string} options.provider_id - Launches from this Company
|
|
42
|
+
* @param {number | string} options.tag_id - Launches with this Tag
|
|
43
|
+
* @param {number | string} options.vehicle_id - Launches on this Vehicle
|
|
44
|
+
* @param {ISO3166Alpha2.StateCodeUS} options.state_abbr - ISO 3166 Alpha 2 US State Code
|
|
45
|
+
* @param {ISO3166Alpha2.CountryCode} options.country_code - ISO 3166 Alpha 2 Country Code
|
|
46
|
+
* @param {number | string} options.search - Launches matching this search string
|
|
47
|
+
* @param {number | string} options.slug - Launches matching this unique slug
|
|
48
|
+
*
|
|
49
|
+
*/
|
|
50
|
+
constructor(fetcher: (params: URLSearchParams) => Promise<RLLResponse<RLLEntity.Launch[]>>, interval?: number | string, options?: RLLQueryConfig.Launches);
|
|
51
|
+
/**
|
|
52
|
+
* Recursive API Caller to iterate through pages
|
|
53
|
+
*
|
|
54
|
+
* @private
|
|
55
|
+
* @function
|
|
56
|
+
*
|
|
57
|
+
* @param {URLSearchParams} params - Search parameters
|
|
58
|
+
* @param {function(results: RLLResponse<RLLEntity.Launch[]>)} callback - To execute on each page
|
|
59
|
+
*
|
|
60
|
+
* @returns {Promise<void>}
|
|
61
|
+
*/
|
|
62
|
+
private recursivelyFetch;
|
|
63
|
+
/**
|
|
64
|
+
* Query wrapper to trigger events
|
|
65
|
+
*
|
|
66
|
+
* @private
|
|
67
|
+
* @function
|
|
68
|
+
*
|
|
69
|
+
* @returns {void}
|
|
70
|
+
*/
|
|
71
|
+
private query;
|
|
72
|
+
/**
|
|
73
|
+
* Begin monitoring API using the configured query parameters.
|
|
74
|
+
*
|
|
75
|
+
* @public
|
|
76
|
+
* @function
|
|
77
|
+
*
|
|
78
|
+
* @returns {void}
|
|
79
|
+
*/
|
|
80
|
+
start(): void;
|
|
81
|
+
/**
|
|
82
|
+
* Stop monitoring API
|
|
83
|
+
*
|
|
84
|
+
* @public
|
|
85
|
+
* @function
|
|
86
|
+
*
|
|
87
|
+
* @returns {void}
|
|
88
|
+
*/
|
|
89
|
+
stop(): void;
|
|
90
|
+
}
|
|
91
|
+
export {};
|
|
92
|
+
//# sourceMappingURL=Watcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Watcher.d.ts","sourceRoot":"","sources":["../../../src/Watcher.ts"],"names":[],"mappings":";AAAA,OAAO,YAAY,MAAM,QAAQ,CAAC;AAClC,OAAO,EAEL,SAAS,EACT,QAAQ,EACR,cAAc,EACd,WAAW,EACZ,MAAM,qBAAqB,CAAC;AA4C7B,UAAU,gBAAgB;IACxB,GAAG,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,KAAK,IAAI,CAAC;IACxC,MAAM,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,CAAC,MAAM,KAAK,IAAI,CAAC;IAC3E,KAAK,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAC;IACjC,KAAK,EAAE,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC;IACzD,UAAU,EAAE,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAC;IACtC,IAAI,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,CAAC;CACzC;AAED;;;GAGG;AACH,qBAAa,UAAW,SAAQ,YAAY;IAC1C,OAAO,CAAC,UAAU,CAAW;IAC7B,OAAO,CAAC,YAAY,CAAa;IAC1B,EAAE,iFAGN,IAAI,CAAqC;IACrC,IAAI,4FAGR,OAAO,CAAsC;IAChD,OAAO,CAAC,SAAS,CAAO;IACjB,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,CAAa;IAC3D,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,KAAK,CAA2B;IACxC,OAAO,CAAC,OAAO,CAE+B;IAE9C;;;;;;;;;;;;;;;;;;;;;;OAsBG;gBAED,OAAO,EAAE,CACP,MAAM,EAAE,eAAe,KACpB,OAAO,CAAC,WAAW,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC,EAC7C,QAAQ,GAAE,MAAM,GAAG,MAAiC,EACpD,OAAO,CAAC,EAAE,cAAc,CAAC,QAAQ;IAUnC;;;;;;;;;;OAUG;IACH,OAAO,CAAC,gBAAgB,CAsBtB;IAEF;;;;;;;OAOG;IACH,OAAO,CAAC,KAAK;IAyBb;;;;;;;OAOG;IACI,KAAK,IAAI,IAAI;IAoBpB;;;;;;;OAOG;IACI,IAAI,IAAI,IAAI;CAKpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetcher.d.ts","sourceRoot":"","sources":["../../../src/fetcher.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fetcher.d.ts","sourceRoot":"","sources":["../../../src/fetcher.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,OAAO,cACV,MAAM,YACJ,MAAM,UACR,eAAe,oBACL,OAAO,eAc1B,CAAC"}
|
package/lib/cjs/types/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { RLLClient } from "./Client";
|
|
2
2
|
import { RLLClientOptions } from "./types/application";
|
|
3
|
-
export { RLLEndPoint, RLLResponse, RLLClientOptions, RLLQueryConfig, RLLEntity, } from "./types/application";
|
|
3
|
+
export { RLLEndPoint, RLLResponse, RLLClientOptions, RLLQueryConfig, RLLEntity, RLLError, } from "./types/application";
|
|
4
4
|
export { ISO3166Alpha2 } from "./types/standards";
|
|
5
5
|
export { RLLClient } from "./Client";
|
|
6
|
+
export { RLLWatcher } from "./Watcher";
|
|
6
7
|
/**
|
|
7
8
|
* Generate a RocketLaunch.Live client
|
|
8
9
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,EACL,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,SAAS,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,EACL,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,SAAS,EACT,QAAQ,GACT,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,IAAI,WAAY,MAAM,YAAY,gBAAgB,KAAG,SAClC,CAAC"}
|
|
@@ -14,13 +14,14 @@ export declare namespace RLLEntity {
|
|
|
14
14
|
}
|
|
15
15
|
export interface Country {
|
|
16
16
|
name: string;
|
|
17
|
-
code: ISO3166Alpha2.CountryCode;
|
|
17
|
+
code: ISO3166Alpha2.CountryCode | "";
|
|
18
18
|
}
|
|
19
19
|
export interface State {
|
|
20
20
|
name: string;
|
|
21
|
-
abbr
|
|
21
|
+
abbr?: ISO3166Alpha2.StateCodeUS;
|
|
22
22
|
}
|
|
23
23
|
export interface Company extends RLLRecord {
|
|
24
|
+
name: string;
|
|
24
25
|
country: Country;
|
|
25
26
|
inactive: boolean | null;
|
|
26
27
|
}
|
|
@@ -40,12 +41,23 @@ export declare namespace RLLEntity {
|
|
|
40
41
|
}
|
|
41
42
|
export interface Launch extends RLLRecord {
|
|
42
43
|
name: string;
|
|
43
|
-
cospar_id: string;
|
|
44
|
+
cospar_id: string | null;
|
|
44
45
|
sort_date: string;
|
|
45
|
-
provider:
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
provider: {
|
|
47
|
+
slug: string;
|
|
48
|
+
} & Omit<Company, "inactive" | "country">;
|
|
49
|
+
vehicle: {
|
|
50
|
+
company_id: number;
|
|
51
|
+
slug: string;
|
|
52
|
+
} & Omit<Vehicle, "company">;
|
|
53
|
+
pad: Omit<Pad, "full_name" | "location"> & {
|
|
54
|
+
location: Omit<Location, "pads" | "utc_offset" | "latitute" | "latitude" | "longitude" | "country" | "state"> & {
|
|
55
|
+
slug: string;
|
|
56
|
+
country: string;
|
|
57
|
+
state: ISO3166Alpha2.StateCodeUS | null;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
missions: Omit<Mission, "launch_id" | "company">[];
|
|
49
61
|
mission_description: string | null;
|
|
50
62
|
launch_description: string;
|
|
51
63
|
win_open: string | null;
|
|
@@ -61,6 +73,8 @@ export declare namespace RLLEntity {
|
|
|
61
73
|
tags: Omit<Tag, "slug">[];
|
|
62
74
|
slug: string;
|
|
63
75
|
weather_summary: string | null;
|
|
76
|
+
weather_condition: string | null;
|
|
77
|
+
weather_wind_mph: number | null;
|
|
64
78
|
weather_temp: number | null;
|
|
65
79
|
weather_icon: string | null;
|
|
66
80
|
weather_updated: string | null;
|
|
@@ -77,20 +91,20 @@ export declare namespace RLLEntity {
|
|
|
77
91
|
longitude: string;
|
|
78
92
|
state: State | null;
|
|
79
93
|
statename?: string | null;
|
|
80
|
-
country: Country;
|
|
81
|
-
pads: Omit<Pad, "location" | "country" | "state">[];
|
|
82
|
-
utc_offset: number;
|
|
94
|
+
country: Country | null;
|
|
95
|
+
pads: Omit<Pad, "full_name" | "location" | "country" | "state">[];
|
|
96
|
+
utc_offset: number | null;
|
|
83
97
|
}
|
|
84
98
|
export interface Mission extends RLLRecord {
|
|
85
99
|
name: string;
|
|
86
100
|
description: string | null;
|
|
87
101
|
launch_id: number;
|
|
88
|
-
company: Omit<Company, "
|
|
102
|
+
company: Omit<Company, "inactive" | "country">;
|
|
89
103
|
}
|
|
90
104
|
export interface Pad extends RLLRecord {
|
|
91
105
|
name: string;
|
|
92
106
|
full_name: string;
|
|
93
|
-
location: Omit<Location, "pads" | "utc_offset" | "latitute">;
|
|
107
|
+
location: Omit<Location, "pads" | "utc_offset" | "latitute" | "statename">;
|
|
94
108
|
}
|
|
95
109
|
export interface Tag extends RLLRecord {
|
|
96
110
|
text: string;
|
|
@@ -98,8 +112,7 @@ export declare namespace RLLEntity {
|
|
|
98
112
|
}
|
|
99
113
|
export interface Vehicle extends RLLRecord {
|
|
100
114
|
name: string;
|
|
101
|
-
|
|
102
|
-
company: Omit<Company, "slug" | "inactive" | "country">;
|
|
115
|
+
company: Omit<Company, "inactive" | "country">;
|
|
103
116
|
}
|
|
104
117
|
export {};
|
|
105
118
|
}
|
|
@@ -181,4 +194,10 @@ export type RLLResponse<T> = {
|
|
|
181
194
|
last_page: number;
|
|
182
195
|
result: T;
|
|
183
196
|
};
|
|
197
|
+
export type RLLError = {
|
|
198
|
+
error: string;
|
|
199
|
+
statusCode: number | null;
|
|
200
|
+
message: string;
|
|
201
|
+
server_response: string | null;
|
|
202
|
+
};
|
|
184
203
|
//# sourceMappingURL=application.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../../../../src/types/application.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,oBAAY,WAAW;IACrB,SAAS,cAAc;IACvB,QAAQ,aAAa;IACrB,SAAS,cAAc;IACvB,QAAQ,aAAa;IACrB,IAAI,SAAS;IACb,IAAI,SAAS;IACb,QAAQ,aAAa;CACtB;AAED,yBAAiB,SAAS,CAAC;IACzB,UAAU,SAAS;QACjB,EAAE,EAAE,MAAM,CAAC;KACZ;IAED,MAAM,WAAW,OAAO;QACtB,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,aAAa,CAAC,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../../../../src/types/application.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,oBAAY,WAAW;IACrB,SAAS,cAAc;IACvB,QAAQ,aAAa;IACrB,SAAS,cAAc;IACvB,QAAQ,aAAa;IACrB,IAAI,SAAS;IACb,IAAI,SAAS;IACb,QAAQ,aAAa;CACtB;AAED,yBAAiB,SAAS,CAAC;IACzB,UAAU,SAAS;QACjB,EAAE,EAAE,MAAM,CAAC;KACZ;IAED,MAAM,WAAW,OAAO;QACtB,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,aAAa,CAAC,WAAW,GAAG,EAAE,CAAC;KACtC;IAED,MAAM,WAAW,KAAK;QACpB,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,CAAC,EAAE,aAAa,CAAC,WAAW,CAAC;KAClC;IAED,MAAM,WAAW,OAAQ,SAAQ,SAAS;QACxC,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,OAAO,CAAC;QACjB,QAAQ,EAAE,OAAO,GAAG,IAAI,CAAC;KAC1B;IAED,MAAM,MAAM,YAAY;QACtB,OAAO,KAAK;QACZ,OAAO,IAAI;QACX,OAAO,IAAI;QACX,eAAe,IAAI;QACnB,sBAAsB,IAAI;KAC3B;IAED,MAAM,WAAW,KAAM,SAAQ,SAAS;QACtC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;QACzB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;QAC7B,QAAQ,EAAE,OAAO,CAAC;QAClB,UAAU,EAAE,OAAO,CAAC;QACpB,QAAQ,EAAE,OAAO,CAAC;KACnB;IAED,MAAM,WAAW,MAAO,SAAQ,SAAS;QACvC,IAAI,EAAE,MAAM,CA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IACd,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC,CAAC"}
|
package/lib/cjs/types/utils.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { RLLEndPoint, RLLQueryConfig } from "./types/application";
|
|
2
|
+
export declare const formatToRLLISODate: (date: Date) => string;
|
|
2
3
|
export declare const apiKeyValidator: (apiKey: any) => string;
|
|
3
4
|
export declare const optionsValidator: (options: {
|
|
4
5
|
[key: string]: any;
|
|
5
6
|
[key: number]: any;
|
|
6
7
|
[key: symbol]: any;
|
|
7
8
|
}) => void;
|
|
8
|
-
export declare const queryOptionsValidator: (resource: RLLEndPoint, options?: RLLQueryConfig.Companies | RLLQueryConfig.Launches | RLLQueryConfig.Locations | RLLQueryConfig.Missions | RLLQueryConfig.Pads | RLLQueryConfig.Tags | RLLQueryConfig.Vehicles) =>
|
|
9
|
+
export declare const queryOptionsValidator: (resource: RLLEndPoint, options?: RLLQueryConfig.Companies | RLLQueryConfig.Launches | RLLQueryConfig.Locations | RLLQueryConfig.Missions | RLLQueryConfig.Pads | RLLQueryConfig.Tags | RLLQueryConfig.Vehicles) => URLSearchParams;
|
|
9
10
|
export declare const warn: (msg: string) => void;
|
|
10
11
|
export declare const error: (msg: string, type?: "type" | "range" | "error") => void;
|
|
11
12
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAQlE,eAAO,MAAM,eAAe,WAAY,GAAG,KAAG,MA2B7C,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;;MAEzB,IAeH,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAQlE,eAAO,MAAM,kBAAkB,SAAU,IAAI,KAAG,MAE/C,CAAC;AAEF,eAAO,MAAM,eAAe,WAAY,GAAG,KAAG,MA2B7C,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;;MAEzB,IAeH,CAAC;AA6JF,eAAO,MAAM,qBAAqB,aACtB,WAAW,YAEjB,eAAe,SAAS,GACxB,eAAe,QAAQ,GACvB,eAAe,SAAS,GACxB,eAAe,QAAQ,GACvB,eAAe,IAAI,GACnB,eAAe,IAAI,GACnB,eAAe,QAAQ,KAC1B,eAwDF,CAAC;AAEF,eAAO,MAAM,IAAI,QAAS,MAAM,SAAyC,CAAC;AAE1E,eAAO,MAAM,KAAK,QACX,MAAM,SACL,MAAM,GAAG,OAAO,GAAG,OAAO,KAC/B,IAYF,CAAC"}
|
package/lib/cjs/utils.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.error = exports.warn = exports.queryOptionsValidator = exports.optionsValidator = exports.apiKeyValidator = void 0;
|
|
3
|
+
exports.error = exports.warn = exports.queryOptionsValidator = exports.optionsValidator = exports.apiKeyValidator = exports.formatToRLLISODate = void 0;
|
|
4
4
|
const standards_1 = require("./types/standards");
|
|
5
5
|
const getLeadingZero = (month, offset = 0) => {
|
|
6
6
|
const str = "0".concat((month + offset).toString());
|
|
7
7
|
return str.slice(-2);
|
|
8
8
|
};
|
|
9
|
+
const formatToRLLISODate = (date) => {
|
|
10
|
+
return date.toISOString().slice(0, 19).concat("Z");
|
|
11
|
+
};
|
|
12
|
+
exports.formatToRLLISODate = formatToRLLISODate;
|
|
9
13
|
const apiKeyValidator = (apiKey) => {
|
|
10
14
|
if (apiKey === undefined) {
|
|
11
15
|
(0, exports.error)("RLL Client requires API Key", "type");
|
|
@@ -39,112 +43,94 @@ const optionsValidator = (options) => {
|
|
|
39
43
|
exports.optionsValidator = optionsValidator;
|
|
40
44
|
const validators = {
|
|
41
45
|
string: (option) => {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
resolve(option);
|
|
53
|
-
});
|
|
46
|
+
if (typeof option === "number") {
|
|
47
|
+
return option.toString();
|
|
48
|
+
}
|
|
49
|
+
if (typeof option !== "string") {
|
|
50
|
+
throw "Must be a string";
|
|
51
|
+
}
|
|
52
|
+
if (option.length <= 0) {
|
|
53
|
+
throw "String must have length greater than 0";
|
|
54
|
+
}
|
|
55
|
+
return option;
|
|
54
56
|
},
|
|
55
57
|
boolean: (option) => {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
resolve(option === true ? 1 : 0);
|
|
61
|
-
});
|
|
58
|
+
if (typeof option !== "boolean") {
|
|
59
|
+
throw "Must be a boolean";
|
|
60
|
+
}
|
|
61
|
+
return option === true ? 1 : 0;
|
|
62
62
|
},
|
|
63
63
|
number: (option) => {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
else {
|
|
74
|
-
resolve(Number(option));
|
|
75
|
-
}
|
|
76
|
-
});
|
|
64
|
+
if (typeof option === "number") {
|
|
65
|
+
return option;
|
|
66
|
+
}
|
|
67
|
+
if (typeof option !== "string" || option === "" || isNaN(Number(option))) {
|
|
68
|
+
throw "Must be a number";
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
return Number(option);
|
|
72
|
+
}
|
|
77
73
|
},
|
|
78
74
|
countryCode: (option) => {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
resolve(option);
|
|
87
|
-
});
|
|
75
|
+
if (typeof option !== "string") {
|
|
76
|
+
throw "Must be a string";
|
|
77
|
+
}
|
|
78
|
+
if (!(0, standards_1.isValidCountryCode)(option)) {
|
|
79
|
+
throw "Invalid country code. Country codes should follow ISO 3166-1 A2 convention, like 'US'.";
|
|
80
|
+
}
|
|
81
|
+
return option;
|
|
88
82
|
},
|
|
89
83
|
stateCode: (option) => {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
resolve(option);
|
|
98
|
-
});
|
|
84
|
+
if (typeof option !== "string") {
|
|
85
|
+
throw "Must be a string";
|
|
86
|
+
}
|
|
87
|
+
if (!(0, standards_1.isValidStateCode)(option)) {
|
|
88
|
+
throw "Invalid United States State Code. State Codes should follow ISO 3166-2 convention, like 'FL'.";
|
|
89
|
+
}
|
|
90
|
+
return option;
|
|
99
91
|
},
|
|
100
92
|
cosparId: (option) => {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
resolve(option);
|
|
109
|
-
});
|
|
93
|
+
if (typeof option !== "string") {
|
|
94
|
+
throw "Must be a string";
|
|
95
|
+
}
|
|
96
|
+
if (!option.match(/^\d{4}\-\d{3}$/g)) {
|
|
97
|
+
throw "Cospar IDs must be in the format of YYYY-NNN (eg. 2023-123)";
|
|
98
|
+
}
|
|
99
|
+
return option;
|
|
110
100
|
},
|
|
111
101
|
shortDate: (option) => {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
date = new Date(parsed);
|
|
121
|
-
}
|
|
122
|
-
else {
|
|
123
|
-
date = option;
|
|
124
|
-
}
|
|
125
|
-
resolve(`${date.getUTCFullYear()}-${getLeadingZero(date.getUTCMonth(), 1)}-${getLeadingZero(date.getUTCDate())}`);
|
|
102
|
+
if (typeof option !== "string" && !(option instanceof Date)) {
|
|
103
|
+
throw "Must be a JavaScript Date Object or ISO 8601 Date String";
|
|
104
|
+
}
|
|
105
|
+
let date;
|
|
106
|
+
if (typeof option === "string") {
|
|
107
|
+
const parsed = Date.parse(option);
|
|
108
|
+
if (isNaN(parsed)) {
|
|
109
|
+
throw "Must be an ISO 8601 Date String";
|
|
126
110
|
}
|
|
127
|
-
|
|
128
|
-
}
|
|
111
|
+
date = new Date(parsed);
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
date = option;
|
|
115
|
+
}
|
|
116
|
+
return `${date.getUTCFullYear()}-${getLeadingZero(date.getUTCMonth(), 1)}-${getLeadingZero(date.getUTCDate())}`;
|
|
129
117
|
},
|
|
130
118
|
isoDate: (option) => {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
date = new Date(parsed);
|
|
140
|
-
}
|
|
141
|
-
else {
|
|
142
|
-
date = option;
|
|
143
|
-
}
|
|
144
|
-
resolve(date.toISOString().slice(0, 19).concat("Z"));
|
|
119
|
+
if (typeof option !== "string" && !(option instanceof Date)) {
|
|
120
|
+
throw "Must be a JavaScript Date Object or ISO 8601 Date String";
|
|
121
|
+
}
|
|
122
|
+
let date;
|
|
123
|
+
if (typeof option === "string") {
|
|
124
|
+
const parsed = Date.parse(option);
|
|
125
|
+
if (isNaN(parsed)) {
|
|
126
|
+
throw "Must be an ISO 8601 Date String";
|
|
145
127
|
}
|
|
146
|
-
|
|
147
|
-
}
|
|
128
|
+
date = new Date(parsed);
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
date = option;
|
|
132
|
+
}
|
|
133
|
+
return (0, exports.formatToRLLISODate)(date);
|
|
148
134
|
},
|
|
149
135
|
};
|
|
150
136
|
const optionsMap = {
|
|
@@ -204,9 +190,18 @@ const optionsMap = {
|
|
|
204
190
|
};
|
|
205
191
|
const queryOptionsValidator = (resource, options) => {
|
|
206
192
|
const params = new URLSearchParams();
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
193
|
+
if (options === undefined) {
|
|
194
|
+
return params;
|
|
195
|
+
}
|
|
196
|
+
if (typeof options === "string" ||
|
|
197
|
+
typeof options === "number" ||
|
|
198
|
+
typeof options === "boolean" ||
|
|
199
|
+
typeof options === "bigint" ||
|
|
200
|
+
typeof options === "symbol" ||
|
|
201
|
+
typeof options === "function" ||
|
|
202
|
+
options === null ||
|
|
203
|
+
Array.isArray(options)) {
|
|
204
|
+
(0, exports.error)("Invalid type for query options. Must be an object.");
|
|
210
205
|
}
|
|
211
206
|
if ((options.id || "slug" in options || "cospar_id" in options) &&
|
|
212
207
|
Object.keys(options).length > 1) {
|
|
@@ -221,14 +216,15 @@ const queryOptionsValidator = (resource, options) => {
|
|
|
221
216
|
(0, exports.warn)(`Parameter "${option}" is undefined and will be ignored.`);
|
|
222
217
|
continue;
|
|
223
218
|
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
.
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
219
|
+
try {
|
|
220
|
+
const o = optionsMap[resource][option](options[option]);
|
|
221
|
+
params.set(option, o);
|
|
222
|
+
}
|
|
223
|
+
catch (err) {
|
|
224
|
+
(0, exports.error)(`Malformed query parameter for resource "${resource}" and parameter: "${option}": ${err}.`, "type");
|
|
225
|
+
}
|
|
230
226
|
}
|
|
231
|
-
return
|
|
227
|
+
return params;
|
|
232
228
|
};
|
|
233
229
|
exports.queryOptionsValidator = queryOptionsValidator;
|
|
234
230
|
const warn = (msg) => console.warn(`[RLL Client]: ${msg}`);
|
package/lib/esm/Client.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { RLLEndPoint, } from "./types/application";
|
|
2
2
|
import { fetcher } from "./fetcher";
|
|
3
3
|
import { apiKeyValidator, optionsValidator, queryOptionsValidator, } from "./utils";
|
|
4
|
+
import { RLLWatcher } from "./Watcher";
|
|
4
5
|
/**
|
|
5
6
|
* Class representing a RocketLaunch.Live client
|
|
6
7
|
* @class
|
|
@@ -46,6 +47,19 @@ export class RLLClient {
|
|
|
46
47
|
query(endpoint, params) {
|
|
47
48
|
return fetcher(this.apiKey, endpoint, params, this.config.keyInQueryParams);
|
|
48
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* Instantiate a new RLL Watcher which will continually query the API for changes to the launches endpoint
|
|
52
|
+
*
|
|
53
|
+
* @public
|
|
54
|
+
*
|
|
55
|
+
* @param {number} interval - Interval in minutes to query the API for changes. Defaults to 5 minutes, cannot be less than 1 minute
|
|
56
|
+
* @param {RLLQueryConfig.Launches} options - Query options, same as calling the launches method
|
|
57
|
+
*
|
|
58
|
+
* @returns {RLLWatcher}
|
|
59
|
+
*/
|
|
60
|
+
watch(interval, options) {
|
|
61
|
+
return new RLLWatcher((params) => this.query(RLLEndPoint.LAUNCHES, params), interval, options);
|
|
62
|
+
}
|
|
49
63
|
/**
|
|
50
64
|
* Fetch launch companies
|
|
51
65
|
*
|
|
@@ -63,10 +77,11 @@ export class RLLClient {
|
|
|
63
77
|
*
|
|
64
78
|
* @example
|
|
65
79
|
*
|
|
66
|
-
* const response = client.companies({ country_code: "US" })
|
|
80
|
+
* const response = await client.companies({ country_code: "US" })
|
|
67
81
|
*/
|
|
68
82
|
companies(options) {
|
|
69
|
-
|
|
83
|
+
const params = queryOptionsValidator(RLLEndPoint.COMPANIES, options);
|
|
84
|
+
return this.query(RLLEndPoint.COMPANIES, params);
|
|
70
85
|
}
|
|
71
86
|
/**
|
|
72
87
|
* Fetch launches
|
|
@@ -95,10 +110,11 @@ export class RLLClient {
|
|
|
95
110
|
*
|
|
96
111
|
* @example
|
|
97
112
|
*
|
|
98
|
-
* const response = client.launches({ after_date: new Date("2022-10-10") })
|
|
113
|
+
* const response = await client.launches({ after_date: new Date("2022-10-10") })
|
|
99
114
|
*/
|
|
100
115
|
launches(options) {
|
|
101
|
-
|
|
116
|
+
const params = queryOptionsValidator(RLLEndPoint.LAUNCHES, options);
|
|
117
|
+
return this.query(RLLEndPoint.LAUNCHES, params);
|
|
102
118
|
}
|
|
103
119
|
/**
|
|
104
120
|
* Fetch launch locations
|
|
@@ -117,10 +133,11 @@ export class RLLClient {
|
|
|
117
133
|
*
|
|
118
134
|
* @example
|
|
119
135
|
*
|
|
120
|
-
* const response = client.locations({ country_code: "US" })
|
|
136
|
+
* const response = await client.locations({ country_code: "US" })
|
|
121
137
|
*/
|
|
122
138
|
locations(options) {
|
|
123
|
-
|
|
139
|
+
const params = queryOptionsValidator(RLLEndPoint.LOCATIONS, options);
|
|
140
|
+
return this.query(RLLEndPoint.LOCATIONS, params);
|
|
124
141
|
}
|
|
125
142
|
/**
|
|
126
143
|
* Fetch launch Missions
|
|
@@ -137,10 +154,11 @@ export class RLLClient {
|
|
|
137
154
|
*
|
|
138
155
|
* @example
|
|
139
156
|
*
|
|
140
|
-
* const response = client.missions({ name: "Mars 2020" })
|
|
157
|
+
* const response = await client.missions({ name: "Mars 2020" })
|
|
141
158
|
*/
|
|
142
159
|
missions(options) {
|
|
143
|
-
|
|
160
|
+
const params = queryOptionsValidator(RLLEndPoint.MISSIONS, options);
|
|
161
|
+
return this.query(RLLEndPoint.MISSIONS, params);
|
|
144
162
|
}
|
|
145
163
|
/**
|
|
146
164
|
* Fetch launch pads
|
|
@@ -159,10 +177,11 @@ export class RLLClient {
|
|
|
159
177
|
*
|
|
160
178
|
* @example
|
|
161
179
|
*
|
|
162
|
-
* const response = client.pads({ country_code: "US" })
|
|
180
|
+
* const response = await client.pads({ country_code: "US" })
|
|
163
181
|
*/
|
|
164
182
|
pads(options) {
|
|
165
|
-
|
|
183
|
+
const params = queryOptionsValidator(RLLEndPoint.PADS, options);
|
|
184
|
+
return this.query(RLLEndPoint.PADS, params);
|
|
166
185
|
}
|
|
167
186
|
/**
|
|
168
187
|
* Fetch launch tags
|
|
@@ -179,10 +198,11 @@ export class RLLClient {
|
|
|
179
198
|
*
|
|
180
199
|
* @example
|
|
181
200
|
*
|
|
182
|
-
* const response = client.tags({ text: "Crewed" })
|
|
201
|
+
* const response = await client.tags({ text: "Crewed" })
|
|
183
202
|
*/
|
|
184
203
|
tags(options) {
|
|
185
|
-
|
|
204
|
+
const params = queryOptionsValidator(RLLEndPoint.TAGS, options);
|
|
205
|
+
return this.query(RLLEndPoint.TAGS, params);
|
|
186
206
|
}
|
|
187
207
|
/**
|
|
188
208
|
* Fetch launch Vehicles
|
|
@@ -199,9 +219,10 @@ export class RLLClient {
|
|
|
199
219
|
*
|
|
200
220
|
* @example
|
|
201
221
|
*
|
|
202
|
-
* const response = client.vehicles({ name: "Falcon 9" })
|
|
222
|
+
* const response = await client.vehicles({ name: "Falcon 9" })
|
|
203
223
|
*/
|
|
204
224
|
vehicles(options) {
|
|
205
|
-
|
|
225
|
+
const params = queryOptionsValidator(RLLEndPoint.VEHICLES, options);
|
|
226
|
+
return this.query(RLLEndPoint.VEHICLES, params);
|
|
206
227
|
}
|
|
207
228
|
}
|