@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.
Files changed (70) hide show
  1. package/dist/cjs/http/body-encoding.cjs +1 -0
  2. package/dist/cjs/http/client.cjs +1 -1
  3. package/dist/cjs/http/constants.cjs +1 -1
  4. package/dist/cjs/index.cjs +1 -1
  5. package/dist/cjs/push/client.cjs +1 -0
  6. package/dist/cjs/push/helpers.cjs +1 -0
  7. package/dist/cjs/push/index.cjs +1 -0
  8. package/dist/cjs/push/types.cjs +1 -0
  9. package/dist/es/api/client.js +1 -1
  10. package/dist/es/api/constants.js +1 -1
  11. package/dist/es/api/helpers.js +1 -1
  12. package/dist/es/api/index.js +1 -1
  13. package/dist/es/auth/helpers.js +1 -1
  14. package/dist/es/auth/index.js +1 -1
  15. package/dist/es/context/api-client.js +1 -1
  16. package/dist/es/context/app.js +1 -1
  17. package/dist/es/context/context-selector.js +1 -1
  18. package/dist/es/context/disabled.js +1 -1
  19. package/dist/es/context/index.js +1 -1
  20. package/dist/es/dnd/index.js +1 -1
  21. package/dist/es/http/body-encoding.js +28 -0
  22. package/dist/es/http/client.js +78 -56
  23. package/dist/es/http/constants.js +3 -3
  24. package/dist/es/http/errors.js +1 -1
  25. package/dist/es/http/helpers.js +1 -1
  26. package/dist/es/http/index.js +1 -1
  27. package/dist/es/immer/index.js +1 -1
  28. package/dist/es/index.js +21 -18
  29. package/dist/es/motion/features.js +1 -1
  30. package/dist/es/motion/index.js +1 -1
  31. package/dist/es/motion/motion-provider.js +1 -1
  32. package/dist/es/push/client.js +103 -0
  33. package/dist/es/push/helpers.js +8 -0
  34. package/dist/es/push/index.js +5 -0
  35. package/dist/es/push/types.js +5 -0
  36. package/dist/es/query/constants.js +1 -1
  37. package/dist/es/query/helpers.js +1 -1
  38. package/dist/es/query/hooks.js +1 -1
  39. package/dist/es/query/index.js +1 -1
  40. package/dist/es/sse/client.js +1 -1
  41. package/dist/es/sse/helpers.js +1 -1
  42. package/dist/es/sse/index.js +1 -1
  43. package/dist/es/sse/stream-machine.js +1 -1
  44. package/dist/es/state/index.js +1 -1
  45. package/dist/es/state-machine/index.js +1 -1
  46. package/dist/es/storage/errors.js +1 -1
  47. package/dist/es/storage/index.js +1 -1
  48. package/dist/es/storage/protocol.js +1 -1
  49. package/dist/es/storage/resumable/fingerprint.js +1 -1
  50. package/dist/es/storage/resumable/index.js +1 -1
  51. package/dist/es/storage/resumable/persistence.js +1 -1
  52. package/dist/es/storage/resumable/plan.js +1 -1
  53. package/dist/es/storage/types.js +1 -1
  54. package/dist/es/storage/uploader-machine.js +1 -1
  55. package/dist/es/storage/uploader.js +1 -1
  56. package/dist/es/store/bound.js +1 -1
  57. package/dist/es/store/index.js +1 -1
  58. package/dist/es/store/unbound.js +1 -1
  59. package/dist/es/store/use-deep.js +1 -1
  60. package/dist/types/context/types.d.ts +3 -3
  61. package/dist/types/http/body-encoding.d.ts +18 -0
  62. package/dist/types/http/client.d.ts +9 -1
  63. package/dist/types/http/constants.d.ts +5 -0
  64. package/dist/types/http/types.d.ts +18 -0
  65. package/dist/types/index.d.ts +2 -1
  66. package/dist/types/push/client.d.ts +33 -0
  67. package/dist/types/push/helpers.d.ts +9 -0
  68. package/dist/types/push/index.d.ts +3 -0
  69. package/dist/types/push/types.d.ts +103 -0
  70. 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.12.0",
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.12.0"
60
+ "@vef-framework-react/shared": "2.13.1"
61
61
  },
62
62
  "devDependencies": {
63
63
  "react": "^19.2.7"