axiam-sdk 1.0.0-alpha
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/LICENSE +201 -0
- package/README.md +231 -0
- package/dist/amqp/index.d.cts +246 -0
- package/dist/amqp/index.d.ts +246 -0
- package/dist/amqp/index.js +179 -0
- package/dist/amqp/index.js.map +1 -0
- package/dist/amqp/index.mjs +166 -0
- package/dist/amqp/index.mjs.map +1 -0
- package/dist/client-B2SB-C7c.d.cts +207 -0
- package/dist/client-B2SB-C7c.d.ts +207 -0
- package/dist/grpc/index.d.cts +106 -0
- package/dist/grpc/index.d.ts +106 -0
- package/dist/grpc/index.js +908 -0
- package/dist/grpc/index.js.map +1 -0
- package/dist/grpc/index.mjs +868 -0
- package/dist/grpc/index.mjs.map +1 -0
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +561 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +552 -0
- package/dist/index.mjs.map +1 -0
- package/dist/jwks-CX-nhD6A.d.cts +29 -0
- package/dist/jwks-CX-nhD6A.d.ts +29 -0
- package/dist/middleware/index.d.cts +153 -0
- package/dist/middleware/index.d.ts +153 -0
- package/dist/middleware/index.js +232 -0
- package/dist/middleware/index.js.map +1 -0
- package/dist/middleware/index.mjs +220 -0
- package/dist/middleware/index.mjs.map +1 -0
- package/dist/node/index.d.cts +103 -0
- package/dist/node/index.d.ts +103 -0
- package/dist/node/index.js +717 -0
- package/dist/node/index.js.map +1 -0
- package/dist/node/index.mjs +700 -0
- package/dist/node/index.mjs.map +1 -0
- package/dist/rest/index.d.cts +27 -0
- package/dist/rest/index.d.ts +27 -0
- package/dist/rest/index.js +561 -0
- package/dist/rest/index.js.map +1 -0
- package/dist/rest/index.mjs +552 -0
- package/dist/rest/index.mjs.map +1 -0
- package/dist/sensitive-CWBH_tHr.d.cts +12 -0
- package/dist/sensitive-CWBH_tHr.d.ts +12 -0
- package/package.json +145 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { CookieJar } from 'tough-cookie';
|
|
2
|
+
import { S as SharedSession, a as AxiamClientOptions, b as AxiamClient } from '../client-B2SB-C7c.cjs';
|
|
3
|
+
import { S as Sensitive } from '../sensitive-CWBH_tHr.cjs';
|
|
4
|
+
import { V as Verifier } from '../jwks-CX-nhD6A.cjs';
|
|
5
|
+
export { A as AxiamClaims, J as JWKS_PATH, c as createVerifier } from '../jwks-CX-nhD6A.cjs';
|
|
6
|
+
import { AxiosInstance } from 'axios';
|
|
7
|
+
|
|
8
|
+
declare class TokenManager {
|
|
9
|
+
#private;
|
|
10
|
+
constructor(jar: CookieJar, baseUrl: string, tenantId?: string);
|
|
11
|
+
/**
|
|
12
|
+
* Synchronous, best-effort read of the last-known access token. Returns
|
|
13
|
+
* `null` if no token has been cached yet (no request/refresh has
|
|
14
|
+
* completed since construction, or `syncFromJar()` was never called).
|
|
15
|
+
*/
|
|
16
|
+
cachedAccessToken(): Sensitive<string> | null;
|
|
17
|
+
/**
|
|
18
|
+
* Async read of the current `axiam_refresh` cookie value from the jar,
|
|
19
|
+
* wrapped in Sensitive<T>. Queried against the refresh endpoint's URL
|
|
20
|
+
* since the cookie is path-scoped to `/api/v1/auth/refresh` (not visible
|
|
21
|
+
* at the bare base URL).
|
|
22
|
+
*/
|
|
23
|
+
refreshTokenValue(): Promise<Sensitive<string> | null>;
|
|
24
|
+
/**
|
|
25
|
+
* Refresh the in-memory cached access token from the jar. Call this after
|
|
26
|
+
* every REST request/refresh so the synchronous gRPC-interceptor fast-path
|
|
27
|
+
* (`cachedAccessToken()`) stays current (Pitfall 3).
|
|
28
|
+
*/
|
|
29
|
+
syncFromJar(): Promise<void>;
|
|
30
|
+
/** The resolved tenant identifier (slug or UUID form), if known. */
|
|
31
|
+
tenantId(): string | undefined;
|
|
32
|
+
/** Set/update the resolved tenant identifier (e.g. after decoding the access token's tenant_id claim). */
|
|
33
|
+
setTenantId(tenantId: string): void;
|
|
34
|
+
/** Clear all cached token state (used by logout()). */
|
|
35
|
+
clear(): void;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
declare class NodeSession extends SharedSession {
|
|
39
|
+
#private;
|
|
40
|
+
readonly tokenManager: TokenManager;
|
|
41
|
+
readonly jwksVerifier: Verifier;
|
|
42
|
+
constructor(options: AxiamClientOptions, base: SharedSession, tokenManager: TokenManager, jwksVerifier: Verifier, jar: CookieJar);
|
|
43
|
+
/**
|
|
44
|
+
* Drives the actual `POST /api/v1/auth/refresh` HTTP call. Passed to this
|
|
45
|
+
* session's per-instance `refreshGuard` (inherited from SharedSession) by
|
|
46
|
+
* both REST's reactive interceptor (rest/interceptors.ts) and gRPC's
|
|
47
|
+
* callWithRefresh — since `refreshGuard` is scoped to THIS session
|
|
48
|
+
* instance (CR-02, D-13), both transports share exactly one in-flight
|
|
49
|
+
* refresh for this session regardless of which one triggers it, while
|
|
50
|
+
* remaining fully independent from any other session's guard.
|
|
51
|
+
*/
|
|
52
|
+
doRefresh: () => Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* Session-level hook (CR-01, D-05) invoked by rest/auth.ts after a
|
|
55
|
+
* successful login()/verifyMfa(). Refreshes the cached access token (so
|
|
56
|
+
* the gRPC interceptor's synchronous fast-path is current immediately
|
|
57
|
+
* after login) and reads the `axiam_csrf` cookie out of the jar into
|
|
58
|
+
* `session.csrfToken`, mirroring TokenManager.syncFromJar()'s pattern.
|
|
59
|
+
*/
|
|
60
|
+
onAuthenticated: () => Promise<void>;
|
|
61
|
+
}
|
|
62
|
+
/** Build the Node persona's session: REST SharedSession + cookie jar + TokenManager + JWKS verifier. */
|
|
63
|
+
declare function createNodeSession(options: AxiamClientOptions): NodeSession;
|
|
64
|
+
/**
|
|
65
|
+
* Build an `AxiamClient` wired to the Node persona (SDK-Q05). This is the Node
|
|
66
|
+
* counterpart to `new AxiamClient(options)` (which builds the browser
|
|
67
|
+
* `SharedSession` with no cookie jar): it constructs a `NodeSession`
|
|
68
|
+
* (tough-cookie jar + CSRF/refresh token sync) and adopts it via the
|
|
69
|
+
* `AxiamClient` session-injection constructor, so httpOnly `Set-Cookie` tokens
|
|
70
|
+
* from login/refresh persist and every post-login REST call authenticates
|
|
71
|
+
* correctly under Node.
|
|
72
|
+
*
|
|
73
|
+
* Lives in this Node-only module (reachable via the `axiam-sdk/node` and
|
|
74
|
+
* `axiam-sdk/grpc` subpaths) rather than in the browser-safe `axiam-sdk/rest`
|
|
75
|
+
* entry, so browser bundles never pull in tough-cookie/jose/node:https (SC#1).
|
|
76
|
+
* The returned client shares the single session with any `AuthzGrpcClient`
|
|
77
|
+
* built from the same `NodeSession`.
|
|
78
|
+
*/
|
|
79
|
+
declare function createNodeClient(options: AxiamClientOptions): AxiamClient;
|
|
80
|
+
|
|
81
|
+
/** The `axiam_access` cookie name (httpOnly, path `/`). */
|
|
82
|
+
declare const ACCESS_COOKIE = "axiam_access";
|
|
83
|
+
/** The `axiam_refresh` cookie name (httpOnly, path-scoped to `/api/v1/auth/refresh`). */
|
|
84
|
+
declare const REFRESH_COOKIE = "axiam_refresh";
|
|
85
|
+
/** The `axiam_csrf` cookie name (JS-readable, path `/`). */
|
|
86
|
+
declare const CSRF_COOKIE = "axiam_csrf";
|
|
87
|
+
/** Construct a fresh, per-client-instance cookie jar (§4 — never process-global). */
|
|
88
|
+
declare function createJar(): CookieJar;
|
|
89
|
+
/**
|
|
90
|
+
* Wrap an axios instance with `axios-cookiejar-support` so the jar persists
|
|
91
|
+
* `Set-Cookie` responses across requests and replays them on subsequent
|
|
92
|
+
* requests to the same origin/path (§4). Mutates and returns the same
|
|
93
|
+
* instance (matches `axios-cookiejar-support`'s documented in-place wrap).
|
|
94
|
+
*/
|
|
95
|
+
declare function wrapAxios(instance: AxiosInstance, jar: CookieJar): AxiosInstance;
|
|
96
|
+
/**
|
|
97
|
+
* Read a single cookie's value out of the jar by name, for the given URL.
|
|
98
|
+
* This is the ONLY token-source path (RESEARCH.md Area 3 — no JSON-body
|
|
99
|
+
* fallback exists on the wire).
|
|
100
|
+
*/
|
|
101
|
+
declare function extractCookieValue(jar: CookieJar, url: string, name: string): Promise<string | undefined>;
|
|
102
|
+
|
|
103
|
+
export { ACCESS_COOKIE, CSRF_COOKIE, NodeSession, REFRESH_COOKIE, TokenManager, Verifier, createJar, createNodeClient, createNodeSession, extractCookieValue, wrapAxios };
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { CookieJar } from 'tough-cookie';
|
|
2
|
+
import { S as SharedSession, a as AxiamClientOptions, b as AxiamClient } from '../client-B2SB-C7c.js';
|
|
3
|
+
import { S as Sensitive } from '../sensitive-CWBH_tHr.js';
|
|
4
|
+
import { V as Verifier } from '../jwks-CX-nhD6A.js';
|
|
5
|
+
export { A as AxiamClaims, J as JWKS_PATH, c as createVerifier } from '../jwks-CX-nhD6A.js';
|
|
6
|
+
import { AxiosInstance } from 'axios';
|
|
7
|
+
|
|
8
|
+
declare class TokenManager {
|
|
9
|
+
#private;
|
|
10
|
+
constructor(jar: CookieJar, baseUrl: string, tenantId?: string);
|
|
11
|
+
/**
|
|
12
|
+
* Synchronous, best-effort read of the last-known access token. Returns
|
|
13
|
+
* `null` if no token has been cached yet (no request/refresh has
|
|
14
|
+
* completed since construction, or `syncFromJar()` was never called).
|
|
15
|
+
*/
|
|
16
|
+
cachedAccessToken(): Sensitive<string> | null;
|
|
17
|
+
/**
|
|
18
|
+
* Async read of the current `axiam_refresh` cookie value from the jar,
|
|
19
|
+
* wrapped in Sensitive<T>. Queried against the refresh endpoint's URL
|
|
20
|
+
* since the cookie is path-scoped to `/api/v1/auth/refresh` (not visible
|
|
21
|
+
* at the bare base URL).
|
|
22
|
+
*/
|
|
23
|
+
refreshTokenValue(): Promise<Sensitive<string> | null>;
|
|
24
|
+
/**
|
|
25
|
+
* Refresh the in-memory cached access token from the jar. Call this after
|
|
26
|
+
* every REST request/refresh so the synchronous gRPC-interceptor fast-path
|
|
27
|
+
* (`cachedAccessToken()`) stays current (Pitfall 3).
|
|
28
|
+
*/
|
|
29
|
+
syncFromJar(): Promise<void>;
|
|
30
|
+
/** The resolved tenant identifier (slug or UUID form), if known. */
|
|
31
|
+
tenantId(): string | undefined;
|
|
32
|
+
/** Set/update the resolved tenant identifier (e.g. after decoding the access token's tenant_id claim). */
|
|
33
|
+
setTenantId(tenantId: string): void;
|
|
34
|
+
/** Clear all cached token state (used by logout()). */
|
|
35
|
+
clear(): void;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
declare class NodeSession extends SharedSession {
|
|
39
|
+
#private;
|
|
40
|
+
readonly tokenManager: TokenManager;
|
|
41
|
+
readonly jwksVerifier: Verifier;
|
|
42
|
+
constructor(options: AxiamClientOptions, base: SharedSession, tokenManager: TokenManager, jwksVerifier: Verifier, jar: CookieJar);
|
|
43
|
+
/**
|
|
44
|
+
* Drives the actual `POST /api/v1/auth/refresh` HTTP call. Passed to this
|
|
45
|
+
* session's per-instance `refreshGuard` (inherited from SharedSession) by
|
|
46
|
+
* both REST's reactive interceptor (rest/interceptors.ts) and gRPC's
|
|
47
|
+
* callWithRefresh — since `refreshGuard` is scoped to THIS session
|
|
48
|
+
* instance (CR-02, D-13), both transports share exactly one in-flight
|
|
49
|
+
* refresh for this session regardless of which one triggers it, while
|
|
50
|
+
* remaining fully independent from any other session's guard.
|
|
51
|
+
*/
|
|
52
|
+
doRefresh: () => Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* Session-level hook (CR-01, D-05) invoked by rest/auth.ts after a
|
|
55
|
+
* successful login()/verifyMfa(). Refreshes the cached access token (so
|
|
56
|
+
* the gRPC interceptor's synchronous fast-path is current immediately
|
|
57
|
+
* after login) and reads the `axiam_csrf` cookie out of the jar into
|
|
58
|
+
* `session.csrfToken`, mirroring TokenManager.syncFromJar()'s pattern.
|
|
59
|
+
*/
|
|
60
|
+
onAuthenticated: () => Promise<void>;
|
|
61
|
+
}
|
|
62
|
+
/** Build the Node persona's session: REST SharedSession + cookie jar + TokenManager + JWKS verifier. */
|
|
63
|
+
declare function createNodeSession(options: AxiamClientOptions): NodeSession;
|
|
64
|
+
/**
|
|
65
|
+
* Build an `AxiamClient` wired to the Node persona (SDK-Q05). This is the Node
|
|
66
|
+
* counterpart to `new AxiamClient(options)` (which builds the browser
|
|
67
|
+
* `SharedSession` with no cookie jar): it constructs a `NodeSession`
|
|
68
|
+
* (tough-cookie jar + CSRF/refresh token sync) and adopts it via the
|
|
69
|
+
* `AxiamClient` session-injection constructor, so httpOnly `Set-Cookie` tokens
|
|
70
|
+
* from login/refresh persist and every post-login REST call authenticates
|
|
71
|
+
* correctly under Node.
|
|
72
|
+
*
|
|
73
|
+
* Lives in this Node-only module (reachable via the `axiam-sdk/node` and
|
|
74
|
+
* `axiam-sdk/grpc` subpaths) rather than in the browser-safe `axiam-sdk/rest`
|
|
75
|
+
* entry, so browser bundles never pull in tough-cookie/jose/node:https (SC#1).
|
|
76
|
+
* The returned client shares the single session with any `AuthzGrpcClient`
|
|
77
|
+
* built from the same `NodeSession`.
|
|
78
|
+
*/
|
|
79
|
+
declare function createNodeClient(options: AxiamClientOptions): AxiamClient;
|
|
80
|
+
|
|
81
|
+
/** The `axiam_access` cookie name (httpOnly, path `/`). */
|
|
82
|
+
declare const ACCESS_COOKIE = "axiam_access";
|
|
83
|
+
/** The `axiam_refresh` cookie name (httpOnly, path-scoped to `/api/v1/auth/refresh`). */
|
|
84
|
+
declare const REFRESH_COOKIE = "axiam_refresh";
|
|
85
|
+
/** The `axiam_csrf` cookie name (JS-readable, path `/`). */
|
|
86
|
+
declare const CSRF_COOKIE = "axiam_csrf";
|
|
87
|
+
/** Construct a fresh, per-client-instance cookie jar (§4 — never process-global). */
|
|
88
|
+
declare function createJar(): CookieJar;
|
|
89
|
+
/**
|
|
90
|
+
* Wrap an axios instance with `axios-cookiejar-support` so the jar persists
|
|
91
|
+
* `Set-Cookie` responses across requests and replays them on subsequent
|
|
92
|
+
* requests to the same origin/path (§4). Mutates and returns the same
|
|
93
|
+
* instance (matches `axios-cookiejar-support`'s documented in-place wrap).
|
|
94
|
+
*/
|
|
95
|
+
declare function wrapAxios(instance: AxiosInstance, jar: CookieJar): AxiosInstance;
|
|
96
|
+
/**
|
|
97
|
+
* Read a single cookie's value out of the jar by name, for the given URL.
|
|
98
|
+
* This is the ONLY token-source path (RESEARCH.md Area 3 — no JSON-body
|
|
99
|
+
* fallback exists on the wire).
|
|
100
|
+
*/
|
|
101
|
+
declare function extractCookieValue(jar: CookieJar, url: string, name: string): Promise<string | undefined>;
|
|
102
|
+
|
|
103
|
+
export { ACCESS_COOKIE, CSRF_COOKIE, NodeSession, REFRESH_COOKIE, TokenManager, Verifier, createJar, createNodeClient, createNodeSession, extractCookieValue, wrapAxios };
|