@futdevpro/nts-dynamo 1.10.9 → 1.10.11

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 (95) hide show
  1. package/build/_collections/global-settings.const.d.ts.map +1 -1
  2. package/build/_collections/global-settings.const.js +1 -0
  3. package/build/_collections/global-settings.const.js.map +1 -1
  4. package/build/_models/control-models/api-call-params.control-model.d.ts.map +1 -1
  5. package/build/_models/control-models/api-call-params.control-model.js +1 -2
  6. package/build/_models/control-models/api-call-params.control-model.js.map +1 -1
  7. package/build/_models/control-models/app-params.control-model.d.ts.map +1 -1
  8. package/build/_models/control-models/app-params.control-model.js +16 -0
  9. package/build/_models/control-models/app-params.control-model.js.map +1 -1
  10. package/build/_models/control-models/endpoint-params.control-model.d.ts.map +1 -1
  11. package/build/_models/control-models/endpoint-params.control-model.js +1 -2
  12. package/build/_models/control-models/endpoint-params.control-model.js.map +1 -1
  13. package/build/_models/interfaces/global-settings.interface.d.ts +4 -0
  14. package/build/_models/interfaces/global-settings.interface.d.ts.map +1 -1
  15. package/build/_modules/mock/data-model.mock.spec.js +2 -2
  16. package/build/_modules/mock/data-model.mock.spec.js.map +1 -1
  17. package/build/_modules/server/error/error.controller.d.ts +13 -0
  18. package/build/_modules/server/error/error.controller.d.ts.map +1 -0
  19. package/build/_modules/server/error/error.controller.js +155 -0
  20. package/build/_modules/server/error/error.controller.js.map +1 -0
  21. package/build/_modules/server/error/error.data-service.d.ts +13 -0
  22. package/build/_modules/server/error/error.data-service.d.ts.map +1 -0
  23. package/build/_modules/server/error/error.data-service.js +249 -0
  24. package/build/_modules/server/error/error.data-service.js.map +1 -0
  25. package/build/_modules/server/index.d.ts +5 -0
  26. package/build/_modules/server/index.d.ts.map +1 -0
  27. package/build/_modules/server/index.js +10 -0
  28. package/build/_modules/server/index.js.map +1 -0
  29. package/build/_modules/server/server-status/server-status.control-service.d.ts +24 -0
  30. package/build/_modules/server/server-status/server-status.control-service.d.ts.map +1 -0
  31. package/build/_modules/server/server-status/server-status.control-service.js +102 -0
  32. package/build/_modules/server/server-status/server-status.control-service.js.map +1 -0
  33. package/build/_modules/server/server-status/server-status.controller.d.ts +9 -0
  34. package/build/_modules/server/server-status/server-status.controller.d.ts.map +1 -0
  35. package/build/_modules/server/server-status/server-status.controller.js +61 -0
  36. package/build/_modules/server/server-status/server-status.controller.js.map +1 -0
  37. package/build/_modules/socket/_services/socket-server.service.d.ts.map +1 -1
  38. package/build/_modules/socket/_services/socket-server.service.js.map +1 -1
  39. package/build/_modules/socket/index.d.ts +1 -0
  40. package/build/_modules/socket/index.d.ts.map +1 -1
  41. package/build/_modules/socket/index.js +1 -0
  42. package/build/_modules/socket/index.js.map +1 -1
  43. package/build/_services/base/data.service.d.ts +18 -10
  44. package/build/_services/base/data.service.d.ts.map +1 -1
  45. package/build/_services/base/data.service.js +151 -106
  46. package/build/_services/base/data.service.js.map +1 -1
  47. package/build/_services/base/db.service.d.ts +21 -10
  48. package/build/_services/base/db.service.d.ts.map +1 -1
  49. package/build/_services/base/db.service.js +79 -47
  50. package/build/_services/base/db.service.js.map +1 -1
  51. package/build/_services/core/api.service.d.ts.map +1 -1
  52. package/build/_services/core/api.service.js +18 -2
  53. package/build/_services/core/api.service.js.map +1 -1
  54. package/build/_services/core/global.service.d.ts.map +1 -1
  55. package/build/_services/core/global.service.js +8 -2
  56. package/build/_services/core/global.service.js.map +1 -1
  57. package/build/_services/server/app.server.d.ts.map +1 -1
  58. package/build/_services/server/app.server.js +13 -1
  59. package/build/_services/server/app.server.js.map +1 -1
  60. package/build/index.d.ts +0 -1
  61. package/build/index.d.ts.map +1 -1
  62. package/build/index.js +0 -1
  63. package/build/index.js.map +1 -1
  64. package/nodemon.json +2 -0
  65. package/package.json +11 -4
  66. package/src/_collections/global-settings.const.ts +1 -0
  67. package/src/_models/control-models/api-call-params.control-model.ts +2 -3
  68. package/src/_models/control-models/app-params.control-model.ts +25 -0
  69. package/src/_models/control-models/endpoint-params.control-model.ts +3 -3
  70. package/src/_models/interfaces/global-settings.interface.ts +5 -0
  71. package/src/_modules/mock/data-model.mock.spec.ts +2 -2
  72. package/src/_modules/server/error/error.controller.ts +210 -0
  73. package/src/_modules/server/error/error.data-service.ts +337 -0
  74. package/src/_modules/server/index.ts +11 -0
  75. package/src/_modules/server/server-status/server-status.control-service.ts +217 -0
  76. package/src/_modules/server/server-status/server-status.controller.ts +90 -0
  77. package/src/_modules/socket/_services/socket-server.service.ts +0 -1
  78. package/src/_modules/socket/index.ts +1 -1
  79. package/src/_services/base/data.service.ts +233 -164
  80. package/src/_services/base/db.service.ts +105 -60
  81. package/src/_services/core/api.service.ts +23 -2
  82. package/src/_services/core/global.service.ts +12 -5
  83. package/src/_services/server/app.server.ts +17 -4
  84. package/src/index.ts +0 -1
  85. package/tsconfig.json +1 -1
  86. package/build/_collections/stack.util.d.ts +0 -7
  87. package/build/_collections/stack.util.d.ts.map +0 -1
  88. package/build/_collections/stack.util.js +0 -31
  89. package/build/_collections/stack.util.js.map +0 -1
  90. package/build/_collections/stack.util.test.d.ts +0 -2
  91. package/build/_collections/stack.util.test.d.ts.map +0 -1
  92. package/build/_collections/stack.util.test.js +0 -96
  93. package/build/_collections/stack.util.test.js.map +0 -1
  94. package/src/_collections/stack.util.test.ts +0 -111
  95. package/src/_collections/stack.util.ts +0 -33
