@vef-framework-react/core 2.3.0 → 2.4.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.
Files changed (142) hide show
  1. package/dist/cjs/api/client.cjs +1 -1
  2. package/dist/cjs/api/constants.cjs +1 -1
  3. package/dist/cjs/api/helpers.cjs +1 -1
  4. package/dist/cjs/api/index.cjs +1 -1
  5. package/dist/cjs/auth/helpers.cjs +1 -1
  6. package/dist/cjs/auth/index.cjs +1 -1
  7. package/dist/cjs/context/api-client.cjs +1 -1
  8. package/dist/cjs/context/app.cjs +1 -1
  9. package/dist/cjs/context/context-selector.cjs +1 -1
  10. package/dist/cjs/context/disabled.cjs +1 -1
  11. package/dist/cjs/context/index.cjs +1 -1
  12. package/dist/cjs/dnd/index.cjs +1 -1
  13. package/dist/cjs/http/client.cjs +1 -1
  14. package/dist/cjs/http/helpers.cjs +1 -1
  15. package/dist/cjs/http/index.cjs +1 -1
  16. package/dist/cjs/immer/index.cjs +1 -1
  17. package/dist/cjs/index.cjs +1 -1
  18. package/dist/cjs/motion/features.cjs +1 -1
  19. package/dist/cjs/motion/index.cjs +1 -1
  20. package/dist/cjs/motion/motion-provider.cjs +1 -1
  21. package/dist/cjs/query/helpers.cjs +1 -1
  22. package/dist/cjs/query/hooks.cjs +1 -1
  23. package/dist/cjs/query/index.cjs +1 -1
  24. package/dist/cjs/sse/client.cjs +1 -1
  25. package/dist/cjs/sse/helpers.cjs +1 -1
  26. package/dist/cjs/sse/index.cjs +1 -1
  27. package/dist/cjs/sse/stream-machine.cjs +1 -0
  28. package/dist/cjs/state/index.cjs +1 -1
  29. package/dist/cjs/state-machine/index.cjs +1 -1
  30. package/dist/cjs/storage/index.cjs +1 -1
  31. package/dist/cjs/storage/protocol.cjs +1 -1
  32. package/dist/cjs/storage/resumable/index.cjs +1 -1
  33. package/dist/cjs/storage/resumable/plan.cjs +1 -1
  34. package/dist/cjs/storage/uploader-machine.cjs +1 -0
  35. package/dist/cjs/storage/uploader.cjs +1 -1
  36. package/dist/cjs/store/bound.cjs +1 -1
  37. package/dist/cjs/store/index.cjs +1 -1
  38. package/dist/cjs/store/unbound.cjs +1 -1
  39. package/dist/cjs/store/use-deep.cjs +1 -1
  40. package/dist/es/api/client.js +1 -1
  41. package/dist/es/api/constants.js +1 -1
  42. package/dist/es/api/helpers.js +1 -1
  43. package/dist/es/api/index.js +1 -1
  44. package/dist/es/auth/helpers.js +1 -1
  45. package/dist/es/auth/index.js +1 -1
  46. package/dist/es/context/api-client.js +1 -1
  47. package/dist/es/context/app.js +1 -1
  48. package/dist/es/context/context-selector.js +1 -1
  49. package/dist/es/context/disabled.js +1 -1
  50. package/dist/es/context/index.js +1 -1
  51. package/dist/es/dnd/index.js +11 -10
  52. package/dist/es/http/client.js +1 -1
  53. package/dist/es/http/constants.js +1 -1
  54. package/dist/es/http/errors.js +1 -1
  55. package/dist/es/http/helpers.js +1 -1
  56. package/dist/es/http/index.js +1 -1
  57. package/dist/es/immer/index.js +1 -1
  58. package/dist/es/index.js +22 -22
  59. package/dist/es/motion/features.js +1 -1
  60. package/dist/es/motion/index.js +1 -1
  61. package/dist/es/motion/motion-provider.js +1 -1
  62. package/dist/es/query/constants.js +1 -1
  63. package/dist/es/query/helpers.js +1 -1
  64. package/dist/es/query/hooks.js +1 -1
  65. package/dist/es/query/index.js +1 -1
  66. package/dist/es/sse/client.js +61 -55
  67. package/dist/es/sse/helpers.js +1 -1
  68. package/dist/es/sse/index.js +1 -1
  69. package/dist/es/sse/stream-machine.js +102 -0
  70. package/dist/es/state/index.js +1 -1
  71. package/dist/es/state-machine/index.js +9 -9
  72. package/dist/es/storage/errors.js +1 -1
  73. package/dist/es/storage/index.js +1 -1
  74. package/dist/es/storage/protocol.js +1 -1
  75. package/dist/es/storage/resumable/fingerprint.js +1 -1
  76. package/dist/es/storage/resumable/index.js +1 -1
  77. package/dist/es/storage/resumable/persistence.js +1 -1
  78. package/dist/es/storage/resumable/plan.js +1 -1
  79. package/dist/es/storage/types.js +1 -1
  80. package/dist/es/storage/uploader-machine.js +88 -0
  81. package/dist/es/storage/uploader.js +135 -89
  82. package/dist/es/store/bound.js +1 -1
  83. package/dist/es/store/index.js +1 -1
  84. package/dist/es/store/unbound.js +1 -1
  85. package/dist/es/store/use-deep.js +1 -1
  86. package/dist/types/{dnd → src/dnd}/index.d.ts +3 -2
  87. package/dist/types/{index.d.ts → src/index.d.ts} +1 -1
  88. package/dist/types/{query → src/query}/hooks.d.ts +1 -1
  89. package/dist/types/src/sse/client.d.ts +24 -0
  90. package/dist/types/src/sse/stream-machine.d.ts +104 -0
  91. package/dist/types/src/storage/uploader-machine.d.ts +108 -0
  92. package/dist/types/{storage → src/storage}/uploader.d.ts +8 -2
  93. package/package.json +8 -8
  94. package/dist/types/sse/client.d.ts +0 -16
  95. /package/dist/types/{api → src/api}/client.d.ts +0 -0
  96. /package/dist/types/{api → src/api}/constants.d.ts +0 -0
  97. /package/dist/types/{api → src/api}/helpers.d.ts +0 -0
  98. /package/dist/types/{api → src/api}/index.d.ts +0 -0
  99. /package/dist/types/{api → src/api}/types.d.ts +0 -0
  100. /package/dist/types/{auth → src/auth}/helpers.d.ts +0 -0
  101. /package/dist/types/{auth → src/auth}/index.d.ts +0 -0
  102. /package/dist/types/{auth → src/auth}/types.d.ts +0 -0
  103. /package/dist/types/{common → src/common}/index.d.ts +0 -0
  104. /package/dist/types/{common → src/common}/types.d.ts +0 -0
  105. /package/dist/types/{context → src/context}/api-client.d.ts +0 -0
  106. /package/dist/types/{context → src/context}/app.d.ts +0 -0
  107. /package/dist/types/{context → src/context}/context-selector.d.ts +0 -0
  108. /package/dist/types/{context → src/context}/disabled.d.ts +0 -0
  109. /package/dist/types/{context → src/context}/index.d.ts +0 -0
  110. /package/dist/types/{context → src/context}/types.d.ts +0 -0
  111. /package/dist/types/{http → src/http}/client.d.ts +0 -0
  112. /package/dist/types/{http → src/http}/constants.d.ts +0 -0
  113. /package/dist/types/{http → src/http}/errors.d.ts +0 -0
  114. /package/dist/types/{http → src/http}/helpers.d.ts +0 -0
  115. /package/dist/types/{http → src/http}/index.d.ts +0 -0
  116. /package/dist/types/{http → src/http}/types.d.ts +0 -0
  117. /package/dist/types/{immer → src/immer}/index.d.ts +0 -0
  118. /package/dist/types/{motion → src/motion}/features.d.ts +0 -0
  119. /package/dist/types/{motion → src/motion}/index.d.ts +0 -0
  120. /package/dist/types/{motion → src/motion}/motion-provider.d.ts +0 -0
  121. /package/dist/types/{query → src/query}/constants.d.ts +0 -0
  122. /package/dist/types/{query → src/query}/helpers.d.ts +0 -0
  123. /package/dist/types/{query → src/query}/index.d.ts +0 -0
  124. /package/dist/types/{query → src/query}/types.d.ts +0 -0
  125. /package/dist/types/{sse → src/sse}/helpers.d.ts +0 -0
  126. /package/dist/types/{sse → src/sse}/index.d.ts +0 -0
  127. /package/dist/types/{sse → src/sse}/types.d.ts +0 -0
  128. /package/dist/types/{state → src/state}/index.d.ts +0 -0
  129. /package/dist/types/{state-machine → src/state-machine}/index.d.ts +0 -0
  130. /package/dist/types/{storage → src/storage}/errors.d.ts +0 -0
  131. /package/dist/types/{storage → src/storage}/index.d.ts +0 -0
  132. /package/dist/types/{storage → src/storage}/protocol.d.ts +0 -0
  133. /package/dist/types/{storage → src/storage}/resumable/fingerprint.d.ts +0 -0
  134. /package/dist/types/{storage → src/storage}/resumable/index.d.ts +0 -0
  135. /package/dist/types/{storage → src/storage}/resumable/persistence.d.ts +0 -0
  136. /package/dist/types/{storage → src/storage}/resumable/plan.d.ts +0 -0
  137. /package/dist/types/{storage → src/storage}/types.d.ts +0 -0
  138. /package/dist/types/{store → src/store}/bound.d.ts +0 -0
  139. /package/dist/types/{store → src/store}/index.d.ts +0 -0
  140. /package/dist/types/{store → src/store}/types.d.ts +0 -0
  141. /package/dist/types/{store → src/store}/unbound.d.ts +0 -0
  142. /package/dist/types/{store → src/store}/use-deep.d.ts +0 -0
