rocket-launch-live-client 0.1.5 → 0.2.1
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/{dist → lib/cjs}/Client.js +32 -55
- package/{dist → lib/cjs}/fetcher.js +17 -15
- package/lib/cjs/index.js +28 -0
- package/{dist → lib/cjs/types}/Client.d.ts +2 -2
- package/lib/cjs/types/Client.d.ts.map +1 -0
- package/{dist → lib/cjs}/types/application.js +23 -4
- package/{dist → lib/cjs/types}/fetcher.d.ts +1 -0
- package/lib/cjs/types/fetcher.d.ts.map +1 -0
- package/lib/cjs/types/index.d.ts +24 -0
- package/lib/cjs/types/index.d.ts.map +1 -0
- package/lib/cjs/types/standards.js +321 -0
- package/{dist → lib/cjs/types}/types/application.d.ts +40 -21
- package/lib/cjs/types/types/application.d.ts.map +1 -0
- package/{dist → lib/cjs/types}/types/standards.d.ts +3 -0
- package/lib/cjs/types/types/standards.d.ts.map +1 -0
- package/lib/cjs/types/utils.d.ts +11 -0
- package/lib/cjs/types/utils.d.ts.map +1 -0
- package/{dist → lib/cjs}/utils.js +56 -60
- package/lib/esm/Client.js +207 -0
- package/lib/esm/fetcher.js +39 -0
- package/{dist/index.d.ts → lib/esm/index.mjs} +5 -6
- package/lib/esm/types/Client.d.ts +176 -0
- package/lib/esm/types/Client.d.ts.map +1 -0
- package/lib/esm/types/application.js +41 -0
- package/lib/esm/types/fetcher.d.ts +2 -0
- package/lib/esm/types/fetcher.d.ts.map +1 -0
- package/lib/esm/types/index.d.ts +24 -0
- package/lib/esm/types/index.d.ts.map +1 -0
- package/{dist → lib/esm}/types/standards.js +8 -6
- package/lib/esm/types/types/application.d.ts +184 -0
- package/lib/esm/types/types/application.d.ts.map +1 -0
- package/lib/esm/types/types/standards.d.ts +317 -0
- package/lib/esm/types/types/standards.d.ts.map +1 -0
- package/lib/esm/types/utils.d.ts +11 -0
- package/lib/esm/types/utils.d.ts.map +1 -0
- package/lib/esm/utils.js +241 -0
- package/package.json +32 -10
- package/dist/Client.js.map +0 -1
- package/dist/fetcher.js.map +0 -1
- package/dist/index.js +0 -27
- package/dist/index.js.map +0 -1
- package/dist/types/application.js.map +0 -1
- package/dist/types/standards.js.map +0 -1
- package/dist/utils.d.ts +0 -6
- package/dist/utils.js.map +0 -1
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
exports.RLLClient = void 0;
|
|
4
|
+
const application_1 = require("./types/application");
|
|
5
|
+
const fetcher_1 = require("./fetcher");
|
|
6
|
+
const utils_1 = require("./utils");
|
|
6
7
|
/**
|
|
7
8
|
* Class representing a RocketLaunch.Live client
|
|
8
9
|
* @class
|
|
9
10
|
*/
|
|
10
|
-
|
|
11
|
+
class RLLClient {
|
|
11
12
|
/**
|
|
12
13
|
* Create a new RocketLaunch.live Client
|
|
13
14
|
*
|
|
@@ -16,14 +17,13 @@ var RLLClient = /** @class */ (function () {
|
|
|
16
17
|
* @param {boolean} options.keyInQueryParams - Set to true to send your API Key via Query parameters instead of Authorization Header (not recommended)
|
|
17
18
|
*
|
|
18
19
|
*/
|
|
19
|
-
|
|
20
|
+
constructor(apiKey, options) {
|
|
20
21
|
this.config = {
|
|
21
22
|
keyInQueryParams: false,
|
|
22
23
|
};
|
|
23
24
|
// Validate API Key is a valid UUID format
|
|
24
25
|
// Constructor throws if not
|
|
25
|
-
(0, utils_1.apiKeyValidator)(apiKey);
|
|
26
|
-
this.apiKey = apiKey;
|
|
26
|
+
this.apiKey = (0, utils_1.apiKeyValidator)(apiKey);
|
|
27
27
|
if (!options) {
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
@@ -45,9 +45,9 @@ var RLLClient = /** @class */ (function () {
|
|
|
45
45
|
*
|
|
46
46
|
* @returns {Promise<T>}
|
|
47
47
|
*/
|
|
48
|
-
|
|
48
|
+
query(endpoint, params) {
|
|
49
49
|
return (0, fetcher_1.fetcher)(this.apiKey, endpoint, params, this.config.keyInQueryParams);
|
|
50
|
-
}
|
|
50
|
+
}
|
|
51
51
|
/**
|
|
52
52
|
* Fetch launch companies
|
|
53
53
|
*
|
|
@@ -67,12 +67,9 @@ var RLLClient = /** @class */ (function () {
|
|
|
67
67
|
*
|
|
68
68
|
* const response = client.companies({ country_code: "US" })
|
|
69
69
|
*/
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
return _this.query(application_1.RLLEndPoint.COMPANIES, params);
|
|
74
|
-
});
|
|
75
|
-
};
|
|
70
|
+
companies(options) {
|
|
71
|
+
return (0, utils_1.queryOptionsValidator)(application_1.RLLEndPoint.COMPANIES, options).then((params) => this.query(application_1.RLLEndPoint.COMPANIES, params));
|
|
72
|
+
}
|
|
76
73
|
/**
|
|
77
74
|
* Fetch launches
|
|
78
75
|
*
|
|
@@ -102,12 +99,9 @@ var RLLClient = /** @class */ (function () {
|
|
|
102
99
|
*
|
|
103
100
|
* const response = client.launches({ after_date: new Date("2022-10-10") })
|
|
104
101
|
*/
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
return _this.query(application_1.RLLEndPoint.LAUNCHES, params);
|
|
109
|
-
});
|
|
110
|
-
};
|
|
102
|
+
launches(options) {
|
|
103
|
+
return (0, utils_1.queryOptionsValidator)(application_1.RLLEndPoint.LAUNCHES, options).then((params) => this.query(application_1.RLLEndPoint.LAUNCHES, params));
|
|
104
|
+
}
|
|
111
105
|
/**
|
|
112
106
|
* Fetch launch locations
|
|
113
107
|
*
|
|
@@ -127,12 +121,9 @@ var RLLClient = /** @class */ (function () {
|
|
|
127
121
|
*
|
|
128
122
|
* const response = client.locations({ country_code: "US" })
|
|
129
123
|
*/
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
return _this.query(application_1.RLLEndPoint.LOCATIONS, params);
|
|
134
|
-
});
|
|
135
|
-
};
|
|
124
|
+
locations(options) {
|
|
125
|
+
return (0, utils_1.queryOptionsValidator)(application_1.RLLEndPoint.LOCATIONS, options).then((params) => this.query(application_1.RLLEndPoint.LOCATIONS, params));
|
|
126
|
+
}
|
|
136
127
|
/**
|
|
137
128
|
* Fetch launch Missions
|
|
138
129
|
*
|
|
@@ -150,12 +141,9 @@ var RLLClient = /** @class */ (function () {
|
|
|
150
141
|
*
|
|
151
142
|
* const response = client.missions({ name: "Mars 2020" })
|
|
152
143
|
*/
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
return _this.query(application_1.RLLEndPoint.MISSIONS, params);
|
|
157
|
-
});
|
|
158
|
-
};
|
|
144
|
+
missions(options) {
|
|
145
|
+
return (0, utils_1.queryOptionsValidator)(application_1.RLLEndPoint.MISSIONS, options).then((params) => this.query(application_1.RLLEndPoint.MISSIONS, params));
|
|
146
|
+
}
|
|
159
147
|
/**
|
|
160
148
|
* Fetch launch pads
|
|
161
149
|
*
|
|
@@ -175,12 +163,9 @@ var RLLClient = /** @class */ (function () {
|
|
|
175
163
|
*
|
|
176
164
|
* const response = client.pads({ country_code: "US" })
|
|
177
165
|
*/
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
return _this.query(application_1.RLLEndPoint.PADS, params);
|
|
182
|
-
});
|
|
183
|
-
};
|
|
166
|
+
pads(options) {
|
|
167
|
+
return (0, utils_1.queryOptionsValidator)(application_1.RLLEndPoint.PADS, options).then((params) => this.query(application_1.RLLEndPoint.PADS, params));
|
|
168
|
+
}
|
|
184
169
|
/**
|
|
185
170
|
* Fetch launch tags
|
|
186
171
|
*
|
|
@@ -198,12 +183,9 @@ var RLLClient = /** @class */ (function () {
|
|
|
198
183
|
*
|
|
199
184
|
* const response = client.tags({ text: "Crewed" })
|
|
200
185
|
*/
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
return _this.query(application_1.RLLEndPoint.TAGS, params);
|
|
205
|
-
});
|
|
206
|
-
};
|
|
186
|
+
tags(options) {
|
|
187
|
+
return (0, utils_1.queryOptionsValidator)(application_1.RLLEndPoint.TAGS, options).then((params) => this.query(application_1.RLLEndPoint.TAGS, params));
|
|
188
|
+
}
|
|
207
189
|
/**
|
|
208
190
|
* Fetch launch Vehicles
|
|
209
191
|
*
|
|
@@ -221,13 +203,8 @@ var RLLClient = /** @class */ (function () {
|
|
|
221
203
|
*
|
|
222
204
|
* const response = client.vehicles({ name: "Falcon 9" })
|
|
223
205
|
*/
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
};
|
|
230
|
-
return RLLClient;
|
|
231
|
-
}());
|
|
232
|
-
exports.default = RLLClient;
|
|
233
|
-
//# sourceMappingURL=Client.js.map
|
|
206
|
+
vehicles(options) {
|
|
207
|
+
return (0, utils_1.queryOptionsValidator)(application_1.RLLEndPoint.VEHICLES, options).then((params) => this.query(application_1.RLLEndPoint.VEHICLES, params));
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
exports.RLLClient = RLLClient;
|
|
@@ -1,29 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.fetcher = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
const https_1 = __importDefault(require("https"));
|
|
8
|
+
const BASE_URL = "https://fdo.rocketlaunch.live";
|
|
9
|
+
const fetcher = (apiKey, endpoint, params, keyInQueryParams) => {
|
|
10
|
+
const url = new URL("json/" + endpoint, BASE_URL);
|
|
11
|
+
let headers;
|
|
9
12
|
if (keyInQueryParams) {
|
|
10
13
|
params.set("key", apiKey);
|
|
11
14
|
}
|
|
12
15
|
else {
|
|
13
|
-
headers = { authorization:
|
|
16
|
+
headers = { authorization: `Bearer ${apiKey}` };
|
|
14
17
|
}
|
|
15
|
-
params.forEach(
|
|
18
|
+
params.forEach((v, k) => url.searchParams.set(k, v));
|
|
16
19
|
return query(url, headers);
|
|
17
20
|
};
|
|
18
21
|
exports.fetcher = fetcher;
|
|
19
|
-
|
|
20
|
-
return new Promise(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
res.on("data",
|
|
24
|
-
res.on("end",
|
|
22
|
+
const query = (url, headers) => {
|
|
23
|
+
return new Promise((resolve, reject) => {
|
|
24
|
+
const req = https_1.default.get(url, { headers }, (res) => {
|
|
25
|
+
let data = [];
|
|
26
|
+
res.on("data", (chunk) => data.push(chunk));
|
|
27
|
+
res.on("end", () => {
|
|
25
28
|
if (res.statusCode === 200) {
|
|
26
|
-
|
|
29
|
+
const response = Buffer.concat(data).toString();
|
|
27
30
|
resolve(JSON.parse(response));
|
|
28
31
|
}
|
|
29
32
|
else if (res.statusCode === 404) {
|
|
@@ -41,4 +44,3 @@ var query = function (url, headers) {
|
|
|
41
44
|
req.on("error", reject);
|
|
42
45
|
});
|
|
43
46
|
};
|
|
44
|
-
//# sourceMappingURL=fetcher.js.map
|
package/lib/cjs/index.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.rllc = exports.RLLClient = exports.RLLEntity = exports.RLLEndPoint = void 0;
|
|
4
|
+
const Client_1 = require("./Client");
|
|
5
|
+
var application_1 = require("./types/application");
|
|
6
|
+
Object.defineProperty(exports, "RLLEndPoint", { enumerable: true, get: function () { return application_1.RLLEndPoint; } });
|
|
7
|
+
Object.defineProperty(exports, "RLLEntity", { enumerable: true, get: function () { return application_1.RLLEntity; } });
|
|
8
|
+
var Client_2 = require("./Client");
|
|
9
|
+
Object.defineProperty(exports, "RLLClient", { enumerable: true, get: function () { return Client_2.RLLClient; } });
|
|
10
|
+
/**
|
|
11
|
+
* Generate a RocketLaunch.Live client
|
|
12
|
+
*
|
|
13
|
+
* @public
|
|
14
|
+
* @function
|
|
15
|
+
*
|
|
16
|
+
* @param {string} apiKey - Your RocketLaunch.Live API Key
|
|
17
|
+
* @param {Object} [options] - Optional Client Configuration options
|
|
18
|
+
* @param {boolean} options.keyInQueryParams - Set to true to send your API Key via Query parameters instead of Authorization Header (not recommended)
|
|
19
|
+
*
|
|
20
|
+
* @returns {RLLCLient}
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
*
|
|
24
|
+
* const MY_KEY = process.env.ROCKETLAUNCH_LIVE_API_KEY
|
|
25
|
+
* const client = rllc(MY_KEY, { keyInQueryParams: true })
|
|
26
|
+
*/
|
|
27
|
+
const rllc = (apiKey, options) => new Client_1.RLLClient(apiKey, options);
|
|
28
|
+
exports.rllc = rllc;
|
|
@@ -3,7 +3,7 @@ import { RLLClientOptions, RLLEntity, RLLQueryConfig, RLLResponse } from "./type
|
|
|
3
3
|
* Class representing a RocketLaunch.Live client
|
|
4
4
|
* @class
|
|
5
5
|
*/
|
|
6
|
-
declare class RLLClient {
|
|
6
|
+
export declare class RLLClient {
|
|
7
7
|
private apiKey;
|
|
8
8
|
private config;
|
|
9
9
|
/**
|
|
@@ -173,4 +173,4 @@ declare class RLLClient {
|
|
|
173
173
|
*/
|
|
174
174
|
vehicles(options?: RLLQueryConfig.Vehicles): Promise<RLLResponse<RLLEntity.Vehicle[]>>;
|
|
175
175
|
}
|
|
176
|
-
|
|
176
|
+
//# sourceMappingURL=Client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Client.d.ts","sourceRoot":"","sources":["../../../src/Client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAEhB,SAAS,EACT,cAAc,EACd,WAAW,EACZ,MAAM,qBAAqB,CAAC;AAQ7B;;;GAGG;AACH,qBAAa,SAAS;IACpB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,MAAM,CAEZ;IAEF;;;;;;;OAOG;gBACS,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB;IAiBtD;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,KAAK;IASb;;;;;;;;;;;;;;;;;;OAkBG;IACI,SAAS,CACd,OAAO,CAAC,EAAE,cAAc,CAAC,SAAS,GACjC,OAAO,CAAC,WAAW,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC,CAAC;IAU5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACI,QAAQ,CACb,OAAO,CAAC,EAAE,cAAc,CAAC,QAAQ,GAChC,OAAO,CAAC,WAAW,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC,CAAC;IAM3C;;;;;;;;;;;;;;;;;;OAkBG;IACI,SAAS,CACd,OAAO,CAAC,EAAE,cAAc,CAAC,SAAS,GACjC,OAAO,CAAC,WAAW,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC,CAAC;IAU7C;;;;;;;;;;;;;;;;OAgBG;IACI,QAAQ,CACb,OAAO,CAAC,EAAE,cAAc,CAAC,QAAQ,GAChC,OAAO,CAAC,WAAW,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC,CAAC;IAM5C;;;;;;;;;;;;;;;;;;OAkBG;IACI,IAAI,CACT,OAAO,CAAC,EAAE,cAAc,CAAC,IAAI,GAC5B,OAAO,CAAC,WAAW,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,CAAC;IAMxC;;;;;;;;;;;;;;;;OAgBG;IACI,IAAI,CACT,OAAO,CAAC,EAAE,cAAc,CAAC,IAAI,GAC5B,OAAO,CAAC,WAAW,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,CAAC;IAMxC;;;;;;;;;;;;;;;;OAgBG;IACI,QAAQ,CACb,OAAO,CAAC,EAAE,cAAc,CAAC,QAAQ,GAChC,OAAO,CAAC,WAAW,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC,CAAC;CAK7C"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RLLEntity = exports.RLLEndPoint = void 0;
|
|
3
|
+
exports.RLLQueryParams = exports.RLLEntity = exports.RLLEndPoint = void 0;
|
|
4
4
|
var RLLEndPoint;
|
|
5
5
|
(function (RLLEndPoint) {
|
|
6
6
|
RLLEndPoint["COMPANIES"] = "companies";
|
|
@@ -13,13 +13,32 @@ var RLLEndPoint;
|
|
|
13
13
|
})(RLLEndPoint = exports.RLLEndPoint || (exports.RLLEndPoint = {}));
|
|
14
14
|
var RLLEntity;
|
|
15
15
|
(function (RLLEntity) {
|
|
16
|
-
|
|
16
|
+
let LaunchResult;
|
|
17
17
|
(function (LaunchResult) {
|
|
18
18
|
LaunchResult[LaunchResult["NOT_SET"] = -1] = "NOT_SET";
|
|
19
19
|
LaunchResult[LaunchResult["FAILURE"] = 0] = "FAILURE";
|
|
20
20
|
LaunchResult[LaunchResult["SUCCESS"] = 1] = "SUCCESS";
|
|
21
21
|
LaunchResult[LaunchResult["PARTIAL_FAILURE"] = 2] = "PARTIAL_FAILURE";
|
|
22
22
|
LaunchResult[LaunchResult["IN_FLIGHT_ABORT_CREWED"] = 3] = "IN_FLIGHT_ABORT_CREWED";
|
|
23
|
-
})(LaunchResult || (LaunchResult = {}));
|
|
23
|
+
})(LaunchResult = RLLEntity.LaunchResult || (RLLEntity.LaunchResult = {}));
|
|
24
24
|
})(RLLEntity = exports.RLLEntity || (exports.RLLEntity = {}));
|
|
25
|
-
|
|
25
|
+
exports.RLLQueryParams = {
|
|
26
|
+
id: true,
|
|
27
|
+
page: true,
|
|
28
|
+
name: true,
|
|
29
|
+
country_code: true,
|
|
30
|
+
inactive: true,
|
|
31
|
+
cospar_id: true,
|
|
32
|
+
after_date: true,
|
|
33
|
+
before_date: true,
|
|
34
|
+
modified_since: true,
|
|
35
|
+
location_id: true,
|
|
36
|
+
pad_id: true,
|
|
37
|
+
provider_id: true,
|
|
38
|
+
tag_id: true,
|
|
39
|
+
vehicle_id: true,
|
|
40
|
+
state_abbr: true,
|
|
41
|
+
search: true,
|
|
42
|
+
slug: true,
|
|
43
|
+
text: true,
|
|
44
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetcher.d.ts","sourceRoot":"","sources":["../../../src/fetcher.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,OAAO,cACV,MAAM,YACJ,MAAM,UACR,eAAe,oBACL,OAAO,eAc1B,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { RLLClient } from "./Client";
|
|
2
|
+
import { RLLClientOptions } from "./types/application";
|
|
3
|
+
export { RLLEndPoint, RLLResponse, RLLClientOptions, RLLQueryConfig, RLLEntity, } from "./types/application";
|
|
4
|
+
export { ISO3166Alpha2 } from "./types/standards";
|
|
5
|
+
export { RLLClient } from "./Client";
|
|
6
|
+
/**
|
|
7
|
+
* Generate a RocketLaunch.Live client
|
|
8
|
+
*
|
|
9
|
+
* @public
|
|
10
|
+
* @function
|
|
11
|
+
*
|
|
12
|
+
* @param {string} apiKey - Your RocketLaunch.Live API Key
|
|
13
|
+
* @param {Object} [options] - Optional Client Configuration options
|
|
14
|
+
* @param {boolean} options.keyInQueryParams - Set to true to send your API Key via Query parameters instead of Authorization Header (not recommended)
|
|
15
|
+
*
|
|
16
|
+
* @returns {RLLCLient}
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
*
|
|
20
|
+
* const MY_KEY = process.env.ROCKETLAUNCH_LIVE_API_KEY
|
|
21
|
+
* const client = rllc(MY_KEY, { keyInQueryParams: true })
|
|
22
|
+
*/
|
|
23
|
+
export declare const rllc: (apiKey: string, options?: RLLClientOptions) => RLLClient;
|
|
24
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +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,GACV,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,IAAI,WAAY,MAAM,YAAY,gBAAgB,KAAG,SAClC,CAAC"}
|
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isValidStateCode = exports.isValidCountryCode = exports.usStateCodes = exports.countryCodes = void 0;
|
|
4
|
+
exports.countryCodes = {
|
|
5
|
+
AF: "AF",
|
|
6
|
+
AL: "AL",
|
|
7
|
+
DZ: "DZ",
|
|
8
|
+
AS: "AS",
|
|
9
|
+
AD: "AD",
|
|
10
|
+
AO: "AO",
|
|
11
|
+
AI: "AI",
|
|
12
|
+
AQ: "AQ",
|
|
13
|
+
AG: "AG",
|
|
14
|
+
AR: "AR",
|
|
15
|
+
AM: "AM",
|
|
16
|
+
AW: "AW",
|
|
17
|
+
AU: "AU",
|
|
18
|
+
AT: "AT",
|
|
19
|
+
AZ: "AZ",
|
|
20
|
+
BS: "BS",
|
|
21
|
+
BH: "BH",
|
|
22
|
+
BD: "BD",
|
|
23
|
+
BB: "BB",
|
|
24
|
+
BY: "BY",
|
|
25
|
+
BE: "BE",
|
|
26
|
+
BZ: "BZ",
|
|
27
|
+
BJ: "BJ",
|
|
28
|
+
BM: "BM",
|
|
29
|
+
BT: "BT",
|
|
30
|
+
BO: "BO",
|
|
31
|
+
BQ: "BQ",
|
|
32
|
+
BA: "BA",
|
|
33
|
+
BW: "BW",
|
|
34
|
+
BV: "BV",
|
|
35
|
+
BR: "BR",
|
|
36
|
+
IO: "IO",
|
|
37
|
+
BN: "BN",
|
|
38
|
+
BG: "BG",
|
|
39
|
+
BF: "BF",
|
|
40
|
+
BI: "BI",
|
|
41
|
+
CV: "CV",
|
|
42
|
+
KH: "KH",
|
|
43
|
+
CM: "CM",
|
|
44
|
+
CA: "CA",
|
|
45
|
+
KY: "KY",
|
|
46
|
+
CF: "CF",
|
|
47
|
+
TD: "TD",
|
|
48
|
+
CL: "CL",
|
|
49
|
+
CN: "CN",
|
|
50
|
+
CX: "CX",
|
|
51
|
+
CC: "CC",
|
|
52
|
+
CO: "CO",
|
|
53
|
+
KM: "KM",
|
|
54
|
+
CD: "CD",
|
|
55
|
+
CG: "CG",
|
|
56
|
+
CK: "CK",
|
|
57
|
+
CR: "CR",
|
|
58
|
+
HR: "HR",
|
|
59
|
+
CU: "CU",
|
|
60
|
+
CW: "CW",
|
|
61
|
+
CY: "CY",
|
|
62
|
+
CZ: "CZ",
|
|
63
|
+
CI: "CI",
|
|
64
|
+
DK: "DK",
|
|
65
|
+
DJ: "DJ",
|
|
66
|
+
DM: "DM",
|
|
67
|
+
DO: "DO",
|
|
68
|
+
EC: "EC",
|
|
69
|
+
EG: "EG",
|
|
70
|
+
SV: "SV",
|
|
71
|
+
GQ: "GQ",
|
|
72
|
+
ER: "ER",
|
|
73
|
+
EE: "EE",
|
|
74
|
+
SZ: "SZ",
|
|
75
|
+
ET: "ET",
|
|
76
|
+
FK: "FK",
|
|
77
|
+
FO: "FO",
|
|
78
|
+
FJ: "FJ",
|
|
79
|
+
FI: "FI",
|
|
80
|
+
FR: "FR",
|
|
81
|
+
GF: "GF",
|
|
82
|
+
PF: "PF",
|
|
83
|
+
TF: "TF",
|
|
84
|
+
GA: "GA",
|
|
85
|
+
GM: "GM",
|
|
86
|
+
GE: "GE",
|
|
87
|
+
DE: "DE",
|
|
88
|
+
GH: "GH",
|
|
89
|
+
GI: "GI",
|
|
90
|
+
GR: "GR",
|
|
91
|
+
GL: "GL",
|
|
92
|
+
GD: "GD",
|
|
93
|
+
GP: "GP",
|
|
94
|
+
GU: "GU",
|
|
95
|
+
GT: "GT",
|
|
96
|
+
GG: "GG",
|
|
97
|
+
GN: "GN",
|
|
98
|
+
GW: "GW",
|
|
99
|
+
GY: "GY",
|
|
100
|
+
HT: "HT",
|
|
101
|
+
HM: "HM",
|
|
102
|
+
VA: "VA",
|
|
103
|
+
HN: "HN",
|
|
104
|
+
HK: "HK",
|
|
105
|
+
HU: "HU",
|
|
106
|
+
IS: "IS",
|
|
107
|
+
IN: "IN",
|
|
108
|
+
ID: "ID",
|
|
109
|
+
IR: "IR",
|
|
110
|
+
IQ: "IQ",
|
|
111
|
+
IE: "IE",
|
|
112
|
+
IM: "IM",
|
|
113
|
+
IL: "IL",
|
|
114
|
+
IT: "IT",
|
|
115
|
+
JM: "JM",
|
|
116
|
+
JP: "JP",
|
|
117
|
+
JE: "JE",
|
|
118
|
+
JO: "JO",
|
|
119
|
+
KZ: "KZ",
|
|
120
|
+
KE: "KE",
|
|
121
|
+
KI: "KI",
|
|
122
|
+
KP: "KP",
|
|
123
|
+
KR: "KR",
|
|
124
|
+
KW: "KW",
|
|
125
|
+
KG: "KG",
|
|
126
|
+
LA: "LA",
|
|
127
|
+
LV: "LV",
|
|
128
|
+
LB: "LB",
|
|
129
|
+
LS: "LS",
|
|
130
|
+
LR: "LR",
|
|
131
|
+
LY: "LY",
|
|
132
|
+
LI: "LI",
|
|
133
|
+
LT: "LT",
|
|
134
|
+
LU: "LU",
|
|
135
|
+
MO: "MO",
|
|
136
|
+
MG: "MG",
|
|
137
|
+
MW: "MW",
|
|
138
|
+
MY: "MY",
|
|
139
|
+
MV: "MV",
|
|
140
|
+
ML: "ML",
|
|
141
|
+
MT: "MT",
|
|
142
|
+
MH: "MH",
|
|
143
|
+
MQ: "MQ",
|
|
144
|
+
MR: "MR",
|
|
145
|
+
MU: "MU",
|
|
146
|
+
YT: "YT",
|
|
147
|
+
MX: "MX",
|
|
148
|
+
FM: "FM",
|
|
149
|
+
MD: "MD",
|
|
150
|
+
MC: "MC",
|
|
151
|
+
MN: "MN",
|
|
152
|
+
ME: "ME",
|
|
153
|
+
MS: "MS",
|
|
154
|
+
MA: "MA",
|
|
155
|
+
MZ: "MZ",
|
|
156
|
+
MM: "MM",
|
|
157
|
+
NA: "NA",
|
|
158
|
+
NR: "NR",
|
|
159
|
+
NP: "NP",
|
|
160
|
+
NL: "NL",
|
|
161
|
+
NC: "NC",
|
|
162
|
+
NZ: "NZ",
|
|
163
|
+
NI: "NI",
|
|
164
|
+
NE: "NE",
|
|
165
|
+
NG: "NG",
|
|
166
|
+
NU: "NU",
|
|
167
|
+
NF: "NF",
|
|
168
|
+
MP: "MP",
|
|
169
|
+
NO: "NO",
|
|
170
|
+
OM: "OM",
|
|
171
|
+
PK: "PK",
|
|
172
|
+
PW: "PW",
|
|
173
|
+
PS: "PS",
|
|
174
|
+
PA: "PA",
|
|
175
|
+
PG: "PG",
|
|
176
|
+
PY: "PY",
|
|
177
|
+
PE: "PE",
|
|
178
|
+
PH: "PH",
|
|
179
|
+
PN: "PN",
|
|
180
|
+
PL: "PL",
|
|
181
|
+
PT: "PT",
|
|
182
|
+
PR: "PR",
|
|
183
|
+
QA: "QA",
|
|
184
|
+
MK: "MK",
|
|
185
|
+
RO: "RO",
|
|
186
|
+
RU: "RU",
|
|
187
|
+
RW: "RW",
|
|
188
|
+
RE: "RE",
|
|
189
|
+
BL: "BL",
|
|
190
|
+
SH: "SH",
|
|
191
|
+
KN: "KN",
|
|
192
|
+
LC: "LC",
|
|
193
|
+
MF: "MF",
|
|
194
|
+
PM: "PM",
|
|
195
|
+
VC: "VC",
|
|
196
|
+
WS: "WS",
|
|
197
|
+
SM: "SM",
|
|
198
|
+
ST: "ST",
|
|
199
|
+
SA: "SA",
|
|
200
|
+
SN: "SN",
|
|
201
|
+
RS: "RS",
|
|
202
|
+
SC: "SC",
|
|
203
|
+
SL: "SL",
|
|
204
|
+
SG: "SG",
|
|
205
|
+
SX: "SX",
|
|
206
|
+
SK: "SK",
|
|
207
|
+
SI: "SI",
|
|
208
|
+
SB: "SB",
|
|
209
|
+
SO: "SO",
|
|
210
|
+
ZA: "ZA",
|
|
211
|
+
GS: "GS",
|
|
212
|
+
SS: "SS",
|
|
213
|
+
ES: "ES",
|
|
214
|
+
LK: "LK",
|
|
215
|
+
SD: "SD",
|
|
216
|
+
SR: "SR",
|
|
217
|
+
SJ: "SJ",
|
|
218
|
+
SE: "SE",
|
|
219
|
+
CH: "CH",
|
|
220
|
+
SY: "SY",
|
|
221
|
+
TW: "TW",
|
|
222
|
+
TJ: "TJ",
|
|
223
|
+
TZ: "TZ",
|
|
224
|
+
TH: "TH",
|
|
225
|
+
TL: "TL",
|
|
226
|
+
TG: "TG",
|
|
227
|
+
TK: "TK",
|
|
228
|
+
TO: "TO",
|
|
229
|
+
TT: "TT",
|
|
230
|
+
TN: "TN",
|
|
231
|
+
TR: "TR",
|
|
232
|
+
TM: "TM",
|
|
233
|
+
TC: "TC",
|
|
234
|
+
TV: "TV",
|
|
235
|
+
UG: "UG",
|
|
236
|
+
UA: "UA",
|
|
237
|
+
AE: "AE",
|
|
238
|
+
GB: "GB",
|
|
239
|
+
UM: "UM",
|
|
240
|
+
US: "US",
|
|
241
|
+
UY: "UY",
|
|
242
|
+
UZ: "UZ",
|
|
243
|
+
VU: "VU",
|
|
244
|
+
VE: "VE",
|
|
245
|
+
VN: "VN",
|
|
246
|
+
VG: "VG",
|
|
247
|
+
VI: "VI",
|
|
248
|
+
WF: "WF",
|
|
249
|
+
EH: "EH",
|
|
250
|
+
YE: "YE",
|
|
251
|
+
ZM: "ZM",
|
|
252
|
+
ZW: "ZW",
|
|
253
|
+
AX: "AX",
|
|
254
|
+
};
|
|
255
|
+
exports.usStateCodes = {
|
|
256
|
+
AL: "AL",
|
|
257
|
+
AK: "AK",
|
|
258
|
+
AZ: "AZ",
|
|
259
|
+
AR: "AR",
|
|
260
|
+
CA: "CA",
|
|
261
|
+
CO: "CO",
|
|
262
|
+
CT: "CT",
|
|
263
|
+
DE: "DE",
|
|
264
|
+
FL: "FL",
|
|
265
|
+
GA: "GA",
|
|
266
|
+
HI: "HI",
|
|
267
|
+
ID: "ID",
|
|
268
|
+
IL: "IL",
|
|
269
|
+
IN: "IN",
|
|
270
|
+
IA: "IA",
|
|
271
|
+
KS: "KS",
|
|
272
|
+
KY: "KY",
|
|
273
|
+
LA: "LA",
|
|
274
|
+
ME: "ME",
|
|
275
|
+
MD: "MD",
|
|
276
|
+
MA: "MA",
|
|
277
|
+
MI: "MI",
|
|
278
|
+
MN: "MN",
|
|
279
|
+
MS: "MS",
|
|
280
|
+
MO: "MO",
|
|
281
|
+
MT: "MT",
|
|
282
|
+
NE: "NE",
|
|
283
|
+
NV: "NV",
|
|
284
|
+
NH: "NH",
|
|
285
|
+
NJ: "NJ",
|
|
286
|
+
NM: "NM",
|
|
287
|
+
NY: "NY",
|
|
288
|
+
NC: "NC",
|
|
289
|
+
ND: "ND",
|
|
290
|
+
OH: "OH",
|
|
291
|
+
OK: "OK",
|
|
292
|
+
OR: "OR",
|
|
293
|
+
PA: "PA",
|
|
294
|
+
RI: "RI",
|
|
295
|
+
SC: "SC",
|
|
296
|
+
SD: "SD",
|
|
297
|
+
TN: "TN",
|
|
298
|
+
TX: "TX",
|
|
299
|
+
UT: "UT",
|
|
300
|
+
VT: "VT",
|
|
301
|
+
VA: "VA",
|
|
302
|
+
WA: "WA",
|
|
303
|
+
WV: "WV",
|
|
304
|
+
WI: "WI",
|
|
305
|
+
WY: "WY",
|
|
306
|
+
DC: "DC",
|
|
307
|
+
AS: "AS",
|
|
308
|
+
GU: "GU",
|
|
309
|
+
MP: "MP",
|
|
310
|
+
PR: "PR",
|
|
311
|
+
UM: "UM",
|
|
312
|
+
VI: "VI",
|
|
313
|
+
};
|
|
314
|
+
const isValidCountryCode = (code) => {
|
|
315
|
+
return !!exports.countryCodes[code];
|
|
316
|
+
};
|
|
317
|
+
exports.isValidCountryCode = isValidCountryCode;
|
|
318
|
+
const isValidStateCode = (code) => {
|
|
319
|
+
return !!exports.usStateCodes[code];
|
|
320
|
+
};
|
|
321
|
+
exports.isValidStateCode = isValidStateCode;
|