@shutterstock/p-map-iterable 1.0.10 → 1.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.
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.IterableMapper = void 0;
4
- const tslib_1 = require("tslib");
5
4
  //
6
5
  // 2021-08-25 - Initially based on: https://raw.githubusercontent.com/sindresorhus/p-map/main/index.js
7
6
  //
8
- const aggregate_error_1 = tslib_1.__importDefault(require("aggregate-error"));
7
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
8
+ const AggregateError = require('aggregate-error');
9
9
  const iterable_queue_1 = require("./iterable-queue");
10
10
  /**
11
11
  * Iterates over a source iterable with specified concurrency,
@@ -98,21 +98,21 @@ class IterableMapper {
98
98
  // promise. We need this so we can await the next() calls
99
99
  // to stop creating runners before hitting the concurrency limit
100
100
  // if the iterable has already been marked as done.
101
- void (() => tslib_1.__awaiter(this, void 0, void 0, function* () {
101
+ void (async () => {
102
102
  for (let index = 0; index < concurrency; index++) {
103
103
  // Setup the detached runner
104
104
  this._activeRunners++;
105
105
  // This only waits for the next source item to be iterated
106
106
  // It does NOT wait for the mapper to be called for for a consumer to pickup
107
107
  // the result out of the unread queue.
108
- yield this.sourceNext();
108
+ await this.sourceNext();
109
109
  if (this._isIterableDone || this._isRejected) {
110
110
  break;
111
111
  }
112
112
  }
113
113
  // Signal that the next() function should now create runners if it sees too few of them
114
114
  this._initialRunnersCreated = true;
115
- }))();
115
+ })();
116
116
  }
117
117
  [Symbol.asyncIterator]() {
118
118
  return this;
@@ -123,33 +123,31 @@ class IterableMapper {
123
123
  *
124
124
  * @returns Iterator result
125
125
  */
126
- next() {
127
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
128
- // Bail out and release all waiters if there are no more items coming
129
- const done = this.areWeDone();
130
- if (done) {
131
- if (!this._options.stopOnMapperError && this._errors.length > 0) {
132
- // throw the errors as an aggregate exception
133
- this._isRejected = true;
134
- throw new aggregate_error_1.default(this._errors);
135
- }
136
- return { value: undefined, done };
137
- }
138
- // Check if queue has an item
139
- const item = yield this._unreadQueue.dequeue();
140
- if (item === undefined) {
141
- // We finished - There were no more items
142
- this.bubbleUpErrors();
143
- return { value: undefined, done: true };
126
+ async next() {
127
+ // Bail out and release all waiters if there are no more items coming
128
+ const done = this.areWeDone();
129
+ if (done) {
130
+ if (!this._options.stopOnMapperError && this._errors.length > 0) {
131
+ // throw the errors as an aggregate exception
132
+ this._isRejected = true;
133
+ throw new AggregateError(this._errors);
144
134
  }
145
- this.startARunnerIfNeeded();
146
- return { value: this.throwIfError(item), done: false };
147
- });
135
+ return { value: undefined, done };
136
+ }
137
+ // Check if queue has an item
138
+ const item = await this._unreadQueue.dequeue();
139
+ if (item === undefined) {
140
+ // We finished - There were no more items
141
+ this.bubbleUpErrors();
142
+ return { value: undefined, done: true };
143
+ }
144
+ this.startARunnerIfNeeded();
145
+ return { value: this.throwIfError(item), done: false };
148
146
  }
149
147
  bubbleUpErrors() {
150
148
  if (!this._options.stopOnMapperError && this._errors.length > 0) {
151
149
  // throw the errors as an aggregate exception
152
- throw new aggregate_error_1.default(this._errors);
150
+ throw new AggregateError(this._errors);
153
151
  }
154
152
  }
