@dereekb/util 13.11.2 → 13.11.3

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 (102) hide show
  1. package/eslint/index.cjs.default.js +1 -0
  2. package/eslint/index.cjs.js +607 -0
  3. package/eslint/index.cjs.mjs +2 -0
  4. package/eslint/index.d.ts +1 -0
  5. package/eslint/index.esm.js +603 -0
  6. package/eslint/package.json +23 -0
  7. package/eslint/src/index.d.ts +1 -0
  8. package/eslint/src/lib/comments.d.ts +54 -0
  9. package/eslint/src/lib/index.d.ts +3 -0
  10. package/eslint/src/lib/plugin.d.ts +18 -0
  11. package/eslint/src/lib/prefer-no-side-effects-in-jsdoc.rule.d.ts +42 -0
  12. package/eslint/src/lib/require-no-side-effects.rule.d.ts +54 -0
  13. package/fetch/package.json +2 -2
  14. package/index.cjs.js +1203 -23
  15. package/index.esm.js +1203 -23
  16. package/package.json +7 -1
  17. package/src/lib/array/array.factory.d.ts +2 -0
  18. package/src/lib/array/array.filter.d.ts +50 -17
  19. package/src/lib/array/array.find.d.ts +1 -0
  20. package/src/lib/array/array.index.d.ts +7 -0
  21. package/src/lib/array/array.indexed.d.ts +21 -0
  22. package/src/lib/array/array.make.d.ts +7 -0
  23. package/src/lib/array/array.random.d.ts +1 -0
  24. package/src/lib/array/array.unique.d.ts +3 -0
  25. package/src/lib/array/array.value.d.ts +7 -0
  26. package/src/lib/auth/auth.role.claims.d.ts +7 -0
  27. package/src/lib/boolean.d.ts +1 -0
  28. package/src/lib/contact/random.d.ts +14 -0
  29. package/src/lib/date/date.d.ts +6 -0
  30. package/src/lib/date/time.d.ts +7 -0
  31. package/src/lib/date/week.d.ts +7 -0
  32. package/src/lib/error/error.d.ts +7 -0
  33. package/src/lib/filter/filter.d.ts +7 -0
  34. package/src/lib/function/function.boolean.d.ts +7 -0
  35. package/src/lib/function/function.forward.d.ts +14 -0
  36. package/src/lib/getter/getter.cache.d.ts +7 -0
  37. package/src/lib/getter/getter.d.ts +34 -0
  38. package/src/lib/getter/getter.map.d.ts +7 -0
  39. package/src/lib/getter/getter.util.d.ts +7 -0
  40. package/src/lib/grouping.d.ts +8 -0
  41. package/src/lib/hash.d.ts +1 -0
  42. package/src/lib/key.d.ts +16 -0
  43. package/src/lib/map/map.key.d.ts +14 -0
  44. package/src/lib/model/id.batch.d.ts +7 -0
  45. package/src/lib/model/id.factory.d.ts +7 -0
  46. package/src/lib/model/model.conversion.d.ts +35 -0
  47. package/src/lib/model/model.copy.d.ts +7 -0
  48. package/src/lib/model/model.d.ts +19 -0
  49. package/src/lib/model/model.modify.d.ts +14 -0
  50. package/src/lib/nodejs/stream.d.ts +7 -0
  51. package/src/lib/number/bound.d.ts +3 -0
  52. package/src/lib/number/dollar.d.ts +7 -0
  53. package/src/lib/number/factory.d.ts +7 -0
  54. package/src/lib/number/random.d.ts +1 -0
  55. package/src/lib/number/round.d.ts +22 -0
  56. package/src/lib/number/sort.d.ts +7 -0
  57. package/src/lib/number/transform.d.ts +7 -0
  58. package/src/lib/object/object.array.delta.d.ts +7 -0
  59. package/src/lib/object/object.equal.d.ts +7 -0
  60. package/src/lib/object/object.filter.pojo.d.ts +87 -0
  61. package/src/lib/object/object.filter.tuple.d.ts +16 -0
  62. package/src/lib/object/object.key.d.ts +14 -0
  63. package/src/lib/object/object.map.d.ts +14 -0
  64. package/src/lib/path/path.d.ts +9 -0
  65. package/src/lib/promise/promise.d.ts +21 -0
  66. package/src/lib/promise/promise.factory.d.ts +7 -0
  67. package/src/lib/promise/promise.task.d.ts +7 -0
  68. package/src/lib/service/handler.config.d.ts +28 -0
  69. package/src/lib/service/handler.d.ts +14 -0
  70. package/src/lib/set/set.d.ts +21 -0
  71. package/src/lib/set/set.decision.d.ts +7 -0
  72. package/src/lib/set/set.delta.d.ts +7 -0
  73. package/src/lib/set/set.selection.d.ts +7 -0
  74. package/src/lib/sort.d.ts +8 -0
  75. package/src/lib/string/char.d.ts +7 -0
  76. package/src/lib/string/dencoder.d.ts +35 -0
  77. package/src/lib/string/factory.d.ts +22 -1
  78. package/src/lib/string/replace.d.ts +78 -0
  79. package/src/lib/string/search.d.ts +7 -0
  80. package/src/lib/string/sort.d.ts +7 -0
  81. package/src/lib/string/string.d.ts +1 -0
  82. package/src/lib/string/transform.d.ts +53 -0
  83. package/src/lib/string/tree.d.ts +7 -0
  84. package/src/lib/string/url.d.ts +7 -0
  85. package/src/lib/tree/tree.array.d.ts +1 -0
  86. package/src/lib/tree/tree.explore.d.ts +3 -0
  87. package/src/lib/type.d.ts +3 -2
  88. package/src/lib/value/bound.d.ts +28 -0
  89. package/src/lib/value/comparator.d.ts +16 -0
  90. package/src/lib/value/decision.d.ts +5 -0
  91. package/src/lib/value/equal.d.ts +2 -0
  92. package/src/lib/value/indexed.d.ts +127 -0
  93. package/src/lib/value/map.d.ts +22 -0
  94. package/src/lib/value/maybe.type.d.ts +2 -2
  95. package/src/lib/value/modifier.d.ts +13 -0
  96. package/src/lib/value/point.d.ts +56 -0
  97. package/src/lib/value/use.d.ts +37 -0
  98. package/src/lib/value/vector.d.ts +7 -0
  99. package/test/index.cjs.js +17 -4
  100. package/test/index.esm.js +17 -4
  101. package/test/package.json +2 -2
  102. package/test/src/lib/shared/shared.fail.d.ts +24 -5
