@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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@every-app/sdk",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {
@@ -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 when available for zero-latency internal routing
50
- // (available in production Workers, not in local dev)
51
- if (env.EVERY_APP_GATEWAY) {
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
- // Fall back to HTTP fetch for local dev
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 { SessionManager, SessionManagerConfig } from "../core/sessionManager.js";
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";