@voltro/integration-http 0.83.1 → 0.85.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/CHANGELOG.md +1191 -0
- package/dist/index.js +18 -17
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -25,27 +25,28 @@ var r = /* @__PURE__ */ new Set([
|
|
|
25
25
|
retryMethods: i,
|
|
26
26
|
retryBudget: a
|
|
27
27
|
}, s = /* @__PURE__ */ new Map(), c = (e, t, n) => {
|
|
28
|
-
let r = t - n
|
|
29
|
-
for (;
|
|
30
|
-
|
|
28
|
+
let r = t - n;
|
|
29
|
+
for (; e.head < e.events.length && e.events[e.head][0] < r;) e.events[e.head][1] === 0 ? --e.requests : --e.retries, e.head += 1;
|
|
30
|
+
e.head > 0 && e.head * 2 >= e.events.length && (e.events = e.events.slice(e.head), e.head = 0);
|
|
31
31
|
}, l = (e) => {
|
|
32
32
|
let t = s.get(e);
|
|
33
|
-
return t === void 0 && (t = {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
33
|
+
return t === void 0 && (t = {
|
|
34
|
+
events: [],
|
|
35
|
+
head: 0,
|
|
36
|
+
requests: 0,
|
|
37
|
+
retries: 0
|
|
38
|
+
}, s.set(e, t)), t;
|
|
39
|
+
}, u = (e) => ({
|
|
40
|
+
requests: e.requests,
|
|
41
|
+
retries: e.retries
|
|
42
|
+
}), d = (e, t, n) => {
|
|
42
43
|
let r = l(e);
|
|
43
|
-
c(r, t, n.windowMs), r.events.push([t, 0]);
|
|
44
|
+
c(r, t, n.windowMs), r.events.push([t, 0]), r.requests += 1;
|
|
44
45
|
}, f = n.counter("voltro_http_retries_total"), p = n.counter("voltro_http_retry_budget_exhausted_total"), m = (e, r, i) => {
|
|
45
46
|
let a = l(e);
|
|
46
47
|
c(a, r, i.windowMs);
|
|
47
48
|
let { requests: o, retries: s } = u(a);
|
|
48
|
-
return s >= Math.max(i.minRetriesPerWindow, Math.floor(o * i.ratio)) ? (t.runSync(n.
|
|
49
|
+
return s >= Math.max(i.minRetriesPerWindow, Math.floor(o * i.ratio)) ? (t.runSync(n.update(n.withAttributes(p, { host: e }), 1)), !1) : (a.events.push([r, 1]), a.retries += 1, t.runSync(n.update(n.withAttributes(f, { host: e }), 1)), !0);
|
|
49
50
|
}, h = (e, t = Date.now(), n = a.windowMs) => {
|
|
50
51
|
let r = s.get(e);
|
|
51
52
|
return r === void 0 ? {
|
|
@@ -124,9 +125,9 @@ var r = /* @__PURE__ */ new Set([
|
|
|
124
125
|
message: `network error: ${String(e)}`,
|
|
125
126
|
retryAfterMs: null
|
|
126
127
|
}
|
|
127
|
-
}).pipe(t.
|
|
128
|
+
}).pipe(t.timeoutOrElse({
|
|
128
129
|
duration: e.millis(p.timeoutMs),
|
|
129
|
-
|
|
130
|
+
orElse: () => t.fail({
|
|
130
131
|
_transient: !0,
|
|
131
132
|
message: `request timed out after ${p.timeoutMs}ms`,
|
|
132
133
|
retryAfterMs: null
|
|
@@ -141,7 +142,7 @@ var r = /* @__PURE__ */ new Set([
|
|
|
141
142
|
message: `${e.message} (not retried: ${n})`,
|
|
142
143
|
transient: !0,
|
|
143
144
|
...e.status === void 0 ? {} : { status: e.status }
|
|
144
|
-
})), D = (n) => x.pipe(t.
|
|
145
|
+
})), D = (n) => x.pipe(t.catch((r) => {
|
|
145
146
|
if (S(r) && n < p.maxAttempts && !C) return E(r, `${c} is not idempotent — pass \`retry: true\` for a call you have made so`);
|
|
146
147
|
if (S(r) && n < p.maxAttempts && w !== !1 && !m(T, g(), w)) return E(r, `the retry budget for ${T} is exhausted`);
|
|
147
148
|
if (S(r) && n < p.maxAttempts) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voltro/integration-http",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.85.0",
|
|
4
4
|
"description": "Server-side HTTP transport core for integration plugins: token auth, transient retry with Retry-After, per-request timeout, and an SSRF host-allowlist guard — over an injectable fetch seam, Effect-first with typed errors.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"voltro",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"node": ">=24.0.0"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"effect": "
|
|
36
|
+
"effect": "4.0.1"
|
|
37
37
|
},
|
|
38
38
|
"publishConfig": {
|
|
39
39
|
"access": "public"
|