@handy-common-utils/promise-utils 1.4.1 → 1.6.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.
@@ -32,8 +32,8 @@ export declare enum PromiseState {
32
32
  }
33
33
  export declare abstract class PromiseUtils {
34
34
  /**
35
- * Do an operation repeatedly and collect all the results.
36
- * This function is useful for client side pagination.
35
+ * Executes an operation repeatedly and collects all the results.
36
+ * This function is very useful for many scenarios, such like client-side pagination.
37
37
  *
38
38
  * @example
39
39
  * const domainNameObjects = await PromiseUtils.repeat(
@@ -43,59 +43,84 @@ export declare abstract class PromiseUtils {
43
43
  * [] as APIGateway.DomainName[],
44
44
  * );
45
45
  *
46
- * @template Result type of the operation result
47
- * @template Param type of the input to the operation, normally the input is a paging parameter
48
- * @template Collection type of the returned value of this function
46
+ * @template Result The type of the operation result.
47
+ * @template Param The type of the input to the operation, typically a paging parameter.
48
+ * @template Collection The type of the collection returned by this function.
49
49
  *
50
- * @param operation a function that takes paging parameter as input and outputs a result, normally the operation supports paging
51
- * @param nextParameter The function for calculating next parameter from the operation result.
52
- * Normally the parameter controls paging,
53
- * This function should return null when next invocation of the operation function is not desired.
54
- * If next invocation is desired, the return value of this function can be a Promise or not a Promise.
55
- * @param collect the function for merging operation result into the collection
56
- * @param initialCollection initial collection which would be the first argument passed into the first invocation of the collect function
57
- * @param initialParameter the parameter for the first operation
58
- * @returns Promise of collection of all the results returned by the operation function
50
+ * @param operation A function that takes a parameter as input and returns a result. Typically, the parameter has optional fields to control paging.
51
+ * @param nextParameter A function for calculating the next parameter from the operation result.
52
+ * Normally, this parameter controls paging.
53
+ * This function should return null when no further invocation of the operation function is desired.
54
+ * If further invocation is desired, the return value of this function can be a Promise or a non-Promise value.
55
+ * @param collect A function for merging the operation result into the collection.
56
+ * @param initialCollection The initial collection, which will be the first argument passed to the first invocation of the collect function.
57
+ * @param initialParameter The parameter for the first operation.
58
+ * @returns A promise that resolves to a collection of all the results returned by the operation function.
59
59
  *
60
60
  */
61
61
  static repeat<Result, Param, Collection>(operation: (parameter: Partial<Param>) => Promise<Result>, nextParameter: (response: Result) => Partial<Param> | Promise<Partial<Param>> | null, collect: (collection: Collection, result: Result) => Collection, initialCollection: Collection, initialParameter?: Partial<Param>): Promise<Collection>;
62
62
  /**
63
- * Do an operation repeatedly until a criteria is met.
63
+ * Repeatedly performs an operation until a specified criteria is met.
64
64
  *
65
65
  * @example
66
66
  * const result = await PromiseUtils.withRetry(() => doSomething(), [100, 200, 300, 500, 800, 1000]);
67
67
  * const result2 = await PromiseUtils.withRetry(() => doSomething(), Array.from({length: 10}, (_v, i) => 1000 * Math.min(FIBONACCI_SEQUENCE[i], 10), err => err.statusCode === 429);
68
68
  * const result3 = await PromiseUtils.withRetry(() => doSomething(), attempt => attempt <= 8 ? 1000 * Math.min(FIBONACCI_SEQUENCE[attempt - 1], 10) : undefined, err => err.statusCode === 429);
69
69
  *
70
- * @template Result type of the operation result
71
- * @template TError type of the possible error that could be generated by the operation
72
- *
73
- * @param operation a function that outputs a Promise result, normally the operation does not use its arguments
74
- * @param backoff Array of retry backoff periods (unit: milliseconds) or function for calculating them.
75
- * If retry is desired, before making next call to the operation the desired backoff period would be waited.
76
- * If the array runs out of elements or the function returns `undefined` or either the array or the function returns a negative number,
77
- * there would be no further call to the operation.
78
- * The `attempt` argument passed into backoff function starts from 1 because the function is called right after the first attempt and before the first retry.
79
- * @param shouldRetry Predicate function for deciding whether another call to the operation should happen.
80
- * If this argument is not defined, retry would happen whenever the operation rejects with an error.
81
- * `shouldRetry` would be evaluated before `backoff`.
82
- * The `attempt` argument passed into shouldRetry function starts from 1.
83
- * @returns Promise of the operation result potentially with retries already applied
70
+ * @template Result Type of the operation result.
71
+ * @template TError Type of the possible error that could be generated by the operation.
72
+ *
73
+ * @param operation A function that outputs a Promise result. Typically, the operation does not use its arguments.
74
+ * @param backoff An array of retry backoff periods (in milliseconds) or a function for calculating them.
75
+ * If retry is desired, the specified backoff period is waited before the next call to the operation.
76
+ * If the array runs out of elements or the function returns `undefined` or a negative number, no further calls to the operation will be made.
77
+ * The `attempt` argument passed to the backoff function starts from 1, as it is called immediately after the first attempt and before the first retry.
78
+ * @param shouldRetry A predicate function for deciding whether another call to the operation should occur.
79
+ * If this argument is not defined, a retry will occur whenever the operation rejects with an error.
80
+ * The `shouldRetry` function is evaluated before the `backoff`.
81
+ * The `attempt` argument passed to the shouldRetry function starts from 1.
82
+ * @returns A promise of the operation result, potentially with retries applied.
84
83
  */
85
84
  static withRetry<Result, TError = any>(operation: (attempt: number, previousResult: Result | undefined, previousError: TError | undefined) => Promise<Result>, backoff: Array<number> | ((attempt: number, previousResult: Result | undefined, previousError: TError | undefined) => number | undefined), shouldRetry?: (previousError: TError | undefined, previousResult: Result | undefined, attempt: number) => boolean): Promise<Result>;
86
85
  /**
87
- * Run multiple jobs/operations in parallel.
86
+ * Executes multiple jobs/operations with a specified level of concurrency.
87
+ *
88
+ * Unlike `inParallel(...)`, this function may throw or reject an error when a job/operation fails.
89
+ * When an error is re-thrown, remaining operations will not be executed.
90
+ * If you want all the operations to always be executed, use {@link PromiseUtils.inParallel} instead.
91
+ *
92
+ * @example
93
+ * // At any time, there would be no more than 5 concurrency API calls. Error would be re-thrown immediately when it occurs.
94
+ * const attributes = await PromiseUtils.withConcurrency(5, topicArns, async (topicArn) => {
95
+ * const topicAttributes = (await sns.getTopicAttributes({ TopicArn: topicArn }).promise()).Attributes!;
96
+ * return topicAttributes;
97
+ * });
98
+ *
88
99
  *
89
- * By default this function does not throw / reject with error when any of the job/operation fails.
90
- * Operation errors are returned together with operation results in the same returned array.
91
- * That also means this function only returns when all the jobs/operations settle (either resolve or reject).
100
+ * @template Data The type of the job data, typically an Array.
101
+ * @template Result The type of the return value from the operation function.
92
102
  *
93
- * However, if options.abortOnError is true, this function throws / rejects with error when any of the job/operation fails.
94
- * That also means, some of the jobs/operations may not get the chance to be executed if one of them fails.
103
+ * @param concurrency The number of jobs/operations to run concurrently.
104
+ * @param jobs The job data to be processed. This function can handle an infinite or unknown number of elements safely.
105
+ * @param operation The function that processes job data asynchronously.
106
+ * @returns A promise that resolves to an array containing the results from the operation function.
107
+ * The results in the returned array are in the same order as the corresponding elements in the jobs array.
108
+ */
109
+ static withConcurrency<Data, Result>(concurrency: number, jobs: Iterable<Data>, operation: (job: Data, index: number) => Promise<Result>): Promise<Array<Result>>;
110
+ /**
111
+ * Executes multiple jobs/operations in parallel. By default, all operations are executed regardless of any failures.
112
+ * In most cases, using {@link PromiseUtils.withConcurrency} might be more convenient.
113
+ *
114
+ * By default, this function does not throw or reject an error when any job/operation fails.
115
+ * Errors from operations are returned alongside results in the returned array.
116
+ * This function only resolves when all jobs/operations are settled (either resolved or rejected).
117
+ *
118
+ * If `options.abortOnError` is set to true, this function throws (or rejects with) an error immediately when any job/operation fails.
119
+ * In this mode, some jobs/operations may not be executed if one fails.
95
120
  *
96
121
  * @example
97
122
  * // Capture errors in the returned array
98
- * const attributesAndPossibleErrors = await PromiseUtils.inParallel(5, topicArns, async (topicArn) => {
123
+ * const attributesAndPossibleErrors: Array<JobResult|JobError> = await PromiseUtils.inParallel(5, topicArns, async (topicArn) => {
99
124
  * const topicAttributes = (await sns.getTopicAttributes({ TopicArn: topicArn }).promise()).Attributes!;
100
125
  * return topicAttributes;
101
126
  * });
@@ -108,88 +133,95 @@ export declare abstract class PromiseUtils {
108
133
  * // handle the error
109
134
  * }
110
135
  *
111
- * @template Data Type of the job data, usually it would be an Array
112
- * @template Result Type of the return value of the operation function
113
- *
114
- * @param parallelism how many jobs/operations can be running at the same time
115
- * @param jobs job data which will be the input to operation function.
116
- * This function is safe when there are infinite unknown number of elements in the job data.
117
- * @param operation the function that turns job data into result asynchronously
118
- * @param options Options for controlling the behavior of this function.
119
- * @returns Promise of void if the operation function does not return a value,
120
- * or promise of an array containing outcomes from the operation function.
121
- * In the returned array containing outcomes, each element is either the fulfilled result, or the rejected error/reason.
136
+ * @template Data The type of the job data, typically an Array.
137
+ * @template Result The type of the return value from the operation function.
138
+ * @template TError The type for the error that could be thrown from the operation function, defaults to `Result`.
139
+ *
140
+ * @param parallelism The number of jobs/operations to run concurrently.
141
+ * @param jobs The job data to be processed. This function can safely handle an infinite or unknown number of elements.
142
+ * @param operation The function that processes job data asynchronously.
143
+ * @param options Options to control the function's behavior.
144
+ * @param options.abortOnError If true, the function aborts and throws an error on the first failed operation.
145
+ * @returns A promise that resolves to an array containing the results of the operations.
146
+ * Each element is either a fulfilled result or a rejected error/reason.
147
+ * The results or errors in the returned array are in the same order as the corresponding elements in the jobs array.
122
148
  */
123
149
  static inParallel<Data, Result, TError = Result>(parallelism: number, jobs: Iterable<Data>, operation: (job: Data, index: number) => Promise<Result>, options?: {
124
150
  abortOnError: boolean;
125
151
  }): Promise<Array<Result | TError>>;
126
152
  /**
127
- * Create a Promise that resolves after number of milliseconds specified
128
- * @param ms number of milliseconds after which the created Promise would resolve
129
- * @param result the result to be resolved for the Promise, or a function that supplies the result.
130
- * @returns the new Promise created
153
+ * Creates a Promise that resolves after a specified number of milliseconds.
154
+ *
155
+ * @param ms The number of milliseconds after which the created Promise will resolve.
156
+ * @param result The result to be resolved by the Promise, or a function that supplies the result.
157
+ * @returns A new Promise that resolves with the specified result after the specified delay.
131
158
  */
132
159
  static delayedResolve<T>(ms: number, result?: T | PromiseLike<T> | (() => (T | PromiseLike<T>))): Promise<T>;
133
160
  /**
134
- * Create a Promise that rejects after number of milliseconds specified.
135
- * @param ms number of milliseconds after which the created Promise would reject
136
- * @param reason the reason of the rejection for the Promise, or a function that supplies the reason.
137
- * If the reason ends up to be a rejected Promise, then the outcome (could be fulfilled or rejected) of it will be the reject reason of the Promise returned.
138
- * @returns the new Promise created
161
+ * Creates a Promise that rejects after a specified number of milliseconds.
162
+ *
163
+ * @param ms The number of milliseconds after which the created Promise will reject.
164
+ * @param reason The reason for the rejection, or a function that supplies the reason.
165
+ * If the reason is a rejected Promise, the outcome of it will be the rejection reason of the returned Promise.
166
+ * @returns A new Promise that rejects with the specified reason after the specified delay.
139
167
  */
140
168
  static delayedReject<T = never, R = any>(ms: number, reason: R | PromiseLike<R> | (() => R | PromiseLike<R>)): Promise<T>;
141
169
  /**
142
170
  * Applies a timeout to a Promise or a function that returns a Promise.
143
- * If the timeout occurs, resolves to the specified result.
144
- * If the timeout doesn't occur, the resolved result or rejection reason of the original Promise will be the outcome of the Promise returned from this function.
145
- * If the 'result' parameter is a function and timeout doesn't occur, the function won't be called.
146
- * The rejection of the 'operation' parameter is not handled by this function, you may want to handle it outside of this function to avoid warnings like "(node:4330) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously".
171
+ * If the timeout occurs, the returned Promise resolves to the specified result.
172
+ * If the timeout does not occur, the returned Promise resolves or rejects based on the outcome of the original Promise.
173
+ * If the `result` parameter is a function and the timeout does not occur, the function will not be called.
174
+ * Note: The rejection of the `operation` parameter is not handled by this function.
175
+ * You may want to handle it outside this function to avoid warnings like "(node:4330) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously."
147
176
  *
148
- * @param operation The original Promise or a function that returns a Promise for which the timeout will be applied.
177
+ * @param operation The original Promise or a function that returns a Promise to which the timeout will be applied.
149
178
  * @param ms The number of milliseconds for the timeout.
150
- * @param result The result to be resolved with if the timeout occurs, or a function that supplies the result.
151
- * @return A new Promise that resolves to the specified result if the timeout occurs.
179
+ * @param result The result to resolve with if the timeout occurs, or a function that supplies the result.
180
+ * @returns A new Promise that resolves to the specified result if the timeout occurs.
152
181
  */
153
182
  static timeoutResolve<T>(operation: Promise<T> | (() => Promise<T>), ms: number, result?: T | PromiseLike<T> | (() => (T | PromiseLike<T>)) | undefined): Promise<T>;
154
183
  /**
155
184
  * Applies a timeout to a Promise or a function that returns a Promise.
156
- * If the timeout occurs, rejects with the specified reason.
157
- * If the timeout doesn't occur, the resolved result or rejection reason of the original Promise will be the outcome of the Promise returned from this function.
158
- * If the 'reason' parameter is a function and timeout doesn't occur, the function won't be called.
159
- * The rejection of the 'operation' parameter is not handled by this function, you may want to handle it outside of this function to avoid warnings like "(node:4330) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously".
185
+ * If the timeout occurs, the returned Promise rejects with the specified reason.
186
+ * If the timeout does not occur, the returned Promise resolves or rejects based on the outcome of the original Promise.
187
+ * If the `rejectReason` parameter is a function and the timeout does not occur, the function will not be called.
188
+ * Note: The rejection of the `operation` parameter is not handled by this function. You may want to handle it outside this function to avoid warnings like "(node:4330) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously."
160
189
  *
161
- * @param operation The original Promise or a function that returns a Promise for which the timeout will be applied.
190
+ * @param operation The original Promise or a function that returns a Promise to which the timeout will be applied.
162
191
  * @param ms The number of milliseconds for the timeout.
163
192
  * @param rejectReason The reason to reject with if the timeout occurs, or a function that supplies the reason.
164
- * @return A new Promise that rejects with the specified reason if the timeout occurs.
193
+ * @returns A new Promise that rejects with the specified reason if the timeout occurs.
165
194
  */
166
195
  static timeoutReject<T = never, R = any>(operation: Promise<T> | (() => Promise<T>), ms: number, rejectReason: R | PromiseLike<R> | (() => R | PromiseLike<R>)): Promise<T>;
167
196
  /**
168
- * Get the state of the Promise.
169
- * Please note that the returned value is a Promise, although it resolves immediately.
170
- * @param p the Promise for which we would like to know its state
171
- * @return A Promise that resolves immediately containing the state of the input Promise
197
+ * Retrieves the state of the specified Promise.
198
+ * Note: The returned value is a Promise that resolves immediately.
199
+ *
200
+ * @param p The Promise whose state is to be determined.
201
+ * @returns A Promise that resolves immediately with the state of the input Promise.
172
202
  */
173
203
  static promiseState(p: Promise<any>): Promise<PromiseState>;
174
204
  private static synchronizationLocks;
175
205
  /**
176
- * Equivalent of `synchronized` in Java.
177
- * In any situation there's no concurrent execution of any operation function associated with the same lock.
178
- * The operation function has access to the state (when `synchronized` is called), settledState (when the operation function is called),
179
- * and result (could be the fulfilled result or the rejected reason) of the previous operation.
180
- * In case there is no previous invocation, state, settledState and result would all be undefined.
181
- * @param lock the object (could be a string, a number, or `this` in a class) that is used to apply the lock
182
- * @param operation function for doing the computation and returning a Promise
183
- * @returns the result of the operation function
206
+ * Provides mutual exclusion similar to `synchronized` in Java.
207
+ * Ensures no concurrent execution of any operation function associated with the same lock.
208
+ * The operation function has access to the state (when `synchronized` is called),
209
+ * settledState (when the operation function is called),
210
+ * and result (either the fulfilled result or the rejected reason) of the previous operation.
211
+ * If there is no previous invocation, state, settledState, and result will all be undefined.
212
+ *
213
+ * @param lock The object (such as a string, a number, or `this` in a class) used to identify the lock.
214
+ * @param operation The function that performs the computation and returns a Promise.
215
+ * @returns The result of the operation function.
184
216
  */
185
- static synchronized<T>(lock: unknown, operation: (previousState: PromiseState | undefined, previousSettledState: PromiseState | undefined, previousResult: any) => Promise<T>): Promise<T>;
217
+ static synchronized<T>(lock: any, operation: (previousState: PromiseState | undefined, previousSettledState: PromiseState | undefined, previousResult: any) => Promise<T>): Promise<T>;
186
218
  /**
187
219
  * This is just another spelling of {@link PromiseUtils.synchronized}.
188
- * @param lock the object (could be a string, a number, or `this` in a class) that is used to apply the lock
189
- * @param operation function for doing the computation and returning a Promise
190
- * @returns the result of the operation function
220
+ * @param lock The object (such as a string, a number, or `this` in a class) used to identify the lock.
221
+ * @param operation The function that performs the computation and returns a Promise.
222
+ * @returns The result of the operation function.
191
223
  */
192
- static synchronised<T>(lock: unknown, operation: (previousState: PromiseState | undefined, previousSettledState: PromiseState | undefined, previousResult: any) => Promise<T>): Promise<T>;
224
+ static synchronised<T>(lock: any, operation: (previousState: PromiseState | undefined, previousSettledState: PromiseState | undefined, previousResult: any) => Promise<T>): Promise<T>;
193
225
  }