@@ -1,111 +0,0 @@
1
- import { DyNTS_getStackLocation } from './stack.util';
2
-
3
- describe('stack.util.ts', () => {
4
- describe('DyNTS_getStackLocation', () => {
5
- // Test class for basic functionality
6
- class TestClass {
7
- constructor() {
8
- this.location = DyNTS_getStackLocation();
9
- }
10
- location: string;
11
- }
12
-
13
- // Test class for nested instantiation
14
- class NestedTestClass {
15
- constructor() {
16
- this.location = DyNTS_getStackLocation();
17
- }
18
- location: string;
19
- }
20
-
21
- // Test class with parameters
22
- class ParamTestClass {
23
- constructor(param: string) {
24
- this.location = DyNTS_getStackLocation();
25
- }
26
- location: string;
27
- }
28
-
29
- // Test class for async instantiation
30
- class AsyncTestClass {
31
- constructor() {
32
- this.location = DyNTS_getStackLocation();
33
- }
34
- location: string;
35
- }
36
-
37
- describe('format validation', () => {
38
- it('should return location in correct file:line:column format', () => {
39
- const instance = new TestClass();
40
- const [file, line, column] = instance.location.split(':');
41
-
42
- expect(file).toBeTruthy();
43
- expect(parseInt(line)).toBeGreaterThan(0);
44
- expect(parseInt(column)).toBeGreaterThan(0);
45
- expect(instance.location).toMatch(/^[^:]+:\d+:\d+$/);
46
- });
47
-
48
- it('should include the correct file path', () => {
49
- const instance = new TestClass();
50
- expect(instance.location).toContain('stack.util.test.ts');
51
- });
52
- });
53
-
54
- describe('location uniqueness', () => {
55
- it('should return different locations for different instantiation points', () => {
56
- const instance1 = new TestClass();
57
- const instance2 = new TestClass();
58
- expect(instance1.location).not.toBe(instance2.location);
59
- });
60
-
61
- it('should return different locations for different classes', () => {
62
- const instance1 = new TestClass();
63
- const instance2 = new NestedTestClass();
64
- expect(instance1.location).not.toBe(instance2.location);
65
- });
66
- });
67
-
68
- describe('class instantiation variations', () => {
69
- it('should work with nested class instantiation', () => {
70
- const instance = new NestedTestClass();
71
- expect(instance.location).toContain('NestedTestClass');
72
- });
73
-
74
- it('should handle class instantiation with parameters', () => {
75
- const instance = new ParamTestClass('test');
76
- expect(instance.location).toMatch(/^[^:]+:\d+:\d+$/);
77
- });
78
-
79
- it('should work with async class instantiation', async () => {
80
- const instance = new AsyncTestClass();
81
- expect(instance.location).toMatch(/^[^:]+:\d+:\d+$/);
82
- });
83
- });
84
-
85
- describe('error handling', () => {
86
- it('should handle invalid stack trace gracefully', () => {
87
- // Mock Error.stack to be undefined
88
- const originalStack = Error.prototype.stack;
89
- Error.prototype.stack = undefined;
90
-
91
- const instance = new TestClass();
92
- expect(instance.location).toBe('');
93
-
94
- // Restore original stack
95
- Error.prototype.stack = originalStack;
96
- });
97
-
98
- it('should handle malformed stack trace gracefully', () => {
99
- // Mock Error.stack to be malformed
100
- const originalStack = Error.prototype.stack;
101
- Error.prototype.stack = 'Invalid stack trace';
102
-
103
- const instance = new TestClass();
104
- expect(instance.location).toBe('');
105
-
106
- // Restore original stack
107
- Error.prototype.stack = originalStack;
108
- });
109
- });
110
- });
111
- });
@@ -1,33 +0,0 @@
1
- import { DyFM_Log } from '@futdevpro/fsm-dynamo';
2
-
3
- /**
4
- * Get the stack location of the constructor call
5
- * use it in the constructor of a class to get the stack location of the constructor call
6
- * @returns The stack location of the constructor call
7
- */
8
- export function DyNTS_getStackLocation(): string {
9
- let stack: string = new Error().stack;
10
-
11
- // Split the stack into lines and remove the first line (Error:)
12
- const stackLines = stack?.split('\n')?.slice(1);
13
-
14
- // Find the line that contains the constructor call
15
- // It will be the FIRST line that doesn't contain 'getStackLocation'
16
- let constructorLine = stackLines?.find(line =>
17
- !line.includes('getStackLocation') &&
18
- !line.includes('at new')
19
- );
20
- if (!constructorLine) {
21
- DyFM_Log.warn('No constructor line found');
22
- return '';
23
- }
24
-
25
- // Remove the 'constructorLine at ... (' and the ')'
26
- constructorLine = constructorLine.split('(')[1]?.split(')')[0];
27
- if (!constructorLine) {
28
- DyFM_Log.warn('No constructor line found');
29
- return '';
30
- }
31
-
32
- return constructorLine;
33
- }