@futdevpro/fsm-dynamo 1.11.37 → 1.11.38

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.
Files changed (35) hide show
  1. package/build/_collections/utils/utilities.util.d.ts +5 -0
  2. package/build/_collections/utils/utilities.util.d.ts.map +1 -1
  3. package/build/_collections/utils/utilities.util.js +40 -0
  4. package/build/_collections/utils/utilities.util.js.map +1 -1
  5. package/build/_enums/basic-property-type.enum.d.ts +4 -2
  6. package/build/_enums/basic-property-type.enum.d.ts.map +1 -1
  7. package/build/_enums/basic-property-type.enum.js +3 -1
  8. package/build/_enums/basic-property-type.enum.js.map +1 -1
  9. package/build/_models/control-models/data-model-params.control-model.d.ts.map +1 -1
  10. package/build/_models/control-models/data-model-params.control-model.js +148 -116
  11. package/build/_models/control-models/data-model-params.control-model.js.map +1 -1
  12. package/build/_models/control-models/data-model-params.control-model.spec.js +19 -1
  13. package/build/_models/control-models/data-model-params.control-model.spec.js.map +1 -1
  14. package/build/_models/control-models/data-property-params.control-model.d.ts +3 -2
  15. package/build/_models/control-models/data-property-params.control-model.d.ts.map +1 -1
  16. package/build/_models/control-models/data-property-params.control-model.js +1 -0
  17. package/build/_models/control-models/data-property-params.control-model.js.map +1 -1
  18. package/build/_modules/pipe/_collections/utils/pip-smart-replace-pipe.util.d.ts.map +1 -1
  19. package/build/_modules/pipe/_collections/utils/pip-smart-replace-pipe.util.js +4 -3
  20. package/build/_modules/pipe/_collections/utils/pip-smart-replace-pipe.util.js.map +1 -1
  21. package/build/_modules/pipe/_collections/utils/pip-smart-replace-pipe.util.spec.js +7 -6
  22. package/build/_modules/pipe/_collections/utils/pip-smart-replace-pipe.util.spec.js.map +1 -1
  23. package/build/_modules/usage/_models/usg-session.data-model.spec.js +12 -9
  24. package/build/_modules/usage/_models/usg-session.data-model.spec.js.map +1 -1
  25. package/futdevpro-fsm-dynamo-01.11.38.tgz +0 -0
  26. package/package.json +1 -1
  27. package/src/_collections/utils/utilities.util.ts +45 -0
  28. package/src/_enums/basic-property-type.enum.ts +3 -1
  29. package/src/_models/control-models/data-model-params.control-model.spec.ts +29 -1
  30. package/src/_models/control-models/data-model-params.control-model.ts +178 -141
  31. package/src/_models/control-models/data-property-params.control-model.ts +3 -2
  32. package/src/_modules/pipe/_collections/utils/pip-smart-replace-pipe.util.spec.ts +7 -6
  33. package/src/_modules/pipe/_collections/utils/pip-smart-replace-pipe.util.ts +4 -3
  34. package/src/_modules/usage/_models/usg-session.data-model.spec.ts +12 -9
  35. package/futdevpro-fsm-dynamo-01.11.37.tgz +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"pip-smart-replace-pipe.util.js","sourceRoot":"","sources":["../../../../../src/_modules/pipe/_collections/utils/pip-smart-replace-pipe.util.ts"],"names":[],"mappings":";;AAsBA,0EAwDC;AAtED,yEAA0E;AAG1E;;;;;;;;;;GAUG;AACH,SAAgB,+BAA+B,CAC7C,KAAa,EAAE,QAAgB,EAAE,UAAqC;IAGtE,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,CAAC,IAAI,CACV,kBAAkB;YAClB,iDAAiD,EACjD,MAAM,EACN,IAAI,KAAK,EAAE,CACZ,CAAC;QAEF,OAAO,KAAK,CAAC;IACf,CAAC;IAED,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;QAC3B,IAAI,QAAQ,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC;YACzB,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC;gBAC1B,OAAO,CAAC,IAAI,CACV,kBAAkB;oBAClB,gCAAgC,GAAG,GAAG,GAAG,+BAA+B,EACxE,MAAM,EACN,IAAI,KAAK,EAAE,CACZ,CAAC;gBAEF,OAAO;YACT,CAAC;YAED,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;gBACxC,OAAO,CAAC,IAAI,CACV,kBAAkB;oBAClB,gCAAgC,GAAG,GAAG,GAAG,gCAAgC,EACzE,MAAM,EACN,IAAI,KAAK,EAAE,CACZ,CAAC;gBAEF,OAAO;YACT,CAAC;YAED,QAAQ,CAAC,GAAG,CAAC,GAAG,IAAA,uDAA4B,EAC1C,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAK,EACnB,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAK,CACpB,CAAC;QACJ,CAAC;QAED,IAAI,UAAU,EAAE,MAAM,EAAE,CAAC;YACvB,QAAQ,CAAC,GAAG,CAAC,GAAG,IAAA,uDAA4B,EAC1C,QAAQ,CAAC,GAAG,CAAC,EACb,UAAU,CACX,CAAC;QACJ,CAAC;QAED,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC,IAAI,GAAG,GAAG,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;IACtD,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
