@daiso-tech/core 0.37.2 → 0.38.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 (155) hide show
  1. package/dist/async/_module-exports.d.ts +1 -1
  2. package/dist/async/_module-exports.js +1 -1
  3. package/dist/async/_module-exports.js.map +1 -1
  4. package/dist/async/async.errors.d.ts +0 -20
  5. package/dist/async/async.errors.js +0 -16
  6. package/dist/async/async.errors.js.map +1 -1
  7. package/dist/async/middlewares/_module.d.ts +0 -1
  8. package/dist/async/middlewares/_module.js +0 -1
  9. package/dist/async/middlewares/_module.js.map +1 -1
  10. package/dist/async/middlewares/bulkhead/bulkhead.middleware.js +1 -1
  11. package/dist/async/middlewares/bulkhead/bulkhead.middleware.js.map +1 -1
  12. package/dist/async/middlewares/fallback/_module.d.ts +1 -0
  13. package/dist/async/middlewares/fallback/_module.js +1 -0
  14. package/dist/async/middlewares/fallback/_module.js.map +1 -1
  15. package/dist/async/middlewares/fallback/fallback.middleware.d.ts +25 -49
  16. package/dist/async/middlewares/fallback/fallback.middleware.js +52 -14
  17. package/dist/async/middlewares/fallback/fallback.middleware.js.map +1 -1
  18. package/dist/async/middlewares/fallback/fallback.types.d.ts +42 -0
  19. package/dist/async/middlewares/fallback/fallback.types.js +6 -0
  20. package/dist/async/middlewares/fallback/fallback.types.js.map +1 -0
  21. package/dist/async/middlewares/hedging/_module.d.ts +2 -2
  22. package/dist/async/middlewares/hedging/_module.js +2 -2
  23. package/dist/async/middlewares/hedging/_module.js.map +1 -1
  24. package/dist/async/middlewares/hedging/{_shared.d.ts → hedging.types.d.ts} +37 -9
  25. package/dist/async/middlewares/hedging/hedging.types.js +6 -0
  26. package/dist/async/middlewares/hedging/hedging.types.js.map +1 -0
  27. package/dist/async/middlewares/hedging/{sequential-hedging/sequential-hedging.middleware.d.ts → sequential-hedging.middleware.d.ts} +3 -3
  28. package/dist/async/middlewares/hedging/sequential-hedging.middleware.js +133 -0
  29. package/dist/async/middlewares/hedging/sequential-hedging.middleware.js.map +1 -0
  30. package/dist/async/middlewares/observe/_module.d.ts +1 -0
  31. package/dist/async/middlewares/observe/_module.js +1 -0
  32. package/dist/async/middlewares/observe/_module.js.map +1 -1
  33. package/dist/async/middlewares/observe/observe.middleware.d.ts +37 -87
  34. package/dist/async/middlewares/observe/observe.middleware.js +53 -2
  35. package/dist/async/middlewares/observe/observe.middleware.js.map +1 -1
  36. package/dist/async/middlewares/observe/observe.types.d.ts +91 -0
  37. package/dist/async/middlewares/observe/observe.types.js +6 -0
  38. package/dist/async/middlewares/observe/observe.types.js.map +1 -0
  39. package/dist/async/middlewares/retry/_module.d.ts +1 -0
  40. package/dist/async/middlewares/retry/_module.js +1 -0
  41. package/dist/async/middlewares/retry/_module.js.map +1 -1
  42. package/dist/async/middlewares/retry/retry.middleware.d.ts +36 -86
  43. package/dist/async/middlewares/retry/retry.middleware.js +70 -22
  44. package/dist/async/middlewares/retry/retry.middleware.js.map +1 -1
  45. package/dist/async/middlewares/retry/retry.types.d.ts +77 -0
  46. package/dist/async/middlewares/retry/retry.types.js +7 -0
  47. package/dist/async/middlewares/retry/retry.types.js.map +1 -0
  48. package/dist/async/middlewares/timeout/_module.d.ts +1 -0
  49. package/dist/async/middlewares/timeout/_module.js +1 -0
  50. package/dist/async/middlewares/timeout/_module.js.map +1 -1
  51. package/dist/async/middlewares/timeout/timeout.middleware.d.ts +1 -47
  52. package/dist/async/middlewares/timeout/timeout.middleware.js +1 -1
  53. package/dist/async/middlewares/timeout/timeout.middleware.js.map +1 -1
  54. package/dist/async/middlewares/timeout/timeout.type.d.ts +51 -0
  55. package/dist/async/middlewares/timeout/timeout.type.js +6 -0
  56. package/dist/async/middlewares/timeout/timeout.type.js.map +1 -0
  57. package/dist/async/utilities/promise-queue/promise-queue.js +19 -8
  58. package/dist/async/utilities/promise-queue/promise-queue.js.map +1 -1
  59. package/dist/event-bus/contracts/event-bus.contract.d.ts +0 -6
  60. package/dist/event-bus/contracts/event-bus.contract.js +1 -7
  61. package/dist/event-bus/contracts/event-bus.contract.js.map +1 -1
  62. package/dist/event-bus/contracts/event-bus.errors.d.ts +0 -32
  63. package/dist/event-bus/contracts/event-bus.errors.js +1 -49
  64. package/dist/event-bus/contracts/event-bus.errors.js.map +1 -1
  65. package/dist/event-bus/implementations/derivables/event-bus/event-bus.js +6 -11
  66. package/dist/event-bus/implementations/derivables/event-bus/event-bus.js.map +1 -1
  67. package/dist/lock/contracts/lock.contract.d.ts +2 -18
  68. package/dist/lock/contracts/lock.errors.d.ts +0 -24
  69. package/dist/lock/contracts/lock.errors.js +0 -46
  70. package/dist/lock/contracts/lock.errors.js.map +1 -1
  71. package/dist/lock/implementations/derivables/lock-provider/lock.js +4 -4
  72. package/dist/lock/implementations/derivables/lock-provider/lock.js.map +1 -1
  73. package/dist/lock/implementations/test-utilities/lock-provider.test-suite.js +15 -19
  74. package/dist/lock/implementations/test-utilities/lock-provider.test-suite.js.map +1 -1
  75. package/dist/utilities/_module-exports.d.ts +1 -1
  76. package/dist/utilities/_module-exports.js +1 -1
  77. package/dist/utilities/_module-exports.js.map +1 -1
  78. package/dist/utilities/classes/hooks/async-hooks.d.ts +6 -4
  79. package/dist/utilities/classes/hooks/async-hooks.js +3 -1
  80. package/dist/utilities/classes/hooks/async-hooks.js.map +1 -1
  81. package/dist/utilities/classes/hooks/hooks.d.ts +1 -1
  82. package/dist/utilities/classes/hooks/hooks.js +1 -1
  83. package/dist/utilities/classes/hooks/hooks.js.map +1 -1
  84. package/dist/utilities/classes/namespace/namespace.d.ts +2 -2
  85. package/dist/utilities/classes/namespace/namespace.js.map +1 -1
  86. package/dist/utilities/functions/{_module-exports.d.ts → _module.d.ts} +5 -1
  87. package/dist/utilities/functions/{_module-exports.js → _module.js} +6 -2
  88. package/dist/utilities/functions/_module.js.map +1 -0
  89. package/dist/utilities/functions/error-policy.d.ts +54 -0
  90. package/dist/utilities/functions/error-policy.js +63 -0
  91. package/dist/utilities/functions/error-policy.js.map +1 -0
  92. package/dist/utilities/functions/invokable.d.ts +57 -1
  93. package/dist/utilities/functions/invokable.js +3 -1
  94. package/dist/utilities/functions/invokable.js.map +1 -1
  95. package/dist/utilities/functions/is-class.d.ts +5 -0
  96. package/dist/utilities/functions/is-class.js +11 -0
  97. package/dist/utilities/functions/is-class.js.map +1 -0
  98. package/dist/utilities/functions/is-standard-schema.d.ts +2 -0
  99. package/dist/utilities/functions/is-standard-schema.js +5 -0
  100. package/dist/utilities/functions/is-standard-schema.js.map +1 -0
  101. package/dist/utilities/functions/lazy.d.ts +27 -1
  102. package/dist/utilities/functions/lazy.js.map +1 -1
  103. package/dist/utilities/functions/option.d.ts +32 -0
  104. package/dist/utilities/functions/option.js +25 -0
  105. package/dist/utilities/functions/option.js.map +1 -0
  106. package/dist/utilities/functions/resolve-one-or-more.d.ts +5 -1
  107. package/dist/utilities/functions/resolve-one-or-more.js.map +1 -1
  108. package/dist/utilities/functions/result.d.ts +81 -1
  109. package/dist/utilities/functions/result.js +46 -2
  110. package/dist/utilities/functions/result.js.map +1 -1
  111. package/dist/utilities/types/_module.d.ts +1 -7
  112. package/dist/utilities/types/_module.js +1 -7
  113. package/dist/utilities/types/_module.js.map +1 -1
  114. package/dist/utilities/types/any-class.type.d.ts +3 -0
  115. package/dist/utilities/types/any-class.type.js +2 -0
  116. package/dist/utilities/types/any-class.type.js.map +1 -0
  117. package/package.json +4 -7
  118. package/dist/async/middlewares/_shared.d.ts +0 -15
  119. package/dist/async/middlewares/_shared.js +0 -15
  120. package/dist/async/middlewares/_shared.js.map +0 -1
  121. package/dist/async/middlewares/hedging/_shared.js +0 -5
  122. package/dist/async/middlewares/hedging/_shared.js.map +0 -1
  123. package/dist/async/middlewares/hedging/concurrent-hedging/_module.d.ts +0 -1
  124. package/dist/async/middlewares/hedging/concurrent-hedging/_module.js +0 -2
  125. package/dist/async/middlewares/hedging/concurrent-hedging/_module.js.map +0 -1
  126. package/dist/async/middlewares/hedging/concurrent-hedging/concurrent-hedging.middleware.d.ts +0 -51
  127. package/dist/async/middlewares/hedging/concurrent-hedging/concurrent-hedging.middleware.js +0 -138
  128. package/dist/async/middlewares/hedging/concurrent-hedging/concurrent-hedging.middleware.js.map +0 -1
  129. package/dist/async/middlewares/hedging/sequential-hedging/_module.d.ts +0 -1
  130. package/dist/async/middlewares/hedging/sequential-hedging/_module.js +0 -2
  131. package/dist/async/middlewares/hedging/sequential-hedging/_module.js.map +0 -1
  132. package/dist/async/middlewares/hedging/sequential-hedging/sequential-hedging.middleware.js +0 -104
  133. package/dist/async/middlewares/hedging/sequential-hedging/sequential-hedging.middleware.js.map +0 -1
  134. package/dist/utilities/functions/_module-exports.js.map +0 -1
  135. package/dist/utilities/types/at-least-one.type.d.ts +0 -8
  136. package/dist/utilities/types/at-least-one.type.js +0 -5
  137. package/dist/utilities/types/at-least-one.type.js.map +0 -1
  138. package/dist/utilities/types/factory.type.d.ts +0 -44
  139. package/dist/utilities/types/factory.type.js +0 -5
  140. package/dist/utilities/types/factory.type.js.map +0 -1
  141. package/dist/utilities/types/invokable.type.d.ts +0 -20
  142. package/dist/utilities/types/invokable.type.js +0 -5
  143. package/dist/utilities/types/invokable.type.js.map +0 -1
  144. package/dist/utilities/types/items.type.d.ts +0 -8
  145. package/dist/utilities/types/items.type.js +0 -5
  146. package/dist/utilities/types/items.type.js.map +0 -1
  147. package/dist/utilities/types/lazy.type.d.ts +0 -31
  148. package/dist/utilities/types/lazy.type.js +0 -5
  149. package/dist/utilities/types/lazy.type.js.map +0 -1
  150. package/dist/utilities/types/one-or-more.type.d.ts +0 -8
  151. package/dist/utilities/types/one-or-more.type.js +0 -5
  152. package/dist/utilities/types/one-or-more.type.js.map +0 -1
  153. package/dist/utilities/types/result.type.d.ts +0 -18
  154. package/dist/utilities/types/result.type.js +0 -5
  155. package/dist/utilities/types/result.type.js.map +0 -1
