@neetru/sdk 1.1.0 → 1.1.1
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/auth.cjs +7 -1
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.mjs +7 -1
- package/dist/auth.mjs.map +1 -1
- package/dist/catalog.cjs +4 -0
- package/dist/catalog.cjs.map +1 -1
- package/dist/catalog.mjs +4 -0
- package/dist/catalog.mjs.map +1 -1
- package/dist/checkout.cjs +4 -0
- package/dist/checkout.cjs.map +1 -1
- package/dist/checkout.mjs +4 -0
- package/dist/checkout.mjs.map +1 -1
- package/dist/db.cjs +4 -0
- package/dist/db.cjs.map +1 -1
- package/dist/db.mjs +4 -0
- package/dist/db.mjs.map +1 -1
- package/dist/entitlements.cjs +4 -0
- package/dist/entitlements.cjs.map +1 -1
- package/dist/entitlements.mjs +4 -0
- package/dist/entitlements.mjs.map +1 -1
- package/dist/index.cjs +7 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +7 -1
- package/dist/index.mjs.map +1 -1
- package/dist/support.cjs +4 -0
- package/dist/support.cjs.map +1 -1
- package/dist/support.mjs +4 -0
- package/dist/support.mjs.map +1 -1
- package/dist/telemetry.cjs +4 -0
- package/dist/telemetry.cjs.map +1 -1
- package/dist/telemetry.mjs +4 -0
- package/dist/telemetry.mjs.map +1 -1
- package/dist/usage.cjs +4 -0
- package/dist/usage.cjs.map +1 -1
- package/dist/usage.mjs +4 -0
- package/dist/usage.mjs.map +1 -1
- package/package.json +11 -5
package/dist/auth.mjs
CHANGED
|
@@ -68,10 +68,14 @@ async function httpRequest(config, opts) {
|
|
|
68
68
|
headers["content-type"] = "application/json";
|
|
69
69
|
init.body = JSON.stringify(opts.body);
|
|
70
70
|
}
|
|
71
|
+
init.signal = AbortSignal.timeout(3e4);
|
|
71
72
|
let res;
|
|
72
73
|
try {
|
|
73
74
|
res = await config.fetch(url, init);
|
|
74
75
|
} catch (err) {
|
|
76
|
+
if (err instanceof DOMException && err.name === "TimeoutError") {
|
|
77
|
+
throw new NeetruError("network_error", "Network error: timeout after 30s");
|
|
78
|
+
}
|
|
75
79
|
const message = err instanceof Error ? err.message : "fetch failed";
|
|
76
80
|
throw new NeetruError("network_error", `Network error: ${message}`);
|
|
77
81
|
}
|
|
@@ -1222,7 +1226,9 @@ function createOidcAuthNamespace(config) {
|
|
|
1222
1226
|
const redirectUri = options?.redirectUri ?? globalThis.location.origin;
|
|
1223
1227
|
const scope = options?.scope ?? "openid profile email";
|
|
1224
1228
|
const state = options?.postLoginRedirect ?? globalThis.location.href;
|
|
1225
|
-
const
|
|
1229
|
+
const overrideAuthUrl = typeof globalThis.NEETRU_AUTH_URL === "string" ? globalThis.NEETRU_AUTH_URL : null;
|
|
1230
|
+
const idpOrigin = overrideAuthUrl ?? config.baseUrl.replace(/^https?:\/\/api\./, "https://auth.");
|
|
1231
|
+
const url = new URL("/api/v1/oauth/authorize", idpOrigin);
|
|
1226
1232
|
url.searchParams.set("response_type", "code");
|
|
1227
1233
|
url.searchParams.set("redirect_uri", redirectUri);
|
|
1228
1234
|
url.searchParams.set("scope", scope);
|