@adaas/a-utils 0.0.8 → 0.1.1

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 (172) hide show
  1. package/.nvmrc +1 -1
  2. package/dist/index.d.ts +21 -14
  3. package/dist/index.js +53 -20
  4. package/dist/index.js.map +1 -1
  5. package/dist/src/constants/errors.constants.d.ts +0 -65
  6. package/dist/src/constants/errors.constants.js +0 -72
  7. package/dist/src/constants/errors.constants.js.map +1 -1
  8. package/dist/src/lib/A-Channel/A-Channel.component.d.ts +3 -0
  9. package/dist/src/lib/A-Channel/A-Channel.component.js +8 -0
  10. package/dist/src/lib/A-Channel/A-Channel.component.js.map +1 -0
  11. package/dist/src/lib/A-Channel/A-Channel.error.d.ts +3 -0
  12. package/dist/src/lib/A-Channel/A-Channel.error.js +8 -0
  13. package/dist/src/lib/A-Channel/A-Channel.error.js.map +1 -0
  14. package/dist/src/lib/A-Channel/A-Channel.types.d.ts +0 -0
  15. package/dist/src/lib/A-Channel/A-Channel.types.js +2 -0
  16. package/dist/src/lib/A-Channel/A-Channel.types.js.map +1 -0
  17. package/dist/src/lib/A-Command/A-Command.constants.d.ts +22 -0
  18. package/dist/src/lib/A-Command/A-Command.constants.js +28 -0
  19. package/dist/src/lib/A-Command/A-Command.constants.js.map +1 -0
  20. package/dist/src/lib/A-Command/A-Command.entity.d.ts +133 -0
  21. package/dist/src/lib/A-Command/A-Command.entity.js +273 -0
  22. package/dist/src/lib/A-Command/A-Command.entity.js.map +1 -0
  23. package/dist/src/lib/A-Command/A-Command.error.d.ts +3 -0
  24. package/dist/src/lib/A-Command/A-Command.error.js +8 -0
  25. package/dist/src/lib/A-Command/A-Command.error.js.map +1 -0
  26. package/dist/src/lib/A-Command/A-Command.types.d.ts +73 -0
  27. package/dist/src/lib/A-Command/A-Command.types.js +4 -0
  28. package/dist/src/lib/A-Command/A-Command.types.js.map +1 -0
  29. package/dist/src/lib/A-Config/A-Config.constants.d.ts +3 -0
  30. package/dist/src/lib/A-Config/A-Config.constants.js +6 -0
  31. package/dist/src/lib/A-Config/A-Config.constants.js.map +1 -0
  32. package/dist/src/lib/A-Config/A-Config.container.d.ts +8 -0
  33. package/dist/src/lib/A-Config/A-Config.container.js +75 -0
  34. package/dist/src/lib/A-Config/A-Config.container.js.map +1 -0
  35. package/dist/src/lib/A-Config/A-Config.context.d.ts +29 -0
  36. package/dist/src/lib/A-Config/A-Config.context.js +63 -0
  37. package/dist/src/lib/A-Config/A-Config.context.js.map +1 -0
  38. package/dist/src/lib/A-Config/A-Config.error.d.ts +4 -0
  39. package/dist/src/lib/A-Config/A-Config.error.js +9 -0
  40. package/dist/src/lib/A-Config/A-Config.error.js.map +1 -0
  41. package/dist/src/lib/A-Config/A-Config.types.d.ts +19 -0
  42. package/dist/src/lib/A-Config/A-Config.types.js +7 -0
  43. package/dist/src/lib/A-Config/A-Config.types.js.map +1 -0
  44. package/dist/src/lib/A-Config/components/ConfigReader.component.d.ts +30 -0
  45. package/dist/src/lib/A-Config/components/ConfigReader.component.js +85 -0
  46. package/dist/src/lib/A-Config/components/ConfigReader.component.js.map +1 -0
  47. package/dist/src/lib/A-Config/components/ENVConfigReader.component.d.ts +10 -0
  48. package/dist/src/lib/A-Config/components/ENVConfigReader.component.js +37 -0
  49. package/dist/src/lib/A-Config/components/ENVConfigReader.component.js.map +1 -0
  50. package/dist/src/lib/A-Config/components/FileConfigReader.component.d.ts +11 -0
  51. package/dist/src/lib/A-Config/components/FileConfigReader.component.js +47 -0
  52. package/dist/src/lib/A-Config/components/FileConfigReader.component.js.map +1 -0
  53. package/dist/src/lib/A-Logger/A-Logger.component.d.ts +29 -0
  54. package/dist/src/lib/A-Logger/A-Logger.component.js +152 -0
  55. package/dist/src/lib/A-Logger/A-Logger.component.js.map +1 -0
  56. package/dist/src/lib/A-Logger/A-Logger.types.d.ts +0 -0
  57. package/dist/src/lib/A-Logger/A-Logger.types.js +2 -0
  58. package/dist/src/lib/A-Logger/A-Logger.types.js.map +1 -0
  59. package/dist/src/lib/A-Memory/A-Memory.context.d.ts +64 -0
  60. package/dist/src/lib/A-Memory/A-Memory.context.js +105 -0
  61. package/dist/src/lib/A-Memory/A-Memory.context.js.map +1 -0
  62. package/dist/src/lib/A-Polyfill/A-Polyfill.component.d.ts +20 -0
  63. package/dist/src/lib/A-Polyfill/A-Polyfill.component.js +53 -0
  64. package/dist/src/lib/A-Polyfill/A-Polyfill.component.js.map +1 -0
  65. package/dist/src/{global/A_Polyfills.d.ts → lib/A-Polyfill/A-Polyfill.types.d.ts} +1 -13
  66. package/dist/src/lib/A-Polyfill/A-Polyfill.types.js +2 -0
  67. package/dist/src/lib/A-Polyfill/A-Polyfill.types.js.map +1 -0
  68. package/dist/src/lib/A-Polyfill/A-Polyfills.class.d.ts +10 -0
  69. package/dist/src/{global/A_Polyfills.js → lib/A-Polyfill/A-Polyfills.class.js} +4 -4
  70. package/dist/src/lib/A-Polyfill/A-Polyfills.class.js.map +1 -0
  71. package/dist/src/{global/A_Deferred.class.d.ts → lib/A-Schedule/A-Deferred.class.d.ts} +4 -0
  72. package/dist/src/{global/A_Deferred.class.js → lib/A-Schedule/A-Deferred.class.js} +5 -1
  73. package/dist/src/lib/A-Schedule/A-Deferred.class.js.map +1 -0
  74. package/dist/src/lib/A-Schedule/A-Schedule.component.d.ts +57 -0
  75. package/dist/src/lib/A-Schedule/A-Schedule.component.js +49 -0
  76. package/dist/src/lib/A-Schedule/A-Schedule.component.js.map +1 -0
  77. package/dist/src/{types/A_ScheduleObject.types.d.ts → lib/A-Schedule/A-Schedule.types.d.ts} +2 -1
  78. package/dist/src/{types/ASEID.types.js → lib/A-Schedule/A-Schedule.types.js} +1 -3
  79. package/dist/src/lib/A-Schedule/A-Schedule.types.js.map +1 -0
  80. package/dist/src/lib/A-Schedule/A-ScheduleObject.class.d.ts +29 -0
  81. package/dist/src/{global/A_ScheduleObject.class.js → lib/A-Schedule/A-ScheduleObject.class.js} +25 -5
  82. package/dist/src/lib/A-Schedule/A-ScheduleObject.class.js.map +1 -0
  83. package/index.ts +23 -47
  84. package/jest.config.ts +3 -3
  85. package/package.json +6 -6
  86. package/src/constants/errors.constants.ts +0 -78
  87. package/src/lib/A-Channel/A-Channel.component.ts +8 -0
  88. package/src/lib/A-Channel/A-Channel.error.ts +6 -0
  89. package/src/lib/A-Channel/A-Channel.types.ts +0 -0
  90. package/src/lib/A-Command/A-Command.constants.ts +31 -0
  91. package/src/lib/A-Command/A-Command.entity.ts +327 -0
  92. package/src/lib/A-Command/A-Command.error.ts +6 -0
  93. package/src/lib/A-Command/A-Command.types.ts +100 -0
  94. package/src/lib/A-Config/A-Config.constants.ts +13 -0
  95. package/src/lib/A-Config/A-Config.container.ts +63 -0
  96. package/src/lib/A-Config/A-Config.context.ts +117 -0
  97. package/src/lib/A-Config/A-Config.error.ts +7 -0
  98. package/src/lib/A-Config/A-Config.types.ts +26 -0
  99. package/src/lib/A-Config/components/ConfigReader.component.ts +67 -0
  100. package/src/lib/A-Config/components/ENVConfigReader.component.ts +31 -0
  101. package/src/lib/A-Config/components/FileConfigReader.component.ts +42 -0
  102. package/src/lib/A-Logger/A-Logger.component.ts +190 -0
  103. package/src/lib/A-Logger/A-Logger.types.ts +0 -0
  104. package/src/lib/A-Memory/A-Memory.context.ts +115 -0
  105. package/src/lib/A-Polyfill/A-Polyfill.component.ts +45 -0
  106. package/src/lib/A-Polyfill/A-Polyfill.types.ts +10 -0
  107. package/src/{global/A_Polyfills.ts → lib/A-Polyfill/A-Polyfills.class.ts} +2 -16
  108. package/src/{global/A_Deferred.class.ts → lib/A-Schedule/A-Deferred.class.ts} +4 -0
  109. package/src/lib/A-Schedule/A-Schedule.component.ts +89 -0
  110. package/src/{types/A_ScheduleObject.types.ts → lib/A-Schedule/A-Schedule.types.ts} +7 -2
  111. package/src/{global/A_ScheduleObject.class.ts → lib/A-Schedule/A-ScheduleObject.class.ts} +25 -7
  112. package/tests/A-Channel.test.ts +16 -0
  113. package/tests/A-Command.test.ts +133 -0
  114. package/tests/A-Config.test.ts +185 -0
  115. package/tests/A-Polyfill.test.ts +67 -0
  116. package/tests/A-Schedule.test.ts +84 -0
  117. package/tests/jest.setup.ts +35 -0
  118. package/tsconfig.build.json +56 -0
  119. package/tsconfig.json +2 -2
  120. package/dist/src/global/ASEID.class.d.ts +0 -77
  121. package/dist/src/global/ASEID.class.js +0 -129
  122. package/dist/src/global/ASEID.class.js.map +0 -1
  123. package/dist/src/global/A_Deferred.class.js.map +0 -1
  124. package/dist/src/global/A_Entity.class.d.ts +0 -49
  125. package/dist/src/global/A_Entity.class.js +0 -94
  126. package/dist/src/global/A_Entity.class.js.map +0 -1
  127. package/dist/src/global/A_Error.class.d.ts +0 -13
  128. package/dist/src/global/A_Error.class.js +0 -63
  129. package/dist/src/global/A_Error.class.js.map +0 -1
  130. package/dist/src/global/A_Polyfills.js.map +0 -1
  131. package/dist/src/global/A_ScheduleObject.class.d.ts +0 -9
  132. package/dist/src/global/A_ScheduleObject.class.js.map +0 -1
  133. package/dist/src/global/A_ServerError.class.d.ts +0 -13
  134. package/dist/src/global/A_ServerError.class.js +0 -57
  135. package/dist/src/global/A_ServerError.class.js.map +0 -1
  136. package/dist/src/helpers/A_Common.helper.d.ts +0 -42
  137. package/dist/src/helpers/A_Common.helper.js +0 -214
  138. package/dist/src/helpers/A_Common.helper.js.map +0 -1
  139. package/dist/src/helpers/A_Schedule.helper.d.ts +0 -6
  140. package/dist/src/helpers/A_Schedule.helper.js +0 -21
  141. package/dist/src/helpers/A_Schedule.helper.js.map +0 -1
  142. package/dist/src/types/ASEID.types.d.ts +0 -65
  143. package/dist/src/types/ASEID.types.js.map +0 -1
  144. package/dist/src/types/A_Common.types.d.ts +0 -59
  145. package/dist/src/types/A_Common.types.js +0 -3
  146. package/dist/src/types/A_Common.types.js.map +0 -1
  147. package/dist/src/types/A_Entity.types.d.ts +0 -13
  148. package/dist/src/types/A_Entity.types.js +0 -4
  149. package/dist/src/types/A_Entity.types.js.map +0 -1
  150. package/dist/src/types/A_Error.type.d.ts +0 -7
  151. package/dist/src/types/A_Error.type.js +0 -3
  152. package/dist/src/types/A_Error.type.js.map +0 -1
  153. package/dist/src/types/A_Error.types.d.ts +0 -7
  154. package/dist/src/types/A_Error.types.js +0 -3
  155. package/dist/src/types/A_Error.types.js.map +0 -1
  156. package/dist/src/types/A_ScheduleObject.types.js +0 -3
  157. package/dist/src/types/A_ScheduleObject.types.js.map +0 -1
  158. package/dist/src/types/A_ServerError.types.d.ts +0 -4
  159. package/dist/src/types/A_ServerError.types.js +0 -3
  160. package/dist/src/types/A_ServerError.types.js.map +0 -1
  161. package/src/global/ASEID.class.ts +0 -208
  162. package/src/global/A_Error.class.ts +0 -88
  163. package/src/global/A_ServerError.class.ts +0 -70
  164. package/src/helpers/A_Common.helper.ts +0 -265
  165. package/src/helpers/A_Schedule.helper.ts +0 -25
  166. package/src/types/ASEID.types.ts +0 -86
  167. package/src/types/A_Common.types.ts +0 -111
  168. package/src/types/A_Entity.types.ts +0 -17
  169. package/src/types/A_Error.types.ts +0 -10
  170. package/src/types/A_ServerError.types.ts +0 -7
  171. package/tests/default.test.ts +0 -160
  172. package/tests/polyfill.test.ts +0 -37
