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.
- package/README.md +105 -61
- package/lib/{esm/types/Client.d.ts → Client.d.ts} +6 -8
- package/lib/Client.js +61 -0
- package/lib/fetcher.d.ts +5 -0
- package/lib/fetcher.js +146 -0
- package/lib/{cjs/types/index.d.ts → index.d.ts} +0 -1
- package/lib/index.js +4 -0
- package/lib/{cjs/types/types → types}/application.d.ts +41 -27
- package/lib/types/application.js +41 -0
- package/lib/types/standards.d.ts +8 -0
- package/lib/types/standards.js +314 -0
- package/lib/{cjs/types/utils.d.ts → utils.d.ts} +1 -4
- package/lib/{esm/utils.js → utils.js} +18 -4
- package/lib/{cjs/types → watcher}/Watcher.d.ts +16 -12
- package/lib/watcher/Watcher.js +145 -0
- package/lib/watcher/index.d.ts +25 -0
- package/lib/watcher/index.js +3 -0
- package/package.json +30 -26
- package/lib/cjs/Client.js +0 -233
- package/lib/cjs/Watcher.js +0 -172
- package/lib/cjs/fetcher.js +0 -61
- package/lib/cjs/index.js +0 -30
- package/lib/cjs/package.json +0 -3
- package/lib/cjs/types/Client.d.ts +0 -189
- package/lib/cjs/types/application.js +0 -46
- package/lib/cjs/types/fetcher.d.ts +0 -2
- package/lib/cjs/types/standards.js +0 -321
- package/lib/cjs/types/types/standards.d.ts +0 -316
- package/lib/cjs/utils.js +0 -266
- package/lib/esm/Client.js +0 -229
- package/lib/esm/Watcher.js +0 -168
- package/lib/esm/fetcher.js +0 -54
- package/lib/esm/index.mjs +0 -22
- package/lib/esm/package.json +0 -3
- package/lib/esm/types/Watcher.d.ts +0 -81
- package/lib/esm/types/application.js +0 -43
- package/lib/esm/types/fetcher.d.ts +0 -2
- package/lib/esm/types/index.d.ts +0 -24
- package/lib/esm/types/standards.js +0 -316
- package/lib/esm/types/types/application.d.ts +0 -206
- package/lib/esm/types/types/standards.d.ts +0 -316
- package/lib/esm/types/utils.d.ts +0 -12
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { ISO3166Alpha2 } from "./standards.js";
|
|
2
|
-
export declare
|
|
3
|
-
COMPANIES
|
|
4
|
-
LAUNCHES
|
|
5
|
-
LOCATIONS
|
|
6
|
-
MISSIONS
|
|
7
|
-
PADS
|
|
8
|
-
TAGS
|
|
9
|
-
VEHICLES
|
|
10
|
-
}
|
|
2
|
+
export declare const RLLEndPoint: {
|
|
3
|
+
readonly COMPANIES: "companies";
|
|
4
|
+
readonly LAUNCHES: "launches";
|
|
5
|
+
readonly LOCATIONS: "locations";
|
|
6
|
+
readonly MISSIONS: "missions";
|
|
7
|
+
readonly PADS: "pads";
|
|
8
|
+
readonly TAGS: "tags";
|
|
9
|
+
readonly VEHICLES: "vehicles";
|
|
10
|
+
};
|
|
11
|
+
export type RLLEndPoint = (typeof RLLEndPoint)[keyof typeof RLLEndPoint];
|
|
11
12
|
export declare namespace RLLEntity {
|
|
12
13
|
interface RLLRecord {
|
|
13
14
|
id: number;
|
|
@@ -22,22 +23,28 @@ export declare namespace RLLEntity {
|
|
|
22
23
|
}
|
|
23
24
|
export interface Company extends RLLRecord {
|
|
24
25
|
name: string;
|
|
26
|
+
slug: string;
|
|
25
27
|
country: Country;
|
|
26
28
|
inactive: boolean;
|
|
27
29
|
}
|
|
28
|
-
export
|
|
29
|
-
NOT_SET
|
|
30
|
-
FAILURE
|
|
31
|
-
SUCCESS
|
|
32
|
-
PARTIAL_FAILURE
|
|
33
|
-
IN_FLIGHT_ABORT_CREWED
|
|
34
|
-
}
|
|
30
|
+
export const LaunchResult: {
|
|
31
|
+
readonly NOT_SET: -1;
|
|
32
|
+
readonly FAILURE: 0;
|
|
33
|
+
readonly SUCCESS: 1;
|
|
34
|
+
readonly PARTIAL_FAILURE: 2;
|
|
35
|
+
readonly IN_FLIGHT_ABORT_CREWED: 3;
|
|
36
|
+
};
|
|
37
|
+
export type LaunchResult = (typeof LaunchResult)[keyof typeof LaunchResult];
|
|
35
38
|
export interface Media extends RLLRecord {
|
|
36
39
|
media_url: string | null;
|
|
37
40
|
youtube_vidid: string | null;
|
|
41
|
+
x_postid: string | null;
|
|
42
|
+
x_accountid: string | null;
|
|
43
|
+
bilibili_roomid: string | null;
|
|
38
44
|
featured: boolean;
|
|
39
45
|
ldfeatured: boolean;
|
|
40
46
|
approved: boolean;
|
|
47
|
+
live_status: boolean | null;
|
|
41
48
|
}
|
|
42
49
|
export interface Launch extends RLLRecord {
|
|
43
50
|
name: string;
|
|
@@ -45,7 +52,7 @@ export declare namespace RLLEntity {
|
|
|
45
52
|
sort_date: string;
|
|
46
53
|
provider: {
|
|
47
54
|
slug: string;
|
|
48
|
-
} & Omit<Company, "inactive" | "country">;
|
|
55
|
+
} & Omit<Company, "slug" | "inactive" | "country">;
|
|
49
56
|
vehicle: {
|
|
50
57
|
company_id: number;
|
|
51
58
|
slug: string;
|
|
@@ -74,32 +81,32 @@ export declare namespace RLLEntity {
|
|
|
74
81
|
slug: string;
|
|
75
82
|
weather_summary: string | null;
|
|
76
83
|
weather_condition: string | null;
|
|
77
|
-
weather_wind_mph:
|
|
78
|
-
weather_temp:
|
|
84
|
+
weather_wind_mph: string | null;
|
|
85
|
+
weather_temp: string | null;
|
|
79
86
|
weather_icon: string | null;
|
|
80
87
|
weather_updated: string | null;
|
|
81
88
|
quicktext: string;
|
|
82
|
-
media
|
|
89
|
+
media: Media[];
|
|
83
90
|
result: LaunchResult | null;
|
|
84
91
|
suborbital: boolean;
|
|
85
92
|
modified: string;
|
|
86
93
|
}
|
|
87
94
|
export interface Location extends RLLRecord {
|
|
88
95
|
name: string;
|
|
89
|
-
latitute: string;
|
|
90
|
-
latitude: string;
|
|
91
|
-
longitude: string;
|
|
96
|
+
latitute: string | null;
|
|
97
|
+
latitude: string | null;
|
|
98
|
+
longitude: string | null;
|
|
92
99
|
state: State | null;
|
|
93
100
|
statename?: string | null;
|
|
94
101
|
country: Country | null;
|
|
95
102
|
pads: Omit<Pad, "full_name" | "location" | "country" | "state">[];
|
|
96
|
-
utc_offset:
|
|
103
|
+
utc_offset: string | null;
|
|
97
104
|
}
|
|
98
105
|
export interface Mission extends RLLRecord {
|
|
99
106
|
name: string;
|
|
100
107
|
description: string | null;
|
|
101
|
-
launch_id: number;
|
|
102
|
-
company: Omit<Company, "inactive" | "country">;
|
|
108
|
+
launch_id: number | null;
|
|
109
|
+
company: Omit<Company, "slug" | "inactive" | "country">;
|
|
103
110
|
}
|
|
104
111
|
export interface Pad extends RLLRecord {
|
|
105
112
|
name: string;
|
|
@@ -112,7 +119,7 @@ export declare namespace RLLEntity {
|
|
|
112
119
|
}
|
|
113
120
|
export interface Vehicle extends RLLRecord {
|
|
114
121
|
name: string;
|
|
115
|
-
company: Omit<Company, "inactive" | "country">;
|
|
122
|
+
company: Omit<Company, "slug" | "inactive" | "country">;
|
|
116
123
|
}
|
|
117
124
|
export {};
|
|
118
125
|
}
|
|
@@ -188,6 +195,13 @@ export declare namespace RLLQueryConfig {
|
|
|
188
195
|
}
|
|
189
196
|
export type RLLClientOptions = {
|
|
190
197
|
keyInQueryParams?: boolean;
|
|
198
|
+
/** HTTP request timeout in milliseconds (default 30000). Must be greater than 0. */
|
|
199
|
+
timeoutMs?: number;
|
|
200
|
+
/**
|
|
201
|
+
* Max decompressed response body size in bytes (default 10 MiB).
|
|
202
|
+
* Protects against oversized or gzip-bomb responses. Must be greater than 0.
|
|
203
|
+
*/
|
|
204
|
+
maxResponseBytes?: number;
|
|
191
205
|
};
|
|
192
206
|
export type RLLResponse<T> = {
|
|
193
207
|
errors?: string[];
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export const RLLEndPoint = {
|
|
2
|
+
COMPANIES: "companies",
|
|
3
|
+
LAUNCHES: "launches",
|
|
4
|
+
LOCATIONS: "locations",
|
|
5
|
+
MISSIONS: "missions",
|
|
6
|
+
PADS: "pads",
|
|
7
|
+
TAGS: "tags",
|
|
8
|
+
VEHICLES: "vehicles",
|
|
9
|
+
};
|
|
10
|
+
export var RLLEntity;
|
|
11
|
+
(function (RLLEntity) {
|
|
12
|
+
RLLEntity.LaunchResult = {
|
|
13
|
+
NOT_SET: -1,
|
|
14
|
+
FAILURE: 0,
|
|
15
|
+
SUCCESS: 1,
|
|
16
|
+
PARTIAL_FAILURE: 2,
|
|
17
|
+
IN_FLIGHT_ABORT_CREWED: 3,
|
|
18
|
+
};
|
|
19
|
+
})(RLLEntity || (RLLEntity = {}));
|
|
20
|
+
export const RLLQueryParams = {
|
|
21
|
+
id: true,
|
|
22
|
+
page: true,
|
|
23
|
+
name: true,
|
|
24
|
+
country_code: true,
|
|
25
|
+
inactive: true,
|
|
26
|
+
cospar_id: true,
|
|
27
|
+
after_date: true,
|
|
28
|
+
before_date: true,
|
|
29
|
+
modified_since: true,
|
|
30
|
+
location_id: true,
|
|
31
|
+
pad_id: true,
|
|
32
|
+
provider_id: true,
|
|
33
|
+
tag_id: true,
|
|
34
|
+
vehicle_id: true,
|
|
35
|
+
state_abbr: true,
|
|
36
|
+
search: true,
|
|
37
|
+
slug: true,
|
|
38
|
+
text: true,
|
|
39
|
+
limit: true,
|
|
40
|
+
direction: true,
|
|
41
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const countryCodes: readonly ["AF", "AL", "DZ", "AS", "AD", "AO", "AI", "AQ", "AG", "AR", "AM", "AW", "AU", "AT", "AZ", "BS", "BH", "BD", "BB", "BY", "BE", "BZ", "BJ", "BM", "BT", "BO", "BQ", "BA", "BW", "BV", "BR", "IO", "BN", "BG", "BF", "BI", "CV", "KH", "CM", "CA", "KY", "CF", "TD", "CL", "CN", "CX", "CC", "CO", "KM", "CD", "CG", "CK", "CR", "HR", "CU", "CW", "CY", "CZ", "CI", "DK", "DJ", "DM", "DO", "EC", "EG", "SV", "GQ", "ER", "EE", "SZ", "ET", "FK", "FO", "FJ", "FI", "FR", "GF", "PF", "TF", "GA", "GM", "GE", "DE", "GH", "GI", "GR", "GL", "GD", "GP", "GU", "GT", "GG", "GN", "GW", "GY", "HT", "HM", "VA", "HN", "HK", "HU", "IS", "IN", "ID", "IR", "IQ", "IE", "IM", "IL", "IT", "JM", "JP", "JE", "JO", "KZ", "KE", "KI", "KP", "KR", "KW", "KG", "LA", "LV", "LB", "LS", "LR", "LY", "LI", "LT", "LU", "MO", "MG", "MW", "MY", "MV", "ML", "MT", "MH", "MQ", "MR", "MU", "YT", "MX", "FM", "MD", "MC", "MN", "ME", "MS", "MA", "MZ", "MM", "NA", "NR", "NP", "NL", "NC", "NZ", "NI", "NE", "NG", "NU", "NF", "MP", "NO", "OM", "PK", "PW", "PS", "PA", "PG", "PY", "PE", "PH", "PN", "PL", "PT", "PR", "QA", "MK", "RO", "RU", "RW", "RE", "BL", "SH", "KN", "LC", "MF", "PM", "VC", "WS", "SM", "ST", "SA", "SN", "RS", "SC", "SL", "SG", "SX", "SK", "SI", "SB", "SO", "ZA", "GS", "SS", "ES", "LK", "SD", "SR", "SJ", "SE", "CH", "SY", "TW", "TJ", "TZ", "TH", "TL", "TG", "TK", "TO", "TT", "TN", "TR", "TM", "TC", "TV", "UG", "UA", "AE", "GB", "UM", "US", "UY", "UZ", "VU", "VE", "VN", "VG", "VI", "WF", "EH", "YE", "ZM", "ZW", "AX"];
|
|
2
|
+
export declare const usStateCodes: readonly ["AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DE", "FL", "GA", "HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD", "MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ", "NM", "NY", "NC", "ND", "OH", "OK", "OR", "PA", "RI", "SC", "SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY", "DC", "AS", "GU", "MP", "PR", "UM", "VI"];
|
|
3
|
+
export declare const isValidCountryCode: (code: string) => code is (typeof countryCodes)[number];
|
|
4
|
+
export declare const isValidStateCode: (code: string) => code is (typeof usStateCodes)[number];
|
|
5
|
+
export declare namespace ISO3166Alpha2 {
|
|
6
|
+
type CountryCode = (typeof countryCodes)[number];
|
|
7
|
+
type StateCodeUS = (typeof usStateCodes)[number];
|
|
8
|
+
}
|
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
export const countryCodes = [
|
|
2
|
+
"AF",
|
|
3
|
+
"AL",
|
|
4
|
+
"DZ",
|
|
5
|
+
"AS",
|
|
6
|
+
"AD",
|
|
7
|
+
"AO",
|
|
8
|
+
"AI",
|
|
9
|
+
"AQ",
|
|
10
|
+
"AG",
|
|
11
|
+
"AR",
|
|
12
|
+
"AM",
|
|
13
|
+
"AW",
|
|
14
|
+
"AU",
|
|
15
|
+
"AT",
|
|
16
|
+
"AZ",
|
|
17
|
+
"BS",
|
|
18
|
+
"BH",
|
|
19
|
+
"BD",
|
|
20
|
+
"BB",
|
|
21
|
+
"BY",
|
|
22
|
+
"BE",
|
|
23
|
+
"BZ",
|
|
24
|
+
"BJ",
|
|
25
|
+
"BM",
|
|
26
|
+
"BT",
|
|
27
|
+
"BO",
|
|
28
|
+
"BQ",
|
|
29
|
+
"BA",
|
|
30
|
+
"BW",
|
|
31
|
+
"BV",
|
|
32
|
+
"BR",
|
|
33
|
+
"IO",
|
|
34
|
+
"BN",
|
|
35
|
+
"BG",
|
|
36
|
+
"BF",
|
|
37
|
+
"BI",
|
|
38
|
+
"CV",
|
|
39
|
+
"KH",
|
|
40
|
+
"CM",
|
|
41
|
+
"CA",
|
|
42
|
+
"KY",
|
|
43
|
+
"CF",
|
|
44
|
+
"TD",
|
|
45
|
+
"CL",
|
|
46
|
+
"CN",
|
|
47
|
+
"CX",
|
|
48
|
+
"CC",
|
|
49
|
+
"CO",
|
|
50
|
+
"KM",
|
|
51
|
+
"CD",
|
|
52
|
+
"CG",
|
|
53
|
+
"CK",
|
|
54
|
+
"CR",
|
|
55
|
+
"HR",
|
|
56
|
+
"CU",
|
|
57
|
+
"CW",
|
|
58
|
+
"CY",
|
|
59
|
+
"CZ",
|
|
60
|
+
"CI",
|
|
61
|
+
"DK",
|
|
62
|
+
"DJ",
|
|
63
|
+
"DM",
|
|
64
|
+
"DO",
|
|
65
|
+
"EC",
|
|
66
|
+
"EG",
|
|
67
|
+
"SV",
|
|
68
|
+
"GQ",
|
|
69
|
+
"ER",
|
|
70
|
+
"EE",
|
|
71
|
+
"SZ",
|
|
72
|
+
"ET",
|
|
73
|
+
"FK",
|
|
74
|
+
"FO",
|
|
75
|
+
"FJ",
|
|
76
|
+
"FI",
|
|
77
|
+
"FR",
|
|
78
|
+
"GF",
|
|
79
|
+
"PF",
|
|
80
|
+
"TF",
|
|
81
|
+
"GA",
|
|
82
|
+
"GM",
|
|
83
|
+
"GE",
|
|
84
|
+
"DE",
|
|
85
|
+
"GH",
|
|
86
|
+
"GI",
|
|
87
|
+
"GR",
|
|
88
|
+
"GL",
|
|
89
|
+
"GD",
|
|
90
|
+
"GP",
|
|
91
|
+
"GU",
|
|
92
|
+
"GT",
|
|
93
|
+
"GG",
|
|
94
|
+
"GN",
|
|
95
|
+
"GW",
|
|
96
|
+
"GY",
|
|
97
|
+
"HT",
|
|
98
|
+
"HM",
|
|
99
|
+
"VA",
|
|
100
|
+
"HN",
|
|
101
|
+
"HK",
|
|
102
|
+
"HU",
|
|
103
|
+
"IS",
|
|
104
|
+
"IN",
|
|
105
|
+
"ID",
|
|
106
|
+
"IR",
|
|
107
|
+
"IQ",
|
|
108
|
+
"IE",
|
|
109
|
+
"IM",
|
|
110
|
+
"IL",
|
|
111
|
+
"IT",
|
|
112
|
+
"JM",
|
|
113
|
+
"JP",
|
|
114
|
+
"JE",
|
|
115
|
+
"JO",
|
|
116
|
+
"KZ",
|
|
117
|
+
"KE",
|
|
118
|
+
"KI",
|
|
119
|
+
"KP",
|
|
120
|
+
"KR",
|
|
121
|
+
"KW",
|
|
122
|
+
"KG",
|
|
123
|
+
"LA",
|
|
124
|
+
"LV",
|
|
125
|
+
"LB",
|
|
126
|
+
"LS",
|
|
127
|
+
"LR",
|
|
128
|
+
"LY",
|
|
129
|
+
"LI",
|
|
130
|
+
"LT",
|
|
131
|
+
"LU",
|
|
132
|
+
"MO",
|
|
133
|
+
"MG",
|
|
134
|
+
"MW",
|
|
135
|
+
"MY",
|
|
136
|
+
"MV",
|
|
137
|
+
"ML",
|
|
138
|
+
"MT",
|
|
139
|
+
"MH",
|
|
140
|
+
"MQ",
|
|
141
|
+
"MR",
|
|
142
|
+
"MU",
|
|
143
|
+
"YT",
|
|
144
|
+
"MX",
|
|
145
|
+
"FM",
|
|
146
|
+
"MD",
|
|
147
|
+
"MC",
|
|
148
|
+
"MN",
|
|
149
|
+
"ME",
|
|
150
|
+
"MS",
|
|
151
|
+
"MA",
|
|
152
|
+
"MZ",
|
|
153
|
+
"MM",
|
|
154
|
+
"NA",
|
|
155
|
+
"NR",
|
|
156
|
+
"NP",
|
|
157
|
+
"NL",
|
|
158
|
+
"NC",
|
|
159
|
+
"NZ",
|
|
160
|
+
"NI",
|
|
161
|
+
"NE",
|
|
162
|
+
"NG",
|
|
163
|
+
"NU",
|
|
164
|
+
"NF",
|
|
165
|
+
"MP",
|
|
166
|
+
"NO",
|
|
167
|
+
"OM",
|
|
168
|
+
"PK",
|
|
169
|
+
"PW",
|
|
170
|
+
"PS",
|
|
171
|
+
"PA",
|
|
172
|
+
"PG",
|
|
173
|
+
"PY",
|
|
174
|
+
"PE",
|
|
175
|
+
"PH",
|
|
176
|
+
"PN",
|
|
177
|
+
"PL",
|
|
178
|
+
"PT",
|
|
179
|
+
"PR",
|
|
180
|
+
"QA",
|
|
181
|
+
"MK",
|
|
182
|
+
"RO",
|
|
183
|
+
"RU",
|
|
184
|
+
"RW",
|
|
185
|
+
"RE",
|
|
186
|
+
"BL",
|
|
187
|
+
"SH",
|
|
188
|
+
"KN",
|
|
189
|
+
"LC",
|
|
190
|
+
"MF",
|
|
191
|
+
"PM",
|
|
192
|
+
"VC",
|
|
193
|
+
"WS",
|
|
194
|
+
"SM",
|
|
195
|
+
"ST",
|
|
196
|
+
"SA",
|
|
197
|
+
"SN",
|
|
198
|
+
"RS",
|
|
199
|
+
"SC",
|
|
200
|
+
"SL",
|
|
201
|
+
"SG",
|
|
202
|
+
"SX",
|
|
203
|
+
"SK",
|
|
204
|
+
"SI",
|
|
205
|
+
"SB",
|
|
206
|
+
"SO",
|
|
207
|
+
"ZA",
|
|
208
|
+
"GS",
|
|
209
|
+
"SS",
|
|
210
|
+
"ES",
|
|
211
|
+
"LK",
|
|
212
|
+
"SD",
|
|
213
|
+
"SR",
|
|
214
|
+
"SJ",
|
|
215
|
+
"SE",
|
|
216
|
+
"CH",
|
|
217
|
+
"SY",
|
|
218
|
+
"TW",
|
|
219
|
+
"TJ",
|
|
220
|
+
"TZ",
|
|
221
|
+
"TH",
|
|
222
|
+
"TL",
|
|
223
|
+
"TG",
|
|
224
|
+
"TK",
|
|
225
|
+
"TO",
|
|
226
|
+
"TT",
|
|
227
|
+
"TN",
|
|
228
|
+
"TR",
|
|
229
|
+
"TM",
|
|
230
|
+
"TC",
|
|
231
|
+
"TV",
|
|
232
|
+
"UG",
|
|
233
|
+
"UA",
|
|
234
|
+
"AE",
|
|
235
|
+
"GB",
|
|
236
|
+
"UM",
|
|
237
|
+
"US",
|
|
238
|
+
"UY",
|
|
239
|
+
"UZ",
|
|
240
|
+
"VU",
|
|
241
|
+
"VE",
|
|
242
|
+
"VN",
|
|
243
|
+
"VG",
|
|
244
|
+
"VI",
|
|
245
|
+
"WF",
|
|
246
|
+
"EH",
|
|
247
|
+
"YE",
|
|
248
|
+
"ZM",
|
|
249
|
+
"ZW",
|
|
250
|
+
"AX",
|
|
251
|
+
];
|
|
252
|
+
export const usStateCodes = [
|
|
253
|
+
"AL",
|
|
254
|
+
"AK",
|
|
255
|
+
"AZ",
|
|
256
|
+
"AR",
|
|
257
|
+
"CA",
|
|
258
|
+
"CO",
|
|
259
|
+
"CT",
|
|
260
|
+
"DE",
|
|
261
|
+
"FL",
|
|
262
|
+
"GA",
|
|
263
|
+
"HI",
|
|
264
|
+
"ID",
|
|
265
|
+
"IL",
|
|
266
|
+
"IN",
|
|
267
|
+
"IA",
|
|
268
|
+
"KS",
|
|
269
|
+
"KY",
|
|
270
|
+
"LA",
|
|
271
|
+
"ME",
|
|
272
|
+
"MD",
|
|
273
|
+
"MA",
|
|
274
|
+
"MI",
|
|
275
|
+
"MN",
|
|
276
|
+
"MS",
|
|
277
|
+
"MO",
|
|
278
|
+
"MT",
|
|
279
|
+
"NE",
|
|
280
|
+
"NV",
|
|
281
|
+
"NH",
|
|
282
|
+
"NJ",
|
|
283
|
+
"NM",
|
|
284
|
+
"NY",
|
|
285
|
+
"NC",
|
|
286
|
+
"ND",
|
|
287
|
+
"OH",
|
|
288
|
+
"OK",
|
|
289
|
+
"OR",
|
|
290
|
+
"PA",
|
|
291
|
+
"RI",
|
|
292
|
+
"SC",
|
|
293
|
+
"SD",
|
|
294
|
+
"TN",
|
|
295
|
+
"TX",
|
|
296
|
+
"UT",
|
|
297
|
+
"VT",
|
|
298
|
+
"VA",
|
|
299
|
+
"WA",
|
|
300
|
+
"WV",
|
|
301
|
+
"WI",
|
|
302
|
+
"WY",
|
|
303
|
+
"DC",
|
|
304
|
+
"AS",
|
|
305
|
+
"GU",
|
|
306
|
+
"MP",
|
|
307
|
+
"PR",
|
|
308
|
+
"UM",
|
|
309
|
+
"VI",
|
|
310
|
+
];
|
|
311
|
+
const countryCodeSet = new Set(countryCodes);
|
|
312
|
+
const usStateCodeSet = new Set(usStateCodes);
|
|
313
|
+
export const isValidCountryCode = (code) => countryCodeSet.has(code);
|
|
314
|
+
export const isValidStateCode = (code) => usStateCodeSet.has(code);
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { RLLEndPoint, RLLQueryConfig } from "./types/application.js";
|
|
3
2
|
export declare const formatToRLLISODate: (date: Date) => string;
|
|
4
3
|
export declare const apiKeyValidator: (apiKey: any) => string;
|
|
5
4
|
export declare const optionsValidator: (options: {
|
|
6
|
-
[key: string]: any;
|
|
7
|
-
[key: number]: any;
|
|
8
|
-
[key: symbol]: any;
|
|
5
|
+
[key: string | number | symbol]: any;
|
|
9
6
|
}) => void;
|
|
10
7
|
export declare const queryOptionsValidator: (resource: RLLEndPoint, options?: RLLQueryConfig.Companies | RLLQueryConfig.Launches | RLLQueryConfig.Locations | RLLQueryConfig.Missions | RLLQueryConfig.Pads | RLLQueryConfig.Tags | RLLQueryConfig.Vehicles) => URLSearchParams;
|
|
11
8
|
export declare const warn: (msg: string) => void;
|
|
@@ -25,14 +25,28 @@ export const apiKeyValidator = (apiKey) => {
|
|
|
25
25
|
};
|
|
26
26
|
export const optionsValidator = (options) => {
|
|
27
27
|
for (const option in options) {
|
|
28
|
-
if (option
|
|
29
|
-
warn(`RLL Client options do not accept a "${option}" property. This property will be ignored.`);
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
28
|
+
if (option === "keyInQueryParams") {
|
|
32
29
|
if (typeof options[option] !== "boolean") {
|
|
33
30
|
error("RLL Client configuration option 'keyInQueryParams' must be a boolean.", "type");
|
|
34
31
|
}
|
|
35
32
|
}
|
|
33
|
+
else if (option === "timeoutMs") {
|
|
34
|
+
if (typeof options[option] !== "number" ||
|
|
35
|
+
!Number.isFinite(options[option]) ||
|
|
36
|
+
options[option] <= 0) {
|
|
37
|
+
error("RLL Client configuration option 'timeoutMs' must be a number greater than 0.", "type");
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
else if (option === "maxResponseBytes") {
|
|
41
|
+
if (typeof options[option] !== "number" ||
|
|
42
|
+
!Number.isFinite(options[option]) ||
|
|
43
|
+
options[option] <= 0) {
|
|
44
|
+
error("RLL Client configuration option 'maxResponseBytes' must be a number greater than 0.", "type");
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
warn(`RLL Client options do not accept a "${option}" property. This property will be ignored.`);
|
|
49
|
+
}
|
|
36
50
|
}
|
|
37
51
|
};
|
|
38
52
|
const validators = {
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { EventEmitter } from "events";
|
|
4
|
-
import { RLLEntity, RLLQueryConfig, RLLResponse } from "./types/application.js";
|
|
1
|
+
import { EventEmitter } from "node:events";
|
|
2
|
+
import { RLLEntity, RLLQueryConfig, RLLResponse } from "../types/application.js";
|
|
5
3
|
/**
|
|
6
4
|
* Class representing a RocketLaunch.Live Client Watcher
|
|
7
5
|
* @class
|
|
@@ -14,6 +12,8 @@ export declare class RLLWatcher extends EventEmitter {
|
|
|
14
12
|
private interval;
|
|
15
13
|
private params;
|
|
16
14
|
private timer;
|
|
15
|
+
private running;
|
|
16
|
+
private queryInFlight;
|
|
17
17
|
private fetcher;
|
|
18
18
|
/**
|
|
19
19
|
* Create a new RocketLaunch.live Client Watcher
|
|
@@ -22,7 +22,8 @@ export declare class RLLWatcher extends EventEmitter {
|
|
|
22
22
|
* @param {number | string} [interval] - Optional Client Configuration options
|
|
23
23
|
* @param {Object} [options] - Launch Search Options
|
|
24
24
|
* @param {number | string} options.id - Launch id
|
|
25
|
-
* @param {number | string} options.page -
|
|
25
|
+
* @param {number | string} options.page - Ignored; Watcher always starts at page 1
|
|
26
|
+
* @param {number | string} options.limit - Ignored; Watcher uses the API default page size
|
|
26
27
|
* @param {string} options.cospar_id - Launch COSPAR ID (ie. 2022-123)
|
|
27
28
|
* @param {Date | string} options.before_date - Only return launches before this date
|
|
28
29
|
* @param {Date | string} options.after_date - Only return launches after this date
|
|
@@ -40,17 +41,19 @@ export declare class RLLWatcher extends EventEmitter {
|
|
|
40
41
|
*/
|
|
41
42
|
constructor(fetcher: (params: URLSearchParams) => Promise<RLLResponse<RLLEntity.Launch[]>>, interval?: number | string, options?: RLLQueryConfig.Launches);
|
|
42
43
|
/**
|
|
43
|
-
*
|
|
44
|
+
* Fetch a single launches page. Always normalizes the page query param so a
|
|
45
|
+
* caller-supplied `page` cannot derail pagination.
|
|
44
46
|
*
|
|
45
47
|
* @private
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
*
|
|
48
|
+
*/
|
|
49
|
+
private fetchPage;
|
|
50
|
+
/**
|
|
51
|
+
* Fetch every page for a query. After page 1 reveals `last_page`, remaining
|
|
52
|
+
* pages are fetched with bounded concurrency (1 = fully serial).
|
|
50
53
|
*
|
|
51
|
-
* @
|
|
54
|
+
* @private
|
|
52
55
|
*/
|
|
53
|
-
private
|
|
56
|
+
private fetchAllPages;
|
|
54
57
|
/**
|
|
55
58
|
* Query wrapper to trigger events
|
|
56
59
|
*
|
|
@@ -62,6 +65,7 @@ export declare class RLLWatcher extends EventEmitter {
|
|
|
62
65
|
private query;
|
|
63
66
|
/**
|
|
64
67
|
* Begin monitoring API using the configured query parameters.
|
|
68
|
+
* Subsequent calls while already running are no-ops.
|
|
65
69
|
*
|
|
66
70
|
* @public
|
|
67
71
|
* @function
|