package/dist/es/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @vef-framework-react/core v2.3.0 made by Venus | 2026-05-22T09:39:47.405Z */
1
+ /*! @vef-framework-react/core v2.4.0 made by Venus | 2026-06-15T15:10:07.347Z */
2
2
  import { SKIP_AUTH_HEADER as e, SKIP_AUTH_VALUE as t } from "./http/constants.js";
3
3
  import { keepPreviousData as n } from "./query/helpers.js";
4
4
  import { matchMutation as r, matchQuery as i, skipQueryToken as a, useInfiniteQuery as o, useIsFetching as s, useIsMutating as c, useMutation as l, useMutationState as u, useQueries as d, useQuery as f, useQueryClient as p, useQueryErrorResetBoundary as m } from "./query/hooks.js";
@@ -10,24 +10,24 @@ import { ApiClientProvider as x, useApiClient as S } from "./context/api-client.
10
10
  import { AppContextProvider as C, useAppContext as w } from "./context/app.js";
11
11
  import { createContextWithSelector as T } from "./context/context-selector.js";
12
12
  import { DisabledProvider as E, useDisabled as D } from "./context/disabled.js";
13
- import { AxisModifier as O, DragDropContext as k, DragDropProvider as A, DragOverlay as j, Draggable as M, Droppable as N, Feedback as P, KeyboardSensor as F, PointerSensor as I, RestrictToElement as L, RestrictToHorizontalAxis as R, RestrictToVerticalAxis as z, RestrictToWindow as B, SnapModifier as V, closestCenter as H, closestCorners as U, defaultCollisionDetection as W, defaultPreset as G, directionBiased as K, moveArrayItem as q, moveDragItem as J, pointerDistance as Y, pointerIntersection as X, restrictShapeToBoundingRectangle as Z, shapeIntersection as Q, swapArrayItem as $, swapDragItem as ee, useDragDropMonitor as te, useDraggable as ne, useDroppable as re, useSortable as ie } from "./dnd/index.js";
14
- import { applyPatches as ae, currentState as oe, originalState as se, produce as ce, produceWithPatches as le, useImmer as ue, useImmerReducer as de } from "./immer/index.js";
15
- import fe from "./motion/motion-provider.js";
16
- import { AnimatePresence as pe, LayoutGroup as me, Reorder as he, motion as ge, useDragControls as _e, useInView as ve } from "./motion/index.js";
17
- import { SseClient as ye } from "./sse/client.js";
18
- import { createSseClient as be } from "./sse/helpers.js";
19
- import { AtomStoreProvider as xe, atom as Se, createAtomStore as Ce, getDefaultAtomStore as we, useAtom as Te, useAtomStore as Ee, useAtomValue as De, useSetAtom as Oe } from "./state/index.js";
20
- import { Actor as ke, createActor as Ae, createMachine as je, updateContext as Me, useActor as Ne, useActorRef as Pe } from "./state-machine/index.js";
21
- import { UploadAbortedError as Fe, UploadError as Ie, UploadPartError as Le, UploadProtocolError as Re } from "./storage/errors.js";
22
- import { DEFAULT_API_PATH as ze, DEFAULT_RESOURCE as Be, DEFAULT_VERSION as Ve, abortUpload as He, completeUpload as Ue, initUpload as We, listParts as Ge, uploadPart as Ke } from "./storage/protocol.js";
23
- import { PrefixFingerprinter as qe, WeakFingerprinter as Je } from "./storage/resumable/fingerprint.js";
24
- import { LocalStoragePersistence as Ye } from "./storage/resumable/persistence.js";
25
- import { resolveResumePlan as Xe } from "./storage/resumable/plan.js";
26
- import { PRIVATE_PREFIX as Ze, PUBLIC_PREFIX as Qe } from "./storage/types.js";
27
- import { Uploader as $e, uploadFile as et } from "./storage/uploader.js";
28
- import { createPersistedStore as tt, createStore as nt } from "./store/bound.js";
29
- import { createComponentStore as rt } from "./store/unbound.js";
30
- import { useDeep as it } from "./store/use-deep.js";
31
- import { useShallow as at } from "./store/index.js";
32
- import { clsx as ot } from "clsx";
33
- export { ke as Actor, pe as AnimatePresence, _ as ApiClient, x as ApiClientProvider, C as AppContextProvider, xe as AtomStoreProvider, O as AxisModifier, E as DisabledProvider, k as DragDropContext, A as DragDropProvider, j as DragOverlay, M as Draggable, N as Droppable, P as Feedback, h as HTTP_CLIENT, F as KeyboardSensor, me as LayoutGroup, Ye as LocalStoragePersistence, fe as MotionProvider, Ze as PRIVATE_PREFIX, Qe as PUBLIC_PREFIX, I as PointerSensor, qe as PrefixFingerprinter, g as QUERY_CLIENT, he as Reorder, L as RestrictToElement, R as RestrictToHorizontalAxis, z as RestrictToVerticalAxis, B as RestrictToWindow, ze as STORAGE_API_PATH, Be as STORAGE_RESOURCE, Ve as STORAGE_VERSION, V as SnapModifier, ye as SseClient, Fe as UploadAbortedError, Ie as UploadError, Le as UploadPartError, Re as UploadProtocolError, $e as Uploader, Je as WeakFingerprinter, He as abortUpload, ae as applyPatches, Se as atom, b as checkPermission, H as closestCenter, U as closestCorners, ot as clsx, Ue as completeUpload, Ae as createActor, v as createApiClient, y as createApiRequest, Ce as createAtomStore, rt as createComponentStore, T as createContextWithSelector, je as createMachine, tt as createPersistedStore, be as createSseClient, nt as createStore, oe as currentState, W as defaultCollisionDetection, G as defaultPreset, K as directionBiased, we as getDefaultAtomStore, We as initUpload, n as keepPreviousData, Ge as listParts, r as matchMutation, i as matchQuery, ge as motion, q as moveArrayItem, J as moveDragItem, se as originalState, Y as pointerDistance, X as pointerIntersection, ce as produce, le as produceWithPatches, Xe as resolveResumePlan, Z as restrictShapeToBoundingRectangle, Q as shapeIntersection, e as skipAuthenticationHeader, t as skipAuthenticationValue, a as skipQueryToken, $ as swapArrayItem, ee as swapDragItem, Me as updateContext, et as uploadFile, Ke as uploadPart, Ne as useActor, Pe as useActorRef, S as useApiClient, w as useAppContext, Te as useAtom, Ee as useAtomStore, De as useAtomValue, it as useDeep, D as useDisabled, _e as useDragControls, te as useDragDropMonitor, ne as useDraggable, re as useDroppable, ue as useImmer, de as useImmerReducer, ve as useInView, o as useInfiniteQuery, s as useIsFetching, c as useIsMutating, l as useMutation, u as useMutationState, d as useQueries, f as useQuery, p as useQueryClient, m as useQueryErrorResetBoundary, Oe as useSetAtom, at as useShallow, ie as useSortable };
13
+ import { AxisModifier as O, CollisionPriority as k, DragDropContext as A, DragDropProvider as j, DragOverlay as M, Draggable as N, Droppable as P, Feedback as F, KeyboardSensor as I, PointerActivationConstraints as L, PointerSensor as R, RestrictToElement as z, RestrictToHorizontalAxis as B, RestrictToVerticalAxis as V, RestrictToWindow as H, SnapModifier as U, closestCenter as W, closestCorners as G, defaultCollisionDetection as K, defaultPreset as q, directionBiased as J, moveArrayItem as Y, moveDragItem as X, pointerDistance as Z, pointerIntersection as Q, restrictShapeToBoundingRectangle as $, shapeIntersection as ee, swapArrayItem as te, swapDragItem as ne, useDragDropMonitor as re, useDragOperation as ie, useDraggable as ae, useDroppable as oe, useSortable as se } from "./dnd/index.js";
14
+ import { applyPatches as ce, currentState as le, originalState as ue, produce as de, produceWithPatches as fe, useImmer as pe, useImmerReducer as me } from "./immer/index.js";
15
+ import he from "./motion/motion-provider.js";
16
+ import { AnimatePresence as ge, LayoutGroup as _e, Reorder as ve, motion as ye, useDragControls as be, useInView as xe } from "./motion/index.js";
17
+ import { SseClient as Se } from "./sse/client.js";
18
+ import { createSseClient as Ce } from "./sse/helpers.js";
19
+ import { AtomStoreProvider as we, atom as Te, createAtomStore as Ee, getDefaultAtomStore as De, useAtom as Oe, useAtomStore as ke, useAtomValue as Ae, useSetAtom as je } from "./state/index.js";
20
+ import { Actor as Me, createActor as Ne, createMachine as Pe, updateContext as Fe, useActor as Ie, useActorRef as Le } from "./state-machine/index.js";
21
+ import { UploadAbortedError as Re, UploadError as ze, UploadPartError as Be, UploadProtocolError as Ve } from "./storage/errors.js";
22
+ import { DEFAULT_API_PATH as He, DEFAULT_RESOURCE as Ue, DEFAULT_VERSION as We, abortUpload as Ge, completeUpload as Ke, initUpload as qe, listParts as Je, uploadPart as Ye } from "./storage/protocol.js";
23
+ import { PrefixFingerprinter as Xe, WeakFingerprinter as Ze } from "./storage/resumable/fingerprint.js";
24
+ import { LocalStoragePersistence as Qe } from "./storage/resumable/persistence.js";
25
+ import { resolveResumePlan as $e } from "./storage/resumable/plan.js";
26
+ import { PRIVATE_PREFIX as et, PUBLIC_PREFIX as tt } from "./storage/types.js";
27
+ import { Uploader as nt, uploadFile as rt } from "./storage/uploader.js";
28
+ import { createPersistedStore as it, createStore as at } from "./store/bound.js";
29
+ import { createComponentStore as ot } from "./store/unbound.js";
30
+ import { useDeep as st } from "./store/use-deep.js";
31
+ import { useShallow as ct } from "./store/index.js";
32
+ import { clsx as lt } from "clsx";
33
+ export { Me as Actor, ge as AnimatePresence, _ as ApiClient, x as ApiClientProvider, C as AppContextProvider, we as AtomStoreProvider, O as AxisModifier, k as CollisionPriority, E as DisabledProvider, A as DragDropContext, j as DragDropProvider, M as DragOverlay, N as Draggable, P as Droppable, F as Feedback, h as HTTP_CLIENT, I as KeyboardSensor, _e as LayoutGroup, Qe as LocalStoragePersistence, he as MotionProvider, et as PRIVATE_PREFIX, tt as PUBLIC_PREFIX, L as PointerActivationConstraints, R as PointerSensor, Xe as PrefixFingerprinter, g as QUERY_CLIENT, ve as Reorder, z as RestrictToElement, B as RestrictToHorizontalAxis, V as RestrictToVerticalAxis, H as RestrictToWindow, He as STORAGE_API_PATH, Ue as STORAGE_RESOURCE, We as STORAGE_VERSION, U as SnapModifier, Se as SseClient, Re as UploadAbortedError, ze as UploadError, Be as UploadPartError, Ve as UploadProtocolError, nt as Uploader, Ze as WeakFingerprinter, Ge as abortUpload, ce as applyPatches, Te as atom, b as checkPermission, W as closestCenter, G as closestCorners, lt as clsx, Ke as completeUpload, Ne as createActor, v as createApiClient, y as createApiRequest, Ee as createAtomStore, ot as createComponentStore, T as createContextWithSelector, Pe as createMachine, it as createPersistedStore, Ce as createSseClient, at as createStore, le as currentState, K as defaultCollisionDetection, q as defaultPreset, J as directionBiased, De as getDefaultAtomStore, qe as initUpload, n as keepPreviousData, Je as listParts, r as matchMutation, i as matchQuery, ye as motion, Y as moveArrayItem, X as moveDragItem, ue as originalState, Z as pointerDistance, Q as pointerIntersection, de as produce, fe as produceWithPatches, $e as resolveResumePlan, $ as restrictShapeToBoundingRectangle, ee as shapeIntersection, e as skipAuthenticationHeader, t as skipAuthenticationValue, a as skipQueryToken, te as swapArrayItem, ne as swapDragItem, Fe as updateContext, rt as uploadFile, Ye as uploadPart, Ie as useActor, Le as useActorRef, S as useApiClient, w as useAppContext, Oe as useAtom, ke as useAtomStore, Ae as useAtomValue, st as useDeep, D as useDisabled, be as useDragControls, re as useDragDropMonitor, ie as useDragOperation, ae as useDraggable, oe as useDroppable, pe as useImmer, me as useImmerReducer, xe as useInView, o as useInfiniteQuery, s as useIsFetching, c as useIsMutating, l as useMutation, u as useMutationState, d as useQueries, f as useQuery, p as useQueryClient, m as useQueryErrorResetBoundary, je as useSetAtom, ct as useShallow, se as useSortable };
@@ -1,3 +1,3 @@
1
- /*! @vef-framework-react/core v2.3.0 made by Venus | 2026-05-22T09:39:47.405Z */
1
+ /*! @vef-framework-react/core v2.4.0 made by Venus | 2026-06-15T15:10:07.347Z */
2
2
  import { domMax as e } from "motion/react";
