@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.
- package/dist/cjs/api/client.cjs +1 -1
- package/dist/cjs/api/constants.cjs +1 -1
- package/dist/cjs/api/helpers.cjs +1 -1
- package/dist/cjs/api/index.cjs +1 -1
- package/dist/cjs/auth/helpers.cjs +1 -1
- package/dist/cjs/auth/index.cjs +1 -1
- package/dist/cjs/context/api-client.cjs +1 -1
- package/dist/cjs/context/app.cjs +1 -1
- package/dist/cjs/context/context-selector.cjs +1 -1
- package/dist/cjs/context/disabled.cjs +1 -1
- package/dist/cjs/context/index.cjs +1 -1
- package/dist/cjs/dnd/index.cjs +1 -1
- package/dist/cjs/http/client.cjs +1 -1
- package/dist/cjs/http/helpers.cjs +1 -1
- package/dist/cjs/http/index.cjs +1 -1
- package/dist/cjs/immer/index.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/motion/features.cjs +1 -1
- package/dist/cjs/motion/index.cjs +1 -1
- package/dist/cjs/motion/motion-provider.cjs +1 -1
- package/dist/cjs/query/helpers.cjs +1 -1
- package/dist/cjs/query/hooks.cjs +1 -1
- package/dist/cjs/query/index.cjs +1 -1
- package/dist/cjs/sse/client.cjs +1 -1
- package/dist/cjs/sse/helpers.cjs +1 -1
- package/dist/cjs/sse/index.cjs +1 -1
- package/dist/cjs/sse/stream-machine.cjs +1 -0
- package/dist/cjs/state/index.cjs +1 -1
- package/dist/cjs/state-machine/index.cjs +1 -1
- package/dist/cjs/storage/index.cjs +1 -1
- package/dist/cjs/storage/protocol.cjs +1 -1
- package/dist/cjs/storage/resumable/index.cjs +1 -1
- package/dist/cjs/storage/resumable/plan.cjs +1 -1
- package/dist/cjs/storage/uploader-machine.cjs +1 -0
- package/dist/cjs/storage/uploader.cjs +1 -1
- package/dist/cjs/store/bound.cjs +1 -1
- package/dist/cjs/store/index.cjs +1 -1
- package/dist/cjs/store/unbound.cjs +1 -1
- package/dist/cjs/store/use-deep.cjs +1 -1
- 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 +11 -10
- package/dist/es/http/client.js +1 -1
- package/dist/es/http/constants.js +1 -1
- 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 +22 -22
- 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/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 +61 -55
- package/dist/es/sse/helpers.js +1 -1
- package/dist/es/sse/index.js +1 -1
- package/dist/es/sse/stream-machine.js +102 -0
- package/dist/es/state/index.js +1 -1
- package/dist/es/state-machine/index.js +9 -9
- 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 +88 -0
- package/dist/es/storage/uploader.js +135 -89
- 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/{dnd → src/dnd}/index.d.ts +3 -2
- package/dist/types/{index.d.ts → src/index.d.ts} +1 -1
- package/dist/types/{query → src/query}/hooks.d.ts +1 -1
- package/dist/types/src/sse/client.d.ts +24 -0
- package/dist/types/src/sse/stream-machine.d.ts +104 -0
- package/dist/types/src/storage/uploader-machine.d.ts +108 -0
- package/dist/types/{storage → src/storage}/uploader.d.ts +8 -2
- package/package.json +8 -8
- package/dist/types/sse/client.d.ts +0 -16
- /package/dist/types/{api → src/api}/client.d.ts +0 -0
- /package/dist/types/{api → src/api}/constants.d.ts +0 -0
- /package/dist/types/{api → src/api}/helpers.d.ts +0 -0
- /package/dist/types/{api → src/api}/index.d.ts +0 -0
- /package/dist/types/{api → src/api}/types.d.ts +0 -0
- /package/dist/types/{auth → src/auth}/helpers.d.ts +0 -0
- /package/dist/types/{auth → src/auth}/index.d.ts +0 -0
- /package/dist/types/{auth → src/auth}/types.d.ts +0 -0
- /package/dist/types/{common → src/common}/index.d.ts +0 -0
- /package/dist/types/{common → src/common}/types.d.ts +0 -0
- /package/dist/types/{context → src/context}/api-client.d.ts +0 -0
- /package/dist/types/{context → src/context}/app.d.ts +0 -0
- /package/dist/types/{context → src/context}/context-selector.d.ts +0 -0
- /package/dist/types/{context → src/context}/disabled.d.ts +0 -0
- /package/dist/types/{context → src/context}/index.d.ts +0 -0
- /package/dist/types/{context → src/context}/types.d.ts +0 -0
- /package/dist/types/{http → src/http}/client.d.ts +0 -0
- /package/dist/types/{http → src/http}/constants.d.ts +0 -0
- /package/dist/types/{http → src/http}/errors.d.ts +0 -0
- /package/dist/types/{http → src/http}/helpers.d.ts +0 -0
- /package/dist/types/{http → src/http}/index.d.ts +0 -0
- /package/dist/types/{http → src/http}/types.d.ts +0 -0
- /package/dist/types/{immer → src/immer}/index.d.ts +0 -0
- /package/dist/types/{motion → src/motion}/features.d.ts +0 -0
- /package/dist/types/{motion → src/motion}/index.d.ts +0 -0
- /package/dist/types/{motion → src/motion}/motion-provider.d.ts +0 -0
- /package/dist/types/{query → src/query}/constants.d.ts +0 -0
- /package/dist/types/{query → src/query}/helpers.d.ts +0 -0
- /package/dist/types/{query → src/query}/index.d.ts +0 -0
- /package/dist/types/{query → src/query}/types.d.ts +0 -0
- /package/dist/types/{sse → src/sse}/helpers.d.ts +0 -0
- /package/dist/types/{sse → src/sse}/index.d.ts +0 -0
- /package/dist/types/{sse → src/sse}/types.d.ts +0 -0
- /package/dist/types/{state → src/state}/index.d.ts +0 -0
- /package/dist/types/{state-machine → src/state-machine}/index.d.ts +0 -0
- /package/dist/types/{storage → src/storage}/errors.d.ts +0 -0
- /package/dist/types/{storage → src/storage}/index.d.ts +0 -0
- /package/dist/types/{storage → src/storage}/protocol.d.ts +0 -0
- /package/dist/types/{storage → src/storage}/resumable/fingerprint.d.ts +0 -0
- /package/dist/types/{storage → src/storage}/resumable/index.d.ts +0 -0
- /package/dist/types/{storage → src/storage}/resumable/persistence.d.ts +0 -0
- /package/dist/types/{storage → src/storage}/resumable/plan.d.ts +0 -0
- /package/dist/types/{storage → src/storage}/types.d.ts +0 -0
- /package/dist/types/{store → src/store}/bound.d.ts +0 -0
- /package/dist/types/{store → src/store}/index.d.ts +0 -0
- /package/dist/types/{store → src/store}/types.d.ts +0 -0
- /package/dist/types/{store → src/store}/unbound.d.ts +0 -0
- /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.
|
|
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,
|
|
14
|
-
import { applyPatches as
|
|
15
|
-
import
|
|
16
|
-
import { AnimatePresence as
|
|
17
|
-
import { SseClient as
|
|
18
|
-
import { createSseClient as
|
|
19
|
-
import { AtomStoreProvider as
|
|
20
|
-
import { Actor as
|
|
21
|
-
import { UploadAbortedError as
|
|
22
|
-
import { DEFAULT_API_PATH as
|
|
23
|
-
import { PrefixFingerprinter as
|
|
24
|
-
import { LocalStoragePersistence as
|
|
25
|
-
import { resolveResumePlan as
|
|
26
|
-
import { PRIVATE_PREFIX as
|
|
27
|
-
import { Uploader as
|
|
28
|
-
import { createPersistedStore as
|
|
29
|
-
import { createComponentStore as
|
|
30
|
-
import { useDeep as
|
|
31
|
-
import { useShallow as
|
|
32
|
-
import { clsx as
|
|
33
|
-
export {
|
|
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 };
|
package/dist/es/motion/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/core v2.
|
|
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.
|
|
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";
|
package/dist/es/query/helpers.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/core v2.
|
|
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
|
package/dist/es/query/hooks.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/core v2.
|
|
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) {
|
package/dist/es/query/index.js
CHANGED
package/dist/es/sse/client.js
CHANGED
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
/*! @vef-framework-react/core v2.
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
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
|
-
|
|
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
|
|
15
|
-
if (
|
|
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
|
|
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,
|
|
28
|
-
|
|
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(
|
|
35
|
-
let
|
|
36
|
-
this.#t.add(
|
|
37
|
-
let
|
|
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(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
if (
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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
|
-
|
|
71
|
+
n.onMessage({
|
|
55
72
|
id: e.id,
|
|
56
73
|
event: e.event,
|
|
57
74
|
data: e.data
|
|
58
75
|
});
|
|
59
76
|
},
|
|
60
|
-
onerror: (
|
|
61
|
-
if (
|
|
62
|
-
if (
|
|
63
|
-
if (this.#e.enableRetry &&
|
|
64
|
-
|
|
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
|
|
68
|
-
throw
|
|
84
|
+
let r = t;
|
|
85
|
+
throw n.onError?.(r), this.#e.showErrorMessage?.(r.message), t;
|
|
69
86
|
},
|
|
70
87
|
onclose: () => {
|
|
71
|
-
|
|
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
|
-
|
|
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 && !
|
|
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(
|
|
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 {
|
|
127
|
+
export { s as SseClient };
|
package/dist/es/sse/helpers.js
CHANGED
package/dist/es/sse/index.js
CHANGED
|
@@ -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 };
|
package/dist/es/state/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! @vef-framework-react/core v2.
|
|
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.
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
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(
|
|
6
|
-
let
|
|
5
|
+
function s(e, t, ...[n]) {
|
|
6
|
+
let r = i(e, n);
|
|
7
7
|
return [
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
o(r, t, Object.is),
|
|
9
|
+
r.send,
|
|
10
|
+
r
|
|
11
11
|
];
|
|
12
12
|
}
|
|
13
13
|
//#endregion
|
|
14
|
-
export {
|
|
14
|
+
export { e as Actor, n as createActor, r as createMachine, t as updateContext, s as useActor, a as useActorRef };
|
package/dist/es/storage/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/core v2.
|
|
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.
|
|
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) {
|
package/dist/es/storage/types.js
CHANGED
|
@@ -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 };
|