@@ -1,86 +0,0 @@
1
- export interface A_TYPES__ASEID_Constructor {
2
-
3
- /**
4
- * Namespace for the ASEID
5
- * Generally it is the application name or code, should correspond to the namespace of the application
6
- * Could be ID or ASEID
7
- */
8
- namespace?: string,
9
-
10
- /**
11
- * Entity Scope the primary location of the resource
12
- * Organization, or organization Unit
13
- * Could be ID or ASEID
14
- *
15
- */
16
- scope: number | string
17
-
18
- /**
19
- * Entity Type the type of the resource
20
- */
21
- entity: string
22
-
23
- /**
24
- * Entity ID the unique identifier of the resource
25
- */
26
- id: number | string
27
-
28
-
29
- /**
30
- * Version of the entity (optional)
31
- */
32
- version?: string
33
-
34
- /**
35
- * Shard of the entity (optional)
36
- */
37
- shard?: string
38
- };
39
-
40
-
41
- export interface A_TYPES__ASEID_ConstructorConfig {
42
-
43
-
44
- /**
45
- * If true, the entity ASEID will be distributed across multiple shards.
46
- * In this case SHARD should be provided via Environment Variables (A_SHARD) or Configurations
47
- *
48
- */
49
- sharding?: boolean
50
- };
51
-
52
-
53
-
54
-
55
- export type A_TYPES__ASEID_JSON = {
56
- /**
57
- * Namespace for the ASEID
58
- */
59
- namespace: string,
60
-
61
- /**
62
- * Entity Scope the primary location of the resource
63
- */
64
- scope: string,
65
-
66
- /**
67
- * Entity Type the type of the resource
68
- */
69
- entity: string,
70
-
71
- /**
72
- * Entity ID the unique identifier of the resource
73
- */
74
- id: string,
75
-
76
- /**
77
- * Version of the entity (optional)
78
- */
79
- version?: string,
80
-
81
- /**
82
- * Shard of the entity (optional)
83
- */
84
- shard?: string
85
- }
86
-
@@ -1,111 +0,0 @@
1
- export type A_AUTH_RequestParam = {
2
- id?: string,
3
- /**
4
- * The issuer of the parameter. Could be system, custom, proxy, credentials or SIC to data provider service(e.g. CSS)
5
- */
6
- issuer?: 'system' | 'custom' | 'proxy' | 'credentials' | string;
7
- /**
8
- * Common internal value, uses for proper mapping
9
- */
10
- key?: string,
11
- /**
12
- * Allows to define the type of the parameter to convert input during the execution
13
- */
14
- type: 'json' | 'array' | 'number' | 'string' | 'boolean' | 'base_64' | 'file' | 'file_url';
15
- /**
16
- * The name of the parameter
17
- */
18
- name: string,
19
- /**
20
- * The value of the parameter
21
- */
22
- value: string
23
- }
24
-
25
-
26
-
27
-
28
-
29
- // =======================================================
30
- // ==================== COMMON TYPES =====================
31
- // =======================================================
32
-
33
- type Primitive = string | number | boolean | bigint | symbol | null | undefined;
34
- type Decrement = [never, 0, 1, 2, 3, 4, 5];
35
-
36
- export type A_TYPES__DeepPartial<T, D extends number = 5> = {
37
- [P in keyof Required<T>]?:
38
- [D] extends [never] ? any :
39
-
40
- Required<T>[P] extends Array<infer U>
41
- ? Array<A_TYPES__DeepPartial<U, Decrement[D]>>
42
-
43
- : Required<T>[P] extends Function
44
- ? Required<T>[P]
45
-
46
- : Required<T>[P] extends object
47
- ? A_TYPES__DeepPartial<T[P], Decrement[D]>
48
- : T[P]
49
- };
50
-
51
-
52
- // export type A_TYPES__DeepPartial<T> = {
53
- // [P in keyof Required<T>]?: Required<T>[P] extends object ? A_TYPES__DeepPartial<T[P]> : T[P];
54
- // };
55
-
56
- export type A_TYPES__ObjectKeyEnum<T, E> = {
57
- [P in keyof Required<T>]?: T[P] extends object ? A_TYPES__ObjectKeyEnum<T[P], E> : E;
58
- };
59
-
60
-
61
- export type A_TYPES__Dictionary<T> = {
62
- [Key: string]: T;
63
- }
64
-
65
-
66
- export type A_TYPES__NonObjectPaths<T> = T extends object ? { [K in keyof T]:
67
- `${Exclude<K, symbol>}${""}`
68
- }[keyof T] : never
69
-
70
-
71
-
72
-
73
- export type A_TYPES__Paths<T, D extends number = 5> = [D] extends [never] ? never : (
74
- T extends object ? { [K in keyof T]:
75
- `${Exclude<K, symbol>}${"" | `.${A_TYPES__Paths<T[K], Decrement[D]>}`}`
76
- }[keyof T] : never
77
- );
78
-
79
- export type A_TYPES__UnionToIntersection<U> =
80
- (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
81
-
82
-
83
- export type A_TYPES__PathsToObject<_Obj, T extends readonly string[]> = A_TYPES__UnionToIntersection<
84
- {
85
- [K in keyof T]: T[K] extends `${infer Key}.${infer Rest}`
86
- ? { [P in Key]: P extends keyof _Obj
87
- ? A_TYPES__PathsToObject<Required<_Obj>[P], [Rest]>
88
- : any
89
-
90
- }
91
- : { [P in T[K]]:
92
- `${T[K]}` extends keyof Required<_Obj> ? Required<_Obj>[`${T[K]}`] : never
93
- };
94
- }[number]
95
- >;
96
-
97
- export type A_TYPES__Required<T, arr extends (A_TYPES__Paths<T>)[] = (A_TYPES__Paths<T>)[]> = A_TYPES__PathsToObject<T, arr> & T;
98
-
99
-
100
- export type A_TYPES__ExtractNested<T, P extends string> = P extends `${infer K}.${infer Rest}`
101
- ? K extends keyof T
102
- ? { [Key in K]: A_TYPES__ExtractNested<T[K], Rest> }
103
- : never
104
- : P extends keyof T
105
- ? { [Key in P]: T[P] }
106
- : never;
107
-
108
-
109
- export type A_TYPES__ExtractProperties<T, P extends A_TYPES__Paths<T>[]> = A_TYPES__UnionToIntersection<{
110
- [K in keyof P]: P[K] extends string ? A_TYPES__ExtractNested<T, P[K]> : never
111
- }[number]>;
@@ -1,17 +0,0 @@
1
- import { ASEID } from "../global/ASEID.class";
2
-
3
- export interface A_TYPES__IAEntity {
4
- /**
5
- * The ASEID of the entity
6
- */
7
- aseid: ASEID
8
- };
9
-
10
-
11
- export type A_TYPES__AEntity_JSON = {
12
- /**
13
- * The ASEID of the entity
14
- */
15
- aseid: string
16
- };
17
-
@@ -1,10 +0,0 @@
1
- export type A_TYPES__Error = {
2
- message: string;
3
- code: string;
4
- description: string
5
-
6
- link?: string,
7
- originalError?: Error | unknown
8
- }
9
-
10
-
@@ -1,7 +0,0 @@
1
- import { A_TYPES__Error } from "./A_Error.types";
2
-
3
- export type A_TYPES__ServerError = {
4
-
5
- serverCode: number,
6
-
7
- } & A_TYPES__Error
@@ -1,160 +0,0 @@
1
- import { A_CommonHelper } from '@adaas/a-utils/helpers/A_Common.helper';
2
- import { A_ScheduleHelper } from '@adaas/a-utils/helpers/A_Schedule.helper';
3
- import { A_TYPES__DeepPartial } from '@adaas/a-utils/types/A_Common.types';
4
- import { config } from 'dotenv';
5
- config();
6
- jest.retryTimes(0);
7
-
8
- describe('CommonHelper Tests', () => {
9
-
10
- it('Schedule Should execute promise and await it ', async () => {
11
-
12
- const start = Date.now();
13
- let res = '';
14
-
15
- try {
16
- const scheduler = A_ScheduleHelper.schedule(3000, async () => {
17
- return 'RESOLVED';
18
- });
19
-
20
-
21
- res = await scheduler.promise;
22
-
23
- } catch (error) {
24
- // Handle error if any
25
- } finally {
26
- const end = Date.now();
27
- const duration = end - start;
28
-
29
- expect(res).toBe('RESOLVED');
30
- // Check if the duration exceeds 3 seconds
31
- expect(duration).toBeGreaterThan(3000);
32
- }
33
-
34
- });
35
-
36
- it('Schedule Should be canceled and rejected', async () => {
37
-
38
- const start = Date.now();
39
- let res = '';
40
-
41
- try {
42
- const scheduler = A_ScheduleHelper.schedule(3000, async () => {
43
- return 'RESOLVED';
44
- });
45
-
46
-
47
- scheduler.clear();
48
- res = await scheduler.promise;
49
- } catch (error) {
50
- // Handle error if any
51
- } finally {
52
- const end = Date.now();
53
- const duration = end - start;
54
-
55
- expect(res).toBe('');
56
- // Check if the duration exceeds 3 seconds
57
- expect(duration).toBeLessThan(3000);
58
- }
59
-
60
- });
61
-
62
- it('Deep Clone and Merge ', async () => {
63
-
64
- type TestType = {
65
- a: string,
66
- b: string,
67
- c: {
68
- d: string
69
- },
70
- f: (name: string) => string
71
- s: Date
72
- }
73
-
74
- const t: TestType = {
75
- a: 'a',
76
- b: 'b',
77
- c: {
78
- d: 'd'
79
- },
80
- f: (name: string) => { return name },
81
- s: new Date()
82
- }
83
-
84
- const t2: A_TYPES__DeepPartial<TestType> = {
85
- a: 'aa',
86
- c: {
87
- d: 'dd'
88
- },
89
- f: (name: string) => { return name + '2' }
90
- }
91
-
92
- const merged = A_CommonHelper.deepCloneAndMerge(t2, t);
93
-
94
-
95
- const name = merged.f('names');
96
-
97
-
98
- expect(merged.a).toBe('aa');
99
- expect(merged.b).toBe('b');
100
- expect(merged.c.d).toBe('dd');
101
- expect(name).toBe('names2');
102
- expect(t).not.toEqual(merged);
103
- expect(t2).not.toEqual(merged);
104
- });
105
-
106
- it('Deep Clone Different Types', async () => {
107
-
108
- type TestType = {
109
- a: string,
110
- b: string,
111
- c: {
112
- d: string
113
- },
114
- bool:{
115
- a: boolean
116
- },
117
- f: (name: string) => string
118
- s: Date
119
- }
120
-
121
- const t: TestType = {
122
- a: 'a',
123
- b: 'b',
124
- c: {
125
- d: 'd'
126
- },
127
- bool:{
128
- a: true
129
- },
130
- f: (name: string) => { return name },
131
- s: new Date()
132
- }
133
-
134
- const t2: any = {
135
- e: 'foo',
136
- b: 'bb',
137
- c:{
138
- d: 'ddd'
139
- },
140
- bool:{
141
- a: false
142
- },
143
- some: {
144
- d: 'dd'
145
- },
146
- }
147
-
148
- const merged = A_CommonHelper.deepCloneAndMerge(t2, t);
149
-
150
- console.log('merged: ', merged)
151
-
152
- expect(merged.a).toBe('a');
153
- expect(merged.b).toBe('bb');
154
- expect(merged.c.d).toBe('ddd');
155
- expect(merged.bool.a).toBe(false);
156
- expect((merged as any).e).toBe('foo');
157
- expect((merged as any).some.d).toBe('dd');
158
- expect(merged.f('names')).toBe('names');
159
- });
160
- });
@@ -1,37 +0,0 @@
1
- import { config } from 'dotenv';
2
- import { A_Polyfills } from '../src/global/A_Polyfills'
3
- config();
4
- jest.retryTimes(0);
5
-
6
- describe('Polyfill Tests', () => {
7
-
8
- it('It Should return fs', async () => {
9
-
10
- const fs = await A_Polyfills.fs();
11
-
12
-
13
- console.log('fs: ', fs)
14
-
15
-
16
- });
17
- it('It Should return crypto', async () => {
18
-
19
- const crypto = await A_Polyfills.crypto();
20
-
21
- console.log('crypto: ', crypto)
22
-
23
- });
24
-
25
- it('Crypto should calculate Hash', async () => {
26
-
27
- const crypto = await A_Polyfills.crypto();
28
-
29
- const hash = await crypto.createFileHash('./index.ts', 'sha-256');
30
-
31
- console.log('hash: ', hash)
32
-
33
-
34
- });
35
-
36
-
37
- });