3
3
  export { e as default };
@@ -1,4 +1,4 @@
1
- /*! @vef-framework-react/core v2.3.0 made by Venus | 2026-05-22T09:39:47.405Z */
1
+ /*! @vef-framework-react/core v2.4.0 made by Venus | 2026-06-15T15:10:07.347Z */
2
2
  import "./motion-provider.js";
3
3
  import { AnimatePresence as e, LayoutGroup as t, Reorder as n, useDragControls as r, useInView as i } from "motion/react";
4
4
  import * as a from "motion/react-m";
@@ -1,4 +1,4 @@
1
- /*! @vef-framework-react/core v2.3.0 made by Venus | 2026-05-22T09:39:47.405Z */
1
+ /*! @vef-framework-react/core v2.4.0 made by Venus | 2026-06-15T15:10:07.347Z */
2
2
  import { generateId as e } from "@vef-framework-react/shared";
3
3
  import { useState as t } from "react";
4
4
  import { jsx as n } from "@emotion/react/jsx-runtime";
@@ -1,4 +1,4 @@
1
- /*! @vef-framework-react/core v2.3.0 made by Venus | 2026-05-22T09:39:47.405Z */
1
+ /*! @vef-framework-react/core v2.4.0 made by Venus | 2026-06-15T15:10:07.347Z */
2
2
  //#region src/query/constants.ts
