@nlozgachev/pipelined 0.64.0 → 0.65.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.
- package/dist/Core-BDXRLmMa.cjs +6147 -0
- package/dist/Core-BHN87zoB.mjs +6010 -0
- package/dist/InternalTypes-B1Lh9uw_.d.cts +143 -0
- package/dist/InternalTypes-DzDey5Do.d.ts +143 -0
- package/dist/composition.cjs +724 -632
- package/dist/composition.d.cts +453 -446
- package/dist/composition.d.ts +453 -446
- package/dist/composition.mjs +695 -577
- package/dist/core.cjs +24 -6580
- package/dist/core.d.cts +3 -2627
- package/dist/core.d.ts +3 -2627
- package/dist/core.mjs +2 -6532
- package/dist/data.cjs +2889 -3682
- package/dist/data.d.cts +1234 -1228
- package/dist/data.d.ts +1234 -1228
- package/dist/data.mjs +2880 -3647
- package/dist/index-B07Wr815.d.ts +4383 -0
- package/dist/index-Bs8En5LJ.d.cts +238 -0
- package/dist/index-Bs8En5LJ.d.ts +238 -0
- package/dist/index-DCK_VPog.d.cts +4383 -0
- package/dist/index.cjs +69 -9607
- package/dist/index.d.cts +6 -7
- package/dist/index.d.ts +6 -7
- package/dist/index.mjs +5 -9517
- package/dist/types.cjs +195 -225
- package/dist/types.d.cts +2 -58
- package/dist/types.d.ts +2 -58
- package/dist/types.mjs +192 -196
- package/package.json +24 -15
- package/dist/Duration-DeyxG6VQ.d.cts +0 -181
- package/dist/Duration-DeyxG6VQ.d.ts +0 -181
- package/dist/InternalTypes-CCXa8Kvr.d.ts +0 -142
- package/dist/InternalTypes-GFn4RTwD.d.cts +0 -142
- package/dist/Task-9SJCMtG4.d.ts +0 -1748
- package/dist/Task-C_goFYQ1.d.cts +0 -1748
package/dist/types.cjs
CHANGED
|
@@ -1,228 +1,198 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/Types/Brand.ts
|
|
3
|
+
const Brand = {
|
|
4
|
+
/**
|
|
5
|
+
* Returns a constructor that wraps a value of type T in brand K.
|
|
6
|
+
* The resulting function performs an unchecked cast — only use when the raw
|
|
7
|
+
* value is known to satisfy the brand's invariants.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* type PositiveNumber = Brand<"PositiveNumber", number>;
|
|
12
|
+
* const toPositiveNumber = Brand.wrap<"PositiveNumber", number>();
|
|
13
|
+
*
|
|
14
|
+
* const n: PositiveNumber = toPositiveNumber(42);
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
wrap: () => (value) => value,
|
|
18
|
+
/**
|
|
19
|
+
* Strips the brand and returns the underlying value.
|
|
20
|
+
* Since Brand<K, T> extends T this is rarely needed, but can improve readability.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```ts
|
|
24
|
+
* type UserId = Brand<"UserId", string>;
|
|
25
|
+
* const toUserId = Brand.wrap<"UserId", string>();
|
|
26
|
+
* const userId: UserId = toUserId("user-123");
|
|
27
|
+
* const raw: string = Brand.unwrap(userId); // "user-123"
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
unwrap: (branded) => branded
|
|
9
31
|
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
32
|
+
//#endregion
|
|
33
|
+
//#region src/Types/RetryPolicy.ts
|
|
34
|
+
const RetryPolicy = {
|
|
35
|
+
/**
|
|
36
|
+
* Creates a RetryPolicy with a constant delay between retry attempts.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* const policy = RetryPolicy.constant({
|
|
41
|
+
* attempts: 3,
|
|
42
|
+
* delay: Duration.seconds(1),
|
|
43
|
+
* });
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
constant: (options) => ({
|
|
47
|
+
attempts: Math.max(1, options.attempts),
|
|
48
|
+
getDelay: () => options.delay
|
|
49
|
+
}),
|
|
50
|
+
/**
|
|
51
|
+
* Creates a RetryPolicy with exponential backoff delays between attempts.
|
|
52
|
+
* An optional `factor` (default 2) controls the growth rate.
|
|
53
|
+
* An optional `jitter` (default false) adds randomized variance to prevent thundering herd problems.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* const policy = RetryPolicy.exponential({
|
|
58
|
+
* attempts: 5,
|
|
59
|
+
* initial: Duration.milliseconds(100),
|
|
60
|
+
* factor: 2,
|
|
61
|
+
* jitter: true,
|
|
62
|
+
* });
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
exponential: (options) => {
|
|
66
|
+
const attempts = Math.max(1, options.attempts);
|
|
67
|
+
const initialMs = Duration.to.milliseconds(options.initial);
|
|
68
|
+
const factor = options.factor ?? 2;
|
|
69
|
+
const jitter = options.jitter ?? false;
|
|
70
|
+
return {
|
|
71
|
+
attempts,
|
|
72
|
+
getDelay: (attempt) => {
|
|
73
|
+
const rawMs = initialMs * factor ** Math.max(0, attempt - 1);
|
|
74
|
+
const finalMs = jitter ? Math.random() * rawMs : rawMs;
|
|
75
|
+
return Duration.milliseconds(finalMs);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
}
|
|
17
79
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
80
|
+
//#endregion
|
|
81
|
+
//#region src/Types/Duration.ts
|
|
82
|
+
const wrap = Brand.wrap();
|
|
83
|
+
const Duration = {
|
|
84
|
+
/**
|
|
85
|
+
* Creates a Duration from milliseconds.
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```ts
|
|
89
|
+
* Duration.milliseconds(500); // 500ms Duration
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
milliseconds: (ms) => wrap(ms),
|
|
93
|
+
/**
|
|
94
|
+
* Creates a Duration from seconds.
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* ```ts
|
|
98
|
+
* Duration.seconds(2); // 2000ms Duration
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
seconds: (s) => wrap(s * 1e3),
|
|
102
|
+
/**
|
|
103
|
+
* Creates a Duration from minutes.
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```ts
|
|
107
|
+
* Duration.minutes(5); // 300000ms Duration
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
110
|
+
minutes: (m) => wrap(m * 60 * 1e3),
|
|
111
|
+
/**
|
|
112
|
+
* Creates a Duration from hours.
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* ```ts
|
|
116
|
+
* Duration.hours(1); // 3600000ms Duration
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
119
|
+
hours: (h) => wrap(h * 60 * 60 * 1e3),
|
|
120
|
+
/**
|
|
121
|
+
* Creates a Duration from days.
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* ```ts
|
|
125
|
+
* Duration.days(1); // 86400000ms Duration
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
128
|
+
days: (d) => wrap(d * 24 * 60 * 60 * 1e3),
|
|
129
|
+
to: {
|
|
130
|
+
/**
|
|
131
|
+
* Converts a Duration back to raw milliseconds.
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* ```ts
|
|
135
|
+
* Duration.to.milliseconds(Duration.seconds(2)); // 2000
|
|
136
|
+
* ```
|
|
137
|
+
*/
|
|
138
|
+
milliseconds: (d) => Brand.unwrap(d),
|
|
139
|
+
/**
|
|
140
|
+
* Converts a Duration to seconds.
|
|
141
|
+
*
|
|
142
|
+
* @example
|
|
143
|
+
* ```ts
|
|
144
|
+
* Duration.to.seconds(Duration.milliseconds(2500)); // 2.5
|
|
145
|
+
* ```
|
|
146
|
+
*/
|
|
147
|
+
seconds: (d) => Brand.unwrap(d) / 1e3,
|
|
148
|
+
/**
|
|
149
|
+
* Converts a Duration to minutes.
|
|
150
|
+
*
|
|
151
|
+
* @example
|
|
152
|
+
* ```ts
|
|
153
|
+
* Duration.to.minutes(Duration.seconds(120)); // 2
|
|
154
|
+
* ```
|
|
155
|
+
*/
|
|
156
|
+
minutes: (d) => Brand.unwrap(d) / 6e4,
|
|
157
|
+
/**
|
|
158
|
+
* Converts a Duration to hours.
|
|
159
|
+
*
|
|
160
|
+
* @example
|
|
161
|
+
* ```ts
|
|
162
|
+
* Duration.to.hours(Duration.minutes(90)); // 1.5
|
|
163
|
+
* ```
|
|
164
|
+
*/
|
|
165
|
+
hours: (d) => Brand.unwrap(d) / 36e5,
|
|
166
|
+
/**
|
|
167
|
+
* Converts a Duration to days.
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* ```ts
|
|
171
|
+
* Duration.to.days(Duration.hours(36)); // 1.5
|
|
172
|
+
* ```
|
|
173
|
+
*/
|
|
174
|
+
days: (d) => Brand.unwrap(d) / 864e5
|
|
175
|
+
},
|
|
176
|
+
/**
|
|
177
|
+
* Adds two Durations together.
|
|
178
|
+
*
|
|
179
|
+
* @example
|
|
180
|
+
* ```ts
|
|
181
|
+
* pipe(Duration.seconds(1), Duration.add(Duration.milliseconds(500))); // 1500ms
|
|
182
|
+
* ```
|
|
183
|
+
*/
|
|
184
|
+
add: (other) => (self) => wrap(Brand.unwrap(self) + Brand.unwrap(other)),
|
|
185
|
+
/**
|
|
186
|
+
* Subtracts the other Duration from this one.
|
|
187
|
+
*
|
|
188
|
+
* @example
|
|
189
|
+
* ```ts
|
|
190
|
+
* pipe(Duration.seconds(1), Duration.subtract(Duration.milliseconds(500))); // 500ms
|
|
191
|
+
* ```
|
|
192
|
+
*/
|
|
193
|
+
subtract: (other) => (self) => wrap(Brand.unwrap(self) - Brand.unwrap(other))
|
|
58
194
|
};
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Creates a Duration from milliseconds.
|
|
65
|
-
*
|
|
66
|
-
* @example
|
|
67
|
-
* ```ts
|
|
68
|
-
* Duration.milliseconds(500); // 500ms Duration
|
|
69
|
-
* ```
|
|
70
|
-
*/
|
|
71
|
-
milliseconds: (ms) => wrap(ms),
|
|
72
|
-
/**
|
|
73
|
-
* Creates a Duration from seconds.
|
|
74
|
-
*
|
|
75
|
-
* @example
|
|
76
|
-
* ```ts
|
|
77
|
-
* Duration.seconds(2); // 2000ms Duration
|
|
78
|
-
* ```
|
|
79
|
-
*/
|
|
80
|
-
seconds: (s) => wrap(s * 1e3),
|
|
81
|
-
/**
|
|
82
|
-
* Creates a Duration from minutes.
|
|
83
|
-
*
|
|
84
|
-
* @example
|
|
85
|
-
* ```ts
|
|
86
|
-
* Duration.minutes(5); // 300000ms Duration
|
|
87
|
-
* ```
|
|
88
|
-
*/
|
|
89
|
-
minutes: (m) => wrap(m * 60 * 1e3),
|
|
90
|
-
/**
|
|
91
|
-
* Creates a Duration from hours.
|
|
92
|
-
*
|
|
93
|
-
* @example
|
|
94
|
-
* ```ts
|
|
95
|
-
* Duration.hours(1); // 3600000ms Duration
|
|
96
|
-
* ```
|
|
97
|
-
*/
|
|
98
|
-
hours: (h) => wrap(h * 60 * 60 * 1e3),
|
|
99
|
-
/**
|
|
100
|
-
* Creates a Duration from days.
|
|
101
|
-
*
|
|
102
|
-
* @example
|
|
103
|
-
* ```ts
|
|
104
|
-
* Duration.days(1); // 86400000ms Duration
|
|
105
|
-
* ```
|
|
106
|
-
*/
|
|
107
|
-
days: (d) => wrap(d * 24 * 60 * 60 * 1e3),
|
|
108
|
-
// --- to ---
|
|
109
|
-
to: {
|
|
110
|
-
/**
|
|
111
|
-
* Converts a Duration back to raw milliseconds.
|
|
112
|
-
*
|
|
113
|
-
* @example
|
|
114
|
-
* ```ts
|
|
115
|
-
* Duration.to.milliseconds(Duration.seconds(2)); // 2000
|
|
116
|
-
* ```
|
|
117
|
-
*/
|
|
118
|
-
milliseconds: (d) => Brand.unwrap(d),
|
|
119
|
-
/**
|
|
120
|
-
* Converts a Duration to seconds.
|
|
121
|
-
*
|
|
122
|
-
* @example
|
|
123
|
-
* ```ts
|
|
124
|
-
* Duration.to.seconds(Duration.milliseconds(2500)); // 2.5
|
|
125
|
-
* ```
|
|
126
|
-
*/
|
|
127
|
-
seconds: (d) => Brand.unwrap(d) / 1e3,
|
|
128
|
-
/**
|
|
129
|
-
* Converts a Duration to minutes.
|
|
130
|
-
*
|
|
131
|
-
* @example
|
|
132
|
-
* ```ts
|
|
133
|
-
* Duration.to.minutes(Duration.seconds(120)); // 2
|
|
134
|
-
* ```
|
|
135
|
-
*/
|
|
136
|
-
minutes: (d) => Brand.unwrap(d) / (60 * 1e3),
|
|
137
|
-
/**
|
|
138
|
-
* Converts a Duration to hours.
|
|
139
|
-
*
|
|
140
|
-
* @example
|
|
141
|
-
* ```ts
|
|
142
|
-
* Duration.to.hours(Duration.minutes(90)); // 1.5
|
|
143
|
-
* ```
|
|
144
|
-
*/
|
|
145
|
-
hours: (d) => Brand.unwrap(d) / (60 * 60 * 1e3),
|
|
146
|
-
/**
|
|
147
|
-
* Converts a Duration to days.
|
|
148
|
-
*
|
|
149
|
-
* @example
|
|
150
|
-
* ```ts
|
|
151
|
-
* Duration.to.days(Duration.hours(36)); // 1.5
|
|
152
|
-
* ```
|
|
153
|
-
*/
|
|
154
|
-
days: (d) => Brand.unwrap(d) / (24 * 60 * 60 * 1e3)
|
|
155
|
-
},
|
|
156
|
-
/**
|
|
157
|
-
* Adds two Durations together.
|
|
158
|
-
*
|
|
159
|
-
* @example
|
|
160
|
-
* ```ts
|
|
161
|
-
* pipe(Duration.seconds(1), Duration.add(Duration.milliseconds(500))); // 1500ms
|
|
162
|
-
* ```
|
|
163
|
-
*/
|
|
164
|
-
add: (other) => (self) => wrap(Brand.unwrap(self) + Brand.unwrap(other)),
|
|
165
|
-
/**
|
|
166
|
-
* Subtracts the other Duration from this one.
|
|
167
|
-
*
|
|
168
|
-
* @example
|
|
169
|
-
* ```ts
|
|
170
|
-
* pipe(Duration.seconds(1), Duration.subtract(Duration.milliseconds(500))); // 500ms
|
|
171
|
-
* ```
|
|
172
|
-
*/
|
|
173
|
-
subtract: (other) => (self) => wrap(Brand.unwrap(self) - Brand.unwrap(other))
|
|
174
|
-
};
|
|
175
|
-
|
|
176
|
-
// src/Types/RetryPolicy.ts
|
|
177
|
-
var RetryPolicy = {
|
|
178
|
-
/**
|
|
179
|
-
* Creates a RetryPolicy with a constant delay between retry attempts.
|
|
180
|
-
*
|
|
181
|
-
* @example
|
|
182
|
-
* ```ts
|
|
183
|
-
* const policy = RetryPolicy.constant({
|
|
184
|
-
* attempts: 3,
|
|
185
|
-
* delay: Duration.seconds(1),
|
|
186
|
-
* });
|
|
187
|
-
* ```
|
|
188
|
-
*/
|
|
189
|
-
constant: (options) => ({
|
|
190
|
-
attempts: Math.max(1, options.attempts),
|
|
191
|
-
getDelay: () => options.delay
|
|
192
|
-
}),
|
|
193
|
-
/**
|
|
194
|
-
* Creates a RetryPolicy with exponential backoff delays between attempts.
|
|
195
|
-
* An optional `factor` (default 2) controls the growth rate.
|
|
196
|
-
* An optional `jitter` (default false) adds randomized variance to prevent thundering herd problems.
|
|
197
|
-
*
|
|
198
|
-
* @example
|
|
199
|
-
* ```ts
|
|
200
|
-
* const policy = RetryPolicy.exponential({
|
|
201
|
-
* attempts: 5,
|
|
202
|
-
* initial: Duration.milliseconds(100),
|
|
203
|
-
* factor: 2,
|
|
204
|
-
* jitter: true,
|
|
205
|
-
* });
|
|
206
|
-
* ```
|
|
207
|
-
*/
|
|
208
|
-
exponential: (options) => {
|
|
209
|
-
const attempts = Math.max(1, options.attempts);
|
|
210
|
-
const initialMs = Duration.to.milliseconds(options.initial);
|
|
211
|
-
const factor = options.factor ?? 2;
|
|
212
|
-
const jitter = options.jitter ?? false;
|
|
213
|
-
return {
|
|
214
|
-
attempts,
|
|
215
|
-
getDelay: (attempt) => {
|
|
216
|
-
const rawMs = initialMs * factor ** Math.max(0, attempt - 1);
|
|
217
|
-
const finalMs = jitter ? Math.random() * rawMs : rawMs;
|
|
218
|
-
return Duration.milliseconds(finalMs);
|
|
219
|
-
}
|
|
220
|
-
};
|
|
221
|
-
}
|
|
222
|
-
};
|
|
223
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
224
|
-
0 && (module.exports = {
|
|
225
|
-
Brand,
|
|
226
|
-
Duration,
|
|
227
|
-
RetryPolicy
|
|
228
|
-
});
|
|
195
|
+
//#endregion
|
|
196
|
+
exports.Brand = Brand;
|
|
197
|
+
exports.Duration = Duration;
|
|
198
|
+
exports.RetryPolicy = RetryPolicy;
|
package/dist/types.d.cts
CHANGED
|
@@ -1,58 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* An immutable policy describing retry limits and backoff delay strategies.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```ts
|
|
9
|
-
* const policy: RetryPolicy = RetryPolicy.constant({
|
|
10
|
-
* attempts: 3,
|
|
11
|
-
* delay: Duration.seconds(1),
|
|
12
|
-
* });
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
type RetryPolicy = {
|
|
16
|
-
readonly attempts: number;
|
|
17
|
-
readonly getDelay: (attempt: number) => Duration;
|
|
18
|
-
};
|
|
19
|
-
declare const RetryPolicy: {
|
|
20
|
-
/**
|
|
21
|
-
* Creates a RetryPolicy with a constant delay between retry attempts.
|
|
22
|
-
*
|
|
23
|
-
* @example
|
|
24
|
-
* ```ts
|
|
25
|
-
* const policy = RetryPolicy.constant({
|
|
26
|
-
* attempts: 3,
|
|
27
|
-
* delay: Duration.seconds(1),
|
|
28
|
-
* });
|
|
29
|
-
* ```
|
|
30
|
-
*/
|
|
31
|
-
constant: (options: {
|
|
32
|
-
attempts: number;
|
|
33
|
-
delay: Duration;
|
|
34
|
-
}) => RetryPolicy;
|
|
35
|
-
/**
|
|
36
|
-
* Creates a RetryPolicy with exponential backoff delays between attempts.
|
|
37
|
-
* An optional `factor` (default 2) controls the growth rate.
|
|
38
|
-
* An optional `jitter` (default false) adds randomized variance to prevent thundering herd problems.
|
|
39
|
-
*
|
|
40
|
-
* @example
|
|
41
|
-
* ```ts
|
|
42
|
-
* const policy = RetryPolicy.exponential({
|
|
43
|
-
* attempts: 5,
|
|
44
|
-
* initial: Duration.milliseconds(100),
|
|
45
|
-
* factor: 2,
|
|
46
|
-
* jitter: true,
|
|
47
|
-
* });
|
|
48
|
-
* ```
|
|
49
|
-
*/
|
|
50
|
-
exponential: (options: {
|
|
51
|
-
attempts: number;
|
|
52
|
-
initial: Duration;
|
|
53
|
-
factor?: number;
|
|
54
|
-
jitter?: boolean;
|
|
55
|
-
}) => RetryPolicy;
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export { Duration, RetryPolicy };
|
|
1
|
+
import { n as Duration, r as Brand, t as RetryPolicy } from "./index-Bs8En5LJ.cjs";
|
|
2
|
+
export { Brand, Duration, RetryPolicy };
|
package/dist/types.d.ts
CHANGED
|
@@ -1,58 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* An immutable policy describing retry limits and backoff delay strategies.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```ts
|
|
9
|
-
* const policy: RetryPolicy = RetryPolicy.constant({
|
|
10
|
-
* attempts: 3,
|
|
11
|
-
* delay: Duration.seconds(1),
|
|
12
|
-
* });
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
type RetryPolicy = {
|
|
16
|
-
readonly attempts: number;
|
|
17
|
-
readonly getDelay: (attempt: number) => Duration;
|
|
18
|
-
};
|
|
19
|
-
declare const RetryPolicy: {
|
|
20
|
-
/**
|
|
21
|
-
* Creates a RetryPolicy with a constant delay between retry attempts.
|
|
22
|
-
*
|
|
23
|
-
* @example
|
|
24
|
-
* ```ts
|
|
25
|
-
* const policy = RetryPolicy.constant({
|
|
26
|
-
* attempts: 3,
|
|
27
|
-
* delay: Duration.seconds(1),
|
|
28
|
-
* });
|
|
29
|
-
* ```
|
|
30
|
-
*/
|
|
31
|
-
constant: (options: {
|
|
32
|
-
attempts: number;
|
|
33
|
-
delay: Duration;
|
|
34
|
-
}) => RetryPolicy;
|
|
35
|
-
/**
|
|
36
|
-
* Creates a RetryPolicy with exponential backoff delays between attempts.
|
|
37
|
-
* An optional `factor` (default 2) controls the growth rate.
|
|
38
|
-
* An optional `jitter` (default false) adds randomized variance to prevent thundering herd problems.
|
|
39
|
-
*
|
|
40
|
-
* @example
|
|
41
|
-
* ```ts
|
|
42
|
-
* const policy = RetryPolicy.exponential({
|
|
43
|
-
* attempts: 5,
|
|
44
|
-
* initial: Duration.milliseconds(100),
|
|
45
|
-
* factor: 2,
|
|
46
|
-
* jitter: true,
|
|
47
|
-
* });
|
|
48
|
-
* ```
|
|
49
|
-
*/
|
|
50
|
-
exponential: (options: {
|
|
51
|
-
attempts: number;
|
|
52
|
-
initial: Duration;
|
|
53
|
-
factor?: number;
|
|
54
|
-
jitter?: boolean;
|
|
55
|
-
}) => RetryPolicy;
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export { Duration, RetryPolicy };
|
|
1
|
+
import { n as Duration, r as Brand, t as RetryPolicy } from "./index-Bs8En5LJ.js";
|
|
2
|
+
export { Brand, Duration, RetryPolicy };
|