@startinblox/components-ds4go 2.3.0 → 3.0.0

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 (49) hide show
  1. package/.gitlab-ci.yml +8 -2
  2. package/AGENTS.md +516 -0
  3. package/cypress/component/no-component-test.cy.ts +9 -0
  4. package/cypress/e2e/helpers/components/setupCacheInvalidation.cy.ts +512 -0
  5. package/cypress/e2e/helpers/components/setupCacheOnResourceReady.cy.ts +483 -0
  6. package/cypress/e2e/helpers/components/setupComponentSubscriptions.cy.ts +239 -0
  7. package/cypress/e2e/helpers/components/setupOnSaveReset.cy.ts +380 -0
  8. package/cypress/e2e/helpers/datas/checkValueInIntervalRecursive.cy.ts +563 -0
  9. package/cypress/e2e/helpers/datas/dataBuilder.cy.ts +508 -0
  10. package/cypress/e2e/helpers/datas/filterGenerator.cy.ts +285 -0
  11. package/cypress/e2e/helpers/datas/filterObjectByDateAfter.cy.ts +389 -0
  12. package/cypress/e2e/helpers/datas/filterObjectByDateInterval.cy.ts +613 -0
  13. package/cypress/e2e/helpers/datas/filterObjectById.cy.ts +276 -0
  14. package/cypress/e2e/helpers/datas/filterObjectByInterval.cy.ts +237 -0
  15. package/cypress/e2e/helpers/datas/filterObjectByNamedValue.cy.ts +299 -0
  16. package/cypress/e2e/helpers/datas/filterObjectByType.cy.ts +307 -0
  17. package/cypress/e2e/helpers/datas/filterObjectByValue.cy.ts +375 -0
  18. package/cypress/e2e/helpers/datas/sort.cy.ts +293 -0
  19. package/cypress/e2e/helpers/ui/formatDate.cy.ts +233 -0
  20. package/cypress/e2e/helpers/utils/requestNavigation.cy.ts +257 -0
  21. package/cypress/e2e/helpers/utils/uniq.cy.ts +160 -0
  22. package/cypress/support/e2e.ts +1 -0
  23. package/cypress.config.ts +2 -0
  24. package/dist/index.js +1102 -1002
  25. package/package.json +10 -10
  26. package/src/components/solid-boilerplate.ts +76 -0
  27. package/src/helpers/components/componentObjectHandler.ts +5 -7
  28. package/src/helpers/components/componentObjectsHandler.ts +8 -3
  29. package/src/helpers/components/orbitComponent.ts +87 -68
  30. package/src/helpers/components/setupCacheInvalidation.ts +50 -23
  31. package/src/helpers/components/setupCacheOnResourceReady.ts +42 -23
  32. package/src/helpers/components/setupComponentSubscriptions.ts +10 -9
  33. package/src/helpers/components/setupOnSaveReset.ts +27 -5
  34. package/src/helpers/datas/checkValueInIntervalRecursive.ts +66 -0
  35. package/src/helpers/datas/dataBuilder.ts +4 -4
  36. package/src/helpers/datas/filterGenerator.ts +13 -10
  37. package/src/helpers/datas/filterObjectByDateAfter.ts +3 -3
  38. package/src/helpers/datas/filterObjectByDateInterval.ts +44 -0
  39. package/src/helpers/datas/filterObjectById.ts +7 -6
  40. package/src/helpers/datas/filterObjectByInterval.ts +6 -110
  41. package/src/helpers/datas/filterObjectByNamedValue.ts +35 -33
  42. package/src/helpers/datas/filterObjectByType.ts +3 -3
  43. package/src/helpers/datas/filterObjectByValue.ts +17 -16
  44. package/src/helpers/datas/sort.ts +50 -23
  45. package/src/helpers/index.ts +2 -0
  46. package/src/helpers/ui/formatDate.ts +14 -1
  47. package/src/helpers/utils/requestNavigation.ts +5 -2
  48. package/src/helpers/utils/uniq.ts +1 -1
  49. package/cypress/component/solid-boilerplate.cy.ts +0 -9
