@futdevpro/fsm-dynamo 1.5.44 → 1.5.45
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/lib/_collections/_constants/country-divisions-ISO-3166-all-list.json +19036 -0
- package/lib/_collections/_tools/dynamo-regions.d.ts +5 -5
- package/lib/_collections/_tools/dynamo-regions.d.ts.map +1 -1
- package/lib/_collections/_tools/dynamo-regions.js +17 -7
- package/lib/_collections/_tools/dynamo-regions.js.map +1 -1
- package/lib/_models/control-models/country-division.d.ts +6 -0
- package/lib/_models/control-models/country-division.d.ts.map +1 -0
- package/lib/_models/control-models/country-division.js +3 -0
- package/lib/_models/control-models/country-division.js.map +1 -0
- package/lib/_models/control-models/country-iso.d.ts +3 -0
- package/lib/_models/control-models/country-iso.d.ts.map +1 -1
- package/lib/_models/control-models/country-phone-code.d.ts +1 -1
- package/lib/_models/control-models/country-phone-code.d.ts.map +1 -1
- package/lib/_models/control-models/division-collection.d.ts +9 -0
- package/lib/_models/control-models/division-collection.d.ts.map +1 -0
- package/lib/_models/control-models/division-collection.js +3 -0
- package/lib/_models/control-models/division-collection.js.map +1 -0
- package/lib/_models/control-models/division-region-data.d.ts +45 -0
- package/lib/_models/control-models/division-region-data.d.ts.map +1 -0
- package/lib/_models/control-models/division-region-data.js +46 -0
- package/lib/_models/control-models/division-region-data.js.map +1 -0
- package/lib/_models/index.d.ts +2 -2
- package/lib/_models/index.d.ts.map +1 -1
- package/lib/_models/index.js +2 -2
- package/lib/_models/index.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +66 -50
- package/package.json +1 -1
- package/src/_collections/_constants/country-divisions-ISO-3166-all-list.json +19036 -0
- package/src/_collections/_tools/dynamo-regions.ts +17 -9
- package/src/_models/control-models/country-division.ts +7 -0
- package/src/_models/control-models/country-iso.ts +3 -0
- package/src/_models/control-models/country-phone-code.ts +1 -1
- package/src/_models/control-models/division-collection.ts +10 -0
- package/src/_models/index.ts +2 -2
- package/src/_models/control-models/subdivision-collection.ts +0 -10
- /package/src/_collections/_constants/{country-sub-divisions-ISO-3166.json → country-divisions-ISO-3166.json} +0 -0
- /package/src/_models/control-models/{subdivision-region-data.ts → division-region-data.ts} +0 -0
|
@@ -1,28 +1,36 @@
|
|
|
1
1
|
|
|
2
2
|
import * as ISOs from '../_constants/country-codes-ISO-3166.json';
|
|
3
3
|
import * as PhoneCodes from '../_constants/country-phone-codes.json';
|
|
4
|
-
import * as
|
|
4
|
+
import * as Divisions from '../_constants/country-divisions-ISO-3166-all-list.json';
|
|
5
5
|
import { Region } from '../../_enums/region.enum';
|
|
6
6
|
import { Dynamo_Error } from '../../_models';
|
|
7
7
|
import { CountryPhoneCode } from '../../_models/control-models/country-phone-code';
|
|
8
8
|
import { JSONListify } from './utilities';
|
|
9
9
|
import { CountryISO } from '../../_models/control-models/country-iso';
|
|
10
|
-
import {
|
|
10
|
+
import { CountryDivision } from '../../_models/control-models/country-division';
|
|
11
11
|
|
|
12
12
|
export class Dynamo_Regions {
|
|
13
|
-
|
|
14
|
-
static
|
|
13
|
+
/* static divisions: DivisionCollection = Dynamo_Regions.getSubdivisionCollection(); */
|
|
14
|
+
static divisions: CountryDivision[] = Dynamo_Regions.getAllDivisions();
|
|
15
15
|
static phoneCodes: CountryPhoneCode[] = Dynamo_Regions.getAllPhoneCodes();
|
|
16
|
-
static
|
|
16
|
+
static ISOs: CountryISO[] = Dynamo_Regions.getAllCountryISO();
|
|
17
17
|
|
|
18
|
-
private static
|
|
19
|
-
return JSONListify(
|
|
18
|
+
private static getAllDivisions(): CountryDivision[] {
|
|
19
|
+
return JSONListify(Divisions);
|
|
20
20
|
}
|
|
21
21
|
private static getAllPhoneCodes(): CountryPhoneCode[] {
|
|
22
22
|
return JSONListify(PhoneCodes);
|
|
23
23
|
}
|
|
24
|
-
private static getSubdivisionCollection():
|
|
25
|
-
return
|
|
24
|
+
/* private static getSubdivisionCollection(): DivisionCollection {
|
|
25
|
+
return Divisions as DivisionCollection;
|
|
26
|
+
} */
|
|
27
|
+
private static getAllCountryISO(): CountryISO[] {
|
|
28
|
+
const result: CountryISO[] = JSONListify(ISOs);
|
|
29
|
+
result.forEach((iso: CountryISO) => {
|
|
30
|
+
iso.phoneCode = this.phoneCodes.find((pc: CountryPhoneCode) => pc.iso === iso.iso2)?.code;
|
|
31
|
+
iso.divisions = this.divisions.filter((d: CountryDivision) => d.iso === iso.iso2);
|
|
32
|
+
});
|
|
33
|
+
return
|
|
26
34
|
}
|
|
27
35
|
|
|
28
36
|
static iso1ToCountryIso(iso1: string): CountryISO {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Region } from '../../_enums/region.enum';
|
|
2
2
|
import { SubRegion } from '../../_enums/sub-region.enum';
|
|
3
|
+
import { CountryDivision } from './country-division';
|
|
3
4
|
|
|
4
5
|
export interface CountryISO {
|
|
5
6
|
name: string;
|
|
@@ -13,4 +14,6 @@ export interface CountryISO {
|
|
|
13
14
|
subRegionCode: string;
|
|
14
15
|
subdivisionRegion: string;
|
|
15
16
|
subdivisionRegionCode: string;
|
|
17
|
+
phoneCode?: string;
|
|
18
|
+
divisions?: CountryDivision[];
|
|
16
19
|
}
|
package/src/_models/index.ts
CHANGED
|
@@ -14,8 +14,8 @@ export * from './control-models/dynamo-usage-data';
|
|
|
14
14
|
export * from './control-models/geo-ip-location';
|
|
15
15
|
export * from './control-models/location-coordinates';
|
|
16
16
|
export * from './control-models/random-weight';
|
|
17
|
-
export * from './control-models/
|
|
18
|
-
export * from './control-models/
|
|
17
|
+
export * from './control-models/division-collection';
|
|
18
|
+
export * from './control-models/division-region-data';
|
|
19
19
|
// Data models
|
|
20
20
|
export * from './data-models/dynamo-custom-data';
|
|
21
21
|
export * from './data-models/dynamo-metadata';
|
|
File without changes
|
|
File without changes
|