@vef-framework-react/core 2.12.0 → 2.13.1
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/cjs/http/body-encoding.cjs +1 -0
- package/dist/cjs/http/client.cjs +1 -1
- package/dist/cjs/http/constants.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/push/client.cjs +1 -0
- package/dist/cjs/push/helpers.cjs +1 -0
- package/dist/cjs/push/index.cjs +1 -0
- package/dist/cjs/push/types.cjs +1 -0
- package/dist/es/api/client.js +1 -1
- package/dist/es/api/constants.js +1 -1
- package/dist/es/api/helpers.js +1 -1
- package/dist/es/api/index.js +1 -1
- package/dist/es/auth/helpers.js +1 -1
- package/dist/es/auth/index.js +1 -1
- package/dist/es/context/api-client.js +1 -1
- package/dist/es/context/app.js +1 -1
- package/dist/es/context/context-selector.js +1 -1
- package/dist/es/context/disabled.js +1 -1
- package/dist/es/context/index.js +1 -1
- package/dist/es/dnd/index.js +1 -1
- package/dist/es/http/body-encoding.js +28 -0
- package/dist/es/http/client.js +78 -56
- package/dist/es/http/constants.js +3 -3
- package/dist/es/http/errors.js +1 -1
- package/dist/es/http/helpers.js +1 -1
- package/dist/es/http/index.js +1 -1
- package/dist/es/immer/index.js +1 -1
- package/dist/es/index.js +21 -18
- package/dist/es/motion/features.js +1 -1
- package/dist/es/motion/index.js +1 -1
- package/dist/es/motion/motion-provider.js +1 -1
- package/dist/es/push/client.js +103 -0
- package/dist/es/push/helpers.js +8 -0
- package/dist/es/push/index.js +5 -0
- package/dist/es/push/types.js +5 -0
- package/dist/es/query/constants.js +1 -1
- package/dist/es/query/helpers.js +1 -1
- package/dist/es/query/hooks.js +1 -1
- package/dist/es/query/index.js +1 -1
- package/dist/es/sse/client.js +1 -1
- package/dist/es/sse/helpers.js +1 -1
- package/dist/es/sse/index.js +1 -1
- package/dist/es/sse/stream-machine.js +1 -1
- package/dist/es/state/index.js +1 -1
- package/dist/es/state-machine/index.js +1 -1
- package/dist/es/storage/errors.js +1 -1
- package/dist/es/storage/index.js +1 -1
- package/dist/es/storage/protocol.js +1 -1
- package/dist/es/storage/resumable/fingerprint.js +1 -1
- package/dist/es/storage/resumable/index.js +1 -1
- package/dist/es/storage/resumable/persistence.js +1 -1
- package/dist/es/storage/resumable/plan.js +1 -1
- package/dist/es/storage/types.js +1 -1
- package/dist/es/storage/uploader-machine.js +1 -1
- package/dist/es/storage/uploader.js +1 -1
- package/dist/es/store/bound.js +1 -1
- package/dist/es/store/index.js +1 -1
- package/dist/es/store/unbound.js +1 -1
- package/dist/es/store/use-deep.js +1 -1
- package/dist/types/context/types.d.ts +3 -3
- package/dist/types/http/body-encoding.d.ts +18 -0
- package/dist/types/http/client.d.ts +9 -1
- package/dist/types/http/constants.d.ts +5 -0
- package/dist/types/http/types.d.ts +18 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/push/client.d.ts +33 -0
- package/dist/types/push/helpers.d.ts +9 -0
- package/dist/types/push/index.d.ts +3 -0
- package/dist/types/push/types.d.ts +103 -0
- package/package.json +2 -2
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { Awaitable, MaybeUndefined } from '@vef-framework-react/shared';
|
|
2
|
+
import { AuthTokens } from '../http';
|
|
3
|
+
/**
|
|
4
|
+
* Close code sent when the connection's login session was revoked (logout,
|
|
5
|
+
* concurrent-login eviction, administrative kick) or expired. Terminal: the
|
|
6
|
+
* client must not reconnect and should enter its logged-out flow.
|
|
7
|
+
*/
|
|
8
|
+
export declare const PUSH_CLOSE_SESSION_INVALID = 4401;
|
|
9
|
+
/**
|
|
10
|
+
* Close code sent when the per-user connection cap was reached. Terminal: the
|
|
11
|
+
* client must not retry until another connection closes.
|
|
12
|
+
*/
|
|
13
|
+
export declare const PUSH_CLOSE_TOO_MANY_CONNECTIONS = 4429;
|
|
14
|
+
/**
|
|
15
|
+
* The wire envelope every push message arrives in (one JSON text frame).
|
|
16
|
+
*/
|
|
17
|
+
export interface PushMessage<TPayload = unknown> {
|
|
18
|
+
/**
|
|
19
|
+
* Server-generated message id, stable across recipients.
|
|
20
|
+
*/
|
|
21
|
+
id: string;
|
|
22
|
+
/**
|
|
23
|
+
* Business-defined discriminator handlers subscribe on.
|
|
24
|
+
*/
|
|
25
|
+
type: string;
|
|
26
|
+
/**
|
|
27
|
+
* Arbitrary JSON payload; absent when the server sent none.
|
|
28
|
+
*/
|
|
29
|
+
payload?: TPayload;
|
|
30
|
+
/**
|
|
31
|
+
* Server-side send time (RFC 3339).
|
|
32
|
+
*/
|
|
33
|
+
time: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Push connection lifecycle status.
|
|
37
|
+
*/
|
|
38
|
+
export type PushStatus = "idle" | "connecting" | "open" | "reconnecting" | "closed";
|
|
39
|
+
/**
|
|
40
|
+
* Reconnect backoff configuration. Only transport-level failures reconnect;
|
|
41
|
+
* terminal close codes (4401 / 4429) and an explicit `close()` never do.
|
|
42
|
+
*/
|
|
43
|
+
export interface PushReconnectOptions {
|
|
44
|
+
/**
|
|
45
|
+
* Whether to reconnect after a transport-level loss.
|
|
46
|
+
*
|
|
47
|
+
* @default true
|
|
48
|
+
*/
|
|
49
|
+
enabled?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* First retry delay in milliseconds; doubles per attempt.
|
|
52
|
+
*
|
|
53
|
+
* @default 1000
|
|
54
|
+
*/
|
|
55
|
+
initialDelay?: number;
|
|
56
|
+
/**
|
|
57
|
+
* Upper bound for the retry delay in milliseconds.
|
|
58
|
+
*
|
|
59
|
+
* @default 30000
|
|
60
|
+
*/
|
|
61
|
+
maxDelay?: number;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Push message handler.
|
|
65
|
+
*/
|
|
66
|
+
export type PushMessageHandler<TPayload = unknown> = (message: PushMessage<TPayload>) => void;
|
|
67
|
+
/**
|
|
68
|
+
* Push client options.
|
|
69
|
+
*/
|
|
70
|
+
export interface PushClientOptions {
|
|
71
|
+
/**
|
|
72
|
+
* Push endpoint URL. Accepts ws(s):// or http(s):// (converted), absolute
|
|
73
|
+
* or relative (resolved against the current origin).
|
|
74
|
+
*
|
|
75
|
+
* @default "/ws"
|
|
76
|
+
*/
|
|
77
|
+
url?: string;
|
|
78
|
+
/**
|
|
79
|
+
* Retrieve auth tokens. The access token rides the `__accessToken` query
|
|
80
|
+
* parameter — a browser WebSocket cannot set an Authorization header — and
|
|
81
|
+
* is re-read from here on every (re)connect attempt, so a refreshed token
|
|
82
|
+
* is picked up automatically.
|
|
83
|
+
*/
|
|
84
|
+
getAuthTokens?: () => Awaitable<MaybeUndefined<Readonly<Pick<AuthTokens, "accessToken">>>>;
|
|
85
|
+
/**
|
|
86
|
+
* Reconnect backoff configuration.
|
|
87
|
+
*/
|
|
88
|
+
reconnect?: PushReconnectOptions;
|
|
89
|
+
/**
|
|
90
|
+
* Called when the server closes with 4401 (session revoked or expired).
|
|
91
|
+
* The client will not reconnect; route the user to the logged-out flow.
|
|
92
|
+
*/
|
|
93
|
+
onSessionInvalid?: (event: CloseEvent) => void;
|
|
94
|
+
/**
|
|
95
|
+
* Called when the server refuses the connection with 4429 (per-user
|
|
96
|
+
* connection cap). The client will not retry automatically.
|
|
97
|
+
*/
|
|
98
|
+
onConnectionRejected?: (event: CloseEvent) => void;
|
|
99
|
+
/**
|
|
100
|
+
* Observes connection status transitions.
|
|
101
|
+
*/
|
|
102
|
+
onStatusChange?: (status: PushStatus) => void;
|
|
103
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vef-framework-react/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.13.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Core features for VEF framework",
|
|
6
6
|
"keywords": [
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"use-immer": "^0.11.0",
|
|
58
58
|
"xstate": "^5.32.3",
|
|
59
59
|
"zustand": "^5.0.14",
|
|
60
|
-
"@vef-framework-react/shared": "2.
|
|
60
|
+
"@vef-framework-react/shared": "2.13.1"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"react": "^19.2.7"
|