@studyportals/static-domain-data 7.0.0-3 → 7.0.0-5
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/cjs/src/areas/area-get-async.js +97 -0
- package/cjs/src/areas/area-id-country-id-mapping.js +69 -0
- package/cjs/src/areas/chunks/areas-202.js +14 -0
- package/cjs/src/areas/chunks/areas-30.js +10 -0
- package/cjs/src/areas/chunks/areas-82.js +57 -0
- package/cjs/src/areas/i-area-record.js +2 -0
- package/cjs/src/countries/country-get-async.js +60 -5
- package/cjs/src/currencies/currency-get-countries-async.js +34 -0
- package/cjs/src/currencies/currency-get-from-country-async.js +22 -0
- package/cjs/src/disciplines/discipline-get-parent-discipline-async.js +17 -0
- package/cjs/src/disciplines/discipline-get-sub-or-parent-discipline-async.js +22 -0
- package/esm/src/areas/area-get-async.d.ts +8 -0
- package/esm/src/areas/area-get-async.js +66 -0
- package/esm/src/areas/area-id-country-id-mapping.d.ts +2 -0
- package/esm/src/areas/area-id-country-id-mapping.js +66 -0
- package/esm/src/areas/chunks/areas-202.d.ts +3 -0
- package/esm/src/areas/chunks/areas-202.js +11 -0
- package/esm/src/areas/chunks/areas-30.d.ts +3 -0
- package/esm/src/areas/chunks/areas-30.js +7 -0
- package/esm/src/areas/chunks/areas-82.d.ts +3 -0
- package/esm/src/areas/chunks/areas-82.js +54 -0
- package/esm/src/areas/i-area-record.d.ts +1 -0
- package/esm/src/areas/i-area-record.js +1 -0
- package/esm/src/countries/country-get-async.d.ts +5 -2
- package/esm/src/countries/country-get-async.js +58 -5
- package/esm/src/currencies/currency-get-countries-async.d.ts +2 -0
- package/esm/src/currencies/currency-get-countries-async.js +31 -0
- package/esm/src/currencies/currency-get-from-country-async.d.ts +3 -0
- package/esm/src/currencies/currency-get-from-country-async.js +19 -0
- package/esm/src/disciplines/discipline-get-parent-discipline-async.d.ts +2 -0
- package/esm/src/disciplines/discipline-get-parent-discipline-async.js +14 -0
- package/esm/src/disciplines/discipline-get-sub-or-parent-discipline-async.d.ts +4 -0
- package/esm/src/disciplines/discipline-get-sub-or-parent-discipline-async.js +19 -0
- package/package.json +1 -1
- package/cjs/src/countries/country-id-chunk-mapping.js +0 -235
- package/cjs/src/countries/country-iso-chunk-mapping.js +0 -235
- package/esm/src/countries/country-id-chunk-mapping.d.ts +0 -2
- package/esm/src/countries/country-id-chunk-mapping.js +0 -232
- package/esm/src/countries/country-iso-chunk-mapping.d.ts +0 -2
- package/esm/src/countries/country-iso-chunk-mapping.js +0 -232
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
+
exports.areasGetByCountryIdAsync = exports.areasAvailableForCountryAsync = exports.areaGetPathAsync = exports.areaGetIdByCodeAsync = exports.areaGetByIdAsync = exports.areaGetByCodeAsync = void 0;
|
|
36
|
+
const area_id_country_id_mapping_js_1 = require("./area-id-country-id-mapping.js");
|
|
37
|
+
const area_get_id_by_code_js_1 = require("./area-get-id-by-code.js");
|
|
38
|
+
const areaByIdCache = new Map();
|
|
39
|
+
const areasByCountryIdCache = new Map();
|
|
40
|
+
const areaChunkLoaders = {
|
|
41
|
+
"30": () => Promise.resolve().then(() => __importStar(require("./chunks/areas-30.js"))),
|
|
42
|
+
"82": () => Promise.resolve().then(() => __importStar(require("./chunks/areas-82.js"))),
|
|
43
|
+
"202": () => Promise.resolve().then(() => __importStar(require("./chunks/areas-202.js"))),
|
|
44
|
+
};
|
|
45
|
+
const loadAreasByCountryId = (countryId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
46
|
+
if (areasByCountryIdCache.has(countryId)) {
|
|
47
|
+
return areasByCountryIdCache.get(countryId);
|
|
48
|
+
}
|
|
49
|
+
const { areaRecords } = yield areaChunkLoaders[countryId]();
|
|
50
|
+
const areas = areaRecords.map(([id, name, mappedCountryId]) => {
|
|
51
|
+
const area = { id, name, countryId: mappedCountryId };
|
|
52
|
+
areaByIdCache.set(id, area);
|
|
53
|
+
return area;
|
|
54
|
+
});
|
|
55
|
+
areasByCountryIdCache.set(countryId, areas);
|
|
56
|
+
return areas;
|
|
57
|
+
});
|
|
58
|
+
const areaGetByIdAsync = (areaId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
59
|
+
var _a;
|
|
60
|
+
const normalizedAreaId = areaId.trim();
|
|
61
|
+
if (areaByIdCache.has(normalizedAreaId)) {
|
|
62
|
+
return areaByIdCache.get(normalizedAreaId);
|
|
63
|
+
}
|
|
64
|
+
const countryId = area_id_country_id_mapping_js_1.areaIdCountryIdMapping[normalizedAreaId];
|
|
65
|
+
if (!countryId) {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
yield loadAreasByCountryId(countryId);
|
|
69
|
+
return (_a = areaByIdCache.get(normalizedAreaId)) !== null && _a !== void 0 ? _a : null;
|
|
70
|
+
});
|
|
71
|
+
exports.areaGetByIdAsync = areaGetByIdAsync;
|
|
72
|
+
const areasGetByCountryIdAsync = (countryId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
73
|
+
const normalizedCountryId = countryId.trim();
|
|
74
|
+
if (!(normalizedCountryId in areaChunkLoaders)) {
|
|
75
|
+
return [];
|
|
76
|
+
}
|
|
77
|
+
return loadAreasByCountryId(normalizedCountryId);
|
|
78
|
+
});
|
|
79
|
+
exports.areasGetByCountryIdAsync = areasGetByCountryIdAsync;
|
|
80
|
+
const areaGetIdByCodeAsync = (code) => __awaiter(void 0, void 0, void 0, function* () {
|
|
81
|
+
return (0, area_get_id_by_code_js_1.areaGetIdByCode)(code);
|
|
82
|
+
});
|
|
83
|
+
exports.areaGetIdByCodeAsync = areaGetIdByCodeAsync;
|
|
84
|
+
const areaGetByCodeAsync = (code) => __awaiter(void 0, void 0, void 0, function* () {
|
|
85
|
+
const areaId = yield areaGetIdByCodeAsync(code);
|
|
86
|
+
return areaId ? areaGetByIdAsync(areaId) : null;
|
|
87
|
+
});
|
|
88
|
+
exports.areaGetByCodeAsync = areaGetByCodeAsync;
|
|
89
|
+
const areaGetPathAsync = (id) => __awaiter(void 0, void 0, void 0, function* () {
|
|
90
|
+
const { areaGetPath } = yield Promise.resolve().then(() => __importStar(require("./area-get-path.js")));
|
|
91
|
+
return areaGetPath(id);
|
|
92
|
+
});
|
|
93
|
+
exports.areaGetPathAsync = areaGetPathAsync;
|
|
94
|
+
const areasAvailableForCountryAsync = (countryId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
95
|
+
return countryId.trim() in areaChunkLoaders;
|
|
96
|
+
});
|
|
97
|
+
exports.areasAvailableForCountryAsync = areasAvailableForCountryAsync;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.areaIdCountryIdMapping = void 0;
|
|
4
|
+
const areaIdCountryIdMapping = {
|
|
5
|
+
"137": "202",
|
|
6
|
+
"138": "202",
|
|
7
|
+
"139": "202",
|
|
8
|
+
"140": "202",
|
|
9
|
+
"141": "202",
|
|
10
|
+
"142": "202",
|
|
11
|
+
"143": "202",
|
|
12
|
+
"144": "202",
|
|
13
|
+
"993": "30",
|
|
14
|
+
"994": "30",
|
|
15
|
+
"995": "30",
|
|
16
|
+
"996": "30",
|
|
17
|
+
"3578": "82",
|
|
18
|
+
"3579": "82",
|
|
19
|
+
"3580": "82",
|
|
20
|
+
"3581": "82",
|
|
21
|
+
"3582": "82",
|
|
22
|
+
"3583": "82",
|
|
23
|
+
"3584": "82",
|
|
24
|
+
"3585": "82",
|
|
25
|
+
"3586": "82",
|
|
26
|
+
"3587": "82",
|
|
27
|
+
"3588": "82",
|
|
28
|
+
"3589": "82",
|
|
29
|
+
"3590": "82",
|
|
30
|
+
"3591": "82",
|
|
31
|
+
"3592": "82",
|
|
32
|
+
"3593": "82",
|
|
33
|
+
"3594": "82",
|
|
34
|
+
"3595": "82",
|
|
35
|
+
"3596": "82",
|
|
36
|
+
"3597": "82",
|
|
37
|
+
"3598": "82",
|
|
38
|
+
"3599": "82",
|
|
39
|
+
"3600": "82",
|
|
40
|
+
"3601": "82",
|
|
41
|
+
"3602": "82",
|
|
42
|
+
"3603": "82",
|
|
43
|
+
"3604": "82",
|
|
44
|
+
"3605": "82",
|
|
45
|
+
"3606": "82",
|
|
46
|
+
"3607": "82",
|
|
47
|
+
"3608": "82",
|
|
48
|
+
"3609": "82",
|
|
49
|
+
"3610": "82",
|
|
50
|
+
"3611": "82",
|
|
51
|
+
"3612": "82",
|
|
52
|
+
"3613": "82",
|
|
53
|
+
"3614": "82",
|
|
54
|
+
"3615": "82",
|
|
55
|
+
"3616": "82",
|
|
56
|
+
"3617": "82",
|
|
57
|
+
"3618": "82",
|
|
58
|
+
"3619": "82",
|
|
59
|
+
"3620": "82",
|
|
60
|
+
"3621": "82",
|
|
61
|
+
"3622": "82",
|
|
62
|
+
"3623": "82",
|
|
63
|
+
"3624": "82",
|
|
64
|
+
"3625": "82",
|
|
65
|
+
"3626": "82",
|
|
66
|
+
"3627": "82",
|
|
67
|
+
"3628": "82",
|
|
68
|
+
};
|
|
69
|
+
exports.areaIdCountryIdMapping = areaIdCountryIdMapping;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.areaRecords = void 0;
|
|
4
|
+
const areaRecords = [
|
|
5
|
+
["137", "Western Australia", "202"],
|
|
6
|
+
["138", "South Australia", "202"],
|
|
7
|
+
["139", "Northern Territory", "202"],
|
|
8
|
+
["140", "Victoria", "202"],
|
|
9
|
+
["141", "Tasmania", "202"],
|
|
10
|
+
["142", "Queensland", "202"],
|
|
11
|
+
["143", "New South Wales", "202"],
|
|
12
|
+
["144", "Australian Capital Territory", "202"],
|
|
13
|
+
];
|
|
14
|
+
exports.areaRecords = areaRecords;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.areaRecords = void 0;
|
|
4
|
+
const areaRecords = [
|
|
5
|
+
["993", "Wales", "30"],
|
|
6
|
+
["994", "Scotland", "30"],
|
|
7
|
+
["995", "N Ireland", "30"],
|
|
8
|
+
["996", "England", "30"],
|
|
9
|
+
];
|
|
10
|
+
exports.areaRecords = areaRecords;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.areaRecords = void 0;
|
|
4
|
+
const areaRecords = [
|
|
5
|
+
["3578", "Arkansas", "82"],
|
|
6
|
+
["3579", "Washington, D.C.", "82"],
|
|
7
|
+
["3580", "Delaware", "82"],
|
|
8
|
+
["3581", "Florida", "82"],
|
|
9
|
+
["3582", "Georgia", "82"],
|
|
10
|
+
["3583", "Kansas", "82"],
|
|
11
|
+
["3584", "Louisiana", "82"],
|
|
12
|
+
["3585", "Maryland", "82"],
|
|
13
|
+
["3586", "Missouri", "82"],
|
|
14
|
+
["3587", "Mississippi", "82"],
|
|
15
|
+
["3588", "North Carolina", "82"],
|
|
16
|
+
["3589", "Oklahoma", "82"],
|
|
17
|
+
["3590", "South Carolina", "82"],
|
|
18
|
+
["3591", "Tennessee", "82"],
|
|
19
|
+
["3592", "Texas", "82"],
|
|
20
|
+
["3593", "West Virginia", "82"],
|
|
21
|
+
["3594", "Alabama", "82"],
|
|
22
|
+
["3595", "Connecticut", "82"],
|
|
23
|
+
["3596", "Iowa", "82"],
|
|
24
|
+
["3597", "Illinois", "82"],
|
|
25
|
+
["3598", "Indiana", "82"],
|
|
26
|
+
["3599", "Maine", "82"],
|
|
27
|
+
["3600", "Michigan", "82"],
|
|
28
|
+
["3601", "Minnesota", "82"],
|
|
29
|
+
["3602", "Nebraska", "82"],
|
|
30
|
+
["3603", "New Hampshire", "82"],
|
|
31
|
+
["3604", "New Jersey", "82"],
|
|
32
|
+
["3605", "New York", "82"],
|
|
33
|
+
["3606", "Ohio", "82"],
|
|
34
|
+
["3607", "Rhode Island", "82"],
|
|
35
|
+
["3608", "Vermont", "82"],
|
|
36
|
+
["3609", "Wisconsin", "82"],
|
|
37
|
+
["3610", "California", "82"],
|
|
38
|
+
["3611", "Colorado", "82"],
|
|
39
|
+
["3612", "New Mexico", "82"],
|
|
40
|
+
["3613", "Nevada", "82"],
|
|
41
|
+
["3614", "Utah", "82"],
|
|
42
|
+
["3615", "Arizona", "82"],
|
|
43
|
+
["3616", "Idaho", "82"],
|
|
44
|
+
["3617", "Montana", "82"],
|
|
45
|
+
["3618", "North Dakota", "82"],
|
|
46
|
+
["3619", "Oregon", "82"],
|
|
47
|
+
["3620", "South Dakota", "82"],
|
|
48
|
+
["3621", "Washington", "82"],
|
|
49
|
+
["3622", "Wyoming", "82"],
|
|
50
|
+
["3623", "Hawaii", "82"],
|
|
51
|
+
["3624", "Alaska", "82"],
|
|
52
|
+
["3625", "Kentucky", "82"],
|
|
53
|
+
["3626", "Massachusetts", "82"],
|
|
54
|
+
["3627", "Pennsylvania", "82"],
|
|
55
|
+
["3628", "Virginia", "82"],
|
|
56
|
+
];
|
|
57
|
+
exports.areaRecords = areaRecords;
|
|
@@ -32,12 +32,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
32
32
|
});
|
|
33
33
|
};
|
|
34
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
exports.countryGetByIsoCodeAsync = exports.countryGetByIdAsync = void 0;
|
|
36
|
-
const
|
|
37
|
-
const country_iso_chunk_mapping_js_1 = require("./country-iso-chunk-mapping.js");
|
|
35
|
+
exports.countryGetExtendedByIsoCodeAsync = exports.countryGetExtendedByIdAsync = exports.countryGetByIsoCodeAsync = exports.countryGetByIdAsync = void 0;
|
|
36
|
+
const country_get_iso_code_js_1 = require("./country-get-iso-code.js");
|
|
38
37
|
const countriesByChunkCache = new Map();
|
|
39
38
|
const countryByIdCache = new Map();
|
|
40
39
|
const countryByIsoCodeCache = new Map();
|
|
40
|
+
const countryExtendedByIdCache = new Map();
|
|
41
|
+
const countryExtendedByIsoCodeCache = new Map();
|
|
41
42
|
const countryChunkLoaders = {
|
|
42
43
|
"a-f": () => Promise.resolve().then(() => __importStar(require("./chunks/country-records-a-f.js"))),
|
|
43
44
|
"g-l": () => Promise.resolve().then(() => __importStar(require("./chunks/country-records-g-l.js"))),
|
|
@@ -57,6 +58,22 @@ const getRecordsFromChunkModule = (chunk, chunkModule) => {
|
|
|
57
58
|
return (_d = chunkModule.countryRecordsSZ) !== null && _d !== void 0 ? _d : [];
|
|
58
59
|
}
|
|
59
60
|
};
|
|
61
|
+
const countryGetChunkByIsoCode = (isoCode) => {
|
|
62
|
+
const firstLetter = isoCode[0];
|
|
63
|
+
if (!firstLetter) {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
if (firstLetter >= "A" && firstLetter <= "F") {
|
|
67
|
+
return "a-f";
|
|
68
|
+
}
|
|
69
|
+
if (firstLetter >= "G" && firstLetter <= "L") {
|
|
70
|
+
return "g-l";
|
|
71
|
+
}
|
|
72
|
+
if (firstLetter >= "M" && firstLetter <= "R") {
|
|
73
|
+
return "m-r";
|
|
74
|
+
}
|
|
75
|
+
return "s-z";
|
|
76
|
+
};
|
|
60
77
|
const loadCountryChunk = (chunk) => __awaiter(void 0, void 0, void 0, function* () {
|
|
61
78
|
if (countriesByChunkCache.has(chunk)) {
|
|
62
79
|
return countriesByChunkCache.get(chunk);
|
|
@@ -67,6 +84,9 @@ const loadCountryChunk = (chunk) => __awaiter(void 0, void 0, void 0, function*
|
|
|
67
84
|
const country = { id, name };
|
|
68
85
|
countryByIdCache.set(id, country);
|
|
69
86
|
countryByIsoCodeCache.set(isoCode, country);
|
|
87
|
+
const countryExtended = Object.assign(Object.assign({}, country), { iso: isoCode });
|
|
88
|
+
countryExtendedByIdCache.set(id, countryExtended);
|
|
89
|
+
countryExtendedByIsoCodeCache.set(isoCode, countryExtended);
|
|
70
90
|
return country;
|
|
71
91
|
});
|
|
72
92
|
countriesByChunkCache.set(chunk, countries);
|
|
@@ -78,7 +98,8 @@ const countryGetByIdAsync = (id) => __awaiter(void 0, void 0, void 0, function*
|
|
|
78
98
|
if (countryByIdCache.has(normalizedId)) {
|
|
79
99
|
return countryByIdCache.get(normalizedId);
|
|
80
100
|
}
|
|
81
|
-
const
|
|
101
|
+
const isoCode = (0, country_get_iso_code_js_1.countryGetIsoCode)(normalizedId);
|
|
102
|
+
const chunk = isoCode ? countryGetChunkByIsoCode(isoCode) : null;
|
|
82
103
|
if (!chunk) {
|
|
83
104
|
return null;
|
|
84
105
|
}
|
|
@@ -92,7 +113,7 @@ const countryGetByIsoCodeAsync = (isoCode) => __awaiter(void 0, void 0, void 0,
|
|
|
92
113
|
if (countryByIsoCodeCache.has(normalizedIsoCode)) {
|
|
93
114
|
return countryByIsoCodeCache.get(normalizedIsoCode);
|
|
94
115
|
}
|
|
95
|
-
const chunk =
|
|
116
|
+
const chunk = countryGetChunkByIsoCode(normalizedIsoCode);
|
|
96
117
|
if (!chunk) {
|
|
97
118
|
return null;
|
|
98
119
|
}
|
|
@@ -100,3 +121,37 @@ const countryGetByIsoCodeAsync = (isoCode) => __awaiter(void 0, void 0, void 0,
|
|
|
100
121
|
return (_a = countryByIsoCodeCache.get(normalizedIsoCode)) !== null && _a !== void 0 ? _a : null;
|
|
101
122
|
});
|
|
102
123
|
exports.countryGetByIsoCodeAsync = countryGetByIsoCodeAsync;
|
|
124
|
+
const countryGetExtendedByIdAsync = (id) => __awaiter(void 0, void 0, void 0, function* () {
|
|
125
|
+
const normalizedId = id.trim();
|
|
126
|
+
if (countryExtendedByIdCache.has(normalizedId)) {
|
|
127
|
+
return countryExtendedByIdCache.get(normalizedId);
|
|
128
|
+
}
|
|
129
|
+
const country = yield countryGetByIdAsync(normalizedId);
|
|
130
|
+
if (!country) {
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
133
|
+
const isoCode = (0, country_get_iso_code_js_1.countryGetIsoCode)(normalizedId);
|
|
134
|
+
if (!isoCode) {
|
|
135
|
+
return null;
|
|
136
|
+
}
|
|
137
|
+
const countryExtended = Object.assign(Object.assign({}, country), { iso: isoCode });
|
|
138
|
+
countryExtendedByIdCache.set(normalizedId, countryExtended);
|
|
139
|
+
countryExtendedByIsoCodeCache.set(isoCode, countryExtended);
|
|
140
|
+
return countryExtended;
|
|
141
|
+
});
|
|
142
|
+
exports.countryGetExtendedByIdAsync = countryGetExtendedByIdAsync;
|
|
143
|
+
const countryGetExtendedByIsoCodeAsync = (isoCode) => __awaiter(void 0, void 0, void 0, function* () {
|
|
144
|
+
const normalizedIsoCode = isoCode.toUpperCase().trim();
|
|
145
|
+
if (countryExtendedByIsoCodeCache.has(normalizedIsoCode)) {
|
|
146
|
+
return countryExtendedByIsoCodeCache.get(normalizedIsoCode);
|
|
147
|
+
}
|
|
148
|
+
const country = yield countryGetByIsoCodeAsync(normalizedIsoCode);
|
|
149
|
+
if (!country) {
|
|
150
|
+
return null;
|
|
151
|
+
}
|
|
152
|
+
const countryExtended = Object.assign(Object.assign({}, country), { iso: normalizedIsoCode });
|
|
153
|
+
countryExtendedByIsoCodeCache.set(normalizedIsoCode, countryExtended);
|
|
154
|
+
countryExtendedByIdCache.set(country.id, countryExtended);
|
|
155
|
+
return countryExtended;
|
|
156
|
+
});
|
|
157
|
+
exports.countryGetExtendedByIsoCodeAsync = countryGetExtendedByIsoCodeAsync;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.currencyGetCountriesAsync = void 0;
|
|
13
|
+
const country_get_async_js_1 = require("../countries/country-get-async.js");
|
|
14
|
+
const currency_iso_country_iso_mapping_js_1 = require("./currency-iso-country-iso-mapping.js");
|
|
15
|
+
const countryIsoCodesByCurrencyIso = new Map();
|
|
16
|
+
for (const { countryIso, currencyIso } of currency_iso_country_iso_mapping_js_1.currencyIsoCountryIsoMapping) {
|
|
17
|
+
if (countryIsoCodesByCurrencyIso.has(currencyIso)) {
|
|
18
|
+
countryIsoCodesByCurrencyIso.get(currencyIso).push(countryIso);
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
countryIsoCodesByCurrencyIso.set(currencyIso, [countryIso]);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
const currencyGetCountriesAsync = (iso) => __awaiter(void 0, void 0, void 0, function* () {
|
|
25
|
+
var _a;
|
|
26
|
+
const normalizedIso = iso.toUpperCase().trim();
|
|
27
|
+
const countryIsoCodes = (_a = countryIsoCodesByCurrencyIso.get(normalizedIso)) !== null && _a !== void 0 ? _a : [];
|
|
28
|
+
if (!countryIsoCodes.length) {
|
|
29
|
+
return [];
|
|
30
|
+
}
|
|
31
|
+
const countries = yield Promise.all(countryIsoCodes.map((countryIsoCode) => (0, country_get_async_js_1.countryGetByIsoCodeAsync)(countryIsoCode)));
|
|
32
|
+
return countries.flatMap((country) => (country ? [country.id] : []));
|
|
33
|
+
});
|
|
34
|
+
exports.currencyGetCountriesAsync = currencyGetCountriesAsync;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.currencyGetFromCountryAsync = void 0;
|
|
13
|
+
const currency_iso_country_iso_mapping_js_1 = require("./currency-iso-country-iso-mapping.js");
|
|
14
|
+
const currency_get_async_js_1 = require("./currency-get-async.js");
|
|
15
|
+
const currencyIsoByCountryIso = new Map(currency_iso_country_iso_mapping_js_1.currencyIsoCountryIsoMapping.map(({ countryIso, currencyIso }) => [countryIso, currencyIso]));
|
|
16
|
+
const currencyGetFromCountryAsync = (countryIso) => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
|
+
var _a, _b;
|
|
18
|
+
const normalizedCountryIso = countryIso.toUpperCase().trim();
|
|
19
|
+
const currencyIso = (_a = currencyIsoByCountryIso.get(normalizedCountryIso)) !== null && _a !== void 0 ? _a : "EUR";
|
|
20
|
+
return (_b = (yield (0, currency_get_async_js_1.currencyGetByIsoAsync)(currencyIso))) !== null && _b !== void 0 ? _b : undefined;
|
|
21
|
+
});
|
|
22
|
+
exports.currencyGetFromCountryAsync = currencyGetFromCountryAsync;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.subdisciplineGetParentIdAsync = void 0;
|
|
13
|
+
const subdiscipline_id_discipline_id_mapping_js_1 = require("./subdiscipline-id-discipline-id-mapping.js");
|
|
14
|
+
const subdisciplineGetParentIdAsync = (subDisciplineId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
|
+
return subdiscipline_id_discipline_id_mapping_js_1.subdisciplineIdDisciplineIdMapping[subDisciplineId] || null;
|
|
16
|
+
});
|
|
17
|
+
exports.subdisciplineGetParentIdAsync = subdisciplineGetParentIdAsync;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.disciplineGetSubOrParentDisciplineAsync = void 0;
|
|
13
|
+
const discipline_get_subdiscipline_by_id_async_js_1 = require("./discipline-get-subdiscipline-by-id-async.js");
|
|
14
|
+
const disciplines_js_1 = require("./disciplines.js");
|
|
15
|
+
const disciplineGetSubOrParentDisciplineAsync = (id) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
+
const subDiscipline = yield (0, discipline_get_subdiscipline_by_id_async_js_1.disciplineGetSubdisciplineByIdAsync)(id);
|
|
17
|
+
if (subDiscipline) {
|
|
18
|
+
return subDiscipline;
|
|
19
|
+
}
|
|
20
|
+
return disciplines_js_1.disciplinesAll.find((discipline) => discipline.id === id);
|
|
21
|
+
});
|
|
22
|
+
exports.disciplineGetSubOrParentDisciplineAsync = disciplineGetSubOrParentDisciplineAsync;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { IArea } from "./i-area";
|
|
2
|
+
declare const areaGetByIdAsync: (areaId: string) => Promise<IArea | null>;
|
|
3
|
+
declare const areasGetByCountryIdAsync: (countryId: string) => Promise<readonly IArea[]>;
|
|
4
|
+
declare const areaGetIdByCodeAsync: (code: string) => Promise<string | null>;
|
|
5
|
+
declare const areaGetByCodeAsync: (code: string) => Promise<IArea | null>;
|
|
6
|
+
declare const areaGetPathAsync: (id: string) => Promise<string | null>;
|
|
7
|
+
declare const areasAvailableForCountryAsync: (countryId: string) => Promise<boolean>;
|
|
8
|
+
export { areaGetByCodeAsync, areaGetByIdAsync, areaGetIdByCodeAsync, areaGetPathAsync, areasAvailableForCountryAsync, areasGetByCountryIdAsync, };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { areaIdCountryIdMapping } from "./area-id-country-id-mapping.js";
|
|
11
|
+
import { areaGetIdByCode } from "./area-get-id-by-code.js";
|
|
12
|
+
const areaByIdCache = new Map();
|
|
13
|
+
const areasByCountryIdCache = new Map();
|
|
14
|
+
const areaChunkLoaders = {
|
|
15
|
+
"30": () => import("./chunks/areas-30.js"),
|
|
16
|
+
"82": () => import("./chunks/areas-82.js"),
|
|
17
|
+
"202": () => import("./chunks/areas-202.js"),
|
|
18
|
+
};
|
|
19
|
+
const loadAreasByCountryId = (countryId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
20
|
+
if (areasByCountryIdCache.has(countryId)) {
|
|
21
|
+
return areasByCountryIdCache.get(countryId);
|
|
22
|
+
}
|
|
23
|
+
const { areaRecords } = yield areaChunkLoaders[countryId]();
|
|
24
|
+
const areas = areaRecords.map(([id, name, mappedCountryId]) => {
|
|
25
|
+
const area = { id, name, countryId: mappedCountryId };
|
|
26
|
+
areaByIdCache.set(id, area);
|
|
27
|
+
return area;
|
|
28
|
+
});
|
|
29
|
+
areasByCountryIdCache.set(countryId, areas);
|
|
30
|
+
return areas;
|
|
31
|
+
});
|
|
32
|
+
const areaGetByIdAsync = (areaId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
33
|
+
var _a;
|
|
34
|
+
const normalizedAreaId = areaId.trim();
|
|
35
|
+
if (areaByIdCache.has(normalizedAreaId)) {
|
|
36
|
+
return areaByIdCache.get(normalizedAreaId);
|
|
37
|
+
}
|
|
38
|
+
const countryId = areaIdCountryIdMapping[normalizedAreaId];
|
|
39
|
+
if (!countryId) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
yield loadAreasByCountryId(countryId);
|
|
43
|
+
return (_a = areaByIdCache.get(normalizedAreaId)) !== null && _a !== void 0 ? _a : null;
|
|
44
|
+
});
|
|
45
|
+
const areasGetByCountryIdAsync = (countryId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
46
|
+
const normalizedCountryId = countryId.trim();
|
|
47
|
+
if (!(normalizedCountryId in areaChunkLoaders)) {
|
|
48
|
+
return [];
|
|
49
|
+
}
|
|
50
|
+
return loadAreasByCountryId(normalizedCountryId);
|
|
51
|
+
});
|
|
52
|
+
const areaGetIdByCodeAsync = (code) => __awaiter(void 0, void 0, void 0, function* () {
|
|
53
|
+
return areaGetIdByCode(code);
|
|
54
|
+
});
|
|
55
|
+
const areaGetByCodeAsync = (code) => __awaiter(void 0, void 0, void 0, function* () {
|
|
56
|
+
const areaId = yield areaGetIdByCodeAsync(code);
|
|
57
|
+
return areaId ? areaGetByIdAsync(areaId) : null;
|
|
58
|
+
});
|
|
59
|
+
const areaGetPathAsync = (id) => __awaiter(void 0, void 0, void 0, function* () {
|
|
60
|
+
const { areaGetPath } = yield import("./area-get-path.js");
|
|
61
|
+
return areaGetPath(id);
|
|
62
|
+
});
|
|
63
|
+
const areasAvailableForCountryAsync = (countryId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
64
|
+
return countryId.trim() in areaChunkLoaders;
|
|
65
|
+
});
|
|
66
|
+
export { areaGetByCodeAsync, areaGetByIdAsync, areaGetIdByCodeAsync, areaGetPathAsync, areasAvailableForCountryAsync, areasGetByCountryIdAsync, };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
const areaIdCountryIdMapping = {
|
|
2
|
+
"137": "202",
|
|
3
|
+
"138": "202",
|
|
4
|
+
"139": "202",
|
|
5
|
+
"140": "202",
|
|
6
|
+
"141": "202",
|
|
7
|
+
"142": "202",
|
|
8
|
+
"143": "202",
|
|
9
|
+
"144": "202",
|
|
10
|
+
"993": "30",
|
|
11
|
+
"994": "30",
|
|
12
|
+
"995": "30",
|
|
13
|
+
"996": "30",
|
|
14
|
+
"3578": "82",
|
|
15
|
+
"3579": "82",
|
|
16
|
+
"3580": "82",
|
|
17
|
+
"3581": "82",
|
|
18
|
+
"3582": "82",
|
|
19
|
+
"3583": "82",
|
|
20
|
+
"3584": "82",
|
|
21
|
+
"3585": "82",
|
|
22
|
+
"3586": "82",
|
|
23
|
+
"3587": "82",
|
|
24
|
+
"3588": "82",
|
|
25
|
+
"3589": "82",
|
|
26
|
+
"3590": "82",
|
|
27
|
+
"3591": "82",
|
|
28
|
+
"3592": "82",
|
|
29
|
+
"3593": "82",
|
|
30
|
+
"3594": "82",
|
|
31
|
+
"3595": "82",
|
|
32
|
+
"3596": "82",
|
|
33
|
+
"3597": "82",
|
|
34
|
+
"3598": "82",
|
|
35
|
+
"3599": "82",
|
|
36
|
+
"3600": "82",
|
|
37
|
+
"3601": "82",
|
|
38
|
+
"3602": "82",
|
|
39
|
+
"3603": "82",
|
|
40
|
+
"3604": "82",
|
|
41
|
+
"3605": "82",
|
|
42
|
+
"3606": "82",
|
|
43
|
+
"3607": "82",
|
|
44
|
+
"3608": "82",
|
|
45
|
+
"3609": "82",
|
|
46
|
+
"3610": "82",
|
|
47
|
+
"3611": "82",
|
|
48
|
+
"3612": "82",
|
|
49
|
+
"3613": "82",
|
|
50
|
+
"3614": "82",
|
|
51
|
+
"3615": "82",
|
|
52
|
+
"3616": "82",
|
|
53
|
+
"3617": "82",
|
|
54
|
+
"3618": "82",
|
|
55
|
+
"3619": "82",
|
|
56
|
+
"3620": "82",
|
|
57
|
+
"3621": "82",
|
|
58
|
+
"3622": "82",
|
|
59
|
+
"3623": "82",
|
|
60
|
+
"3624": "82",
|
|
61
|
+
"3625": "82",
|
|
62
|
+
"3626": "82",
|
|
63
|
+
"3627": "82",
|
|
64
|
+
"3628": "82",
|
|
65
|
+
};
|
|
66
|
+
export { areaIdCountryIdMapping, };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const areaRecords = [
|
|
2
|
+
["137", "Western Australia", "202"],
|
|
3
|
+
["138", "South Australia", "202"],
|
|
4
|
+
["139", "Northern Territory", "202"],
|
|
5
|
+
["140", "Victoria", "202"],
|
|
6
|
+
["141", "Tasmania", "202"],
|
|
7
|
+
["142", "Queensland", "202"],
|
|
8
|
+
["143", "New South Wales", "202"],
|
|
9
|
+
["144", "Australian Capital Territory", "202"],
|
|
10
|
+
];
|
|
11
|
+
export { areaRecords, };
|