@@ -0,0 +1,63 @@
1
+ /**
2
+ * @module Utilities
3
+ */
4
+ import { callInvokable, isInvokable, } from "../../utilities/functions/invokable.js";
5
+ import { isResult, isResultSuccess, } from "../../utilities/functions/result.js";
6
+ import { isStandardSchema } from "../../utilities/functions/is-standard-schema.js";
7
+ import { isClass } from "../../utilities/functions/is-class.js";
8
+ import {} from "../../utilities/types/_module.js";
9
+ /**
10
+ * @internal
11
+ */
12
+ export function isErrorPolicyBoolSetting(value) {
13
+ return (typeof value === "object" &&
14
+ value !== null &&
15
+ "treatFalseAsError" in value &&
16
+ typeof value.treatFalseAsError === "boolean");
17
+ }
18
+ /**
19
+ * @internal
20
+ */
21
+ export async function callErrorPolicyOnValue(errorPolicy = () => true, value) {
22
+ // Will retry if the value is false and the setting treatFalseAsError is true
23
+ if (!isResult(value)) {
24
+ const shouldRetry = isErrorPolicyBoolSetting(errorPolicy) &&
25
+ typeof value === "boolean" &&
26
+ !value &&
27
+ errorPolicy.treatFalseAsError;
28
+ return shouldRetry;
29
+ }
30
+ // Will not retry if the Result successful
31
+ if (isResultSuccess(value)) {
32
+ return false;
33
+ }
34
+ if (isInvokable(errorPolicy)) {
35
+ return callInvokable(errorPolicy, value.error);
36
+ }
37
+ if (isStandardSchema(errorPolicy)) {
38
+ const schemaResult = await errorPolicy["~standard"].validate(value.error);
39
+ return schemaResult.issues === undefined;
40
+ }
41
+ // This only need so typescript wont complain
42
+ if (isErrorPolicyBoolSetting(errorPolicy)) {
43
+ return false;
44
+ }
45
+ return value.error instanceof errorPolicy;
46
+ }
47
+ /**
48
+ * @internal
49
+ */
50
+ export async function callErrorPolicyOnThrow(errorPolicy = () => true, error) {
51
+ if (isInvokable(errorPolicy)) {
52
+ return callInvokable(errorPolicy, error);
53
+ }
54
+ if (isStandardSchema(errorPolicy)) {
55
+ const result = await errorPolicy["~standard"].validate(error);
56
+ return result.issues === undefined;
57
+ }
58
+ if (isClass(errorPolicy)) {
59
+ return error instanceof errorPolicy;
60
+ }
61
+ return false;
62
+ }
63
+ //# sourceMappingURL=error-policy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error-policy.js","source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xD,KAAK,CAAC,KAAK,CACd,CAAC;QACF,OAAO,YAAY,CAAC,MAAM,KAAK,SAAS,CAAC;IAC7C,CAAC;IAED,6CAA6C;IAC7C,IAAI,wBAAwB,CAAC,WAAW,CAAC,EAAE,CAAC;QACxC,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,OAAO,KAAK,CAAC,KAAK,YAAY,WAAW,CAAC;AAC9C,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CACxC,cAAmC,GAAG,EAAE,CAAC,IAAI,EAC7C,KAAa;IAEb,IAAI,WAAW,CAAC,WAAW,CAAC,EAAE,CAAC;QAC3B,OAAO,aAAa,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;IAC7C,CAAC;IAED,IAAI,gBAAgB,CAAC,WAAW,CAAC,EAAE,CAAC;QAChC,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,WAAW,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC9D,OAAO,MAAM,CAAC,MAAM,KAAK,SAAS,CAAC;IACvC,CAAC;IAED,IAAI,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC;QACvB,OAAO,KAAK,YAAY,WAAW,CAAC;IACxC,CAAC;IAED,OAAO,KAAK,CAAC;AACjB,CAAC"}
@@ -1,7 +1,63 @@
1
1
  /**
2
2
  * @module Utilities
3
3
  */