194
226
  /**
195
227
  * See {@link PromiseUtils.repeat} for full documentation.
@@ -199,6 +231,10 @@ export declare const repeat: typeof PromiseUtils.repeat;
199
231
  * See {@link PromiseUtils.withRetry} for full documentation.
200
232
  */
201
233
  export declare const withRetry: typeof PromiseUtils.withRetry;
234
+ /**
235
+ * See {@link PromiseUtils.withConcurrency} for full documentation.
236
+ */
237
+ export declare const withConcurrency: typeof PromiseUtils.withConcurrency;
202
238
  /**
203
239
  * See {@link PromiseUtils.inParallel} for full documentation.
204
240
  */
@@ -1 +1 @@
1
- {"version":3,"file":"promise-utils.d.ts","sourceRoot":"","sources":["../src/promise-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,kBAAkB,UAAkJ,CAAC;AAElL;;;;;;;;;;GAUG;AACH,eAAO,MAAM,oBAAoB,UAA6K,CAAC;AAE/M;;GAEG;AACH,oBAAY,YAAY;IACtB,OAAO,YAAY;IACnB,SAAS,cAAc;IACvB,QAAQ,aAAa;CACtB;AAED,8BAAsB,YAAY;IAChC;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;WACU,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,UAAU,EAC3C,SAAS,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC,KAAK,CAAC,KAAK,OAAO,CAAC,MAAM,CAAC,EACzD,aAAa,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,EACpF,OAAO,EAAE,CAAC,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,KAAK,UAAU,EAC/D,iBAAiB,EAAE,UAAU,EAC7B,gBAAgB,GAAE,OAAO,CAAC,KAAK,CAAM,GACpC,OAAO,CAAC,UAAU,CAAC;IAetB;;;;;;;;;;;;;;;;;;;;;;OAsBG;WACU,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG,EACzC,SAAS,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAC,SAAS,EAAE,aAAa,EAAE,MAAM,GAAC,SAAS,KAAK,OAAO,CAAC,MAAM,CAAC,EAClH,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAC,SAAS,EAAE,a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