@ndriadev/futurable 1.0.8 → 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.
package/README.md CHANGED
@@ -11,7 +11,7 @@
11
11
  <div align="center">
12
12
 
13
13
  ![Statements](https://img.shields.io/badge/statements-100%25-brightgreen.svg?style=for-the-badge)
14
- ![Branches](https://img.shields.io/badge/branches-96.46%25-brightgreen.svg?style=for-the-badge)
14
+ ![Branches](https://img.shields.io/badge/branches-96.55%25-brightgreen.svg?style=for-the-badge)
15
15
  ![Functions](https://img.shields.io/badge/functions-100%25-brightgreen.svg?style=for-the-badge)
16
16
  ![Lines](https://img.shields.io/badge/lines-100%25-brightgreen.svg?style=for-the-badge)
17
17
  </div>
@@ -1 +1 @@
1
- "use strict";var P=Object.defineProperty;var z=(i,h,e)=>h in i?P(i,h,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[h]=e;var S=(i,h,e)=>(z(i,typeof h!="symbol"?h+"":h,e),e),D=(i,h,e)=>{if(!h.has(i))throw TypeError("Cannot "+e)};var C=(i,h,e)=>{if(h.has(i))throw TypeError("Cannot add the same private member more than once");h instanceof WeakSet?h.add(i):h.set(i,e)};var j=(i,h,e)=>(D(i,h,"access private method"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var I=(i=>(i.PENDING="pending",i.FULFILLED="fulfilled",i.REJECTED="rejected",i))(I||{}),m,v;const s=class extends Promise{constructor(e,t){const r=t?null:new AbortController,n=t||r.signal,l=[],c=()=>{for(const a of l)clearTimeout(a)};let o;const u={signal:n,cancel:()=>{var a;return(a=this.controller)==null?void 0:a.abort()},onCancel:a=>{o=a},delay:(a,d)=>new s(g=>{l.push(setTimeout(()=>{g(a())},d))},n),sleep:a=>u.delay(()=>{},a),fetch:(a,d)=>new s((g,T)=>{fetch(a,{...d||{},signal:n}).then(b=>g(b)).catch(b=>{b.name!=="AbortError"&&T(b)})},n),futurizable:a=>new s((d,g)=>{a.then(d).catch(g)},n)};let y="pending";const E=new Promise((a,d)=>{if(n.aborted){c(),y==="pending"&&o&&o();return}else{const g=typeof n.onabort=="function"?n.onabort:()=>{};n.onabort=()=>{g(),c(),y==="pending"&&o&&o()},e(p=>{y="fulfilled",a(p)},p=>{y="rejected",d(p)},u)}});super((a,d)=>{E.then(g=>a(g)).catch(d)});C(this,m);S(this,"controller");S(this,"internalSignal");S(this,"idsTimeout");this.controller=r,this.internalSignal=n,this.idsTimeout=l}static get[Symbol.species](){return this}get[Symbol.toStringTag](){return"Futurable"}get signal(){return this.internalSignal}then(e,t){let r,n;const l=new s((c,o)=>{r=c,n=o},this.internalSignal);return l.controller=this.controller,super.then(c=>{var o;if((o=this.internalSignal)!=null&&o.aborted){j(this,m,v).call(this);return}try{r(e?e(c):c)}catch(f){n(f)}},c=>{var o;if((o=this.internalSignal)!=null&&o.aborted){j(this,m,v).call(this);return}try{t?r(t(c)):n(c)}catch(f){n(f)}}),l}catch(e){return this.then(null,e)}finally(e){return this.then(()=>{e()},()=>{e()})}cancel(){var e,t;!((e=this.internalSignal)!=null&&e.aborted)&&((t=this.controller)==null||t.abort())}delay(e,t){let r,n;const l=new s((c,o)=>{r=c,n=o},this.internalSignal);return l.controller=this.controller,this.then(c=>{this.idsTimeout.push(setTimeout(()=>r(e(c)),t))},c=>{n(c)}),l}sleep(e){return this.delay(t=>t,e)}fetch(e,t){let r,n;const l=new s((c,o)=>{r=c,n=o},this.internalSignal);return l.controller=this.controller,this.then(c=>{const o=typeof e=="function"?e(c):e,f={...typeof t=="function"?t(c):t,signal:this.internalSignal};fetch(o,f).then(u=>r(u)).catch(u=>{u.name!=="AbortError"&&n(u)})}),l}onCancel(e){let t,r;const n=new s((l,c,o)=>{o.onCancel(e),t=l,r=c},this.internalSignal);return n.controller=this.controller,this.then(l=>t(l),l=>r(l)),n}futurizable(e){let t,r;const n=new s((l,c)=>{t=l,r=c},this.internalSignal);return n.controller=this.controller,this.then(l=>{(typeof e=="function"?e(l):e).then(t).catch(r)}),n}static resolve(e,t){return new s(r=>r(e),t)}static reject(e,t){return new s((r,n)=>n(e),t)}static onCancel({cb:e,signal:t}){return new s((r,n,l)=>{l.onCancel(()=>r(e()))},t)}static delay({cb:e,timer:t,signal:r}){return s.resolve(!0,r).delay(e,t)}static sleep({timer:e,signal:t}){return s.delay({cb:()=>{},timer:e,signal:t})}static fetch(e,t){const r=(t==null?void 0:t.signal)||void 0;return t!=null&&t.signal&&delete t.signal,s.resolve(!0,r).fetch(e,t)}static futurizable({promise:e,signal:t}){return new s((r,n)=>{e.then(r).catch(n)},t)}static handleIterables(e,t){let r,n;const l=[],c=new s((o,f,u)=>{r=o,n=f,u.onCancel(()=>{for(const y of l)y.signal!==t&&y.cancel()})},t);t||(t=c.internalSignal);for(const o in e)e[o]instanceof s?l.push(e[o]):e[o]instanceof Promise?l.push(new s((f,u)=>{e[o].then(f).catch(u)},t)):l.push(s.resolve(e[o]));return{f:c,resolve:r,reject:n,array:l}}static all(e,t){const{f:r,resolve:n,reject:l,array:c}=s.handleIterables(e,t);return super.all(c).then(n).catch(l),r}static allSettled(e,t){const{f:r,resolve:n,reject:l,array:c}=s.handleIterables(e,t);return super.allSettled(c).then(n).catch(l),r}static race(e,t){const{f:r,resolve:n,reject:l,array:c}=s.handleIterables(e,t);return super.race(c).then(n).catch(l),r}static any(e,t){const{f:r,resolve:n,reject:l,array:c}=s.handleIterables(e,t);return super.any(c).then(n).catch(l),r}};let w=s;m=new WeakSet,v=function(){for(const e of this.idsTimeout)clearTimeout(e)};exports.FUTURABLE_STATUS=I;exports.Futurable=w;
1
+ "use strict";var T=Object.defineProperty;var v=(g,f,e)=>f in g?T(g,f,{enumerable:!0,configurable:!0,writable:!0,value:e}):g[f]=e;var S=(g,f,e)=>(v(g,typeof f!="symbol"?f+"":f,e),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class i extends Promise{constructor(e,t){const r=t?null:new AbortController,n=t||r.signal,o=[],c=()=>{for(const l of o)clearTimeout(l)};let s;const d={signal:n,cancel:()=>{var l;return(l=this.controller)==null?void 0:l.abort()},onCancel:l=>{s=l},delay:(l,a)=>new i(h=>{o.push(setTimeout(()=>{h(l())},a))},n),sleep:l=>d.delay(()=>{},l),fetch:(l,a)=>new i((h,w)=>{fetch(l,{...a||{},signal:n}).then(y=>h(y)).catch(y=>{y.name!=="AbortError"&&w(y)})},n),futurizable:l=>new i((a,h)=>{l.then(a).catch(h)},n)};let m="pending";const p=new Promise((l,a)=>{if(n.aborted){c(),m==="pending"&&s&&s();return}else{const h=typeof n.onabort=="function"?n.onabort:()=>{};n.onabort=()=>{h(),c(),m==="pending"&&s&&s()},e(j=>{m="fulfilled",l(j)},j=>{m="rejected",a(j)},d)}});super((l,a)=>{p.then(h=>l(h)).catch(a)});S(this,"controller");S(this,"internalSignal");S(this,"idsTimeout");this.controller=r,this.internalSignal=n,this.idsTimeout=o}static get[Symbol.species](){return this}get[Symbol.toStringTag](){return"Futurable"}get signal(){return this.internalSignal}clearTimeout(){for(const e of this.idsTimeout)clearTimeout(e)}then(e,t){let r,n;const o=new i((c,s)=>{r=c,n=s},this.internalSignal);return o.controller=this.controller,super.then(c=>{var s;if((s=this.internalSignal)!=null&&s.aborted){this.clearTimeout();return}try{r(e?e(c):c)}catch(u){n(u)}},c=>{var s;if((s=this.internalSignal)!=null&&s.aborted){this.clearTimeout();return}try{t?r(t(c)):n(c)}catch(u){n(u)}}),o}catch(e){return this.then(null,e)}finally(e){return this.then(()=>{e()},()=>{e()})}cancel(){var e,t;!((e=this.internalSignal)!=null&&e.aborted)&&((t=this.controller)==null||t.abort())}delay(e,t){let r,n;const o=new i((c,s)=>{r=c,n=s},this.internalSignal);return o.controller=this.controller,this.then(c=>{this.idsTimeout.push(setTimeout(()=>r(e(c)),t))},c=>{n(c)}),o}sleep(e){return this.delay(t=>t,e)}fetch(e,t){let r,n;const o=new i((c,s)=>{r=c,n=s},this.internalSignal);return o.controller=this.controller,this.then(c=>{const s=typeof e=="function"?e(c):e,u={...typeof t=="function"?t(c):t,signal:this.internalSignal};fetch(s,u).then(d=>r(d)).catch(d=>{d.name!=="AbortError"&&n(d)})}),o}onCancel(e){let t,r;const n=new i((o,c,s)=>{s.onCancel(e),t=o,r=c},this.internalSignal);return n.controller=this.controller,this.then(o=>t(o),o=>r(o)),n}futurizable(e){let t,r;const n=new i((o,c)=>{t=o,r=c},this.internalSignal);return n.controller=this.controller,this.then(o=>{(typeof e=="function"?e(o):e).then(t).catch(r)}),n}static resolve(e,t){return new i(r=>r(e),t)}static reject(e,t){return new i((r,n)=>n(e),t)}static onCancel({cb:e,signal:t}){return new i((r,n,o)=>{o.onCancel(()=>r(e()))},t)}static delay({cb:e,timer:t,signal:r}){return new i((n,o,c)=>{c.delay(e,t).then(n)},r)}static sleep({timer:e,signal:t}){return i.delay({cb:()=>{},timer:e,signal:t})}static fetch(e,t){const r=(t==null?void 0:t.signal)||void 0;return t!=null&&t.signal&&delete t.signal,new i((n,o,c)=>{c.fetch(e,t).then(n)},r)}static futurizable({promise:e,signal:t}){return new i((r,n)=>{e.then(r).catch(n)},t)}static handleIterables(e,t){const r={array:[]};r.f=new i((n,o,c)=>{r.resolve=n,r.reject=o,c.onCancel(()=>{for(const s of r.array)s.cancel()})},t),t||(t=r.f.internalSignal);for(const n in e)e[n]instanceof i?r.array.push(e[n]):e[n]instanceof Promise?r.array.push(new i((o,c)=>{e[n].then(u=>o(u)).catch(c)},t)):r.array.push(i.resolve(e[n],t));return r}static all(e,t){const{f:r,resolve:n,reject:o,array:c}=i.handleIterables(e,t);return super.all(c).then(n).catch(o),r}static allSettled(e,t){const{f:r,resolve:n,reject:o,array:c}=i.handleIterables(e,t);return super.allSettled(c).then(n).catch(o),r}static race(e,t){const{f:r,resolve:n,reject:o,array:c}=i.handleIterables(e,t);return super.race(c).then(n).catch(o),r}static any(e,t){const{f:r,resolve:n,reject:o,array:c}=i.handleIterables(e,t);return super.any(c).then(n).catch(o),r}}exports.Futurable=i;
@@ -1,73 +1,62 @@
1
- var E = Object.defineProperty;
2
- var P = (i, h, e) => h in i ? E(i, h, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[h] = e;
3
- var p = (i, h, e) => (P(i, typeof h != "symbol" ? h + "" : h, e), e), z = (i, h, e) => {
4
- if (!h.has(i))
5
- throw TypeError("Cannot " + e);
6
- };
7
- var C = (i, h, e) => {
8
- if (h.has(i))
9
- throw TypeError("Cannot add the same private member more than once");
10
- h instanceof WeakSet ? h.add(i) : h.set(i, e);
11
- };
12
- var j = (i, h, e) => (z(i, h, "access private method"), e);
13
- var D = /* @__PURE__ */ ((i) => (i.PENDING = "pending", i.FULFILLED = "fulfilled", i.REJECTED = "rejected", i))(D || {}), m, v;
14
- const s = class extends Promise {
1
+ var T = Object.defineProperty;
2
+ var v = (g, f, e) => f in g ? T(g, f, { enumerable: !0, configurable: !0, writable: !0, value: e }) : g[f] = e;
3
+ var w = (g, f, e) => (v(g, typeof f != "symbol" ? f + "" : f, e), e);
4
+ class s extends Promise {
15
5
  constructor(e, t) {
16
- const r = t ? null : new AbortController(), n = t || r.signal, l = [], c = () => {
17
- for (const a of l)
18
- clearTimeout(a);
6
+ const r = t ? null : new AbortController(), n = t || r.signal, o = [], c = () => {
7
+ for (const l of o)
8
+ clearTimeout(l);
19
9
  };
20
- let o;
21
- const u = {
10
+ let i;
11
+ const d = {
22
12
  signal: n,
23
13
  cancel: () => {
24
- var a;
25
- return (a = this.controller) == null ? void 0 : a.abort();
14
+ var l;
15
+ return (l = this.controller) == null ? void 0 : l.abort();
26
16
  },
27
- onCancel: (a) => {
28
- o = a;
17
+ onCancel: (l) => {
18
+ i = l;
29
19
  },
30
- delay: (a, d) => new s((g) => {
31
- l.push(setTimeout(() => {
32
- g(a());
33
- }, d));
20
+ delay: (l, a) => new s((h) => {
21
+ o.push(setTimeout(() => {
22
+ h(l());
23
+ }, a));
34
24
  }, n),
35
- sleep: (a) => u.delay(() => {
36
- }, a),
37
- fetch: (a, d) => new s((g, S) => {
38
- fetch(a, { ...d || {}, signal: n }).then((b) => g(b)).catch((b) => {
39
- b.name !== "AbortError" && S(b);
25
+ sleep: (l) => d.delay(() => {
26
+ }, l),
27
+ fetch: (l, a) => new s((h, j) => {
28
+ fetch(l, { ...a || {}, signal: n }).then((y) => h(y)).catch((y) => {
29
+ y.name !== "AbortError" && j(y);
40
30
  });
41
31
  }, n),
42
- futurizable: (a) => new s((d, g) => {
43
- a.then(d).catch(g);
32
+ futurizable: (l) => new s((a, h) => {
33
+ l.then(a).catch(h);
44
34
  }, n)
45
35
  };
46
- let y = "pending";
47
- const T = new Promise((a, d) => {
36
+ let m = "pending";
37
+ const p = new Promise((l, a) => {
48
38
  if (n.aborted) {
49
- c(), y === "pending" && o && o();
39
+ c(), m === "pending" && i && i();
50
40
  return;
51
41
  } else {
52
- const g = typeof n.onabort == "function" ? n.onabort : () => {
42
+ const h = typeof n.onabort == "function" ? n.onabort : () => {
53
43
  };
54
44
  n.onabort = () => {
55
- g(), c(), y === "pending" && o && o();
56
- }, e((w) => {
57
- y = "fulfilled", a(w);
58
- }, (w) => {
59
- y = "rejected", d(w);
60
- }, u);
45
+ h(), c(), m === "pending" && i && i();
46
+ }, e((S) => {
47
+ m = "fulfilled", l(S);
48
+ }, (S) => {
49
+ m = "rejected", a(S);
50
+ }, d);
61
51
  }
62
52
  });
63
- super((a, d) => {
64
- T.then((g) => a(g)).catch(d);
53
+ super((l, a) => {
54
+ p.then((h) => l(h)).catch(a);
65
55
  });
66
- C(this, m);
67
- p(this, "controller");
68
- p(this, "internalSignal");
69
- p(this, "idsTimeout");
70
- this.controller = r, this.internalSignal = n, this.idsTimeout = l;
56
+ w(this, "controller");
57
+ w(this, "internalSignal");
58
+ w(this, "idsTimeout");
59
+ this.controller = r, this.internalSignal = n, this.idsTimeout = o;
71
60
  }
72
61
  static get [Symbol.species]() {
73
62
  return this;
@@ -81,37 +70,41 @@ const s = class extends Promise {
81
70
  get signal() {
82
71
  return this.internalSignal;
83
72
  }
73
+ clearTimeout() {
74
+ for (const e of this.idsTimeout)
75
+ clearTimeout(e);
76
+ }
84
77
  /**
85
78
  * Attaches callbacks for the resolution and/or rejection of the Futurable.
86
79
  */
87
80
  then(e, t) {
88
81
  let r, n;
89
- const l = new s((c, o) => {
90
- r = c, n = o;
82
+ const o = new s((c, i) => {
83
+ r = c, n = i;
91
84
  }, this.internalSignal);
92
- return l.controller = this.controller, super.then((c) => {
93
- var o;
94
- if ((o = this.internalSignal) != null && o.aborted) {
95
- j(this, m, v).call(this);
85
+ return o.controller = this.controller, super.then((c) => {
86
+ var i;
87
+ if ((i = this.internalSignal) != null && i.aborted) {
88
+ this.clearTimeout();
96
89
  return;
97
90
  }
98
91
  try {
99
92
  r(e ? e(c) : c);
100
- } catch (f) {
101
- n(f);
93
+ } catch (u) {
94
+ n(u);
102
95
  }
103
96
  }, (c) => {
104
- var o;
105
- if ((o = this.internalSignal) != null && o.aborted) {
106
- j(this, m, v).call(this);
97
+ var i;
98
+ if ((i = this.internalSignal) != null && i.aborted) {
99
+ this.clearTimeout();
107
100
  return;
108
101
  }
109
102
  try {
110
103
  t ? r(t(c)) : n(c);
111
- } catch (f) {
112
- n(f);
104
+ } catch (u) {
105
+ n(u);
113
106
  }
114
- }), l;
107
+ }), o;
115
108
  }
116
109
  /**
117
110
  * Attaches a callback for only the rejection of the Futurable.
@@ -146,17 +139,17 @@ const s = class extends Promise {
146
139
  */
147
140
  delay(e, t) {
148
141
  let r, n;
149
- const l = new s((c, o) => {
150
- r = c, n = o;
142
+ const o = new s((c, i) => {
143
+ r = c, n = i;
151
144
  }, this.internalSignal);
152
- return l.controller = this.controller, this.then(
145
+ return o.controller = this.controller, this.then(
153
146
  (c) => {
154
147
  this.idsTimeout.push(setTimeout(() => r(e(c)), t));
155
148
  },
156
149
  (c) => {
157
150
  n(c);
158
151
  }
159
- ), l;
152
+ ), o;
160
153
  }
161
154
  /**
162
155
  * Waits for timer parameter (in milliseconds) before returning the value.
@@ -172,15 +165,15 @@ const s = class extends Promise {
172
165
  */
173
166
  fetch(e, t) {
174
167
  let r, n;
175
- const l = new s((c, o) => {
176
- r = c, n = o;
168
+ const o = new s((c, i) => {
169
+ r = c, n = i;
177
170
  }, this.internalSignal);
178
- return l.controller = this.controller, this.then((c) => {
179
- const o = typeof e == "function" ? e(c) : e, f = { ...typeof t == "function" ? t(c) : t, signal: this.internalSignal };
180
- fetch(o, f).then((u) => r(u)).catch((u) => {
181
- u.name !== "AbortError" && n(u);
171
+ return o.controller = this.controller, this.then((c) => {
172
+ const i = typeof e == "function" ? e(c) : e, u = { ...typeof t == "function" ? t(c) : t, signal: this.internalSignal };
173
+ fetch(i, u).then((d) => r(d)).catch((d) => {
174
+ d.name !== "AbortError" && n(d);
182
175
  });
183
- }), l;
176
+ }), o;
184
177
  }
185
178
  /**
186
179
  * Executes the callback passed as a parameter when the futurable is cancelled.
@@ -188,12 +181,12 @@ const s = class extends Promise {
188
181
  */
189
182
  onCancel(e) {
190
183
  let t, r;
191
- const n = new s((l, c, o) => {
192
- o.onCancel(e), t = l, r = c;
184
+ const n = new s((o, c, i) => {
185
+ i.onCancel(e), t = o, r = c;
193
186
  }, this.internalSignal);
194
187
  return n.controller = this.controller, this.then(
195
- (l) => t(l),
196
- (l) => r(l)
188
+ (o) => t(o),
189
+ (o) => r(o)
197
190
  ), n;
198
191
  }
199
192
  // promisify<TResult1 = T, TResult2 = never>(): Promise<TResult1 | TResult2> {
@@ -215,11 +208,11 @@ const s = class extends Promise {
215
208
  */
216
209
  futurizable(e) {
217
210
  let t, r;
218
- const n = new s((l, c) => {
219
- t = l, r = c;
211
+ const n = new s((o, c) => {
212
+ t = o, r = c;
220
213
  }, this.internalSignal);
221
- return n.controller = this.controller, this.then((l) => {
222
- (typeof e == "function" ? e(l) : e).then(t).catch(r);
214
+ return n.controller = this.controller, this.then((o) => {
215
+ (typeof e == "function" ? e(o) : e).then(t).catch(r);
223
216
  }), n;
224
217
  }
225
218
  static resolve(e, t) {
@@ -232,15 +225,17 @@ const s = class extends Promise {
232
225
  * OnCancel static method. It accepts a callback or a object with cb property and an optional signal.
233
226
  */
234
227
  static onCancel({ cb: e, signal: t }) {
235
- return new s((r, n, l) => {
236
- l.onCancel(() => r(e()));
228
+ return new s((r, n, o) => {
229
+ o.onCancel(() => r(e()));
237
230
  }, t);
238
231
  }
239
232
  /**
240
233
  * Delay static method. It accepts a object with timer and cb properties and an optional signal property.
241
234
  */
242
235
  static delay({ cb: e, timer: t, signal: r }) {
243
- return s.resolve(!0, r).delay(e, t);
236
+ return new s((n, o, c) => {
237
+ c.delay(e, t).then(n);
238
+ }, r);
244
239
  }
245
240
  /**
246
241
  * Sleep static method. It accepts a timer or a object with timer property and an optional signal.
@@ -258,7 +253,9 @@ const s = class extends Promise {
258
253
  */
259
254
  static fetch(e, t) {
260
255
  const r = (t == null ? void 0 : t.signal) || void 0;
261
- return t != null && t.signal && delete t.signal, s.resolve(!0, r).fetch(e, t);
256
+ return t != null && t.signal && delete t.signal, new s((n, o, c) => {
257
+ c.fetch(e, t).then(n);
258
+ }, r);
262
259
  }
263
260
  /**
264
261
  * Futurizable static method.
@@ -269,40 +266,41 @@ const s = class extends Promise {
269
266
  }, t);
270
267
  }
271
268
  static handleIterables(e, t) {
272
- let r, n;
273
- const l = [], c = new s((o, f, u) => {
274
- r = o, n = f, u.onCancel(() => {
275
- for (const y of l)
276
- y.signal !== t && y.cancel();
269
+ const r = {
270
+ array: []
271
+ };
272
+ r.f = new s((n, o, c) => {
273
+ r.resolve = n, r.reject = o, c.onCancel(() => {
274
+ for (const i of r.array)
275
+ i.cancel();
277
276
  });
278
- }, t);
279
- t || (t = c.internalSignal);
280
- for (const o in e)
281
- e[o] instanceof s ? l.push(e[o]) : e[o] instanceof Promise ? l.push(new s((f, u) => {
282
- e[o].then(f).catch(u);
283
- }, t)) : l.push(s.resolve(e[o]));
284
- return { f: c, resolve: r, reject: n, array: l };
277
+ }, t), t || (t = r.f.internalSignal);
278
+ for (const n in e)
279
+ e[n] instanceof s ? r.array.push(e[n]) : e[n] instanceof Promise ? r.array.push(new s((o, c) => {
280
+ e[n].then((u) => o(u)).catch(c);
281
+ }, t)) : r.array.push(s.resolve(e[n], t));
282
+ return r;
285
283
  }
286
284
  /**
287
285
  * Creates a Futurable with cancellation support that is resolved with an array of results when all of the provided Futurables resolve, or rejected when any Futurable is rejected.
288
286
  */
289
287
  static all(e, t) {
290
- const { f: r, resolve: n, reject: l, array: c } = s.handleIterables(e, t);
291
- return super.all(c).then(n).catch(l), r;
288
+ const { f: r, resolve: n, reject: o, array: c } = s.handleIterables(e, t);
289
+ return super.all(c).then(n).catch(o), r;
292
290
  }
293
291
  /**
294
292
  * Creates a Futurable with cancellation support that is resolved with an array of results when all of the provided Futurables resolve or reject.
295
293
  */
296
294
  static allSettled(e, t) {
297
- const { f: r, resolve: n, reject: l, array: c } = s.handleIterables(e, t);
298
- return super.allSettled(c).then(n).catch(l), r;
295
+ const { f: r, resolve: n, reject: o, array: c } = s.handleIterables(e, t);
296
+ return super.allSettled(c).then(n).catch(o), r;
299
297
  }
300
298
  /**
301
299
  * Creates a Futurable with cancellation support that is resolved or rejected when any of the provided Futurables are resolved or rejected.
302
300
  */
303
301
  static race(e, t) {
304
- const { f: r, resolve: n, reject: l, array: c } = s.handleIterables(e, t);
305
- return super.race(c).then(n).catch(l), r;
302
+ const { f: r, resolve: n, reject: o, array: c } = s.handleIterables(e, t);
303
+ return super.race(c).then(n).catch(o), r;
306
304
  }
307
305
  /**
308
306
  * The any function returns a futurable with cancellation support that is fulfilled by the first given futurable to be fulfilled,
@@ -311,16 +309,10 @@ const s = class extends Promise {
311
309
  * it runs this algorithm.
312
310
  */
313
311
  static any(e, t) {
314
- const { f: r, resolve: n, reject: l, array: c } = s.handleIterables(e, t);
315
- return super.any(c).then(n).catch(l), r;
312
+ const { f: r, resolve: n, reject: o, array: c } = s.handleIterables(e, t);
313
+ return super.any(c).then(n).catch(o), r;
316
314
  }
317
- };
318
- let I = s;
319
- m = new WeakSet(), v = function() {
320
- for (const e of this.idsTimeout)
321
- clearTimeout(e);
322
- };
315
+ }
323
316
  export {
324
- D as FUTURABLE_STATUS,
325
- I as Futurable
317
+ s as Futurable
326
318
  };
package/dist/index.d.ts CHANGED
@@ -49,17 +49,11 @@ export type FuturableExecutor<T> = (resolve: FuturableResolve<T>, reject: Futura
49
49
  * Object containing implemented functionalities.
50
50
  */
51
51
  utils: FuturableUtils<T>) => void;
52
- export type FuturableIterable = Futurable<any> | Promise<any> | any;
52
+ export type FuturableIterable<T = any> = Futurable<T> | Promise<T> | T;
53
53
  export interface FuturableLike<T> {
54
54
  then<TResult1 = T, TResult2 = never>(onfulfilled?: FuturableOnfulfilled<TResult1, TResult2>, onrejected?: FuturableOnrejected<TResult2>): FuturableLike<TResult1 | TResult2>;
55
55
  }
56
- export declare enum FUTURABLE_STATUS {
57
- PENDING = "pending",
58
- FULFILLED = "fulfilled",
59
- REJECTED = "rejected"
60
- }
61
56
  export declare class Futurable<T> extends Promise<T> {
62
- #private;
63
57
  private controller;
64
58
  private internalSignal;
65
59
  private idsTimeout;
@@ -70,6 +64,7 @@ export declare class Futurable<T> extends Promise<T> {
70
64
  * Return internal futurable signal
71
65
  */
72
66
  get signal(): AbortSignal;
67
+ private clearTimeout;
73
68
  /**
74
69
  * Attaches callbacks for the resolution and/or rejection of the Futurable.
75
70
  */
@@ -107,40 +102,40 @@ export declare class Futurable<T> extends Promise<T> {
107
102
  * Executes the callback passed as a parameter when the futurable is cancelled.
108
103
  * @param cb: callback
109
104
  */
110
- onCancel<TResult1 = T, TResult2 = never>(cb: () => void): Futurable<TResult1 | TResult2>;
105
+ onCancel<TResult1 = void, TResult2 = never>(cb: () => void): Futurable<TResult1 | TResult2>;
111
106
  /**
112
107
  * Takes a promise and transforms it into a futurizable. Promise can be also a function that receives value from futurable chaining as parameter.
113
108
  * @param promise: Promise to futurize or function that return promise with futurable chaining value as parameter
114
109
  */
115
- futurizable<TResult1 = T, TResult2 = never>(promise: Promise<TResult1> | ((val?: TResult1) => Promise<TResult1>)): Futurable<TResult1 | TResult2>;
116
- static resolve(value?: any, signal?: AbortSignal): Futurable<any>;
117
- static reject(reason?: any, signal?: AbortSignal): Futurable<any>;
110
+ futurizable<TResult1 = any, TResult2 = never>(promise: Promise<TResult1> | ((val?: TResult1) => Promise<TResult1>)): Futurable<TResult1 | TResult2>;
111
+ static resolve<T = any, TResult2 = never>(value?: T, signal?: AbortSignal): Futurable<T | TResult2>;
112
+ static reject<T = any, TResult2 = never>(reason?: T, signal?: AbortSignal): Futurable<T | TResult2>;
118
113
  /**
119
114
  * OnCancel static method. It accepts a callback or a object with cb property and an optional signal.
120
115
  */
121
- static onCancel({ cb, signal }: {
122
- cb: () => void;
116
+ static onCancel<T = void>({ cb, signal }: {
117
+ cb: () => T;
123
118
  signal?: AbortSignal;
124
- }): Futurable<any>;
119
+ }): Futurable<T>;
125
120
  /**
126
121
  * Delay static method. It accepts a object with timer and cb properties and an optional signal property.
127
122
  */
128
- static delay({ cb, timer, signal }: {
123
+ static delay<T = any, TResult2 = never>({ cb, timer, signal }: {
129
124
  cb: () => any;
130
125
  timer: number;
131
126
  signal?: AbortSignal;
132
- }): Futurable<any>;
127
+ }): Futurable<T | TResult2>;
133
128
  /**
134
129
  * Sleep static method. It accepts a timer or a object with timer property and an optional signal.
135
130
  */
136
- static sleep({ timer, signal }: {
131
+ static sleep<T = any, TResult2 = never>({ timer, signal }: {
137
132
  timer: number;
138
133
  signal?: AbortSignal;
139
- }): Futurable<any>;
134
+ }): Futurable<T | TResult2>;
140
135
  /**
141
136
  * Fetch static method.
142
137
  */
143
- static fetch(url: string, opts?: RequestInit): Futurable<any>;
138
+ static fetch<T = any, TResult2 = never>(url: string, opts?: RequestInit): Futurable<T | TResult2>;
144
139
  /**
145
140
  * Futurizable static method.
146
141
  */
@@ -152,21 +147,29 @@ export declare class Futurable<T> extends Promise<T> {
152
147
  /**
153
148
  * Creates a Futurable with cancellation support that is resolved with an array of results when all of the provided Futurables resolve, or rejected when any Futurable is rejected.
154
149
  */
155
- static all(iterables: FuturableIterable[], signal?: AbortSignal): Futurable<any>;
150
+ static all<T extends readonly unknown[] | []>(iterables: FuturableIterable[], signal?: AbortSignal): Futurable<{
151
+ -readonly [P in keyof T]: Awaited<T[P]>;
152
+ }>;
156
153
  /**
157
154
  * Creates a Futurable with cancellation support that is resolved with an array of results when all of the provided Futurables resolve or reject.
158
155
  */
159
- static allSettled(iterables: FuturableIterable[], signal?: AbortSignal): Futurable<any>;
156
+ static allSettled<T extends readonly unknown[] | []>(iterables: FuturableIterable[], signal?: AbortSignal): Futurable<{
157
+ -readonly [P in keyof T]: Awaited<T[P]>;
158
+ }>;
160
159
  /**
161
160
  * Creates a Futurable with cancellation support that is resolved or rejected when any of the provided Futurables are resolved or rejected.
162
161
  */
163
- static race(iterables: FuturableIterable[], signal?: AbortSignal): Futurable<any>;
162
+ static race<T extends readonly unknown[] | []>(iterables: FuturableIterable[], signal?: AbortSignal): Futurable<{
163
+ -readonly [P in keyof T]: Awaited<T[P]>;
164
+ }>;
164
165
  /**
165
166
  * The any function returns a futurable with cancellation support that is fulfilled by the first given futurable to be fulfilled,
166
167
  * or rejected with an AggregateError containing an array of rejection reasons if all of the
167
168
  * given futurables are rejected. It resolves all elements of the passed iterable to futurables as
168
169
  * it runs this algorithm.
169
170
  */
170
- static any(iterables: FuturableIterable[], signal?: AbortSignal): Futurable<any>;
171
+ static any<T extends readonly unknown[] | []>(iterables: FuturableIterable[], signal?: AbortSignal): Futurable<{
172
+ -readonly [P in keyof T]: Awaited<T[P]>;
173
+ }>;
171
174
  }
172
175
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,oBAAoB,CAAC,CAAC,EAAE,QAAQ,GAAG,KAAK,IAAI,CAAC,CAAC,KAAK,EAAE,GAAG,KAAK,CAAC,GAAG,QAAQ,GAAG,aAA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,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;KAAE,CAAC;CAO3J"}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@ndriadev/futurable",
3
3
  "description": "Extension Javascript's Promise API with more functionalities",
4
4
  "private": false,
5
- "version": "1.0.8",
5
+ "version": "1.1.0",
6
6
  "type": "module",
7
7
  "engines": {
8
8
  "node": ">=16.13.2"