@bounded-sh/core 0.0.57 → 0.0.59
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/client/config.d.ts +8 -0
- package/dist/{index-B30-XpaX.js → index-BIdD2yUB.js} +957 -312
- package/dist/index-BIdD2yUB.js.map +1 -0
- package/dist/{index-DYbzK8YT.mjs → index-BQ6e4MeP.mjs} +952 -313
- package/dist/index-BQ6e4MeP.mjs.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{realtime-store-BpQsQYhl.js → realtime-store-Bz4Ob6K6.js} +2 -2
- package/dist/{realtime-store-BpQsQYhl.js.map → realtime-store-Bz4Ob6K6.js.map} +1 -1
- package/dist/{realtime-store-BSuV-Vyr.mjs → realtime-store-DKngqviG.mjs} +2 -2
- package/dist/{realtime-store-BSuV-Vyr.mjs.map → realtime-store-DKngqviG.mjs.map} +1 -1
- package/dist/{solana-message-DKOPPJwk.js → solana-message-B0NoE4nC.js} +2 -2
- package/dist/{solana-message-DKOPPJwk.js.map → solana-message-B0NoE4nC.js.map} +1 -1
- package/dist/{solana-message-C2_VvNX7.mjs → solana-message-QUfJi1Qm.mjs} +2 -2
- package/dist/{solana-message-C2_VvNX7.mjs.map → solana-message-QUfJi1Qm.mjs.map} +1 -1
- package/dist/{solana-operations-CuYFYlyN.mjs → solana-operations-B2Oy9T7D.mjs} +2 -2
- package/dist/{solana-operations-CuYFYlyN.mjs.map → solana-operations-B2Oy9T7D.mjs.map} +1 -1
- package/dist/{solana-operations-BOKHbEuy.js → solana-operations-ngqIkN9W.js} +2 -2
- package/dist/{solana-operations-BOKHbEuy.js.map → solana-operations-ngqIkN9W.js.map} +1 -1
- package/dist/utils/auth-token-freshness.d.ts +79 -0
- package/dist/utils/rn-session-manager.d.ts +19 -2
- package/dist/utils/session-events.d.ts +31 -0
- package/dist/utils/session-mutation.d.ts +124 -0
- package/dist/utils/utils.d.ts +18 -1
- package/dist/utils/web-session-manager.d.ts +43 -2
- package/package.json +2 -2
- package/dist/index-B30-XpaX.js.map +0 -1
- package/dist/index-DYbzK8YT.mjs.map +0 -1
|
@@ -1,5 +1,18 @@
|
|
|
1
|
+
import { type CommitResult, type ExpectedSession } from "./session-mutation";
|
|
1
2
|
export declare class WebSessionManager {
|
|
2
3
|
private static BOUNDED_SESSION_STORAGE_KEY;
|
|
4
|
+
/** Raw read of the stored blob. Callers inside the lock use this, never a cached copy. */
|
|
5
|
+
private static readRaw;
|
|
6
|
+
private static writeRaw;
|
|
7
|
+
/**
|
|
8
|
+
* Read the session, stamping a `sessionGeneration` if it predates them.
|
|
9
|
+
*
|
|
10
|
+
* Sessions written before generations existed have no lineage marker, so a
|
|
11
|
+
* later refresh could not prove it descended from them. Minting on read
|
|
12
|
+
* upgrades them in place; a request already in flight across that mint carries
|
|
13
|
+
* no generation and fails closed at commit rather than writing unprovably.
|
|
14
|
+
*/
|
|
15
|
+
static readSessionWithGeneration(): Promise<any | null>;
|
|
3
16
|
/**
|
|
4
17
|
* Decode a base64url-encoded string (used by JWT payloads).
|
|
5
18
|
* Normalises base64url → standard base64 before calling browser atob().
|
|
@@ -10,11 +23,39 @@ export declare class WebSessionManager {
|
|
|
10
23
|
address: string;
|
|
11
24
|
session: any;
|
|
12
25
|
} | null>;
|
|
13
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Remove the session unconditionally (logout, app-id mismatch, dead refresh).
|
|
28
|
+
*
|
|
29
|
+
* ASYNC AND LOCKED, and callers MUST await it. Two failure modes hang on this:
|
|
30
|
+
*
|
|
31
|
+
* - Removing outside the lock lets a refresh that read before the logout write
|
|
32
|
+
* the session back afterwards, resurrecting a logged-out session.
|
|
33
|
+
* - Not awaiting lets `logout()` return while the credential is still in
|
|
34
|
+
* storage, so the very next request authenticates as the user who just left.
|
|
35
|
+
*/
|
|
36
|
+
static clearSession(): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Remove the session only if it is still the one identified by `generation`.
|
|
39
|
+
*
|
|
40
|
+
* Used by every failure path that wants to drop a dead session without
|
|
41
|
+
* trampling a newer login that landed while the failure was in flight.
|
|
42
|
+
*/
|
|
43
|
+
static clearSessionIfGeneration(generation: string | null): Promise<void>;
|
|
14
44
|
static isAuthenticated(): boolean;
|
|
15
45
|
static getIdToken(): string | null;
|
|
16
46
|
static getRefreshToken(): string | null;
|
|
17
47
|
/** The issuer base that minted this session (for routing silent refresh). */
|
|
18
48
|
static getIssuer(): string | null;
|
|
19
|
-
|
|
49
|
+
/**
|
|
50
|
+
* Commit refreshed tokens, bound to the session generation they were minted for.
|
|
51
|
+
*
|
|
52
|
+
* Returns WHICH of the four outcomes happened, and the session the caller must
|
|
53
|
+
* actually use. The old version returned void and silently dropped a refused
|
|
54
|
+
* write, so `getFreshAuthToken` handed back the refreshed token regardless — a
|
|
55
|
+
* request could then execute as the previous user while storage and the UI had
|
|
56
|
+
* already moved to a new one.
|
|
57
|
+
*
|
|
58
|
+
* Never hand back `idToken` directly: use `result.session`.
|
|
59
|
+
*/
|
|
60
|
+
static commitRefreshedTokens(expected: ExpectedSession, idToken: string, accessToken: string, refreshToken?: string): Promise<CommitResult<any>>;
|
|
20
61
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bounded-sh/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.59",
|
|
4
4
|
"description": "Shared client, data-plane, and transport primitives for Bounded, the full-stack app builder and runtime for AI-built apps: policy-enforced operations, files, functions, and realtime.",
|
|
5
5
|
"homepage": "https://bounded.sh/docs/sdk",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"scripts": {
|
|
17
17
|
"build": "rm -rf ./dist ./.rollup-tmp && tsc -p tsconfig.build.json --outDir .rollup-tmp --declarationDir .rollup-tmp --emitDeclarationOnly false && rollup -c && tsc -p tsconfig.build.json --emitDeclarationOnly --declarationDir dist && rm -rf ./.rollup-tmp",
|
|
18
18
|
"watch": "rollup -c -w",
|
|
19
|
-
"test": "node src/client/run-config-network-test.mjs && node src/client/run-read-principal-test.mjs && node src/client/run-principal-collision-test.mjs && node src/client/run-abortable-read-test.mjs && node src/utils/run-api-abort-test.mjs && node src/utils/run-api-transient-get-retry-test.mjs && node src/utils/run-auth-api-issuer-switch-test.mjs && node src/utils/run-session-manager-binding-test.mjs && node src/utils/run-server-session-manager-test.mjs && node src/utils/api-refresh-inflight-key.source.test.mjs && node src/client/run-row-shape-test.mjs && node src/client/run-transport-test.mjs && node src/client/run-queries-coalesce-test.mjs && node src/client/run-runexpression-overrides-test.mjs && node src/client/run-subscribe-query-test.mjs && node src/client/subscribe-query-defaults.source.test.mjs && node src/client/run-public-export-surface-test.mjs && node src/client/run-live-auth-test.mjs && node src/client/run-live-view-principal-test.mjs && node src/client/run-subscription-auth-error-test.mjs && node src/client/run-subscription-confirmation-retry-test.mjs && node src/client/subscription-handoff-grace.source.test.mjs && node src/client/run-onchain-validation-test.mjs && node src/client/run-evm-dispatch-test.mjs && node src/utils/evm/run-evm-utils-test.mjs && node src/client/websocket-auth-url.test.mjs && node src/client/run-create-client-http-test.mjs && node src/client/run-create-client-subscribe-test.mjs",
|
|
19
|
+
"test": "node src/client/run-config-network-test.mjs && node src/client/run-read-principal-test.mjs && node src/client/run-principal-collision-test.mjs && node src/client/run-abortable-read-test.mjs && node src/utils/run-api-abort-test.mjs && node src/utils/run-api-transient-get-retry-test.mjs && node src/utils/run-auth-api-issuer-switch-test.mjs && node src/utils/run-session-manager-binding-test.mjs && node src/utils/run-session-protocol-test.mjs && node src/utils/run-auth-token-freshness-test.mjs && node src/utils/run-api-401-recovery-test.mjs && node src/utils/run-server-session-manager-test.mjs && node src/utils/api-refresh-inflight-key.source.test.mjs && node src/client/run-row-shape-test.mjs && node src/client/run-transport-test.mjs && node src/client/run-queries-coalesce-test.mjs && node src/client/run-runexpression-overrides-test.mjs && node src/client/run-subscribe-query-test.mjs && node src/client/subscribe-query-defaults.source.test.mjs && node src/client/run-public-export-surface-test.mjs && node src/client/run-live-auth-test.mjs && node src/client/run-live-view-principal-test.mjs && node src/client/run-subscription-auth-error-test.mjs && node src/client/run-subscription-confirmation-retry-test.mjs && node src/client/subscription-handoff-grace.source.test.mjs && node src/client/run-onchain-validation-test.mjs && node src/client/run-evm-dispatch-test.mjs && node src/utils/evm/run-evm-utils-test.mjs && node src/client/websocket-auth-url.test.mjs && node src/client/run-create-client-http-test.mjs && node src/client/run-create-client-subscribe-test.mjs",
|
|
20
20
|
"prepare": "npm run build"
|
|
21
21
|
},
|
|
22
22
|
"files": [
|