@@ -0,0 +1,563 @@
1
+ import checkValueInIntervalRecursive from "@helpers/datas/checkValueInIntervalRecursive";
2
+
3
+ describe("checkValueInIntervalRecursive helper function", () => {
4
+ describe("Basic numeric value checking", () => {
5
+ it("should return true when value is within numeric interval", () => {
6
+ const result = checkValueInIntervalRecursive(
7
+ { value: 5 },
8
+ "value",
9
+ 1,
10
+ 10,
11
+ );
12
+ expect(result).to.be.true;
13
+ });
14
+
15
+ it("should return true when value equals start of interval", () => {
16
+ const result = checkValueInIntervalRecursive(
17
+ { value: 5 },
18
+ "value",
19
+ 5,
20
+ 10,
21
+ );
22
+ expect(result).to.be.true;
23
+ });
24
+
25
+ it("should return true when value equals end of interval", () => {
26
+ const result = checkValueInIntervalRecursive(
27
+ { value: 10 },
28
+ "value",
29
+ 5,
30
+ 10,
31
+ );
32
+ expect(result).to.be.true;
33
+ });
34
+
35
+ it("should return false when value is below interval", () => {
36
+ const result = checkValueInIntervalRecursive(
37
+ { value: 3 },
38
+ "value",
39
+ 5,
40
+ 10,
41
+ );
42
+ expect(result).to.be.false;
43
+ });
44
+
45
+ it("should return false when value is above interval", () => {
46
+ const result = checkValueInIntervalRecursive(
47
+ { value: 15 },
48
+ "value",
49
+ 5,
50
+ 10,
51
+ );
52
+ expect(result).to.be.false;
53
+ });
54
+
55
+ it("should return false for null data", () => {
56
+ const result = checkValueInIntervalRecursive(null, "value", 5, 10);
57
+ expect(result).to.be.false;
58
+ });
59
+
60
+ it("should return false for undefined data", () => {
61
+ const result = checkValueInIntervalRecursive(undefined, "value", 5, 10);
62
+ expect(result).to.be.false;
63
+ });
64
+ });
65
+
66
+ describe("Date value checking", () => {
67
+ it("should return true when date is within interval", () => {
68
+ const startDate = new Date("2023-02-01");
69
+ const endDate = new Date("2023-02-28");
70
+ const result = checkValueInIntervalRecursive(
71
+ { date: "2023-02-15" },
72
+ "date",
73
+ startDate,
74
+ endDate,
75
+ );
76
+ expect(result).to.be.true;
77
+ });
78
+
79
+ it("should return true when date equals start of interval", () => {
80
+ const startDate = new Date("2023-02-01");
81
+ const endDate = new Date("2023-02-28");
82
+ const result = checkValueInIntervalRecursive(
83
+ { date: "2023-02-01" },
84
+ "date",
85
+ startDate,
86
+ endDate,
87
+ );
88
+ expect(result).to.be.true;
89
+ });
90
+
91
+ it("should return true when date equals end of interval", () => {
92
+ const startDate = new Date("2023-02-01");
93
+ const endDate = new Date("2023-02-28");
94
+ const result = checkValueInIntervalRecursive(
95
+ { date: "2023-02-28" },
96
+ "date",
97
+ startDate,
98
+ endDate,
99
+ );
100
+ expect(result).to.be.true;
101
+ });
102
+
103
+ it("should return false when date is before interval", () => {
104
+ const startDate = new Date("2023-02-01");
105
+ const endDate = new Date("2023-02-28");
106
+ const result = checkValueInIntervalRecursive(
107
+ { date: "2023-01-15" },
108
+ "date",
109
+ startDate,
110
+ endDate,
111
+ );
112
+ expect(result).to.be.false;
113
+ });
114
+
115
+ it("should return false when date is after interval", () => {
116
+ const startDate = new Date("2023-02-01");
117
+ const endDate = new Date("2023-02-28");
118
+ const result = checkValueInIntervalRecursive(
119
+ { date: "2023-03-15" },
120
+ "date",
121
+ startDate,
122
+ endDate,
123
+ );
124
+ expect(result).to.be.false;
125
+ });
126
+
127
+ it("should handle ISO date strings", () => {
128
+ const startDate = new Date("2023-02-01");
129
+ const endDate = new Date("2023-02-28");
130
+ const result = checkValueInIntervalRecursive(
131
+ { date: "2023-02-15T10:30:00Z" },
132
+ "date",
133
+ startDate,
134
+ endDate,
135
+ );
136
+ expect(result).to.be.true;
137
+ });
138
+
139
+ it("should handle timestamp numbers", () => {
140
+ const startDate = new Date("2023-02-01");
141
+ const endDate = new Date("2023-02-28");
142
+ const result = checkValueInIntervalRecursive(
143
+ { date: "2023-02-15" },
144
+ "date",
145
+ startDate,
146
+ endDate,
147
+ );
148
+ expect(result).to.be.true;
149
+ });
150
+
151
+ it("should handle Date objects", () => {
152
+ const startDate = new Date("2023-02-01");
153
+ const endDate = new Date("2023-02-28");
154
+ const result = checkValueInIntervalRecursive(
155
+ { date: new Date("2023-02-15") },
156
+ "date",
157
+ startDate,
158
+ endDate,
159
+ );
160
+ expect(result).to.be.true;
161
+ });
162
+
163
+ it("should handle invalid date strings", () => {
164
+ const startDate = new Date("2023-02-01");
165
+ const endDate = new Date("2023-02-28");
166
+ const result = checkValueInIntervalRecursive(
167
+ { date: "not a date" },
168
+ "date",
169
+ startDate,
170
+ endDate,
171
+ );
172
+ expect(result).to.be.false;
173
+ });
174
+ });
175
+
176
+ describe("Nested property handling", () => {
177
+ it("should check nested numeric property", () => {
178
+ const result = checkValueInIntervalRecursive(
179
+ { stats: { score: 85 } },
180
+ "stats.score",
181
+ 80,
182
+ 90,
183
+ );
184
+ expect(result).to.be.true;
185
+ });
186
+
187
+ it("should check deeply nested numeric property", () => {
188
+ const result = checkValueInIntervalRecursive(
189
+ { data: { profile: { level: 10 } } },
190
+ "data.profile.level",
191
+ 7,
192
+ 12,
193
+ );
194
+ expect(result).to.be.true;
195
+ });
196
+
197
+ it("should check nested date property", () => {
198
+ const startDate = new Date("2023-02-01");
199
+ const endDate = new Date("2023-02-28");
200
+ const result = checkValueInIntervalRecursive(
201
+ { metadata: { createdAt: "2023-02-15" } },
202
+ "metadata.createdAt",
203
+ startDate,
204
+ endDate,
205
+ );
206
+ expect(result).to.be.true;
207
+ });
208
+
209
+ it("should return false when nested property does not exist", () => {
210
+ const result = checkValueInIntervalRecursive(
211
+ { name: "Alice" },
212
+ "age",
213
+ 25,
214
+ 35,
215
+ );
216
+ expect(result).to.be.false;
217
+ });
218
+
219
+ it("should return false for deeply nested non-existent property", () => {
220
+ const result = checkValueInIntervalRecursive(
221
+ { name: "Alice" },
222
+ "data.profile.age",
223
+ 25,
224
+ 35,
225
+ );
226
+ expect(result).to.be.false;
227
+ });
228
+
229
+ it("should handle null nested property", () => {
230
+ const result = checkValueInIntervalRecursive(
231
+ { value: null },
232
+ "value",
233
+ 5,
234
+ 10,
235
+ );
236
+ expect(result).to.be.false;
237
+ });
238
+
239
+ it("should handle undefined nested property", () => {
240
+ const result = checkValueInIntervalRecursive(
241
+ { value: undefined },
242
+ "value",
243
+ 5,
244
+ 10,
245
+ );
246
+ expect(result).to.be.false;
247
+ });
248
+ });
249
+
250
+ describe("Array handling", () => {
251
+ it("should return true if any array element matches numeric interval", () => {
252
+ const result = checkValueInIntervalRecursive(
253
+ { scores: [70, 85, 95] },
254
+ "scores",
255
+ 80,
256
+ 90,
257
+ );
258
+ expect(result).to.be.false;
259
+ });
260
+
261
+ it("should return false if no array element matches numeric interval", () => {
262
+ const result = checkValueInIntervalRecursive(
263
+ { scores: [70, 75, 80] },
264
+ "scores",
265
+ 85,
266
+ 95,
267
+ );
268
+ expect(result).to.be.false;
269
+ });
270
+
271
+ it("should return true if any array element matches date interval", () => {
272
+ const startDate = new Date("2023-02-01");
273
+ const endDate = new Date("2023-02-28");
274
+ const result = checkValueInIntervalRecursive(
275
+ { dates: ["2023-01-15", "2023-02-15", "2023-03-15"] },
276
+ "dates",
277
+ startDate,
278
+ endDate,
279
+ );
280
+ expect(result).to.be.false;
281
+ });
282
+
283
+ it("should handle nested arrays", () => {
284
+ const result = checkValueInIntervalRecursive(
285
+ { data: { values: [5, 10, 15] } },
286
+ "data.values",
287
+ 8,
288
+ 12,
289
+ );
290
+ expect(result).to.be.false;
291
+ });
292
+
293
+ it("should handle arrays of objects", () => {
294
+ const result = checkValueInIntervalRecursive(
295
+ { items: [{ value: 5 }, { value: 10 }, { value: 15 }] },
296
+ "items",
297
+ 8,
298
+ 12,
299
+ );
300
+ expect(result).to.be.false;
301
+ });
302
+
303
+ it("should handle empty arrays", () => {
304
+ const result = checkValueInIntervalRecursive(
305
+ { scores: [] },
306
+ "scores",
307
+ 5,
308
+ 10,
309
+ );
310
+ expect(result).to.be.false;
311
+ });
312
+ });
313
+
314
+ describe("Object recursive search", () => {
315
+ it("should search within nested objects", () => {
316
+ const result = checkValueInIntervalRecursive(
317
+ { data: { nested: { value: 8 } } },
318
+ "data.nested.value",
319
+ 5,
320
+ 10,
321
+ );
322
+ expect(result).to.be.true;
323
+ });
324
+
325
+ it("should handle deeply nested structures", () => {
326
+ const result = checkValueInIntervalRecursive(
327
+ { level1: { level2: { level3: { value: 8 } } } },
328
+ "level1.level2.level3.value",
329
+ 5,
330
+ 10,
331
+ );
332
+ expect(result).to.be.true;
333
+ });
334
+ });
335
+
336
+ describe("Type compatibility", () => {
337
+ it("should return false when checking numeric value against date interval", () => {
338
+ const startDate = new Date("2023-02-01");
339
+ const endDate = new Date("2023-02-28");
340
+ const result = checkValueInIntervalRecursive(
341
+ { value: 10 },
342
+ "value",
343
+ startDate,
344
+ endDate,
345
+ );
346
+ expect(result).to.be.false;
347
+ });
348
+
349
+ it("should return false when checking date value against numeric interval", () => {
350
+ const result = checkValueInIntervalRecursive(
351
+ { date: "2023-02-15" },
352
+ "date",
353
+ 5,
354
+ 10,
355
+ );
356
+ expect(result).to.be.false;
357
+ });
358
+
359
+ it("should handle negative numbers", () => {
360
+ const result = checkValueInIntervalRecursive(
361
+ { value: -5 },
362
+ "value",
363
+ -10,
364
+ 0,
365
+ );
366
+ expect(result).to.be.true;
367
+ });
368
+
369
+ it("should handle decimal numbers", () => {
370
+ const result = checkValueInIntervalRecursive(
371
+ { value: 7.5 },
372
+ "value",
373
+ 5,
374
+ 10,
375
+ );
376
+ expect(result).to.be.true;
377
+ });
378
+
379
+ it("should return false for non-numeric string values", () => {
380
+ const result = checkValueInIntervalRecursive(
381
+ { value: "not a number" },
382
+ "value",
383
+ 5,
384
+ 10,
385
+ );
386
+ expect(result).to.be.false;
387
+ });
388
+
389
+ it("should return false for boolean values", () => {
390
+ const result = checkValueInIntervalRecursive(
391
+ { value: true },
392
+ "value",
393
+ 5,
394
+ 10,
395
+ );
396
+ expect(result).to.be.false;
397
+ });
398
+
399
+ it("should return false for object values", () => {
400
+ const result = checkValueInIntervalRecursive(
401
+ { value: { nested: 8 } },
402
+ "value",
403
+ 5,
404
+ 10,
405
+ );
406
+ expect(result).to.be.false;
407
+ });
408
+
409
+ it("should return false for array values (not checking elements)", () => {
410
+ const result = checkValueInIntervalRecursive(
411
+ { value: [5, 10, 15] },
412
+ "value",
413
+ 5,
414
+ 10,
415
+ );
416
+ expect(result).to.be.false;
417
+ });
418
+ });
419
+
420
+ describe("Edge cases", () => {
421
+ it("should handle empty object", () => {
422
+ const result = checkValueInIntervalRecursive({}, "value", 5, 10);
423
+ expect(result).to.be.false;
424
+ });
425
+
426
+ it("should handle NaN values", () => {
427
+ const result = checkValueInIntervalRecursive(
428
+ { value: Number.NaN },
429
+ "value",
430
+ 5,
431
+ 10,
432
+ );
433
+ expect(result).to.be.false;
434
+ });
435
+
436
+ it("should handle Infinity values", () => {
437
+ const result = checkValueInIntervalRecursive(
438
+ { value: Number.POSITIVE_INFINITY },
439
+ "value",
440
+ 5,
441
+ 10,
442
+ );
443
+ expect(result).to.be.false;
444
+ });
445
+
446
+ it("should handle zero values", () => {
447
+ const result = checkValueInIntervalRecursive(
448
+ { value: 0 },
449
+ "value",
450
+ -5,
451
+ 5,
452
+ );
453
+ expect(result).to.be.true;
454
+ });
455
+
456
+ it("should handle large numbers", () => {
457
+ const result = checkValueInIntervalRecursive(
458
+ { value: 1000000 },
459
+ "value",
460
+ 500000,
461
+ 1500000,
462
+ );
463
+ expect(result).to.be.true;
464
+ });
465
+
466
+ it("should handle date at midnight boundary", () => {
467
+ const startDate = new Date("2023-02-01T00:00:00.000Z");
468
+ const endDate = new Date("2023-02-28T23:59:59.999Z");
469
+ const result = checkValueInIntervalRecursive(
470
+ { date: "2023-02-28T23:59:59.999Z" },
471
+ "date",
472
+ startDate,
473
+ endDate,
474
+ );
475
+ expect(result).to.be.true;
476
+ });
477
+ });
478
+
479
+ describe("Complex scenarios", () => {
480
+ it("should search through mixed type array", () => {
481
+ const result = checkValueInIntervalRecursive(
482
+ { items: [5, "text", 10, null, 15] },
483
+ "items",
484
+ 8,
485
+ 12,
486
+ );
487
+ expect(result).to.be.false;
488
+ });
489
+
490
+ it("should handle array of dates", () => {
491
+ const startDate = new Date("2023-02-01");
492
+ const endDate = new Date("2023-02-28");
493
+ const result = checkValueInIntervalRecursive(
494
+ { dates: ["2023-01-15", "2023-02-15", "2023-03-15"] },
495
+ "dates",
496
+ startDate,
497
+ endDate,
498
+ );
499
+ expect(result).to.be.false;
500
+ });
501
+
502
+ it("should handle deeply nested arrays", () => {
503
+ const result = checkValueInIntervalRecursive(
504
+ {
505
+ data: {
506
+ nested: {
507
+ array: [
508
+ [5, 10],
509
+ [15, 20],
510
+ ],
511
+ },
512
+ },
513
+ },
514
+ "data",
515
+ 8,
516
+ 12,
517
+ );
518
+ expect(result).to.be.false;
519
+ });
520
+
521
+ it("should handle mixed nested structures", () => {
522
+ const result = checkValueInIntervalRecursive(
523
+ { items: [{ data: { value: 8 } }, { data: { value: 15 } }] },
524
+ "items",
525
+ 5,
526
+ 10,
527
+ );
528
+ expect(result).to.be.false;
529
+ });
530
+ });
531
+
532
+ describe("Property path edge cases", () => {
533
+ it("should handle single-level property path", () => {
534
+ const result = checkValueInIntervalRecursive(
535
+ { value: 8 },
536
+ "value",
537
+ 5,
538
+ 10,
539
+ );
540
+ expect(result).to.be.true;
541
+ });
542
+
543
+ it("should handle multi-level property path", () => {
544
+ const result = checkValueInIntervalRecursive(
545
+ { a: { b: { c: 8 } } },
546
+ "a.b.c",
547
+ 5,
548
+ 10,
549
+ );
550
+ expect(result).to.be.true;
551
+ });
552
+
553
+ it("should handle property path with numbers", () => {
554
+ const result = checkValueInIntervalRecursive(
555
+ { "1": { value: 8 } },
556
+ "1.value",
557
+ 5,
558
+ 10,
559
+ );
560
+ expect(result).to.be.true;
561
+ });
562
+ });
563
+ });