3
3
  var e = "__vef_query_client_key";
4
4
  //#endregion
@@ -1,4 +1,4 @@
1
- /*! @vef-framework-react/core v2.3.0 made by Venus | 2026-05-22T09:39:47.405Z */
1
+ /*! @vef-framework-react/core v2.4.0 made by Venus | 2026-06-15T15:10:07.347Z */
2
2
  import { hashKey as e, isPlainObject as t } from "@vef-framework-react/shared";
3
3
  import { MutationCache as n, QueryClient as r, keepPreviousData as i, matchQuery as a } from "@tanstack/react-query";
4
4
  //#region src/query/helpers.ts
@@ -1,4 +1,4 @@
1
- /*! @vef-framework-react/core v2.3.0 made by Venus | 2026-05-22T09:39:47.405Z */
1
+ /*! @vef-framework-react/core v2.4.0 made by Venus | 2026-06-15T15:10:07.347Z */
2
2
  import { matchMutation as e, matchQuery as t, skipToken as n, useInfiniteQuery as r, useIsFetching as i, useIsMutating as a, useMutation as o, useMutationState as s, useQueries as c, useQuery as l, useQueryClient as u, useQueryErrorResetBoundary as d } from "@tanstack/react-query";
3
3
  //#region src/query/hooks.ts
