@vef-framework-react/core 2.13.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/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 +1 -1
- 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 +1 -1
- package/dist/es/push/helpers.js +1 -1
- package/dist/es/push/index.js +1 -1
- package/dist/es/push/types.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 +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/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 +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=32768;function t(t){if(`toBase64`in t&&typeof t.toBase64==`function`)return t.toBase64();let n=``;for(let r=0;r<t.length;r+=e)n+=String.fromCodePoint(...t.subarray(r,r+e));return btoa(n)}function n(){return typeof CompressionStream<`u`}async function r(e){let t=new CompressionStream(`gzip`),n=t.writable.getWriter(),r=n.write(e).then(()=>n.close()),[i]=await Promise.all([new Response(t.readable).arrayBuffer(),r]);return new Uint8Array(i)}async function i(e,i){let a=new TextEncoder().encode(e);return i===`gzip+base64`&&n()?{body:t(await r(a)),encoding:`gzip+base64`}:{body:t(a),encoding:`base64`}}exports.encodeRequestBody=i;
|
package/dist/cjs/http/client.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("../_internal/_rolldown/runtime.cjs"),t=require("./
|
|
1
|
+
const e=require("../_internal/_rolldown/runtime.cjs"),t=require("./body-encoding.cjs"),n=require("./constants.cjs"),r=require("./errors.cjs");let i=require("@vef-framework-react/shared"),a=require("axios");a=e.__toESM(a,1);var o=`__vefResponseMode`,s=1024*1024,c=`download`;function l(e){return Object.prototype.toString.call(e)===`[object ArrayBuffer]`}function u(e){return!(0,i.isNullish)(e)&&!(e instanceof FormData)&&!(e instanceof Blob)&&!l(e)&&!ArrayBuffer.isView(e)}function d(e){return typeof e.addEventListener==`function`&&typeof e.removeEventListener==`function`}var f=class{#e;#t;#n;#r=new Set;constructor(e){this.#t=e;let{baseUrl:t,timeout:r=n.DEFAULT_TIMEOUT}=e;this.#e=a.default.create({baseURL:t,allowAbsoluteUrls:!0,timeout:r,headers:{"Content-Type":`application/json`},paramsSerializer:e=>(0,i.encodeQueryString)(e,{arrayFormat:`repeat`,skipNulls:!0,charset:`utf-8`}),responseType:`json`,responseEncoding:`utf-8`,validateStatus:e=>e>=200&&e<300,withCredentials:!1,timeoutErrorMessage:`请求超时`}),this.initInterceptors()}initInterceptors(){this.#e.interceptors.request.use(this.handleRequest.bind(this),this.handleRequestError.bind(this)),this.#e.interceptors.response.use(this.handleResponse.bind(this),this.handleResponseError.bind(this))}matchesCode(e,t){return(0,i.isArray)(t)?t.includes(e):e===t}async handleRequest(e){let t=e.headers[n.SKIP_AUTH_HEADER]===`1`,r=this.#n?.promise;if(r&&!t&&!await this.waitForTokenRefresh(r,e))throw Error(`登录已过期, 请重新登录`);return t?delete e.headers[n.SKIP_AUTH_HEADER]:await this.injectAccessToken(e),this.replacePathParams(e),e}handleRequestError(e){let{showErrorMessage:t}=this.#t,n=`发起请求失败: ${(e instanceof Error?e.message:String(e))||`未知错误`}`;return t?t(n):console.error(`[HttpClient] ${n}`),Promise.reject(e)}handleResponse(e){if(this.getResponseMode(e.config)===`raw`)return e;if(!this.isApiResult(e.data))throw TypeError(`Invalid API response envelope`);return this.assertBusinessSuccess(e.data,e.config),e}async handleResponseError(e){if(e instanceof a.CanceledError){if(e.response){let{method:t,url:n}=e.response.config;console.warn(`[HttpClient] [${t}: ${n}] 被取消`)}throw e}let{response:t}=e;if(!t)throw this.logError(`请求失败: ${e.message||`未知错误`}`),e;let{status:n,config:r,data:i}=t,o=await this.readApiResult(i),s=o?.code,c=o?.message??e.message??`未知错误`,l=`[${r.method}: ${r.url}]`;switch(n){case 400:this.logWarning(c,`${l} 参数错误: ${c}`);break;case 401:{let t=await this.handleUnauthorized(e,s);if(t)return t;break}case 403:this.#t.showWarningMessage?.(`${c}, 请联系管理员为您开通`),console.warn(`[HttpClient] ${l} 访问被拒绝: ${c}`),await this.#t.onAccessDenied?.();break;default:this.logError(c,`${l} 返回错误: ${c}`)}throw e}async handleUnauthorized(e,t){let{tokenExpiredCode:n=[]}=this.#t;if(t===void 0||!this.matchesCode(t,n)){await this.#t.onUnauthenticated?.();return}if(this.#n)throw e;let{cycle:r}=this.tryRefreshToken(async()=>{this.logInfo(`登录已过期, 请重新登录`),await this.#t.onUnauthenticated?.()});if(await this.waitForTokenRefresh(r.promise,e.response.config))return this.retryRequest(e.response.config);await r.failureHandled}logInfo(e){this.#t.showInfoMessage?this.#t.showInfoMessage(e):console.info(`[HttpClient] ${e}`)}logWarning(e,t){this.#t.showWarningMessage?this.#t.showWarningMessage(e):console.warn(`[HttpClient] ${t??e}`)}logError(e,t){this.#t.showErrorMessage?this.#t.showErrorMessage(e):console.error(`[HttpClient] ${t??e}`)}async injectAccessToken(e){let{getAuthTokens:t}=this.#t;if(!t)return;let n=await t();n?.accessToken&&(e.headers.Authorization=`Bearer ${n.accessToken}`)}replacePathParams(e){let{url:t,params:r={}}=e;!t||!n.PATH_PARAM_REGEX.test(t)||(n.PATH_PARAM_REGEX.lastIndex=0,e.url=t.replaceAll(n.PATH_PARAM_REGEX,(e,n)=>{if(!Object.hasOwn(r,n))return console.warn(`[HttpClient] 接口: ${t} 路径参数 ${n} 未在查询参数中定义, 请检查`),`unknown`;let a=r[n];return(0,i.isNullish)(a)?(console.warn(`[HttpClient] 接口: ${t} 路径参数 ${n} 在查询参数中为空, 请检查`),`unknown`):String(a)}))}tryRefreshToken(e){if(this.#n)return{cycle:this.#n,owner:!1};let{getAuthTokens:t,refreshToken:n,setAuthTokens:r}=this.#t;if(!t||!n||!r)return{cycle:this.createRefreshCycle(Promise.resolve(!1),e,!1),owner:!0};let i=Promise.withResolvers(),a=i.promise,o=this.createRefreshCycle(a,e,!0);return this.performTokenRefresh(t,n,r).then(i.resolve,i.reject),{cycle:o,owner:!0}}createRefreshCycle(e,t,n){let r=Promise.withResolvers(),i={failureHandled:r.promise,promise:e};return n&&(this.#n=i),e.then(e=>{n&&this.finishTokenRefresh(i,e),(e?Promise.resolve():this.handleRefreshFailure(t)).then(r.resolve,r.reject)},e=>{n&&this.finishTokenRefresh(i,!1),this.handleRefreshFailure(t).then(()=>r.reject(e),r.reject)}),r.promise.catch(()=>void 0),i}async handleRefreshFailure(e){await e?.()}async performTokenRefresh(e,t,n){try{let r=await e();if(!r)return!1;let i=await t(r);return await n(Object.freeze(i)),!0}catch(e){return console.error(`[HttpClient] 刷新令牌失败: ${e}`),!1}}finishTokenRefresh(e,t){if(this.#n===e){for(let e of this.#r)e(t);this.#r.clear(),this.#n=void 0}}waitForTokenRefresh(e,t){if(this.#n?.promise!==e)return e;let{signal:n}=t;return n?.aborted?Promise.reject(new a.CanceledError(void 0,t)):new Promise((e,r)=>{let i=n&&d(n)?n:void 0,o,s=()=>{let e=o;e&&(o=void 0,this.#r.delete(e),i?.removeEventListener(`abort`,s),r(new a.CanceledError(void 0,t)))};o=t=>{let n=o;n&&(o=void 0,this.#r.delete(n),i?.removeEventListener(`abort`,s),e(t))},this.#r.add(o),i?.addEventListener(`abort`,s,{once:!0}),n?.aborted&&s()})}async retryRequest(e){let t={...e,[o]:this.getResponseMode(e)};return await this.injectAccessToken(t),this.#e(t)}getResponseMode(e){return Reflect.get(e,o)===`raw`?`raw`:`envelope`}isApiResult(e){return typeof e==`object`&&!!e&&(0,i.isNumber)(Reflect.get(e,`code`))&&(0,i.isString)(Reflect.get(e,`message`))&&Object.hasOwn(e,`data`)}assertBusinessSuccess(e,t){let{showWarningMessage:n,okCode:i=0}=this.#t,{code:a,message:o,data:s}=e;if(!this.matchesCode(a,i))throw n?n(o):console.warn(`[HttpClient] [${t.method}: ${t.url}] 返回错误: ${o}`),new r.BusinessError(a,o,s)}async readApiResult(e){if(this.isApiResult(e))return e;if((0,i.isString)(e)){if(e.length>s||new Blob([e]).size>s)return;try{let t=JSON.parse(e);return this.isApiResult(t)?t:void 0}catch{return}}if((l(e)||ArrayBuffer.isView(e))&&e.byteLength>s)return;let t;try{t=this.toBlob(e)}catch{return}if(!(t.size>s))try{let e=JSON.parse(await t.text());return this.isApiResult(e)?e:void 0}catch{}}toBlob(e,t){if(e instanceof Blob)return e;let n=(0,i.isString)(t)?{type:t}:void 0;if(l(e))return new Blob([e],n);if(ArrayBuffer.isView(e)){if(l(e.buffer))return new Blob([new Uint8Array(e.buffer,e.byteOffset,e.byteLength)],n);let t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),new Blob([t],n)}throw TypeError(`Invalid file response body`)}getResponseFilename(e){if(!(0,i.isString)(e))return;let t=e.split(`;`).find(e=>{let t=e.indexOf(`=`);return t!==-1&&e.slice(0,t).trim().toLowerCase()===`filename*`}),r=t?.slice(t.indexOf(`=`)+1).trim(),a=r?.indexOf(`'`)??-1,o=a>=0?r?.indexOf(`'`,a+1)??-1:-1,s=o>=0?r?.slice(o+1):void 0,c=a>=0?r?.slice(0,a).trim().toLowerCase():void 0;if(s&&(!c||c===`utf-8`))try{return decodeURIComponent(s)}catch{}let l=n.CONTENT_DISPOSITION_FILENAME_REGEX.exec(e),u=l?.groups?.name?.trim();return u?l?.groups?.quote?u.slice(1,-1):u:void 0}async encodeRequestData(e,r,a){let o=r??this.#t.defaultBodyEncoding??`none`;if(o===`none`||!u(e))return{data:e,options:a};let s=(0,i.isString)(e)?e:JSON.stringify(e),c=await t.encodeRequestBody(s,o);return{data:c.body,options:{...a,headers:{...a.headers,[n.BODY_ENCODING_HEADER]:c.encoding}}}}async ensureTokenRefreshed(e=!0){let t=e?()=>this.#t.onUnauthenticated?.():void 0,{cycle:n,owner:r}=this.tryRefreshToken(t),i=await n.promise;return r&&await n.failureHandled,i}async get(e,t){return(await this.#e.get(e,t)).data}async post(e,t){let{data:n,bodyEncoding:r,...i}=t??{},a=await this.encodeRequestData(n,r,i);return(await this.#e.post(e,a.data,a.options)).data}async put(e,t){let{data:n,bodyEncoding:r,...i}=t??{},a=await this.encodeRequestData(n,r,i);return(await this.#e.put(e,a.data,a.options)).data}async delete(e,t){return(await this.#e.delete(e,t)).data}async upload(e,t){let{data:n,onProgress:r,...a}=t??{};return(await this.#e.postForm(e,n,{...a,onUploadProgress:(0,i.isFunction)(r)?r:void 0})).data}async requestFile(e,t){let{method:n=`get`,data:r,onProgress:a,...s}=t??{},c={...s,[o]:`raw`,responseType:`arraybuffer`,responseEncoding:`binary`,onDownloadProgress:(0,i.isFunction)(a)?a:void 0},{config:l,data:u,headers:d}=n===`post`?await this.#e.post(e,r,c):await this.#e.get(e,c),f=this.toBlob(u,d[`content-type`]),p=await this.readApiResult(f);return p&&this.assertBusinessSuccess(p,l),{blob:f,filename:this.getResponseFilename(d[`content-disposition`])}}async download(e,t){let{filename:n,...r}=t??{},{blob:a,filename:o}=await this.requestFile(e,r),s=o??c,l=URL.createObjectURL(a);try{let e=document.createElement(`a`);e.href=l,e.download=(0,i.isFunction)(n)?n(s):n??s,e.click()}finally{setTimeout(()=>URL.revokeObjectURL(l),0)}}};exports.HttpClient=f;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var e=`__vef_http_client_key`,t=/(?<=\/):(?<key>[A-Z_]\w*)/gi,n=/(?:^|;)\s*filename\s*=(?<name>(?<quote>['"]).*?\2|[^;\n]*)/i,r=`X-Skip-Authentication`,i=`1`,a=3e4;exports.CONTENT_DISPOSITION_FILENAME_REGEX=n,exports.DEFAULT_TIMEOUT=
|
|
1
|
+
var e=`__vef_http_client_key`,t=/(?<=\/):(?<key>[A-Z_]\w*)/gi,n=/(?:^|;)\s*filename\s*=(?<name>(?<quote>['"]).*?\2|[^;\n]*)/i,r=`X-Skip-Authentication`,i=`1`,a=`X-Body-Encoding`,o=3e4;exports.BODY_ENCODING_HEADER=a,exports.CONTENT_DISPOSITION_FILENAME_REGEX=n,exports.DEFAULT_TIMEOUT=o,exports.HTTP_CLIENT_KEY=e,exports.PATH_PARAM_REGEX=t,exports.SKIP_AUTH_HEADER=r,exports.SKIP_AUTH_VALUE=i;
|
package/dist/es/api/client.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/core v2.13.
|
|
1
|
+
/*! @vef-framework-react/core v2.13.1 made by Venus | 2026-07-28T11:21:11.377Z */
|
|
2
2
|
import { createHttpClient as e } from "../http/helpers.js";
|
|
3
3
|
import { createQueryClient as t } from "../query/helpers.js";
|
|
4
4
|
import { HTTP_CLIENT as n, PROXIED_METHODS as r, QUERY_CLIENT as i } from "./constants.js";
|
package/dist/es/api/constants.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/core v2.13.
|
|
1
|
+
/*! @vef-framework-react/core v2.13.1 made by Venus | 2026-07-28T11:21:11.377Z */
|
|
2
2
|
import { HTTP_CLIENT_KEY as e } from "../http/constants.js";
|
|
3
3
|
import { QUERY_CLIENT_KEY as t } from "../query/constants.js";
|
|
4
4
|
//#region src/api/constants.ts
|
package/dist/es/api/helpers.js
CHANGED
package/dist/es/api/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/core v2.13.
|
|
1
|
+
/*! @vef-framework-react/core v2.13.1 made by Venus | 2026-07-28T11:21:11.377Z */
|
|
2
2
|
import { HTTP_CLIENT as e, QUERY_CLIENT as t } from "./constants.js";
|
|
3
3
|
import { ApiClient as n } from "./client.js";
|
|
4
4
|
import { createApiClient as r, createApiRequest as i } from "./helpers.js";
|
package/dist/es/auth/helpers.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/core v2.13.
|
|
1
|
+
/*! @vef-framework-react/core v2.13.1 made by Venus | 2026-07-28T11:21:11.377Z */
|
|
2
2
|
import { isNullish as e, isString as t } from "@vef-framework-react/shared";
|
|
3
3
|
//#region src/auth/helpers.ts
|
|
4
4
|
function n(n, r, i = "any") {
|
package/dist/es/auth/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/core v2.13.
|
|
1
|
+
/*! @vef-framework-react/core v2.13.1 made by Venus | 2026-07-28T11:21:11.377Z */
|
|
2
2
|
import { QUERY_CLIENT as e } from "../api/constants.js";
|
|
3
3
|
import { QueryClientProvider as t } from "@tanstack/react-query";
|
|
4
4
|
import { createContext as n, use as r } from "react";
|
package/dist/es/context/app.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/core v2.13.
|
|
1
|
+
/*! @vef-framework-react/core v2.13.1 made by Venus | 2026-07-28T11:21:11.377Z */
|
|
2
2
|
import { isFunction as e } from "@vef-framework-react/shared";
|
|
3
3
|
import { createContext as t, use as n, useEffect as r, useState as i, useSyncExternalStore as a } from "react";
|
|
4
4
|
import { jsx as o } from "@emotion/react/jsx-runtime";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/core v2.13.
|
|
1
|
+
/*! @vef-framework-react/core v2.13.1 made by Venus | 2026-07-28T11:21:11.377Z */
|
|
2
2
|
import { createContext as e, use as t } from "react";
|
|
3
3
|
//#region src/context/disabled.ts
|
|
4
4
|
var n = e(!1);
|
package/dist/es/context/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/core v2.13.
|
|
1
|
+
/*! @vef-framework-react/core v2.13.1 made by Venus | 2026-07-28T11:21:11.377Z */
|
|
2
2
|
import { ApiClientProvider as e, useApiClient as t } from "./api-client.js";
|
|
3
3
|
import { AppContextProvider as n, useAppContext as r } from "./app.js";
|
|
4
4
|
import { createContextWithSelector as i } from "./context-selector.js";
|
package/dist/es/dnd/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/core v2.13.
|
|
1
|
+
/*! @vef-framework-react/core v2.13.1 made by Venus | 2026-07-28T11:21:11.377Z */
|
|
2
2
|
import { CollisionPriority as e } from "@dnd-kit/abstract";
|
|
3
3
|
import { AxisModifier as t, RestrictToHorizontalAxis as n, RestrictToVerticalAxis as r, SnapModifier as i, restrictShapeToBoundingRectangle as a } from "@dnd-kit/abstract/modifiers";
|
|
4
4
|
import { closestCenter as o, closestCorners as s, defaultCollisionDetection as c, directionBiased as l, pointerDistance as u, pointerIntersection as d, shapeIntersection as f } from "@dnd-kit/collision";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*! @vef-framework-react/core v2.13.1 made by Venus | 2026-07-28T11:21:11.377Z */
|
|
2
|
+
//#region src/http/body-encoding.ts
|
|
3
|
+
var e = 32768;
|
|
4
|
+
function t(t) {
|
|
5
|
+
if ("toBase64" in t && typeof t.toBase64 == "function") return t.toBase64();
|
|
6
|
+
let n = "";
|
|
7
|
+
for (let r = 0; r < t.length; r += e) n += String.fromCodePoint(...t.subarray(r, r + e));
|
|
8
|
+
return btoa(n);
|
|
9
|
+
}
|
|
10
|
+
function n() {
|
|
11
|
+
return typeof CompressionStream < "u";
|
|
12
|
+
}
|
|
13
|
+
async function r(e) {
|
|
14
|
+
let t = new CompressionStream("gzip"), n = t.writable.getWriter(), r = n.write(e).then(() => n.close()), [i] = await Promise.all([new Response(t.readable).arrayBuffer(), r]);
|
|
15
|
+
return new Uint8Array(i);
|
|
16
|
+
}
|
|
17
|
+
async function i(e, i) {
|
|
18
|
+
let a = new TextEncoder().encode(e);
|
|
19
|
+
return i === "gzip+base64" && n() ? {
|
|
20
|
+
body: t(await r(a)),
|
|
21
|
+
encoding: "gzip+base64"
|
|
22
|
+
} : {
|
|
23
|
+
body: t(a),
|
|
24
|
+
encoding: "base64"
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
export { i as encodeRequestBody };
|
package/dist/es/http/client.js
CHANGED
|
@@ -1,30 +1,34 @@
|
|
|
1
|
-
/*! @vef-framework-react/core v2.13.
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
1
|
+
/*! @vef-framework-react/core v2.13.1 made by Venus | 2026-07-28T11:21:11.377Z */
|
|
2
|
+
import { encodeRequestBody as e } from "./body-encoding.js";
|
|
3
|
+
import { BODY_ENCODING_HEADER as t, CONTENT_DISPOSITION_FILENAME_REGEX as n, DEFAULT_TIMEOUT as r, PATH_PARAM_REGEX as i, SKIP_AUTH_HEADER as a } from "./constants.js";
|
|
4
|
+
import { BusinessError as o } from "./errors.js";
|
|
5
|
+
import { encodeQueryString as s, isArray as c, isFunction as l, isNullish as u, isNumber as d, isString as f } from "@vef-framework-react/shared";
|
|
6
|
+
import p, { CanceledError as m } from "axios";
|
|
6
7
|
//#region src/http/client.ts
|
|
7
|
-
var
|
|
8
|
-
function
|
|
8
|
+
var h = "__vefResponseMode", g = 1024 * 1024, _ = "download";
|
|
9
|
+
function v(e) {
|
|
9
10
|
return Object.prototype.toString.call(e) === "[object ArrayBuffer]";
|
|
10
11
|
}
|
|
11
|
-
function
|
|
12
|
+
function y(e) {
|
|
13
|
+
return !u(e) && !(e instanceof FormData) && !(e instanceof Blob) && !v(e) && !ArrayBuffer.isView(e);
|
|
14
|
+
}
|
|
15
|
+
function b(e) {
|
|
12
16
|
return typeof e.addEventListener == "function" && typeof e.removeEventListener == "function";
|
|
13
17
|
}
|
|
14
|
-
var
|
|
18
|
+
var x = class {
|
|
15
19
|
#e;
|
|
16
20
|
#t;
|
|
17
21
|
#n;
|
|
18
22
|
#r = /* @__PURE__ */ new Set();
|
|
19
23
|
constructor(e) {
|
|
20
24
|
this.#t = e;
|
|
21
|
-
let { baseUrl:
|
|
22
|
-
this.#e =
|
|
23
|
-
baseURL:
|
|
25
|
+
let { baseUrl: t, timeout: n = r } = e;
|
|
26
|
+
this.#e = p.create({
|
|
27
|
+
baseURL: t,
|
|
24
28
|
allowAbsoluteUrls: !0,
|
|
25
|
-
timeout:
|
|
29
|
+
timeout: n,
|
|
26
30
|
headers: { "Content-Type": "application/json" },
|
|
27
|
-
paramsSerializer: (e) =>
|
|
31
|
+
paramsSerializer: (e) => s(e, {
|
|
28
32
|
arrayFormat: "repeat",
|
|
29
33
|
skipNulls: !0,
|
|
30
34
|
charset: "utf-8"
|
|
@@ -40,12 +44,12 @@ var v = class {
|
|
|
40
44
|
this.#e.interceptors.request.use(this.handleRequest.bind(this), this.handleRequestError.bind(this)), this.#e.interceptors.response.use(this.handleResponse.bind(this), this.handleResponseError.bind(this));
|
|
41
45
|
}
|
|
42
46
|
matchesCode(e, t) {
|
|
43
|
-
return
|
|
47
|
+
return c(t) ? t.includes(e) : e === t;
|
|
44
48
|
}
|
|
45
49
|
async handleRequest(e) {
|
|
46
|
-
let t = e.headers[
|
|
50
|
+
let t = e.headers[a] === "1", n = this.#n?.promise;
|
|
47
51
|
if (n && !t && !await this.waitForTokenRefresh(n, e)) throw Error("登录已过期, 请重新登录");
|
|
48
|
-
return t ? delete e.headers[
|
|
52
|
+
return t ? delete e.headers[a] : await this.injectAccessToken(e), this.replacePathParams(e), e;
|
|
49
53
|
}
|
|
50
54
|
handleRequestError(e) {
|
|
51
55
|
let { showErrorMessage: t } = this.#t, n = `发起请求失败: ${(e instanceof Error ? e.message : String(e)) || "未知错误"}`;
|
|
@@ -57,7 +61,7 @@ var v = class {
|
|
|
57
61
|
return this.assertBusinessSuccess(e.data, e.config), e;
|
|
58
62
|
}
|
|
59
63
|
async handleResponseError(e) {
|
|
60
|
-
if (e instanceof
|
|
64
|
+
if (e instanceof m) {
|
|
61
65
|
if (e.response) {
|
|
62
66
|
let { method: t, url: n } = e.response.config;
|
|
63
67
|
console.warn(`[HttpClient] [${t}: ${n}] 被取消`);
|
|
@@ -112,11 +116,11 @@ var v = class {
|
|
|
112
116
|
n?.accessToken && (e.headers.Authorization = `Bearer ${n.accessToken}`);
|
|
113
117
|
}
|
|
114
118
|
replacePathParams(e) {
|
|
115
|
-
let { url: t, params:
|
|
116
|
-
!t || !
|
|
117
|
-
if (!Object.hasOwn(
|
|
118
|
-
let i = r
|
|
119
|
-
return
|
|
119
|
+
let { url: t, params: n = {} } = e;
|
|
120
|
+
!t || !i.test(t) || (i.lastIndex = 0, e.url = t.replaceAll(i, (e, r) => {
|
|
121
|
+
if (!Object.hasOwn(n, r)) return console.warn(`[HttpClient] 接口: ${t} 路径参数 ${r} 未在查询参数中定义, 请检查`), "unknown";
|
|
122
|
+
let i = n[r];
|
|
123
|
+
return u(i) ? (console.warn(`[HttpClient] 接口: ${t} 路径参数 ${r} 在查询参数中为空, 请检查`), "unknown") : String(i);
|
|
120
124
|
}));
|
|
121
125
|
}
|
|
122
126
|
tryRefreshToken(e) {
|
|
@@ -168,10 +172,10 @@ var v = class {
|
|
|
168
172
|
waitForTokenRefresh(e, t) {
|
|
169
173
|
if (this.#n?.promise !== e) return e;
|
|
170
174
|
let { signal: n } = t;
|
|
171
|
-
return n?.aborted ? Promise.reject(new
|
|
172
|
-
let i = n &&
|
|
175
|
+
return n?.aborted ? Promise.reject(new m(void 0, t)) : new Promise((e, r) => {
|
|
176
|
+
let i = n && b(n) ? n : void 0, a, o = () => {
|
|
173
177
|
let e = a;
|
|
174
|
-
e && (a = void 0, this.#r.delete(e), i?.removeEventListener("abort", o), r(new
|
|
178
|
+
e && (a = void 0, this.#r.delete(e), i?.removeEventListener("abort", o), r(new m(void 0, t)));
|
|
175
179
|
};
|
|
176
180
|
a = (t) => {
|
|
177
181
|
let n = a;
|
|
@@ -182,24 +186,24 @@ var v = class {
|
|
|
182
186
|
async retryRequest(e) {
|
|
183
187
|
let t = {
|
|
184
188
|
...e,
|
|
185
|
-
[
|
|
189
|
+
[h]: this.getResponseMode(e)
|
|
186
190
|
};
|
|
187
191
|
return await this.injectAccessToken(t), this.#e(t);
|
|
188
192
|
}
|
|
189
193
|
getResponseMode(e) {
|
|
190
|
-
return Reflect.get(e,
|
|
194
|
+
return Reflect.get(e, h) === "raw" ? "raw" : "envelope";
|
|
191
195
|
}
|
|
192
196
|
isApiResult(e) {
|
|
193
|
-
return typeof e == "object" && !!e &&
|
|
197
|
+
return typeof e == "object" && !!e && d(Reflect.get(e, "code")) && f(Reflect.get(e, "message")) && Object.hasOwn(e, "data");
|
|
194
198
|
}
|
|
195
199
|
assertBusinessSuccess(e, t) {
|
|
196
|
-
let { showWarningMessage: n, okCode: r = 0 } = this.#t, { code:
|
|
197
|
-
if (!this.matchesCode(
|
|
200
|
+
let { showWarningMessage: n, okCode: r = 0 } = this.#t, { code: i, message: a, data: s } = e;
|
|
201
|
+
if (!this.matchesCode(i, r)) throw n ? n(a) : console.warn(`[HttpClient] [${t.method}: ${t.url}] 返回错误: ${a}`), new o(i, a, s);
|
|
198
202
|
}
|
|
199
203
|
async readApiResult(e) {
|
|
200
204
|
if (this.isApiResult(e)) return e;
|
|
201
|
-
if (
|
|
202
|
-
if (e.length >
|
|
205
|
+
if (f(e)) {
|
|
206
|
+
if (e.length > g || new Blob([e]).size > g) return;
|
|
203
207
|
try {
|
|
204
208
|
let t = JSON.parse(e);
|
|
205
209
|
return this.isApiResult(t) ? t : void 0;
|
|
@@ -207,41 +211,59 @@ var v = class {
|
|
|
207
211
|
return;
|
|
208
212
|
}
|
|
209
213
|
}
|
|
210
|
-
if ((
|
|
214
|
+
if ((v(e) || ArrayBuffer.isView(e)) && e.byteLength > g) return;
|
|
211
215
|
let t;
|
|
212
216
|
try {
|
|
213
217
|
t = this.toBlob(e);
|
|
214
218
|
} catch {
|
|
215
219
|
return;
|
|
216
220
|
}
|
|
217
|
-
if (!(t.size >
|
|
221
|
+
if (!(t.size > g)) try {
|
|
218
222
|
let e = JSON.parse(await t.text());
|
|
219
223
|
return this.isApiResult(e) ? e : void 0;
|
|
220
224
|
} catch {}
|
|
221
225
|
}
|
|
222
226
|
toBlob(e, t) {
|
|
223
227
|
if (e instanceof Blob) return e;
|
|
224
|
-
let n =
|
|
225
|
-
if (
|
|
228
|
+
let n = f(t) ? { type: t } : void 0;
|
|
229
|
+
if (v(e)) return new Blob([e], n);
|
|
226
230
|
if (ArrayBuffer.isView(e)) {
|
|
227
|
-
if (
|
|
231
|
+
if (v(e.buffer)) return new Blob([new Uint8Array(e.buffer, e.byteOffset, e.byteLength)], n);
|
|
228
232
|
let t = new Uint8Array(e.byteLength);
|
|
229
233
|
return t.set(new Uint8Array(e.buffer, e.byteOffset, e.byteLength)), new Blob([t], n);
|
|
230
234
|
}
|
|
231
235
|
throw TypeError("Invalid file response body");
|
|
232
236
|
}
|
|
233
|
-
getResponseFilename(
|
|
234
|
-
if (!
|
|
235
|
-
let
|
|
237
|
+
getResponseFilename(e) {
|
|
238
|
+
if (!f(e)) return;
|
|
239
|
+
let t = e.split(";").find((e) => {
|
|
236
240
|
let t = e.indexOf("=");
|
|
237
241
|
return t !== -1 && e.slice(0, t).trim().toLowerCase() === "filename*";
|
|
238
|
-
}), r =
|
|
242
|
+
}), r = t?.slice(t.indexOf("=") + 1).trim(), i = r?.indexOf("'") ?? -1, a = i >= 0 ? r?.indexOf("'", i + 1) ?? -1 : -1, o = a >= 0 ? r?.slice(a + 1) : void 0, s = i >= 0 ? r?.slice(0, i).trim().toLowerCase() : void 0;
|
|
239
243
|
if (o && (!s || s === "utf-8")) try {
|
|
240
244
|
return decodeURIComponent(o);
|
|
241
245
|
} catch {}
|
|
242
|
-
let c =
|
|
246
|
+
let c = n.exec(e), l = c?.groups?.name?.trim();
|
|
243
247
|
return l ? c?.groups?.quote ? l.slice(1, -1) : l : void 0;
|
|
244
248
|
}
|
|
249
|
+
async encodeRequestData(n, r, i) {
|
|
250
|
+
let a = r ?? this.#t.defaultBodyEncoding ?? "none";
|
|
251
|
+
if (a === "none" || !y(n)) return {
|
|
252
|
+
data: n,
|
|
253
|
+
options: i
|
|
254
|
+
};
|
|
255
|
+
let o = await e(f(n) ? n : JSON.stringify(n), a);
|
|
256
|
+
return {
|
|
257
|
+
data: o.body,
|
|
258
|
+
options: {
|
|
259
|
+
...i,
|
|
260
|
+
headers: {
|
|
261
|
+
...i.headers,
|
|
262
|
+
[t]: o.encoding
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
}
|
|
245
267
|
async ensureTokenRefreshed(e = !0) {
|
|
246
268
|
let t = e ? () => this.#t.onUnauthenticated?.() : void 0, { cycle: n, owner: r } = this.tryRefreshToken(t), i = await n.promise;
|
|
247
269
|
return r && await n.failureHandled, i;
|
|
@@ -250,12 +272,12 @@ var v = class {
|
|
|
250
272
|
return (await this.#e.get(e, t)).data;
|
|
251
273
|
}
|
|
252
274
|
async post(e, t) {
|
|
253
|
-
let { data: n,
|
|
254
|
-
return (await this.#e.post(e,
|
|
275
|
+
let { data: n, bodyEncoding: r, ...i } = t ?? {}, a = await this.encodeRequestData(n, r, i);
|
|
276
|
+
return (await this.#e.post(e, a.data, a.options)).data;
|
|
255
277
|
}
|
|
256
278
|
async put(e, t) {
|
|
257
|
-
let { data: n,
|
|
258
|
-
return (await this.#e.put(e,
|
|
279
|
+
let { data: n, bodyEncoding: r, ...i } = t ?? {}, a = await this.encodeRequestData(n, r, i);
|
|
280
|
+
return (await this.#e.put(e, a.data, a.options)).data;
|
|
259
281
|
}
|
|
260
282
|
async delete(e, t) {
|
|
261
283
|
return (await this.#e.delete(e, t)).data;
|
|
@@ -264,31 +286,31 @@ var v = class {
|
|
|
264
286
|
let { data: n, onProgress: r, ...i } = t ?? {};
|
|
265
287
|
return (await this.#e.postForm(e, n, {
|
|
266
288
|
...i,
|
|
267
|
-
onUploadProgress:
|
|
289
|
+
onUploadProgress: l(r) ? r : void 0
|
|
268
290
|
})).data;
|
|
269
291
|
}
|
|
270
292
|
async requestFile(e, t) {
|
|
271
293
|
let { method: n = "get", data: r, onProgress: i, ...a } = t ?? {}, o = {
|
|
272
294
|
...a,
|
|
273
|
-
[
|
|
295
|
+
[h]: "raw",
|
|
274
296
|
responseType: "arraybuffer",
|
|
275
297
|
responseEncoding: "binary",
|
|
276
|
-
onDownloadProgress:
|
|
277
|
-
}, { config:
|
|
278
|
-
return f && this.assertBusinessSuccess(f,
|
|
298
|
+
onDownloadProgress: l(i) ? i : void 0
|
|
299
|
+
}, { config: s, data: c, headers: u } = n === "post" ? await this.#e.post(e, r, o) : await this.#e.get(e, o), d = this.toBlob(c, u["content-type"]), f = await this.readApiResult(d);
|
|
300
|
+
return f && this.assertBusinessSuccess(f, s), {
|
|
279
301
|
blob: d,
|
|
280
302
|
filename: this.getResponseFilename(u["content-disposition"])
|
|
281
303
|
};
|
|
282
304
|
}
|
|
283
305
|
async download(e, t) {
|
|
284
|
-
let { filename: n, ...r } = t ?? {}, { blob: i, filename: a } = await this.requestFile(e, r), o = a ??
|
|
306
|
+
let { filename: n, ...r } = t ?? {}, { blob: i, filename: a } = await this.requestFile(e, r), o = a ?? _, s = URL.createObjectURL(i);
|
|
285
307
|
try {
|
|
286
308
|
let e = document.createElement("a");
|
|
287
|
-
e.href =
|
|
309
|
+
e.href = s, e.download = l(n) ? n(o) : n ?? o, e.click();
|
|
288
310
|
} finally {
|
|
289
|
-
setTimeout(() => URL.revokeObjectURL(
|
|
311
|
+
setTimeout(() => URL.revokeObjectURL(s), 0);
|
|
290
312
|
}
|
|
291
313
|
}
|
|
292
314
|
};
|
|
293
315
|
//#endregion
|
|
294
|
-
export {
|
|
316
|
+
export { x as HttpClient };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! @vef-framework-react/core v2.13.
|
|
1
|
+
/*! @vef-framework-react/core v2.13.1 made by Venus | 2026-07-28T11:21:11.377Z */
|
|
2
2
|
//#region src/http/constants.ts
|
|
3
|
-
var e = "__vef_http_client_key", t = /(?<=\/):(?<key>[A-Z_]\w*)/gi, n = /(?:^|;)\s*filename\s*=(?<name>(?<quote>['"]).*?\2|[^;\n]*)/i, r = "X-Skip-Authentication", i = "1", a = 3e4;
|
|
3
|
+
var e = "__vef_http_client_key", t = /(?<=\/):(?<key>[A-Z_]\w*)/gi, n = /(?:^|;)\s*filename\s*=(?<name>(?<quote>['"]).*?\2|[^;\n]*)/i, r = "X-Skip-Authentication", i = "1", a = "X-Body-Encoding", o = 3e4;
|
|
4
4
|
//#endregion
|
|
5
|
-
export { n as CONTENT_DISPOSITION_FILENAME_REGEX,
|
|
5
|
+
export { a as BODY_ENCODING_HEADER, n as CONTENT_DISPOSITION_FILENAME_REGEX, o as DEFAULT_TIMEOUT, e as HTTP_CLIENT_KEY, t as PATH_PARAM_REGEX, r as SKIP_AUTH_HEADER, i as SKIP_AUTH_VALUE };
|
package/dist/es/http/errors.js
CHANGED
package/dist/es/http/helpers.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/core v2.13.
|
|
1
|
+
/*! @vef-framework-react/core v2.13.1 made by Venus | 2026-07-28T11:21:11.377Z */
|
|
2
2
|
import { BusinessError as e } from "./errors.js";
|
|
3
3
|
import { HttpClient as t } from "./client.js";
|
|
4
4
|
//#region src/http/helpers.ts
|
package/dist/es/http/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/core v2.13.
|
|
1
|
+
/*! @vef-framework-react/core v2.13.1 made by Venus | 2026-07-28T11:21:11.377Z */
|
|
2
2
|
import { HTTP_CLIENT_KEY as e, SKIP_AUTH_HEADER as t, SKIP_AUTH_VALUE as n } from "./constants.js";
|
|
3
3
|
import { BusinessError as r } from "./errors.js";
|
|
4
4
|
import "./client.js";
|
package/dist/es/immer/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/core v2.13.
|
|
1
|
+
/*! @vef-framework-react/core v2.13.1 made by Venus | 2026-07-28T11:21:11.377Z */
|
|
2
2
|
import { applyPatches as e, current as t, enableMapSet as n, enablePatches as r, original as i, produce as a, produceWithPatches as o, setAutoFreeze as s } from "immer";
|
|
3
3
|
import { useImmer as c, useImmerReducer as l } from "use-immer";
|
|
4
4
|
n(), r(), s(!1);
|
package/dist/es/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/core v2.13.
|
|
1
|
+
/*! @vef-framework-react/core v2.13.1 made by Venus | 2026-07-28T11:21:11.377Z */
|
|
2
2
|
import { SKIP_AUTH_HEADER as e, SKIP_AUTH_VALUE as t } from "./http/constants.js";
|
|
3
3
|
import { BusinessError as n } from "./http/errors.js";
|
|
4
4
|
import { isBusinessError as r } from "./http/helpers.js";
|
package/dist/es/motion/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/core v2.13.
|
|
1
|
+
/*! @vef-framework-react/core v2.13.1 made by Venus | 2026-07-28T11:21:11.377Z */
|
|
2
2
|
import e from "./motion-provider.js";
|
|
3
3
|
import { AnimatePresence as t, LayoutGroup as n, Reorder as r, useDragControls as i, useInView as a } from "motion/react";
|
|
4
4
|
import * as o from "motion/react-m";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/core v2.13.
|
|
1
|
+
/*! @vef-framework-react/core v2.13.1 made by Venus | 2026-07-28T11:21:11.377Z */
|
|
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/push/client.js
CHANGED
package/dist/es/push/helpers.js
CHANGED
package/dist/es/push/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/core v2.13.
|
|
1
|
+
/*! @vef-framework-react/core v2.13.1 made by Venus | 2026-07-28T11:21:11.377Z */
|
|
2
2
|
import { PUSH_CLOSE_SESSION_INVALID as e, PUSH_CLOSE_TOO_MANY_CONNECTIONS as t } from "./types.js";
|
|
3
3
|
import { PushClient as n } from "./client.js";
|
|
4
4
|
import { createPushClient as r } from "./helpers.js";
|
package/dist/es/push/types.js
CHANGED
package/dist/es/query/helpers.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/core v2.13.
|
|
1
|
+
/*! @vef-framework-react/core v2.13.1 made by Venus | 2026-07-28T11:21:11.377Z */
|
|
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.13.
|
|
1
|
+
/*! @vef-framework-react/core v2.13.1 made by Venus | 2026-07-28T11:21:11.377Z */
|
|
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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/core v2.13.
|
|
1
|
+
/*! @vef-framework-react/core v2.13.1 made by Venus | 2026-07-28T11:21:11.377Z */
|
|
2
2
|
import { QUERY_CLIENT_KEY as e } from "./constants.js";
|
|
3
3
|
import { createQueryClient as t } from "./helpers.js";
|
|
4
4
|
import { useInfiniteQuery as n, useIsFetching as r, useIsMutating as i, useMutation as a, useMutationState as o, useQueries as s, useQuery as c } from "./hooks.js";
|
package/dist/es/sse/client.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/core v2.13.
|
|
1
|
+
/*! @vef-framework-react/core v2.13.1 made by Venus | 2026-07-28T11:21:11.377Z */
|
|
2
2
|
import { TokenExpiredError as e, createStreamMachine as t } from "./stream-machine.js";
|
|
3
3
|
import { isString as n } from "@vef-framework-react/shared";
|
|
4
4
|
import { fetchEventSource as r } from "@microsoft/fetch-event-source";
|
package/dist/es/sse/helpers.js
CHANGED
package/dist/es/sse/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/core v2.13.
|
|
1
|
+
/*! @vef-framework-react/core v2.13.1 made by Venus | 2026-07-28T11:21:11.377Z */
|
|
2
2
|
import { SseClient as e } from "./client.js";
|
|
3
3
|
import { createSseClient as t } from "./helpers.js";
|
|
4
4
|
export { e as SseClient, t as createSseClient };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/core v2.13.
|
|
1
|
+
/*! @vef-framework-react/core v2.13.1 made by Venus | 2026-07-28T11:21:11.377Z */
|
|
2
2
|
import { fromPromise as e, setup as t } from "xstate";
|
|
3
3
|
//#region src/sse/stream-machine.ts
|
|
4
4
|
var n = class extends Error {
|
package/dist/es/state/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! @vef-framework-react/core v2.13.
|
|
1
|
+
/*! @vef-framework-react/core v2.13.1 made by Venus | 2026-07-28T11:21:11.377Z */
|
|
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,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/core v2.13.
|
|
1
|
+
/*! @vef-framework-react/core v2.13.1 made by Venus | 2026-07-28T11:21:11.377Z */
|
|
2
2
|
import { Actor as e, assign as t, createActor as n, createMachine as r } from "xstate";
|
|
3
3
|
import { useActorRef as i, useActorRef as a, useSelector as o } from "@xstate/react";
|
|
4
4
|
//#region src/state-machine/index.ts
|
package/dist/es/storage/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/core v2.13.
|
|
1
|
+
/*! @vef-framework-react/core v2.13.1 made by Venus | 2026-07-28T11:21:11.377Z */
|
|
2
2
|
import { UploadAbortedError as e, UploadError as t, UploadPartError as n, UploadProtocolError as r } from "./errors.js";
|
|
3
3
|
import { DEFAULT_API_PATH as i, DEFAULT_RESOURCE as a, DEFAULT_VERSION as o, abortUpload as s, completeUpload as c, initUpload as l, listParts as u, uploadPart as d } from "./protocol.js";
|
|
4
4
|
import { PrefixFingerprinter as f, WeakFingerprinter as p } from "./resumable/fingerprint.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/core v2.13.
|
|
1
|
+
/*! @vef-framework-react/core v2.13.1 made by Venus | 2026-07-28T11:21:11.377Z */
|
|
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.13.
|
|
1
|
+
/*! @vef-framework-react/core v2.13.1 made by Venus | 2026-07-28T11:21:11.377Z */
|
|
2
2
|
import { PrefixFingerprinter as e, WeakFingerprinter as t } from "./fingerprint.js";
|
|
3
3
|
import { LocalStoragePersistence as n } from "./persistence.js";
|
|
4
4
|
import { resolveResumePlan as r } from "./plan.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/core v2.13.
|
|
1
|
+
/*! @vef-framework-react/core v2.13.1 made by Venus | 2026-07-28T11:21:11.377Z */
|
|
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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/core v2.13.
|
|
1
|
+
/*! @vef-framework-react/core v2.13.1 made by Venus | 2026-07-28T11:21:11.377Z */
|
|
2
2
|
import { assertEvent as e, fromPromise as t, setup as n } from "xstate";
|
|
3
3
|
//#region src/storage/uploader-machine.ts
|
|
4
4
|
function r(r) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/core v2.13.
|
|
1
|
+
/*! @vef-framework-react/core v2.13.1 made by Venus | 2026-07-28T11:21:11.377Z */
|
|
2
2
|
import { UploadAbortedError as e, UploadError as t, UploadPartError as n, UploadProtocolError as r } from "./errors.js";
|
|
3
3
|
import { abortUpload as i, completeUpload as a, initUpload as o, uploadPart as s } from "./protocol.js";
|
|
4
4
|
import { createUploaderMachine as c } from "./uploader-machine.js";
|
package/dist/es/store/bound.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/core v2.13.
|
|
1
|
+
/*! @vef-framework-react/core v2.13.1 made by Venus | 2026-07-28T11:21:11.377Z */
|
|
2
2
|
import { constantCase as e, identity as t } from "@vef-framework-react/shared";
|
|
3
3
|
import { create as n } from "zustand";
|
|
4
4
|
import { createJSONStorage as r, persist as i, subscribeWithSelector as a } from "zustand/middleware";
|
package/dist/es/store/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/core v2.13.
|
|
1
|
+
/*! @vef-framework-react/core v2.13.1 made by Venus | 2026-07-28T11:21:11.377Z */
|
|
2
2
|
import { createPersistedStore as e, createStore as t } from "./bound.js";
|
|
3
3
|
import { createComponentStore as n } from "./unbound.js";
|
|
4
4
|
import { useDeep as r } from "./use-deep.js";
|
package/dist/es/store/unbound.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/core v2.13.
|
|
1
|
+
/*! @vef-framework-react/core v2.13.1 made by Venus | 2026-07-28T11:21:11.377Z */
|
|
2
2
|
import { constantCase as e, identity as t, isPlainObject as n, mergeWith as r } from "@vef-framework-react/shared";
|
|
3
3
|
import { createContext as i, use as a, useRef as o } from "react";
|
|
4
4
|
import { jsx as s } from "@emotion/react/jsx-runtime";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @vef-framework-react/core v2.13.
|
|
1
|
+
/*! @vef-framework-react/core v2.13.1 made by Venus | 2026-07-28T11:21:11.377Z */
|
|
2
2
|
import { isDeepEqual as e } from "@vef-framework-react/shared";
|
|
3
3
|
import { useRef as t } from "react";
|
|
4
4
|
//#region src/store/use-deep.ts
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BodyEncoding } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* The transport encoding actually applied to a request body, paired with the
|
|
4
|
+
* encoded text. `gzip+base64` degrades to `base64` when the runtime has no
|
|
5
|
+
* `CompressionStream`, so the reported encoding can differ from the request.
|
|
6
|
+
*/
|
|
7
|
+
export interface EncodedRequestBody {
|
|
8
|
+
body: string;
|
|
9
|
+
encoding: Exclude<BodyEncoding, "none">;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Encode a serialized JSON payload for transport so a code-shaped body (an
|
|
13
|
+
* integration adapter or envelope/auth script) survives middleboxes that
|
|
14
|
+
* false-positive on it; the server's body-encoding middleware reverses it
|
|
15
|
+
* before parsing. `gzip+base64` compresses first — smaller on the wire and
|
|
16
|
+
* still text-shaped — and falls back to `base64` when the runtime cannot gzip.
|
|
17
|
+
*/
|
|
18
|
+
export declare function encodeRequestBody(payload: string, encoding: Exclude<BodyEncoding, "none">): Promise<EncodedRequestBody>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AxiosProgressEvent } from 'axios';
|
|
2
|
-
import { ApiResult, HttpClientOptions, HttpFileResponse, RequestOptions } from './types';
|
|
2
|
+
import { ApiResult, BodyEncoding, HttpClientOptions, HttpFileResponse, RequestOptions } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* The HTTP client.
|
|
5
5
|
*/
|
|
@@ -103,6 +103,12 @@ export declare class HttpClient {
|
|
|
103
103
|
* Extract a filename from Content-Disposition.
|
|
104
104
|
*/
|
|
105
105
|
private getResponseFilename;
|
|
106
|
+
/**
|
|
107
|
+
* Apply the resolved transport body encoding to a request, adding the
|
|
108
|
+
* `X-Body-Encoding` header for the server to reverse. A non-JSON body or a
|
|
109
|
+
* resolved `none` encoding passes through untouched.
|
|
110
|
+
*/
|
|
111
|
+
private encodeRequestData;
|
|
106
112
|
/**
|
|
107
113
|
* Ensure the token is refreshed. Can be called proactively by external code
|
|
108
114
|
* (e.g., fetch-based SSE) to refresh token before/after request.
|
|
@@ -123,6 +129,7 @@ export declare class HttpClient {
|
|
|
123
129
|
post<R = unknown, D = unknown, P = unknown>(url: string, options?: RequestOptions & {
|
|
124
130
|
data?: D;
|
|
125
131
|
params?: P;
|
|
132
|
+
bodyEncoding?: BodyEncoding;
|
|
126
133
|
}): Promise<ApiResult<R>>;
|
|
127
134
|
/**
|
|
128
135
|
* PUT request.
|
|
@@ -130,6 +137,7 @@ export declare class HttpClient {
|
|
|
130
137
|
put<R = unknown, D = unknown, P = unknown>(url: string, options?: RequestOptions & {
|
|
131
138
|
data?: D;
|
|
132
139
|
params?: P;
|
|
140
|
+
bodyEncoding?: BodyEncoding;
|
|
133
141
|
}): Promise<ApiResult<R>>;
|
|
134
142
|
/**
|
|
135
143
|
* DELETE request.
|
|
@@ -21,6 +21,11 @@ export declare const SKIP_AUTH_HEADER = "X-Skip-Authentication";
|
|
|
21
21
|
* The header value for skipping authentication.
|
|
22
22
|
*/
|
|
23
23
|
export declare const SKIP_AUTH_VALUE = "1";
|
|
24
|
+
/**
|
|
25
|
+
* The header naming the transport encoding applied to a request body, which the
|
|
26
|
+
* server's body-encoding middleware reverses before parsing.
|
|
27
|
+
*/
|
|
28
|
+
export declare const BODY_ENCODING_HEADER = "X-Body-Encoding";
|
|
24
29
|
/**
|
|
25
30
|
* Default request timeout in milliseconds (30 seconds).
|
|
26
31
|
*/
|
|
@@ -18,6 +18,18 @@ export interface ApiResult<T = unknown> {
|
|
|
18
18
|
*/
|
|
19
19
|
readonly data: T;
|
|
20
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* How a request body is transport-encoded so a code-shaped payload survives
|
|
23
|
+
* middleboxes (WAF / proxy) that false-positive on it; the server's
|
|
24
|
+
* body-encoding middleware reverses it before parsing.
|
|
25
|
+
*
|
|
26
|
+
* - `none` — send the body verbatim (also opts a single request out of a
|
|
27
|
+
* client-wide `defaultBodyEncoding`).
|
|
28
|
+
* - `base64` — base64 of the UTF-8 JSON body.
|
|
29
|
+
* - `gzip+base64` — base64 of a gzip stream of the UTF-8 JSON body; smaller on
|
|
30
|
+
* the wire and still text-shaped.
|
|
31
|
+
*/
|
|
32
|
+
export type BodyEncoding = "none" | "base64" | "gzip+base64";
|
|
21
33
|
/**
|
|
22
34
|
* The authenticated tokens.
|
|
23
35
|
*/
|
|
@@ -87,6 +99,12 @@ export interface HttpClientOptions {
|
|
|
87
99
|
* The function to show the error message.
|
|
88
100
|
*/
|
|
89
101
|
showErrorMessage?: (message: string) => void;
|
|
102
|
+
/**
|
|
103
|
+
* The transport encoding applied to every request body by default. Individual
|
|
104
|
+
* requests override it (including `"none"` to opt out); absent means the body
|
|
105
|
+
* is sent verbatim.
|
|
106
|
+
*/
|
|
107
|
+
defaultBodyEncoding?: BodyEncoding;
|
|
90
108
|
}
|
|
91
109
|
/**
|
|
92
110
|
* A file fetched through the HTTP client.
|
package/dist/types/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export { checkPermission, type PermissionCheckMode } from './auth';
|
|
|
3
3
|
export { type DataOption, type DataOptionWithPinyin, type PaginationParams, type PaginationResult } from './common';
|
|
4
4
|
export { ApiClientProvider, AppContextProvider, createContextWithSelector, DisabledProvider, useApiClient, useAppContext, useDisabled, type AppContext, type SelectorContextProviderProps, type SelectorContextResult, type UseSelectorContext } from './context';
|
|
5
5
|
export { AxisModifier, closestCenter, closestCorners, CollisionPriority, defaultCollisionDetection, defaultPreset, directionBiased, DragDropContext, DragDropProvider, Draggable, DragOverlay, Droppable, Feedback, KeyboardSensor, moveArrayItem, moveDragItem, PointerActivationConstraints, pointerDistance, pointerIntersection, PointerSensor, restrictShapeToBoundingRectangle, RestrictToElement, RestrictToHorizontalAxis, RestrictToVerticalAxis, RestrictToWindow, shapeIntersection, SnapModifier, swapArrayItem, swapDragItem, useDragDropMonitor, useDraggable, useDragOperation, useDroppable, useSortable, type BeforeDragStartEvent, type CollisionDetector, type CollisionEvent, type DragDropContextProps, type DragDropEventHandlers, type DragEndEvent, type DraggableChildrenFn, type DraggableId, type DraggableLocation, type DraggableProps, type DraggableProvided, type DraggableProvidedDraggableProps, type DraggableProvidedDragHandleProps, type DraggableRubric, type DraggableStateSnapshot, type DragMoveEvent, type DragOverEvent, type DragStartEvent, type DroppableId, type DroppableProps, type DroppableProvided, type DroppableProvidedProps, type DroppableStateSnapshot, type DropResult, type FeedbackInput, type FeedbackOptions, type FeedbackType, type OnBeforeCaptureResponder, type OnBeforeDragStartResponder, type OnDragEndResponder, type OnDragStartResponder, type OnDragUpdateResponder } from './dnd';
|
|
6
|
-
export type { ApiResult, AuthTokens, HttpClient, HttpClientOptions, HttpFileResponse, ProgressEvent, RequestOptions } from './http';
|
|
6
|
+
export type { ApiResult, AuthTokens, BodyEncoding, HttpClient, HttpClientOptions, HttpFileResponse, ProgressEvent, RequestOptions } from './http';
|
|
7
7
|
export { BusinessError, isBusinessError, skipAuthenticationHeader, skipAuthenticationValue } from './http';
|
|
8
8
|
export { applyPatches, currentState, originalState, produce, produceWithPatches, useImmer, useImmerReducer } from './immer';
|
|
9
9
|
export { AnimatePresence, LayoutGroup, motion, MotionProvider, Reorder, useDragControls, useInView, type MotionProps, type ResolvedValues, type TargetAndTransition, type Transition, type Variant, type VariantLabels, type Variants } from './motion';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vef-framework-react/core",
|
|
3
|
-
"version": "2.13.
|
|
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.13.
|
|
60
|
+
"@vef-framework-react/shared": "2.13.1"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"react": "^19.2.7"
|