@futdevpro/fsm-dynamo 1.7.14 → 1.8.2
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 +1 -1
- package/lib/_constants/error-defaults.const.d.ts.map +1 -1
- package/lib/_constants/error-defaults.const.js +2 -2
- package/lib/_constants/error-defaults.const.js.map +1 -1
- package/lib/_constants/module-settings/custom-data-module-settings.const.d.ts +2 -2
- package/lib/_constants/module-settings/custom-data-module-settings.const.d.ts.map +1 -1
- package/lib/_constants/module-settings/custom-data-module-settings.const.js +2 -2
- package/lib/_constants/module-settings/custom-data-module-settings.const.js.map +1 -1
- package/lib/_constants/module-settings/test-module-settings.const.d.ts +2 -2
- package/lib/_constants/module-settings/test-module-settings.const.d.ts.map +1 -1
- package/lib/_constants/module-settings/test-module-settings.const.js +2 -2
- package/lib/_constants/module-settings/test-module-settings.const.js.map +1 -1
- package/lib/_constants/module-settings/usage-module-settings.const.d.ts +2 -2
- package/lib/_constants/module-settings/usage-module-settings.const.d.ts.map +1 -1
- package/lib/_constants/module-settings/usage-module-settings.const.js +2 -2
- package/lib/_constants/module-settings/usage-module-settings.const.js.map +1 -1
- package/lib/_enums/data-model-type.enum.d.ts +10 -3
- package/lib/_enums/data-model-type.enum.d.ts.map +1 -1
- package/lib/_enums/data-model-type.enum.js +10 -3
- package/lib/_enums/data-model-type.enum.js.map +1 -1
- package/lib/_enums/day-of-week.enum.d.ts +3 -2
- package/lib/_enums/day-of-week.enum.d.ts.map +1 -1
- package/lib/_enums/day-of-week.enum.js +4 -3
- package/lib/_enums/day-of-week.enum.js.map +1 -1
- package/lib/_models/control-models/data-model-params.control-model.d.ts +19 -0
- package/lib/_models/control-models/data-model-params.control-model.d.ts.map +1 -0
- package/lib/_models/control-models/data-model-params.control-model.js +30 -0
- package/lib/_models/control-models/data-model-params.control-model.js.map +1 -0
- package/lib/_models/control-models/data-property-params.control-model.d.ts +14 -9
- 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 +16 -7
- package/lib/_models/control-models/data-property-params.control-model.js.map +1 -1
- package/lib/_models/control-models/error.control-model.js +13 -13
- package/lib/_models/control-models/error.control-model.js.map +1 -1
- package/lib/_models/control-models/error.control-model.spec.js +9 -9
- package/lib/_models/control-models/error.control-model.spec.js.map +1 -1
- package/lib/_models/control-models/index.d.ts +1 -1
- package/lib/_models/control-models/index.d.ts.map +1 -1
- package/lib/_models/control-models/index.js +1 -1
- package/lib/_models/control-models/index.js.map +1 -1
- package/lib/_models/control-models/range-value.control-model.d.ts +14 -14
- package/lib/_models/control-models/range-value.control-model.d.ts.map +1 -1
- package/lib/_models/control-models/range-value.control-model.js +3 -3
- package/lib/_models/control-models/range-value.control-model.js.map +1 -1
- package/lib/_models/data-models/custom-data.data-model.d.ts +5 -5
- package/lib/_models/data-models/custom-data.data-model.d.ts.map +1 -1
- package/lib/_models/data-models/custom-data.data-model.js +3 -3
- package/lib/_models/data-models/custom-data.data-model.js.map +1 -1
- package/lib/_models/data-models/metadata.data-model.d.ts +1 -0
- package/lib/_models/data-models/metadata.data-model.d.ts.map +1 -1
- package/lib/_models/data-models/metadata.data-model.js +18 -0
- package/lib/_models/data-models/metadata.data-model.js.map +1 -1
- package/lib/_models/data-models/usage-session.data-model.d.ts +4 -4
- package/lib/_models/data-models/usage-session.data-model.d.ts.map +1 -1
- package/lib/_models/data-models/usage-session.data-model.js +3 -3
- package/lib/_models/data-models/usage-session.data-model.js.map +1 -1
- package/lib/_models/interfaces/location/country-division.interface.d.ts +1 -1
- package/lib/_models/interfaces/location/country-division.interface.d.ts.map +1 -1
- package/lib/_models/interfaces/location/country-iso.interface.d.ts +3 -3
- package/lib/_models/interfaces/location/country-iso.interface.d.ts.map +1 -1
- package/lib/_models/interfaces/location/country-phone-code.interface.d.ts +1 -1
- package/lib/_models/interfaces/location/country-phone-code.interface.d.ts.map +1 -1
- package/lib/_models/interfaces/location/division-collection.interface.d.ts +1 -1
- package/lib/_models/interfaces/location/division-collection.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/_models/interfaces/location/geo-ip-location.interface.d.ts +1 -1
- package/lib/_models/interfaces/location/geo-ip-location.interface.d.ts.map +1 -1
- package/lib/_models/interfaces/location/location-coordinates.interface.d.ts +1 -1
- package/lib/_models/interfaces/location/location-coordinates.interface.d.ts.map +1 -1
- package/lib/_models/interfaces/random-weight.interface.d.ts +1 -1
- package/lib/_models/interfaces/random-weight.interface.d.ts.map +1 -1
- package/lib/_models/interfaces/route-settings.interface.d.ts +3 -3
- package/lib/_models/interfaces/route-settings.interface.d.ts.map +1 -1
- package/lib/_modules/data-modules.index.d.ts +1 -1
- package/lib/_modules/data-modules.index.d.ts.map +1 -1
- package/lib/_modules/data-modules.index.js +1 -1
- package/lib/_modules/data-modules.index.js.map +1 -1
- package/lib/_utils/array.util.d.ts +1 -1
- 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/array.util.spec.js +3 -3
- package/lib/_utils/array.util.spec.js.map +1 -1
- package/lib/_utils/box-bounds.util.d.ts +13 -12
- package/lib/_utils/box-bounds.util.d.ts.map +1 -1
- package/lib/_utils/box-bounds.util.js +10 -7
- package/lib/_utils/box-bounds.util.js.map +1 -1
- package/lib/_utils/location.util.d.ts +2 -2
- package/lib/_utils/location.util.d.ts.map +1 -1
- package/lib/_utils/location.util.js.map +1 -1
- package/lib/_utils/metadata.util.d.ts +1 -4
- package/lib/_utils/metadata.util.d.ts.map +1 -1
- package/lib/_utils/metadata.util.js +27 -20
- package/lib/_utils/metadata.util.js.map +1 -1
- package/lib/_utils/random.util.d.ts +3 -3
- package/lib/_utils/random.util.d.ts.map +1 -1
- package/lib/_utils/random.util.js.map +1 -1
- package/lib/_utils/regex/password-regex.util.d.ts +1 -1
- package/lib/_utils/regex/password-regex.util.d.ts.map +1 -1
- package/lib/_utils/regex/password-regex.util.js +3 -3
- package/lib/_utils/regex/password-regex.util.js.map +1 -1
- package/lib/_utils/regex/username-regex.util.d.ts +1 -1
- package/lib/_utils/regex/username-regex.util.d.ts.map +1 -1
- package/lib/_utils/regex/username-regex.util.js +2 -2
- package/lib/_utils/regex/username-regex.util.js.map +1 -1
- package/lib/_utils/regex.util.d.ts +1 -1
- package/lib/_utils/regex.util.d.ts.map +1 -1
- package/lib/_utils/regex.util.js +2 -2
- package/lib/_utils/regex.util.js.map +1 -1
- package/lib/_utils/regions.util.d.ts +8 -8
- package/lib/_utils/regions.util.d.ts.map +1 -1
- package/lib/_utils/regions.util.js +3 -3
- package/lib/_utils/regions.util.js.map +1 -1
- package/lib/_utils/shared.static-service.js +5 -5
- package/lib/_utils/shared.static-service.js.map +1 -1
- package/lib/_utils/time.util.d.ts +7 -0
- package/lib/_utils/time.util.d.ts.map +1 -1
- package/lib/_utils/time.util.js +7 -0
- package/lib/_utils/time.util.js.map +1 -1
- package/lib/_utils/utilities.util.d.ts +24 -12
- package/lib/_utils/utilities.util.d.ts.map +1 -1
- package/lib/_utils/utilities.util.js +34 -22
- package/lib/_utils/utilities.util.js.map +1 -1
- package/lib/_utils/vector2.util.d.ts +45 -43
- package/lib/_utils/vector2.util.d.ts.map +1 -1
- package/lib/_utils/vector2.util.js +47 -37
- package/lib/_utils/vector2.util.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -1
- package/src/_constants/error-defaults.const.ts +1 -1
- package/src/_constants/module-settings/custom-data-module-settings.const.ts +2 -2
- package/src/_constants/module-settings/test-module-settings.const.ts +2 -2
- package/src/_constants/module-settings/usage-module-settings.const.ts +2 -2
- package/src/_enums/data-model-type.enum.ts +10 -3
- package/src/_enums/day-of-week.enum.ts +3 -2
- package/src/_models/control-models/data-model-params.control-model.ts +39 -0
- package/src/_models/control-models/data-property-params.control-model.ts +23 -9
- package/src/_models/control-models/error.control-model.spec.ts +10 -10
- package/src/_models/control-models/error.control-model.ts +14 -14
- package/src/_models/control-models/index.ts +1 -1
- package/src/_models/control-models/range-value.control-model.ts +17 -16
- package/src/_models/data-models/custom-data.data-model.ts +6 -6
- package/src/_models/data-models/metadata.data-model.ts +24 -0
- package/src/_models/data-models/usage-session.data-model.ts +5 -5
- package/src/_models/interfaces/location/country-division.interface.ts +1 -1
- package/src/_models/interfaces/location/country-iso.interface.ts +3 -3
- package/src/_models/interfaces/location/country-phone-code.interface.ts +1 -1
- package/src/_models/interfaces/location/division-collection.interface.ts +1 -1
- package/src/_models/interfaces/location/division-region-data.interface.ts +2 -2
- package/src/_models/interfaces/location/geo-ip-location.interface.ts +1 -1
- package/src/_models/interfaces/location/location-coordinates.interface.ts +1 -1
- package/src/_models/interfaces/random-weight.interface.ts +1 -1
- package/src/_models/interfaces/route-settings.interface.ts +3 -3
- package/src/_modules/data-modules.index.ts +1 -1
- package/src/_utils/array.util.spec.ts +4 -4
- package/src/_utils/array.util.ts +2 -2
- package/src/_utils/box-bounds.util.ts +24 -20
- package/src/_utils/location.util.ts +3 -3
- package/src/_utils/metadata.util.ts +2 -1
- package/src/_utils/random.util.ts +3 -3
- package/src/_utils/regex/password-regex.util.ts +1 -1
- package/src/_utils/regex/username-regex.util.ts +1 -1
- package/src/_utils/regex.util.ts +3 -1
- package/src/_utils/regions.util.ts +22 -22
- package/src/_utils/shared.static-service.ts +6 -6
- package/src/_utils/time.util.ts +9 -1
- package/src/_utils/utilities.util.ts +25 -13
- package/src/_utils/vector2.util.ts +85 -73
- package/lib/_models/control-models/data-params.control-model.d.ts +0 -13
- package/lib/_models/control-models/data-params.control-model.d.ts.map +0 -1
- package/lib/_models/control-models/data-params.control-model.js +0 -23
- package/lib/_models/control-models/data-params.control-model.js.map +0 -1
- package/src/_models/control-models/data-params.control-model.ts +0 -27
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
|
|
2
|
+
import { Dynamo_DataModelType } from '../../_enums';
|
|
3
|
+
import { Dynamo_Metadata } from '../data-models';
|
|
4
|
+
import { Dynamo_DataProperty_Params } from './data-property-params.control-model';
|
|
5
|
+
|
|
6
|
+
export type D_Data_S = Dynamo_DataModel_Settings;
|
|
7
|
+
export type D_Data_Settings = Dynamo_DataModel_Settings;
|
|
8
|
+
export class Dynamo_DataModel_Settings extends Dynamo_Metadata {
|
|
9
|
+
dataName: string;
|
|
10
|
+
modelType?: Dynamo_DataModelType;
|
|
11
|
+
dbName?: string;
|
|
12
|
+
properties?: Dynamo_DataProperty_Params[];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type D_Data_P = Dynamo_DataModel_Params;
|
|
16
|
+
export type D_Data_Params = Dynamo_DataModel_Params;
|
|
17
|
+
export class Dynamo_DataModel_Params extends Dynamo_DataModel_Settings {
|
|
18
|
+
|
|
19
|
+
properties?: Dynamo_DataProperty_Params[] = [];
|
|
20
|
+
|
|
21
|
+
constructor(
|
|
22
|
+
set: Dynamo_DataModel_Settings
|
|
23
|
+
) {
|
|
24
|
+
super(set);
|
|
25
|
+
|
|
26
|
+
if (!set?.modelType || set?.modelType == Dynamo_DataModelType.data) {
|
|
27
|
+
set.modelType = Dynamo_DataModelType.data;
|
|
28
|
+
set.dbName = set.dataName.charAt(0).toUpperCase() + set.dataName.slice(1);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (set) {
|
|
32
|
+
Object.assign(this, set);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
constructed?(): boolean {
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import { Dynamo_BasicPropertyType } from '../../_enums/basic-property-type.enum';
|
|
2
2
|
|
|
3
|
-
export
|
|
4
|
-
export type D_DPropPs = Dynamo_DataPropertyParams;
|
|
5
|
-
/**
|
|
6
|
-
* This will be used for setting up db.
|
|
7
|
-
* DataServices also uses this to prehook tools, as db service and dependency db service.
|
|
8
|
-
*/
|
|
9
|
-
export class Dynamo_DataPropertyParams {
|
|
3
|
+
export class Dynamo_DataProperty_Settings {
|
|
10
4
|
key: string;
|
|
11
5
|
type: Dynamo_BasicPropertyType | string;
|
|
12
6
|
|
|
@@ -28,13 +22,29 @@ export class Dynamo_DataPropertyParams {
|
|
|
28
22
|
minlength?: number;
|
|
29
23
|
maxlength?: number;
|
|
30
24
|
|
|
31
|
-
subObjectParams?:
|
|
25
|
+
subObjectParams?: Dynamo_DataProperty_Params[];
|
|
26
|
+
|
|
27
|
+
additionalValidators?: ((data: any/* : T[K] */) => void)[];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
export type D_DataPropertyParams = Dynamo_DataProperty_Params;
|
|
32
|
+
export type D_DPropPs = Dynamo_DataProperty_Params;
|
|
33
|
+
/**
|
|
34
|
+
* This will be used for setting up db.
|
|
35
|
+
* DataServices also uses this to prehook tools, as db service and dependency db service.
|
|
36
|
+
*/
|
|
37
|
+
export class Dynamo_DataProperty_Params extends Dynamo_DataProperty_Settings {
|
|
38
|
+
|
|
39
|
+
subObjectParams?: Dynamo_DataProperty_Params[] = [];
|
|
32
40
|
|
|
33
41
|
additionalValidators?: ((data: any/* : T[K] */) => void)[] = [];
|
|
34
42
|
|
|
35
43
|
constructor(
|
|
36
|
-
set:
|
|
44
|
+
set: Dynamo_DataProperty_Settings
|
|
37
45
|
) {
|
|
46
|
+
super();
|
|
47
|
+
|
|
38
48
|
if (set) {
|
|
39
49
|
if (!set.key || !set.type) {
|
|
40
50
|
console.log(
|
|
@@ -63,6 +73,10 @@ export class Dynamo_DataPropertyParams {
|
|
|
63
73
|
}
|
|
64
74
|
}
|
|
65
75
|
|
|
76
|
+
constructed?(): boolean {
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
|
|
66
80
|
// tslint:disable-next-line: ban-types
|
|
67
81
|
getBEType?(): String | Number | Boolean | Object | Function | Array<any> | Date {
|
|
68
82
|
switch (this.type) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { Dynamo_error_defaults } from '../../_constants/error-defaults.const';
|
|
4
4
|
import { Dynamo_Log } from '../../_utils/log.util';
|
|
5
5
|
import { Dynamo_Error } from './error.control-model';
|
|
6
6
|
|
|
@@ -16,7 +16,7 @@ describe('Dynamo_Error;', (): void => {
|
|
|
16
16
|
const message_base: string = '-TEST ERROR: something failed!-';
|
|
17
17
|
const message_1: string = 'TEST ERROR MSG (1)';
|
|
18
18
|
const message_2: string = 'TEST ERROR MSG (2)';
|
|
19
|
-
const message_selfDefined: string =
|
|
19
|
+
const message_selfDefined: string = Dynamo_error_defaults.message +
|
|
20
20
|
'; error.control-model.spec.js:78:29)';
|
|
21
21
|
|
|
22
22
|
const errorCode_0: string = 'ASD-ASD-001';
|
|
@@ -159,7 +159,7 @@ describe('Dynamo_Error;', (): void => {
|
|
|
159
159
|
});
|
|
160
160
|
|
|
161
161
|
it('on self defined error', (): void => {
|
|
162
|
-
expect(error_selfDefined._errorCode).toBe(
|
|
162
|
+
expect(error_selfDefined._errorCode).toBe(Dynamo_error_defaults.errorCode);
|
|
163
163
|
});
|
|
164
164
|
});
|
|
165
165
|
|
|
@@ -177,7 +177,7 @@ describe('Dynamo_Error;', (): void => {
|
|
|
177
177
|
});
|
|
178
178
|
|
|
179
179
|
it('on self defined error', (): void => {
|
|
180
|
-
expect(error_selfDefined._errorCodes).toEqual([
|
|
180
|
+
expect(error_selfDefined._errorCodes).toEqual([ Dynamo_error_defaults.errorCode ]);
|
|
181
181
|
});
|
|
182
182
|
});
|
|
183
183
|
|
|
@@ -242,18 +242,18 @@ describe('Dynamo_Error;', (): void => {
|
|
|
242
242
|
|
|
243
243
|
it('on error_stack_1', (): void => {
|
|
244
244
|
expect(error_stack_1.__userMessages).toEqual(
|
|
245
|
-
[ userMessageResult_0,
|
|
245
|
+
[ userMessageResult_0, Dynamo_error_defaults.userMessage ]
|
|
246
246
|
);
|
|
247
247
|
});
|
|
248
248
|
|
|
249
249
|
it('on error_stack_2', (): void => {
|
|
250
250
|
expect(error_stack_2.__userMessages).toEqual(
|
|
251
|
-
[ userMessageResult_0,
|
|
251
|
+
[ userMessageResult_0, Dynamo_error_defaults.userMessage, userMessageResult_2 ]
|
|
252
252
|
);
|
|
253
253
|
});
|
|
254
254
|
|
|
255
255
|
it('on self defined error', (): void => {
|
|
256
|
-
expect(error_selfDefined.__userMessages).toEqual([
|
|
256
|
+
expect(error_selfDefined.__userMessages).toEqual([ Dynamo_error_defaults.userMessage ]);
|
|
257
257
|
});
|
|
258
258
|
});
|
|
259
259
|
|
|
@@ -343,7 +343,7 @@ describe('Dynamo_Error;', (): void => {
|
|
|
343
343
|
});
|
|
344
344
|
|
|
345
345
|
it('on self defined error', (): void => {
|
|
346
|
-
expect(error_selfDefined.___issuer).toBe(
|
|
346
|
+
expect(error_selfDefined.___issuer).toBe(Dynamo_error_defaults.issuer);
|
|
347
347
|
});
|
|
348
348
|
});
|
|
349
349
|
|
|
@@ -379,7 +379,7 @@ describe('Dynamo_Error;', (): void => {
|
|
|
379
379
|
});
|
|
380
380
|
|
|
381
381
|
it('on self defined error', (): void => {
|
|
382
|
-
expect(error_selfDefined.___issuerSystem).toBe(
|
|
382
|
+
expect(error_selfDefined.___issuerSystem).toBe(Dynamo_error_defaults.issuerSystem);
|
|
383
383
|
});
|
|
384
384
|
});
|
|
385
385
|
|
|
@@ -397,7 +397,7 @@ describe('Dynamo_Error;', (): void => {
|
|
|
397
397
|
});
|
|
398
398
|
|
|
399
399
|
it('on self defined error', (): void => {
|
|
400
|
-
expect(error_selfDefined.___issuerService).toBe(
|
|
400
|
+
expect(error_selfDefined.___issuerService).toBe(Dynamo_error_defaults.issuerService);
|
|
401
401
|
});
|
|
402
402
|
});
|
|
403
403
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Dynamo_error_defaults } from '../../_constants/error-defaults.const';
|
|
2
2
|
import { Dynamo_ErrorLevel } from '../../_enums';
|
|
3
3
|
import { Dynamo_Log } from '../../_utils/log.util';
|
|
4
4
|
import { Dynamo_Metadata } from '../data-models/metadata.data-model';
|
|
@@ -120,7 +120,7 @@ export class Dynamo_Error extends Dynamo_Metadata {
|
|
|
120
120
|
{
|
|
121
121
|
issuer: set?.issuerService ??
|
|
122
122
|
(set?.error as Dynamo_Error)?.___issuerService ??
|
|
123
|
-
|
|
123
|
+
Dynamo_error_defaults.issuerService
|
|
124
124
|
}
|
|
125
125
|
);
|
|
126
126
|
|
|
@@ -134,13 +134,13 @@ export class Dynamo_Error extends Dynamo_Metadata {
|
|
|
134
134
|
this.___status = set?.status ?? (set?.error as Dynamo_Error)?.___status;
|
|
135
135
|
this.___issuer = set?.issuer ??
|
|
136
136
|
(set?.error as Dynamo_Error)?.___issuer ??
|
|
137
|
-
|
|
137
|
+
Dynamo_error_defaults.issuer;
|
|
138
138
|
this.___issuerSystem = set?.issuerSystem ??
|
|
139
139
|
(set?.error as Dynamo_Error)?.___issuerSystem ??
|
|
140
|
-
|
|
140
|
+
Dynamo_error_defaults.issuerSystem;
|
|
141
141
|
this.___issuerService = set?.issuerService ??
|
|
142
142
|
(set?.error as Dynamo_Error)?.___issuerService ??
|
|
143
|
-
|
|
143
|
+
Dynamo_error_defaults.issuerService;
|
|
144
144
|
|
|
145
145
|
this.level = set?.level ?? (set?.error as Dynamo_Error)?.level ?? Dynamo_ErrorLevel.error;
|
|
146
146
|
|
|
@@ -150,7 +150,7 @@ export class Dynamo_Error extends Dynamo_Metadata {
|
|
|
150
150
|
|
|
151
151
|
/** set default error code */
|
|
152
152
|
if (!set.errorCode) {
|
|
153
|
-
set.errorCode =
|
|
153
|
+
set.errorCode = Dynamo_error_defaults.errorCode;
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
/** set default error (self defined) */
|
|
@@ -170,7 +170,7 @@ export class Dynamo_Error extends Dynamo_Metadata {
|
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
if (!set.errorCode) {
|
|
173
|
-
set.errorCode =
|
|
173
|
+
set.errorCode = Dynamo_error_defaults.errorCode;
|
|
174
174
|
}
|
|
175
175
|
previousErrorCodes = previousErrorCodes.filter(
|
|
176
176
|
(code: string): boolean => code !== set.errorCode
|
|
@@ -180,7 +180,7 @@ export class Dynamo_Error extends Dynamo_Metadata {
|
|
|
180
180
|
/** bring up non NTS and non default first error */
|
|
181
181
|
const filteredErrorCodes: string[] = this._errorCodes.filter(
|
|
182
182
|
(code: string): boolean =>
|
|
183
|
-
code && code !==
|
|
183
|
+
code && code !== Dynamo_error_defaults.errorCode && !code.includes('NTS-')
|
|
184
184
|
);
|
|
185
185
|
|
|
186
186
|
this._errorCode = filteredErrorCodes[0] ?? this._errorCodes?.[0];
|
|
@@ -200,7 +200,7 @@ export class Dynamo_Error extends Dynamo_Metadata {
|
|
|
200
200
|
/** error not defined - self defining */
|
|
201
201
|
const posFull = (set.error as Error).stack.split('\n')?.[1]?.split('\\');
|
|
202
202
|
|
|
203
|
-
set.message =
|
|
203
|
+
set.message = Dynamo_error_defaults.message + '; ' + posFull[posFull.length - 1];
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
206
|
/** set messages */
|
|
@@ -219,7 +219,7 @@ export class Dynamo_Error extends Dynamo_Metadata {
|
|
|
219
219
|
if (
|
|
220
220
|
-1 < highlightedErrorCodeIndex &&
|
|
221
221
|
this._messages[highlightedErrorCodeIndex] &&
|
|
222
|
-
this._messages[highlightedErrorCodeIndex] !==
|
|
222
|
+
this._messages[highlightedErrorCodeIndex] !== Dynamo_error_defaults.message
|
|
223
223
|
) {
|
|
224
224
|
this._message = this._messages[highlightedErrorCodeIndex];
|
|
225
225
|
} else {
|
|
@@ -234,12 +234,12 @@ export class Dynamo_Error extends Dynamo_Metadata {
|
|
|
234
234
|
}
|
|
235
235
|
|
|
236
236
|
if (!set.userMessage) {
|
|
237
|
-
set.userMessage =
|
|
237
|
+
set.userMessage = Dynamo_error_defaults.userMessage;
|
|
238
238
|
}
|
|
239
239
|
|
|
240
240
|
if (
|
|
241
241
|
set.addECToUserMsg &&
|
|
242
|
-
set.userMessage !==
|
|
242
|
+
set.userMessage !== Dynamo_error_defaults.userMessage &&
|
|
243
243
|
set.errorCode
|
|
244
244
|
) {
|
|
245
245
|
set.userMessage += `\nErrorCode: ${set.errorCode}`;
|
|
@@ -252,12 +252,12 @@ export class Dynamo_Error extends Dynamo_Metadata {
|
|
|
252
252
|
if (
|
|
253
253
|
-1 < highlightedErrorCodeIndex &&
|
|
254
254
|
this.__userMessages[highlightedErrorCodeIndex] &&
|
|
255
|
-
this.__userMessages[highlightedErrorCodeIndex] !==
|
|
255
|
+
this.__userMessages[highlightedErrorCodeIndex] !== Dynamo_error_defaults.userMessage
|
|
256
256
|
) {
|
|
257
257
|
this.__userMessage = this.__userMessages[highlightedErrorCodeIndex];
|
|
258
258
|
} else {
|
|
259
259
|
this.__userMessage = this.__userMessages.filter(
|
|
260
|
-
(msg: string): boolean => msg && msg !==
|
|
260
|
+
(msg: string): boolean => msg && msg !== Dynamo_error_defaults.userMessage
|
|
261
261
|
)?.[0];
|
|
262
262
|
}
|
|
263
263
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
// CONTROL MODELS
|
|
3
3
|
export * from './daily-usage-data.control-model';
|
|
4
|
-
export * from './data-params.control-model';
|
|
4
|
+
export * from './data-model-params.control-model';
|
|
5
5
|
export * from './data-property-params.control-model';
|
|
6
6
|
export * from './error.control-model';
|
|
7
7
|
export * from './poll.control-model';
|
|
@@ -4,9 +4,6 @@ export type D_RangeValue<T> = Dynamo_RangeValue<T>;
|
|
|
4
4
|
export type D_RangeV<T> = Dynamo_RangeValue<T>;
|
|
5
5
|
export class Dynamo_RangeValue<T = number> {
|
|
6
6
|
readonly isRange: boolean = true;
|
|
7
|
-
get constructed(): boolean {
|
|
8
|
-
return true;
|
|
9
|
-
}
|
|
10
7
|
|
|
11
8
|
from: T;
|
|
12
9
|
to: T;
|
|
@@ -25,62 +22,66 @@ export class Dynamo_RangeValue<T = number> {
|
|
|
25
22
|
this.to = to ?? from as T;
|
|
26
23
|
}
|
|
27
24
|
}
|
|
25
|
+
|
|
26
|
+
constructed?(): boolean {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
28
29
|
|
|
29
|
-
newValues(value: Dynamo_RangeValue<T>): void {
|
|
30
|
+
newValues?(value: Dynamo_RangeValue<T>): void {
|
|
30
31
|
this.from = value.from;
|
|
31
32
|
this.to = value.to;
|
|
32
33
|
}
|
|
33
34
|
|
|
34
|
-
addRange(range: Dynamo_RangeValue<number>): void {
|
|
35
|
+
addRange?(range: Dynamo_RangeValue<number>): void {
|
|
35
36
|
(this as Dynamo_RangeValue<number>).from += range.from;
|
|
36
37
|
(this as Dynamo_RangeValue<number>).to += range.to;
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
subtractRange(range: Dynamo_RangeValue<number>): void {
|
|
40
|
+
subtractRange?(range: Dynamo_RangeValue<number>): void {
|
|
40
41
|
(this as Dynamo_RangeValue<number>).from -= range.from;
|
|
41
42
|
(this as Dynamo_RangeValue<number>).to -= range.to;
|
|
42
43
|
}
|
|
43
44
|
|
|
44
|
-
multiplyRange(range: Dynamo_RangeValue<number>): void {
|
|
45
|
+
multiplyRange?(range: Dynamo_RangeValue<number>): void {
|
|
45
46
|
(this as Dynamo_RangeValue<number>).from *= range.from;
|
|
46
47
|
(this as Dynamo_RangeValue<number>).to *= range.to;
|
|
47
48
|
}
|
|
48
49
|
|
|
49
|
-
divideRange(range: Dynamo_RangeValue<number>): void {
|
|
50
|
+
divideRange?(range: Dynamo_RangeValue<number>): void {
|
|
50
51
|
(this as Dynamo_RangeValue<number>).from /= range.from;
|
|
51
52
|
(this as Dynamo_RangeValue<number>).to /= range.to;
|
|
52
53
|
}
|
|
53
54
|
|
|
54
|
-
add(value: number): void {
|
|
55
|
+
add?(value: number): void {
|
|
55
56
|
(this as Dynamo_RangeValue<number>).from += value;
|
|
56
57
|
(this as Dynamo_RangeValue<number>).to += value;
|
|
57
58
|
}
|
|
58
59
|
|
|
59
|
-
subtract(value: number): void {
|
|
60
|
+
subtract?(value: number): void {
|
|
60
61
|
(this as Dynamo_RangeValue<number>).from -= value;
|
|
61
62
|
(this as Dynamo_RangeValue<number>).to -= value;
|
|
62
63
|
}
|
|
63
64
|
|
|
64
|
-
multiply(value: number): void {
|
|
65
|
+
multiply?(value: number): void {
|
|
65
66
|
(this as Dynamo_RangeValue<number>).from *= value;
|
|
66
67
|
(this as Dynamo_RangeValue<number>).to *= value;
|
|
67
68
|
}
|
|
68
69
|
|
|
69
|
-
divide(value: number): void {
|
|
70
|
+
divide?(value: number): void {
|
|
70
71
|
(this as Dynamo_RangeValue<number>).from /= value;
|
|
71
72
|
(this as Dynamo_RangeValue<number>).to /= value;
|
|
72
73
|
}
|
|
73
74
|
|
|
74
|
-
clone(): Dynamo_RangeValue<T> {
|
|
75
|
+
clone?(): Dynamo_RangeValue<T> {
|
|
75
76
|
return new Dynamo_RangeValue<T>(this.from, this.to);
|
|
76
77
|
}
|
|
77
78
|
|
|
78
|
-
applyTransform
|
|
79
|
+
applyTransform?<K = T>(transform: (value: T) => K): Dynamo_RangeValue<K> {
|
|
79
80
|
return new Dynamo_RangeValue<K>(transform(this.from), transform(this.to));
|
|
80
81
|
}
|
|
81
82
|
|
|
82
|
-
toString = this.stringify;
|
|
83
|
-
stringify(spaces: boolean = true, auto: boolean = true): string {
|
|
83
|
+
toString? = this.stringify;
|
|
84
|
+
stringify?(spaces: boolean = true, auto: boolean = true): string {
|
|
84
85
|
if (auto && this.from === this.to) {
|
|
85
86
|
return `${this.from}`;
|
|
86
87
|
} else if (spaces) {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
|
|
2
|
-
import {
|
|
2
|
+
import { Dynamo_DataModel_Params } from '../control-models/data-model-params.control-model';
|
|
3
3
|
import { Dynamo_Metadata } from './metadata.data-model';
|
|
4
4
|
|
|
5
5
|
export type D_CustomData = Dynamo_CustomData;
|
|
6
6
|
export type D_CustomD = Dynamo_CustomData;
|
|
7
|
-
export class Dynamo_CustomData extends Dynamo_Metadata {
|
|
8
|
-
data?:
|
|
7
|
+
export class Dynamo_CustomData<T = any> extends Dynamo_Metadata {
|
|
8
|
+
data?: T;
|
|
9
9
|
|
|
10
10
|
constructor(
|
|
11
|
-
set?: Dynamo_CustomData
|
|
11
|
+
set?: Dynamo_CustomData<T>
|
|
12
12
|
) {
|
|
13
13
|
super(set);
|
|
14
14
|
|
|
@@ -18,9 +18,9 @@ export class Dynamo_CustomData extends Dynamo_Metadata {
|
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
export const customDataModelParams = new
|
|
21
|
+
export const customDataModelParams = new Dynamo_DataModel_Params({
|
|
22
22
|
dataName: 'customData',
|
|
23
|
-
|
|
23
|
+
properties: [
|
|
24
24
|
{ key: 'data', type: 'string', required: true },
|
|
25
25
|
]
|
|
26
26
|
});
|
|
@@ -56,4 +56,28 @@ export class Dynamo_Metadata {
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
+
|
|
60
|
+
static updateMetadata<T extends Dynamo_Metadata>(data: T, issuer: string, id?: string): T {
|
|
61
|
+
if (!data) {
|
|
62
|
+
return data;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (!data._id && id) {
|
|
66
|
+
data._id = id;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (!data.__created) {
|
|
70
|
+
data.__created = new Date();
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (!data.__createdBy) {
|
|
74
|
+
data.__createdBy = issuer;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
data.__lastModified = new Date();
|
|
78
|
+
data.__lastModifiedBy = issuer;
|
|
79
|
+
data.__v = data.__v ? data.__v + 1 : 1;
|
|
80
|
+
|
|
81
|
+
return data;
|
|
82
|
+
}
|
|
59
83
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
2
|
import { Dynamo_Metadata } from './metadata.data-model';
|
|
3
3
|
import { Dynamo_UsageData } from '../control-models/usage-data.control-model';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { Dynamo_DataModel_Params } from '../control-models/data-model-params.control-model';
|
|
5
|
+
import { Dynamo_GeoIpLocation } from '../interfaces/location/geo-ip-location.interface';
|
|
6
6
|
|
|
7
7
|
export type D_UsageSession = Dynamo_UsageSession;
|
|
8
8
|
export class Dynamo_UsageSession extends Dynamo_Metadata {
|
|
@@ -11,7 +11,7 @@ export class Dynamo_UsageSession extends Dynamo_Metadata {
|
|
|
11
11
|
sessionEnd?: Date;
|
|
12
12
|
address?: string;
|
|
13
13
|
issuer?: string;
|
|
14
|
-
locationData?:
|
|
14
|
+
locationData?: Dynamo_GeoIpLocation;
|
|
15
15
|
|
|
16
16
|
usageData?: Dynamo_UsageData[] = [];
|
|
17
17
|
totalSessionTime?: number;
|
|
@@ -32,9 +32,9 @@ export class Dynamo_UsageSession extends Dynamo_Metadata {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
export const usageSessionModelParams = new
|
|
35
|
+
export const usageSessionModelParams = new Dynamo_DataModel_Params({
|
|
36
36
|
dataName: 'usageSession',
|
|
37
|
-
|
|
37
|
+
properties: [
|
|
38
38
|
{ key: 'date', type: 'string',
|
|
39
39
|
required: true, index: true
|
|
40
40
|
},
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
import { Dynamo_Region } from '../../../_enums/region.enum';
|
|
4
4
|
import { Dynamo_SubRegion } from '../../../_enums/sub-region.enum';
|
|
5
|
-
import {
|
|
5
|
+
import { Dynamo_CountryDivision } from './country-division.interface';
|
|
6
6
|
|
|
7
|
-
export interface
|
|
7
|
+
export interface Dynamo_CountryISO {
|
|
8
8
|
name: string;
|
|
9
9
|
iso2: string;
|
|
10
10
|
iso3: string;
|
|
@@ -17,5 +17,5 @@ export interface CountryISO {
|
|
|
17
17
|
subdivisionRegion: string;
|
|
18
18
|
subdivisionRegionCode: string;
|
|
19
19
|
phoneCode?: string;
|
|
20
|
-
divisions?:
|
|
20
|
+
divisions?: Dynamo_CountryDivision[];
|
|
21
21
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Dynamo_SubdivisionRegionType } from '../../../_enums/subdivision-region-type.enum';
|
|
2
|
-
import {
|
|
2
|
+
import { Dynamo_CountryISO } from './country-iso.interface';
|
|
3
3
|
|
|
4
|
-
export interface
|
|
4
|
+
export interface Dynamo_SubdivisionRegionData extends Dynamo_CountryISO {
|
|
5
5
|
type?: Dynamo_SubdivisionRegionType;
|
|
6
6
|
}
|
|
7
7
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
|
-
export type D_RouteSettings =
|
|
3
|
-
export type D_RouteS =
|
|
4
|
-
export interface
|
|
2
|
+
export type D_RouteSettings = Dynamo_Route_Settings;
|
|
3
|
+
export type D_RouteS = Dynamo_Route_Settings;
|
|
4
|
+
export interface Dynamo_Route_Settings {
|
|
5
5
|
mainRoute: string;
|
|
6
6
|
|
|
7
7
|
endPoints: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
// DATA MODULE
|
|
3
3
|
export * from '../_models/data-models/metadata.data-model';
|
|
4
|
-
export * from '../_models/control-models/data-params.control-model';
|
|
4
|
+
export * from '../_models/control-models/data-model-params.control-model';
|
|
5
5
|
export * from '../_models/control-models/data-property-params.control-model';
|
|
6
6
|
export * from '../_models/control-models/error.control-model';
|
|
7
7
|
export * from '../_enums/data-model-type.enum';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
3
|
import { Dynamo_Array } from './array.util';
|
|
4
|
-
import {
|
|
4
|
+
import { Dynamo_delay } from './utilities.util';
|
|
5
5
|
|
|
6
6
|
describe('Dynamo_Array', (): void => {
|
|
7
7
|
|
|
@@ -10,7 +10,7 @@ describe('Dynamo_Array', (): void => {
|
|
|
10
10
|
const list = [1, 2, 3];
|
|
11
11
|
const result = [];
|
|
12
12
|
const func = async (e, i): Promise<void> => {
|
|
13
|
-
await
|
|
13
|
+
await Dynamo_delay(30);
|
|
14
14
|
result.push(e);
|
|
15
15
|
};
|
|
16
16
|
|
|
@@ -25,12 +25,12 @@ describe('Dynamo_Array', (): void => {
|
|
|
25
25
|
const list = [1, 2, 3];
|
|
26
26
|
|
|
27
27
|
const func = async (e, i): Promise<number> => {
|
|
28
|
-
await
|
|
28
|
+
await Dynamo_delay(30);
|
|
29
29
|
|
|
30
30
|
return e * 2;
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
-
const result = await Dynamo_Array.
|
|
33
|
+
const result = await Dynamo_Array.asyncMap(list, func);
|
|
34
34
|
|
|
35
35
|
expect(result).toEqual([2, 4, 6]);
|
|
36
36
|
});
|
package/src/_utils/array.util.ts
CHANGED
|
@@ -13,7 +13,7 @@ export class Dynamo_Array {
|
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
static async
|
|
16
|
+
static async asyncMap<T, R>(
|
|
17
17
|
list: T[],
|
|
18
18
|
mapFunc: (element: T, index?: number, array?: T[]) => Promise<R>
|
|
19
19
|
): Promise<R[]> {
|
|
@@ -27,7 +27,7 @@ export class Dynamo_Array {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
static last<T>(array: T[]): T {
|
|
30
|
-
return array[array.length - 1];
|
|
30
|
+
return array.length ? array[array.length - 1] : null;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
static remove<T>(array: T[], element: T): T[] {
|