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