@futdevpro/fsm-dynamo 1.15.8 → 1.15.10

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 (38) hide show
  1. package/.dynamo/version-bump.config.json +5 -0
  2. package/.github/workflows/main.yml +427 -394
  3. package/.husky/pre-commit +1 -0
  4. package/README.md +3 -0
  5. package/__documentations/2026-05-17-oai-compatible-providers-howto.md +282 -0
  6. package/package.json +64 -34
  7. package/pipeline.cicd.config.json +128 -0
  8. package/src/_collections/utils/async.util.spec.ts +354 -0
  9. package/src/_collections/utils/data.util.spec.ts +345 -0
  10. package/src/_collections/utils/json-error-helper.util.spec.ts +521 -0
  11. package/src/_collections/utils/math/box-bounds.spec.ts +74 -0
  12. package/src/_collections/utils/utilities.util.spec.ts +201 -0
  13. package/src/_models/control-models/http/http-error-response.control-model.spec.ts +116 -0
  14. package/src/_models/control-models/http/http-headers.control-model.spec.ts +25 -0
  15. package/src/_models/control-models/http/http-response.model-base.spec.ts +46 -0
  16. package/src/_models/control-models/server-status.control-model.spec.ts +66 -0
  17. package/src/_models/control-models/service-endpoint-settings-base.control-model.spec.ts +145 -0
  18. package/src/_models/data-models/errors.data-model.spec.ts +71 -0
  19. package/src/_models/data-models/metadata.data-model.spec.ts +184 -0
  20. package/src/_modules/ai/_modules/anthropic/_models/aai-call-settings.control-model.spec.ts +28 -0
  21. package/src/_modules/ai/_modules/anthropic/_models/aai-settings.control-model.spec.ts +22 -0
  22. package/src/_modules/ai/_modules/google-ai/_models/gai-call-settings.control-model.spec.ts +28 -0
  23. package/src/_modules/ai/_modules/google-ai/_models/gai-settings.control-model.spec.ts +22 -0
  24. package/src/_modules/ai/_modules/local-ai/_models/lai-call-settings.control-model.spec.ts +28 -0
  25. package/src/_modules/ai/_modules/local-ai/_models/lai-settings.control-model.spec.ts +22 -0
  26. package/src/_modules/ai/_modules/open-ai/_models/oai-call-settings.control-model.spec.ts +28 -0
  27. package/src/_modules/ai/_modules/open-ai/_models/oai-settings.control-model.spec.ts +22 -0
  28. package/src/_modules/ci-tools/_models/cit-ci-result-info.data-models.spec.ts +58 -0
  29. package/src/_modules/data-handler/_models/data-handler-settings.control-model.spec.ts +110 -0
  30. package/src/_modules/data-handler/_models/data-handler.control-model.spec.ts +445 -0
  31. package/src/_modules/data-handler/_models/data-list-handler.control-model.spec.ts +263 -0
  32. package/src/_modules/data-handler/_models/data-search-handler.control-model.spec.ts +417 -0
  33. package/src/_modules/data-handler/_models/list-collector-data-handler.control-model.spec.ts +374 -0
  34. package/src/_modules/messaging/_models/msg-conversation.data-model.spec.ts +69 -0
  35. package/src/_modules/messaging/_models/msg-message.data-model.spec.ts +79 -0
  36. package/src/_modules/pipe/_collections/utils/pip-json-pipe.util.spec.ts +62 -0
  37. package/src/_modules/pipe/_collections/utils/pip-multi-pipe-pipe.util.spec.ts +10 -3
  38. package/futdevpro-fsm-dynamo-01.15.8.tgz +0 -0
