@wentools/simmer 0.1.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 (113) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +107 -0
  3. package/esm/debounce/debounce.d.ts +15 -0
  4. package/esm/debounce/debounce.d.ts.map +1 -0
  5. package/esm/debounce/debounce.js +61 -0
  6. package/esm/debounce/mod.d.ts +2 -0
  7. package/esm/debounce/mod.d.ts.map +1 -0
  8. package/esm/debounce/mod.js +1 -0
  9. package/esm/deps/jsr.io/@wentools/result/0.1.3/src/err/err.d.ts +38 -0
  10. package/esm/deps/jsr.io/@wentools/result/0.1.3/src/err/err.d.ts.map +1 -0
  11. package/esm/deps/jsr.io/@wentools/result/0.1.3/src/err/err.js +38 -0
  12. package/esm/deps/jsr.io/@wentools/result/0.1.3/src/err/mod.d.ts +2 -0
  13. package/esm/deps/jsr.io/@wentools/result/0.1.3/src/err/mod.d.ts.map +1 -0
  14. package/esm/deps/jsr.io/@wentools/result/0.1.3/src/err/mod.js +1 -0
  15. package/esm/deps/jsr.io/@wentools/result/0.1.3/src/is_result/is_result.d.ts +11 -0
  16. package/esm/deps/jsr.io/@wentools/result/0.1.3/src/is_result/is_result.d.ts.map +1 -0
  17. package/esm/deps/jsr.io/@wentools/result/0.1.3/src/is_result/is_result.js +14 -0
  18. package/esm/deps/jsr.io/@wentools/result/0.1.3/src/is_result/mod.d.ts +2 -0
  19. package/esm/deps/jsr.io/@wentools/result/0.1.3/src/is_result/mod.d.ts.map +1 -0
  20. package/esm/deps/jsr.io/@wentools/result/0.1.3/src/is_result/mod.js +1 -0
  21. package/esm/deps/jsr.io/@wentools/result/0.1.3/src/mod.d.ts +156 -0
  22. package/esm/deps/jsr.io/@wentools/result/0.1.3/src/mod.d.ts.map +1 -0
  23. package/esm/deps/jsr.io/@wentools/result/0.1.3/src/mod.js +65 -0
  24. package/esm/deps/jsr.io/@wentools/result/0.1.3/src/propagate_err/mod.d.ts +2 -0
  25. package/esm/deps/jsr.io/@wentools/result/0.1.3/src/propagate_err/mod.d.ts.map +1 -0
  26. package/esm/deps/jsr.io/@wentools/result/0.1.3/src/propagate_err/mod.js +1 -0
  27. package/esm/deps/jsr.io/@wentools/result/0.1.3/src/propagate_err/propagate_err.d.ts +28 -0
  28. package/esm/deps/jsr.io/@wentools/result/0.1.3/src/propagate_err/propagate_err.d.ts.map +1 -0
  29. package/esm/deps/jsr.io/@wentools/result/0.1.3/src/propagate_err/propagate_err.js +30 -0
  30. package/esm/eventual/eventual.d.ts +32 -0
  31. package/esm/eventual/eventual.d.ts.map +1 -0
  32. package/esm/eventual/eventual.js +47 -0
  33. package/esm/eventual/mod.d.ts +3 -0
  34. package/esm/eventual/mod.d.ts.map +1 -0
  35. package/esm/eventual/mod.js +1 -0
  36. package/esm/mod.d.ts +7 -0
  37. package/esm/mod.d.ts.map +1 -0
  38. package/esm/mod.js +4 -0
  39. package/esm/package.json +3 -0
  40. package/esm/retry/delay.d.ts +8 -0
  41. package/esm/retry/delay.d.ts.map +1 -0
  42. package/esm/retry/delay.js +28 -0
  43. package/esm/retry/mod.d.ts +5 -0
  44. package/esm/retry/mod.d.ts.map +1 -0
  45. package/esm/retry/mod.js +3 -0
  46. package/esm/retry/retry.d.ts +23 -0
  47. package/esm/retry/retry.d.ts.map +1 -0
  48. package/esm/retry/retry.js +128 -0
  49. package/esm/retry/types.d.ts +59 -0
  50. package/esm/retry/types.d.ts.map +1 -0
  51. package/esm/retry/types.js +8 -0
  52. package/esm/sleep/mod.d.ts +2 -0
  53. package/esm/sleep/mod.d.ts.map +1 -0
  54. package/esm/sleep/mod.js +1 -0
  55. package/esm/sleep/sleep.d.ts +6 -0
  56. package/esm/sleep/sleep.d.ts.map +1 -0
  57. package/esm/sleep/sleep.js +7 -0
  58. package/package.json +33 -0
  59. package/script/debounce/debounce.d.ts +15 -0
  60. package/script/debounce/debounce.d.ts.map +1 -0
  61. package/script/debounce/debounce.js +65 -0
  62. package/script/debounce/mod.d.ts +2 -0
  63. package/script/debounce/mod.d.ts.map +1 -0
  64. package/script/debounce/mod.js +6 -0
  65. package/script/deps/jsr.io/@wentools/result/0.1.3/src/err/err.d.ts +38 -0
  66. package/script/deps/jsr.io/@wentools/result/0.1.3/src/err/err.d.ts.map +1 -0
  67. package/script/deps/jsr.io/@wentools/result/0.1.3/src/err/err.js +41 -0
  68. package/script/deps/jsr.io/@wentools/result/0.1.3/src/err/mod.d.ts +2 -0
  69. package/script/deps/jsr.io/@wentools/result/0.1.3/src/err/mod.d.ts.map +1 -0
  70. package/script/deps/jsr.io/@wentools/result/0.1.3/src/err/mod.js +5 -0
  71. package/script/deps/jsr.io/@wentools/result/0.1.3/src/is_result/is_result.d.ts +11 -0
  72. package/script/deps/jsr.io/@wentools/result/0.1.3/src/is_result/is_result.d.ts.map +1 -0
  73. package/script/deps/jsr.io/@wentools/result/0.1.3/src/is_result/is_result.js +17 -0
  74. package/script/deps/jsr.io/@wentools/result/0.1.3/src/is_result/mod.d.ts +2 -0
  75. package/script/deps/jsr.io/@wentools/result/0.1.3/src/is_result/mod.d.ts.map +1 -0
  76. package/script/deps/jsr.io/@wentools/result/0.1.3/src/is_result/mod.js +5 -0
  77. package/script/deps/jsr.io/@wentools/result/0.1.3/src/mod.d.ts +156 -0
  78. package/script/deps/jsr.io/@wentools/result/0.1.3/src/mod.d.ts.map +1 -0
  79. package/script/deps/jsr.io/@wentools/result/0.1.3/src/mod.js +77 -0
  80. package/script/deps/jsr.io/@wentools/result/0.1.3/src/propagate_err/mod.d.ts +2 -0
  81. package/script/deps/jsr.io/@wentools/result/0.1.3/src/propagate_err/mod.d.ts.map +1 -0
  82. package/script/deps/jsr.io/@wentools/result/0.1.3/src/propagate_err/mod.js +5 -0
  83. package/script/deps/jsr.io/@wentools/result/0.1.3/src/propagate_err/propagate_err.d.ts +28 -0
  84. package/script/deps/jsr.io/@wentools/result/0.1.3/src/propagate_err/propagate_err.d.ts.map +1 -0
  85. package/script/deps/jsr.io/@wentools/result/0.1.3/src/propagate_err/propagate_err.js +33 -0
  86. package/script/eventual/eventual.d.ts +32 -0
  87. package/script/eventual/eventual.d.ts.map +1 -0
  88. package/script/eventual/eventual.js +53 -0
  89. package/script/eventual/mod.d.ts +3 -0
  90. package/script/eventual/mod.d.ts.map +1 -0
  91. package/script/eventual/mod.js +8 -0
  92. package/script/mod.d.ts +7 -0
  93. package/script/mod.d.ts.map +1 -0
  94. package/script/mod.js +20 -0
  95. package/script/package.json +3 -0
  96. package/script/retry/delay.d.ts +8 -0
  97. package/script/retry/delay.d.ts.map +1 -0
  98. package/script/retry/delay.js +32 -0
  99. package/script/retry/mod.d.ts +5 -0
  100. package/script/retry/mod.d.ts.map +1 -0
  101. package/script/retry/mod.js +12 -0
  102. package/script/retry/retry.d.ts +23 -0
  103. package/script/retry/retry.d.ts.map +1 -0
  104. package/script/retry/retry.js +134 -0
  105. package/script/retry/types.d.ts +59 -0
  106. package/script/retry/types.d.ts.map +1 -0
  107. package/script/retry/types.js +11 -0
  108. package/script/sleep/mod.d.ts +2 -0
  109. package/script/sleep/mod.d.ts.map +1 -0
  110. package/script/sleep/mod.js +5 -0
  111. package/script/sleep/sleep.d.ts +6 -0
  112. package/script/sleep/sleep.d.ts.map +1 -0
  113. package/script/sleep/sleep.js +10 -0