4
- import type { Invokable, InvokableFn, IInvokableObject } from "../../utilities/types/_module.js";
4
+ import type { NoneFunc } from "../../utilities/types/none-func.type.js";
5
+ import type { Promisable } from "../../utilities/types/promiseable.type.js";
6
+ /**
7
+ *
8
+ * IMPORT_PATH: `"@daiso-tech/core/utilities"`
9
+ */
10
+ export type InvokableFn<TArgs extends unknown[] = unknown[], TReturn = unknown> = (...args: TArgs) => TReturn;
11
+ /**
12
+ *
13
+ * IMPORT_PATH: `"@daiso-tech/core/utilities"`
14
+ */
15
+ export type IInvokableObject<TArgs extends unknown[] = unknown[], TReturn = unknown> = {
16
+ invoke(...args: TArgs): TReturn;
17
+ };
18
+ /**
19
+ *
20
+ * IMPORT_PATH: `"@daiso-tech/core/utilities"`
21
+ */
22
+ export type Invokable<TArgs extends unknown[] = unknown[], TReturn = unknown> = InvokableFn<TArgs, TReturn> | IInvokableObject<TArgs, TReturn>;
23
+ /**
24
+ *
25
+ * IMPORT_PATH: `"@daiso-tech/core/utilities"`
26
+ */
27
+ export type FactoryFn<TInput, TOutput> = InvokableFn<[
28
+ value: TInput
29
+ ], NoneFunc<TOutput>>;
30
+ /**
31
+ *
32
+ * IMPORT_PATH: `"@daiso-tech/core/utilities"`
33
+ */
34
+ export type IFactoryObject<TInput, TOutput> = IInvokableObject<[
35
+ value: TInput
36
+ ], NoneFunc<TOutput>>;
37
+ /**
38
+ *
39
+ * IMPORT_PATH: `"@daiso-tech/core/utilities"`
40
+ */
41
+ export type Factory<TInput, TOutput> = FactoryFn<TInput, TOutput> | IFactoryObject<TInput, TOutput>;
42
+ /**
43
+ *
44
+ * IMPORT_PATH: `"@daiso-tech/core/utilities"`
45
+ */
46
+ export type AsyncFactoryFn<TInput, TOutput> = InvokableFn<[
47
+ value: TInput
48
+ ], Promisable<NoneFunc<TOutput>>>;
49
+ /**
50
+ *
51
+ * IMPORT_PATH: `"@daiso-tech/core/utilities"`
52
+ */
53
+ export type IAsyncFactoryObject<TInput, TOutput> = IInvokableObject<[
54
+ value: TInput
55
+ ], Promisable<NoneFunc<TOutput>>>;
56
+ /**
57
+ *
58
+ * IMPORT_PATH: `"@daiso-tech/core/utilities"`
59
+ */
60
+ export type AsyncFactory<TInput, TOutput> = AsyncFactoryFn<TInput, TOutput> | IAsyncFactoryObject<TInput, TOutput>;
5
61
  /**
6
62
  * @internal
7
63
  */
