@bitbybit-dev/base 1.3.2-rc.1 → 1.4.0-rc.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 (77) hide show
  1. package/README.md +1 -1
  2. package/lib/api/GlobalCDNProvider.js +1 -1
  3. package/lib/api/index.d.ts +2 -0
  4. package/lib/api/index.js +2 -0
  5. package/lib/api/inputs/base-inputs.d.ts +10 -4
  6. package/lib/api/inputs/color-inputs.d.ts +24 -23
  7. package/lib/api/inputs/color-inputs.js +1 -0
  8. package/lib/api/inputs/dates-inputs.d.ts +16 -16
  9. package/lib/api/inputs/frame-inputs.d.ts +515 -0
  10. package/lib/api/inputs/frame-inputs.js +617 -0
  11. package/lib/api/inputs/index.d.ts +1 -0
  12. package/lib/api/inputs/index.js +1 -0
  13. package/lib/api/inputs/io-inputs.d.ts +3 -3
  14. package/lib/api/inputs/io-inputs.js +1 -1
  15. package/lib/api/inputs/lists-inputs.d.ts +23 -23
  16. package/lib/api/inputs/logic-inputs.d.ts +11 -11
  17. package/lib/api/inputs/math-inputs.d.ts +49 -49
  18. package/lib/api/inputs/math-inputs.js +4 -4
  19. package/lib/api/inputs/mesh-inputs.d.ts +3 -3
  20. package/lib/api/inputs/mesh-inputs.js +3 -3
  21. package/lib/api/inputs/point-inputs.d.ts +39 -38
  22. package/lib/api/inputs/point-inputs.js +6 -5
  23. package/lib/api/inputs/polyline-inputs.d.ts +5 -4
  24. package/lib/api/inputs/polyline-inputs.js +3 -3
  25. package/lib/api/inputs/text-inputs.d.ts +34 -33
  26. package/lib/api/inputs/text-inputs.js +15 -12
  27. package/lib/api/inputs/transforms-inputs.d.ts +16 -16
  28. package/lib/api/inputs/vector-inputs.d.ts +26 -25
  29. package/lib/api/inputs/vector-inputs.js +2 -1
  30. package/lib/api/kernel-calls/call-by-path.d.ts +12 -0
  31. package/lib/api/kernel-calls/call-by-path.js +36 -0
  32. package/lib/api/kernel-calls/constraints.d.ts +53 -0
  33. package/lib/api/kernel-calls/constraints.js +21 -0
  34. package/lib/api/kernel-calls/describe-failure.d.ts +32 -0
  35. package/lib/api/kernel-calls/describe-failure.js +164 -0
  36. package/lib/api/kernel-calls/errors.d.ts +55 -0
  37. package/lib/api/kernel-calls/errors.js +42 -0
  38. package/lib/api/kernel-calls/failure-message.d.ts +18 -0
  39. package/lib/api/kernel-calls/failure-message.js +36 -0
  40. package/lib/api/kernel-calls/index.d.ts +10 -0
  41. package/lib/api/kernel-calls/index.js +10 -0
  42. package/lib/api/kernel-calls/input-rules.d.ts +67 -0
  43. package/lib/api/kernel-calls/input-rules.js +135 -0
  44. package/lib/api/kernel-calls/input-validation.d.ts +130 -0
  45. package/lib/api/kernel-calls/input-validation.js +221 -0
  46. package/lib/api/kernel-calls/rehydrate.d.ts +16 -0
  47. package/lib/api/kernel-calls/rehydrate.js +38 -0
  48. package/lib/api/kernel-calls/resolve-dto.d.ts +59 -0
  49. package/lib/api/kernel-calls/resolve-dto.js +61 -0
  50. package/lib/api/kernel-calls/with-defaults.d.ts +16 -0
  51. package/lib/api/kernel-calls/with-defaults.js +53 -0
  52. package/lib/api/resolved-inputs/index.d.ts +304 -0
  53. package/lib/api/resolved-inputs/index.js +1 -0
  54. package/lib/api/services/color.js +43 -26
  55. package/lib/api/services/dates.js +53 -33
  56. package/lib/api/services/frame.d.ts +670 -0
  57. package/lib/api/services/frame.js +1040 -0
  58. package/lib/api/services/helpers/dxf/dxf-generator.d.ts +2 -3
  59. package/lib/api/services/helpers/dxf/dxf-generator.js +27 -37
  60. package/lib/api/services/helpers/dxf/dxf.js +10 -4
  61. package/lib/api/services/helpers/frame-axes.d.ts +36 -0
  62. package/lib/api/services/helpers/frame-axes.js +57 -0
  63. package/lib/api/services/helpers/matrices.d.ts +17 -0
  64. package/lib/api/services/helpers/matrices.js +51 -0
  65. package/lib/api/services/index.d.ts +1 -0
  66. package/lib/api/services/index.js +1 -0
  67. package/lib/api/services/line.js +15 -12
  68. package/lib/api/services/lists.js +174 -136
  69. package/lib/api/services/logic.js +44 -34
  70. package/lib/api/services/math.js +127 -82
  71. package/lib/api/services/mesh.js +20 -13
  72. package/lib/api/services/point.js +62 -46
  73. package/lib/api/services/polyline.js +22 -18
  74. package/lib/api/services/text.js +81 -46
  75. package/lib/api/services/transforms.js +38 -25
  76. package/lib/api/services/vector.js +37 -22
  77. package/package.json +1 -1
