@futdevpro/fsm-dynamo 1.9.9 → 1.9.12
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/.github/workflows/main.yml +196 -0
- package/HOWTO.md +15 -15
- package/README.md +17 -17
- package/build/_collections/constants/country-divisions.const.d.ts +1 -1
- package/build/_collections/constants/country-divisions.const.d.ts.map +1 -1
- package/build/_collections/constants/country-divisions.const.js +2 -2
- package/build/_collections/constants/country-divisions.const.js.map +1 -1
- package/build/_collections/constants/courtry-isos.const.d.ts +1 -1
- package/build/_collections/constants/courtry-isos.const.d.ts.map +1 -1
- package/build/_collections/constants/courtry-isos.const.js +2 -2
- package/build/_collections/constants/courtry-isos.const.js.map +1 -1
- package/build/_collections/constants/error-defaults.const.d.ts +1 -1
- package/build/_collections/constants/error-defaults.const.d.ts.map +1 -1
- package/build/_collections/constants/module-settings/usage-module-settings.const.js +1 -1
- package/build/_collections/constants/pipe-transforms.const.js +12 -12
- package/build/_collections/constants/pipe-transforms.const.js.map +1 -1
- package/build/_collections/utils/pipe-transforms/division-pipe.util.js +1 -1
- package/build/_collections/utils/pipe-transforms/division-pipe.util.js.map +1 -1
- package/build/_collections/utils/pipe-transforms/list-pipe.util.d.ts.map +1 -1
- package/build/_collections/utils/pipe-transforms/list-pipe.util.js.map +1 -1
- package/build/_collections/utils/pipe-transforms/range-pipe.util.d.ts +2 -2
- package/build/_collections/utils/pipe-transforms/range-pipe.util.d.ts.map +1 -1
- package/build/_collections/utils/pipe-transforms/range-pipe.util.js +11 -11
- package/build/_collections/utils/pipe-transforms/range-pipe.util.js.map +1 -1
- package/build/_collections/utils/regions.util.d.ts.map +1 -1
- package/build/_collections/utils/regions.util.js +3 -0
- package/build/_collections/utils/regions.util.js.map +1 -1
- package/build/_enums/range-pipe-setting.enum.d.ts +1 -1
- package/build/_enums/range-pipe-setting.enum.d.ts.map +1 -1
- package/build/_enums/range-pipe-setting.enum.js +12 -12
- package/build/_enums/range-pipe-setting.enum.js.map +1 -1
- package/build/_models/control-models/error.control-model.js +1 -1
- package/build/_models/control-models/error.control-model.js.map +1 -1
- package/build/_models/control-models/error.control-model.spec.js +25 -6
- package/build/_models/control-models/error.control-model.spec.js.map +1 -1
- package/build/_models/interfaces/index.d.ts +3 -0
- package/build/_models/interfaces/index.d.ts.map +1 -1
- package/build/_models/interfaces/index.js +3 -0
- package/build/_models/interfaces/index.js.map +1 -1
- package/build/_models/interfaces/pipe-transforms.interface.d.ts +2 -2
- package/build/_models/interfaces/pipe-transforms.interface.d.ts.map +1 -1
- package/futdevpro-fsm-dynamo-01.09.12.tgz +0 -0
- package/nodemon.json +11 -11
- package/package.json +151 -151
- package/src/_collections/assets/location/country-codes-ISO-3166.json +3239 -3239
- package/src/_collections/assets/location/country-divisions-ISO-3166-all-list.json +19035 -19035
- package/src/_collections/assets/location/country-divisions-ISO-3166.json +4993 -4993
- package/src/_collections/assets/location/country-phone-codes.json +1203 -1203
- package/src/_collections/constants/country-divisions.const.ts +9 -9
- package/src/_collections/constants/courtry-isos.const.ts +8 -8
- package/src/_collections/constants/error-defaults.const.ts +11 -11
- package/src/_collections/constants/index.ts +15 -15
- package/src/_collections/constants/module-settings/custom-data-module-settings.const.ts +15 -15
- package/src/_collections/constants/module-settings/index.ts +8 -8
- package/src/_collections/constants/module-settings/test-module-settings.const.ts +19 -19
- package/src/_collections/constants/module-settings/usage-module-settings.const.ts +19 -19
- package/src/_collections/constants/pipe-transforms.const.ts +35 -35
- package/src/_collections/constants/times.const.ts +8 -8
- package/src/_collections/index.ts +6 -6
- package/src/_collections/utils/array.util.spec.ts +39 -39
- package/src/_collections/utils/array.util.ts +137 -137
- package/src/_collections/utils/index.ts +18 -18
- package/src/_collections/utils/location.util.ts +55 -55
- package/src/_collections/utils/log.util.ts +239 -239
- package/src/_collections/utils/math/box-bounds.util.ts +85 -85
- package/src/_collections/utils/math/index.ts +5 -5
- package/src/_collections/utils/math/math.util.ts +53 -53
- package/src/_collections/utils/math/random.util.ts +80 -80
- package/src/_collections/utils/math/trigonometry.util.ts +73 -73
- package/src/_collections/utils/math/vector2.util.ts +197 -197
- package/src/_collections/utils/pipe-transforms/country-pipe.util.ts +18 -18
- package/src/_collections/utils/pipe-transforms/custom-pipe.util.ts +9 -9
- package/src/_collections/utils/pipe-transforms/division-pipe.util.ts +20 -20
- package/src/_collections/utils/pipe-transforms/index.ts +15 -15
- package/src/_collections/utils/pipe-transforms/list-pipe.util.ts +10 -14
- package/src/_collections/utils/pipe-transforms/multi-pipe-pipe.util.ts +160 -160
- package/src/_collections/utils/pipe-transforms/obj-key-pipe.util.ts +9 -9
- package/src/_collections/utils/pipe-transforms/range-pipe.util.ts +94 -94
- package/src/_collections/utils/pipe-transforms/region-pipe.util.ts +18 -18
- package/src/_collections/utils/pipe-transforms/replace-pipe.util.ts +11 -11
- package/src/_collections/utils/pipe-transforms/slider-pipe.util.ts +20 -20
- package/src/_collections/utils/pipe-transforms/smart-replace-pipe.util.ts +71 -71
- package/src/_collections/utils/regex/index.ts +4 -4
- package/src/_collections/utils/regex/password-regex.util.ts +52 -52
- package/src/_collections/utils/regex/regex.util.ts +6 -6
- package/src/_collections/utils/regex/username-regex.util.ts +33 -33
- package/src/_collections/utils/regions.util.ts +100 -97
- package/src/_collections/utils/round-list.util.ts +44 -44
- package/src/_collections/utils/shared.static-service.ts +177 -177
- package/src/_collections/utils/time.util.spec.ts +50 -50
- package/src/_collections/utils/time.util.ts +219 -219
- package/src/_collections/utils/type-cloning-facility.util.ts +121 -121
- package/src/_collections/utils/utilities.util.ts +130 -130
- package/src/_enums/basic-property-type.enum.ts +9 -9
- package/src/_enums/data-model-type.enum.ts +13 -13
- package/src/_enums/day-of-week.enum.ts +28 -28
- package/src/_enums/error-level.enum.ts +17 -17
- package/src/_enums/index.ts +16 -16
- package/src/_enums/location/index.ts +3 -3
- package/src/_enums/location/region.enum.ts +9 -9
- package/src/_enums/location/sub-region.enum.ts +26 -26
- package/src/_enums/location/subdivision-region-type.enum.ts +44 -44
- package/src/_enums/log-style.enum.ts +30 -30
- package/src/_enums/month.enum.ts +16 -16
- package/src/_enums/pipe.enum.ts +45 -45
- package/src/_enums/range-pipe-setting.enum.ts +11 -11
- package/src/_enums/time/day-of-week.enum.ts +28 -28
- package/src/_enums/time/index.ts +3 -3
- package/src/_enums/time/month.enum.ts +16 -16
- package/src/_enums/time/relative-date.enum.ts +13 -13
- package/src/_models/control-models/daily-usage-data.control-model.ts +21 -21
- package/src/_models/control-models/data-model-params.control-model.ts +39 -39
- package/src/_models/control-models/data-property-params.control-model.ts +106 -106
- package/src/_models/control-models/error.control-model.spec.ts +753 -716
- package/src/_models/control-models/error.control-model.ts +722 -722
- package/src/_models/control-models/index.ts +10 -10
- package/src/_models/control-models/poll.control-model.ts +113 -113
- package/src/_models/control-models/range-value.control-model.ts +142 -142
- package/src/_models/control-models/usage-action.control-model.ts +15 -15
- package/src/_models/control-models/usage-data.control-model.ts +20 -20
- package/src/_models/data-models/custom-data.data-model.ts +28 -28
- package/src/_models/data-models/index.ts +5 -5
- package/src/_models/data-models/metadata.data-model.ts +83 -83
- package/src/_models/data-models/usage-session.data-model.ts +53 -53
- package/src/_models/index.ts +12 -12
- package/src/_models/interfaces/error-defaults.interface.ts +11 -11
- package/src/_models/interfaces/index.ts +11 -8
- package/src/_models/interfaces/location/country-division.interface.ts +7 -7
- package/src/_models/interfaces/location/country-iso.interface.ts +21 -21
- package/src/_models/interfaces/location/country-phone-code.interface.ts +7 -7
- package/src/_models/interfaces/location/division-collection.interface.ts +10 -10
- package/src/_models/interfaces/location/division-region-data.interface.ts +8 -8
- package/src/_models/interfaces/location/geo-ip-location.interface.ts +26 -26
- package/src/_models/interfaces/location/index.ts +10 -10
- package/src/_models/interfaces/location/location-coordinates.interface.ts +5 -5
- package/src/_models/interfaces/multi-pipe-settings.type.ts +7 -7
- package/src/_models/interfaces/paged.interface.ts +11 -11
- package/src/_models/interfaces/pipe-transforms.interface.ts +29 -29
- package/src/_models/interfaces/random-weight.interface.ts +7 -7
- package/src/_models/interfaces/route-settings.interface.ts +11 -11
- package/src/_modules/collections.index.ts +2 -2
- package/src/_modules/constants.index.ts +2 -2
- package/src/_modules/custom-data-module.index.ts +6 -6
- package/src/_modules/data-modules.index.ts +9 -9
- package/src/_modules/enums.index.ts +2 -2
- package/src/_modules/error-module.index.ts +8 -8
- package/src/_modules/location.index.ts +15 -15
- package/src/_modules/models.index.ts +2 -2
- package/src/_modules/shared-service.index.ts +9 -9
- package/src/_modules/test-module.index.ts +5 -5
- package/src/_modules/usage-module.index.ts +10 -10
- package/tsconfig.json +29 -29
- package/tslint.json +153 -153
- package/build/_enums/region.enum.d.ts +0 -8
- package/build/_enums/region.enum.d.ts.map +0 -1
- package/build/_enums/region.enum.js +0 -12
- package/build/_enums/region.enum.js.map +0 -1
- package/build/_enums/relative-date.enum.d.ts +0 -9
- package/build/_enums/relative-date.enum.d.ts.map +0 -1
- package/build/_enums/relative-date.enum.js +0 -13
- package/build/_enums/relative-date.enum.js.map +0 -1
- package/build/_enums/sub-region.enum.d.ts +0 -20
- package/build/_enums/sub-region.enum.d.ts.map +0 -1
- package/build/_enums/sub-region.enum.js +0 -24
- package/build/_enums/sub-region.enum.js.map +0 -1
- package/build/_enums/subdivision-region-type.enum.d.ts +0 -41
- package/build/_enums/subdivision-region-type.enum.d.ts.map +0 -1
- package/build/_enums/subdivision-region-type.enum.js +0 -46
- package/build/_enums/subdivision-region-type.enum.js.map +0 -1
- package/src/_enums/region.enum.ts +0 -9
- package/src/_enums/relative-date.enum.ts +0 -13
- package/src/_enums/sub-region.enum.ts +0 -26
- package/src/_enums/subdivision-region-type.enum.ts +0 -44
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import { DynamoFM_MultiPipe_Setting } from '../../../_models/interfaces/multi-pipe-settings.type';
|
|
9
|
-
import { DynamoFM_multiPipe_pipeTransform } from './multi-pipe-pipe.util';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Replaces the keys from the replacer with the values from the replacer object.
|
|
14
|
-
*/
|
|
15
|
-
export function DynamoFM_smartReplace_pipeTransform(
|
|
16
|
-
value: string, replacer: object, multiPipes?: DynamoFM_MultiPipe_Setting[]
|
|
17
|
-
): string {
|
|
18
|
-
|
|
19
|
-
if (!replacer) {
|
|
20
|
-
console.warn(
|
|
21
|
-
'DYNAMO WARNING: ' +
|
|
22
|
-
'\nSmartReplacePipe: replaceTo is not defined...',
|
|
23
|
-
'\n\n',
|
|
24
|
-
new Error()
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
return value;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
for (const key in replacer) {
|
|
31
|
-
if (replacer[key]?.value) {
|
|
32
|
-
if (!replacer[key]?.pipes) {
|
|
33
|
-
console.warn(
|
|
34
|
-
'DYNAMO WARNING: ' +
|
|
35
|
-
'\nSmartReplacePipe: replaceTo[' + key + '].multiPipe is not defined...',
|
|
36
|
-
'\n\n',
|
|
37
|
-
new Error()
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
if (!Array.isArray(replacer[key].pipes)) {
|
|
44
|
-
console.warn(
|
|
45
|
-
'DYNAMO WARNING: ' +
|
|
46
|
-
'\nSmartReplacePipe: replaceTo[' + key + '].multiPipe is not an array...',
|
|
47
|
-
'\n\n',
|
|
48
|
-
new Error()
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
replacer[key] = DynamoFM_multiPipe_pipeTransform(
|
|
55
|
-
replacer[key].value,
|
|
56
|
-
replacer[key].pipes
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
if (multiPipes?.length) {
|
|
61
|
-
replacer[key] = DynamoFM_multiPipe_pipeTransform(
|
|
62
|
-
replacer[key],
|
|
63
|
-
multiPipes
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
value = value.replaceAll(`{${key}}`, replacer[key]);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return value;
|
|
71
|
-
}
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
import { DynamoFM_MultiPipe_Setting } from '../../../_models/interfaces/multi-pipe-settings.type';
|
|
9
|
+
import { DynamoFM_multiPipe_pipeTransform } from './multi-pipe-pipe.util';
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Replaces the keys from the replacer with the values from the replacer object.
|
|
14
|
+
*/
|
|
15
|
+
export function DynamoFM_smartReplace_pipeTransform(
|
|
16
|
+
value: string, replacer: object, multiPipes?: DynamoFM_MultiPipe_Setting[]
|
|
17
|
+
): string {
|
|
18
|
+
|
|
19
|
+
if (!replacer) {
|
|
20
|
+
console.warn(
|
|
21
|
+
'DYNAMO WARNING: ' +
|
|
22
|
+
'\nSmartReplacePipe: replaceTo is not defined...',
|
|
23
|
+
'\n\n',
|
|
24
|
+
new Error()
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
return value;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
for (const key in replacer) {
|
|
31
|
+
if (replacer[key]?.value) {
|
|
32
|
+
if (!replacer[key]?.pipes) {
|
|
33
|
+
console.warn(
|
|
34
|
+
'DYNAMO WARNING: ' +
|
|
35
|
+
'\nSmartReplacePipe: replaceTo[' + key + '].multiPipe is not defined...',
|
|
36
|
+
'\n\n',
|
|
37
|
+
new Error()
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (!Array.isArray(replacer[key].pipes)) {
|
|
44
|
+
console.warn(
|
|
45
|
+
'DYNAMO WARNING: ' +
|
|
46
|
+
'\nSmartReplacePipe: replaceTo[' + key + '].multiPipe is not an array...',
|
|
47
|
+
'\n\n',
|
|
48
|
+
new Error()
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
replacer[key] = DynamoFM_multiPipe_pipeTransform(
|
|
55
|
+
replacer[key].value,
|
|
56
|
+
replacer[key].pipes
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (multiPipes?.length) {
|
|
61
|
+
replacer[key] = DynamoFM_multiPipe_pipeTransform(
|
|
62
|
+
replacer[key],
|
|
63
|
+
multiPipes
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
value = value.replaceAll(`{${key}}`, replacer[key]);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return value;
|
|
71
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export * from './password-regex.util';
|
|
4
|
-
export * from './regex.util';
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
export * from './password-regex.util';
|
|
4
|
+
export * from './regex.util';
|
|
5
5
|
export * from './username-regex.util';
|
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
|
|
2
|
-
export const DynamoFM_passwordRegex: RegExp = new RegExp(
|
|
3
|
-
'^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&*]){6,}'
|
|
4
|
-
);
|
|
5
|
-
|
|
6
|
-
/* export const DynamoFM_ALLPasswordRegexUserMessages: string =
|
|
7
|
-
'Password must include at least one lowercase letter. ' +
|
|
8
|
-
'Password must include at least one uppercase letter.' +
|
|
9
|
-
'Password must include at least one digit.' +
|
|
10
|
-
'Password must include at least one of the !@#$%^&* characters.' +
|
|
11
|
-
'Password must be at least 6 characters long.'; */
|
|
12
|
-
|
|
13
|
-
export function DynamoFM_getPasswordErrors(password: string): string[] {
|
|
14
|
-
const errors: string[] = [];
|
|
15
|
-
|
|
16
|
-
DynamoFM_passwordErrorsOneByOne.forEach((error): void => {
|
|
17
|
-
if (!error.regex.test(password)) {
|
|
18
|
-
errors.push(error.message);
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
return errors;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const DynamoFM_passwordErrorsOneByOne = [
|
|
26
|
-
{
|
|
27
|
-
regex: new RegExp('^(?=.*[a-z])'),
|
|
28
|
-
code: 'pwErrorLowercase',
|
|
29
|
-
message: 'Password must include at least one lowercase letter.'
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
regex: new RegExp('^(?=.*[A-Z])'),
|
|
33
|
-
code: 'pwErrorUppercase',
|
|
34
|
-
message: 'Password must include at least one uppercase letter.'
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
regex: new RegExp('^(?=.*[0-9])'),
|
|
38
|
-
code: 'pwErrorDigit',
|
|
39
|
-
message: 'Password must include at least one digit.'
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
regex: new RegExp('^(?=.*[!@#$%^&*])'),
|
|
43
|
-
code: 'pwErrorSpecialChar',
|
|
44
|
-
message: 'Password must include at least one of the !@#$%^&* characters.'
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
regex: new RegExp('^(?=.{6,})'),
|
|
48
|
-
code: 'pwErrorLength',
|
|
49
|
-
message: 'Password must be at least 6 characters long.'
|
|
50
|
-
},
|
|
51
|
-
];
|
|
52
|
-
|
|
1
|
+
|
|
2
|
+
export const DynamoFM_passwordRegex: RegExp = new RegExp(
|
|
3
|
+
'^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&*]){6,}'
|
|
4
|
+
);
|
|
5
|
+
|
|
6
|
+
/* export const DynamoFM_ALLPasswordRegexUserMessages: string =
|
|
7
|
+
'Password must include at least one lowercase letter. ' +
|
|
8
|
+
'Password must include at least one uppercase letter.' +
|
|
9
|
+
'Password must include at least one digit.' +
|
|
10
|
+
'Password must include at least one of the !@#$%^&* characters.' +
|
|
11
|
+
'Password must be at least 6 characters long.'; */
|
|
12
|
+
|
|
13
|
+
export function DynamoFM_getPasswordErrors(password: string): string[] {
|
|
14
|
+
const errors: string[] = [];
|
|
15
|
+
|
|
16
|
+
DynamoFM_passwordErrorsOneByOne.forEach((error): void => {
|
|
17
|
+
if (!error.regex.test(password)) {
|
|
18
|
+
errors.push(error.message);
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
return errors;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const DynamoFM_passwordErrorsOneByOne = [
|
|
26
|
+
{
|
|
27
|
+
regex: new RegExp('^(?=.*[a-z])'),
|
|
28
|
+
code: 'pwErrorLowercase',
|
|
29
|
+
message: 'Password must include at least one lowercase letter.'
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
regex: new RegExp('^(?=.*[A-Z])'),
|
|
33
|
+
code: 'pwErrorUppercase',
|
|
34
|
+
message: 'Password must include at least one uppercase letter.'
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
regex: new RegExp('^(?=.*[0-9])'),
|
|
38
|
+
code: 'pwErrorDigit',
|
|
39
|
+
message: 'Password must include at least one digit.'
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
regex: new RegExp('^(?=.*[!@#$%^&*])'),
|
|
43
|
+
code: 'pwErrorSpecialChar',
|
|
44
|
+
message: 'Password must include at least one of the !@#$%^&* characters.'
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
regex: new RegExp('^(?=.{6,})'),
|
|
48
|
+
code: 'pwErrorLength',
|
|
49
|
+
message: 'Password must be at least 6 characters long.'
|
|
50
|
+
},
|
|
51
|
+
];
|
|
52
|
+
|
|
53
53
|
//'!@#$%^&*+-_<>?.,;:|~'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export const DynamoFM_emailRegex: RegExp = new RegExp(
|
|
4
|
-
'^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+.[a-zA-Z0-9-.]+$'
|
|
5
|
-
);
|
|
6
|
-
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
export const DynamoFM_emailRegex: RegExp = new RegExp(
|
|
4
|
+
'^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+.[a-zA-Z0-9-.]+$'
|
|
5
|
+
);
|
|
6
|
+
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
export const DynamoFM_usernameRegex: RegExp = new RegExp('^[a-zA-Z0-9-_#$%&^|*]{6,}$');
|
|
3
|
-
|
|
4
|
-
/* export const FDP_usernameRegexUserMessage: string =
|
|
5
|
-
'Username must be at least 6 characters long and can only contain letters, ' +
|
|
6
|
-
'numbers, and the following special characters: -_#$%&^|*'; */
|
|
7
|
-
|
|
8
|
-
/* export function getUsernameErrors(username: string): string[] {
|
|
9
|
-
const errors: string[] = [];
|
|
10
|
-
|
|
11
|
-
usernameErrorsOneByOne.forEach((error) => {
|
|
12
|
-
if (!error.regex.test(username)) {
|
|
13
|
-
errors.push(error.message);
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
return errors;
|
|
18
|
-
} */
|
|
19
|
-
|
|
20
|
-
const DynamoFM_usernameErrorsOneByOne = [
|
|
21
|
-
{
|
|
22
|
-
regex: new RegExp('^(?=.{6,})'),
|
|
23
|
-
code: 'usernameErrorLength',
|
|
24
|
-
/* message: 'Username must be at least 6 characters long.' */
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
regex: new RegExp('^(?=.*[a-zA-Z0-9-_#$%&^|*])'),
|
|
28
|
-
code: 'usernameErrorSpecialChar',
|
|
29
|
-
/* message:
|
|
30
|
-
'Username can only contain letters, numbers, and the following special characters: -_#$%&^|*' */
|
|
31
|
-
},
|
|
32
|
-
];
|
|
33
|
-
|
|
1
|
+
|
|
2
|
+
export const DynamoFM_usernameRegex: RegExp = new RegExp('^[a-zA-Z0-9-_#$%&^|*]{6,}$');
|
|
3
|
+
|
|
4
|
+
/* export const FDP_usernameRegexUserMessage: string =
|
|
5
|
+
'Username must be at least 6 characters long and can only contain letters, ' +
|
|
6
|
+
'numbers, and the following special characters: -_#$%&^|*'; */
|
|
7
|
+
|
|
8
|
+
/* export function getUsernameErrors(username: string): string[] {
|
|
9
|
+
const errors: string[] = [];
|
|
10
|
+
|
|
11
|
+
usernameErrorsOneByOne.forEach((error) => {
|
|
12
|
+
if (!error.regex.test(username)) {
|
|
13
|
+
errors.push(error.message);
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
return errors;
|
|
18
|
+
} */
|
|
19
|
+
|
|
20
|
+
const DynamoFM_usernameErrorsOneByOne = [
|
|
21
|
+
{
|
|
22
|
+
regex: new RegExp('^(?=.{6,})'),
|
|
23
|
+
code: 'usernameErrorLength',
|
|
24
|
+
/* message: 'Username must be at least 6 characters long.' */
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
regex: new RegExp('^(?=.*[a-zA-Z0-9-_#$%&^|*])'),
|
|
28
|
+
code: 'usernameErrorSpecialChar',
|
|
29
|
+
/* message:
|
|
30
|
+
'Username can only contain letters, numbers, and the following special characters: -_#$%&^|*' */
|
|
31
|
+
},
|
|
32
|
+
];
|
|
33
|
+
|
|
@@ -1,97 +1,100 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import * as
|
|
6
|
-
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
} from '../../_models
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
static
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
private static
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
iso.
|
|
48
|
-
(
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
1
|
+
|
|
2
|
+
/* const ISOs = [];
|
|
3
|
+
const PhoneCodes = [];
|
|
4
|
+
const Divisions = []; */
|
|
5
|
+
import * as ISOs from '../assets/location/country-codes-ISO-3166.json';
|
|
6
|
+
|
|
7
|
+
import * as PhoneCodes from '../assets/location/country-phone-codes.json';
|
|
8
|
+
import * as Divisions from '../assets/location/country-divisions-ISO-3166-all-list.json';
|
|
9
|
+
|
|
10
|
+
import { DynamoFM_Region } from '../../_enums/location/region.enum';
|
|
11
|
+
import { DynamoFM_Error } from '../../_models';
|
|
12
|
+
import {
|
|
13
|
+
DynamoFM_CountryPhoneCode
|
|
14
|
+
} from '../../_models/interfaces/location/country-phone-code.interface';
|
|
15
|
+
import { DynamoFM_CountryISO } from '../../_models/interfaces/location/country-iso.interface';
|
|
16
|
+
import { DynamoFM_CountryDivision } from '../../_models/interfaces/location/country-division.interface';
|
|
17
|
+
|
|
18
|
+
import { DynamoFM_JSONListify } from './utilities.util';
|
|
19
|
+
|
|
20
|
+
export type DFM_Regions = DynamoFM_Regions;
|
|
21
|
+
export class DynamoFM_Regions {
|
|
22
|
+
/* static divisions: DivisionCollection = DynamoFM_Regions.getSubdivisionCollection(); */
|
|
23
|
+
static divisions: DynamoFM_CountryDivision[] = DynamoFM_Regions.getAllDivisions();
|
|
24
|
+
static phoneCodes: DynamoFM_CountryPhoneCode[] = DynamoFM_Regions.getAllPhoneCodes();
|
|
25
|
+
static countryISOs: DynamoFM_CountryISO[] = DynamoFM_Regions.getAllCountryISO();
|
|
26
|
+
|
|
27
|
+
private static getAllDivisions(): DynamoFM_CountryDivision[] {
|
|
28
|
+
if (!Divisions) throw new DynamoFM_Error({ message: 'Cannot find ISO-3166 JSON file.' });
|
|
29
|
+
|
|
30
|
+
return DynamoFM_JSONListify(Divisions);
|
|
31
|
+
}
|
|
32
|
+
private static getAllPhoneCodes(): DynamoFM_CountryPhoneCode[] {
|
|
33
|
+
if (!PhoneCodes) throw new DynamoFM_Error({ message: 'Cannot find ISO-3166 JSON file.' });
|
|
34
|
+
|
|
35
|
+
return DynamoFM_JSONListify(PhoneCodes);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/* private static getSubdivisionCollection(): DivisionCollection {
|
|
39
|
+
return Divisions as DivisionCollection;
|
|
40
|
+
} */
|
|
41
|
+
private static getAllCountryISO(): DynamoFM_CountryISO[] {
|
|
42
|
+
if (!ISOs) throw new DynamoFM_Error({ message: 'Cannot find ISO-3166 JSON file.' });
|
|
43
|
+
|
|
44
|
+
const result: DynamoFM_CountryISO[] = DynamoFM_JSONListify(ISOs);
|
|
45
|
+
|
|
46
|
+
result.forEach((iso: DynamoFM_CountryISO): void => {
|
|
47
|
+
iso.phoneCode = this.phoneCodes.find(
|
|
48
|
+
(pc: DynamoFM_CountryPhoneCode): boolean => pc.iso === iso.iso2
|
|
49
|
+
)?.code;
|
|
50
|
+
iso.divisions = this.divisions.filter(
|
|
51
|
+
(d: DynamoFM_CountryDivision): boolean => d.iso === iso.iso2
|
|
52
|
+
);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
return result;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
static isoToCountryIso(iso2: string): DynamoFM_CountryISO {
|
|
59
|
+
const country: DynamoFM_CountryISO = this.countryISOs.find(
|
|
60
|
+
(iso: DynamoFM_CountryISO): boolean => iso.iso2 == iso2
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
if (!country) {
|
|
64
|
+
throw new DynamoFM_Error({
|
|
65
|
+
message: `Cannot find ISO-3166 code for this: ${iso2}`,
|
|
66
|
+
});
|
|
67
|
+
} else {
|
|
68
|
+
return country;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
static isoToRegion(iso2: string): DynamoFM_Region {
|
|
73
|
+
const region: DynamoFM_Region = this.countryISOs.find(
|
|
74
|
+
(iso: DynamoFM_CountryISO): boolean => iso.iso2 == iso2
|
|
75
|
+
)?.region;
|
|
76
|
+
|
|
77
|
+
if (!region) {
|
|
78
|
+
throw new DynamoFM_Error({
|
|
79
|
+
message: `Cannot find ISO-3166 code for this: ${iso2}`,
|
|
80
|
+
});
|
|
81
|
+
} else {
|
|
82
|
+
return region;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
static isoToPhoneCode(iso2: string): DynamoFM_CountryPhoneCode {
|
|
87
|
+
const phoneCode: DynamoFM_CountryPhoneCode = this.phoneCodes.find(
|
|
88
|
+
(code: DynamoFM_CountryPhoneCode): boolean => code.iso == iso2
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
if (!phoneCode) {
|
|
92
|
+
throw new DynamoFM_Error({
|
|
93
|
+
message: `Cannot find ISO-3166 code for this: ${iso2}`,
|
|
94
|
+
});
|
|
95
|
+
} else {
|
|
96
|
+
return phoneCode;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export type DFM_RoundList = DynamoFM_RoundList;
|
|
4
|
-
export class DynamoFM_RoundList {
|
|
5
|
-
static getOutboundedIndex(listLength: number, outboundIndex: number): number {
|
|
6
|
-
if (!(0 < listLength)) {
|
|
7
|
-
throw new Error('roundListPlusIndex failed. list is empty!');
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
if (outboundIndex < 0) {
|
|
11
|
-
outboundIndex = outboundIndex % listLength;
|
|
12
|
-
outboundIndex = listLength + outboundIndex;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
if (listLength <= outboundIndex) {
|
|
16
|
-
outboundIndex = outboundIndex % listLength;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
return outboundIndex;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
static getIndexOpposite(length: number, oppositeOf: number): number {
|
|
23
|
-
const plusIndex = oppositeOf + Math.round(length / 2);
|
|
24
|
-
const res = this.getOutboundedIndex(length, plusIndex);
|
|
25
|
-
|
|
26
|
-
return res;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
static getListIndex<T>(list: T[], outboundIndex: number): T {
|
|
30
|
-
return list[this.getOutboundedIndex(list.length, outboundIndex)];
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
static getListOpposite<T>(list: T[], oppositeOf: T): T {
|
|
34
|
-
return list[this.getIndexOpposite(list.length, list.indexOf(oppositeOf))];
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
static getLast<T>(list: T[]): T {
|
|
38
|
-
if (0 < list.length) {
|
|
39
|
-
return list[list.length - 1];
|
|
40
|
-
} else {
|
|
41
|
-
return null;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
export type DFM_RoundList = DynamoFM_RoundList;
|
|
4
|
+
export class DynamoFM_RoundList {
|
|
5
|
+
static getOutboundedIndex(listLength: number, outboundIndex: number): number {
|
|
6
|
+
if (!(0 < listLength)) {
|
|
7
|
+
throw new Error('roundListPlusIndex failed. list is empty!');
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
if (outboundIndex < 0) {
|
|
11
|
+
outboundIndex = outboundIndex % listLength;
|
|
12
|
+
outboundIndex = listLength + outboundIndex;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (listLength <= outboundIndex) {
|
|
16
|
+
outboundIndex = outboundIndex % listLength;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return outboundIndex;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
static getIndexOpposite(length: number, oppositeOf: number): number {
|
|
23
|
+
const plusIndex = oppositeOf + Math.round(length / 2);
|
|
24
|
+
const res = this.getOutboundedIndex(length, plusIndex);
|
|
25
|
+
|
|
26
|
+
return res;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
static getListIndex<T>(list: T[], outboundIndex: number): T {
|
|
30
|
+
return list[this.getOutboundedIndex(list.length, outboundIndex)];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
static getListOpposite<T>(list: T[], oppositeOf: T): T {
|
|
34
|
+
return list[this.getIndexOpposite(list.length, list.indexOf(oppositeOf))];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
static getLast<T>(list: T[]): T {
|
|
38
|
+
if (0 < list.length) {
|
|
39
|
+
return list[list.length - 1];
|
|
40
|
+
} else {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|