@futdevpro/fsm-dynamo 1.5.58 → 1.5.60
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/_constants/error-defaults.const.d.ts +3 -0
- package/lib/_constants/error-defaults.const.d.ts.map +1 -0
- package/lib/_constants/error-defaults.const.js +12 -0
- package/lib/_constants/error-defaults.const.js.map +1 -0
- package/lib/_constants/index.d.ts +1 -0
- package/lib/_constants/index.d.ts.map +1 -1
- package/lib/_constants/index.js +1 -0
- package/lib/_constants/index.js.map +1 -1
- package/lib/_enums/basic-property-type.enum.d.ts +1 -1
- package/lib/_enums/basic-property-type.enum.d.ts.map +1 -1
- package/lib/_enums/basic-property-type.enum.js +9 -9
- package/lib/_enums/basic-property-type.enum.js.map +1 -1
- package/lib/_enums/data-model-type.enum.d.ts +1 -1
- package/lib/_enums/data-model-type.enum.d.ts.map +1 -1
- package/lib/_enums/data-model-type.enum.js +7 -7
- package/lib/_enums/data-model-type.enum.js.map +1 -1
- package/lib/_enums/log-style.enum.d.ts +1 -1
- package/lib/_enums/log-style.enum.d.ts.map +1 -1
- package/lib/_enums/log-style.enum.js +27 -27
- package/lib/_enums/log-style.enum.js.map +1 -1
- package/lib/_enums/region.enum.d.ts +1 -1
- package/lib/_enums/region.enum.d.ts.map +1 -1
- package/lib/_enums/region.enum.js +9 -9
- package/lib/_enums/region.enum.js.map +1 -1
- package/lib/_enums/sub-region.enum.d.ts +1 -1
- package/lib/_enums/sub-region.enum.d.ts.map +1 -1
- package/lib/_enums/sub-region.enum.js +21 -21
- package/lib/_enums/sub-region.enum.js.map +1 -1
- package/lib/_enums/subdivision-region-type.enum.d.ts +1 -1
- package/lib/_enums/subdivision-region-type.enum.d.ts.map +1 -1
- package/lib/_enums/subdivision-region-type.enum.js +42 -42
- package/lib/_enums/subdivision-region-type.enum.js.map +1 -1
- package/lib/_models/control-models/data-params.control-model.d.ts +2 -2
- package/lib/_models/control-models/data-params.control-model.d.ts.map +1 -1
- package/lib/_models/control-models/data-params.control-model.js +2 -2
- package/lib/_models/control-models/data-params.control-model.js.map +1 -1
- package/lib/_models/control-models/data-property-params.control-model.d.ts +2 -2
- package/lib/_models/control-models/data-property-params.control-model.d.ts.map +1 -1
- package/lib/_models/control-models/data-property-params.control-model.js +5 -5
- package/lib/_models/control-models/data-property-params.control-model.js.map +1 -1
- package/lib/_models/control-models/error.control-model.d.ts +30 -17
- package/lib/_models/control-models/error.control-model.d.ts.map +1 -1
- package/lib/_models/control-models/error.control-model.js +93 -88
- package/lib/_models/control-models/error.control-model.js.map +1 -1
- package/lib/_models/control-models/error.control-model.spec.d.ts +2 -0
- package/lib/_models/control-models/error.control-model.spec.d.ts.map +1 -0
- package/lib/_models/control-models/error.control-model.spec.js +272 -0
- package/lib/_models/control-models/error.control-model.spec.js.map +1 -0
- package/lib/_models/control-models/poll.control-model.d.ts.map +1 -1
- package/lib/_models/control-models/poll.control-model.js +0 -2
- package/lib/_models/control-models/poll.control-model.js.map +1 -1
- package/lib/_models/data-models/metadata.data-model.d.ts +7 -1
- package/lib/_models/data-models/metadata.data-model.d.ts.map +1 -1
- package/lib/_models/data-models/metadata.data-model.js +39 -3
- package/lib/_models/data-models/metadata.data-model.js.map +1 -1
- package/lib/_models/interfaces/error-defaults.interface.d.ts +9 -0
- package/lib/_models/interfaces/error-defaults.interface.d.ts.map +1 -0
- package/lib/_models/interfaces/error-defaults.interface.js +3 -0
- package/lib/_models/interfaces/error-defaults.interface.js.map +1 -0
- package/lib/_models/interfaces/index.d.ts +1 -0
- package/lib/_models/interfaces/index.d.ts.map +1 -1
- package/lib/_models/interfaces/index.js +1 -0
- package/lib/_models/interfaces/index.js.map +1 -1
- package/lib/_models/interfaces/location/country-iso.interface.d.ts +4 -4
- package/lib/_models/interfaces/location/country-iso.interface.d.ts.map +1 -1
- package/lib/_models/interfaces/location/division-region-data.interface.d.ts +2 -2
- package/lib/_models/interfaces/location/division-region-data.interface.d.ts.map +1 -1
- package/lib/_modules/error-module.index.d.ts +2 -0
- package/lib/_modules/error-module.index.d.ts.map +1 -1
- package/lib/_modules/error-module.index.js +2 -0
- package/lib/_modules/error-module.index.js.map +1 -1
- package/lib/_utils/array.util.d.ts +2 -2
- package/lib/_utils/array.util.d.ts.map +1 -1
- package/lib/_utils/array.util.js +2 -2
- package/lib/_utils/array.util.js.map +1 -1
- package/lib/_utils/log.util.d.ts +5 -3
- package/lib/_utils/log.util.d.ts.map +1 -1
- package/lib/_utils/log.util.js +23 -12
- package/lib/_utils/log.util.js.map +1 -1
- package/lib/_utils/regions.util.d.ts +2 -2
- package/lib/_utils/regions.util.d.ts.map +1 -1
- package/lib/_utils/regions.util.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +154 -90
- package/package.json +1 -1
- package/src/_constants/error-defaults.const.ts +11 -0
- package/src/_constants/index.ts +1 -0
- package/src/_enums/basic-property-type.enum.ts +1 -1
- package/src/_enums/data-model-type.enum.ts +1 -1
- package/src/_enums/log-style.enum.ts +1 -1
- package/src/_enums/region.enum.ts +1 -1
- package/src/_enums/sub-region.enum.ts +1 -1
- package/src/_enums/subdivision-region-type.enum.ts +1 -1
- package/src/_models/control-models/data-params.control-model.ts +4 -4
- package/src/_models/control-models/data-property-params.control-model.ts +7 -7
- package/src/_models/control-models/error.control-model.spec.ts +345 -0
- package/src/_models/control-models/error.control-model.ts +134 -108
- package/src/_models/control-models/poll.control-model.ts +0 -2
- package/src/_models/data-models/metadata.data-model.ts +49 -4
- package/src/_models/interfaces/error-defaults.interface.ts +11 -0
- package/src/_models/interfaces/index.ts +1 -0
- package/src/_models/interfaces/location/country-iso.interface.ts +4 -4
- package/src/_models/interfaces/location/division-region-data.interface.ts +2 -2
- package/src/_modules/error-module.index.ts +2 -0
- package/src/_utils/array.util.ts +4 -4
- package/src/_utils/log.util.ts +30 -17
- package/src/_utils/regions.util.ts +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { Dynamo_Error } from '../control-models';
|
|
2
2
|
|
|
3
3
|
export type D_Metadata = Dynamo_Metadata;
|
|
4
4
|
export type D_MetaD = Dynamo_Metadata;
|
|
@@ -12,14 +12,59 @@ export class Dynamo_Metadata {
|
|
|
12
12
|
__v?: number;
|
|
13
13
|
|
|
14
14
|
constructor(
|
|
15
|
-
set?: Dynamo_Metadata
|
|
15
|
+
set?: Dynamo_Metadata,
|
|
16
|
+
forceInit?: {
|
|
17
|
+
id?: string,
|
|
18
|
+
issuer: string,
|
|
19
|
+
},
|
|
20
|
+
forceUpdate?: {
|
|
21
|
+
throwOnMissingId?: boolean,
|
|
22
|
+
issuer: string,
|
|
23
|
+
},
|
|
16
24
|
){
|
|
17
25
|
if (set) {
|
|
18
26
|
if (!set._id && set._id !== undefined) {
|
|
19
|
-
|
|
27
|
+
set._id = undefined;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
this._id = set._id;
|
|
31
|
+
this.__created = set.__created;
|
|
32
|
+
this.__createdBy = set.__createdBy;
|
|
33
|
+
this.__lastModified = set.__lastModified;
|
|
34
|
+
this.__lastModifiedBy = set.__lastModifiedBy;
|
|
35
|
+
this.__v = set.__v;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (forceInit?.issuer) {
|
|
39
|
+
if (!this._id && forceInit.id) {
|
|
40
|
+
this._id = forceInit.id;
|
|
41
|
+
}
|
|
42
|
+
if (!this.__created) {
|
|
43
|
+
this.__created = new Date();
|
|
20
44
|
}
|
|
45
|
+
if (!this.__createdBy) {
|
|
46
|
+
this.__createdBy = forceInit.issuer;
|
|
47
|
+
}
|
|
48
|
+
if (!this.__lastModified) {
|
|
49
|
+
this.__lastModified = new Date();
|
|
50
|
+
}
|
|
51
|
+
if (!this.__lastModifiedBy) {
|
|
52
|
+
this.__lastModifiedBy = forceInit.issuer;
|
|
53
|
+
}
|
|
54
|
+
if (!this.__v) {
|
|
55
|
+
this.__v = 0;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
21
58
|
|
|
22
|
-
|
|
59
|
+
if (forceUpdate?.issuer) {
|
|
60
|
+
if (!this._id && forceUpdate.throwOnMissingId) {
|
|
61
|
+
throw new Dynamo_Error({
|
|
62
|
+
message: `Dynamo_Metadata.constructor: missing _id`,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
this.__lastModified = new Date();
|
|
66
|
+
this.__lastModifiedBy = forceUpdate.issuer;
|
|
67
|
+
this.__v = this.__v ? this.__v + 1 : 1;
|
|
23
68
|
}
|
|
24
69
|
}
|
|
25
70
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { Dynamo_Region } from '../../../_enums/region.enum';
|
|
4
|
+
import { Dynamo_SubRegion } from '../../../_enums/sub-region.enum';
|
|
5
5
|
import { CountryDivision } from './country-division.interface';
|
|
6
6
|
|
|
7
7
|
export interface CountryISO {
|
|
@@ -10,9 +10,9 @@ export interface CountryISO {
|
|
|
10
10
|
iso3: string;
|
|
11
11
|
countryCode: string;
|
|
12
12
|
fullIso: string;
|
|
13
|
-
region:
|
|
13
|
+
region: Dynamo_Region;
|
|
14
14
|
regionCode: string;
|
|
15
|
-
subRegion:
|
|
15
|
+
subRegion: Dynamo_SubRegion;
|
|
16
16
|
subRegionCode: string;
|
|
17
17
|
subdivisionRegion: string;
|
|
18
18
|
subdivisionRegionCode: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Dynamo_SubdivisionRegionType } from '../../../_enums/subdivision-region-type.enum';
|
|
2
2
|
import { CountryISO } from './country-iso.interface';
|
|
3
3
|
|
|
4
4
|
export interface SubdivisionRegionData extends CountryISO {
|
|
5
|
-
type?:
|
|
5
|
+
type?: Dynamo_SubdivisionRegionType;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
|
package/src/_utils/array.util.ts
CHANGED
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
export type D_Array = Dynamo_Array;
|
|
4
4
|
export class Dynamo_Array {
|
|
5
5
|
|
|
6
|
-
static async asyncForEach<T>(list: T[], func: (element: T, index?: number) => Promise<void>): Promise<void> {
|
|
6
|
+
static async asyncForEach<T>(list: T[], func: (element: T, index?: number, array?: T[]) => Promise<void>): Promise<void> {
|
|
7
7
|
for (let i = 0; i < list.length; i++) {
|
|
8
|
-
await func(list[i], i);
|
|
8
|
+
await func(list[i], i, list);
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
static async asyncMapArray<T, R>(list: T[], mapFunc: (element: T, index?: number) => Promise<R>): Promise<R[]> {
|
|
12
|
+
static async asyncMapArray<T, R>(list: T[], mapFunc: (element: T, index?: number, array?: T[]) => Promise<R>): Promise<R[]> {
|
|
13
13
|
const resultList: R[] = [];
|
|
14
14
|
for (let i = 0; i < list.length; i++) {
|
|
15
|
-
resultList.push(await mapFunc(list[i], i));
|
|
15
|
+
resultList.push(await mapFunc(list[i], i, list));
|
|
16
16
|
}
|
|
17
17
|
return resultList;
|
|
18
18
|
}
|
package/src/_utils/log.util.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { Dynamo_LogStyle } from '../_enums/log-style.enum';
|
|
3
3
|
|
|
4
4
|
/* export class D_Log implements Dynamo_Log {}; */
|
|
5
5
|
export type Dynamo_L = Dynamo_Log;
|
|
@@ -7,34 +7,47 @@ export type D_Log = Dynamo_Log;
|
|
|
7
7
|
export type D_L = Dynamo_Log;
|
|
8
8
|
|
|
9
9
|
export class Dynamo_Log {
|
|
10
|
-
static
|
|
10
|
+
static highlightedLog(message: string, ...optionalParams: any[]): void {
|
|
11
|
+
console.log('\n\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!');
|
|
12
|
+
console.log(message, ...optionalParams);
|
|
13
|
+
console.log('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n');
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
static testLog(message: string, ...optionalParams: any[]): void {
|
|
17
|
+
console.log('\n\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!');
|
|
18
|
+
console.log('TEST');
|
|
19
|
+
console.log(message, ...optionalParams);
|
|
20
|
+
console.log('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n');
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
static setStyle(styles: Dynamo_LogStyle[]): void {
|
|
11
24
|
let styleSets = '';
|
|
12
|
-
styles.forEach((style:
|
|
25
|
+
styles.forEach((style: Dynamo_LogStyle) => {
|
|
13
26
|
styleSets += style;
|
|
14
27
|
});
|
|
15
28
|
console.log(styleSets);
|
|
16
29
|
}
|
|
17
30
|
static resetStyle(): void {
|
|
18
|
-
console.log(
|
|
31
|
+
console.log(Dynamo_LogStyle.reset);
|
|
19
32
|
}
|
|
20
33
|
|
|
21
|
-
static addStyle(input: string, styles:
|
|
34
|
+
static addStyle(input: string, styles: Dynamo_LogStyle[], dontReset?: boolean): string {
|
|
22
35
|
let result = '';
|
|
23
|
-
styles.forEach((style:
|
|
36
|
+
styles.forEach((style: Dynamo_LogStyle) => {
|
|
24
37
|
result += style;
|
|
25
38
|
});
|
|
26
39
|
result += input;
|
|
27
40
|
if (!dontReset) {
|
|
28
|
-
result +=
|
|
41
|
+
result += Dynamo_LogStyle.reset;
|
|
29
42
|
}
|
|
30
43
|
return result;
|
|
31
44
|
}
|
|
32
45
|
|
|
33
46
|
static success(message: string, ...optionalParams: any[]): void {
|
|
34
47
|
if (0 < optionalParams.length) {
|
|
35
|
-
console.log(`${
|
|
48
|
+
console.log(`${Dynamo_LogStyle.green}${Dynamo_LogStyle.bright}${message}`, ...optionalParams, Dynamo_LogStyle.reset);
|
|
36
49
|
} else {
|
|
37
|
-
console.log(`${
|
|
50
|
+
console.log(`${Dynamo_LogStyle.green}${Dynamo_LogStyle.bright}${message}${Dynamo_LogStyle.reset}`);
|
|
38
51
|
}
|
|
39
52
|
}
|
|
40
53
|
/**
|
|
@@ -46,9 +59,9 @@ export class Dynamo_Log {
|
|
|
46
59
|
|
|
47
60
|
static error(message: string, ...optionalParams: any[]): void {
|
|
48
61
|
if (0 < optionalParams.length) {
|
|
49
|
-
console.error(`${
|
|
62
|
+
console.error(`${Dynamo_LogStyle.red}${Dynamo_LogStyle.bright}${message}`, ...optionalParams, Dynamo_LogStyle.reset);
|
|
50
63
|
} else {
|
|
51
|
-
console.error(`${
|
|
64
|
+
console.error(`${Dynamo_LogStyle.red}${Dynamo_LogStyle.bright}${message}${Dynamo_LogStyle.reset}`);
|
|
52
65
|
}
|
|
53
66
|
}
|
|
54
67
|
/**
|
|
@@ -60,9 +73,9 @@ export class Dynamo_Log {
|
|
|
60
73
|
|
|
61
74
|
static warn(message: string, ...optionalParams: any[]): void {
|
|
62
75
|
if (0 < optionalParams.length) {
|
|
63
|
-
console.warn(`${
|
|
76
|
+
console.warn(`${Dynamo_LogStyle.yellow}${Dynamo_LogStyle.bright}${message}`, ...optionalParams, Dynamo_LogStyle.reset);
|
|
64
77
|
} else {
|
|
65
|
-
console.warn(`${
|
|
78
|
+
console.warn(`${Dynamo_LogStyle.yellow}${Dynamo_LogStyle.bright}${message}${Dynamo_LogStyle.reset}`);
|
|
66
79
|
}
|
|
67
80
|
}
|
|
68
81
|
/**
|
|
@@ -80,15 +93,15 @@ export class Dynamo_Log {
|
|
|
80
93
|
|
|
81
94
|
static highlighted(message: string, ...optionalParams: any[]): void {
|
|
82
95
|
if (0 < optionalParams.length) {
|
|
83
|
-
console.log(`${
|
|
96
|
+
console.log(`${Dynamo_LogStyle.white}${Dynamo_LogStyle.bright}${message}`, ...optionalParams, Dynamo_LogStyle.reset);
|
|
84
97
|
} else {
|
|
85
|
-
console.log(`${
|
|
98
|
+
console.log(`${Dynamo_LogStyle.white}${Dynamo_LogStyle.bright}${message}${Dynamo_LogStyle.reset}`);
|
|
86
99
|
}
|
|
87
100
|
}
|
|
88
101
|
|
|
89
102
|
static removeLogStyles(message: string): string {
|
|
90
|
-
for (let styleKey of Object(
|
|
91
|
-
message = message.replace(new RegExp(
|
|
103
|
+
for (let styleKey of Object(Dynamo_LogStyle)) {
|
|
104
|
+
message = message.replace(new RegExp(Dynamo_LogStyle[styleKey], 'g'), '');
|
|
92
105
|
}
|
|
93
106
|
return message;
|
|
94
107
|
}
|
|
@@ -4,7 +4,7 @@ import * as ISOs from '../_constants/location/country-codes-ISO-3166.json';
|
|
|
4
4
|
import * as PhoneCodes from '../_constants/location/country-phone-codes.json';
|
|
5
5
|
import * as Divisions from '../_constants/location/country-divisions-ISO-3166-all-list.json';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { Dynamo_Region } from '../_enums/region.enum';
|
|
8
8
|
import { Dynamo_Error } from '../_models';
|
|
9
9
|
import { CountryPhoneCode } from '../_models/interfaces/location/country-phone-code.interface';
|
|
10
10
|
import { CountryISO } from '../_models/interfaces/location/country-iso.interface';
|
|
@@ -48,8 +48,8 @@ export class Dynamo_Regions {
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
static isoToRegion(iso2: string):
|
|
52
|
-
const region:
|
|
51
|
+
static isoToRegion(iso2: string): Dynamo_Region {
|
|
52
|
+
const region: Dynamo_Region = this.ISOs.find(iso => iso.iso2 == iso2).region;
|
|
53
53
|
if (!region) {
|
|
54
54
|
throw new Dynamo_Error({
|
|
55
55
|
message: `Cannot find ISO-3166 code for this: ${iso2}`
|