@@ -0,0 +1,345 @@
1
+ import { DyFM_Data } from './data.util';
2
+ import { DyFM_Math } from './math/math.util';
3
+
4
+ describe('| DyFM_Data', (): void => {
5
+
6
+ describe('| constants', (): void => {
7
+ it('| should have correct kilobyte value', (): void => {
8
+ expect(DyFM_Data.kilobyte).toBe(1024);
9
+ });
10
+
11
+ it('| should have correct megabyte value', (): void => {
12
+ expect(DyFM_Data.megabyte).toBe(1024 * 1024);
13
+ });
14
+
15
+ it('| should have correct gigabyte value', (): void => {
16
+ expect(DyFM_Data.gigabyte).toBe(1024 * 1024 * 1024);
17
+ });
18
+
19
+ it('| should have correct terabyte value', (): void => {
20
+ expect(DyFM_Data.terabyte).toBe(1024 * 1024 * 1024 * 1024);
21
+ });
22
+ });
23
+
24
+ describe('| getSizeString', (): void => {
25
+ it('| should return "0B" for zero size', (): void => {
26
+ expect(DyFM_Data.getSizeString(0)).toBe('0B');
27
+ });
28
+
29
+ it('| should return "N/A" for null or undefined size', (): void => {
30
+ expect(DyFM_Data.getSizeString(null as any)).toBe('N/A');
31
+ expect(DyFM_Data.getSizeString(undefined as any)).toBe('N/A');
32
+ });
33
+
34
+ it('| should format bytes less than 1KB', (): void => {
35
+ expect(DyFM_Data.getSizeString(512)).toBe('512B');
36
+ expect(DyFM_Data.getSizeString(1023)).toBe('1023B');
37
+ });
38
+
39
+ it('| should format kilobytes', (): void => {
40
+ expect(DyFM_Data.getSizeString(1536)).toBe('1.5KB');
41
+ expect(DyFM_Data.getSizeString(2048)).toBe('2KB');
42
+ expect(DyFM_Data.getSizeString(1024 * 10)).toBe('10KB');
43
+ });
44
+
45
+ it('| should format megabytes', (): void => {
46
+ expect(DyFM_Data.getSizeString(1024 * 1024)).toBe('1MB');
47
+ expect(DyFM_Data.getSizeString(1024 * 1024 * 1.5)).toBe('1.5MB');
48
+ expect(DyFM_Data.getSizeString(1024 * 1024 * 10)).toBe('10MB');
49
+ });
50
+
51
+ it('| should format gigabytes', (): void => {
52
+ expect(DyFM_Data.getSizeString(1024 * 1024 * 1024)).toBe('1GB');
53
+ expect(DyFM_Data.getSizeString(1024 * 1024 * 1024 * 1.5)).toBe('1.5GB');
54
+ });
55
+
56
+ it('| should format terabytes', (): void => {
57
+ expect(DyFM_Data.getSizeString(1024 * 1024 * 1024 * 1024)).toBe('1TB');
58
+ });
59
+
60
+ it('| should handle negative values', (): void => {
61
+ expect(DyFM_Data.getSizeString(-512)).toBe('-512B');
62
+ expect(DyFM_Data.getSizeString(-1536)).toBe('-1.5KB');
63
+ });
64
+
65
+ it('| should use custom decimals when provided', (): void => {
66
+ expect(DyFM_Data.getSizeString(1536, 1)).toBe('1.5KB');
67
+ expect(DyFM_Data.getSizeString(1536, 3)).toBe('1.5KB');
68
+ expect(DyFM_Data.getSizeString(1536, 0)).toBe('2KB');
69
+ });
70
+
71
+ it('| should show full format with remainder when full=true', (): void => {
72
+ const result = DyFM_Data.getSizeString(1536, 0, true);
73
+ expect(result).toContain('KB');
74
+ expect(result).toContain('B');
75
+ });
76
+
77
+ it('| should show full format for megabytes with remainder', (): void => {
78
+ const size = DyFM_Data.megabyte + DyFM_Data.kilobyte * 256;
79
+ const result = DyFM_Data.getSizeString(size, 0, true);
80
+ expect(result).toContain('MB');
81
+ expect(result).toContain('KB');
82
+ });
83
+
84
+ it('| should show full format for gigabytes with remainder', (): void => {
85
+ const size = DyFM_Data.gigabyte + DyFM_Data.megabyte * 256;
86
+ const result = DyFM_Data.getSizeString(size, 0, true);
87
+ expect(result).toContain('GB');
88
+ expect(result).toContain('MB');
89
+ });
90
+
91
+ it('| should handle very large sizes', (): void => {
92
+ const petabyte = DyFM_Data.petabyte;
93
+ expect(DyFM_Data.getSizeString(petabyte)).toContain('PB');
94
+ });
95
+
96
+ it('| should format petabytes', (): void => {
97
+ expect(DyFM_Data.getSizeString(DyFM_Data.petabyte)).toBe('1PB');
98
+ expect(DyFM_Data.getSizeString(DyFM_Data.petabyte * 1.5)).toBe('1.5PB');
99
+ });
100
+
101
+ it('| should format exabytes', (): void => {
102
+ expect(DyFM_Data.getSizeString(DyFM_Data.exabyte)).toBe('1EB');
103
+ expect(DyFM_Data.getSizeString(DyFM_Data.exabyte * 2.5)).toBe('2.5EB');
104
+ });
105
+
106
+ it('| should format zettabytes', (): void => {
107
+ expect(DyFM_Data.getSizeString(DyFM_Data.zettabyte)).toBe('1ZB');
108
+ expect(DyFM_Data.getSizeString(DyFM_Data.zettabyte * 3.7)).toBe('3.7ZB');
109
+ });
110
+
111
+ it('| should format yottabytes', (): void => {
112
+ expect(DyFM_Data.getSizeString(DyFM_Data.yottabyte)).toBe('1YB');
113
+ expect(DyFM_Data.getSizeString(DyFM_Data.yottabyte * 4.2)).toBe('4.2YB');
114
+ });
115
+
116
+ it('| should handle edge case at exact unit boundaries', (): void => {
117
+ expect(DyFM_Data.getSizeString(DyFM_Data.kilobyte)).toBe('1KB');
118
+ expect(DyFM_Data.getSizeString(DyFM_Data.megabyte)).toBe('1MB');
119
+ expect(DyFM_Data.getSizeString(DyFM_Data.gigabyte)).toBe('1GB');
120
+ expect(DyFM_Data.getSizeString(DyFM_Data.terabyte)).toBe('1TB');
121
+ expect(DyFM_Data.getSizeString(DyFM_Data.petabyte)).toBe('1PB');
122
+ expect(DyFM_Data.getSizeString(DyFM_Data.exabyte)).toBe('1EB');
123
+ expect(DyFM_Data.getSizeString(DyFM_Data.zettabyte)).toBe('1ZB');
124
+ expect(DyFM_Data.getSizeString(DyFM_Data.yottabyte)).toBe('1YB');
125
+ });
126
+
127
+ it('| should not show remainder in full format when remainder is zero', (): void => {
128
+ const result = DyFM_Data.getSizeString(DyFM_Data.kilobyte, 0, true);
129
+ expect(result).toBe('1KB');
130
+ expect(result).not.toContain('0B');
131
+ });
132
+
133
+ it('| should show full format for terabytes with remainder', (): void => {
134
+ const size = DyFM_Data.terabyte + DyFM_Data.gigabyte * 256;
135
+ const result = DyFM_Data.getSizeString(size, 0, true);
136
+ expect(result).toContain('TB');
137
+ expect(result).toContain('GB');
138
+ });
139
+
140
+ it('| should show full format for petabytes with remainder', (): void => {
141
+ const size = DyFM_Data.petabyte + DyFM_Data.terabyte * 512;
142
+ const result = DyFM_Data.getSizeString(size, 0, true);
143
+ expect(result).toContain('PB');
144
+ expect(result).toContain('TB');
145
+ });
146
+
147
+ it('| should handle negative values with full format', (): void => {
148
+ const result = DyFM_Data.getSizeString(-1536, 0, true);
149
+ expect(result).toContain('-');
150
+ expect(result).toContain('KB');
151
+ });
152
+
153
+ it('| should handle very large negative values', (): void => {
154
+ const result = DyFM_Data.getSizeString(-DyFM_Data.gigabyte);
155
+ expect(result).toContain('-');
156
+ expect(result).toContain('GB');
157
+ });
158
+
159
+ it('| should handle custom decimals for large sizes', (): void => {
160
+ const size = DyFM_Data.terabyte * 1.234;
161
+ const result = DyFM_Data.getSizeString(size, 3);
162
+ expect(result).toContain('TB');
163
+ expect(result).toMatch(/1\.\d{3}TB/);
164
+ });
165
+
166
+ it('| should show full format for exabytes with remainder', (): void => {
167
+ const size = DyFM_Data.exabyte + DyFM_Data.petabyte * 512;
168
+ const result = DyFM_Data.getSizeString(size, 0, true);
169
+ expect(result).toContain('EB');
170
+ expect(result).toContain('PB');
171
+ });
172
+
173
+ it('| should show full format for zettabytes with remainder', (): void => {
174
+ const size = DyFM_Data.zettabyte + DyFM_Data.exabyte * 256;
175
+ const result = DyFM_Data.getSizeString(size, 0, true);
176
+ expect(result).toContain('ZB');
177
+ expect(result).toContain('EB');
178
+ });
179
+
180
+ it('| should show full format for yottabytes with remainder', (): void => {
181
+ const size = DyFM_Data.yottabyte + DyFM_Data.zettabyte * 128;
182
+ const result = DyFM_Data.getSizeString(size, 0, true);
183
+ expect(result).toContain('YB');
184
+ expect(result).toContain('ZB');
185
+ });
186
+
187
+ it('| should not show remainder in full format for exabytes when remainder is zero', (): void => {
188
+ const result = DyFM_Data.getSizeString(DyFM_Data.exabyte, 0, true);
189
+ expect(result).toBe('1EB');
190
+ expect(result).not.toContain('0PB');
191
+ });
192
+
193
+ it('| should not show remainder in full format for zettabytes when remainder is zero', (): void => {
194
+ const result = DyFM_Data.getSizeString(DyFM_Data.zettabyte, 0, true);
195
+ expect(result).toBe('1ZB');
196
+ expect(result).not.toContain('0EB');
197
+ });
198
+
199
+ it('| should not show remainder in full format for yottabytes when remainder is zero', (): void => {
200
+ const result = DyFM_Data.getSizeString(DyFM_Data.yottabyte, 0, true);
201
+ expect(result).toBe('1YB');
202
+ expect(result).not.toContain('0ZB');
203
+ });
204
+
205
+ it('| should handle KB with remainder in full format', (): void => {
206
+ const size = DyFM_Data.kilobyte + 512;
207
+ const result = DyFM_Data.getSizeString(size, 0, true);
208
+ expect(result).toContain('KB');
209
+ expect(result).toContain('B');
210
+ });
211
+
212
+ it('| should handle negative KB with remainder in full format', (): void => {
213
+ const size = -(DyFM_Data.kilobyte + 512);
214
+ const result = DyFM_Data.getSizeString(size, 0, true);
215
+ expect(result).toContain('-');
216
+ expect(result).toContain('KB');
217
+ });
218
+
219
+ it('| should handle PB without remainder in full format', (): void => {
220
+ // Test case for line 169-170: PB without remainder case
221
+ const size = DyFM_Data.petabyte; // Exactly 1 PB
222
+ const result = DyFM_Data.getSizeString(size, 0, true);
223
+ expect(result).toBe('1PB');
224
+ expect(result).not.toContain('TB');
225
+ });
226
+
227
+ it('| should handle PB with remainder in full format', (): void => {
228
+ // Test case for line 166-167: PB with remainder
229
+ const size = DyFM_Data.petabyte + DyFM_Data.terabyte * 512;
230
+ const result = DyFM_Data.getSizeString(size, 0, true);
231
+ expect(result).toContain('PB');
232
+ expect(result).toContain('TB');
233
+ });
234
+
235
+ it('| should handle all size ranges with full format - KB', (): void => {
236
+ const size = DyFM_Data.kilobyte + 512;
237
+ const result = DyFM_Data.getSizeString(size, 0, true);
238
+ expect(result).toContain('KB');
239
+ expect(result).toContain('B');
240
+ });
241
+
242
+ it('| should handle all size ranges with full format - MB', (): void => {
243
+ const size = DyFM_Data.megabyte + DyFM_Data.kilobyte * 256;
244
+ const result = DyFM_Data.getSizeString(size, 0, true);
245
+ expect(result).toContain('MB');
246
+ expect(result).toContain('KB');
247
+ });
248
+
249
+ it('| should handle all size ranges with full format - GB', (): void => {
250
+ const size = DyFM_Data.gigabyte + DyFM_Data.megabyte * 256;
251
+ const result = DyFM_Data.getSizeString(size, 0, true);
252
+ expect(result).toContain('GB');
253
+ expect(result).toContain('MB');
254
+ });
255
+
256
+ it('| should handle all size ranges with full format - TB', (): void => {
257
+ const size = DyFM_Data.terabyte + DyFM_Data.gigabyte * 256;
258
+ const result = DyFM_Data.getSizeString(size, 0, true);
259
+ expect(result).toContain('TB');
260
+ expect(result).toContain('GB');
261
+ });
262
+
263
+ it('| should handle all size ranges with full format - PB', (): void => {
264
+ const size = DyFM_Data.petabyte + DyFM_Data.terabyte * 512;
265
+ const result = DyFM_Data.getSizeString(size, 0, true);
266
+ expect(result).toContain('PB');
267
+ expect(result).toContain('TB');
268
+ });
269
+
270
+ it('| should handle all size ranges with full format - EB', (): void => {
271
+ const size = DyFM_Data.exabyte + DyFM_Data.petabyte * 512;
272
+ const result = DyFM_Data.getSizeString(size, 0, true);
273
+ expect(result).toContain('EB');
274
+ expect(result).toContain('PB');
275
+ });
276
+
277
+ it('| should handle all size ranges with full format - ZB', (): void => {
278
+ const size = DyFM_Data.zettabyte + DyFM_Data.exabyte * 256;
279
+ const result = DyFM_Data.getSizeString(size, 0, true);
280
+ expect(result).toContain('ZB');
281
+ expect(result).toContain('EB');
282
+ });
283
+
284
+ it('| should handle all size ranges with full format - YB', (): void => {
285
+ const size = DyFM_Data.yottabyte + DyFM_Data.zettabyte * 128;
286
+ const result = DyFM_Data.getSizeString(size, 0, true);
287
+ expect(result).toContain('YB');
288
+ expect(result).toContain('ZB');
289
+ });
290
+
291
+ it('| should handle negative values with full format for all ranges', (): void => {
292
+ const sizes = [
293
+ -(DyFM_Data.kilobyte + 512),
294
+ -(DyFM_Data.megabyte + DyFM_Data.kilobyte * 256),
295
+ -(DyFM_Data.gigabyte + DyFM_Data.megabyte * 256),
296
+ -(DyFM_Data.terabyte + DyFM_Data.gigabyte * 256),
297
+ -(DyFM_Data.petabyte + DyFM_Data.terabyte * 512),
298
+ ];
299
+
300
+ sizes.forEach(size => {
301
+ const result = DyFM_Data.getSizeString(size, 0, true);
302
+ expect(result).toContain('-');
303
+ });
304
+ });
305
+
306
+ it('| should handle exact boundaries with full format', (): void => {
307
+ // Test exact unit boundaries with full format
308
+ const boundaries = [
309
+ DyFM_Data.kilobyte,
310
+ DyFM_Data.megabyte,
311
+ DyFM_Data.gigabyte,
312
+ DyFM_Data.terabyte,
313
+ DyFM_Data.petabyte,
314
+ DyFM_Data.exabyte,
315
+ DyFM_Data.zettabyte,
316
+ DyFM_Data.yottabyte,
317
+ ];
318
+
319
+ boundaries.forEach(size => {
320
+ const result = DyFM_Data.getSizeString(size, 0, true);
321
+ expect(result).toMatch(/^\d+(KB|MB|GB|TB|PB|EB|ZB|YB)$/);
322
+ expect(result).not.toMatch(/\s/); // No space means no remainder
323
+ });
324
+ });
325
+ });
326
+
327
+ describe('| constants - all units', (): void => {
328
+ it('| should have correct petabyte value', (): void => {
329
+ expect(DyFM_Data.petabyte).toBe(1024 * 1024 * 1024 * 1024 * 1024);
330
+ });
331
+
332
+ it('| should have correct exabyte value', (): void => {
333
+ expect(DyFM_Data.exabyte).toBe(1024 * 1024 * 1024 * 1024 * 1024 * 1024);
334
+ });
335
+
336
+ it('| should have correct zettabyte value', (): void => {
337
+ expect(DyFM_Data.zettabyte).toBe(1024 * 1024 * 1024 * 1024 * 1024 * 1024 * 1024);
338
+ });
339
+
340
+ it('| should have correct yottabyte value', (): void => {
341
+ expect(DyFM_Data.yottabyte).toBe(1024 * 1024 * 1024 * 1024 * 1024 * 1024 * 1024 * 1024);
342
+ });
343
+ });
344
+ });
345
+