155
153
  startARunnerIfNeeded() {
@@ -235,104 +233,102 @@ class IterableMapper {
235
233
  * If the read queue + runners = max read queue length then the runner
236
234
  * will exit and will be restarted when an item is read from the queue.
237
235
  */
238
- sourceNext() {
239
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
240
- if (this._isRejected) {
241
- this._activeRunners--;
242
- return;
236
+ async sourceNext() {
237
+ if (this._isRejected) {
238
+ this._activeRunners--;
239
+ return;
240
+ }
241
+ // Note: do NOT await a non-async iterable as it will cause next() to be
242
+ // pushed into the event loop, slowing down iteration of non-async iterables.
243
+ let nextItem;
244
+ try {
245
+ if (this._asyncIterator) {
246
+ nextItem = await this._iterator.next();
247
+ }
248
+ else {
249
+ nextItem = this._iterator.next();
243
250
  }
244
- // Note: do NOT await a non-async iterable as it will cause next() to be
245
- // pushed into the event loop, slowing down iteration of non-async iterables.
246
- let nextItem;
251
+ }
252
+ catch (error) {
253
+ // Iterator protocol / Iterables can throw exceptions - If this happens we have to just stop
254
+ // regardless of stopOnMapperError since we can't iterate any additional items
255
+ this._isRejected = true;
256
+ this._activeRunners--;
257
+ // Push the error onto the unread queue, to be rethrown by next()
258
+ await this._unreadQueue.enqueue({ error });
259
+ return;
260
+ }
261
+ const index = this._currentIndex;
262
+ this._currentIndex++;
263
+ if (nextItem.done) {
264
+ this._isIterableDone = true;
265
+ // If there are no active resolvers, then release all the waiters
266
+ if (this._resolvingCount === 0) {
267
+ // At this point the only waiters in the queue are not going to get an item
268
+ // as there are no source items left
269
+ this._unreadQueue.done();
270
+ }
271
+ this._activeRunners--;
272
+ return;
273
+ }
274
+ this._resolvingCount++;
275
+ // This is created as a detached, non-awaited async
276
+ // to allow next() to return while the async mapper is awaited.
277
+ // More next() calls will be made up to the concurrency limit.
278
+ void (async () => {
279
+ //
280
+ // Push an item or error into the read queue
281
+ // Note: once we push an item we end this try/catch as any subsequent errors
282
+ // are errors in this class and not errors thrown by the mapper function.
283
+ // Once we've pushed an item we can't also push an error...
284
+ //
247
285
  try {
248
- if (this._asyncIterator) {
249
- nextItem = yield this._iterator.next();
250
- }
251
- else {
252
- nextItem = this._iterator.next();
286
+ const element = nextItem.value;
287
+ if (this._isRejected) {
288
+ this._activeRunners--;
289
+ return;
253
290
  }
291
+ const value = await this._mapper(element, index);
292
+ this._resolvingCount--;
293
+ // if (value === pMapSkip) {
294
+ // skippedIndexes.push(index);
295
+ // } else {
296
+ // result[index] = value;
297
+ // }
298
+ // Push item onto the ready queue
299
+ await this._unreadQueue.enqueue({ element: value });
300
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
254
301
  }
255
302
  catch (error) {
256
- // Iterator protocol / Iterables can throw exceptions - If this happens we have to just stop
257
- // regardless of stopOnMapperError since we can't iterate any additional items
258
- this._isRejected = true;
259
- this._activeRunners--;
260
- // Push the error onto the unread queue, to be rethrown by next()
261
- yield this._unreadQueue.enqueue({ error });
262
- return;
263
- }
264
- const index = this._currentIndex;
265
- this._currentIndex++;
266
- if (nextItem.done) {
267
- this._isIterableDone = true;
268
- // If there are no active resolvers, then release all the waiters
269
- if (this._resolvingCount === 0) {
270
- // At this point the only waiters in the queue are not going to get an item
271
- // as there are no source items left
272
- this._unreadQueue.done();
303
+ if (this._options.stopOnMapperError) {
304
+ this._isRejected = true;
305
+ this._activeRunners--;
306
+ // Push the error onto the unread queue, to be rethrown by next()
307
+ await this._unreadQueue.enqueue({ error });
308
+ // Fall through to release a reader
273
309
  }
274
- this._activeRunners--;
275
- return;
276
- }
277
- this._resolvingCount++;
278
- // This is created as a detached, non-awaited async
279
- // to allow next() to return while the async mapper is awaited.
280
- // More next() calls will be made up to the concurrency limit.
281
- void (() => tslib_1.__awaiter(this, void 0, void 0, function* () {
282
- //
283
- // Push an item or error into the read queue
284
- // Note: once we push an item we end this try/catch as any subsequent errors
285
- // are errors in this class and not errors thrown by the mapper function.
286
- // Once we've pushed an item we can't also push an error...
287
- //
288
- try {
289
- const element = nextItem.value;
290
- if (this._isRejected) {
291
- this._activeRunners--;
292
- return;
293
- }
294
- const value = yield this._mapper(element, index);
310
+ else {
311
+ // Collect the error but do not stop iterating
312
+ // These will be thrown in an AggregateError at the end
313
+ this._errors.push(error);
295
314
  this._resolvingCount--;
296
- // if (value === pMapSkip) {
297
- // skippedIndexes.push(index);
298
- // } else {
299
- // result[index] = value;
300
- // }
301
- // Push item onto the ready queue
302
- yield this._unreadQueue.enqueue({ element: value });
303
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
304
- }
305
- catch (error) {
306
- if (this._options.stopOnMapperError) {
307
- this._isRejected = true;
308
- this._activeRunners--;
309
- // Push the error onto the unread queue, to be rethrown by next()
310
- yield this._unreadQueue.enqueue({ error });
311
- // Fall through to release a reader
312
- }
313
- else {
314
- // Collect the error but do not stop iterating
315
- // These will be thrown in an AggregateError at the end
316
- this._errors.push(error);
317
- this._resolvingCount--;
318
- yield this.sourceNext();
319
- // Return so we don't release a reader since we didn't push an item
320
- return;
321
- }
322
- }
323
- //
324
- // Tasks below are not related to the mapper
325
- //
326
- // Bail if read queue length + active runners will hit max unread
327
- if (this._unreadQueue.length + this._activeRunners > this._options.maxUnread) {
328
- this._activeRunners--;
315
+ await this.sourceNext();
316
+ // Return so we don't release a reader since we didn't push an item
329
317
  return;
330
318
  }
331
- // Start myself again
332
- // Note: this will bail out if it reaches the end of the source iterable
333
- yield this.sourceNext();
334
- }))();
335
- });
319
+ }
320
+ //
321
+ // Tasks below are not related to the mapper
322
+ //
323
+ // Bail if read queue length + active runners will hit max unread
324
+ if (this._unreadQueue.length + this._activeRunners > this._options.maxUnread) {
325
+ this._activeRunners--;
326
+ return;
327
+ }
328
+ // Start myself again
329
+ // Note: this will bail out if it reaches the end of the source iterable
330
+ await this.sourceNext();
331
+ })();
336
332
  }
337
333
  }
338
334
  exports.IterableMapper = IterableMapper;
@@ -1 +1 @@
1
- {"version":3,"file":"iterable-mapper.js","sourceRoot":"","sources":["../../src/iterable-mapper.ts"],"names":[],"mappings":";;;;AAAA,EAAE;AACF,sGAAsG;AACtG,EAAE;AACF,8EAA6C;AAC7C,qDAAiD;AAqDjD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAa,cAAc;IAgBzB;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,YACE,KAAiD,EACjD,MAAmC,EACnC,UAAiC,EAAE;QAjCpB,YAAO,GAAG,EAAa,CAAC;QACjC,mBAAc,GAAG,KAAK,CAAC;QACvB,gBAAW,GAAG,KAAK,CAAC;QACpB,oBAAe,GAAG,KAAK,CAAC;QACxB,mBAAc,GAAG,CAAC,CAAC;QACnB,oBAAe,GAAG,CAAC,CAAC;QACpB,kBAAa,GAAG,CAAC,CAAC;QAClB,2BAAsB,GAAG,KAAK,CAAC;QA4BrC,M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