aveazul 1.0.2 → 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.
Files changed (83) hide show
  1. package/cjs-entry.cjs +2 -0
  2. package/dist-cjs/any.cjs +50 -0
  3. package/dist-cjs/any.cjs.map +1 -0
  4. package/dist-cjs/any.d.ts +2 -0
  5. package/dist-cjs/any.js.map +1 -0
  6. package/dist-cjs/aveazul.cjs +648 -0
  7. package/dist-cjs/aveazul.cjs.map +1 -0
  8. package/dist-cjs/aveazul.d.ts +344 -0
  9. package/dist-cjs/aveazul.js.map +1 -0
  10. package/dist-cjs/disposer.cjs +15 -0
  11. package/dist-cjs/disposer.cjs.map +1 -0
  12. package/dist-cjs/disposer.d.ts +9 -0
  13. package/dist-cjs/disposer.js.map +1 -0
  14. package/dist-cjs/index.cjs +17 -0
  15. package/dist-cjs/index.cjs.map +1 -0
  16. package/dist-cjs/index.d.ts +10 -0
  17. package/dist-cjs/index.js.map +1 -0
  18. package/dist-cjs/not-implemented.cjs +107 -0
  19. package/dist-cjs/not-implemented.cjs.map +1 -0
  20. package/dist-cjs/not-implemented.d.ts +4 -0
  21. package/dist-cjs/not-implemented.js.map +1 -0
  22. package/dist-cjs/operational-error.cjs +43 -0
  23. package/dist-cjs/operational-error.cjs.map +1 -0
  24. package/dist-cjs/operational-error.d.ts +20 -0
  25. package/dist-cjs/operational-error.js.map +1 -0
  26. package/dist-cjs/promisify-all.cjs +74 -0
  27. package/dist-cjs/promisify-all.cjs.map +1 -0
  28. package/dist-cjs/promisify-all.d.ts +10 -0
  29. package/dist-cjs/promisify-all.js.map +1 -0
  30. package/dist-cjs/promisify.cjs +63 -0
  31. package/dist-cjs/promisify.cjs.map +1 -0
  32. package/dist-cjs/promisify.d.ts +11 -0
  33. package/dist-cjs/promisify.js.map +1 -0
  34. package/dist-cjs/tsconfig.cjs.tsbuildinfo +1 -0
  35. package/dist-cjs/using.cjs +129 -0
  36. package/dist-cjs/using.cjs.map +1 -0
  37. package/dist-cjs/using.d.ts +12 -0
  38. package/dist-cjs/using.js.map +1 -0
  39. package/dist-cjs/util.cjs +185 -0
  40. package/dist-cjs/util.cjs.map +1 -0
  41. package/dist-cjs/util.d.ts +29 -0
  42. package/dist-cjs/util.js.map +1 -0
  43. package/dist-esm/any.d.ts +2 -0
  44. package/dist-esm/any.js +47 -0
  45. package/dist-esm/any.js.map +1 -0
  46. package/dist-esm/aveazul.d.ts +344 -0
  47. package/dist-esm/aveazul.js +612 -0
  48. package/dist-esm/aveazul.js.map +1 -0
  49. package/dist-esm/disposer.d.ts +9 -0
  50. package/dist-esm/disposer.js +11 -0
  51. package/dist-esm/disposer.js.map +1 -0
  52. package/dist-esm/index.d.ts +10 -0
  53. package/dist-esm/index.js +8 -0
  54. package/dist-esm/index.js.map +1 -0
  55. package/dist-esm/not-implemented.d.ts +4 -0
  56. package/dist-esm/not-implemented.js +102 -0
  57. package/dist-esm/not-implemented.js.map +1 -0
  58. package/dist-esm/operational-error.d.ts +20 -0
  59. package/dist-esm/operational-error.js +37 -0
  60. package/dist-esm/operational-error.js.map +1 -0
  61. package/dist-esm/promisify-all.d.ts +10 -0
  62. package/dist-esm/promisify-all.js +71 -0
  63. package/dist-esm/promisify-all.js.map +1 -0
  64. package/dist-esm/promisify.d.ts +11 -0
  65. package/dist-esm/promisify.js +60 -0
  66. package/dist-esm/promisify.js.map +1 -0
  67. package/dist-esm/tsconfig.esm.tsbuildinfo +1 -0
  68. package/dist-esm/using.d.ts +12 -0
  69. package/dist-esm/using.js +126 -0
  70. package/dist-esm/using.js.map +1 -0
  71. package/dist-esm/util.d.ts +29 -0
  72. package/dist-esm/util.js +175 -0
  73. package/dist-esm/util.js.map +1 -0
  74. package/package.json +31 -18
  75. package/lib/any.js +0 -55
  76. package/lib/aveazul.js +0 -645
  77. package/lib/disposer.js +0 -14
  78. package/lib/not-implemented.js +0 -110
  79. package/lib/operational-error.js +0 -46
  80. package/lib/promisify-all.js +0 -93
  81. package/lib/promisify.js +0 -70
  82. package/lib/using.js +0 -142
  83. package/lib/util.js +0 -199
