@every-app/sdk 0.1.6 → 0.1.8
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/cloudflare/index.d.ts +1 -1
- package/dist/cloudflare/index.d.ts.map +1 -1
- package/dist/cloudflare/index.js +1 -1
- package/dist/cloudflare/server/index.d.ts +1 -1
- package/dist/cloudflare/server/index.d.ts.map +1 -1
- package/dist/cloudflare/server/index.js +1 -1
- package/dist/core/index.d.ts +3 -3
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +2 -2
- package/dist/tanstack/EmbeddedAppProvider.d.ts +1 -1
- package/dist/tanstack/EmbeddedAppProvider.d.ts.map +1 -1
- package/dist/tanstack/EmbeddedAppProvider.js +3 -3
- package/dist/tanstack/_internal/useEveryAppSession.d.ts +1 -1
- package/dist/tanstack/_internal/useEveryAppSession.d.ts.map +1 -1
- package/dist/tanstack/_internal/useEveryAppSession.js +1 -1
- package/dist/tanstack/index.d.ts +3 -3
- package/dist/tanstack/index.d.ts.map +1 -1
- package/dist/tanstack/index.js +3 -3
- package/dist/tanstack/server/authConfig.d.ts +1 -1
- package/dist/tanstack/server/authConfig.d.ts.map +1 -1
- package/dist/tanstack/server/authenticateRequest.d.ts +1 -1
- package/dist/tanstack/server/authenticateRequest.d.ts.map +1 -1
- package/dist/tanstack/server/index.d.ts +3 -3
- package/dist/tanstack/server/index.d.ts.map +1 -1
- package/dist/tanstack/server/index.js +2 -2
- package/dist/tanstack/useEveryAppRouter.d.ts +1 -1
- package/dist/tanstack/useEveryAppRouter.d.ts.map +1 -1
- package/dist/tanstack/useSessionTokenClientMiddleware.d.ts +1 -5
- package/dist/tanstack/useSessionTokenClientMiddleware.d.ts.map +1 -1
- package/dist/tanstack/useSessionTokenClientMiddleware.js +1 -6
- package/package.json +3 -2
- package/src/cloudflare/index.ts +1 -1
- package/src/cloudflare/server/index.ts +1 -1
- package/src/core/index.ts +3 -3
- package/src/tanstack/EmbeddedAppProvider.tsx +4 -4
- package/src/tanstack/_internal/useEveryAppSession.tsx +1 -1
- package/src/tanstack/index.ts +3 -3
- package/src/tanstack/server/authConfig.ts +1 -1
- package/src/tanstack/server/authenticateRequest.ts +1 -1
- package/src/tanstack/server/index.ts +3 -3
- package/src/tanstack/useEveryAppRouter.tsx +1 -1
- package/src/tanstack/useSessionTokenClientMiddleware.ts +2 -9
- package/dist/core/localDemoSessionManager.d.ts +0 -42
- package/dist/core/localDemoSessionManager.d.ts.map +0 -1
- package/dist/core/localDemoSessionManager.js +0 -52
- package/dist/shared/demoModeLocalOnly.d.ts +0 -14
- package/dist/shared/demoModeLocalOnly.d.ts.map +0 -1
- package/dist/shared/demoModeLocalOnly.js +0 -31
- package/dist/shared/localOnly.d.ts +0 -14
- package/dist/shared/localOnly.d.ts.map +0 -1
- package/dist/shared/localOnly.js +0 -30
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { lazyInitForWorkers } from "./lazyInit";
|
|
1
|
+
export { lazyInitForWorkers } from "./lazyInit.js";
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cloudflare/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cloudflare/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/cloudflare/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { lazyInitForWorkers } from "./lazyInit";
|
|
1
|
+
export { lazyInitForWorkers } from "./lazyInit.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cloudflare/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cloudflare/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { getLocalD1Url } from "../getLocalD1Url.js";
|
|
2
|
-
export { fetchGateway, getGatewayUrl } from "./gateway";
|
|
2
|
+
export { fetchGateway, getGatewayUrl } from "./gateway.js";
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { SessionManager, isRunningInIframe } from "./sessionManager";
|
|
2
|
-
export type { SessionManagerConfig } from "./sessionManager";
|
|
3
|
-
export { authenticatedFetch, getSessionToken } from "./authenticatedFetch";
|
|
1
|
+
export { SessionManager, isRunningInIframe } from "./sessionManager.js";
|
|
2
|
+
export type { SessionManagerConfig } from "./sessionManager.js";
|
|
3
|
+
export { authenticatedFetch, getSessionToken } from "./authenticatedFetch.js";
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/core/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxE,YAAY,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAEhE,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC"}
|
package/dist/core/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { SessionManager, isRunningInIframe } from "./sessionManager";
|
|
2
|
-
export { authenticatedFetch, getSessionToken } from "./authenticatedFetch";
|
|
1
|
+
export { SessionManager, isRunningInIframe } from "./sessionManager.js";
|
|
2
|
+
export { authenticatedFetch, getSessionToken } from "./authenticatedFetch.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmbeddedAppProvider.d.ts","sourceRoot":"","sources":["../../src/tanstack/EmbeddedAppProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAClE,OAAO,EAAkB,oBAAoB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"EmbeddedAppProvider.d.ts","sourceRoot":"","sources":["../../src/tanstack/EmbeddedAppProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAClE,OAAO,EAAkB,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAKjF,UAAU,sBAAuB,SAAQ,oBAAoB;IAC3D,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAUD,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,GAAG,MAAM,EACV,EAAE,sBAAsB,kDA6BxB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,cAAc,IAAI;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAmBzE"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { createContext, useContext, useMemo } from "react";
|
|
3
|
-
import { useEveryAppSession } from "./_internal/useEveryAppSession";
|
|
4
|
-
import { useEveryAppRouter } from "./useEveryAppRouter";
|
|
5
|
-
import { GatewayRequiredError } from "./GatewayRequiredError";
|
|
3
|
+
import { useEveryAppSession } from "./_internal/useEveryAppSession.js";
|
|
4
|
+
import { useEveryAppRouter } from "./useEveryAppRouter.js";
|
|
5
|
+
import { GatewayRequiredError } from "./GatewayRequiredError.js";
|
|
6
6
|
const EmbeddedAppContext = createContext(null);
|
|
7
7
|
export function EmbeddedAppProvider({ children, ...config }) {
|
|
8
8
|
const { sessionManager, sessionTokenState } = useEveryAppSession({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEveryAppSession.d.ts","sourceRoot":"","sources":["../../../src/tanstack/_internal/useEveryAppSession.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"useEveryAppSession.d.ts","sourceRoot":"","sources":["../../../src/tanstack/_internal/useEveryAppSession.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,UAAU,oBAAoB;IAC5B,KAAK,EAAE,MAAM,CAAC;CACf;AAED,UAAU,wBAAwB;IAChC,oBAAoB,EAAE,oBAAoB,CAAC;CAC5C;AAED,wBAAgB,kBAAkB,CAAC,EACjC,oBAAoB,GACrB,EAAE,wBAAwB;;;;;;EA8C1B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useEffect, useRef, useState } from "react";
|
|
2
|
-
import { SessionManager } from "../../core/sessionManager";
|
|
2
|
+
import { SessionManager } from "../../core/sessionManager.js";
|
|
3
3
|
export function useEveryAppSession({ sessionManagerConfig, }) {
|
|
4
4
|
const sessionManagerRef = useRef(null);
|
|
5
5
|
const [sessionTokenState, setSessionTokenState] = useState({
|
package/dist/tanstack/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { useSessionTokenClientMiddleware } from "./useSessionTokenClientMiddleware";
|
|
2
|
-
export { useEveryAppRouter } from "./useEveryAppRouter";
|
|
3
|
-
export { EmbeddedAppProvider, useCurrentUser } from "./EmbeddedAppProvider";
|
|
1
|
+
export { useSessionTokenClientMiddleware } from "./useSessionTokenClientMiddleware.js";
|
|
2
|
+
export { useEveryAppRouter } from "./useEveryAppRouter.js";
|
|
3
|
+
export { EmbeddedAppProvider, useCurrentUser } from "./EmbeddedAppProvider.js";
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tanstack/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tanstack/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AACvF,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC"}
|
package/dist/tanstack/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { useSessionTokenClientMiddleware } from "./useSessionTokenClientMiddleware";
|
|
2
|
-
export { useEveryAppRouter } from "./useEveryAppRouter";
|
|
3
|
-
export { EmbeddedAppProvider, useCurrentUser } from "./EmbeddedAppProvider";
|
|
1
|
+
export { useSessionTokenClientMiddleware } from "./useSessionTokenClientMiddleware.js";
|
|
2
|
+
export { useEveryAppRouter } from "./useEveryAppRouter.js";
|
|
3
|
+
export { EmbeddedAppProvider, useCurrentUser } from "./EmbeddedAppProvider.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authConfig.d.ts","sourceRoot":"","sources":["../../../src/tanstack/server/authConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"authConfig.d.ts","sourceRoot":"","sources":["../../../src/tanstack/server/authConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAG7C,wBAAgB,aAAa,IAAI,UAAU,CAK1C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authenticateRequest.d.ts","sourceRoot":"","sources":["../../../src/tanstack/server/authenticateRequest.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"authenticateRequest.d.ts","sourceRoot":"","sources":["../../../src/tanstack/server/authenticateRequest.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAG7C;;;GAGG;AACH,UAAU,mBAAmB;IAC3B,8BAA8B;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,iCAAiC;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,6DAA6D;IAC7D,GAAG,EAAE,MAAM,CAAC;IACZ,2BAA2B;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,0BAA0B;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,sDAAsD;IACtD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAsB,mBAAmB,CACvC,UAAU,EAAE,UAAU,EACtB,eAAe,CAAC,EAAE,OAAO,GACxB,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC,CA8BrC;AAyCD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAK3E"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { authenticateRequest } from "./authenticateRequest";
|
|
2
|
-
export type { AuthConfig } from "./types";
|
|
3
|
-
export { getAuthConfig } from "./authConfig";
|
|
1
|
+
export { authenticateRequest } from "./authenticateRequest.js";
|
|
2
|
+
export type { AuthConfig } from "./types.js";
|
|
3
|
+
export { getAuthConfig } from "./authConfig.js";
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tanstack/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tanstack/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,YAAY,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { authenticateRequest } from "./authenticateRequest";
|
|
2
|
-
export { getAuthConfig } from "./authConfig";
|
|
1
|
+
export { authenticateRequest } from "./authenticateRequest.js";
|
|
2
|
+
export { getAuthConfig } from "./authConfig.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEveryAppRouter.d.ts","sourceRoot":"","sources":["../../src/tanstack/useEveryAppRouter.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"useEveryAppRouter.d.ts","sourceRoot":"","sources":["../../src/tanstack/useEveryAppRouter.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAG3D,UAAU,uBAAuB;IAC/B,cAAc,EAAE,cAAc,GAAG,IAAI,CAAC;CACvC;AAED,wBAAgB,iBAAiB,CAAC,EAAE,cAAc,EAAE,EAAE,uBAAuB,QAmE5E"}
|
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
* Exported as `any` to avoid cross-package type identity issues when apps and
|
|
3
|
-
* the SDK resolve different `@tanstack/react-start` instances in a monorepo.
|
|
4
|
-
*/
|
|
5
|
-
export declare const useSessionTokenClientMiddleware: any;
|
|
1
|
+
export declare const useSessionTokenClientMiddleware: import("@tanstack/react-start").FunctionMiddlewareAfterClient<{}, unknown, undefined, undefined, undefined>;
|
|
6
2
|
//# sourceMappingURL=useSessionTokenClientMiddleware.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSessionTokenClientMiddleware.d.ts","sourceRoot":"","sources":["../../src/tanstack/useSessionTokenClientMiddleware.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useSessionTokenClientMiddleware.d.ts","sourceRoot":"","sources":["../../src/tanstack/useSessionTokenClientMiddleware.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,+BAA+B,6GA2B1C,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createMiddleware } from "@tanstack/react-start";
|
|
2
|
-
const
|
|
2
|
+
export const useSessionTokenClientMiddleware = createMiddleware({
|
|
3
3
|
type: "function",
|
|
4
4
|
}).client(async ({ next }) => {
|
|
5
5
|
// Get the global sessionManager - this MUST be available for embedded apps
|
|
@@ -19,8 +19,3 @@ const _useSessionTokenClientMiddleware = createMiddleware({
|
|
|
19
19
|
},
|
|
20
20
|
});
|
|
21
21
|
});
|
|
22
|
-
/**
|
|
23
|
-
* Exported as `any` to avoid cross-package type identity issues when apps and
|
|
24
|
-
* the SDK resolve different `@tanstack/react-start` instances in a monorepo.
|
|
25
|
-
*/
|
|
26
|
-
export const useSessionTokenClientMiddleware = _useSessionTokenClientMiddleware;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@every-app/sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -35,7 +35,8 @@
|
|
|
35
35
|
"format:check": "prettier --check .",
|
|
36
36
|
"format:write": "prettier . --write",
|
|
37
37
|
"test": "vitest run --silent",
|
|
38
|
-
"test:watch": "vitest"
|
|
38
|
+
"test:watch": "vitest",
|
|
39
|
+
"check:esm-relative-imports": "node ./scripts/check-esm-relative-imports.mjs"
|
|
39
40
|
},
|
|
40
41
|
"dependencies": {
|
|
41
42
|
"jsonc-parser": "^3.3.1"
|
package/src/cloudflare/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { lazyInitForWorkers } from "./lazyInit";
|
|
1
|
+
export { lazyInitForWorkers } from "./lazyInit.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { getLocalD1Url } from "../getLocalD1Url.js";
|
|
2
|
-
export { fetchGateway, getGatewayUrl } from "./gateway";
|
|
2
|
+
export { fetchGateway, getGatewayUrl } from "./gateway.js";
|
package/src/core/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { SessionManager, isRunningInIframe } from "./sessionManager";
|
|
2
|
-
export type { SessionManagerConfig } from "./sessionManager";
|
|
1
|
+
export { SessionManager, isRunningInIframe } from "./sessionManager.js";
|
|
2
|
+
export type { SessionManagerConfig } from "./sessionManager.js";
|
|
3
3
|
|
|
4
|
-
export { authenticatedFetch, getSessionToken } from "./authenticatedFetch";
|
|
4
|
+
export { authenticatedFetch, getSessionToken } from "./authenticatedFetch.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React, { createContext, useContext, useMemo } from "react";
|
|
2
|
-
import { SessionManager, SessionManagerConfig } from "../core/sessionManager";
|
|
3
|
-
import { useEveryAppSession } from "./_internal/useEveryAppSession";
|
|
4
|
-
import { useEveryAppRouter } from "./useEveryAppRouter";
|
|
5
|
-
import { GatewayRequiredError } from "./GatewayRequiredError";
|
|
2
|
+
import { SessionManager, SessionManagerConfig } from "../core/sessionManager.js";
|
|
3
|
+
import { useEveryAppSession } from "./_internal/useEveryAppSession.js";
|
|
4
|
+
import { useEveryAppRouter } from "./useEveryAppRouter.js";
|
|
5
|
+
import { GatewayRequiredError } from "./GatewayRequiredError.js";
|
|
6
6
|
|
|
7
7
|
interface EmbeddedProviderConfig extends SessionManagerConfig {
|
|
8
8
|
children: React.ReactNode;
|
package/src/tanstack/index.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { useSessionTokenClientMiddleware } from "./useSessionTokenClientMiddleware";
|
|
2
|
-
export { useEveryAppRouter } from "./useEveryAppRouter";
|
|
3
|
-
export { EmbeddedAppProvider, useCurrentUser } from "./EmbeddedAppProvider";
|
|
1
|
+
export { useSessionTokenClientMiddleware } from "./useSessionTokenClientMiddleware.js";
|
|
2
|
+
export { useEveryAppRouter } from "./useEveryAppRouter.js";
|
|
3
|
+
export { EmbeddedAppProvider, useCurrentUser } from "./EmbeddedAppProvider.js";
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { authenticateRequest } from "./authenticateRequest";
|
|
2
|
-
export type { AuthConfig } from "./types";
|
|
3
|
-
export { getAuthConfig } from "./authConfig";
|
|
1
|
+
export { authenticateRequest } from "./authenticateRequest.js";
|
|
2
|
+
export type { AuthConfig } from "./types.js";
|
|
3
|
+
export { getAuthConfig } from "./authConfig.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createMiddleware } from "@tanstack/react-start";
|
|
2
|
-
import type { SessionManager } from "../core/sessionManager";
|
|
2
|
+
import type { SessionManager } from "../core/sessionManager.js";
|
|
3
3
|
|
|
4
|
-
const
|
|
4
|
+
export const useSessionTokenClientMiddleware = createMiddleware({
|
|
5
5
|
type: "function",
|
|
6
6
|
}).client(async ({ next }) => {
|
|
7
7
|
// Get the global sessionManager - this MUST be available for embedded apps
|
|
@@ -29,10 +29,3 @@ const _useSessionTokenClientMiddleware = createMiddleware({
|
|
|
29
29
|
},
|
|
30
30
|
});
|
|
31
31
|
});
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Exported as `any` to avoid cross-package type identity issues when apps and
|
|
35
|
-
* the SDK resolve different `@tanstack/react-start` instances in a monorepo.
|
|
36
|
-
*/
|
|
37
|
-
export const useSessionTokenClientMiddleware: any =
|
|
38
|
-
_useSessionTokenClientMiddleware;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
export interface SessionManagerConfig {
|
|
2
|
-
appId: string;
|
|
3
|
-
}
|
|
4
|
-
/**
|
|
5
|
-
* A simplified session manager for local demo mode.
|
|
6
|
-
*
|
|
7
|
-
* This manager bypasses all real authentication and returns static demo credentials.
|
|
8
|
-
* It should only be used in development when LOCAL_DEMO_ONLY_MODE is enabled.
|
|
9
|
-
*
|
|
10
|
-
* SECURITY: This class is only instantiated when isLocalDemoModeClient() returns true,
|
|
11
|
-
* which includes a production safety check.
|
|
12
|
-
*/
|
|
13
|
-
export declare class LocalDemoSessionManager {
|
|
14
|
-
readonly parentOrigin: string;
|
|
15
|
-
readonly appId: string;
|
|
16
|
-
readonly isInIframe: boolean;
|
|
17
|
-
constructor(config: SessionManagerConfig);
|
|
18
|
-
/**
|
|
19
|
-
* Returns the static demo token.
|
|
20
|
-
* No expiration logic needed since this is just for local development.
|
|
21
|
-
*/
|
|
22
|
-
getToken(): Promise<string>;
|
|
23
|
-
/**
|
|
24
|
-
* Always returns VALID status with the demo token.
|
|
25
|
-
*/
|
|
26
|
-
getTokenState(): {
|
|
27
|
-
status: "NO_TOKEN" | "VALID" | "EXPIRED" | "REFRESHING";
|
|
28
|
-
token: string | null;
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* Returns static demo user info.
|
|
32
|
-
*/
|
|
33
|
-
getUser(): {
|
|
34
|
-
userId: string;
|
|
35
|
-
email: string;
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* No-op for demo mode - token never needs refreshing.
|
|
39
|
-
*/
|
|
40
|
-
requestNewToken(): Promise<string>;
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=localDemoSessionManager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"localDemoSessionManager.d.ts","sourceRoot":"","sources":["../../src/core/localDemoSessionManager.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;GAQG;AACH,qBAAa,uBAAuB;IAClC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAQ;gBAExB,MAAM,EAAE,oBAAoB;IAcxC;;;OAGG;IACG,QAAQ,IAAI,OAAO,CAAC,MAAM,CAAC;IAIjC;;OAEG;IACH,aAAa,IAAI;QACf,MAAM,EAAE,UAAU,GAAG,OAAO,GAAG,SAAS,GAAG,YAAY,CAAC;QACxD,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;KACtB;IAID;;OAEG;IACH,OAAO,IAAI;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE;IAO5C;;OAEG;IACG,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC;CAGzC"}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { LOCAL_DEMO_TOKEN, LOCAL_DEMO_USER_ID, LOCAL_DEMO_EMAIL, } from "../shared/localOnly";
|
|
2
|
-
/**
|
|
3
|
-
* A simplified session manager for local demo mode.
|
|
4
|
-
*
|
|
5
|
-
* This manager bypasses all real authentication and returns static demo credentials.
|
|
6
|
-
* It should only be used in development when LOCAL_DEMO_ONLY_MODE is enabled.
|
|
7
|
-
*
|
|
8
|
-
* SECURITY: This class is only instantiated when isLocalDemoModeClient() returns true,
|
|
9
|
-
* which includes a production safety check.
|
|
10
|
-
*/
|
|
11
|
-
export class LocalDemoSessionManager {
|
|
12
|
-
parentOrigin;
|
|
13
|
-
appId;
|
|
14
|
-
isInIframe = true;
|
|
15
|
-
constructor(config) {
|
|
16
|
-
if (!config.appId) {
|
|
17
|
-
throw new Error("[LocalDemoSessionManager] appId is required.");
|
|
18
|
-
}
|
|
19
|
-
this.appId = config.appId;
|
|
20
|
-
this.parentOrigin = typeof window !== "undefined" ? window.location.origin : "http://localhost";
|
|
21
|
-
console.warn("[LocalDemoSessionManager] Running in LOCAL DEMO MODE. " +
|
|
22
|
-
"Authentication is bypassed. Do not use in production!");
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Returns the static demo token.
|
|
26
|
-
* No expiration logic needed since this is just for local development.
|
|
27
|
-
*/
|
|
28
|
-
async getToken() {
|
|
29
|
-
return LOCAL_DEMO_TOKEN;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Always returns VALID status with the demo token.
|
|
33
|
-
*/
|
|
34
|
-
getTokenState() {
|
|
35
|
-
return { status: "VALID", token: LOCAL_DEMO_TOKEN };
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Returns static demo user info.
|
|
39
|
-
*/
|
|
40
|
-
getUser() {
|
|
41
|
-
return {
|
|
42
|
-
userId: LOCAL_DEMO_USER_ID,
|
|
43
|
-
email: LOCAL_DEMO_EMAIL,
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* No-op for demo mode - token never needs refreshing.
|
|
48
|
-
*/
|
|
49
|
-
async requestNewToken() {
|
|
50
|
-
return LOCAL_DEMO_TOKEN;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export declare const DEMO_MODE_LOCAL_ONLY_TOKEN = "DEMO_MODE_LOCAL_ONLY";
|
|
2
|
-
export declare const DEMO_MODE_LOCAL_ONLY_USER_ID = "demo-local-user";
|
|
3
|
-
export declare const DEMO_MODE_LOCAL_ONLY_EMAIL = "demo-local-user@local";
|
|
4
|
-
export declare function isDemoModeLocalOnlyClient(): boolean;
|
|
5
|
-
export declare function isDemoModeLocalOnlyServer(): boolean;
|
|
6
|
-
export declare function createDemoModeLocalOnlySessionPayload(audience: string): {
|
|
7
|
-
sub: string;
|
|
8
|
-
email: string;
|
|
9
|
-
iss: string;
|
|
10
|
-
aud: string;
|
|
11
|
-
iat: number;
|
|
12
|
-
exp: number;
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=demoModeLocalOnly.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"demoModeLocalOnly.d.ts","sourceRoot":"","sources":["../../src/shared/demoModeLocalOnly.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,0BAA0B,yBAAyB,CAAC;AACjE,eAAO,MAAM,4BAA4B,oBAAoB,CAAC;AAC9D,eAAO,MAAM,0BAA0B,0BAA0B,CAAC;AAElE,wBAAgB,yBAAyB,IAAI,OAAO,CAEnD;AAED,wBAAgB,yBAAyB,IAAI,OAAO,CAiBnD;AAED,wBAAgB,qCAAqC,CAAC,QAAQ,EAAE,MAAM;;;;;;;EAYrE"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
export const DEMO_MODE_LOCAL_ONLY_TOKEN = "DEMO_MODE_LOCAL_ONLY";
|
|
2
|
-
export const DEMO_MODE_LOCAL_ONLY_USER_ID = "demo-local-user";
|
|
3
|
-
export const DEMO_MODE_LOCAL_ONLY_EMAIL = "demo-local-user@local";
|
|
4
|
-
export function isDemoModeLocalOnlyClient() {
|
|
5
|
-
return import.meta.env.VITE_DEMO_MODE_LOCAL_ONLY === "true";
|
|
6
|
-
}
|
|
7
|
-
export function isDemoModeLocalOnlyServer() {
|
|
8
|
-
const metaEnv = import.meta
|
|
9
|
-
.env;
|
|
10
|
-
const metaValue = metaEnv?.DEMO_MODE_LOCAL_ONLY ?? metaEnv?.VITE_DEMO_MODE_LOCAL_ONLY;
|
|
11
|
-
if (metaValue === "true") {
|
|
12
|
-
return true;
|
|
13
|
-
}
|
|
14
|
-
if (typeof process !== "undefined" &&
|
|
15
|
-
process.env?.DEMO_MODE_LOCAL_ONLY === "true") {
|
|
16
|
-
return true;
|
|
17
|
-
}
|
|
18
|
-
return false;
|
|
19
|
-
}
|
|
20
|
-
export function createDemoModeLocalOnlySessionPayload(audience) {
|
|
21
|
-
const issuedAt = Math.floor(Date.now() / 1000);
|
|
22
|
-
const expiresAt = issuedAt + 60 * 60;
|
|
23
|
-
return {
|
|
24
|
-
sub: DEMO_MODE_LOCAL_ONLY_USER_ID,
|
|
25
|
-
email: DEMO_MODE_LOCAL_ONLY_EMAIL,
|
|
26
|
-
iss: "local",
|
|
27
|
-
aud: audience,
|
|
28
|
-
iat: issuedAt,
|
|
29
|
-
exp: expiresAt,
|
|
30
|
-
};
|
|
31
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export declare const LOCAL_ONLY_TOKEN = "DEMO_MODE_LOCAL_ONLY";
|
|
2
|
-
export declare const LOCAL_ONLY_USER_ID = "demo-local-user";
|
|
3
|
-
export declare const LOCAL_ONLY_EMAIL = "demo-local-user@local";
|
|
4
|
-
export declare function isLocalOnlyClient(): boolean;
|
|
5
|
-
export declare function isLocalOnlyServer(): boolean;
|
|
6
|
-
export declare function createLocalOnlySessionPayload(audience: string): {
|
|
7
|
-
sub: string;
|
|
8
|
-
email: string;
|
|
9
|
-
iss: string;
|
|
10
|
-
aud: string;
|
|
11
|
-
iat: number;
|
|
12
|
-
exp: number;
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=localOnly.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"localOnly.d.ts","sourceRoot":"","sources":["../../src/shared/localOnly.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,yBAAyB,CAAC;AACvD,eAAO,MAAM,kBAAkB,oBAAoB,CAAC;AACpD,eAAO,MAAM,gBAAgB,0BAA0B,CAAC;AAExD,wBAAgB,iBAAiB,IAAI,OAAO,CAE3C;AAED,wBAAgB,iBAAiB,IAAI,OAAO,CAa3C;AAED,wBAAgB,6BAA6B,CAAC,QAAQ,EAAE,MAAM;;;;;;;EAY7D"}
|
package/dist/shared/localOnly.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export const LOCAL_ONLY_TOKEN = "DEMO_MODE_LOCAL_ONLY";
|
|
2
|
-
export const LOCAL_ONLY_USER_ID = "demo-local-user";
|
|
3
|
-
export const LOCAL_ONLY_EMAIL = "demo-local-user@local";
|
|
4
|
-
export function isLocalOnlyClient() {
|
|
5
|
-
return import.meta.env.VITE_LOCAL_ONLY === "true";
|
|
6
|
-
}
|
|
7
|
-
export function isLocalOnlyServer() {
|
|
8
|
-
const metaEnv = import.meta
|
|
9
|
-
.env;
|
|
10
|
-
const metaValue = metaEnv?.LOCAL_ONLY ?? metaEnv?.VITE_LOCAL_ONLY;
|
|
11
|
-
if (metaValue === "true") {
|
|
12
|
-
return true;
|
|
13
|
-
}
|
|
14
|
-
if (typeof process !== "undefined" && process.env?.LOCAL_ONLY === "true") {
|
|
15
|
-
return true;
|
|
16
|
-
}
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
19
|
-
export function createLocalOnlySessionPayload(audience) {
|
|
20
|
-
const issuedAt = Math.floor(Date.now() / 1000);
|
|
21
|
-
const expiresAt = issuedAt + 60 * 60;
|
|
22
|
-
return {
|
|
23
|
-
sub: LOCAL_ONLY_USER_ID,
|
|
24
|
-
email: LOCAL_ONLY_EMAIL,
|
|
25
|
-
iss: "local",
|
|
26
|
-
aud: audience,
|
|
27
|
-
iat: issuedAt,
|
|
28
|
-
exp: expiresAt,
|
|
29
|
-
};
|
|
30
|
-
}
|