1
+ {"version":3,"file":"pip-smart-replace-pipe.util.js","sourceRoot":"","sources":["../../../../../src/_modules/pipe/_collections/utils/pip-smart-replace-pipe.util.ts"],"names":[],"mappings":";;AAuBA,0EAwDC;AAxED,sEAAmE;AAEnE,yEAA0E;AAG1E;;;;;;;;;;GAUG;AACH,SAAgB,+BAA+B,CAC7C,KAAa,EAAE,QAAgB,EAAE,UAAqC;IAGtE,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,mBAAQ,CAAC,IAAI,CACX,kBAAkB;YAClB,iDAAiD,EACjD,MAAM,EACN,IAAI,KAAK,EAAE,CACZ,CAAC;QAEF,OAAO,KAAK,CAAC;IACf,CAAC;IAED,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;QAC3B,IAAI,QAAQ,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC;YACzB,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC;gBAC1B,mBAAQ,CAAC,IAAI,CACX,kBAAkB;oBAClB,gCAAgC,GAAG,GAAG,GAAG,+BAA+B,EACxE,MAAM,EACN,IAAI,KAAK,EAAE,CACZ,CAAC;gBAEF,OAAO;YACT,CAAC;YAED,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;gBACxC,mBAAQ,CAAC,IAAI,CACX,kBAAkB;oBAClB,gCAAgC,GAAG,GAAG,GAAG,gCAAgC,EACzE,MAAM,EACN,IAAI,KAAK,EAAE,CACZ,CAAC;gBAEF,OAAO;YACT,CAAC;YAED,QAAQ,CAAC,GAAG,CAAC,GAAG,IAAA,uDAA4B,EAC1C,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAK,EACnB,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAK,CACpB,CAAC;QACJ,CAAC;QAED,IAAI,UAAU,EAAE,MAAM,EAAE,CAAC;YACvB,QAAQ,CAAC,GAAG,CAAC,GAAG,IAAA,uDAA4B,EAC1C,QAAQ,CAAC,GAAG,CAAC,EACb,UAAU,CACX,CAAC;QACJ,CAAC;QAED,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC,IAAI,GAAG,GAAG,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;IACtD,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const log_util_1 = require("../../../../_collections/utils/log.util");
3
4
  const pip_smart_replace_pipe_util_1 = require("./pip-smart-replace-pipe.util");
4
5
  describe('| DyFM_smartReplace_pipeTransform', () => {
5
6
  it('| should return the original value if replacer is not defined', () => {
@@ -8,25 +9,25 @@ describe('| DyFM_smartReplace_pipeTransform', () => {
8
9
  });
9
10
  it('| should replace keys with values from replacer', () => {
10
11
  const replacer = { name: { value: 'World', pipes: [] } };
11
- spyOn(console, 'warn');
12
+ spyOn(log_util_1.DyFM_Log, 'warn');
12
13
  const result = (0, pip_smart_replace_pipe_util_1.DyFM_smartReplace_pipeTransform)('Hello, {name}!', replacer);
13
14
  expect(result).toBe('Hello, World!');
14
- expect(console.warn).not.toHaveBeenCalled();
15
+ expect(log_util_1.DyFM_Log.warn).not.toHaveBeenCalled();
15
16
  });
16
17
  it('| should warn if replacer key has no pipes', () => {
17
18
  const replacer = { name: { value: 'World' } };
18
- spyOn(console, 'warn');
19
+ spyOn(log_util_1.DyFM_Log, 'warn');
19
20
  const result = (0, pip_smart_replace_pipe_util_1.DyFM_smartReplace_pipeTransform)('Hello, {name}!', replacer);
20
21
  expect(result).toBeUndefined();
21
- expect(console.warn).toHaveBeenCalledWith('DYNAMO WARNING: ' +
22
+ expect(log_util_1.DyFM_Log.warn).toHaveBeenCalledWith('DYNAMO WARNING: ' +
22
23
  '\nSmartReplacePipe: replaceTo[name].multiPipe is not defined...', '\n\n', jasmine.any(Error));
23
24
  });
24
25
  it('| should warn if replacer key pipes is not an array', () => {
25
26
  const replacer = { name: { value: 'World', pipes: 'not-an-array' } };
26
- spyOn(console, 'warn');
27
+ spyOn(log_util_1.DyFM_Log, 'warn');
27
28
  const result = (0, pip_smart_replace_pipe_util_1.DyFM_smartReplace_pipeTransform)('Hello, {name}!', replacer);
28
29
  expect(result).toBeUndefined();
29
- expect(console.warn).toHaveBeenCalledWith('DYNAMO WARNING: ' +
30
+ expect(log_util_1.DyFM_Log.warn).toHaveBeenCalledWith('DYNAMO WARNING: ' +
30
31
  '\nSmartReplacePipe: replaceTo[name].multiPipe is not an array...', '\n\n', jasmine.any(Error));
31
32
  });
32
33
  /* it('| should apply multiPipes if provided', () => {
@@ -1 +1 @@
1
- {"version":3,"file":"pip-smart-replace-pipe.util.spec.js","sourceRoot":"","sources":["../../../../../src/_modules/pipe/_collections/utils/pip-smart-replace-pipe.util.spec.ts"],"names":[],"mappings":";;AACA,+EAAgF;AAEhF,QAAQ,CAAC,mCAAmC,EAAE,GAAG,EAAE;I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IAAI,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,EAAE,CAAC;QACrE,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACvB,MAAM,MAAM,GAAG,IAAA,6DAA+B,EAAC,gBAAgB,EAAE,QAAQ,CAAC,CAAC;QAC3E,MAAM,CAAC,MAAM,CAAC,CAAC,aAAa,EAAE,CAAC;QAC/B,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,oBAAoB,CACvC,kBAAkB;YAClB,kEAAkE,EAClE,MAAM,EACN,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CACnB,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH;;;;;;;UAOM;IAEN,EAAE,CAAC,uCAAuC,EAAE,GAAG,EAAE;QAC/C,MAAM,QAAQ,GAAG;YACf,SAAS,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE;YACvC,QAAQ,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE;SACtC,CAAC;QACF,MAAM,MAAM,GAAG,IAAA,6DAA+B,EAAC,gCAAgC,EAAE,QAAQ,CAAC,CAAC;QAC3F,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"pip-smart-replace-pipe.util.spec.js","sourceRoot":"","sources":["../../../../../src/_modules/pipe/_collections/utils/pip-smart-replace-pipe.util.spec.ts"],"names":[],"mappings":";;AACA,sEAAmE;AACnE,+EAAgF;AAEhF,QAAQ,CAAC,mCAAmC,EAAE,GAAG,EAAE;IACjD,EAAE,CAAC,+DAA+D,EAAE,GAAG,EAAE;QACvE,MAAM,MAAM,GAAG,IAAA,6DAA+B,EAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;QACvE,MAAM,CAAC,MAAM,CAAC,CA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AM,GAAG,IAAA,6DAA+B,EAAC,gBAAgB,EAAE,QAAQ,CAAC,CAAC;QAC3E,MAAM,CAAC,MAAM,CAAC,CAAC,aAAa,EAAE,CAAC;QAC/B,MAAM,CAAC,mBAAQ,CAAC,IAAI,CAAC,CAAC,oBAAoB,CACxC,kBAAkB;YAClB,kEAAkE,EAClE,MAAM,EACN,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CACnB,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH;;;;;;;UAOM;IAEN,EAAE,CAAC,uCAAuC,EAAE,GAAG,EAAE;QAC/C,MAAM,QAAQ,GAAG;YACf,SAAS,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE;YACvC,QAAQ,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE;SACtC,CAAC;QACF,MAAM,MAAM,GAAG,IAAA,6DAA+B,EAAC,gCAAgC,EAAE,QAAQ,CAAC,CAAC;QAC3F,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const basic_property_type_enum_1 = require("../../../_enums/basic-property-type.enum");
3
4
  const usg_session_data_model_1 = require("./usg-session.data-model");
4
5
  describe('| DyFM_UsageSession', () => {
5
6
  it('| should create an instance with default values', () => {
@@ -53,27 +54,29 @@ describe('| DyFM_usageSession_dataParams', () => {
53
54
  it('| should have the correct properties configuration', () => {
54
55
  const properties = usg_session_data_model_1.DyFM_usageSession_dataParams.properties;
55
56
  expect(properties.date.key).toBe('date');
56
- expect(properties.date.type).toBe('string');
57
+ expect(properties.date.type).toBe(basic_property_type_enum_1.DyFM_BasicProperty_Type.string);
57
58
  expect(properties.date.required).toBe(true);
58
59
  expect(properties.date.index).toBe(true);
59
60
  expect(properties.sessionStart.key).toBe('sessionStart');
60
- expect(properties.sessionStart.type).toBe('Date');
61
+ expect(properties.sessionStart.type).toBe(basic_property_type_enum_1.DyFM_BasicProperty_Type.date);
61
62
  expect(properties.sessionStart.required).toBe(true);
62
63
  expect(properties.sessionStart.index).toBe(true);
63
64
  expect(properties.sessionEnd.key).toBe('sessionEnd');
64
- expect(properties.sessionEnd.type).toBe('Date');
65
+ expect(properties.sessionEnd.type).toBe(basic_property_type_enum_1.DyFM_BasicProperty_Type.date);
65
66
  expect(properties.address.key).toBe('address');
66
- expect(properties.address.type).toBe('string');
67
+ expect(properties.address.type).toBe(basic_property_type_enum_1.DyFM_BasicProperty_Type.string);
67
68
  expect(properties.issuer.key).toBe('issuer');
68
- expect(properties.issuer.type).toBe('string');
69
+ expect(properties.issuer.type).toBe(basic_property_type_enum_1.DyFM_BasicProperty_Type.string);
69
70
  expect(properties.locationData.key).toBe('locationData');
70
- expect(properties.locationData.type).toBe('IpApiLocation');
71
+ expect(properties.locationData.type).toBe(basic_property_type_enum_1.DyFM_BasicProperty_Type.object);
72
+ expect(properties.locationData.nonBasicType).toBe('IpApiLocation');
71
73
  expect(properties.usageData.key).toBe('usageData');
72
- expect(properties.usageData.type).toBe('UsageData[]');
74
+ expect(properties.usageData.type).toBe(basic_property_type_enum_1.DyFM_BasicProperty_Type.array);
75
+ expect(properties.usageData.nonBasicType).toBe('UsageData[]');
73
76
  expect(properties.totalSessionTime.key).toBe('totalSessionTime');
74
- expect(properties.totalSessionTime.type).toBe('number');
77
+ expect(properties.totalSessionTime.type).toBe(basic_property_type_enum_1.DyFM_BasicProperty_Type.number);
75
78
  expect(properties.loggedInAs.key).toBe('loggedInAs');
76
- expect(properties.loggedInAs.type).toBe('string');
79
+ expect(properties.loggedInAs.type).toBe(basic_property_type_enum_1.DyFM_BasicProperty_Type.string);
77
80
  });
78
81
  });
79
82
  //# sourceMappingURL=usg-session.data-model.spec.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"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CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@futdevpro/fsm-dynamo",
3
- "version": "01.11.37",
3
+ "version": "01.11.38",
4
4
  "description": "Full Stack Model Collection for Dynamic (NodeJS-Typescript) Framework called Dynamo, by Future Development Ltd.",
5
5
  "DyBu_settings": {
6
6
  "packageType": "full-stack-package",
@@ -1,3 +1,4 @@
1
+ import { DyFM_BasicProperty_Type } from '../../_enums/basic-property-type.enum';
1
2
 
2
3
  /**
3
4
  * checks if the value is not null or undefined
@@ -5,3 +6,47 @@
5
6
  export function DyFM_notNull(value: any): boolean {
6
7
  return value !== null && value !== undefined;
7
8
  }
9
+
10
+ /**
11
+ * checks if the value is a function
12
+ */
13
+ export function DyFM_getBasicPropertyType(type: string): DyFM_BasicProperty_Type {
14
+ if (!type) {
15
+ throw new Error('Type is missing');
16
+ }
17
+
18
+ switch (type.toLocaleLowerCase()) {
19
+ case DyFM_BasicProperty_Type.string:
20
+ case 'string':
21
+ return DyFM_BasicProperty_Type.string;
22
+
23
+ case DyFM_BasicProperty_Type.number:
24
+ case 'number':
25
+ return DyFM_BasicProperty_Type.number;
26
+
27
+ case DyFM_BasicProperty_Type.boolean:
28
+ case 'boolean':
29
+ return DyFM_BasicProperty_Type.boolean;
30
+
31
+ case DyFM_BasicProperty_Type.date:
32
+ case 'date':
33
+ return DyFM_BasicProperty_Type.date;
34
+
35
+ case DyFM_BasicProperty_Type.object:
36
+ case 'object':
37
+ return DyFM_BasicProperty_Type.object;
38
+
39
+ case DyFM_BasicProperty_Type.array:
40
+ case 'array':
41
+ return DyFM_BasicProperty_Type.array;
42
+
43
+ default:
44
+ if (type.includes('[]') || type.includes('array')) {
45
+ return DyFM_BasicProperty_Type.array;
46
+ } else if (type.includes('=>') || type.includes('function')) {
47
+ return DyFM_BasicProperty_Type.function;
48
+ } else {
49
+ return DyFM_BasicProperty_Type.object;
50
+ }
51
+ }
52
+ }
@@ -13,6 +13,8 @@ export enum DyFM_BasicProperty_Type {
13
13
  string = 'string',
14
14
  number = 'number',
15
15
  boolean = 'boolean',
16
- date = 'Date',
16
+ date = 'date',
17
17
  object = 'object',
18
+ array = 'array',
19
+ function = 'function',
18
20
  }
@@ -1,8 +1,10 @@
1
1
  import { DyFM_Log } from '../../_collections/utils/log.util';
2
+ import { DyFM_BasicProperty_Type } from '../../_enums/basic-property-type.enum';
2
3
  import { DyFM_DataModel_Type } from '../../_enums/data-model-type.enum';
3
4
  import { DyFM_Metadata } from '../data-models/metadata.data-model';
4
5
  import { DyFM_DataModel_Params, DyFM_DataModel_Settings } from './data-model-params.control-model';
5
6
  import { DyFM_DataProperties } from './data-property-params.control-model';
7
+ import { DyFM_Error } from './error.control-model';
6
8
 
7
9
  describe('| DyFM_DataModel_Params', () => {
8
10
  class MockMetadata extends DyFM_Metadata {
@@ -35,9 +37,25 @@ describe('| DyFM_DataModel_Params', () => {
35
37
  expect(params.properties).toEqual({});
36
38
  });
37
39
 
40
+ it('| should log an error if a property type is missing', () => {
41
+ spyOn(DyFM_Error, 'logSimple');
42
+ spyOn(DyFM_Log, 'warn');
43
+ mockSettings.properties = { '': { key: 'asd', type: '' } } as any;
44
+ const params = new DyFM_DataModel_Params(mockSettings);
45
+ expect(DyFM_Error.logSimple).toHaveBeenCalledWith(
46
+ 'DyFM_DataModel_Params.constructor error:',
47
+ new Error('Type is missing')
48
+ );
49
+ expect(DyFM_Log.warn).toHaveBeenCalledWith(
50
+ 'Due to the error, the Params contruction failed, therefore the model is not constructed properly. ' +
51
+ `("test_model" model)` +
52
+ `\nstackLocation: ${params.stackLocation}`
53
+ );
54
+ });
55
+
38
56
  it('| should log an error if a property key is missing', () => {
39
57
  spyOn(DyFM_Log, 'error');
40
- mockSettings.properties = { '': { key: '' } } as any;
58
+ mockSettings.properties = { '': { key: '', type: 'any' } } as any;
41
59
  const params = new DyFM_DataModel_Params(mockSettings);
42
60
  expect(DyFM_Log.error).toHaveBeenCalledWith(
43
61
  'DyFM_DataModel_Params.constructor: A property key is missing in "test_model" model.' +
@@ -45,6 +63,16 @@ describe('| DyFM_DataModel_Params', () => {
45
63
  );
46
64
  });
47
65
 
66
+ it('| should log an error if dataName is missing', () => {
67
+ spyOn(DyFM_Log, 'error');
68
+ mockSettings.dataName = '';
69
+ const params = new DyFM_DataModel_Params(mockSettings);
70
+ expect(DyFM_Log.error).toHaveBeenCalledWith(
71
+ 'DyFM_DataModel_Params.constructor: dataName is missing in "" model.' +
72
+ `\nstackLocation: ${params.stackLocation}\n`
73
+ );
74
+ });
75
+
48
76
  it('| should set modelType to data if not provided or is data', () => {
49
77
  const params = new DyFM_DataModel_Params(mockSettings);
50
78
  expect(params.modelType).toBe(DyFM_DataModel_Type.data);
@@ -1,9 +1,11 @@
1
1
  import { DyFM_Log } from '../../_collections/utils/log.util';
2
2
  import { DyFM_getConstructionStackLocation } from '../../_collections/utils/stack.util';
3
+ import { DyFM_getBasicPropertyType } from '../../_collections/utils/utilities.util';
3
4
  import { DyFM_BasicProperty_Type } from '../../_enums/basic-property-type.enum';
4
5
  import { DyFM_DataModel_Type } from '../../_enums/data-model-type.enum';
5
6
  import { DyFM_Metadata } from '../data-models/metadata.data-model';
6
7
  import { DyFM_DataProperties, DyFM_DataProperty_Params } from './data-property-params.control-model';
8
+ import { DyFM_Error } from './error.control-model';
7
9
 
8
10
  /* export type DyFM_Data_S<T extends DyFM_Metadata> = DyFM_DataModel_Settings<T>;
9
11
  export type DyFM_Data_Settings<T extends DyFM_Metadata> = DyFM_DataModel_Settings<T>; */
@@ -45,170 +47,198 @@ export class DyFM_DataModel_Params<T extends DyFM_Metadata> extends DyFM_DataMod
45
47
  ) {
46
48
  super(set);
47
49
 
48
- if (set) {
49
- Object.assign(this, set);
50
- }
51
-
52
- this.stackLocation = DyFM_getConstructionStackLocation();
53
-
54
- if (!this.properties || typeof this.properties !== 'object') {
55
- DyFM_Log.error(
56
- 'DyFM_DataModel_Params.constructor: ' +
57
- `Properties are missing in "${this.dataName}" model.` +
58
- `\nstackLocation: ${this.stackLocation}\n`
59
- );
60
-
61
- this.properties = {} as DyFM_DataProperties<T>;
62
- }
63
-
64
- const keys: string[] = Object.keys(this.properties);
65
- keys.forEach((key: string): void => {
66
- if (!key) {
50
+ try {
51
+ if (set) {
52
+ Object.assign(this, set);
53
+ }
54
+
55
+ this.stackLocation = DyFM_getConstructionStackLocation();
56
+
57
+ if (!this.properties || typeof this.properties !== 'object') {
67
58
  DyFM_Log.error(
68
59
  'DyFM_DataModel_Params.constructor: ' +
69
- `A property key is missing in "${this.dataName}" model.` +
60
+ `Properties are missing in "${this.dataName}" model.` +
70
61
  `\nstackLocation: ${this.stackLocation}\n`
71
62
  );
63
+
64
+ this.properties = {} as DyFM_DataProperties<T>;
72
65
  }
73
-
74
- const property: DyFM_DataProperty_Params<any, T> = new DyFM_DataProperty_Params({
75
- ...this.properties[key],
76
- key: key,
77
- }, this);
78
- this.properties[key] = property;
79
-
80
- if (property.subObjectParams) {
81
- this.setKeysForSubObjectParams(property);
82
- }
83
- });
84
-
85
- keys.forEach((key: string): void => {
86
- const property: DyFM_DataProperty_Params<any, T> = this.properties[key];
87
- /* if (property.vectorizeTo) {
88
- if (!this.properties[property.vectorizeTo]) {
89
- throw new Error(
90
- `Vectorize to property "${property.vectorizeTo}" is not found in ` +
91
- `"${this.dataName}" model.`
66
+
67
+ const keys: string[] = Object.keys(this.properties);
68
+ keys.forEach((key: string): void => {
69
+ if (!key) {
70
+ DyFM_Log.error(
71
+ 'DyFM_DataModel_Params.constructor: ' +
72
+ `A property key is missing in "${this.dataName}" model.` +
73
+ `\nstackLocation: ${this.stackLocation}\n`
92
74
  );
93
75
  }
94
-
95
- this.properties[property.vectorizeTo].vectorizeFrom ??= key;
96
- } */
97
-
98
- if (property.vectorizedFrom) {
99
- property.vectorizedFrom.forEach((fromKey: string): void => {
100
- if (!this.properties[fromKey]) {
76
+
77
+ const propertyParams: DyFM_DataProperty_Params<any, T> = new DyFM_DataProperty_Params({
78
+ ...this.properties[key],
79
+ key: key,
80
+ }, this);
81
+ const basicType: DyFM_BasicProperty_Type = DyFM_getBasicPropertyType(propertyParams.type);
82
+ if (basicType !== propertyParams.type) {
83
+ propertyParams.nonBasicType = propertyParams.type;
84
+ propertyParams.type = basicType;
85
+ }
86
+ this.properties[key] = propertyParams;
87
+
88
+ if (propertyParams.subObjectParams) {
89
+ this.setKeysForSubObjectParams(propertyParams);
90
+ }
91
+ });
92
+
93
+ keys.forEach((key: string): void => {
94
+ const property: DyFM_DataProperty_Params<any, T> = this.properties[key];
95
+ /* if (property.vectorizeTo) {
96
+ if (!this.properties[property.vectorizeTo]) {
97
+ throw new Error(
98
+ `Vectorize to property "${property.vectorizeTo}" is not found in ` +
99
+ `"${this.dataName}" model.`
100
+ );
101
+ }
102
+
103
+ this.properties[property.vectorizeTo].vectorizeFrom ??= key;
104
+ } */
105
+
106
+ if (property.vectorizedFrom) {
107
+ property.vectorizedFrom.forEach((fromKey: string): void => {
108
+ if (!this.properties[fromKey]) {
109
+ DyFM_Log.error(
110
+ `Vectorized from property "${fromKey}" is not found in ` +
111
+ `"${this.dataName}" model.` +
112
+ `\nstackLocation: ${this.stackLocation}\n`
113
+ );
114
+ }
115
+
116
+ /* if (!this.properties[fromKey].vectorizeUseIndex) {
117
+ DyFM_Log.error(
118
+ `Vectorized from property "${fromKey}" has no vectorizeUseIndex in ` +
119
+ `"${this.dataName}" model.` +
120
+ `\nstackLocation: ${this.stackLocation}\n`
121
+ );
122
+ } */
123
+
124
+ /* if (
125
+ (this.properties[fromKey] as DyFM_DataProperty_Params<any>)?.type !== DyFM_BasicProperty_Type.string
126
+ ) {
127
+ DyFM_Log.error(
128
+ `Vectorized from property "${property.vectorizedFrom}" is not a string property in ` +
129
+ `"${this.dataName}" model.` +
130
+ `\nstackLocation: ${this.stackLocation}\n`
131
+ );
132
+ } */
133
+ });
134
+
135
+ /* this.properties[property.vectorizedFrom].vectorizeTo ??= key; */
136
+
137
+ if (property.type !== 'number[]') {
101
138
  DyFM_Log.error(
102
- `Vectorized from property "${fromKey}" is not found in ` +
139
+ `Vectorized from property "${property.vectorizedFrom}" is not a number[] property in ` +
103
140
  `"${this.dataName}" model.` +
104
141
  `\nstackLocation: ${this.stackLocation}\n`
105
142
  );
106
143
  }
107
-
108
- /* if (!this.properties[fromKey].vectorizeUseIndex) {
144
+
145
+ if (!property.vectorizeUseIndex) {
109
146
  DyFM_Log.error(
110
- `Vectorized from property "${fromKey}" has no vectorizeUseIndex in ` +
147
+ 'vectorizeUseIndex is required if vectorizedFrom is set. ' +
111
148
  `"${this.dataName}" model.` +
112
149
  `\nstackLocation: ${this.stackLocation}\n`
113
150
  );
114
- } */
115
-
116
- /* if (
117
- (this.properties[fromKey] as DyFM_DataProperty_Params<any>)?.type !== DyFM_BasicProperty_Type.string
118
- ) {
119
- DyFM_Log.error(
120
- `Vectorized from property "${property.vectorizedFrom}" is not a string property in ` +
151
+ }
152
+
153
+ if (property.index) {
154
+ /** {@link DyFM_DataProperty_Params.vectorizeUseIndex} */
155
+ DyFM_Log.warn(
156
+ `index is not recommended to be set for vectorized properties in ` +
157
+ `"${this.dataName}" model. ` +
158
+ `\n(you should set it in the Atlas and vectorizeUseIndex, ` +
159
+ `more info at DyFM_DataProperty_Params.vectorizeUseIndex))` +
160
+ `\nstackLocation: ${this.stackLocation}\n`
161
+ );
162
+ }
163
+
164
+ /* if (!this.properties[property.vectorizeUseIndex]) {
165
+ throw new Error(
166
+ `vectorizeUseIndex property "${property.vectorizeUseIndex}" is not found in ` +
121
167
  `"${this.dataName}" model.` +
122
168
  `\nstackLocation: ${this.stackLocation}\n`
123
169
  );
170
+ }
171
+
172
+ if (!(this.properties[property.vectorizeUseIndex] as DyFM_DataProperty_Params<any>).index) {
173
+ throw new Error(
174
+ `vectorizeUseIndex property "${property.vectorizeUseIndex}" is not an ` +
175
+ `index property in "${this.dataName}" model.` +
176
+ `\nstackLocation: ${this.stackLocation}`
177
+ );
124
178
  } */
125
- });
126
-
127
- /* this.properties[property.vectorizedFrom].vectorizeTo ??= key; */
128
-
129
- if (property.type !== 'number[]') {
130
- DyFM_Log.error(
131
- `Vectorized from property "${property.vectorizedFrom}" is not a number[] property in ` +
132
- `"${this.dataName}" model.` +
133
- `\nstackLocation: ${this.stackLocation}\n`
134
- );
135
- }
136
-
137
- if (!property.vectorizeUseIndex) {
138
- DyFM_Log.error(
139
- 'vectorizeUseIndex is required if vectorizedFrom is set. ' +
140
- `"${this.dataName}" model.` +
141
- `\nstackLocation: ${this.stackLocation}\n`
142
- );
143
- }
144
-
145
- if (property.index) {
146
- /** {@link DyFM_DataProperty_Params.vectorizeUseIndex} */
147
- DyFM_Log.warn(
148
- `index is not recommended to be set for vectorized properties in ` +
149
- `"${this.dataName}" model. ` +
150
- `\n(you should set it in the Atlas and vectorizeUseIndex, ` +
151
- `more info at DyFM_DataProperty_Params.vectorizeUseIndex))` +
152
- `\nstackLocation: ${this.stackLocation}\n`
153
- );
154
- }
155
-
156
- /* if (!this.properties[property.vectorizeUseIndex]) {
157
- throw new Error(
158
- `vectorizeUseIndex property "${property.vectorizeUseIndex}" is not found in ` +
159
- `"${this.dataName}" model.` +
160
- `\nstackLocation: ${this.stackLocation}\n`
161
- );
162
- }
163
-
164
- if (!(this.properties[property.vectorizeUseIndex] as DyFM_DataProperty_Params<any>).index) {
165
- throw new Error(
166
- `vectorizeUseIndex property "${property.vectorizeUseIndex}" is not an ` +
167
- `index property in "${this.dataName}" model.` +
168
- `\nstackLocation: ${this.stackLocation}`
169
- );
170
- } */
171
- }
172
- });
173
-
174
- if (!this?.modelType || this?.modelType == DyFM_DataModel_Type.data) {
175
- this.modelType = DyFM_DataModel_Type.data;
176
- }
177
-
178
- /* if (!this.dbName && this?.modelType == DyFM_DataModel_Type.data) {
179
- // upper case first letter
180
- this.dbName = this.dataName.charAt(0).toUpperCase() + this.dataName.slice(1);
181
-
182
- this.dbName.split('').forEach((char: string, index: number): void => {
183
- if (
184
- index > 0 &&
185
- this.dbName[index - 1] === '_' &&
186
- char === char.toUpperCase()
187
- ) {
188
- this.dbName = this.dbName.slice(0, index) +
189
- char.toLowerCase() +
190
- this.dbName.slice(index + 1);
191
179
  }
192
180
  });
193
- } */
194
-
195
- // check for any Uppercase letters in dbName
196
- if (RegExp(/[A-Z]/).exec(this.dataName)) {
181
+
182
+ if (!this?.modelType || this?.modelType == DyFM_DataModel_Type.data) {
183
+ this.modelType = DyFM_DataModel_Type.data;
184
+ }
185
+
186
+ /* if (!this.dbName && this?.modelType == DyFM_DataModel_Type.data) {
187
+ // upper case first letter
188
+ this.dbName = this.dataName.charAt(0).toUpperCase() + this.dataName.slice(1);
189
+
190
+ this.dbName.split('').forEach((char: string, index: number): void => {
191
+ if (
192
+ index > 0 &&
193
+ this.dbName[index - 1] === '_' &&
194
+ char === char.toUpperCase()
195
+ ) {
196
+ this.dbName = this.dbName.slice(0, index) +
197
+ char.toLowerCase() +
198
+ this.dbName.slice(index + 1);
199
+ }
200
+ });
201
+ } */
202
+
203
+ if (!this.dataName) {
204
+ DyFM_Log.error(
205
+ 'DyFM_DataModel_Params.constructor: ' +
206
+ `dataName is missing in "${this.dataName}" model.` +
207
+ `\nstackLocation: ${this.stackLocation}\n`
208
+ );
209
+ this.dataName = 'UNNAMED_MODEL';
210
+ }
211
+
212
+ // check for any Uppercase letters in dbName
213
+ if (RegExp(/[A-Z]/).exec(this.dataName)) {
214
+ DyFM_Log.warn(
215
+ 'DyFM_DataModel_Params.constructor: ' +
216
+ `dbName should be in snake_case in "${this.dataName}" model.` +
217
+ 'For future compatibility.' +
218
+ `\nstackLocation: ${this.stackLocation}\n`
219
+ );
220
+ }
221
+
222
+ if (this.dataName.includes('-')) {
223
+ DyFM_Log.warn(
224
+ 'DyFM_DataModel_Params.constructor: ' +
225
+ `dataName should be in snake_case in "${this.dataName}" model.` +
226
+ 'For future compatibility.' +
227
+ `\nstackLocation: ${this.stackLocation}\n`
228
+ );
229
+ }
230
+ } catch (error) {
231
+ DyFM_Error.logSimple('DyFM_DataModel_Params.constructor error:', error);
197
232
  DyFM_Log.warn(
198
- 'DyFM_DataModel_Params.constructor: ' +
199
- `dbName should be in snake_case in "${this.dataName}" model.` +
200
- 'For future compatibility.' +
201
- `\nstackLocation: ${this.stackLocation}\n`
233
+ 'Due to the error, the Params contruction failed, therefore the model is not constructed properly. ' +
234
+ `("${this.dataName}" model)` +
235
+ `\nstackLocation: ${this.stackLocation}`
202
236
  );
203
- }
204
-
205
- if (this.dataName.includes('-')) {
206
- DyFM_Log.warn(
237
+ /* DyFM_Log.error(
207
238
  'DyFM_DataModel_Params.constructor: ' +
208
- `dataName should be in snake_case in "${this.dataName}" model.` +
209
- 'For future compatibility.' +
239
+ `An error occurred while constructing the "${this.dataName}" model.` +
210
240
  `\nstackLocation: ${this.stackLocation}\n`
211
- );
241
+ ); */
212
242
  }
213
243
  }
214
244
 
@@ -227,10 +257,17 @@ export class DyFM_DataModel_Params<T extends DyFM_Metadata> extends DyFM_DataMod
227
257
  );
228
258
  }
229
259
 
230
- property.subObjectParams[key].key = key;
260
+ const subObjectPropertyParams: DyFM_DataProperty_Params<any, T> = property.subObjectParams[key];
261
+
262
+ subObjectPropertyParams.key = key;
263
+ const basicType: DyFM_BasicProperty_Type = DyFM_getBasicPropertyType(subObjectPropertyParams.type);
264
+ if (basicType !== subObjectPropertyParams.type) {
265
+ subObjectPropertyParams.nonBasicType = subObjectPropertyParams.type;
266
+ subObjectPropertyParams.type = basicType;
267
+ }
231
268
 
232
- if (property.subObjectParams[key].subObjectParams) {
233
- this.setKeysForSubObjectParams(property.subObjectParams[key]);
269
+ if (subObjectPropertyParams.subObjectParams) {
270
+ this.setKeysForSubObjectParams(subObjectPropertyParams);
234
271
  }
235
272
  });
236
273
  }
@@ -13,6 +13,7 @@ export type DyFM_DataProperties<T_Data> = {
13
13
  export class DyFM_DataProperty_Settings<T_Property, T_Data>{
14
14
  key?: string;
15
15
  type!: DyFM_BasicProperty_Type | string;
16
+ nonBasicType?: string;
16
17
  default?: T_Property;
17
18
 
18
19
  unique?: boolean;
@@ -70,7 +71,7 @@ export class DyFM_DataProperty_Settings<T_Property, T_Data>{
70
71
 
71
72
  subObjectParams?: DyFM_DataProperties<any>;
72
73
 
73
- additionalValidators?: ((property: T_Property, data: T_Data) => void)[];
74
+ additionalValidators?: ((propertyValue: T_Property, data: T_Data) => void)[];
74
75
  }
75
76
 
76
77
 
@@ -85,7 +86,7 @@ export class DyFM_DataProperty_Params<T_Property, T_Data> extends DyFM_DataPrope
85
86
  /* override subObjectParams?: DyFM_DataProperty_Params<>[] = []; */
86
87
  /* override subObjectParams?: DyFM_Data_Params<T> = {}; */
87
88
 
88
- override additionalValidators?: ((property: T_Property, data: T_Data) => void)[] = [];
89
+ override additionalValidators?: ((propertyValue: T_Property, data: T_Data) => void)[] = [];
89
90
 
90
91
  constructor(
91
92
  set: DyFM_DataProperty_Settings<T_Property, T_Data>,