@every-app/sdk 0.1.8 → 0.1.9
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/package.json
CHANGED
|
@@ -46,16 +46,17 @@ export async function fetchGateway({
|
|
|
46
46
|
const resolvedRequest = toRequest(url, init, gatewayBaseUrl);
|
|
47
47
|
const authenticatedRequest = applyAppTokenAuth(resolvedRequest, env);
|
|
48
48
|
|
|
49
|
-
// Use service binding
|
|
50
|
-
//
|
|
51
|
-
|
|
49
|
+
// Use service binding in production for zero-latency internal routing.
|
|
50
|
+
// In local dev wrangler still exposes the binding object, but the target
|
|
51
|
+
// service usually isn't running locally, so we skip it and use HTTP fetch.
|
|
52
|
+
if (import.meta.env.PROD && env.EVERY_APP_GATEWAY) {
|
|
52
53
|
const url = new URL(authenticatedRequest.url);
|
|
53
54
|
const bindingUrl = `${SERVICE_BINDING_ORIGIN}${url.pathname}${url.search}`;
|
|
54
55
|
const bindingRequest = new Request(bindingUrl, authenticatedRequest);
|
|
55
56
|
return env.EVERY_APP_GATEWAY.fetch(bindingRequest);
|
|
56
57
|
}
|
|
57
58
|
|
|
58
|
-
//
|
|
59
|
+
// HTTP fetch – used in local dev, or as a fallback when no binding exists
|
|
59
60
|
return fetch(authenticatedRequest);
|
|
60
61
|
}
|
|
61
62
|
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import React, { createContext, useContext, useMemo } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
SessionManager,
|
|
4
|
+
SessionManagerConfig,
|
|
5
|
+
} from "../core/sessionManager.js";
|
|
3
6
|
import { useEveryAppSession } from "./_internal/useEveryAppSession.js";
|
|
4
7
|
import { useEveryAppRouter } from "./useEveryAppRouter.js";
|
|
5
8
|
import { GatewayRequiredError } from "./GatewayRequiredError.js";
|