@vielzeug/flux 26.11.5 → 26.11.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_iterator.js +1 -2
- package/dist/_link.js +1 -2
- package/dist/_numeric.js +1 -2
- package/dist/_safe.js +1 -2
- package/dist/_scheduler.js +1 -2
- package/dist/_subscription.js +1 -2
- package/dist/async.js +1 -2
- package/dist/channel.js +1 -2
- package/dist/core.js +1 -2
- package/dist/errors.js +1 -2
- package/dist/flux.cjs.map +1 -1
- package/dist/flux.iife.js.map +1 -1
- package/dist/flux.js +17 -34
- package/dist/flux.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +5 -5
- package/dist/operators/combination.cjs +1 -1
- package/dist/operators/combination.cjs.map +1 -1
- package/dist/operators/combination.js +21 -22
- package/dist/operators/creation.cjs +1 -1
- package/dist/operators/creation.cjs.map +1 -1
- package/dist/operators/creation.js +23 -24
- package/dist/operators/filtering.cjs +1 -1
- package/dist/operators/filtering.cjs.map +1 -1
- package/dist/operators/filtering.js +46 -47
- package/dist/operators/transformation.cjs +1 -1
- package/dist/operators/transformation.cjs.map +1 -1
- package/dist/operators/transformation.js +56 -57
- package/dist/operators/utility.cjs +1 -1
- package/dist/operators/utility.cjs.map +1 -1
- package/dist/operators/utility.js +52 -53
- package/dist/pipe.js +1 -2
- package/package.json +8 -8
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { link as e } from "../_link.js";
|
|
2
|
+
import { assertDuration as t, assertNonNegativeInteger as n } from "../_numeric.js";
|
|
3
|
+
import { tryCall as r } from "../_safe.js";
|
|
4
|
+
import { defaultScheduler as i } from "../_scheduler.js";
|
|
5
|
+
import { stream as a } from "../core.js";
|
|
6
|
+
import { FluxCapacityError as o, FluxEmptyError as s } from "../errors.js";
|
|
7
7
|
import { abortError as c } from "@vielzeug/arsenal";
|
|
8
|
-
|
|
9
|
-
function retry(
|
|
10
|
-
return
|
|
8
|
+
// src/operators/utility.ts
|
|
9
|
+
function retry(o) {
|
|
10
|
+
return n(o.times, "retry times"), (n) => a((a, s) => {
|
|
11
11
|
let c = 0, l, u, start = () => {
|
|
12
|
-
if (
|
|
13
|
-
let d =
|
|
14
|
-
complete:
|
|
15
|
-
error(
|
|
16
|
-
if (c ===
|
|
17
|
-
|
|
12
|
+
if (s.aborted) return;
|
|
13
|
+
let d = e(n, {
|
|
14
|
+
complete: a.complete,
|
|
15
|
+
error(e) {
|
|
16
|
+
if (c === o.times) {
|
|
17
|
+
a.error(e);
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
|
-
let
|
|
21
|
-
if (
|
|
22
|
-
l = typeof
|
|
23
|
-
},
|
|
20
|
+
let n = c++, l;
|
|
21
|
+
if (r(() => {
|
|
22
|
+
l = typeof o.delay == "function" ? o.delay(n) : o.delay;
|
|
23
|
+
}, a.error), !s.aborted) {
|
|
24
24
|
if (l !== void 0) try {
|
|
25
|
-
|
|
25
|
+
t(l, "Retry delay");
|
|
26
26
|
} catch (e) {
|
|
27
|
-
|
|
27
|
+
a.error(e);
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
|
-
l === void 0 || l === 0 ? queueMicrotask(start) : u =
|
|
30
|
+
l === void 0 || l === 0 ? queueMicrotask(start) : u = i.delay(start, l);
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
|
-
next:
|
|
34
|
-
},
|
|
33
|
+
next: a.next
|
|
34
|
+
}, s);
|
|
35
35
|
d.closed || (l = d);
|
|
36
36
|
};
|
|
37
37
|
return start(), () => {
|
|
@@ -39,66 +39,65 @@ function retry(n) {
|
|
|
39
39
|
};
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
|
-
function first(
|
|
43
|
-
return new Promise((
|
|
44
|
-
let
|
|
45
|
-
|
|
42
|
+
function first(t, n) {
|
|
43
|
+
return new Promise((r, i) => {
|
|
44
|
+
let a = new AbortController(), abort = () => {
|
|
45
|
+
a.abort(), i(c(n?.signal, "Stream consumption aborted"));
|
|
46
46
|
};
|
|
47
|
-
|
|
47
|
+
n?.signal?.aborted ? abort() : (n?.signal?.addEventListener("abort", abort, { once: !0 }), e(t, {
|
|
48
48
|
complete() {
|
|
49
|
-
|
|
49
|
+
n?.signal?.removeEventListener("abort", abort), "defaultValue" in (n ?? {}) ? r(n.defaultValue) : i(new s());
|
|
50
50
|
},
|
|
51
51
|
error(e) {
|
|
52
|
-
|
|
52
|
+
n?.signal?.removeEventListener("abort", abort), i(e);
|
|
53
53
|
},
|
|
54
54
|
next(e) {
|
|
55
|
-
|
|
55
|
+
n?.signal?.removeEventListener("abort", abort), a.abort(), r(e);
|
|
56
56
|
}
|
|
57
|
-
},
|
|
57
|
+
}, a.signal));
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
|
-
function last(
|
|
61
|
-
return new Promise((
|
|
62
|
-
let
|
|
63
|
-
|
|
60
|
+
function last(t, n) {
|
|
61
|
+
return new Promise((r, i) => {
|
|
62
|
+
let a = new AbortController(), abort = () => {
|
|
63
|
+
a.abort(), i(c(n?.signal, "Stream consumption aborted"));
|
|
64
64
|
};
|
|
65
|
-
if (
|
|
65
|
+
if (n?.signal?.aborted) {
|
|
66
66
|
abort();
|
|
67
67
|
return;
|
|
68
68
|
}
|
|
69
|
-
let
|
|
70
|
-
|
|
69
|
+
let o = !1, l;
|
|
70
|
+
n?.signal?.addEventListener("abort", abort, { once: !0 }), e(t, {
|
|
71
71
|
complete() {
|
|
72
|
-
|
|
72
|
+
n?.signal?.removeEventListener("abort", abort), o ? r(l) : "defaultValue" in (n ?? {}) ? r(n.defaultValue) : i(new s());
|
|
73
73
|
},
|
|
74
74
|
error(e) {
|
|
75
|
-
|
|
75
|
+
n?.signal?.removeEventListener("abort", abort), i(e);
|
|
76
76
|
},
|
|
77
77
|
next(e) {
|
|
78
|
-
|
|
78
|
+
o = !0, l = e;
|
|
79
79
|
}
|
|
80
|
-
},
|
|
80
|
+
}, a.signal);
|
|
81
81
|
});
|
|
82
82
|
}
|
|
83
|
-
function toArray(
|
|
84
|
-
return
|
|
85
|
-
let
|
|
86
|
-
|
|
83
|
+
function toArray(t, r) {
|
|
84
|
+
return n(r.maxItems, "toArray maxItems"), new Promise((n, i) => {
|
|
85
|
+
let a = new AbortController(), s = [], abort = () => {
|
|
86
|
+
a.abort(), i(c(r?.signal, "Stream consumption aborted"));
|
|
87
87
|
};
|
|
88
|
-
r.signal?.aborted ? abort() : (r.signal?.addEventListener("abort", abort, { once: !0 }),
|
|
88
|
+
r.signal?.aborted ? abort() : (r.signal?.addEventListener("abort", abort, { once: !0 }), e(t, {
|
|
89
89
|
complete() {
|
|
90
|
-
r.signal?.removeEventListener("abort", abort),
|
|
90
|
+
r.signal?.removeEventListener("abort", abort), n(s);
|
|
91
91
|
},
|
|
92
92
|
error(e) {
|
|
93
93
|
r.signal?.removeEventListener("abort", abort), i(e);
|
|
94
94
|
},
|
|
95
95
|
next(e) {
|
|
96
|
-
s.length === r.maxItems ? (r.signal?.removeEventListener("abort", abort),
|
|
96
|
+
s.length === r.maxItems ? (r.signal?.removeEventListener("abort", abort), a.abort(), i(new o(r.maxItems, "toArray maxItems exceeded"))) : s.push(e);
|
|
97
97
|
}
|
|
98
|
-
},
|
|
98
|
+
}, a.signal));
|
|
99
99
|
});
|
|
100
100
|
}
|
|
101
|
-
//#endregion
|
|
102
101
|
export { first, last, retry, toArray };
|
|
103
102
|
|
|
104
103
|
//# sourceMappingURL=utility.js.map
|
package/dist/pipe.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vielzeug/flux",
|
|
3
|
-
"version": "26.11.
|
|
3
|
+
"version": "26.11.6",
|
|
4
4
|
"description": "Minimal push streams with explicit ownership, bounded buffering, and structural bridges",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -43,23 +43,23 @@
|
|
|
43
43
|
"registry": "https://registry.npmjs.org/"
|
|
44
44
|
},
|
|
45
45
|
"scripts": {
|
|
46
|
-
"build": "vite build &&
|
|
46
|
+
"build": "vite build && bun run --silent build:bundle && bun run --silent build:types && bun run --silent test:types && bun run --silent verify:exports",
|
|
47
47
|
"build:bundle": "vite build --config vite.bundle.config.ts",
|
|
48
48
|
"build:types": "tsc -p tsconfig.declarations.json",
|
|
49
49
|
"fix": "biome check --write src",
|
|
50
50
|
"lint": "biome ci src",
|
|
51
|
-
"prepublishOnly": "
|
|
51
|
+
"prepublishOnly": "bun run --silent build",
|
|
52
52
|
"test": "vitest",
|
|
53
53
|
"test:types": "tsc -p tsconfig.type-tests.json",
|
|
54
|
-
"verify:exports": "
|
|
54
|
+
"verify:exports": "bun scripts/verify-exports.mjs && bun scripts/verify-package-exports.mjs"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@vielzeug/arsenal": "26.11.
|
|
57
|
+
"@vielzeug/arsenal": "26.11.6"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@types/node": "^26.6.
|
|
60
|
+
"@types/node": "^26.6.6",
|
|
61
61
|
"typescript": "^6.0.3",
|
|
62
|
-
"vite": "^8.3.
|
|
63
|
-
"vitest": "^5.0
|
|
62
|
+
"vite": "^8.3.6",
|
|
63
|
+
"vitest": "^5.1.0"
|
|
64
64
|
}
|
|
65
65
|
}
|