@@ -3,6 +3,7 @@
3
3
  */
4
4
  import { isNullable } from "../../utilities/functions/is-nullable.js";
5
5
  import { getConstructorName } from "../../utilities/functions/get-constructor-name.js";
6
+ import { isClass } from "../../utilities/functions/is-class.js";
6
7
  /**
7
8
  * @internal
8
9
  */
@@ -20,7 +21,8 @@ export function isInvokableFn(invokable) {
20
21
  * @internal
21
22
  */
22
23
  export function isInvokable(invokable) {
23
- return isInvokableObject(invokable) || isInvokableFn(invokable);
24
+ return ((isInvokableObject(invokable) || isInvokableFn(invokable)) &&
25
+ !isClass(invokable));
24
26
  }
25
27
  /**
26
28
  * @internal
@@ -1 +1 @@
1
- {"version":3,"file":"invokable.js","sourceRoot":"","sources":["../../../src/utilities/functions/invokable.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,OAAO,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+CAA+C,CAAC;AAEnF;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAK7B,SAAmD;IAEnD,MAAM,UAAU,GAAG,SAAoC,CAAC;IACxD,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,OAAO,UAAU,CAAC,QAAQ,CAAC,KAAK,UAAU,CAAC;AAChF,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CACzB,SAAmD;IAEnD,OAAO,OAAO,SAAS,KAAK,UAAU,CAAC;AAC3C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CACvB,SAAmD;IAEnD,OAAO,iBAAiB,CAAC,SAAS,CAAC,IAAI,aAAa,CAAC,SAAS,CAAC,CAAC;AACpE,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAC5B,SAA0C;IAE1C,IAAI,iBAAiB,CAAC,SAAS,CAAC,EAAE,CAAC;QAC/B,OAAO,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;IAClD,CAAC;IACD,OAAO,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,CAAC;AAC3C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CACzB,SAA0C,EA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B,CAAC,SAAS,CAAC,EAAE,CAAC;QAC/B,OAAO,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;IAClD,CAAC;IACD,OAAO,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,CAAC;AAC3C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CACzB,SAA0C,EAC1C,GAAG,IAAiB;IAEpB,IAAI,iBAAiB,CAAC,SAAS,CAAC,EAAE,CAAC;QAC/B,OAAO,SAAS,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;IACrC,CAAC;IACD,OAAO,SAAS,CAAC,GAAG,IAAI,CAAC,CAAC;AAC9B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAC5B,SAA0C;IAE1C,IAAI,aAAa,CAAC,SAAS,CAAC,EAAE,CAAC;QAC3B,OAAO,SAAS,CAAC,IAAI,CAAC;IAC1B,CAAC;IACD,OAAO,kBAAkB,CAAC,SAAS,CAAC,CAAC;AACzC,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @module Utilities
3
+ */
4
+ import type { AnyClass } from "../../utilities/types/_module.js";
5
+ export declare function isClass(value: unknown): value is AnyClass;
@@ -0,0 +1,11 @@
1
+ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
2
+ /* eslint-disable prettier/prettier */
3
+ /* eslint-disable @typescript-eslint/no-unsafe-call */
4
+ /* eslint-disable @typescript-eslint/no-unsafe-return */
5
+ /**
6
+ * @module Utilities
7
+ */
8
+ export function isClass(value) {
9
+ return value?.prototype?.constructor?.toString().startsWith("class");
10
+ }
11
+ //# sourceMappingURL=is-class.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-class.js","sourceRoot":"","sources":["../../../src/utilities/functions/is-class.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,sCAAsC;AACtC,sDAAsD;AACtD,wDAAwD;AACxD;;GAEG;AAIH,MAAM,UAAU,OAAO,CAAC,KAAc;IAClC,OAAQ,KAAa,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;AAClF,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { StandardSchemaV1 } from "@standard-schema/spec";
2
+ export declare function isStandardSchema<TInput, TOutput>(value: unknown): value is StandardSchemaV1<TInput, TOutput>;
@@ -0,0 +1,5 @@
1
+ export function isStandardSchema(value) {
2
+ return (typeof value === "object" &&
3
+ typeof value["~standard"] === "object");
4
+ }
5
+ //# sourceMappingURL=is-standard-schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-standard-schema.js","sourceRoot":"","sources":["../../../src/utilities/functions/is-standard-schema.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,gBAAgB,CAC5B,KAAc;IAEd,OAAO,CACH,OAAO,KAAK,KAAK,QAAQ;QACzB,OAAQ,KAAiC,CAAC,WAAW,CAAC,KAAK,QAAQ,CACtE,CAAC;AACN,CAAC"}
@@ -2,7 +2,33 @@
2
2
  * @module Utilities
3
3
  */
4
4
  import type { LazyPromise } from "../../async/utilities/_module.js";
5
- import type { AsyncLazyable, Lazyable, Lazy, AsyncLazy } from "../../utilities/types/_module.js";
5
+ import { type Invokable } from "../../utilities/functions/invokable.js";
6
+ import type { Promisable } from "../../utilities/types/promiseable.type.js";
7
+ /**
8
+ *
9
+ * IMPORT_PATH: `"@daiso-tech/core/utilities"`
10
+ */
11
+ export type Lazy<TValue> = Invokable<[], TValue>;
12
+ /**
13
+ *
14
+ * IMPORT_PATH: `"@daiso-tech/core/utilities"`
15
+ */
16
+ export type Lazyable<TValue> = TValue | Lazy<TValue>;
17
+ /**
18
+ *
19
+ * IMPORT_PATH: `"@daiso-tech/core/utilities"`
20
+ */
21
+ export type AsyncLazy_<TValue> = Invokable<[], Promisable<TValue>>;
22
+ /**
23
+ *
24
+ * IMPORT_PATH: `"@daiso-tech/core/utilities"`
25
+ */
26
+ export type AsyncLazy<TValue> = AsyncLazy_<TValue> | LazyPromise<TValue>;
27
+ /**
28
+ *
29
+ * IMPORT_PATH: `"@daiso-tech/core/utilities"`
30
+ */
31
+ export type AsyncLazyable<TValue> = TValue | AsyncLazy<TValue>;
6
32
  /**
7
33
  * @internal
8
34
  */
@@ -1 +1 @@
1
- {"version":3,"file":"lazy.js","sourceRoot":"","sources":["../../../src/utilities/functions/lazy.ts"],"names":[],"mappings":"AAAA;;GAEG;AASH,OAAO,EACH,WAAW,EACX,gBAAgB,GACnB,MAAM,oCAAoC,CAAC;AAE5C;;GAEG;AACH,MAAM,UAAU,MAAM,CAClB,QAA0B;IAE1B,OAAO,WAAW,CAAC,QAAQ,CAAC,CAAC;AACjC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CACzB,KAAc;IAEd,OAAO,CACH,OAAO,KAAK,KAAK,QAAQ;QACzB,sEAAsE;QACtE,OAAQ,KAAa,EAAE,IAAI,KAAK,UAAU,CAC7C,CAAC;AACN,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CACzB,QAA+B;IAE/B,OAAO,CACH,aAAa,CAAC,QAAQ,CAAC;QACvB,sEAAsE;QACtE,OAAQ,QAAgB,EAAE,KAAK,KAAK,UAAU,CACjD,CAAC;AACN,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CACvB,QAA+B;IAE/B,OAAO,WAAW,CAAC,QAAQ,CAAC,IAAI,aAAa,CAAC,QAAQ,CAAC,CAAC;AAC5D,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAS,QAA0B;IAC9D,IAAI,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;QACnB,OAAO,gBAAgB,CAAC,QAAQ,CAAC,EAAE,CAAC;IACxC,CAAC;IACD,OAAO,QAAQ,CAAC;AACpB,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAo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M,CAAC,KAAK,UAAU,oBAAoB,CACtC,QAA+B;IAE/B,IAAI,WAAW,CAAC,QAAQ,CAAC,EAAE,CAAC;QACxB,IAAI,aAAa,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC1B,OAAO,MAAM,QAAQ,CAAC;QAC1B,CAAC;QACD,OAAO,MAAM,gBAAgB,CAAC,QAAQ,CAAC,EAAE,CAAC;IAC9C,CAAC;IACD,OAAO,QAAQ,CAAC;AACpB,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @internal
3
+ */
4
+ export declare const OPTION: {
5
+ readonly SOME: "some";
6
+ readonly NONE: "none";
7
+ };
8
+ /**
9
+ * @internal
10
+ */
11
+ export type OptionSome<TValue = unknown> = {
12
+ type: (typeof OPTION)["SOME"];
13
+ value: TValue;
14
+ };
15
+ /**
16
+ * @internal
17
+ */
18
+ export type OptionNone = {
19
+ type: (typeof OPTION)["NONE"];
20
+ };
21
+ /**
22
+ * @internal
23
+ */
24
+ export type Option<TValue = unknown> = OptionSome<TValue> | OptionNone;
25
+ /**
26
+ * @internal
27
+ */
28
+ export declare function optionSome<TValue = unknown>(value: TValue): OptionSome<TValue>;
29
+ /**
30
+ * @internal
31
+ */
32
+ export declare function optionNone(): OptionNone;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @internal
3
+ */
4
+ export const OPTION = {
5
+ SOME: "some",
6
+ NONE: "none",
7
+ };
8
+ /**
9
+ * @internal
10
+ */
11
+ export function optionSome(value) {
12
+ return {
13
+ type: OPTION.SOME,
14
+ value,
15
+ };
16
+ }
17
+ /**
18
+ * @internal
19
+ */
20
+ export function optionNone() {
21
+ return {
22
+ type: OPTION.NONE,
23
+ };
24
+ }
25
+ //# sourceMappingURL=option.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"option.js","sourceRoot":"","sources":["../../../src/utilities/functions/option.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG;IAClB,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;CACN,CAAC;AAsBX;;GAEG;AACH,MAAM,UAAU,UAAU,CACtB,KAAa;IAEb,OAAO;QACH,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,KAAK;KACR,CAAC;AACN,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU;IACtB,OAAO;QACH,IAAI,EAAE,MAAM,CAAC,IAAI;KACpB,CAAC;AACN,CAAC"}
@@ -1,7 +1,11 @@
1
1
  /**
2
2
  * @module Utilities
3
3
  */
4
- import type { OneOrMore } from "../../utilities/types/_module.js";
4
+ /**
5
+ *
6
+ * IMPORT_PATH: `"@daiso-tech/core/utilities"`
7
+ */
8
+ export type OneOrMore<TItem> = TItem | Iterable<TItem>;
5
9
  /**
6
10
  * @internal
7
11
  */
@@ -1 +1 @@
1
- {"version":3,"file":"resolve-one-or-more.js","sourceRoot":"","sources":["../../../src/utilities/functions/resolve-one-or-more.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAC;AAGrE;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAQ,KAAuB;IAC3D,IAAI,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;QACpB,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC;IACtB,CAAC;IACD,OAAO,CAAC,KAAK,CAAC,CAAC;AACnB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAC/B,IAAuB,EACvB,OAAO,GAAG,GAAG;IAEb,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC3B,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,OAAO,gBAAgB,CAAC,IAAI,CAAC;SACxB,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC;SAC/B,IAAI,CAAC,OAAO,CAAC,CAAC;AACvB,CAAC"}
1
+ {"version":3,"file":"resolve-one-or-more.js","sourceRoot":"","sources":["../../../src/utilities/functions/resolve-one-or-more.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAC;AAQrE;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAQ,KAAuB;IAC3D,IAAI,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;QACpB,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC;IACtB,CAAC;IACD,OAAO,CAAC,KAAK,CAAC,CAAC;AACnB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAC/B,IAAuB,EACvB,OAAO,GAAG,GAAG;IAEb,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC3B,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,OAAO,gBAAgB,CAAC,IAAI,CAAC;SACxB,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC;SAC/B,IAAI,CAAC,OAAO,CAAC,CAAC;AACvB,CAAC"}
@@ -1,4 +1,84 @@
1
- import type { ResultFailure, ResultSuccess } from "../../utilities/types/_module.js";
1
+ /**
2
+ * @module Utilities
3
+ */
4
+ export declare const RESULT: {
5
+ readonly FAILURE: "failure";
6
+ readonly SUCCESS: "success";
7
+ };
8
+ /**
9
+ *
10
+ * IMPORT_PATH: `"@daiso-tech/core/utilities"`
11
+ */
12
+ export type ResultFailure<TError = unknown> = {
13
+ type: (typeof RESULT)["FAILURE"];
14
+ error: TError;
15
+ };
16
+ /**
17
+ *
18
+ * IMPORT_PATH: `"@daiso-tech/core/utilities"`
19
+ */
20
+ export type ResultSuccess<TValue = unknown> = {
21
+ type: (typeof RESULT)["SUCCESS"];
22
+ value: TValue;
23
+ };
24
+ /**
25
+ * The `Result` type represents either success or failure.
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * import { Result, resultFailure, resultSuccess, RESULT } from "@daiso-tech/core/utilities";
30
+ *
31
+ * function random(): Result<string, Error> {
32
+ * const nbr = Math.round(Math.random() * 100);
33
+ * if (nbr > 50) {
34
+ * // The resultFailure function return a failed result
35
+ * return resultFailure(new Error("Unexpected error occured"));
36
+ * }
37
+ * // The resultSuccess function return a success result
38
+ * return resultSuccess("Function succeded");
39
+ * }
40
+ *
41
+ * const result = random();
42
+ *
43
+ * // Checking for failure
44
+ * if (result.type === RESULT.FAILURE) {
45
+ * console.log("Error occured:", result.error);
46
+ * }
47
+ *
48
+ * // Checking for success
49
+ * if (result.type === RESULT.SUCCESS) {
50
+ * console.log("Result was successful:", result.value);
51
+ * }
52
+ * ```
53
+ *
54
+ * IMPORT_PATH: `"@daiso-tech/core/utilities"`
55
+ */
56
+ export type Result<TValue = unknown, TError = unknown> = ResultFailure<TError> | ResultSuccess<TValue>;
57
+ /**
58
+ *
59
+ * IMPORT_PATH: `"@daiso-tech/core/utilities"`
60
+ */
61
+ export type InferResultError<TValue> = TValue extends Result ? Extract<TValue, ResultFailure>["error"] : unknown;
62
+ /**
63
+ *
64
+ * IMPORT_PATH: `"@daiso-tech/core/utilities"`
65
+ */
66
+ export type InferResultSuccess<TValue> = TValue extends Result ? Extract<TValue, ResultSuccess>["value"] : TValue;
67
+ /**
68
+ *
69
+ * IMPORT_PATH: `"@daiso-tech/core/utilities"`
70
+ */
71
+ export declare function isResultFailure<TError = unknown>(value: unknown): value is ResultFailure<TError>;
72
+ /**
73
+ *
74
+ * IMPORT_PATH: `"@daiso-tech/core/utilities"`
75
+ */
76
+ export declare function isResultSuccess<TSuccess = unknown>(value: unknown): value is ResultSuccess<TSuccess>;
77
+ /**
78
+ *
79
+ * IMPORT_PATH: `"@daiso-tech/core/utilities"`
80
+ */
81
+ export declare function isResult<TValue = unknown, TError = unknown>(value: unknown): value is Result<TValue, TError>;
2
82
  /**
3
83
  *
4
84
  * IMPORT_PATH: `"@daiso-tech/core/utilities"`
@@ -1,15 +1,59 @@
1
+ /**
2
+ * @module Utilities
3
+ */
4
+ export const RESULT = {
5
+ FAILURE: "failure",
6
+ SUCCESS: "success",
7
+ };
8
+ /**
9
+ *
10
+ * IMPORT_PATH: `"@daiso-tech/core/utilities"`
11
+ */
12
+ export function isResultFailure(value) {
13
+ return (typeof value === "object" &&
14
+ value !== null &&
15
+ "type" in value &&
16
+ typeof value.type === "string" &&
17
+ value.type === RESULT.FAILURE &&
18
+ "error" in value);
19
+ }
20
+ /**
21
+ *
22
+ * IMPORT_PATH: `"@daiso-tech/core/utilities"`
23
+ */
24
+ export function isResultSuccess(value) {
25
+ return (typeof value === "object" &&
26
+ value !== null &&
27
+ "type" in value &&
28
+ typeof value.type === "string" &&
29
+ value.type === RESULT.SUCCESS &&
30
+ "value" in value);
31
+ }
32
+ /**
33
+ *
34
+ * IMPORT_PATH: `"@daiso-tech/core/utilities"`
35
+ */
36
+ export function isResult(value) {
37
+ return isResultFailure(value) || isResultSuccess(value);
38
+ }
1
39
  /**
2
40
  *
3
41
  * IMPORT_PATH: `"@daiso-tech/core/utilities"`
4
42
  */
5
43
  export function resultFailure(error) {
6
- return [null, error];
44
+ return {
45
+ type: RESULT.FAILURE,
46
+ error,
47
+ };
7
48
  }
8
49
  /**
9
50
  *
10
51
  * IMPORT_PATH: `"@daiso-tech/core/utilities"`
11
52
  */
12
53
  export function resultSuccess(value) {
13
- return [value, null];
54
+ return {
55
+ type: RESULT.SUCCESS,
56
+ value,
57
+ };
14
58
  }
15
59
  //# sourceMappingURL=result.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"result.js","sourceRoot":"","sources":["../../../src/utilities/functions/result.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,MAAM,UAAU,aAAa,CACzB,KAAa;IAEb,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AACzB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAS,KAAa;IAC/C,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AACzB,CAAC"}
1
+ {"version":3,"file":"result.js","sourceRoot":"","sources":["../../../src/utilities/functions/result.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,CAAC,MAAM,MAAM,GAAG;IAClB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;CACZ,CAAC;AAwEX;;;GAGG;AACH,MAAM,UAAU,eAAe,CAC3B,KAAc;IAEd,OAAO,CACH,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,MAAM,IAAI,KAAK;QACf,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;QAC9B,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC,OAAO;QAC7B,OAAO,IAAI,KAAK,CACnB,CAAC;AACN,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,eAAe,CAC3B,KAAc;IAEd,OAAO,CACH,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,MAAM,IAAI,KAAK;QACf,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ;QAC9B,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC,OAAO;QAC7B,OAAO,IAAI,KAAK,CACnB,CAAC;AACN,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,QAAQ,CACpB,KAAc;IAEd,OAAO,eAAe,CAAC,KAAK,CAAC,IAAI,eAAe,CAAC,KAAK,CAAC,CAAC;AAC5D,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAAa,CACzB,KAAa;IAEb,OAAO;QACH,IAAI,EAAE,MAAM,CAAC,OAAO;QACpB,KAAK;KACR,CAAC;AACN,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAS,KAAa;IAC/C,OAAO;QACH,IAAI,EAAE,MAAM,CAAC,OAAO;QACpB,KAAK;KACR,CAAC;AACN,CAAC"}
@@ -1,10 +1,4 @@
1
+ export * from "../../utilities/types/any-class.type.js";
1
2
  export * from "../../utilities/types/async-iterable-value.type.js";
2
- export * from "../../utilities/types/at-least-one.type.js";
3
- export * from "../../utilities/types/factory.type.js";
4
3
  export * from "../../utilities/types/none-func.type.js";
5
- export * from "../../utilities/types/invokable.type.js";
6
- export * from "../../utilities/types/items.type.js";
7
- export * from "../../utilities/types/lazy.type.js";
8
- export * from "../../utilities/types/one-or-more.type.js";
9
4
  export * from "../../utilities/types/promiseable.type.js";
10
- export * from "../../utilities/types/result.type.js";
@@ -1,11 +1,5 @@
1
+ export * from "../../utilities/types/any-class.type.js";
1
2
  export * from "../../utilities/types/async-iterable-value.type.js";
2
- export * from "../../utilities/types/at-least-one.type.js";
3
- export * from "../../utilities/types/factory.type.js";
4
3
  export * from "../../utilities/types/none-func.type.js";
5
- export * from "../../utilities/types/invokable.type.js";
6
- export * from "../../utilities/types/items.type.js";
7
- export * from "../../utilities/types/lazy.type.js";
8
- export * from "../../utilities/types/one-or-more.type.js";
9
4
  export * from "../../utilities/types/promiseable.type.js";
10
- export * from "../../utilities/types/result.type.js";
11
5
  //# sourceMappingURL=_module.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"_module.js","sourceRoot":"","sources":["../../../src/utilities/types/_module.ts"],"names":[],"mappings":"AAAA,cAAc,gDAAgD,CAAC;AAC/D,cAAc,wCAAwC,CAAC;AACvD,cAAc,mCAAmC,CAAC;AAClD,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC;AACpD,cAAc,iCAAiC,CAAC;AAChD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uCAAuC,CAAC;AACtD,cAAc,uCAAuC,CAAC;AACtD,cAAc,kCAAkC,CAAC"}
1
+ {"version":3,"file":"_module.js","sourceRoot":"","sources":["../../../src/utilities/types/_module.ts"],"names":[],"mappings":"AAAA,cAAc,qCAAqC,CAAC;AACpD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,qCAAqC,CAAC;AACpD,cAAc,uCAAuC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export type AnyClass = {
2
+ new (...args: any[]): any;
3
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=any-class.type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"any-class.type.js","sourceRoot":"","sources":["../../../src/utilities/types/any-class.type.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@daiso-tech/core",
3
3
  "private": false,
4
- "version": "0.37.2",
4
+ "version": "0.38.0",
5
5
  "author": "Yousif Abdulkarim",
6
6
  "license": "Apache-2.0",
7
7
  "type": "module",
@@ -198,8 +198,8 @@
198
198
  },
199
199
  "peerDependencies": {
200
200
  "ioredis": "^5.0.0",
201
- "kysely": "^0.28.0",
202
- "mongodb": "^6.0.0"
201
+ "mongodb": "^6.0.0",
202
+ "kysely": "^0.28.0"
203
203
  },
204
204
  "peerDependenciesMeta": {
205
205
  "mongodb": {
@@ -208,10 +208,7 @@
208
208
  "ioredis": {
209
209
  "optional": true
210
210
  },
211
- "better-sqlite3": {
212
- "optional": true
213
- },
214
- "@libsql/client": {
211
+ "kysely": {
215
212
  "optional": true
216
213
  }
217
214
  },
@@ -1,15 +0,0 @@
1
- /**
2
- * @module Async
3
- */
4
- import { type Invokable } from "../../utilities/_module-exports.js";
5
- import type { StandardSchemaV1 } from "@standard-schema/spec";
6
- /**
7
- *
8
- * IMPORT_PATH: `"@daiso-tech/core/async"`
9
- * @group Middlewares
10
- */
11
- export type ErrorPolicy<TInput = unknown, TOutput = unknown> = Invokable<[error: unknown], boolean> | StandardSchemaV1<TInput, TOutput>;
12
- /**
13
- * @internal
14
- */
15
- export declare function callErrorPolicy<TInput = unknown, TOutput = unknown>(errorPolicy: ErrorPolicy<TInput, TOutput>, value: unknown): Promise<boolean>;
@@ -1,15 +0,0 @@
1
- /**
2
- * @module Async
3
- */
4
- import { callInvokable, isInvokable, } from "../../utilities/_module-exports.js";
5
- /**
6
- * @internal
7
- */
8
- export async function callErrorPolicy(errorPolicy, value) {
9
- if (isInvokable(errorPolicy)) {
10
- return callInvokable(errorPolicy, value);
11
- }
12
- const result = await errorPolicy["~standard"].validate(value);
13
- return result.issues === undefined;
14
- }
15
- //# sourceMappingURL=_shared.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"_shared.js","sourceRoot":"","sources":["../../../src/async/middlewares/_shared.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EACH,aAAa,EACb,WAAW,GAEd,MAAM,gCAAgC,CAAC;AAYxC;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACjC,WAAyC,EACzC,KAAc;IAEd,IAAI,WAAW,CAAC,WAAW,CAAC,EAAE,CAAC;QAC3B,OAAO,aAAa,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;IAC7C,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,WAAW,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9D,OAAO,MAAM,CAAC,MAAM,KAAK,SAAS,CAAC;AACvC,CAAC"}
@@ -1,5 +0,0 @@
1
- /**
2
- * @module Async
3
- */
4
- import {} from "../../../utilities/_module-exports.js";
5
- //# sourceMappingURL=_shared.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"_shared.js","sourceRoot":"","sources":["../../../../src/async/middlewares/hedging/_shared.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAKN,MAAM,gCAAgC,CAAC"}
@@ -1 +0,0 @@
1
- export * from "../../../../async/middlewares/hedging/concurrent-hedging/_module.js";
@@ -1,2 +0,0 @@
1
- export * from "../../../../async/middlewares/hedging/concurrent-hedging/_module.js";
2
- //# sourceMappingURL=_module.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"_module.js","sourceRoot":"","sources":["../../../../../src/async/middlewares/hedging/concurrent-hedging/_module.ts"],"names":[],"mappings":"AAAA,cAAc,2DAA2D,CAAC"}