@@ -0,0 +1,38 @@
1
+ import { type Err } from 'neverthrow';
2
+ /**
3
+ * Create an Err Result with automatic literal type preservation
4
+ *
5
+ * Uses TypeScript 5.0+ const type parameters to preserve literal types automatically.
6
+ * No need for 'as const' - the type parameter is inferred as a literal!
7
+ *
8
+ * Returns Err<never, E> (not Result<never, E>) so .error is directly accessible.
9
+ *
10
+ * @example
11
+ * // ✅ Simple error
12
+ * return err('not_found', 'User not found')
13
+ * // Type: Err<never, { type: 'not_found', message: string }>
14
+ *
15
+ * @example
16
+ * // ✅ Error with additional properties
17
+ * return err('not_found', 'User not found', { userId: '123' })
18
+ * // Type: Err<never, { type: 'not_found', message: string, userId: string }>
19
+ *
20
+ * @example
21
+ * // ✅ Direct .error access (no narrowing needed)
22
+ * const error = err('not_found', 'User not found').error
23
+ * // error.type is 'not_found'
24
+ *
25
+ * @example
26
+ * // ✅ Error with complex additional data
27
+ * return err('validation_failed', 'Invalid input', {
28
+ * field: 'email',
29
+ * errors: ['Invalid format']
30
+ * })
31
+ * // Type: Err<never, { type: 'validation_failed', message: string, field: string, errors: string[] }>
32
+ */
33
+ declare const err: <const TType extends string, TAdditional extends Record<string, unknown> = Record<string, never>>(type: TType, message: string, additional?: TAdditional) => Err<never, {
34
+ type: TType;
35
+ message: string;
36
+ } & TAdditional>;
37
+ export { err };
38
+ //# sourceMappingURL=err.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"err.d.ts","sourceRoot":"","sources":["../../../../../../../../src/deps/jsr.io/@wentools/result/0.1.3/src/err/err.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,GAAG,EAAE,MAAM,YAAY,CAAA;AAElD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,QAAA,MAAM,GAAG,GACR,KAAK,CAAC,KAAK,SAAS,MAAM,EAC1B,WAAW,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAEnE,MAAM,KAAK,EACX,SAAS,MAAM,EACf,aAAa,WAAW,KACtB,GAAG,CAAC,KAAK,EAAE;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,WAAW,CAKP,CAAA;AAErD,OAAO,EAAE,GAAG,EAAE,CAAA"}
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.err = void 0;
4
+ const neverthrow_1 = require("neverthrow");
5
+ /**
6
+ * Create an Err Result with automatic literal type preservation
7
+ *
8
+ * Uses TypeScript 5.0+ const type parameters to preserve literal types automatically.
9
+ * No need for 'as const' - the type parameter is inferred as a literal!
10
+ *
11
+ * Returns Err<never, E> (not Result<never, E>) so .error is directly accessible.
12
+ *
13
+ * @example
14
+ * // ✅ Simple error
15
+ * return err('not_found', 'User not found')
16
+ * // Type: Err<never, { type: 'not_found', message: string }>
17
+ *
18
+ * @example
19
+ * // ✅ Error with additional properties
20
+ * return err('not_found', 'User not found', { userId: '123' })
21
+ * // Type: Err<never, { type: 'not_found', message: string, userId: string }>
22
+ *
23
+ * @example
24
+ * // ✅ Direct .error access (no narrowing needed)
25
+ * const error = err('not_found', 'User not found').error
26
+ * // error.type is 'not_found'
27
+ *
28
+ * @example
29
+ * // ✅ Error with complex additional data
30
+ * return err('validation_failed', 'Invalid input', {
31
+ * field: 'email',
32
+ * errors: ['Invalid format']
33
+ * })
34
+ * // Type: Err<never, { type: 'validation_failed', message: string, field: string, errors: string[] }>
35
+ */
36
+ const err = (type, message, additional) => (0, neverthrow_1.err)({
37
+ ...additional,
38
+ type,
39
+ message,
40
+ });
41
+ exports.err = err;
@@ -0,0 +1,2 @@
1
+ export { err } from './err.js';
2
+ //# sourceMappingURL=mod.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../../../../../../src/deps/jsr.io/@wentools/result/0.1.3/src/err/mod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.err = void 0;
4
+ var err_js_1 = require("./err.js");
5
+ Object.defineProperty(exports, "err", { enumerable: true, get: function () { return err_js_1.err; } });
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Check if a value is a neverthrow Result type
3
+ *
4
+ * Uses duck typing to detect Result objects without importing neverthrow types.
5
+ */
6
+ declare const isResult: (value: unknown) => value is {
7
+ isOk: () => boolean;
8
+ isErr: () => boolean;
9
+ };
10
+ export { isResult };
11
+ //# sourceMappingURL=is_result.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is_result.d.ts","sourceRoot":"","sources":["../../../../../../../../src/deps/jsr.io/@wentools/result/0.1.3/src/is_result/is_result.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,QAAA,MAAM,QAAQ,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI;IAAE,IAAI,EAAE,MAAM,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,OAAO,CAAA;CAStF,CAAA;AAED,OAAO,EAAE,QAAQ,EAAE,CAAA"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ /**
3
+ * Check if a value is a neverthrow Result type
4
+ *
5
+ * Uses duck typing to detect Result objects without importing neverthrow types.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.isResult = void 0;
9
+ const isResult = (value) => {
10
+ return (value !== null &&
11
+ typeof value === 'object' &&
12
+ 'isOk' in value &&
13
+ 'isErr' in value &&
14
+ typeof value.isOk === 'function' &&
15
+ typeof value.isErr === 'function');
16
+ };
17
+ exports.isResult = isResult;
@@ -0,0 +1,2 @@
1
+ export { isResult } from './is_result.js';
2
+ //# sourceMappingURL=mod.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../../../../../../src/deps/jsr.io/@wentools/result/0.1.3/src/is_result/mod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isResult = void 0;
4
+ var is_result_js_1 = require("./is_result.js");
5
+ Object.defineProperty(exports, "isResult", { enumerable: true, get: function () { return is_result_js_1.isResult; } });
@@ -0,0 +1,156 @@
1
+ import { err as _Err, ok, type Result, type Err, ResultAsync, okAsync as neverthrowOkAsync } from 'neverthrow';
2
+ /**
3
+ * Create an error object with literal type preservation
4
+ *
5
+ * @example
6
+ * const error = makeErr('not_found', 'User not found')
7
+ * // ✅ Type: { type: 'not_found', message: string }
8
+ *
9
+ * @example
10
+ * const error = makeErr('not_found', 'User not found', { userId: '123' })
11
+ * // ✅ Type: { type: 'not_found', message: string, userId: string }
12
+ */
13
+ declare const makeErr: <const TType extends string, TAdditional extends Record<string, unknown> = Record<string, never>>(type: TType, message: string, additional?: TAdditional) => {
14
+ type: TType;
15
+ message: string;
16
+ } & TAdditional;
17
+ /**
18
+ * Create an async Err ResultAsync with automatic literal type preservation
19
+ *
20
+ * Async version of err() - same signature, returns ResultAsync instead of Result.
21
+ * Uses TypeScript 5.0+ const type parameters to preserve literal types automatically.
22
+ *
23
+ * @example
24
+ * // ✅ Simple error
25
+ * return errAsync('not_found', 'User not found')
26
+ * // Type: ResultAsync<never, { type: 'not_found', message: string }>
27
+ *
28
+ * @example
29
+ * // ✅ Error with additional properties
30
+ * return errAsync('not_found', 'User not found', { userId: '123' })
31
+ * // Type: ResultAsync<never, { type: 'not_found', message: string, userId: string }>
32
+ *
33
+ * @example
34
+ * // ✅ Error with complex additional data
35
+ * return errAsync('validation_failed', 'Invalid input', {
36
+ * field: 'email',
37
+ * errors: ['Invalid format']
38
+ * })
39
+ * // Type: ResultAsync<never, { type: 'validation_failed', message: string, field: string, errors: string[] }>
40
+ */
41
+ declare const errAsync: <const TType extends string, TAdditional extends Record<string, unknown> = Record<string, never>>(type: TType, message: string, additional?: TAdditional) => ResultAsync<never, {
42
+ type: TType;
43
+ message: string;
44
+ } & TAdditional>;
45
+ /**
46
+ * Re-export okAsync from neverthrow for consistency
47
+ * Creates a successful ResultAsync
48
+ */
49
+ declare const okAsync: typeof neverthrowOkAsync;
50
+ /**
51
+ * Utility type for defining error types concisely
52
+ *
53
+ * @example
54
+ * // Instead of:
55
+ * type UserNotFoundError = {
56
+ * type: 'user_not_found'
57
+ * message: string
58
+ * userId: UserId
59
+ * }
60
+ *
61
+ * // Write:
62
+ * type UserNotFoundError = ErrorType<'user_not_found', { userId: UserId }>
63
+ *
64
+ * @example
65
+ * // Error without additional properties:
66
+ * type InvalidOperationError = ErrorType<'invalid_operation'>
67
+ */
68
+ type ErrorType<TType extends string, TAdditional extends Record<string, unknown> = Record<string, never>> = {
69
+ type: TType;
70
+ message: string;
71
+ } & TAdditional;
72
+ /**
73
+ * Extract the error type from a Result or Promise<Result>
74
+ *
75
+ * @example
76
+ * // From async function
77
+ * const getUser = async (id: string): Promise<Result<User, UserNotFoundError>> => { ... }
78
+ * type GetUserError = ExtractError<ReturnType<typeof getUser>>
79
+ * // Type: UserNotFoundError
80
+ *
81
+ * @example
82
+ * // From Result type directly
83
+ * type MyResult = Result<User, InvalidError>
84
+ * type MyError = ExtractError<MyResult>
85
+ * // Type: InvalidError
86
+ *
87
+ * @example
88
+ * // Works with composed errors
89
+ * const replaceVersion = async (): Promise<Result<Version, VersionNotFoundError | VersionExistsError>> => { ... }
90
+ * type ReplaceError = ExtractError<ReturnType<typeof replaceVersion>>
91
+ * // Type: VersionNotFoundError | VersionExistsError
92
+ */
93
+ type ExtractError<TResultOrPromise> = TResultOrPromise extends Promise<Result<unknown, infer TError>> ? TError : TResultOrPromise extends Result<unknown, infer TError> ? TError : never;
94
+ /**
95
+ * Extract the error type from a function that returns Result or Promise<Result>
96
+ *
97
+ * @example
98
+ * // Simple extraction
99
+ * const getUser = async (id: string): Promise<Result<User, UserNotFoundError>> => { ... }
100
+ * type GetUserError = ExtractFnError<typeof getUser>
101
+ * // Type: UserNotFoundError
102
+ *
103
+ * @example
104
+ * // Compose errors from multiple functions
105
+ * const getUser = async (id: string): Promise<Result<User, UserNotFoundError>> => { ... }
106
+ * const getImage = async (id: string): Promise<Result<Image, ImageNotFoundError>> => { ... }
107
+ * type CombinedError = ExtractFnError<typeof getUser> | ExtractFnError<typeof getImage>
108
+ * // Type: UserNotFoundError | ImageNotFoundError
109
+ */
110
+ type ExtractFnError<TFunction extends (...args: unknown[]) => unknown> = ExtractError<ReturnType<TFunction>>;
111
+ /**
112
+ * Extract and combine error types from multiple Result or Promise<Result> types
113
+ *
114
+ * @example
115
+ * type UserResult = Result<User, UserNotFoundError>
116
+ * type ImageResult = Promise<Result<Image, ImageNotFoundError>>
117
+ * type ProductResult = Result<Product, ProductNotFoundError>
118
+ *
119
+ * type CombinedError = ExtractErrors<[UserResult, ImageResult, ProductResult]>
120
+ * // Type: UserNotFoundError | ImageNotFoundError | ProductNotFoundError
121
+ */
122
+ type ExtractErrors<TResults extends readonly unknown[]> = TResults extends readonly [
123
+ infer TFirst,
124
+ ...infer TRest
125
+ ] ? ExtractError<TFirst> | ExtractErrors<TRest> : never;
126
+ /**
127
+ * Extract and combine error types from multiple functions that return Result or Promise<Result>
128
+ *
129
+ * @example
130
+ * const getUser = async (id: string): Promise<Result<User, UserNotFoundError>> => { ... }
131
+ * const getImage = async (id: string): Promise<Result<Image, ImageNotFoundError>> => { ... }
132
+ * const deleteProduct = async (id: string): Promise<Result<void, ProductNotFoundError>> => { ... }
133
+ *
134
+ * type CombinedError = ExtractFnsError<[typeof getUser, typeof getImage, typeof deleteProduct]>
135
+ * // Type: UserNotFoundError | ImageNotFoundError | ProductNotFoundError
136
+ */
137
+ type ExtractFnsError<TFunctions extends readonly ((...args: unknown[]) => unknown)[]> = TFunctions extends readonly [
138
+ infer TFirst,
139
+ ...infer TRest extends readonly ((...args: unknown[]) => unknown)[]
140
+ ] ? ExtractFnError<TFirst & ((...args: unknown[]) => unknown)> | ExtractFnsError<TRest> : never;
141
+ /**
142
+ * Raw error function from neverthrow - use for lifting database errors directly
143
+ *
144
+ * @example
145
+ * const seedResult = await songSeeds.get.one.byId(songSeedId)
146
+ * if (seedResult.isErr()) {
147
+ * return rawErr(seedResult.error)
148
+ * }
149
+ */
150
+ declare const rawErr: typeof _Err;
151
+ export { makeErr, errAsync, ok, okAsync, rawErr, _Err, ResultAsync };
152
+ export type { Result, Err, ErrorType, ExtractError, ExtractFnError, ExtractErrors, ExtractFnsError };
153
+ export { err } from './err/mod.js';
154
+ export { isResult } from './is_result/mod.js';
155
+ export { propagateErr } from './propagate_err/mod.js';
156
+ //# sourceMappingURL=mod.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../../../../../src/deps/jsr.io/@wentools/result/0.1.3/src/mod.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,GAAG,IAAI,IAAI,EACX,EAAE,EACF,KAAK,MAAM,EACX,KAAK,GAAG,EACR,WAAW,EAEX,OAAO,IAAI,iBAAiB,EAC5B,MAAM,YAAY,CAAA;AAEnB;;;;;;;;;;GAUG;AACH,QAAA,MAAM,OAAO,GACZ,KAAK,CAAC,KAAK,SAAS,MAAM,EAC1B,WAAW,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAEnE,MAAM,KAAK,EACX,SAAS,MAAM,EACf,aAAa,WAAW,KACtB;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,WAKe,CAAA;AAErD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,QAAA,MAAM,QAAQ,GACb,KAAK,CAAC,KAAK,SAAS,MAAM,EAC1B,WAAW,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAEnE,MAAM,KAAK,EACX,SAAS,MAAM,EACf,aAAa,WAAW,KACtB,WAAW,CAAC,KAAK,EAAE;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,WAAW,CAKf,CAAA;AAErD;;;GAGG;AACH,QAAA,MAAM,OAAO,EAAE,OAAO,iBAAqC,CAAA;AAE3D;;;;;;;;;;;;;;;;;GAiBG;AACH,KAAK,SAAS,CACb,KAAK,SAAS,MAAM,EACpB,WAAW,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,IAChE;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,WAAW,CAAA;AAElD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,KAAK,YAAY,CAAC,gBAAgB,IACjC,gBAAgB,SAAS,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,MAAM,CAAC,CAAC,GAC5D,MAAM,GACN,gBAAgB,SAAS,MAAM,CAAC,OAAO,EAAE,MAAM,MAAM,CAAC,GACrD,MAAM,GACN,KAAK,CAAA;AAEV;;;;;;;;;;;;;;;GAeG;AACH,KAAK,cAAc,CAAC,SAAS,SAAS,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,IAAI,YAAY,CACpF,UAAU,CAAC,SAAS,CAAC,CACrB,CAAA;AAED;;;;;;;;;;GAUG;AACH,KAAK,aAAa,CAAC,QAAQ,SAAS,SAAS,OAAO,EAAE,IAAI,QAAQ,SAAS,SAAS;IACnF,MAAM,MAAM;IACZ,GAAG,MAAM,KAAK;CACd,GACE,YAAY,CAAC,MAAM,CAAC,GAAG,aAAa,CAAC,KAAK,CAAC,GAC3C,KAAK,CAAA;AAER;;;;;;;;;;GAUG;AACH,KAAK,eAAe,CAAC,UAAU,SAAS,SAAS,CAAC,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC,EAAE,IACnF,UAAU,SAAS,SAAS;IAC3B,MAAM,MAAM;IACZ,GAAG,MAAM,KAAK,SAAS,SAAS,CAAC,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC,EAAE;CACnE,GACE,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC,CAAC,GAAG,eAAe,CAAC,KAAK,CAAC,GACnF,KAAK,CAAA;AAET;;;;;;;;GAQG;AACH,QAAA,MAAM,MAAM,EAAE,OAAO,IAAW,CAAA;AAEhC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,CAAA;AACpE,YAAY,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,eAAe,EAAE,CAAA;AACpG,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA"}
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.propagateErr = exports.isResult = exports.err = exports.ResultAsync = exports._Err = exports.rawErr = exports.okAsync = exports.ok = exports.errAsync = exports.makeErr = void 0;
4
+ const neverthrow_1 = require("neverthrow");
5
+ Object.defineProperty(exports, "_Err", { enumerable: true, get: function () { return neverthrow_1.err; } });
6
+ Object.defineProperty(exports, "ok", { enumerable: true, get: function () { return neverthrow_1.ok; } });
7
+ Object.defineProperty(exports, "ResultAsync", { enumerable: true, get: function () { return neverthrow_1.ResultAsync; } });
8
+ /**
9
+ * Create an error object with literal type preservation
10
+ *
11
+ * @example
12
+ * const error = makeErr('not_found', 'User not found')
13
+ * // ✅ Type: { type: 'not_found', message: string }
14
+ *
15
+ * @example
16
+ * const error = makeErr('not_found', 'User not found', { userId: '123' })
17
+ * // ✅ Type: { type: 'not_found', message: string, userId: string }
18
+ */
19
+ const makeErr = (type, message, additional) => ({
20
+ ...additional,
21
+ type,
22
+ message,
23
+ });
24
+ exports.makeErr = makeErr;
25
+ /**
26
+ * Create an async Err ResultAsync with automatic literal type preservation
27
+ *
28
+ * Async version of err() - same signature, returns ResultAsync instead of Result.
29
+ * Uses TypeScript 5.0+ const type parameters to preserve literal types automatically.
30
+ *
31
+ * @example
32
+ * // ✅ Simple error
33
+ * return errAsync('not_found', 'User not found')
34
+ * // Type: ResultAsync<never, { type: 'not_found', message: string }>
35
+ *
36
+ * @example
37
+ * // ✅ Error with additional properties
38
+ * return errAsync('not_found', 'User not found', { userId: '123' })
39
+ * // Type: ResultAsync<never, { type: 'not_found', message: string, userId: string }>
40
+ *
41
+ * @example
42
+ * // ✅ Error with complex additional data
43
+ * return errAsync('validation_failed', 'Invalid input', {
44
+ * field: 'email',
45
+ * errors: ['Invalid format']
46
+ * })
47
+ * // Type: ResultAsync<never, { type: 'validation_failed', message: string, field: string, errors: string[] }>
48
+ */
49
+ const errAsync = (type, message, additional) => (0, neverthrow_1.errAsync)({
50
+ ...additional,
51
+ type,
52
+ message,
53
+ });
54
+ exports.errAsync = errAsync;
55
+ /**
56
+ * Re-export okAsync from neverthrow for consistency
57
+ * Creates a successful ResultAsync
58
+ */
59
+ const okAsync = neverthrow_1.okAsync;
60
+ exports.okAsync = okAsync;
61
+ /**
62
+ * Raw error function from neverthrow - use for lifting database errors directly
63
+ *
64
+ * @example
65
+ * const seedResult = await songSeeds.get.one.byId(songSeedId)
66
+ * if (seedResult.isErr()) {
67
+ * return rawErr(seedResult.error)
68
+ * }
69
+ */
70
+ const rawErr = neverthrow_1.err;
71
+ exports.rawErr = rawErr;
72
+ var mod_js_1 = require("./err/mod.js");
73
+ Object.defineProperty(exports, "err", { enumerable: true, get: function () { return mod_js_1.err; } });
74
+ var mod_js_2 = require("./is_result/mod.js");
75
+ Object.defineProperty(exports, "isResult", { enumerable: true, get: function () { return mod_js_2.isResult; } });
76
+ var mod_js_3 = require("./propagate_err/mod.js");
77
+ Object.defineProperty(exports, "propagateErr", { enumerable: true, get: function () { return mod_js_3.propagateErr; } });
@@ -0,0 +1,2 @@
1
+ export { propagateErr } from './propagate_err.js';
2
+ //# sourceMappingURL=mod.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../../../../../../src/deps/jsr.io/@wentools/result/0.1.3/src/propagate_err/mod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.propagateErr = void 0;
4
+ var propagate_err_js_1 = require("./propagate_err.js");
5
+ Object.defineProperty(exports, "propagateErr", { enumerable: true, get: function () { return propagate_err_js_1.propagateErr; } });
@@ -0,0 +1,28 @@
1
+ import type { Result } from 'neverthrow';
2
+ /**
3
+ * Propagates an error Result to a different success type context.
4
+ *
5
+ * This is safe because error Results never contain the success value - only the error.
6
+ * TypeScript's structural typing prevents direct assignment of Result<T, E> to Result<U, E>
7
+ * even though the error type is identical and we're in the error branch.
8
+ *
9
+ * Common use case: Early return from a function that creates multiple items. If creating
10
+ * item 2 fails with Result<Item, DatabaseError>, we need to return Result<Item[], DatabaseError>.
11
+ *
12
+ * @example
13
+ * const result = await createUser(db, data) // Result<User, DatabaseError>
14
+ * if (result.isErr()) {
15
+ * // Need to return Result<Profile, DatabaseError> but have Result<User, DatabaseError>
16
+ * return propagateErr(result)
17
+ * }
18
+ *
19
+ * @example
20
+ * // In bulk creation, propagate single-item error to array context
21
+ * const itemResult = await createItem(data) // Result<Item, Error>
22
+ * if (itemResult.isErr()) {
23
+ * return propagateErr<Item[], Error>(itemResult) // Result<Item[], Error>
24
+ * }
25
+ */
26
+ declare const propagateErr: <TNew, E>(errorResult: Result<unknown, E>) => Result<TNew, E>;
27
+ export { propagateErr };
28
+ //# sourceMappingURL=propagate_err.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"propagate_err.d.ts","sourceRoot":"","sources":["../../../../../../../../src/deps/jsr.io/@wentools/result/0.1.3/src/propagate_err/propagate_err.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAExC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,QAAA,MAAM,YAAY,GAAI,IAAI,EAAE,CAAC,EAAE,aAAa,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,KAAG,MAAM,CAAC,IAAI,EAAE,CAAC,CAI9E,CAAA;AAED,OAAO,EAAE,YAAY,EAAE,CAAA"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.propagateErr = void 0;
4
+ /**
5
+ * Propagates an error Result to a different success type context.
6
+ *
7
+ * This is safe because error Results never contain the success value - only the error.
8
+ * TypeScript's structural typing prevents direct assignment of Result<T, E> to Result<U, E>
9
+ * even though the error type is identical and we're in the error branch.
10
+ *
11
+ * Common use case: Early return from a function that creates multiple items. If creating
12
+ * item 2 fails with Result<Item, DatabaseError>, we need to return Result<Item[], DatabaseError>.
13
+ *
14
+ * @example
15
+ * const result = await createUser(db, data) // Result<User, DatabaseError>
16
+ * if (result.isErr()) {
17
+ * // Need to return Result<Profile, DatabaseError> but have Result<User, DatabaseError>
18
+ * return propagateErr(result)
19
+ * }
20
+ *
21
+ * @example
22
+ * // In bulk creation, propagate single-item error to array context
23
+ * const itemResult = await createItem(data) // Result<Item, Error>
24
+ * if (itemResult.isErr()) {
25
+ * return propagateErr<Item[], Error>(itemResult) // Result<Item[], Error>
26
+ * }
27
+ */
28
+ const propagateErr = (errorResult) => {
29
+ // Type assertion is safe: we're only propagating errors, and error Results
30
+ // don't contain the success value. The error type E is preserved exactly.
31
+ return errorResult;
32
+ };
33
+ exports.propagateErr = propagateErr;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * EventualResult - A utility for the "stale-while-revalidate" pattern
3
+ *
4
+ * Returns cached data immediately, optionally refreshes in background.
5
+ */
6
+ type EventualResult<TData> = {
7
+ readonly current: TData;
8
+ readonly fresh: Promise<TData> | null;
9
+ readonly isStale: boolean;
10
+ };
11
+ /**
12
+ * Create an EventualResult from current data and optional fresh promise
13
+ */
14
+ declare const eventual: <TData>(current: TData, fresh: Promise<TData> | null) => EventualResult<TData>;
15
+ /**
16
+ * Create an EventualResult, lazily creating the fresh promise only when stale
17
+ */
18
+ declare const eventualIf: <TData>(current: TData, isStale: boolean, getFresh: () => Promise<TData>) => EventualResult<TData>;
19
+ /**
20
+ * Transform both current and fresh values of an EventualResult
21
+ */
22
+ declare const mapEventual: <TInput, TOutput>(result: EventualResult<TInput>, fn: (value: TInput) => TOutput) => EventualResult<TOutput>;
23
+ /**
24
+ * Combine multiple EventualResults into a single EventualResult
25
+ *
26
+ * The combined result is stale if any input is stale.
27
+ * The fresh promise resolves when all stale inputs have refreshed.
28
+ */
29
+ declare const combineEventual: <TResults extends Record<string, EventualResult<unknown>>>(results: TResults) => EventualResult<{ [K in keyof TResults]: TResults[K]["current"]; }>;
30
+ export { eventual, eventualIf, mapEventual, combineEventual };
31
+ export type { EventualResult };
32
+ //# sourceMappingURL=eventual.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"eventual.d.ts","sourceRoot":"","sources":["../../src/eventual/eventual.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,KAAK,cAAc,CAAC,KAAK,IAAI;IAC5B,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAA;IACvB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI,CAAA;IACrC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;CACzB,CAAA;AAED;;GAEG;AACH,QAAA,MAAM,QAAQ,GAAI,KAAK,EAAE,SAAS,KAAK,EAAE,OAAO,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI,KAAG,cAAc,CAAC,KAAK,CAI1F,CAAA;AAEF;;GAEG;AACH,QAAA,MAAM,UAAU,GAAI,KAAK,EACxB,SAAS,KAAK,EACd,SAAS,OAAO,EAChB,UAAU,MAAM,OAAO,CAAC,KAAK,CAAC,KAC5B,cAAc,CAAC,KAAK,CAIrB,CAAA;AAEF;;GAEG;AACH,QAAA,MAAM,WAAW,GAAI,MAAM,EAAE,OAAO,EACnC,QAAQ,cAAc,CAAC,MAAM,CAAC,EAC9B,IAAI,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,KAC5B,cAAc,CAAC,OAAO,CAIvB,CAAA;AAEF;;;;;GAKG;AACH,QAAA,MAAM,eAAe,GAAI,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC,EAChF,SAAS,QAAQ,KACf,cAAc,CAAC,GAAG,CAAC,IAAI,MAAM,QAAQ,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAE,CAqBlE,CAAA;AAED,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,eAAe,EAAE,CAAA;AAC7D,YAAY,EAAE,cAAc,EAAE,CAAA"}
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ /**
3
+ * EventualResult - A utility for the "stale-while-revalidate" pattern
4
+ *
5
+ * Returns cached data immediately, optionally refreshes in background.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.combineEventual = exports.mapEventual = exports.eventualIf = exports.eventual = void 0;
9
+ /**
10
+ * Create an EventualResult from current data and optional fresh promise
11
+ */
12
+ const eventual = (current, fresh) => ({
13
+ current,
14
+ fresh,
15
+ isStale: fresh !== null,
16
+ });
17
+ exports.eventual = eventual;
18
+ /**
19
+ * Create an EventualResult, lazily creating the fresh promise only when stale
20
+ */
21
+ const eventualIf = (current, isStale, getFresh) => ({
22
+ current,
23
+ fresh: isStale ? getFresh() : null,
24
+ isStale,
25
+ });
26
+ exports.eventualIf = eventualIf;
27
+ /**
28
+ * Transform both current and fresh values of an EventualResult
29
+ */
30
+ const mapEventual = (result, fn) => ({
31
+ current: fn(result.current),
32
+ fresh: result.fresh?.then(fn) ?? null,
33
+ isStale: result.isStale,
34
+ });
35
+ exports.mapEventual = mapEventual;
36
+ /**
37
+ * Combine multiple EventualResults into a single EventualResult
38
+ *
39
+ * The combined result is stale if any input is stale.
40
+ * The fresh promise resolves when all stale inputs have refreshed.
41
+ */
42
+ const combineEventual = (results) => {
43
+ const current = Object.fromEntries(Object.entries(results).map(([k, v]) => [k, v.current]));
44
+ const freshEntries = Object.entries(results).filter((entry) => entry[1].fresh !== null);
45
+ const fresh = freshEntries.length > 0
46
+ ? Promise.all(freshEntries.map(([k, v]) => v.fresh.then((val) => [k, val]))).then((entries) => ({
47
+ ...current,
48
+ ...Object.fromEntries(entries),
49
+ }))
50
+ : null;
51
+ return { current, fresh, isStale: fresh !== null };
52
+ };
53
+ exports.combineEventual = combineEventual;
@@ -0,0 +1,3 @@
1
+ export { eventual, eventualIf, mapEventual, combineEventual } from './eventual.js';
2
+ export type { EventualResult } from './eventual.js';
3
+ //# sourceMappingURL=mod.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/eventual/mod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAClF,YAAY,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.combineEventual = exports.mapEventual = exports.eventualIf = exports.eventual = void 0;
4
+ var eventual_js_1 = require("./eventual.js");
5
+ Object.defineProperty(exports, "eventual", { enumerable: true, get: function () { return eventual_js_1.eventual; } });
6
+ Object.defineProperty(exports, "eventualIf", { enumerable: true, get: function () { return eventual_js_1.eventualIf; } });
7
+ Object.defineProperty(exports, "mapEventual", { enumerable: true, get: function () { return eventual_js_1.mapEventual; } });
8
+ Object.defineProperty(exports, "combineEventual", { enumerable: true, get: function () { return eventual_js_1.combineEventual; } });
@@ -0,0 +1,7 @@
1
+ export { sleep } from './sleep/mod.js';
2
+ export { debounce, debounceAsync } from './debounce/mod.js';
3
+ export { withRetry, retryPromise, makeRetryable, withRetryMetadata, calculateDelay, defaultRetryOptions, } from './retry/mod.js';
4
+ export type { RetryOptions, RetryError, ExecutionAttempt, ExecutionMetadata, } from './retry/mod.js';
5
+ export { eventual, eventualIf, mapEventual, combineEventual } from './eventual/mod.js';
6
+ export type { EventualResult } from './eventual/mod.js';
7
+ //# sourceMappingURL=mod.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AACtC,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EACN,SAAS,EACT,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,mBAAmB,GACnB,MAAM,gBAAgB,CAAA;AACvB,YAAY,EACX,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,iBAAiB,GACjB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACtF,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA"}
package/script/mod.js ADDED
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.combineEventual = exports.mapEventual = exports.eventualIf = exports.eventual = exports.defaultRetryOptions = exports.calculateDelay = exports.withRetryMetadata = exports.makeRetryable = exports.retryPromise = exports.withRetry = exports.debounceAsync = exports.debounce = exports.sleep = void 0;
4
+ var mod_js_1 = require("./sleep/mod.js");
5
+ Object.defineProperty(exports, "sleep", { enumerable: true, get: function () { return mod_js_1.sleep; } });
6
+ var mod_js_2 = require("./debounce/mod.js");
7
+ Object.defineProperty(exports, "debounce", { enumerable: true, get: function () { return mod_js_2.debounce; } });
8
+ Object.defineProperty(exports, "debounceAsync", { enumerable: true, get: function () { return mod_js_2.debounceAsync; } });
9
+ var mod_js_3 = require("./retry/mod.js");
10
+ Object.defineProperty(exports, "withRetry", { enumerable: true, get: function () { return mod_js_3.withRetry; } });
11
+ Object.defineProperty(exports, "retryPromise", { enumerable: true, get: function () { return mod_js_3.retryPromise; } });
12
+ Object.defineProperty(exports, "makeRetryable", { enumerable: true, get: function () { return mod_js_3.makeRetryable; } });
13
+ Object.defineProperty(exports, "withRetryMetadata", { enumerable: true, get: function () { return mod_js_3.withRetryMetadata; } });
14
+ Object.defineProperty(exports, "calculateDelay", { enumerable: true, get: function () { return mod_js_3.calculateDelay; } });
15
+ Object.defineProperty(exports, "defaultRetryOptions", { enumerable: true, get: function () { return mod_js_3.defaultRetryOptions; } });
16
+ var mod_js_4 = require("./eventual/mod.js");
17
+ Object.defineProperty(exports, "eventual", { enumerable: true, get: function () { return mod_js_4.eventual; } });
18
+ Object.defineProperty(exports, "eventualIf", { enumerable: true, get: function () { return mod_js_4.eventualIf; } });
19
+ Object.defineProperty(exports, "mapEventual", { enumerable: true, get: function () { return mod_js_4.mapEventual; } });
20
+ Object.defineProperty(exports, "combineEventual", { enumerable: true, get: function () { return mod_js_4.combineEventual; } });
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "commonjs"
3
+ }
@@ -0,0 +1,8 @@
1
+ import type { RetryOptions } from './types.js';
2
+ import { sleep } from '../sleep/mod.js';
3
+ /**
4
+ * Calculate delay for next retry attempt based on strategy
5
+ */
6
+ declare const calculateDelay: (attempt: number, options: Pick<RetryOptions, "backoffStrategy" | "initialDelayMs" | "maxDelayMs" | "jitter">) => number;
7
+ export { calculateDelay, sleep };
8
+ //# sourceMappingURL=delay.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delay.d.ts","sourceRoot":"","sources":["../../src/retry/delay.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAEvC;;GAEG;AACH,QAAA,MAAM,cAAc,GACnB,SAAS,MAAM,EACf,SAAS,IAAI,CAAC,YAAY,EAAE,iBAAiB,GAAG,gBAAgB,GAAG,YAAY,GAAG,QAAQ,CAAC,KACzF,MA4BF,CAAA;AAED,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,CAAA"}