Comparing version 0.0.34 to 0.0.35
@@ -0,1 +1,3 @@ | ||
import { Option as Option_2 } from '@mobily/ts-belt'; | ||
declare type AbortControllerGroup = { | ||
@@ -347,2 +349,4 @@ controllers: Set<AbortController>; | ||
export declare type XXX = Option_2<''>; | ||
export { } |
112
dist/adnf.js
@@ -1,2 +0,2 @@ | ||
const C = (e) => "File" in window && e instanceof File, H = (e) => e instanceof FormData, D = (e) => { | ||
const $ = (e) => "File" in window && e instanceof File, G = (e) => e instanceof FormData, C = (e) => { | ||
const t = new FormData(); | ||
@@ -9,5 +9,5 @@ return Object.entries(e).forEach(([n, r]) => { | ||
return t.set(n, `${r}`); | ||
if (C(r)) | ||
if ($(r)) | ||
return t.set(n, r); | ||
if (Array.isArray(r) && r.length && r.every((o) => C(o))) | ||
if (Array.isArray(r) && r.length && r.every((o) => $(o))) | ||
return r.forEach((o) => t.append(`${n}[]`, o)); | ||
@@ -24,3 +24,3 @@ if (typeof r == "object" && r !== null || Array.isArray(r)) { | ||
}), t; | ||
}, _ = (e, t) => { | ||
}, D = (e, t) => { | ||
e.addEventListener( | ||
@@ -52,6 +52,6 @@ "abort", | ||
}), r; | ||
}, J = (e, t, n = !1) => { | ||
}, U = (e, t, n = !1) => { | ||
const r = new URL(e, "https://developer.mozilla.org"), o = Object.fromEntries(r.searchParams), i = Object.fromEntries(new URLSearchParams(t)), u = n ? i : { ...o, ...i }, s = Object.entries(u).toSorted(([d], [y]) => d.localeCompare(y)), f = new URLSearchParams(s).toString(), c = f ? `?${f}` : ""; | ||
return !e || e.startsWith("?") ? c : q(e) ? `${r.origin}${r.pathname}${c}` : `${r.pathname}${c}`; | ||
}, g = (e) => (Array.isArray(e) ? e : [e]).join("/"), q = (e) => { | ||
return !e || e.startsWith("?") ? c : H(e) ? `${r.origin}${r.pathname}${c}` : `${r.pathname}${c}`; | ||
}, g = (e) => (Array.isArray(e) ? e : [e]).join("/"), H = (e) => { | ||
try { | ||
@@ -62,7 +62,7 @@ return !!new URL(e); | ||
} | ||
}, z = (e) => e == null, B = (e) => { | ||
if (z(e)) | ||
}, q = (e) => e == null, z = (e) => { | ||
if (q(e)) | ||
throw new Error("Non-nullable assertion failed"); | ||
return e; | ||
}, L = (e) => ({ | ||
}, _ = (e) => ({ | ||
ok: !0, | ||
@@ -77,5 +77,5 @@ value: e, | ||
log: () => void console.log(e), | ||
notNullable: () => B(e) | ||
}), m = Object.assign(L, { | ||
Ok: L, | ||
notNullable: () => z(e) | ||
}), m = Object.assign(_, { | ||
Ok: _, | ||
Except: (e, t = new Error("Result.Except: No error provided")) => { | ||
@@ -100,3 +100,3 @@ const n = () => void console.error({ type: e, error: t, message: t == null ? void 0 : t.message }); | ||
} | ||
}), V = (e) => { | ||
}), B = (e) => { | ||
try { | ||
@@ -107,3 +107,3 @@ return m.Ok(e()); | ||
} | ||
}, j = (e) => e instanceof Error, Y = (e, t) => Object.assign(W(e, t), { key: e }), W = async (e, t) => { | ||
}, j = (e) => e instanceof Error, Q = (e, t) => Object.assign(V(e, t), { key: e }), V = async (e, t) => { | ||
const { | ||
@@ -124,3 +124,3 @@ strict: n = !0, | ||
timeout: S, | ||
unwrap: Q, | ||
unwrap: K, | ||
...l | ||
@@ -147,7 +147,7 @@ } = t ?? {}; | ||
} | ||
if (l.signal && _(l.signal, h), l.signal = h.signal, u) { | ||
if (l.signal && D(l.signal, h), l.signal = h.signal, u) { | ||
const a = u.add(); | ||
_(a.signal, h); | ||
D(a.signal, h); | ||
} | ||
const N = typeof S == "number" ? setTimeout(() => h.abort(U), S) : null; | ||
const N = typeof S == "number" ? setTimeout(() => h.abort(L), S) : null; | ||
if (c && (l.body = f(c), b({ | ||
@@ -158,10 +158,10 @@ "Content-Type": "application/json" | ||
throw new Error("Fetch provided multiple values for body. Pick data, files or form."); | ||
d && (l.body = H(d) ? d : D(d)), E && (l.body = D(E)); | ||
d && (l.body = G(d) ? d : C(d)), E && (l.body = C(E)); | ||
} | ||
const M = J(e, y ?? {}); | ||
const J = U(e, y ?? {}); | ||
try { | ||
const a = await o(M, l), F = a.ok; | ||
const a = await o(J, l), F = a.ok; | ||
N && clearTimeout(N); | ||
const O = a.headers.get("content-type"), k = O == null ? void 0 : O.includes("application/json"), G = a.status === 200; | ||
if (n && G && !k) | ||
const O = a.headers.get("content-type"), k = O == null ? void 0 : O.includes("application/json"), M = a.status === 200; | ||
if (n && M && !k) | ||
return R({ | ||
@@ -172,10 +172,10 @@ response: a, | ||
}); | ||
const T = await a.text(), A = k ? p(T) : T; | ||
const A = k ? p(await a.text()) : null; | ||
if (F) | ||
return X({ | ||
return W({ | ||
value: A, | ||
response: a | ||
}); | ||
const $ = A; | ||
return R(n && !$ ? { | ||
const T = A; | ||
return R(n && !T ? { | ||
response: a, | ||
@@ -186,7 +186,7 @@ except: null, | ||
response: a, | ||
except: $, | ||
except: T, | ||
error: new Error("Fetch response Except") | ||
}); | ||
} catch (a) { | ||
const F = h.signal.aborted && h.signal.reason === U; | ||
const F = h.signal.aborted && h.signal.reason === L; | ||
return w({ | ||
@@ -205,3 +205,3 @@ error: a, | ||
} | ||
}, X = (e) => Object.assign(m.Ok(e.value), { | ||
}, W = (e) => Object.assign(m.Ok(e.value), { | ||
aborted: !1, | ||
@@ -224,3 +224,3 @@ timeout: !1, | ||
}); | ||
}, U = Symbol("Timeout"), Z = async (e, t) => (console.log( | ||
}, L = Symbol("Timeout"), Y = async (e, t) => (console.log( | ||
"%c🐕 " + ((t == null ? void 0 : t.method) || "GET").toUpperCase(), | ||
@@ -234,3 +234,3 @@ "background: #85ce47; border-radius: 999px; font-weight: 600; padding: 1.5px 5.5px; color: black", | ||
response: new Response() | ||
})), ee = async (e, t) => Object.assign(m.Ok({}), { | ||
})), Z = async (e, t) => Object.assign(m.Ok({}), { | ||
aborted: !1, | ||
@@ -253,10 +253,10 @@ timeout: !1, | ||
}); | ||
}, v = (e, t) => P(e, (n) => (r, o) => { | ||
}, X = (e, t) => P(e, (n) => (r, o) => { | ||
const i = typeof t == "function" ? t(o) : t; | ||
return n(r, x(o, i)); | ||
}), I = (e, t) => P(e, (n) => (r, o) => (r = g(r), n( | ||
}), v = (e, t) => P(e, (n) => (r, o) => (r = g(r), n( | ||
typeof t == "function" ? t(r) : r + g(t), | ||
o | ||
))), te = (e, t) => I(e, (n) => t + n), re = (e) => { | ||
const t = (n) => v(e, { method: n }); | ||
))), ee = (e, t) => v(e, (n) => t + n), te = (e) => { | ||
const t = (n) => X(e, { method: n }); | ||
return { | ||
@@ -272,9 +272,9 @@ method: t, | ||
}; | ||
}, ne = (e) => (t, n) => { | ||
}, re = (e) => (t, n) => { | ||
t = g(t); | ||
const r = K(t, typeof n == "function" ? {} : n); | ||
const r = I(t, typeof n == "function" ? {} : n); | ||
return { | ||
key: r, | ||
fetch: (i, u) => { | ||
const s = V( | ||
const s = B( | ||
() => typeof n == "function" ? n(i) : n | ||
@@ -289,3 +289,3 @@ ); | ||
}; | ||
}, K = (e, t) => J(e, (t == null ? void 0 : t.params) ?? {}), oe = () => { | ||
}, I = (e, t) => U(e, (t == null ? void 0 : t.params) ?? {}), ne = () => { | ||
const e = /* @__PURE__ */ new Set(); | ||
@@ -302,23 +302,23 @@ return { | ||
}; | ||
}, se = (e) => (t, n) => e(t, n).then((r) => r.unwrap()); | ||
}, oe = (e) => (t, n) => e(t, n).then((r) => r.unwrap()); | ||
export { | ||
R as Except, | ||
w as NoResponse, | ||
X as Ok, | ||
W as Ok, | ||
m as Result, | ||
oe as createAbortGroup, | ||
Z as debugFetch, | ||
Y as fetch, | ||
ne as createAbortGroup, | ||
Y as debugFetch, | ||
Q as fetch, | ||
x as mergeOptions, | ||
J as params, | ||
J as respectParams, | ||
Y as resultFetch, | ||
se as unwrap, | ||
ee as voidFetch, | ||
te as withBase, | ||
ne as withDeclarations, | ||
re as withMethods, | ||
U as params, | ||
U as respectParams, | ||
Q as resultFetch, | ||
oe as unwrap, | ||
Z as voidFetch, | ||
ee as withBase, | ||
re as withDeclarations, | ||
te as withMethods, | ||
P as withMiddleware, | ||
v as withOptions, | ||
I as withResource | ||
X as withOptions, | ||
v as withResource | ||
}; |
{ | ||
"name": "adnf", | ||
"version": "0.0.34", | ||
"version": "0.0.35", | ||
"type": "module", | ||
@@ -26,2 +26,3 @@ "files": [ | ||
"dependencies": { | ||
"@mobily/ts-belt": "^3.13.1", | ||
"stable-hash": "^0.0.4" | ||
@@ -28,0 +29,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
43262
657
2
+ Added@mobily/ts-belt@^3.13.1
+ Added@mobily/ts-belt@3.13.1(transitive)