@@ -1,4 +1,5 @@
1
1
  import * as Inputs from "../inputs";
2
+ import { resolveDto } from "../kernel-calls";
2
3
  /**
3
4
  * Reading, building and reshaping plain arrays of any kind of item. Positions are 0-based: index 0
4
5
  * is the first item. Most methods take a `clone` option, on by default, that deep-copies the list
@@ -22,15 +23,16 @@ export class Lists {
22
23
  * ```
23
24
  */
24
25
  getItem(inputs) {
25
- if (inputs.index < 0 || inputs.index >= inputs.list.length) {
26
+ const resolved = resolveDto(Inputs.Lists.ListItemDto, inputs);
27
+ if (resolved.index < 0 || resolved.index >= resolved.list.length) {
26
28
  throw new Error("Index out of bounds");
27
29
  }
28
30
  let result;
29
- if (inputs.clone) {
30
- result = structuredClone(inputs.list[inputs.index]);
31
+ if (resolved.clone) {
32
+ result = structuredClone(resolved.list[resolved.index]);
31
33
  }
32
34
  else {
33
- result = inputs.list[inputs.index];
35
+ result = resolved.list[resolved.index];
34
36
  }
35
37
  return result;
36
38
  }
@@ -45,15 +47,16 @@ export class Lists {
45
47
  * @drawable false
46
48
  */
47
49
  getFirstItem(inputs) {
48
- if (inputs.list.length === 0) {
50
+ const resolved = resolveDto(Inputs.Lists.ListCloneDto, inputs);
51
+ if (resolved.list.length === 0) {
49
52
  throw new Error("List is empty");
50
53
  }
51
54
  let result;
52
- if (inputs.clone) {
53
- result = structuredClone(inputs.list[0]);
55
+ if (resolved.clone) {
56
+ result = structuredClone(resolved.list[0]);
54
57
  }
55
58
  else {
56
- result = inputs.list[0];
59
+ result = resolved.list[0];
57
60
  }
58
61
  return result;
59
62
  }
@@ -68,15 +71,16 @@ export class Lists {
68
71
  * @drawable false
69
72
  */
70
73
  getLastItem(inputs) {
71
- if (inputs.list.length === 0) {
74
+ const resolved = resolveDto(Inputs.Lists.ListCloneDto, inputs);
75
+ if (resolved.list.length === 0) {
72
76
  throw new Error("List is empty");
73
77
  }
74
78
  let result;
75
- if (inputs.clone) {
76
- result = structuredClone(inputs.list[inputs.list.length - 1]);
79
+ if (resolved.clone) {
80
+ result = structuredClone(resolved.list[resolved.list.length - 1]);
77
81
  }
78
82
  else {
79
- result = inputs.list[inputs.list.length - 1];
83
+ result = resolved.list[resolved.list.length - 1];
80
84
  }
81
85
  return result;
82
86
  }
@@ -96,13 +100,14 @@ export class Lists {
96
100
  * ```
97
101
  */
98
102
  randomGetThreshold(inputs) {
99
- let res = inputs.list;
100
- if (inputs.clone) {
101
- res = structuredClone(inputs.list);
103
+ const resolved = resolveDto(Inputs.Lists.RandomThresholdDto, inputs);
104
+ let res = resolved.list;
105
+ if (resolved.clone) {
106
+ res = structuredClone(resolved.list);
102
107
  }
103
108
  const newList = [];
104
- for (let i = 0; i < inputs.list.length; i++) {
105
- if (Math.random() < inputs.threshold) {
109
+ for (let i = 0; i < resolved.list.length; i++) {
110
+ if (Math.random() < resolved.threshold) {
106
111
  newList.push(res[i]);
107
112
  }
108
113
  }
@@ -123,12 +128,13 @@ export class Lists {
123
128
  * ```
124
129
  */
125
130
  getSubList(inputs) {
131
+ const resolved = resolveDto(Inputs.Lists.SubListDto, inputs);
126
132
  let result;
127
- if (inputs.clone) {
128
- result = structuredClone(inputs.list.slice(inputs.indexStart, inputs.indexEnd));
133
+ if (resolved.clone) {
134
+ result = structuredClone(resolved.list.slice(resolved.indexStart, resolved.indexEnd));
129
135
  }
130
136
  else {
131
- result = inputs.list.slice(inputs.indexStart, inputs.indexEnd);
137
+ result = resolved.list.slice(resolved.indexStart, resolved.indexEnd);
132
138
  }
133
139
  return result;
134
140
  }
@@ -148,13 +154,14 @@ export class Lists {
148
154
  * ```
149
155
  */
150
156
  getNthItem(inputs) {
151
- let cloned = inputs.list;
152
- if (inputs.clone) {
153
- cloned = structuredClone(inputs.list);
157
+ const resolved = resolveDto(Inputs.Lists.GetNthItemDto, inputs);
158
+ let cloned = resolved.list;
159
+ if (resolved.clone) {
160
+ cloned = structuredClone(resolved.list);
154
161
  }
155
162
  const result = [];
156
163
  for (let i = 0; i < cloned.length; i++) {
157
- if ((i + inputs.offset) % inputs.nth === 0) {
164
+ if ((i + resolved.offset) % resolved.nth === 0) {
158
165
  result.push(cloned[i]);
159
166
  }
160
167
  }
@@ -176,7 +183,8 @@ export class Lists {
176
183
  * ```
177
184
  */
178
185
  getByPattern(inputs) {
179
- const { list, pattern } = inputs;
186
+ const resolved = resolveDto(Inputs.Lists.GetByPatternDto, inputs);
187
+ const { list, pattern } = resolved;
180
188
  if (!pattern || pattern.length === 0) {
181
189
  throw new Error("Pattern is empty or does not exist");
182
190
  }
@@ -222,8 +230,9 @@ export class Lists {
222
230
  * ```
223
231
  */
224
232
  mergeElementsOfLists(inputs) {
225
- const lists = inputs.lists;
226
- const level = inputs.level;
233
+ const resolved = resolveDto(Inputs.Lists.MergeElementsOfLists, inputs);
234
+ const lists = resolved.lists;
235
+ const level = resolved.level;
227
236
  const elToMerge = [];
228
237
  const result = [];
229
238
  lists.forEach(list => {
@@ -298,9 +307,10 @@ export class Lists {
298
307
  * @drawable false
299
308
  */
300
309
  reverse(inputs) {
301
- let res = inputs.list;
302
- if (inputs.clone) {
303
- res = structuredClone(inputs.list);
310
+ const resolved = resolveDto(Inputs.Lists.ListCloneDto, inputs);
311
+ let res = resolved.list;
312
+ if (resolved.clone) {
313
+ res = structuredClone(resolved.list);
304
314
  }
305
315
  return res.reverse();
306
316
  }
@@ -315,9 +325,10 @@ export class Lists {
315
325
  * @drawable false
316
326
  */
317
327
  shuffle(inputs) {
318
- let res = inputs.list;
319
- if (inputs.clone) {
320
- res = structuredClone(inputs.list);
328
+ const resolved = resolveDto(Inputs.Lists.ListCloneDto, inputs);
329
+ let res = resolved.list;
330
+ if (resolved.clone) {
331
+ res = structuredClone(resolved.list);
321
332
  }
322
333
  for (let i = res.length - 1; i > 0; i--) {
323
334
  const j = Math.floor(Math.random() * (i + 1));
@@ -341,10 +352,11 @@ export class Lists {
341
352
  * ```
342
353
  */
343
354
  flipLists(inputs) {
344
- if (inputs.list.length > 0) {
345
- const lengthOfFirstList = inputs.list[0].length;
355
+ const resolved = resolveDto(Inputs.Lists.ListCloneDto, inputs);
356
+ if (resolved.list.length > 0) {
357
+ const lengthOfFirstList = resolved.list[0].length;
346
358
  let allListsSameLength = true;
347
- inputs.list.forEach(l => {
359
+ resolved.list.forEach(l => {
348
360
  if (l.length !== lengthOfFirstList) {
349
361
  allListsSameLength = false;
350
362
  }
@@ -353,7 +365,7 @@ export class Lists {
353
365
  const result = [];
354
366
  for (let i = 0; i < lengthOfFirstList; i++) {
355
367
  const newList = [];
356
- inputs.list.forEach(l => {
368
+ resolved.list.forEach(l => {
357
369
  newList.push(l[i]);
358
370
  });
359
371
  result.push(newList);
@@ -385,6 +397,7 @@ export class Lists {
385
397
  * ```
386
398
  */
387
399
  groupNth(inputs) {
400
+ const resolved = resolveDto(Inputs.Lists.GroupListDto, inputs);
388
401
  const groupElements = (inputs) => {
389
402
  const { nrElements, list, keepRemainder } = inputs;
390
403
  const nrElementsInGroup = nrElements;
@@ -402,7 +415,7 @@ export class Lists {
402
415
  });
403
416
  return result;
404
417
  };
405
- return groupElements(inputs);
418
+ return groupElements(resolved);
406
419
  }
407
420
  /**
408
421
  * Tells whether an item is in the list.
@@ -451,9 +464,10 @@ export class Lists {
451
464
  * @drawable false
452
465
  */
453
466
  getListDepth(inputs) {
467
+ const resolved = resolveDto(Inputs.Lists.ListCloneDto, inputs);
454
468
  let levels = 0;
455
469
  let deeperLevelsExist = true;
456
- let flatRes = inputs.list;
470
+ let flatRes = resolved.list;
457
471
  while (deeperLevelsExist) {
458
472
  let foundArray = false;
459
473
  for (let i = 0; i < flatRes.length; i++) {
@@ -483,7 +497,8 @@ export class Lists {
483
497
  * @drawable false
484
498
  */
485
499
  listLength(inputs) {
486
- return inputs.list.length;
500
+ const resolved = resolveDto(Inputs.Lists.ListCloneDto, inputs);
501
+ return resolved.list.length;
487
502
  }
488
503
  /**
489
504
  * Inserts an item at a position; the items from that position on shift up by one.
@@ -500,12 +515,13 @@ export class Lists {
500
515
  * ```
501
516
  */
502
517
  addItemAtIndex(inputs) {
503
- let res = inputs.list;
504
- if (inputs.clone) {
505
- res = structuredClone(inputs.list);
518
+ const resolved = resolveDto(Inputs.Lists.AddItemAtIndexDto, inputs);
519
+ let res = resolved.list;
520
+ if (resolved.clone) {
521
+ res = structuredClone(resolved.list);
506
522
  }
507
- if (inputs.index >= 0 && inputs.index <= res.length) {
508
- res.splice(inputs.index, 0, inputs.item);
523
+ if (resolved.index >= 0 && resolved.index <= res.length) {
524
+ res.splice(resolved.index, 0, resolved.item);
509
525
  }
510
526
  return res;
511
527
  }
@@ -524,16 +540,17 @@ export class Lists {
524
540
  * ```
525
541
  */
526
542
  addItemAtIndexes(inputs) {
527
- let cloned = inputs.list;
528
- if (inputs.clone) {
529
- cloned = structuredClone(inputs.list);
543
+ const resolved = resolveDto(Inputs.Lists.AddItemAtIndexesDto, inputs);
544
+ let cloned = resolved.list;
545
+ if (resolved.clone) {
546
+ cloned = structuredClone(resolved.list);
530
547
  }
531
- let cloneIndexes = [...inputs.indexes];
548
+ let cloneIndexes = [...resolved.indexes];
532
549
  cloneIndexes = cloneIndexes.filter(index => index >= 0 && index <= cloned.length);
533
550
  cloneIndexes.sort((a, b) => a - b);
534
551
  cloneIndexes.forEach((index, i) => {
535
552
  if (index >= 0 && index + i <= cloned.length) {
536
- cloned.splice(index + i, 0, inputs.item);
553
+ cloned.splice(index + i, 0, resolved.item);
537
554
  }
538
555
  });
539
556
  return cloned;
@@ -555,25 +572,26 @@ export class Lists {
555
572
  * ```
556
573
  */
557
574
  addItemsAtIndexes(inputs) {
558
- if (inputs.items.length !== inputs.indexes.length) {
575
+ const resolved = resolveDto(Inputs.Lists.AddItemsAtIndexesDto, inputs);
576
+ if (resolved.items.length !== resolved.indexes.length) {
559
577
  throw new Error("Items and indexes must have the same length");
560
578
  }
561
- for (let i = 0; i < inputs.indexes.length; i++) {
579
+ for (let i = 0; i < resolved.indexes.length; i++) {
562
580
  if (i > 0) {
563
- const prev = inputs.indexes[i - 1];
564
- if (prev > inputs.indexes[i]) {
581
+ const prev = resolved.indexes[i - 1];
582
+ if (prev > resolved.indexes[i]) {
565
583
  throw new Error("Indexes must be in ascending order");
566
584
  }
567
585
  }
568
586
  }
569
- let cloned = inputs.list;
570
- if (inputs.clone) {
571
- cloned = structuredClone(inputs.list);
587
+ let cloned = resolved.list;
588
+ if (resolved.clone) {
589
+ cloned = structuredClone(resolved.list);
572
590
  }
573
- const cloneIndexes = [...inputs.indexes];
591
+ const cloneIndexes = [...resolved.indexes];
574
592
  cloneIndexes.forEach((index, i) => {
575
593
  if (index >= 0 && index + i <= cloned.length) {
576
- cloned.splice(index + i, 0, inputs.items[i]);
594
+ cloned.splice(index + i, 0, resolved.items[i]);
577
595
  }
578
596
  });
579
597
  return cloned;
@@ -593,12 +611,13 @@ export class Lists {
593
611
  * ```
594
612
  */
595
613
  removeItemAtIndex(inputs) {
596
- let res = inputs.list;
597
- if (inputs.clone) {
598
- res = structuredClone(inputs.list);
614
+ const resolved = resolveDto(Inputs.Lists.RemoveItemAtIndexDto, inputs);
615
+ let res = resolved.list;
616
+ if (resolved.clone) {
617
+ res = structuredClone(resolved.list);
599
618
  }
600
- if (inputs.index >= 0 && inputs.index <= res.length) {
601
- res.splice(inputs.index, 1);
619
+ if (resolved.index >= 0 && resolved.index <= res.length) {
620
+ res.splice(resolved.index, 1);
602
621
  }
603
622
  return res;
604
623
  }
@@ -613,9 +632,10 @@ export class Lists {
613
632
  * @drawable false
614
633
  */
615
634
  removeFirstItem(inputs) {
616
- let res = inputs.list;
617
- if (inputs.clone) {
618
- res = structuredClone(inputs.list);
635
+ const resolved = resolveDto(Inputs.Lists.ListCloneDto, inputs);
636
+ let res = resolved.list;
637
+ if (resolved.clone) {
638
+ res = structuredClone(resolved.list);
619
639
  }
620
640
  if (res.length > 0) {
621
641
  res.shift();
@@ -633,9 +653,10 @@ export class Lists {
633
653
  * @drawable false
634
654
  */
635
655
  removeLastItem(inputs) {
636
- let res = inputs.list;
637
- if (inputs.clone) {
638
- res = structuredClone(inputs.list);
656
+ const resolved = resolveDto(Inputs.Lists.ListCloneDto, inputs);
657
+ let res = resolved.list;
658
+ if (resolved.clone) {
659
+ res = structuredClone(resolved.list);
639
660
  }
640
661
  if (res.length > 0) {
641
662
  res.pop();
@@ -657,12 +678,13 @@ export class Lists {
657
678
  * ```
658
679
  */
659
680
  removeItemAtIndexFromEnd(inputs) {
660
- let res = inputs.list;
661
- if (inputs.clone) {
662
- res = structuredClone(inputs.list);
681
+ const resolved = resolveDto(Inputs.Lists.RemoveItemAtIndexDto, inputs);
682
+ let res = resolved.list;
683
+ if (resolved.clone) {
684
+ res = structuredClone(resolved.list);
663
685
  }
664
- if (inputs.index >= 0 && inputs.index < res.length) {
665
- const actualIndex = res.length - 1 - inputs.index;
686
+ if (resolved.index >= 0 && resolved.index < res.length) {
687
+ const actualIndex = res.length - 1 - resolved.index;
666
688
  res.splice(actualIndex, 1);
667
689
  }
668
690
  return res;
@@ -682,11 +704,12 @@ export class Lists {
682
704
  * ```
683
705
  */
684
706
  removeItemsAtIndexes(inputs) {
685
- let res = inputs.list;
686
- if (inputs.clone) {
687
- res = structuredClone(inputs.list);
707
+ const resolved = resolveDto(Inputs.Lists.RemoveItemsAtIndexesDto, inputs);
708
+ let res = resolved.list;
709
+ if (resolved.clone) {
710
+ res = structuredClone(resolved.list);
688
711
  }
689
- const cloneIndexes = [...inputs.indexes];
712
+ const cloneIndexes = [...resolved.indexes];
690
713
  cloneIndexes.sort((a, b) => b - a);
691
714
  cloneIndexes.forEach(index => {
692
715
  if (index >= 0 && index < res.length) {
@@ -724,13 +747,14 @@ export class Lists {
724
747
  * ```
725
748
  */
726
749
  removeNthItem(inputs) {
727
- let res = inputs.list;
728
- if (inputs.clone) {
729
- res = structuredClone(inputs.list);
750
+ const resolved = resolveDto(Inputs.Lists.RemoveNthItemDto, inputs);
751
+ let res = resolved.list;
752
+ if (resolved.clone) {
753
+ res = structuredClone(resolved.list);
730
754
  }
731
755
  const result = [];
732
756
  for (let i = 0; i < res.length; i++) {
733
- if ((i + inputs.offset) % inputs.nth !== 0) {
757
+ if ((i + resolved.offset) % resolved.nth !== 0) {
734
758
  result.push(res[i]);
735
759
  }
736
760
  }
@@ -752,13 +776,14 @@ export class Lists {
752
776
  * ```
753
777
  */
754
778
  randomRemoveThreshold(inputs) {
755
- let res = inputs.list;
756
- if (inputs.clone) {
757
- res = structuredClone(inputs.list);
779
+ const resolved = resolveDto(Inputs.Lists.RandomThresholdDto, inputs);
780
+ let res = resolved.list;
781
+ if (resolved.clone) {
782
+ res = structuredClone(resolved.list);
758
783
  }
759
784
  const newList = [];
760
- for (let i = 0; i < inputs.list.length; i++) {
761
- if (Math.random() > inputs.threshold) {
785
+ for (let i = 0; i < resolved.list.length; i++) {
786
+ if (Math.random() > resolved.threshold) {
762
787
  newList.push(res[i]);
763
788
  }
764
789
  }
@@ -775,9 +800,10 @@ export class Lists {
775
800
  * @drawable false
776
801
  */
777
802
  removeDuplicateNumbers(inputs) {
778
- let res = inputs.list;
779
- if (inputs.clone) {
780
- res = structuredClone(inputs.list);
803
+ const resolved = resolveDto(Inputs.Lists.RemoveDuplicatesDto, inputs);
804
+ let res = resolved.list;
805
+ if (resolved.clone) {
806
+ res = structuredClone(resolved.list);
781
807
  }
782
808
  return res.filter((value, index, self) => self.indexOf(value) === index);
783
809
  }
@@ -797,11 +823,12 @@ export class Lists {
797
823
  * ```
798
824
  */
799
825
  removeDuplicateNumbersTolerance(inputs) {
800
- let res = inputs.list;
801
- if (inputs.clone) {
802
- res = structuredClone(inputs.list);
826
+ const resolved = resolveDto(Inputs.Lists.RemoveDuplicatesToleranceDto, inputs);
827
+ let res = resolved.list;
828
+ if (resolved.clone) {
829
+ res = structuredClone(resolved.list);
803
830
  }
804
- return res.filter((value, index, self) => self.findIndex(s => Math.abs(s - value) < inputs.tolerance) === index);
831
+ return res.filter((value, index, self) => self.findIndex(s => Math.abs(s - value) < resolved.tolerance) === index);
805
832
  }
806
833
  /**
807
834
  * Removes repeated items of any kind, keeping the first occurrence of each.
@@ -815,9 +842,10 @@ export class Lists {
815
842
  * @drawable false
816
843
  */
817
844
  removeDuplicates(inputs) {
818
- let res = inputs.list;
819
- if (inputs.clone) {
820
- res = structuredClone(inputs.list);
845
+ const resolved = resolveDto(Inputs.Lists.RemoveDuplicatesDto, inputs);
846
+ let res = resolved.list;
847
+ if (resolved.clone) {
848
+ res = structuredClone(resolved.list);
821
849
  }
822
850
  return res.filter((value, index, self) => self.indexOf(value) === index);
823
851
  }
@@ -836,11 +864,12 @@ export class Lists {
836
864
  * ```
837
865
  */
838
866
  addItem(inputs) {
839
- let res = inputs.list;
840
- if (inputs.clone) {
841
- res = structuredClone(inputs.list);
867
+ const resolved = resolveDto(Inputs.Lists.AddItemDto, inputs);
868
+ let res = resolved.list;
869
+ if (resolved.clone) {
870
+ res = structuredClone(resolved.list);
842
871
  }
843
- res.push(inputs.item);
872
+ res.push(resolved.item);
844
873
  return res;
845
874
  }
846
875
  /**
@@ -858,11 +887,12 @@ export class Lists {
858
887
  * ```
859
888
  */
860
889
  prependItem(inputs) {
861
- let res = inputs.list;
862
- if (inputs.clone) {
863
- res = structuredClone(inputs.list);
890
+ const resolved = resolveDto(Inputs.Lists.AddItemDto, inputs);
891
+ let res = resolved.list;
892
+ if (resolved.clone) {
893
+ res = structuredClone(resolved.list);
864
894
  }
865
- res.unshift(inputs.item);
895
+ res.unshift(resolved.item);
866
896
  return res;
867
897
  }
868
898
  /**
@@ -880,15 +910,16 @@ export class Lists {
880
910
  * ```
881
911
  */
882
912
  addItemFirstLast(inputs) {
883
- let res = inputs.list;
884
- if (inputs.clone) {
885
- res = structuredClone(inputs.list);
913
+ const resolved = resolveDto(Inputs.Lists.AddItemFirstLastDto, inputs);
914
+ let res = resolved.list;
915
+ if (resolved.clone) {
916
+ res = structuredClone(resolved.list);
886
917
  }
887
- if (inputs.position === Inputs.Lists.firstLastEnum.first) {
888
- res.unshift(inputs.item);
918
+ if (resolved.position === Inputs.Lists.firstLastEnum.first) {
919
+ res.unshift(resolved.item);
889
920
  }
890
921
  else {
891
- res.push(inputs.item);
922
+ res.push(resolved.item);
892
923
  }
893
924
  return res;
894
925
  }
@@ -907,14 +938,15 @@ export class Lists {
907
938
  * ```
908
939
  */
909
940
  concatenate(inputs) {
941
+ const resolved = resolveDto(Inputs.Lists.ConcatenateDto, inputs);
910
942
  let result = [];
911
- if (inputs.clone) {
912
- inputs.lists.forEach(list => {
943
+ if (resolved.clone) {
944
+ resolved.lists.forEach(list => {
913
945
  result = result.concat(structuredClone(list));
914
946
  });
915
947
  }
916
948
  else {
917
- inputs.lists.forEach(list => {
949
+ resolved.lists.forEach(list => {
918
950
  result = result.concat(list);
919
951
  });
920
952
  }
@@ -947,9 +979,10 @@ export class Lists {
947
979
  * ```
948
980
  */
949
981
  repeat(inputs) {
982
+ const resolved = resolveDto(Inputs.Lists.MultiplyItemDto, inputs);
950
983
  const result = [];
951
- for (let i = 0; i < inputs.times; i++) {
952
- result.push(inputs.item);
984
+ for (let i = 0; i < resolved.times; i++) {
985
+ result.push(resolved.item);
953
986
  }
954
987
  return result;
955
988
  }
@@ -968,14 +1001,15 @@ export class Lists {
968
1001
  * ```
969
1002
  */
970
1003
  repeatInPattern(inputs) {
971
- let inpList = inputs.list;
972
- if (inputs.clone) {
973
- inpList = structuredClone(inputs.list);
1004
+ const resolved = resolveDto(Inputs.Lists.RepeatInPatternDto, inputs);
1005
+ let inpList = resolved.list;
1006
+ if (resolved.clone) {
1007
+ inpList = structuredClone(resolved.list);
974
1008
  }
975
1009
  const res = [];
976
1010
  let counter = 0;
977
1011
  let index = 0;
978
- while (counter < inputs.lengthLimit) {
1012
+ while (counter < resolved.lengthLimit) {
979
1013
  res.push(inpList[index]);
980
1014
  index++;
981
1015
  if (index === inpList.length) {
@@ -1000,11 +1034,12 @@ export class Lists {
1000
1034
  * ```
1001
1035
  */
1002
1036
  sortNumber(inputs) {
1003
- let res = inputs.list;
1004
- if (inputs.clone) {
1005
- res = structuredClone(inputs.list);
1037
+ const resolved = resolveDto(Inputs.Lists.SortDto, inputs);
1038
+ let res = resolved.list;
1039
+ if (resolved.clone) {
1040
+ res = structuredClone(resolved.list);
1006
1041
  }
1007
- if (inputs.orderAsc) {
1042
+ if (resolved.orderAsc) {
1008
1043
  return res.sort((a, b) => a - b);
1009
1044
  }
1010
1045
  else {
@@ -1026,11 +1061,12 @@ export class Lists {
1026
1061
  * ```
1027
1062
  */
1028
1063
  sortTexts(inputs) {
1029
- let res = inputs.list;
1030
- if (inputs.clone) {
1031
- res = structuredClone(inputs.list);
1064
+ const resolved = resolveDto(Inputs.Lists.SortDto, inputs);
1065
+ let res = resolved.list;
1066
+ if (resolved.clone) {
1067
+ res = structuredClone(resolved.list);
1032
1068
  }
1033
- if (inputs.orderAsc) {
1069
+ if (resolved.orderAsc) {
1034
1070
  return res.sort();
1035
1071
  }
1036
1072
  else {
@@ -1053,15 +1089,16 @@ export class Lists {
1053
1089
  * ```
1054
1090
  */
1055
1091
  sortByPropValue(inputs) {
1056
- let res = inputs.list;
1057
- if (inputs.clone) {
1058
- res = structuredClone(inputs.list);
1092
+ const resolved = resolveDto(Inputs.Lists.SortJsonDto, inputs);
1093
+ let res = resolved.list;
1094
+ if (resolved.clone) {
1095
+ res = structuredClone(resolved.list);
1059
1096
  }
1060
- if (inputs.orderAsc) {
1061
- return res.sort((a, b) => a[inputs.property] - b[inputs.property]);
1097
+ if (resolved.orderAsc) {
1098
+ return res.sort((a, b) => a[resolved.property] - b[resolved.property]);
1062
1099
  }
1063
1100
  else {
1064
- return res.sort((a, b) => b[inputs.property] - a[inputs.property]);
1101
+ return res.sort((a, b) => b[resolved.property] - a[resolved.property]);
1065
1102
  }
1066
1103
  }
1067
1104
  /**
@@ -1081,7 +1118,8 @@ export class Lists {
1081
1118
  * ```
1082
1119
  */
1083
1120
  interleave(inputs) {
1084
- const lists = inputs.clone ? structuredClone(inputs.lists) : inputs.lists;
1121
+ const resolved = resolveDto(Inputs.Lists.InterleaveDto, inputs);
1122
+ const lists = resolved.clone ? structuredClone(resolved.lists) : resolved.lists;
1085
1123
  if (!lists || lists.length === 0) {
1086
1124
  throw new Error("Lists array is empty or does not exist");
1087
1125
  }