4
4
  function f(e) {
@@ -1,4 +1,4 @@
1
- /*! @vef-framework-react/core v2.3.0 made by Venus | 2026-05-22T09:39:47.405Z */
1
+ /*! @vef-framework-react/core v2.4.0 made by Venus | 2026-06-15T15:10:07.347Z */
2
2
  import "./constants.js";
3
3
  import "./helpers.js";
4
4
  import "./hooks.js";
@@ -1,20 +1,17 @@
1
- /*! @vef-framework-react/core v2.3.0 made by Venus | 2026-05-22T09:39:47.405Z */
2
- import { isString as e } from "@vef-framework-react/shared";
3
- import { fetchEventSource as t } from "@microsoft/fetch-event-source";
1
+ /*! @vef-framework-react/core v2.4.0 made by Venus | 2026-06-15T15:10:07.347Z */
2
+ import { TokenExpiredError as e, createStreamMachine as t } from "./stream-machine.js";
3
+ import { isString as n } from "@vef-framework-react/shared";
4
+ import { fetchEventSource as r } from "@microsoft/fetch-event-source";
5
+ import { createActor as i } from "xstate";
4
6
  //#region src/sse/client.ts
5
- var n = class extends Error {
6
- constructor() {
7
- super("Token expired"), this.name = "TokenExpiredError";
8
- }
9
- };
10
- function r(e, t) {
7
+ function a(e, t) {
11
8
  let n = t.toLowerCase();
12
9
  return Object.keys(e).some((e) => e.toLowerCase() === n);
13
10
  }
14
- function i(t, n) {
15
- if (t !== void 0) return e(t) ? t : (r(n, "content-type") || (n["Content-Type"] = "application/json"), JSON.stringify(t));
11
+ function o(e, t) {
12
+ if (e !== void 0) return n(e) ? e : (a(t, "content-type") || (t["Content-Type"] = "application/json"), JSON.stringify(e));
16
13
  }
17
- var a = class {
14
+ var s = class {
18
15
  #e;
19
16
  #t = /* @__PURE__ */ new Set();
20
17
  constructor(e = {}) {
@@ -24,57 +21,75 @@ var a = class {
24
21
  ...e
25
22
  };
26
23
  }
27
- stream(e, t) {
28
- return this.#n(e, t, !1);
24
+ stream(e, n) {
25
+ let r, a = i(t({
26
+ runAttempt: () => this.#n(e, n),
27
+ refreshToken: () => this.#a(),
28
+ reportAuthFailure: () => {
29
+ let e = /* @__PURE__ */ Error("Authentication failed: token expired");
30
+ n.onError?.(e), this.#e.showErrorMessage?.(e.message);
31
+ },
32
+ recordFailure: (e) => {
33
+ r = e;
34
+ }
35
+ }));
36
+ return new Promise((e, t) => {
37
+ a.subscribe((n) => {
38
+ if (n.status === "done") {
39
+ if (n.value === "failed") {
40
+ t(r);
41
+ return;
42
+ }
43
+ e();
44
+ }
45
+ }), a.start();
46
+ });
29
47
  }
30
48
  abort() {
31
49
  for (let e of this.#t) e.abort();
32
50
  this.#t.clear();
33
51
  }
34
- async #n(e, r, a) {
35
- let o = new AbortController();
36
- this.#t.add(o);
37
- let s = this.#r(e.signal, o), c = await this.#i(e.headers), l = i(e.body, c), u = 0, d = !1, f = () => {
38
- d || (d = !0, s?.(), this.#t.delete(o));
39
- };
52
+ async #n(t, n) {
53
+ let i = new AbortController();
54
+ this.#t.add(i);
55
+ let a = this.#r(t.signal, i), s = 0;
40
56
  try {
41
- await t(e.url, {
42
- method: e.method ?? "POST",
43
- headers: c,
44
- body: l,
45
- signal: o.signal,
46
- onopen: async (e) => {
47
- if (e.status === 401) throw new n();
48
- if (!e.ok) throw Error(`HTTP ${e.status}: ${e.statusText}`);
49
- let t = e.headers.get("content-type");
50
- if (t && !t.includes("text/event-stream")) throw Error(`Expected content-type to be text/event-stream, got ${t}`);
51
- u = 0, await r.onOpen?.(e);
57
+ let a = await this.#i(t.headers), c = o(t.body, a);
58
+ await r(t.url, {
59
+ method: t.method ?? "POST",
60
+ headers: a,
61
+ body: c,
62
+ signal: i.signal,
63
+ onopen: async (t) => {
64
+ if (t.status === 401) throw new e();
65
+ if (!t.ok) throw Error(`HTTP ${t.status}: ${t.statusText}`);
66
+ let r = t.headers.get("content-type");
67
+ if (r && !r.includes("text/event-stream")) throw Error(`Expected content-type to be text/event-stream, got ${r}`);
68
+ s = 0, await n.onOpen?.(t);
52
69
  },
53
70
  onmessage: (e) => {
54
- r.onMessage({
71
+ n.onMessage({
55
72
  id: e.id,
56
73
  event: e.event,
57
74
  data: e.data
58
75
  });
59
76
  },
60
- onerror: (e) => {
61
- if (o.signal.aborted) return;
62
- if (e instanceof n) throw e;
63
- if (this.#e.enableRetry && u < this.#e.maxRetries) {
64
- u++, console.warn(`SSE connection error, retrying (${u}/${this.#e.maxRetries})...`);
77
+ onerror: (t) => {
78
+ if (i.signal.aborted) return;
79
+ if (t instanceof e) throw t;
80
+ if (this.#e.enableRetry && s < this.#e.maxRetries) {
81
+ s++, console.warn(`SSE connection error, retrying (${s}/${this.#e.maxRetries})...`);
65
82
  return;
66
83
  }
67
- let t = e;
68
- throw r.onError?.(t), this.#e.showErrorMessage?.(t.message), e;
84
+ let r = t;
85
+ throw n.onError?.(r), this.#e.showErrorMessage?.(r.message), t;
69
86
  },
70
87
  onclose: () => {
71
- r.onClose?.();
88
+ n.onClose?.();
72
89
  }
73
90
  });
74
- } catch (t) {
75
- if (!await this.#a(t, e, r, a, f)) throw t;
76
91
  } finally {
77
- f();
92
+ a?.(), this.#t.delete(i);
78
93
  }
79
94
  }
80
95
  #r(e, t) {
@@ -92,22 +107,13 @@ var a = class {
92
107
  let t = { ...e };
93
108
  try {
94
109
  let e = await this.#e.getAuthTokens?.();
95
- e?.accessToken && !r(t, "authorization") && (t.Authorization = `Bearer ${e.accessToken}`);
110
+ e?.accessToken && !a(t, "authorization") && (t.Authorization = `Bearer ${e.accessToken}`);
96
111
  } catch (e) {
97
112
  console.error("Failed to get auth tokens:", e);
98
113
  }
99
114
  return t;
100
115
  }
101
- async #a(e, t, r, i, a) {
102
- if (e instanceof Error && e.name === "AbortError") return !0;
103
- if (e instanceof n && !i) {
104
- if (await this.#o()) return a(), await this.#n(t, r, !0), !0;
105
- let e = /* @__PURE__ */ Error("Authentication failed: token expired");
106
- return r.onError?.(e), this.#e.showErrorMessage?.(e.message), !0;
107
- }
108
- return !1;
109
- }
110
- async #o() {
116
+ async #a() {
111
117
  let { onTokenExpired: e } = this.#e;
112
118
  if (!e) return !1;
113
119
  try {
@@ -118,4 +124,4 @@ var a = class {
118
124
  }
119
125
  };
120
126
  //#endregion
121
- export { a as SseClient };
127
+ export { s as SseClient };
@@ -1,4 +1,4 @@
1
- /*! @vef-framework-react/core v2.3.0 made by Venus | 2026-05-22T09:39:47.405Z */
1
+ /*! @vef-framework-react/core v2.4.0 made by Venus | 2026-06-15T15:10:07.347Z */
2
2
  import { SseClient as e } from "./client.js";
3
3
  //#region src/sse/helpers.ts
4
4
  function t(t) {
@@ -1,3 +1,3 @@
1
- /*! @vef-framework-react/core v2.3.0 made by Venus | 2026-05-22T09:39:47.405Z */
1
+ /*! @vef-framework-react/core v2.4.0 made by Venus | 2026-06-15T15:10:07.347Z */
2
2
  import "./client.js";
3
3
  import "./helpers.js";
@@ -0,0 +1,102 @@
1
+ /*! @vef-framework-react/core v2.4.0 made by Venus | 2026-06-15T15:10:07.347Z */
2
+ import { fromPromise as e, setup as t } from "xstate";
3
+ //#region src/sse/stream-machine.ts
4
+ var n = class extends Error {
5
+ constructor() {
6
+ super("Token expired"), this.name = "TokenExpiredError";
7
+ }
8
+ };
9
+ function r(e) {
10
+ return e instanceof Error && e.name === "AbortError";
11
+ }
12
+ function i(i) {
13
+ return t({
14
+ actors: {
15
+ runAttempt: e(() => i.runAttempt()),
16
+ refreshToken: e(() => i.refreshToken())
17
+ },
18
+ actions: {
19
+ recordFailure: (e, t) => {
20
+ i.recordFailure(t.error);
21
+ },
22
+ reportAuthFailure: () => {
23
+ i.reportAuthFailure();
24
+ }
25
+ },
26
+ guards: {
27
+ wasAborted: (e, t) => r(t.error),
28
+ wasTokenExpired: (e, t) => t.error instanceof n,
29
+ refreshSucceeded: (e, t) => t.refreshed
30
+ }
31
+ }).createMachine({
32
+ id: "sseStream",
33
+ initial: "streaming",
34
+ states: {
35
+ streaming: { invoke: {
36
+ src: "runAttempt",
37
+ onDone: { target: "completed" },
38
+ onError: [
39
+ {
40
+ guard: {
41
+ type: "wasAborted",
42
+ params: ({ event: e }) => ({ error: e.error })
43
+ },
44
+ target: "completed"
45
+ },
46
+ {
47
+ guard: {
48
+ type: "wasTokenExpired",
49
+ params: ({ event: e }) => ({ error: e.error })
50
+ },
51
+ target: "refreshingToken"
52
+ },
53
+ {
54
+ target: "failed",
55
+ actions: {
56
+ type: "recordFailure",
57
+ params: ({ event: e }) => ({ error: e.error })
58
+ }
59
+ }
60
+ ]
61
+ } },
62
+ refreshingToken: { invoke: {
63
+ src: "refreshToken",
64
+ onDone: [{
65
+ guard: {
66
+ type: "refreshSucceeded",
67
+ params: ({ event: e }) => ({ refreshed: e.output })
68
+ },
69
+ target: "retrying"
70
+ }, {
71
+ target: "completed",
72
+ actions: "reportAuthFailure"
73
+ }],
74
+ onError: {
75
+ target: "completed",
76
+ actions: "reportAuthFailure"
77
+ }
78
+ } },
79
+ retrying: { invoke: {
80
+ src: "runAttempt",
81
+ onDone: { target: "completed" },
82
+ onError: [{
83
+ guard: {
84
+ type: "wasAborted",
85
+ params: ({ event: e }) => ({ error: e.error })
86
+ },
87
+ target: "completed"
88
+ }, {
89
+ target: "failed",
90
+ actions: {
91
+ type: "recordFailure",
92
+ params: ({ event: e }) => ({ error: e.error })
93
+ }
94
+ }]
95
+ } },
96
+ completed: { type: "final" },
97
+ failed: { type: "final" }
98
+ }
99
+ });
100
+ }
101
+ //#endregion
102
+ export { n as TokenExpiredError, i as createStreamMachine };
@@ -1,3 +1,3 @@
1
- /*! @vef-framework-react/core v2.3.0 made by Venus | 2026-05-22T09:39:47.405Z */
1
+ /*! @vef-framework-react/core v2.4.0 made by Venus | 2026-06-15T15:10:07.347Z */
2
2
  import { Provider as e, atom as t, createStore as n, getDefaultStore as r, useAtom as i, useAtomValue as a, useSetAtom as o, useStore as s } from "jotai";
3
3
  export { e as AtomStoreProvider, t as atom, n as createAtomStore, r as getDefaultAtomStore, i as useAtom, s as useAtomStore, a as useAtomValue, o as useSetAtom };
@@ -1,14 +1,14 @@
1
- /*! @vef-framework-react/core v2.3.0 made by Venus | 2026-05-22T09:39:47.405Z */
2
- import { useActorRef as e, useActorRef as t, useSelector as n } from "@xstate/react";
3
- import { Actor as r, assign as i, createActor as a, createMachine as o } from "xstate";
1
+ /*! @vef-framework-react/core v2.4.0 made by Venus | 2026-06-15T15:10:07.347Z */
2
+ import { Actor as e, assign as t, createActor as n, createMachine as r } from "xstate";
3
+ import { useActorRef as i, useActorRef as a, useSelector as o } from "@xstate/react";
4
4
  //#region src/state-machine/index.ts
5
- function s(t, r, ...[i]) {
6
- let a = e(t, i);
5
+ function s(e, t, ...[n]) {
6
+ let r = i(e, n);
7
7
  return [
8
- n(a, r, Object.is),
9
- a.send,
10
- a
8
+ o(r, t, Object.is),
9
+ r.send,
10
+ r
11
11
  ];
12
12
  }
13
13
  //#endregion
14
- export { r as Actor, a as createActor, o as createMachine, i as updateContext, s as useActor, t as useActorRef };
14
+ export { e as Actor, n as createActor, r as createMachine, t as updateContext, s as useActor, a as useActorRef };
@@ -1,4 +1,4 @@
1
- /*! @vef-framework-react/core v2.3.0 made by Venus | 2026-05-22T09:39:47.405Z */
1
+ /*! @vef-framework-react/core v2.4.0 made by Venus | 2026-06-15T15:10:07.347Z */
2
2
  //#region src/storage/errors.ts
3
3
  var e = class extends Error {
4
4
  constructor(e, t) {
@@ -1,4 +1,4 @@
1
- /*! @vef-framework-react/core v2.3.0 made by Venus | 2026-05-22T09:39:47.405Z */
1
+ /*! @vef-framework-react/core v2.4.0 made by Venus | 2026-06-15T15:10:07.347Z */
2
2
  import "./errors.js";
3
3
  import "./protocol.js";
4
4
  import "./resumable/fingerprint.js";
@@ -1,4 +1,4 @@
1
- /*! @vef-framework-react/core v2.3.0 made by Venus | 2026-05-22T09:39:47.405Z */
1
+ /*! @vef-framework-react/core v2.4.0 made by Venus | 2026-06-15T15:10:07.347Z */
2
2
  import { createApiRequest as e } from "../api/helpers.js";
3
3
  import { UploadProtocolError as t } from "./errors.js";
4
4
  //#region src/storage/protocol.ts
@@ -1,4 +1,4 @@
1
- /*! @vef-framework-react/core v2.3.0 made by Venus | 2026-05-22T09:39:47.405Z */
1
+ /*! @vef-framework-react/core v2.4.0 made by Venus | 2026-06-15T15:10:07.347Z */
2
2
  //#region src/storage/resumable/fingerprint.ts
3
3
  var e = class {
4
4
  fingerprint(e) {
@@ -1,4 +1,4 @@
1
- /*! @vef-framework-react/core v2.3.0 made by Venus | 2026-05-22T09:39:47.405Z */
1
+ /*! @vef-framework-react/core v2.4.0 made by Venus | 2026-06-15T15:10:07.347Z */
2
2
  import "./fingerprint.js";
3
3
  import "./persistence.js";
4
4
  import "./plan.js";
@@ -1,4 +1,4 @@
1
- /*! @vef-framework-react/core v2.3.0 made by Venus | 2026-05-22T09:39:47.405Z */
1
+ /*! @vef-framework-react/core v2.4.0 made by Venus | 2026-06-15T15:10:07.347Z */
2
2
  //#region src/storage/resumable/persistence.ts
3
3
  var e = "__VEF_UPLOAD_RESUME__", t = class {
4
4
  #e;
@@ -1,4 +1,4 @@
1
- /*! @vef-framework-react/core v2.3.0 made by Venus | 2026-05-22T09:39:47.405Z */
1
+ /*! @vef-framework-react/core v2.4.0 made by Venus | 2026-06-15T15:10:07.347Z */
2
2
  import { abortUpload as e, listParts as t } from "../protocol.js";
3
3
  //#region src/storage/resumable/plan.ts
4
4
  async function n(n) {
@@ -1,4 +1,4 @@
1
- /*! @vef-framework-react/core v2.3.0 made by Venus | 2026-05-22T09:39:47.405Z */
1
+ /*! @vef-framework-react/core v2.4.0 made by Venus | 2026-06-15T15:10:07.347Z */
2
2
  //#region src/storage/types.ts
3
3
  var e = "pub/", t = "priv/";
4
4
  //#endregion
@@ -0,0 +1,88 @@
1
+ /*! @vef-framework-react/core v2.4.0 made by Venus | 2026-06-15T15:10:07.347Z */
2
+ import { assertEvent as e, fromPromise as t, setup as n } from "xstate";
3
+ //#region src/storage/uploader-machine.ts
4
+ function r(r) {
5
+ return n({
6
+ types: { events: {} },
7
+ actors: {
8
+ prepareSession: t(({ input: e }) => r.prepareSession(e)),
9
+ uploadParts: t(() => r.uploadParts()),
10
+ completeSession: t(() => r.completeSession()),
11
+ abortSession: t(() => r.abortSession())
12
+ },
13
+ actions: {
14
+ killTransport: () => {
15
+ r.killTransport();
16
+ },
17
+ recordFailure: (e, t) => {
18
+ r.recordFailure(t.error);
19
+ }
20
+ },
21
+ guards: { abortRequested: () => r.abortRequested() }
22
+ }).createMachine({
23
+ id: "uploader",
24
+ initial: "idle",
25
+ states: {
26
+ idle: { on: { START: [{
27
+ guard: "abortRequested",
28
+ target: "aborting"
29
+ }, { target: "initializing" }] } },
30
+ initializing: {
31
+ invoke: {
32
+ src: "prepareSession",
33
+ input: ({ event: t }) => (e(t, "START"), t.plan),
34
+ onDone: { target: "uploading" },
35
+ onError: {
36
+ target: "failed",
37
+ actions: {
38
+ type: "recordFailure",
39
+ params: ({ event: e }) => ({ error: e.error })
40
+ }
41
+ }
42
+ },
43
+ on: { ABORT: { target: "aborting" } }
44
+ },
45
+ uploading: {
46
+ invoke: {
47
+ src: "uploadParts",
48
+ onDone: { target: "completing" },
49
+ onError: {
50
+ target: "failed",
51
+ actions: {
52
+ type: "recordFailure",
53
+ params: ({ event: e }) => ({ error: e.error })
54
+ }
55
+ }
56
+ },
57
+ on: { ABORT: { target: "aborting" } }
58
+ },
59
+ completing: {
60
+ invoke: {
61
+ src: "completeSession",
62
+ onDone: { target: "succeeded" },
63
+ onError: {
64
+ target: "failed",
65
+ actions: {
66
+ type: "recordFailure",
67
+ params: ({ event: e }) => ({ error: e.error })
68
+ }
69
+ }
70
+ },
71
+ on: { ABORT: { target: "aborting" } }
72
+ },
73
+ aborting: {
74
+ entry: "killTransport",
75
+ invoke: {
76
+ src: "abortSession",
77
+ onDone: { target: "aborted" },
78
+ onError: { target: "aborted" }
79
+ }
80
+ },
81
+ succeeded: { type: "final" },
82
+ failed: { type: "final" },
83
+ aborted: { type: "final" }
84
+ }
85
+ });
86
+ }
87
+ //#endregion
88
+ export { r as createUploaderMachine };