@reactor-team/js-sdk 3.1.0 → 3.2.0
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/README.md +63 -11
- package/dist/index.cjs +59 -37
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +36 -18
- package/dist/index.d.ts +36 -18
- package/dist/index.js +59 -37
- package/dist/index.js.map +1 -1
- package/dist/wasm/reactor_wasm.d.ts +15 -6
- package/dist/wasm/reactor_wasm.js +22 -9
- package/package.json +1 -1
- package/dist/wasm/reactor_wasm_bg.wasm +0 -0
|
@@ -59,9 +59,17 @@ export interface ConnectOptions {
|
|
|
59
59
|
maxAttempts?: number;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
/**
|
|
63
|
-
*
|
|
64
|
-
|
|
62
|
+
/** What a token is being resolved for. `sessionId` is set for every request
|
|
63
|
+
* that targets an existing session and unset for session creation. A
|
|
64
|
+
* resolver that mints a replacement token must bind it to that session
|
|
65
|
+
* (`resources.sessions.bind`), or the token cannot reach the session. */
|
|
66
|
+
export interface JwtRequestContext {
|
|
67
|
+
sessionId?: string;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** A token, or a resolver called before every authenticated request with a
|
|
71
|
+
* `JwtRequestContext`. Returning "" sends no Authorization header. */
|
|
72
|
+
export type JwtSource = string | ((context?: JwtRequestContext) => string | Promise<string>);
|
|
65
73
|
|
|
66
74
|
export interface TrackCapability {
|
|
67
75
|
name: string;
|
|
@@ -249,9 +257,10 @@ export class ReactorClient {
|
|
|
249
257
|
* Create a client.
|
|
250
258
|
*
|
|
251
259
|
* * `options` — see the `ClientOptions` fields; `modelName` is required.
|
|
252
|
-
* * `jwt` — a token string, a `() => string | Promise<string>`
|
|
253
|
-
* called before every authenticated request
|
|
254
|
-
* unauthenticated local runtime.
|
|
260
|
+
* * `jwt` — a token string, a `(context) => string | Promise<string>`
|
|
261
|
+
* resolver called before every authenticated request with the session
|
|
262
|
+
* it is for, or `null` for an unauthenticated local runtime.
|
|
263
|
+
* Replaceable later with `setJwt`.
|
|
255
264
|
*/
|
|
256
265
|
constructor(options: ClientOptions, jwt?: JwtSource | null);
|
|
257
266
|
/**
|