@@ -0,0 +1,612 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ import * as xaa from "xaa";
3
+ import { promisify } from "./promisify.js";
4
+ import { promisifyAll } from "./promisify-all.js";
5
+ import { Disposer } from "./disposer.js";
6
+ import { using } from "./using.js";
7
+ import { isPromise, triggerUncaughtException, toArray } from "./util.js";
8
+ import { AggregateError } from "@jchip/error";
9
+ import { OperationalError, isOperationalError, isProgrammerError } from "./operational-error.js";
10
+ /**
11
+ * @fileoverview
12
+ * AveAzul ("Blue Bird" in Spanish) - Extended Promise class that provides Bluebird like utility methods
13
+ * This implementation is inspired by and provides similar APIs to the Bluebird Promise library,
14
+ * but built on top of native Promises. The name is a Spanish play on words referencing Bluebird.
15
+ * @extends Promise
16
+ */
17
+ class AveAzul extends Promise {
18
+ constructor(executor) {
19
+ super(executor);
20
+ }
21
+ /**
22
+ * Note: Per ECMAScript specification, when extending Promise, both .then() and static methods
23
+ * (resolve, reject, all, etc) must return instances of the derived class (AveAzul), so there's
24
+ * no need to explicitly wrap returns in new AveAzul(). This behavior is standard across all
25
+ * spec-compliant JS engines (V8, SpiderMonkey, JavaScriptCore, etc).
26
+ */
27
+ /**
28
+ * Bluebird-style tap() method that lets you perform side effects in a chain
29
+ * Similar to Bluebird's Promise.prototype.tap()
30
+ * @param fn - Function to execute with the resolved value
31
+ * @returns Promise that resolves with the original value
32
+ */
33
+ tap(fn) {
34
+ return this.then(async (value) => {
35
+ await fn(value);
36
+ return value;
37
+ });
38
+ }
39
+ /**
40
+ * Bluebird-style filter() method for array operations
41
+ * Similar to Bluebird's Promise.prototype.filter()
42
+ * @param fn - Filter function to apply to each element
43
+ * @returns Promise that resolves with the filtered array
44
+ */
45
+ filter(fn) {
46
+ return this.then((value) => xaa.filter(value, fn));
47
+ }
48
+ /**
49
+ * Bluebird-style map() method for array operations
50
+ * Similar to Bluebird's Promise.prototype.map()
51
+ * @param fn - Map function to apply to each element
52
+ * @returns Promise that resolves with the mapped array
53
+ */
54
+ map(fn, options = { concurrency: 50 }) {
55
+ return this.then((value) => xaa.map(value, fn, options));
56
+ }
57
+ /**
58
+ * Bluebird-style mapSeries() method for array operations
59
+ * Similar to Bluebird's Promise.prototype.mapSeries()
60
+ * @param fn - Map function to apply to each element
61
+ * @returns Promise that resolves with the mapped array
62
+ */
63
+ mapSeries(fn) {
64
+ return this.map(fn, { concurrency: 1 });
65
+ }
66
+ /**
67
+ * Bluebird-style return() method to inject a value into the chain
68
+ * Similar to Bluebird's Promise.prototype.return()
69
+ * @param value - Value to return
70
+ * @returns Promise that resolves with the new value
71
+ */
72
+ return(value) {
73
+ return this.then(() => value);
74
+ }
75
+ /**
76
+ * Bluebird-style any() method for waiting for any promises to resolve
77
+ * @returns Promise that resolves with the first resolved promise
78
+ */
79
+ any() {
80
+ return this.then((args) => {
81
+ return AveAzul.any(toArray(args));
82
+ });
83
+ }
84
+ /**
85
+ * Bluebird-style each() method for array iteration
86
+ * Similar to Bluebird's Promise.prototype.each()
87
+ * @param fn - Function to execute for each element
88
+ * @returns Promise that resolves when iteration is complete
89
+ */
90
+ each(fn) {
91
+ return this.then(async (value) => {
92
+ const arr = value;
93
+ const result = [];
94
+ for (let i = 0; i < arr.length; i++) {
95
+ let x = arr[i];
96
+ if (isPromise(x)) {
97
+ x = await x;
98
+ }
99
+ await fn(x, i, arr.length);
100
+ result.push(x);
101
+ }
102
+ return result;
103
+ });
104
+ }
105
+ /**
106
+ * Bluebird-style delay() method
107
+ * @param ms - Milliseconds to delay
108
+ * @returns Promise that resolves after the delay
109
+ */
110
+ delay(ms) {
111
+ return xaa.delay(ms);
112
+ }
113
+ /**
114
+ * Bluebird-style timeout() method
115
+ * @param ms - Milliseconds before timeout
116
+ * @param message - Optional error message
117
+ * @returns Promise that rejects if timeout occurs
118
+ */
119
+ timeout(ms, message = "operation timed out") {
120
+ return xaa
121
+ .timeout(ms, message, {
122
+ Promise: AveAzul,
123
+ TimeoutError: OperationalError,
124
+ })
125
+ .run(this);
126
+ }
127
+ /**
128
+ * Bluebird-style props() for object properties
129
+ * @returns Promise that resolves with an object of resolved values
130
+ */
131
+ props() {
132
+ return this.then((value) => {
133
+ const obj = value;
134
+ const keys = Object.keys(obj);
135
+ const values = keys.map((k) => obj[k]);
136
+ return AveAzul.all(values).then((results) => {
137
+ const resolved = {};
138
+ keys.forEach((k, i) => {
139
+ resolved[k] = results[i];
140
+ });
141
+ return resolved;
142
+ });
143
+ });
144
+ }
145
+ /**
146
+ * Bluebird-style tapCatch() for side effects on rejection
147
+ * @param fn - Function to execute on rejection
148
+ * @returns Promise that maintains the rejection
149
+ */
150
+ tapCatch(fn) {
151
+ return this.catch((err) => {
152
+ fn(err);
153
+ throw err;
154
+ });
155
+ }
156
+ /**
157
+ * Bluebird-style reduce() method for array reduction
158
+ * Similar to Bluebird's Promise.prototype.reduce()
159
+ * @param fn - Reducer function to apply to each element
160
+ * @param initialValue - Optional initial value
161
+ * @returns Promise that resolves with the final reduced value
162
+ */
163
+ reduce(fn, initialValue) {
164
+ const hasInitial = arguments.length > 1;
165
+ return this.then(async (array) => {
166
+ const arr = array;
167
+ const len = arr.length;
168
+ let value;
169
+ let idx;
170
+ if (hasInitial) {
171
+ idx = 0;
172
+ value = initialValue;
173
+ }
174
+ else {
175
+ idx = 1;
176
+ value = arr[0];
177
+ }
178
+ value = isPromise(value) ? await value : value;
179
+ for (; idx < len; idx++) {
180
+ let x = arr[idx];
181
+ if (isPromise(x)) {
182
+ x = await x;
183
+ }
184
+ value = await fn(value, x, idx, len);
185
+ }
186
+ return value;
187
+ });
188
+ }
189
+ /**
190
+ * Bluebird-style throw() that returns a rejected promise with the given reason
191
+ * @param reason - Value to reject the promise with
192
+ * @returns Promise that rejects with the given reason
193
+ */
194
+ throw(reason) {
195
+ return AveAzul.reject(reason);
196
+ }
197
+ /**
198
+ * Bluebird-style catchThrow() that catches an error and throws a new one
199
+ * @param reason - Value to reject the promise with
200
+ * @returns Promise that rejects with the new reason
201
+ */
202
+ catchThrow(reason) {
203
+ return this.catch(() => {
204
+ throw reason;
205
+ });
206
+ }
207
+ /**
208
+ * Bluebird-style catchReturn() that catches an error and returns a value instead
209
+ * @param value - Value to return
210
+ * @returns Promise that resolves with the given value
211
+ */
212
+ catchReturn(value) {
213
+ return this.catch(() => value);
214
+ }
215
+ /**
216
+ * Bluebird-style get() for retrieving a property value
217
+ * @param key - Key to retrieve
218
+ * @returns Promise that resolves with the property value
219
+ */
220
+ get(key) {
221
+ return this.then((value) => value[key]);
222
+ }
223
+ /**
224
+ * Bluebird-style disposer() for resource cleanup
225
+ * @param fn - Cleanup function
226
+ * @returns Disposer object
227
+ */
228
+ disposer(fn) {
229
+ if (typeof fn !== "function") {
230
+ throw new TypeError("Expected a function");
231
+ }
232
+ return new Disposer(fn, this);
233
+ }
234
+ /**
235
+ * Bluebird-style spread() method for handling array arguments
236
+ * Similar to Bluebird's Promise.prototype.spread()
237
+ * @param fn - Function to apply to the array arguments
238
+ * @returns Promise that resolves with the function's return value
239
+ */
240
+ spread(fn) {
241
+ if (typeof fn !== "function") {
242
+ return AveAzul.reject(new TypeError("expecting a function but got " + fn));
243
+ }
244
+ return this.then(async (args) => {
245
+ if (Array.isArray(args)) {
246
+ for (let i = 0; i < args.length; i++) {
247
+ if (isPromise(args[i])) {
248
+ args[i] = await args[i];
249
+ }
250
+ }
251
+ return fn(...args);
252
+ }
253
+ else {
254
+ return fn(args);
255
+ }
256
+ });
257
+ }
258
+ some(count) {
259
+ return this.then((args) => {
260
+ const arr = toArray(args);
261
+ return new AveAzul((resolve, reject) => {
262
+ // If too many promises are rejected so that the promise can never become fulfilled,
263
+ // it will be immediately rejected with an AggregateError of the rejection reasons
264
+ // in the order they were thrown in.
265
+ const errors = [];
266
+ // The fulfillment value is an array with count values
267
+ // in the order they were fulfilled.
268
+ const results = [];
269
+ const len = arr.length;
270
+ let settled = false;
271
+ const addDone = (result) => {
272
+ if (settled)
273
+ return;
274
+ results.push(result);
275
+ if (results.length >= count) {
276
+ settled = true;
277
+ // Resolve with exactly count results to match Bluebird's behavior
278
+ resolve(results.slice(0, count));
279
+ }
280
+ };
281
+ const addError = (err) => {
282
+ if (settled)
283
+ return;
284
+ errors.push(err);
285
+ if (len - errors.length < count) {
286
+ settled = true;
287
+ reject(new AggregateError(errors, `aggregate error`));
288
+ }
289
+ };
290
+ for (let i = 0; i < len; i++) {
291
+ const x = arr[i];
292
+ if (isPromise(x)) {
293
+ x.then(addDone, addError);
294
+ }
295
+ else {
296
+ addDone(x);
297
+ }
298
+ }
299
+ });
300
+ });
301
+ }
302
+ /**
303
+ * Bluebird-style all() method for array operations
304
+ * Similar to Promise.all() but operates on the resolved value of this promise
305
+ * @returns Promise that resolves when all items in the array resolve
306
+ */
307
+ all() {
308
+ return this.then((value) => {
309
+ return AveAzul.all(toArray(value));
310
+ });
311
+ }
312
+ /**
313
+ * Bluebird-style asCallback() method
314
+ * Attaches a callback to the promise and returns the promise.
315
+ * The callback is invoked when the promise is resolved or rejected.
316
+ *
317
+ * @param cb - Node.js-style callback function (err, value)
318
+ * @param options - Additional options
319
+ * @returns The same promise instance
320
+ */
321
+ asCallback(cb, options = {}) {
322
+ if (typeof cb !== "function") {
323
+ return this;
324
+ }
325
+ const spread = options && options.spread === true;
326
+ this.then((value) => {
327
+ try {
328
+ if (spread && Array.isArray(value)) {
329
+ cb(null, ...value);
330
+ }
331
+ else {
332
+ cb(null, value);
333
+ }
334
+ }
335
+ catch (err) {
336
+ AveAzul.___throwUncaughtError(err);
337
+ }
338
+ }, (reason) => {
339
+ try {
340
+ cb(reason);
341
+ }
342
+ catch (err) {
343
+ AveAzul.___throwUncaughtError(err);
344
+ }
345
+ });
346
+ return this;
347
+ }
348
+ nodeify(cb, options) {
349
+ return this.asCallback(cb, options);
350
+ }
351
+ /**
352
+ * Bluebird-style call() method for calling a method on the resolved value
353
+ * @param methodName - Name of the method to call
354
+ * @param args - Arguments to pass to the method
355
+ * @returns Promise that resolves with the method's return value
356
+ */
357
+ call(methodName, ...args) {
358
+ return this.then(function (obj) {
359
+ const method = obj[methodName];
360
+ if (typeof method === "function") {
361
+ return method.call(obj, ...args);
362
+ }
363
+ throw new TypeError(`${String(methodName)} is not a function`);
364
+ });
365
+ }
366
+ /**
367
+ * Catches only operational errors and passes them to the handler.
368
+ * Programmer errors (non-operational) are rethrown.
369
+ * @param handler - Function to handle operational errors
370
+ * @returns Promise with the error handled or rethrown
371
+ */
372
+ error(handler) {
373
+ return this.catch((err) => {
374
+ if (isOperationalError(err)) {
375
+ return handler(err);
376
+ }
377
+ throw err;
378
+ });
379
+ }
380
+ /**
381
+ * Static helper methods
382
+ */
383
+ /**
384
+ * Bluebird-style delay() that resolves after specified milliseconds
385
+ * @param ms - Milliseconds to delay
386
+ * @param value - Optional value to resolve with
387
+ * @returns Promise that resolves after the delay
388
+ */
389
+ static delay(ms, value) {
390
+ if (value === undefined) {
391
+ return AveAzul.resolve(xaa.delay(ms));
392
+ }
393
+ return AveAzul.resolve(xaa.delay(ms, value));
394
+ }
395
+ /**
396
+ * Bluebird-style map() for array operations
397
+ * @param value - Array to map over
398
+ * @param fn - Map function to apply to each element
399
+ * @returns Promise that resolves with the mapped array
400
+ */
401
+ static map(value, fn, options = { concurrency: 50 }) {
402
+ return AveAzul.resolve(value).map(fn, options);
403
+ }
404
+ /**
405
+ * Bluebird-style mapSeries() for array operations
406
+ * @param value - Array to map over
407
+ * @param fn - Map function to apply to each element
408
+ * @returns Promise that resolves with the mapped array
409
+ */
410
+ static mapSeries(value, fn) {
411
+ return AveAzul.map(value, fn, { concurrency: 1 });
412
+ }
413
+ /**
414
+ * Bluebird-style try() for wrapping sync/async functions
415
+ * @param fn - Function to execute
416
+ * @returns Promise that resolves with the function's return value
417
+ */
418
+ static try(fn) {
419
+ return AveAzul.resolve(xaa.wrap(fn));
420
+ }
421
+ /**
422
+ * Bluebird-style props() for object properties
423
+ * @param obj - Object with promise values
424
+ * @returns Promise that resolves with an object of resolved values
425
+ */
426
+ static props(obj) {
427
+ const keys = Object.keys(obj);
428
+ const values = keys.map((k) => obj[k]);
429
+ return AveAzul.all(values).then((results) => {
430
+ const resolved = {};
431
+ keys.forEach((k, i) => {
432
+ resolved[k] = results[i];
433
+ });
434
+ return resolved;
435
+ });
436
+ }
437
+ /**
438
+ * Bluebird-style defer() for creating a deferred promise
439
+ * @returns Deferred object with promise, resolve, and reject methods
440
+ */
441
+ static defer() {
442
+ return xaa.makeDefer(AveAzul);
443
+ }
444
+ /**
445
+ * Bluebird-style each() for array iteration
446
+ * @param items - Array to iterate over
447
+ * @param fn - Iterator function to call for each item
448
+ * @returns Promise that resolves when iteration is complete
449
+ */
450
+ static each(items, fn) {
451
+ return AveAzul.resolve(items).each(fn);
452
+ }
453
+ /**
454
+ * Bluebird-style reduce() for array reduction
455
+ * @param array - Array to reduce
456
+ * @param fn - Reducer function (value, item, index, length)
457
+ * @param initialValue - Optional initial value
458
+ * @returns Promise that resolves with the final reduced value
459
+ */
460
+ static reduce(array, fn, initialValue) {
461
+ if (arguments.length > 2) {
462
+ return AveAzul.resolve(array).reduce(fn, initialValue);
463
+ }
464
+ return AveAzul.resolve(array).reduce(fn);
465
+ }
466
+ /**
467
+ * Bluebird-style promisify() for converting callback-based functions to promises
468
+ * @param fn - Function to promisify
469
+ * @param options - Options object
470
+ * @returns Promisified function
471
+ */
472
+ static promisify(fn, options) {
473
+ return promisify(fn, {
474
+ ...options,
475
+ Promise: AveAzul,
476
+ });
477
+ }
478
+ /**
479
+ * Bluebird-style promisifyAll() for converting callback-based functions to promises
480
+ * @param target - Object to promisify
481
+ * @param options - Options object
482
+ * @returns Object with promisified methods
483
+ */
484
+ static promisifyAll(target, options) {
485
+ return promisifyAll(target, {
486
+ ...options,
487
+ Promise: AveAzul,
488
+ });
489
+ }
490
+ /**
491
+ * Bluebird-style method() for creating a method that returns a promise
492
+ * @param fn - Function to create a method for
493
+ * @returns Method function that returns a promise
494
+ */
495
+ static method(fn) {
496
+ return function (...args) {
497
+ return new AveAzul((resolve, reject) => {
498
+ try {
499
+ const result = fn.call(this, ...args);
500
+ resolve(result);
501
+ }
502
+ catch (error) {
503
+ reject(error);
504
+ }
505
+ });
506
+ };
507
+ }
508
+ /**
509
+ * Bluebird-style using() for resource management. There is only a static version of this method.
510
+ * After the handler finish and returns, regardless of whether it resolves or rejects, the resources will be disposed.
511
+ *
512
+ * @param resources - Resource disposers, either an array of disposers or a variadic argument list
513
+ * @param args - Handler function that will receive the resources as arguments
514
+ * @returns Promise that resolves with handler result
515
+ */
516
+ static using(resources, ...args) {
517
+ if (args.length === 0) {
518
+ throw new TypeError("resrouces and handler function required");
519
+ }
520
+ if (Array.isArray(resources)) {
521
+ if (args.length > 1) {
522
+ throw new TypeError("only two arguments are allowed when passing an array of resources");
523
+ }
524
+ return using(resources, args[0], AveAzul, true);
525
+ }
526
+ const handler = args.pop();
527
+ return using([resources, ...args], handler, AveAzul, false);
528
+ }
529
+ /**
530
+ * Bluebird-style join() for joining promises
531
+ *
532
+ * @param args - Promises to join
533
+ * @returns Promise that resolves with the handler's return value
534
+ */
535
+ static join(...args) {
536
+ if (args.length > 1 && typeof args[args.length - 1] === "function") {
537
+ const handler = args.pop();
538
+ return AveAzul.all(args).then((results) => handler(...results));
539
+ }
540
+ else {
541
+ return AveAzul.all(args);
542
+ }
543
+ }
544
+ /**
545
+ * Bluebird-style fromCallback() for converting callback-based functions to promises
546
+ * @param fn - Function to convert
547
+ * @param options - Options object
548
+ * @returns Promise that resolves with the function's return value
549
+ */
550
+ static fromCallback(fn, options) {
551
+ return new AveAzul((resolve, reject) => {
552
+ try {
553
+ fn((err, ...args) => {
554
+ if (err) {
555
+ reject(err);
556
+ }
557
+ else {
558
+ if (options && options.multiArgs) {
559
+ resolve(args);
560
+ }
561
+ else {
562
+ resolve(args[0]);
563
+ }
564
+ }
565
+ });
566
+ }
567
+ catch (err) {
568
+ reject(err);
569
+ }
570
+ });
571
+ }
572
+ /**
573
+ * Bluebird-style some() for waiting for some promises to resolve
574
+ * @param promises - Array or iterable of promises
575
+ * @param count - Number of promises that need to resolve
576
+ * @returns Promise that resolves when count promises have resolved
577
+ */
578
+ static some(promises, count) {
579
+ return AveAzul.resolve(promises).some(count);
580
+ }
581
+ /**
582
+ * Bluebird-style any() for waiting for any promise to resolve
583
+ * @param args - Array or iterable of promises
584
+ * @returns Promise that resolves with the first resolved value
585
+ */
586
+ /* v8 ignore next 4 */
587
+ static any(args) {
588
+ // Will be overwritten by addStaticAny
589
+ throw new Error("any not initialized");
590
+ }
591
+ }
592
+ AveAzul.fromNode = AveAzul.fromCallback;
593
+ /**
594
+ * When fatal error and AveAzul needs to crash the process,
595
+ * this method is used to throw the error.
596
+ *
597
+ * @param error - The error to throw.
598
+ */
599
+ AveAzul.___throwUncaughtError = triggerUncaughtException;
600
+ AveAzul.OperationalError = OperationalError;
601
+ AveAzul.isOperationalError = isOperationalError;
602
+ AveAzul.isProgrammerError = isProgrammerError;
603
+ AveAzul.Disposer = Disposer;
604
+ // Setup the any method
605
+ import { addStaticAny } from "./any.js";
606
+ addStaticAny(AveAzul);
607
+ // Setup the not implemented methods
608
+ import { setupNotImplemented } from "./not-implemented.js";
609
+ setupNotImplemented(AveAzul);
610
+ export { AveAzul };
611
+ export default AveAzul;
612
+ //# sourceMappingURL=aveazul.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aveazul.js","sourceRoot":"","sources":["../src/aveazul.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,SAAS,EAAoB,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAuB,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,SAAS,EAAE,wBAAwB,EAAE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O,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;wBACnB,CAAC;oBACH,CAAC;gBACH,CAAC,CAAC,CAAC;YACL,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,MAAM,CAAC,GAAG,CAAC,CAAC;YACd,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAYD;;;;;OAKG;IACH,MAAM,CAAC,IAAI,CAAI,QAAsC,EAAE,KAAa;QAClE,OAAQ,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAkB,CAAC,IAAI,CAAC,KAAK,CAAiB,CAAC;IACjF,CAAC;IAED;;;;OAIG;IACH,sBAAsB;IACtB,MAAM,CAAC,GAAG,CAAI,IAAkC;QAC9C,sCAAsC;QACtC,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACzC,CAAC;;AA7BM,gBAAQ,GAAG,OAAO,CAAC,YAAY,CAAC;AAEvC;;;;;GAKG;AACI,6BAAqB,GAAG,wBAAwB,CAAC;AAuBjD,wBAAgB,GAAG,gBAAgB,CAAC;AACpC,0BAAkB,GAAG,kBAAkB,CAAC;AACxC,yBAAiB,GAAG,iBAAiB,CAAC;AACtC,gBAAQ,GAAG,QAAQ,CAAC;AAK7B,uBAAuB;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,YAAY,CAAC,OAAkC,CAAC,CAAC;AAEjD,oCAAoC;AACpC,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,mBAAmB,CAAC,OAAkC,CAAC,CAAC;AAExD,OAAO,EAAE,OAAO,EAAE,CAAC;AACnB,eAAe,OAAO,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Disposer class for resource cleanup
3
+ * @private
4
+ */
5
+ export declare class Disposer<T> {
6
+ _data: (resource: T) => void | Promise<void>;
7
+ _promise: Promise<T>;
8
+ constructor(fn: (resource: T) => void | Promise<void>, promise: Promise<T>);
9
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Disposer class for resource cleanup
3
+ * @private
4
+ */
5
+ export class Disposer {
6
+ constructor(fn, promise) {
7
+ this._data = fn;
8
+ this._promise = promise;
9
+ }
10
+ }
11
+ //# sourceMappingURL=disposer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"disposer.js","sourceRoot":"","sources":["../src/disposer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,OAAO,QAAQ;IAInB,YACE,EAAyC,EACzC,OAAmB;QAEnB,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;QAChB,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC1B,CAAC;CACF"}
@@ -0,0 +1,10 @@
1
+ import { AveAzul } from "./aveazul.ts";
2
+ export { AveAzul };
3
+ export default AveAzul;
4
+ export type { MapOptions, AsCallbackOptions, FromCallbackOptions, Deferred, AveAzulClass, AveAzulInstance, } from "./aveazul.ts";
5
+ export { Disposer } from "./disposer.ts";
6
+ export { OperationalError, isOperationalError, isProgrammerError } from "./operational-error.ts";
7
+ export { promisify } from "./promisify.ts";
8
+ export type { PromisifyOptions } from "./promisify.ts";
9
+ export { promisifyAll } from "./promisify-all.ts";
10
+ export type { PromisifyAllOptions } from "./promisify-all.ts";
@@ -0,0 +1,8 @@
1
+ import { AveAzul } from "./aveazul.js";
2
+ export { AveAzul };
3
+ export default AveAzul;
4
+ export { Disposer } from "./disposer.js";
5
+ export { OperationalError, isOperationalError, isProgrammerError } from "./operational-error.js";
6
+ export { promisify } from "./promisify.js";
7
+ export { promisifyAll } from "./promisify-all.js";
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,CAAC;AACnB,eAAe,OAAO,CAAC;AASvB,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AACjG,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC"}