package/test/index.esm.js CHANGED
@@ -1088,8 +1088,9 @@ function _ts_generator(thisArg, body) {
1088
1088
  /**
1089
1089
  * Throws an {@link ExpectedFailError} to signal that a test reached the expected failure point.
1090
1090
  *
1091
- * Used within {@link shouldFail} or {@link expectSuccessfulFail} to indicate that the expected
1092
- * error path was taken successfully.
1091
+ * Must be called inside {@link shouldFail} (typically via {@link itShouldFail}) or {@link expectSuccessfulFail},
1092
+ * which catch `ExpectedFailError` and convert it into a passing test. Calling it inside a plain
1093
+ * `it()` block causes the test to fail because the error propagates uncaught.
1093
1094
  *
1094
1095
  * @param message - optional error message
1095
1096
  */ function failSuccessfully(message) {
@@ -1168,11 +1169,23 @@ function _ts_generator(thisArg, body) {
1168
1169
  };
1169
1170
  }
1170
1171
  /**
1171
- * Function that expects any failure to be thrown, then throws an ExpectedFailError.
1172
+ * Function that expects any failure to be thrown, then throws an {@link ExpectedFailError}.
1173
+ *
1174
+ * Intended to be used inside {@link itShouldFail} or {@link shouldFail}, which catch the
1175
+ * `ExpectedFailError` and treat it as a passing test. When used inside a plain `it()` block
1176
+ * the thrown `ExpectedFailError` propagates and fails the test even though `errorFn` rejected
1177
+ * as expected — for that case use vitest's `await expect(...).rejects.toThrow(...)` instead.
1172
1178
  *
1173
1179
  * @param errorFn - function expected to throw an error (sync or async)
1174
1180
  * @param assertFailType - optional assertion to validate the type or content of the thrown error
1175
- * @returns a promise that resolves when the expected failure is verified
1181
+ * @returns a promise that rejects with {@link ExpectedFailError} when the expected failure is verified, or with {@link UnexpectedSuccessFailureError} when `errorFn` resolves successfully
1182
+ *
1183
+ * @example
1184
+ * ```ts
1185
+ * itShouldFail('when the user is not authorized', async () => {
1186
+ * await expectFail(() => callProtectedEndpoint(), expectFailAssertHttpErrorServerErrorCode(403));
1187
+ * });
1188
+ * ```
1176
1189
  */ function expectFail(errorFn, assertFailType) {
1177
1190
  function handleError(e) {
1178
1191
  if (_instanceof(e, UnexpectedSuccessFailureError)) {
package/test/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@dereekb/util/test",
3
- "version": "13.11.2",
3
+ "version": "13.11.3",
4
4
  "peerDependencies": {
5
- "@dereekb/util": "13.11.2",
5
+ "@dereekb/util": "13.11.3",
6
6
  "make-error": "^1.3.6"
7
7
  },
8
8
  "exports": {
@@ -19,8 +19,9 @@ export declare function failSuccessfullyError(message?: string): ExpectedFailErr
19
19
  /**
20
20
  * Throws an {@link ExpectedFailError} to signal that a test reached the expected failure point.
21
21
  *
22
- * Used within {@link shouldFail} or {@link expectSuccessfulFail} to indicate that the expected
23
- * error path was taken successfully.
22
+ * Must be called inside {@link shouldFail} (typically via {@link itShouldFail}) or {@link expectSuccessfulFail},
23
+ * which catch `ExpectedFailError` and convert it into a passing test. Calling it inside a plain
24
+ * `it()` block causes the test to fail because the error propagates uncaught.
24
25
  *
25
26
  * @param message - optional error message
26
27
  */
@@ -80,15 +81,33 @@ export type ExpectFailAssertionFunction = (error: unknown) => PromiseOrValue<May
80
81
  */
81
82
  export declare function expectFailAssertErrorType(expectedType: ClassType | ClassLikeType | typeof Error | any): ExpectFailAssertionFunction;
82
83
  /**
83
- * Function that expects any failure to be thrown, then throws an ExpectedFailError.
84
+ * Function that expects any failure to be thrown, then throws an {@link ExpectedFailError}.
85
+ *
86
+ * Intended to be used inside {@link itShouldFail} or {@link shouldFail}, which catch the
87
+ * `ExpectedFailError` and treat it as a passing test. When used inside a plain `it()` block
88
+ * the thrown `ExpectedFailError` propagates and fails the test even though `errorFn` rejected
89
+ * as expected — for that case use vitest's `await expect(...).rejects.toThrow(...)` instead.
84
90
  *
85
91
  * @param errorFn - function expected to throw an error (sync or async)
86
92
  * @param assertFailType - optional assertion to validate the type or content of the thrown error
87
- * @returns a promise that resolves when the expected failure is verified
93
+ * @returns a promise that rejects with {@link ExpectedFailError} when the expected failure is verified, or with {@link UnexpectedSuccessFailureError} when `errorFn` resolves successfully
94
+ *
95
+ * @example
96
+ * ```ts
97
+ * itShouldFail('when the user is not authorized', async () => {
98
+ * await expectFail(() => callProtectedEndpoint(), expectFailAssertHttpErrorServerErrorCode(403));
99
+ * });
100
+ * ```
88
101
  */
89
102
  export declare function expectFail(errorFn: () => PromiseOrValue<any>, assertFailType?: ExpectFailAssertionFunction): Promise<void>;
90
103
  /**
91
- * Function that expects an ExpectedFailError to be thrown.
104
+ * Function that expects an {@link ExpectedFailError} to be thrown by `errorFn`.
105
+ *
106
+ * Lower-level building block used by {@link shouldFail}; most consumer tests should use
107
+ * {@link itShouldFail} + {@link expectFail} (or {@link failSuccessfully}) rather than calling
108
+ * this directly. If `errorFn` resolves without throwing, this calls `handleError` with an
109
+ * {@link UnexpectedSuccessFailureError}; if it throws something other than `ExpectedFailError`,
110
+ * `handleError` likewise rejects the surrounding test.
92
111
  *
93
112
  * @param errorFn - function expected to throw (sync or async); if it succeeds, the test fails
94
113
  * @param handleError - optional custom error handler; defaults to {@link EXPECT_ERROR_DEFAULT_HANDLER}