@vef-framework/core 2.0.10 → 2.1.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/_internal/_rolldown/runtime.cjs +1 -0
- package/dist/cjs/ai/index.cjs +1 -0
- 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/constants.cjs +1 -0
- package/dist/cjs/http/errors.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/constants.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 -0
- package/dist/cjs/sse/helpers.cjs +1 -0
- package/dist/cjs/sse/index.cjs +1 -0
- package/dist/cjs/state/index.cjs +1 -1
- package/dist/cjs/state-machine/index.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 -3
- package/dist/cjs/store/use-deep.cjs +1 -1
- package/dist/es/ai/index.js +3 -0
- package/dist/es/api/client.js +72 -147
- package/dist/es/api/constants.js +14 -7
- package/dist/es/api/helpers.js +7 -6
- package/dist/es/api/index.js +4 -8
- package/dist/es/auth/helpers.js +9 -9
- package/dist/es/auth/index.js +2 -4
- package/dist/es/context/api-client.js +21 -17
- package/dist/es/context/app.js +8 -8
- package/dist/es/context/context-selector.js +38 -50
- package/dist/es/context/disabled.js +9 -9
- package/dist/es/context/index.js +5 -13
- package/dist/es/dnd/index.js +8 -30
- package/dist/es/http/client.js +186 -359
- package/dist/es/http/constants.js +5 -0
- package/dist/es/http/errors.js +10 -15
- package/dist/es/http/helpers.js +8 -11
- package/dist/es/http/index.js +5 -11
- package/dist/es/immer/index.js +6 -15
- package/dist/es/index.js +27 -122
- package/dist/es/motion/features.js +3 -4
- package/dist/es/motion/index.js +5 -11
- package/dist/es/motion/motion-provider.js +22 -21
- package/dist/es/query/constants.js +5 -4
- package/dist/es/query/helpers.js +40 -54
- package/dist/es/query/hooks.js +18 -28
- package/dist/es/query/index.js +4 -14
- package/dist/es/sse/client.js +121 -0
- package/dist/es/sse/helpers.js +8 -0
- package/dist/es/sse/index.js +3 -0
- package/dist/es/state/index.js +3 -11
- package/dist/es/state-machine/index.js +13 -14
- package/dist/es/store/bound.js +18 -33
- package/dist/es/store/index.js +6 -11
- package/dist/es/store/unbound.js +43 -50
- package/dist/es/store/use-deep.js +12 -11
- package/dist/types/ai/index.d.ts +6 -0
- package/dist/types/api/client.d.ts +15 -35
- package/dist/types/api/constants.d.ts +7 -3
- package/dist/types/api/index.d.ts +1 -1
- package/dist/types/auth/helpers.d.ts +5 -5
- package/dist/types/auth/index.d.ts +2 -2
- package/dist/types/common/index.d.ts +1 -1
- package/dist/types/common/types.d.ts +3 -0
- package/dist/types/context/api-client.d.ts +9 -10
- package/dist/types/context/app.d.ts +9 -1
- package/dist/types/context/context-selector.d.ts +7 -19
- package/dist/types/context/disabled.d.ts +2 -2
- package/dist/types/context/index.d.ts +3 -2
- package/dist/types/context/types.d.ts +0 -1
- package/dist/types/dnd/index.d.ts +4 -2
- package/dist/types/http/client.d.ts +39 -71
- package/dist/types/http/constants.d.ts +24 -0
- package/dist/types/http/index.d.ts +2 -1
- package/dist/types/index.d.ts +4 -2
- package/dist/types/motion/index.d.ts +2 -2
- package/dist/types/motion/motion-provider.d.ts +8 -3
- package/dist/types/query/helpers.d.ts +1 -4
- package/dist/types/query/hooks.d.ts +6 -45
- package/dist/types/query/types.d.ts +12 -12
- package/dist/types/src/ai/index.d.ts +6 -0
- package/dist/types/src/api/client.d.ts +55 -0
- package/dist/types/src/api/constants.d.ts +12 -0
- package/dist/types/src/api/helpers.d.ts +9 -0
- package/dist/types/src/api/index.d.ts +4 -0
- package/dist/types/src/api/types.d.ts +48 -0
- package/dist/types/src/auth/helpers.d.ts +11 -0
- package/dist/types/src/auth/index.d.ts +2 -0
- package/dist/types/src/auth/types.d.ts +1 -0
- package/dist/types/src/common/index.d.ts +1 -0
- package/dist/types/src/common/types.d.ts +98 -0
- package/dist/types/src/context/api-client.d.ts +17 -0
- package/dist/types/src/context/app.d.ts +12 -0
- package/dist/types/src/context/context-selector.d.ts +32 -0
- package/dist/types/src/context/disabled.d.ts +9 -0
- package/dist/types/src/context/index.d.ts +6 -0
- package/dist/types/src/context/types.d.ts +26 -0
- package/dist/types/src/dnd/index.d.ts +8 -0
- package/dist/types/src/http/client.d.ts +112 -0
- package/dist/types/src/http/constants.d.ts +24 -0
- package/dist/types/src/http/errors.d.ts +14 -0
- package/dist/types/src/http/helpers.d.ts +17 -0
- package/dist/types/src/http/index.d.ts +5 -0
- package/dist/types/src/http/types.d.ts +101 -0
- package/dist/types/src/immer/index.d.ts +2 -0
- package/dist/types/src/index.d.ts +16 -0
- package/dist/types/src/motion/features.d.ts +1 -0
- package/dist/types/src/motion/index.d.ts +4 -0
- package/dist/types/src/motion/motion-provider.d.ts +10 -0
- package/dist/types/src/query/constants.d.ts +1 -0
- package/dist/types/src/query/helpers.d.ts +7 -0
- package/dist/types/src/query/hooks.d.ts +27 -0
- package/dist/types/src/query/index.d.ts +4 -0
- package/dist/types/src/query/types.d.ts +51 -0
- package/dist/types/src/sse/client.d.ts +16 -0
- package/dist/types/src/sse/helpers.d.ts +9 -0
- package/dist/types/src/sse/index.d.ts +3 -0
- package/dist/types/src/sse/types.d.ts +98 -0
- package/dist/types/src/state/index.d.ts +1 -0
- package/dist/types/src/state-machine/index.d.ts +15 -0
- package/dist/types/src/store/bound.d.ts +28 -0
- package/dist/types/src/store/index.d.ts +5 -0
- package/dist/types/src/store/types.d.ts +50 -0
- package/dist/types/src/store/unbound.d.ts +26 -0
- package/dist/types/src/store/use-deep.d.ts +8 -0
- package/dist/types/sse/client.d.ts +16 -0
- package/dist/types/sse/helpers.d.ts +9 -0
- package/dist/types/sse/index.d.ts +3 -0
- package/dist/types/sse/types.d.ts +98 -0
- package/dist/types/state-machine/index.d.ts +2 -1
- package/dist/types/store/unbound.d.ts +6 -6
- package/dist/types/store/use-deep.d.ts +4 -3
- package/package.json +18 -16
- package/dist/cjs/common/index.cjs +0 -1
- package/dist/es/common/index.js +0 -1
package/dist/es/store/index.js
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
o as createPersistedStore,
|
|
8
|
-
t as createStore,
|
|
9
|
-
f as useDeep,
|
|
10
|
-
x as useShallow
|
|
11
|
-
};
|
|
1
|
+
/*! @vef-framework/core v2.1.0 made by Venus | 2026-03-27T07:13:02.254Z */
|
|
2
|
+
import "./bound.js";
|
|
3
|
+
import "./unbound.js";
|
|
4
|
+
import "./use-deep.js";
|
|
5
|
+
import { useShallow as e } from "zustand/shallow";
|
|
6
|
+
export { e as useShallow };
|
package/dist/es/store/unbound.js
CHANGED
|
@@ -1,51 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
import { isPlainObject as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
return {
|
|
44
|
-
StoreProvider: l,
|
|
45
|
-
useStoreApi: f,
|
|
46
|
-
useStore: p
|
|
47
|
-
};
|
|
1
|
+
/*! @vef-framework/core v2.1.0 made by Venus | 2026-03-27T07:13:02.254Z */
|
|
2
|
+
import { isPlainObject as e, mergeWith as t } from "@vef-framework/shared";
|
|
3
|
+
import { createContext as n, use as r, useRef as i } from "react";
|
|
4
|
+
import { jsx as a } from "@emotion/react/jsx-runtime";
|
|
5
|
+
import { useIsomorphicLayoutEffect as o } from "motion/react";
|
|
6
|
+
import { createStore as s, useStore as c } from "zustand";
|
|
7
|
+
import { subscribeWithSelector as l } from "zustand/middleware";
|
|
8
|
+
import { immer as u } from "zustand/middleware/immer";
|
|
9
|
+
//#region src/store/unbound.tsx
|
|
10
|
+
var d = /* @__PURE__ */ new Map();
|
|
11
|
+
function f(f, p) {
|
|
12
|
+
let m = `${f}StoreContext`, h = d.get(m);
|
|
13
|
+
h || (h = n(null), h.displayName = m, d.set(m, h));
|
|
14
|
+
let g = h;
|
|
15
|
+
function _({ children: n, initialState: r }) {
|
|
16
|
+
let c = i(null), d = i(!1), f = i(r);
|
|
17
|
+
return f.current = r, (!c.current || !d.current) && (c.current = s()(l(u(p))), d.current = !0), o(() => {
|
|
18
|
+
!e(f.current) || !c.current || c.current.setState((e) => {
|
|
19
|
+
t(e, f.current, !0);
|
|
20
|
+
});
|
|
21
|
+
}, []), /* @__PURE__ */ a(g, {
|
|
22
|
+
value: c.current,
|
|
23
|
+
children: n
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function v() {
|
|
27
|
+
let e = r(g);
|
|
28
|
+
if (!e) {
|
|
29
|
+
let e = `${f}Store is not found in the React context. Ensure the component is wrapped in ${f}StoreProvider.`;
|
|
30
|
+
throw Error(e + "");
|
|
31
|
+
}
|
|
32
|
+
return e;
|
|
33
|
+
}
|
|
34
|
+
function y(e) {
|
|
35
|
+
return c(v(), e);
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
StoreProvider: _,
|
|
39
|
+
useStoreApi: v,
|
|
40
|
+
useStore: y
|
|
41
|
+
};
|
|
48
42
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
};
|
|
43
|
+
//#endregion
|
|
44
|
+
export { f as createComponentStore };
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
/*! @vef-framework/core v2.1.0 made by Venus | 2026-03-27T07:13:02.254Z */
|
|
2
|
+
import { isDeepEqual as e } from "@vef-framework/shared";
|
|
3
|
+
import { useRef as t } from "react";
|
|
4
|
+
//#region src/store/use-deep.ts
|
|
5
|
+
function n(n) {
|
|
6
|
+
let r = t(null);
|
|
7
|
+
return (t) => {
|
|
8
|
+
let i = n(t);
|
|
9
|
+
return e(r.current, i) ? r.current : (r.current = i, i);
|
|
10
|
+
};
|
|
9
11
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { n as useDeep };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { DefaultChatTransport, TextStreamChatTransport, type ChatTransport } from 'ai';
|
|
2
|
+
export type { DataUIPart, DynamicToolUIPart, FileUIPart, ReasoningUIPart, SourceDocumentUIPart, SourceUrlUIPart, StepStartUIPart, TextUIPart, ToolUIPart, UIMessage, UIMessageChunk, UIMessagePart } from 'ai';
|
|
3
|
+
export type { UIToolInvocation, UITools } from 'ai';
|
|
4
|
+
export { getToolName, getToolOrDynamicToolName } from 'ai';
|
|
5
|
+
export { isDataUIPart, isFileUIPart, isReasoningUIPart, isTextUIPart, isToolOrDynamicToolUIPart, isToolUIPart } from 'ai';
|
|
6
|
+
export { isDeepEqualData, parsePartialJson } from 'ai';
|
|
@@ -2,66 +2,46 @@ import { FetchQueryOptions, MutationOptions, QueryClient, QueryMeta } from '@tan
|
|
|
2
2
|
import { Awaitable, Except, If, IsNever, IsOptional } from '@vef-framework/shared';
|
|
3
3
|
import { HttpClient } from '../http';
|
|
4
4
|
import { ApiClientOptions, MutationFunction, QueryFunction, QueryKey } from './types';
|
|
5
|
-
import { QUERY_CLIENT } from './constants';
|
|
5
|
+
import { HTTP_CLIENT, QUERY_CLIENT } from './constants';
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* API client that combines HttpClient and QueryClient for data fetching.
|
|
8
8
|
*/
|
|
9
9
|
export declare class ApiClient {
|
|
10
10
|
#private;
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* Access the underlying QueryClient.
|
|
13
13
|
*/
|
|
14
14
|
get [QUERY_CLIENT](): QueryClient;
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* @param options - The options for the API client.
|
|
16
|
+
* Access the underlying HttpClient.
|
|
19
17
|
*/
|
|
18
|
+
get [HTTP_CLIENT](): Readonly<HttpClient>;
|
|
20
19
|
constructor(options: ApiClientOptions);
|
|
21
20
|
/**
|
|
22
|
-
*
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
*
|
|
21
|
+
* Create a proxied HttpClient that injects the current abort signal.
|
|
22
|
+
*/
|
|
23
|
+
private createProxiedHttpClient;
|
|
24
|
+
/**
|
|
25
|
+
* Create a query function with automatic signal injection.
|
|
27
26
|
*/
|
|
28
27
|
createQueryFn<TResult = unknown, TParams = never, TPageParam = never>(key: string, factory: (http: Readonly<HttpClient>) => (queryParams: TParams, pageParam: TPageParam, meta?: QueryMeta) => Awaitable<TResult>): QueryFunction<TResult, TParams, TPageParam>;
|
|
29
28
|
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* @param key - The key of the mutation function.
|
|
33
|
-
* @param factory - The factory function.
|
|
34
|
-
* @returns The mutation function.
|
|
29
|
+
* Create a mutation function.
|
|
35
30
|
*/
|
|
36
31
|
createMutationFn<TResult = unknown, TParams = never>(key: string, factory: (http: Readonly<HttpClient>) => (params: TParams) => Awaitable<TResult>): MutationFunction<TResult, TParams>;
|
|
37
32
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* @param options - The options for the query.
|
|
41
|
-
* @returns The result of the query.
|
|
33
|
+
* Fetch a query and return the result.
|
|
42
34
|
*/
|
|
43
35
|
fetchQuery<TQueryFnData = unknown, TData = TQueryFnData, TParams = unknown, TPageParam = never>(options: Except<FetchQueryOptions<TQueryFnData, Error, TData, QueryKey<TParams>, TPageParam>, "queryHash" | "queryKeyHashFn">): Promise<TData>;
|
|
44
36
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* @param options - The options for the query.
|
|
48
|
-
* @returns A promise that resolves when the prefetch is complete.
|
|
37
|
+
* Prefetch a query and store the result in cache.
|
|
49
38
|
*/
|
|
50
39
|
prefetchQuery<TQueryFnData = unknown, TData = TQueryFnData, TParams = unknown, TPageParam = never>(options: Except<FetchQueryOptions<TQueryFnData, Error, TData, QueryKey<TParams>, TPageParam>, "queryHash" | "queryKeyHashFn">): Promise<void>;
|
|
51
40
|
/**
|
|
52
|
-
*
|
|
41
|
+
* Execute a mutation imperatively outside of React components.
|
|
53
42
|
*
|
|
54
|
-
* This method allows you to execute mutations imperatively without using the `useMutation` hook.
|
|
55
43
|
* Useful for scenarios like login flows, event handlers, or any code outside React components.
|
|
56
|
-
*
|
|
57
|
-
* @template TData - The type of data returned by the mutation
|
|
58
|
-
* @template TParams - The type of parameters passed to the mutation function
|
|
59
|
-
* @template TOnMutateResult - The type of result returned by onMutate callback
|
|
60
|
-
*
|
|
61
|
-
* @param options - The mutation options including mutationFn, onSuccess, onError, etc.
|
|
62
|
-
* @param variables - The variables to pass to the mutation function. Omit this argument when the mutation does not require parameters.
|
|
63
|
-
* @remarks This reuses TanStack Query's imperative mutation execution so lifecycle callbacks (onMutate, onSuccess, etc.) still fire.
|
|
64
|
-
* @returns A promise that resolves with the mutation result
|
|
44
|
+
* Lifecycle callbacks (onMutate, onSuccess, etc.) still fire.
|
|
65
45
|
*/
|
|
66
46
|
executeMutation<TData = unknown, TParams = unknown, TOnMutateResult = unknown>({ mutationFn, params, ...options }: Except<MutationOptions<TData, Error, TParams, TOnMutateResult>, "mutationKey" | "mutationFn"> & {
|
|
67
47
|
mutationFn: MutationFunction<TData, TParams>;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* HTTP methods that should have the abort signal injected.
|
|
3
3
|
*/
|
|
4
|
-
export declare const PROXIED_METHODS: string
|
|
4
|
+
export declare const PROXIED_METHODS: Set<string>;
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Symbol for accessing the query client.
|
|
7
7
|
*/
|
|
8
8
|
export declare const QUERY_CLIENT: unique symbol;
|
|
9
|
+
/**
|
|
10
|
+
* Symbol for accessing the HTTP client.
|
|
11
|
+
*/
|
|
12
|
+
export declare const HTTP_CLIENT: unique symbol;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { MaybeArray } from '@vef-framework/shared';
|
|
2
|
-
import { PermissionCheckMode } from './types';
|
|
2
|
+
import { PermissionCheckMode } from './types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Check if the user is authorized to access the resource identified by the permission token.
|
|
5
5
|
*
|
|
6
|
-
* @param hasPermission -
|
|
7
|
-
* @param permTokens -
|
|
8
|
-
* @param checkMode -
|
|
9
|
-
* @returns
|
|
6
|
+
* @param hasPermission - Function to check if the user has a specific permission token.
|
|
7
|
+
* @param permTokens - Single token or array of tokens to check. If nullish, returns true (no permission required).
|
|
8
|
+
* @param checkMode - "any" requires at least one token match, "all" requires all tokens to match.
|
|
9
|
+
* @returns True if the user has the required permission(s), false otherwise.
|
|
10
10
|
*/
|
|
11
11
|
export declare function checkPermission(hasPermission: (token: string) => boolean, permTokens?: MaybeArray<string>, checkMode?: PermissionCheckMode): boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { checkPermission } from './helpers';
|
|
2
|
-
export type * from './types';
|
|
1
|
+
export { checkPermission } from './helpers.js';
|
|
2
|
+
export type * from './types.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type * from './types';
|
|
1
|
+
export type * from './types.js';
|
|
@@ -6,11 +6,13 @@ import { AnyObject, EmptyObject, Except, Key } from '@vef-framework/shared';
|
|
|
6
6
|
export interface PaginationParams {
|
|
7
7
|
/**
|
|
8
8
|
* The page number, starting from 1
|
|
9
|
+
*
|
|
9
10
|
* @default 1
|
|
10
11
|
*/
|
|
11
12
|
page?: number;
|
|
12
13
|
/**
|
|
13
14
|
* The number of items per page
|
|
15
|
+
*
|
|
14
16
|
* @default 15
|
|
15
17
|
*/
|
|
16
18
|
size?: number;
|
|
@@ -48,6 +50,7 @@ export type DataOption<T = EmptyObject, M extends AnyObject = AnyObject> = T & {
|
|
|
48
50
|
value: Key;
|
|
49
51
|
/**
|
|
50
52
|
* Whether the option is disabled
|
|
53
|
+
*
|
|
51
54
|
* @default false
|
|
52
55
|
*/
|
|
53
56
|
disabled?: boolean;
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ComponentProps, Context } from 'react';
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
3
2
|
import { ApiClient } from '../api';
|
|
4
|
-
|
|
3
|
+
interface ApiClientProviderProps extends PropsWithChildren {
|
|
4
|
+
value: ApiClient;
|
|
5
|
+
}
|
|
5
6
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* @param props - The props for the provider.
|
|
9
|
-
* @returns The provider for the API client.
|
|
7
|
+
* Provider for the API client context.
|
|
8
|
+
* Wraps children with both ApiClient context and React Query's QueryClientProvider.
|
|
10
9
|
*/
|
|
11
|
-
export declare function ApiClientProvider({ value, children }:
|
|
10
|
+
export declare function ApiClientProvider({ value, children }: ApiClientProviderProps): React.JSX.Element;
|
|
12
11
|
/**
|
|
13
|
-
*
|
|
12
|
+
* Hook to access the API client from context.
|
|
14
13
|
*
|
|
15
|
-
* @
|
|
14
|
+
* @throws Error if used outside of ApiClientProvider.
|
|
16
15
|
*/
|
|
17
16
|
export declare function useApiClient(): ApiClient;
|
|
18
17
|
export {};
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import { AppContext } from './types';
|
|
2
|
-
import { Provider } from 'react';
|
|
2
|
+
import { Context, Provider } from 'react';
|
|
3
|
+
declare const AppContext: Context<AppContext>;
|
|
4
|
+
/**
|
|
5
|
+
* Provider for the VEF app context.
|
|
6
|
+
*/
|
|
3
7
|
export declare const AppContextProvider: Provider<AppContext>;
|
|
8
|
+
/**
|
|
9
|
+
* Hook to access the VEF app context.
|
|
10
|
+
*/
|
|
4
11
|
export declare function useAppContext(): AppContext;
|
|
12
|
+
export {};
|
|
@@ -1,44 +1,32 @@
|
|
|
1
1
|
import { ComponentType, PropsWithChildren } from 'react';
|
|
2
2
|
/**
|
|
3
|
-
* Props for the selector context provider component
|
|
3
|
+
* Props for the selector context provider component.
|
|
4
4
|
*/
|
|
5
5
|
export interface SelectorContextProviderProps<TValue> extends PropsWithChildren {
|
|
6
|
-
/**
|
|
7
|
-
* The value to provide to child components
|
|
8
|
-
*/
|
|
9
6
|
value: TValue;
|
|
10
7
|
}
|
|
11
8
|
/**
|
|
12
|
-
* Context hook interface with optional selector support
|
|
9
|
+
* Context hook interface with optional selector support.
|
|
13
10
|
*/
|
|
14
11
|
export interface UseSelectorContext<in out TValue> {
|
|
15
12
|
/**
|
|
16
|
-
*
|
|
13
|
+
* Returns the full context value.
|
|
17
14
|
*/
|
|
18
15
|
<TStrictValue extends TValue = TValue>(): TStrictValue;
|
|
19
16
|
/**
|
|
20
|
-
*
|
|
17
|
+
* Returns the selected portion of the context value.
|
|
21
18
|
*/
|
|
22
19
|
<TStrictValue extends TValue = TValue, TSelected = TStrictValue>(selector: (value: TStrictValue) => TSelected): NoInfer<TSelected>;
|
|
23
20
|
}
|
|
24
21
|
/**
|
|
25
|
-
* Result of creating a selector context
|
|
22
|
+
* Result of creating a selector context.
|
|
26
23
|
*/
|
|
27
24
|
export interface SelectorContextResult<TValue> {
|
|
28
|
-
/**
|
|
29
|
-
* Provider component to wrap child components
|
|
30
|
-
*/
|
|
31
25
|
Provider: ComponentType<SelectorContextProviderProps<TValue>>;
|
|
32
|
-
/**
|
|
33
|
-
* Hook to access context value with optional selector
|
|
34
|
-
*/
|
|
35
26
|
useContext: UseSelectorContext<TValue>;
|
|
36
27
|
}
|
|
37
28
|
/**
|
|
38
|
-
* Creates a context with selector support
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* @param defaultValue - The default value for the context
|
|
42
|
-
* @returns An object containing the Provider component and useContext hook
|
|
29
|
+
* Creates a context with selector support for optimal re-rendering.
|
|
30
|
+
* Consuming components can select specific parts of the context value.
|
|
43
31
|
*/
|
|
44
32
|
export declare function createContextWithSelector<TValue>(defaultValue: TValue): SelectorContextResult<TValue>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Provider } from 'react';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Hook to access the disabled state from context.
|
|
4
4
|
*/
|
|
5
5
|
export declare function useDisabled(): boolean;
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Provider for the disabled state context.
|
|
8
8
|
*/
|
|
9
9
|
export declare const DisabledProvider: Provider<boolean>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { ApiClientProvider, useApiClient } from './api-client';
|
|
2
2
|
export { AppContextProvider, useAppContext } from './app';
|
|
3
|
-
export {
|
|
3
|
+
export type { SelectorContextProviderProps, SelectorContextResult, UseSelectorContext } from './context-selector';
|
|
4
|
+
export { createContextWithSelector } from './context-selector';
|
|
4
5
|
export { DisabledProvider, useDisabled } from './disabled';
|
|
5
|
-
export type
|
|
6
|
+
export type { AppContext } from './types';
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export { AxisModifier, restrictShapeToBoundingRectangle, RestrictToHorizontalAxis, RestrictToVerticalAxis, SnapModifier } from '@dnd-kit/abstract/modifiers';
|
|
2
2
|
export { RestrictToElement, RestrictToWindow } from '@dnd-kit/dom/modifiers';
|
|
3
3
|
export { arrayMove as moveArrayItem, move as moveDragItem, arraySwap as swapArrayItem, swap as swapDragItem } from '@dnd-kit/helpers';
|
|
4
|
-
export {
|
|
4
|
+
export type { DragDropEventHandlers, DragDropEvents } from '@dnd-kit/react';
|
|
5
|
+
export { DragDropProvider, DragOverlay, KeyboardSensor, PointerSensor, useDragDropMonitor, useDraggable, useDroppable } from '@dnd-kit/react';
|
|
5
6
|
export { useSortable } from '@dnd-kit/react/sortable';
|
|
6
|
-
export {
|
|
7
|
+
export type { DragDropContextProps, DraggableChildrenFn, DraggableId, DraggableLocation, DraggableProps, DraggableProvided, DraggableProvidedDraggableProps, DraggableProvidedDragHandleProps, DraggableRubric, DraggableStateSnapshot, DroppableId, DroppableProps, DroppableProvided, DroppableProvidedProps, DroppableStateSnapshot, DropResult, OnBeforeCaptureResponder, OnBeforeDragStartResponder, OnDragEndResponder, OnDragStartResponder, OnDragUpdateResponder } from '@hello-pangea/dnd';
|
|
8
|
+
export { DragDropContext, Draggable, Droppable } from '@hello-pangea/dnd';
|
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
import { AxiosProgressEvent } from 'axios';
|
|
2
2
|
import { ApiResult, HttpClientOptions, RequestOptions } from './types';
|
|
3
|
-
/**
|
|
4
|
-
* The header name for the skip authentication.
|
|
5
|
-
*/
|
|
6
|
-
export declare const skipAuthenticationHeader = "X-Skip-Authentication";
|
|
7
|
-
/**
|
|
8
|
-
* The header value for the skip authentication.
|
|
9
|
-
*/
|
|
10
|
-
export declare const skipAuthenticationValue = "1";
|
|
11
3
|
/**
|
|
12
4
|
* The HTTP client.
|
|
13
5
|
*/
|
|
@@ -16,113 +8,93 @@ export declare class HttpClient {
|
|
|
16
8
|
constructor(options: HttpClientOptions);
|
|
17
9
|
private initInterceptors;
|
|
18
10
|
/**
|
|
19
|
-
* Check if the code
|
|
20
|
-
*
|
|
21
|
-
* @param code - The code.
|
|
22
|
-
* @param target - The target.
|
|
23
|
-
* @returns The result.
|
|
11
|
+
* Check if the code matches the target code(s).
|
|
24
12
|
*/
|
|
25
|
-
private
|
|
13
|
+
private matchesCode;
|
|
26
14
|
/**
|
|
27
|
-
* Handle the request.
|
|
28
|
-
*
|
|
29
|
-
* @param config - The axios request config.
|
|
30
|
-
* @returns The axios request config.
|
|
15
|
+
* Handle the request interceptor.
|
|
31
16
|
*/
|
|
32
17
|
private handleRequest;
|
|
33
18
|
/**
|
|
34
|
-
* Handle the request error.
|
|
35
|
-
*
|
|
36
|
-
* @param error - The axios error.
|
|
19
|
+
* Handle the request error interceptor.
|
|
37
20
|
*/
|
|
38
21
|
private handleRequestError;
|
|
39
22
|
/**
|
|
40
|
-
* Handle the response.
|
|
41
|
-
*
|
|
42
|
-
* @param response - The axios response.
|
|
43
|
-
* @returns The axios response.
|
|
23
|
+
* Handle the response interceptor.
|
|
44
24
|
*/
|
|
45
25
|
private handleResponse;
|
|
46
26
|
/**
|
|
47
|
-
* Handle the response error.
|
|
48
|
-
*
|
|
49
|
-
* @param error - The axios error.
|
|
27
|
+
* Handle the response error interceptor.
|
|
50
28
|
*/
|
|
51
29
|
private handleResponseError;
|
|
52
30
|
/**
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
* @param config - The axios request config.
|
|
31
|
+
* Handle 401 unauthorized response.
|
|
56
32
|
*/
|
|
57
|
-
private
|
|
33
|
+
private handleUnauthorized;
|
|
58
34
|
/**
|
|
59
|
-
*
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
35
|
+
* Log info message using configured handler or console.
|
|
36
|
+
*/
|
|
37
|
+
private logInfo;
|
|
38
|
+
/**
|
|
39
|
+
* Log warning message using configured handler or console.
|
|
40
|
+
*/
|
|
41
|
+
private logWarning;
|
|
42
|
+
/**
|
|
43
|
+
* Log error message using configured handler or console.
|
|
44
|
+
*/
|
|
45
|
+
private logError;
|
|
46
|
+
/**
|
|
47
|
+
* Inject access token into request Authorization header.
|
|
48
|
+
*/
|
|
49
|
+
private injectAccessToken;
|
|
50
|
+
/**
|
|
51
|
+
* Replace path parameters in the URL (e.g., /users/:id -> /users/123).
|
|
63
52
|
*/
|
|
64
53
|
private replacePathParams;
|
|
65
54
|
/**
|
|
66
|
-
*
|
|
55
|
+
* Ensure the token is refreshed. Can be called proactively by external code
|
|
56
|
+
* (e.g., fetch-based SSE) to refresh token before/after request.
|
|
67
57
|
*
|
|
58
|
+
* @param triggerCallback - Whether to trigger onUnauthenticated callback on failure.
|
|
68
59
|
* @returns True if token refresh succeeded, false otherwise.
|
|
69
60
|
*/
|
|
61
|
+
ensureTokenRefreshed(triggerCallback?: boolean): Promise<boolean>;
|
|
62
|
+
/**
|
|
63
|
+
* Try to refresh the token using the provided refresh callback.
|
|
64
|
+
*/
|
|
70
65
|
private tryRefreshToken;
|
|
71
66
|
/**
|
|
72
|
-
* Retry the request.
|
|
73
|
-
*
|
|
74
|
-
* @param config - The axios request config.
|
|
75
|
-
* @returns The axios response.
|
|
67
|
+
* Retry the request with refreshed token.
|
|
76
68
|
*/
|
|
77
69
|
private retryRequest;
|
|
78
70
|
/**
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
* @param url - The url.
|
|
82
|
-
* @param options - The options for the request.
|
|
83
|
-
* @returns The response data.
|
|
71
|
+
* GET request.
|
|
84
72
|
*/
|
|
85
73
|
get<R = unknown, P = unknown>(url: string, options?: RequestOptions & {
|
|
86
74
|
params?: P;
|
|
87
75
|
}): Promise<ApiResult<R>>;
|
|
88
76
|
/**
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
* @param url - The url.
|
|
92
|
-
* @param options - The options for the request.
|
|
93
|
-
* @returns The response data.
|
|
77
|
+
* POST request.
|
|
94
78
|
*/
|
|
95
79
|
post<R = unknown, D = unknown, P = unknown>(url: string, options?: RequestOptions & {
|
|
96
80
|
data?: D;
|
|
97
81
|
params?: P;
|
|
98
82
|
}): Promise<ApiResult<R>>;
|
|
99
83
|
/**
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
* @param url - The url.
|
|
103
|
-
* @param options - The options for the request.
|
|
104
|
-
* @returns The response data.
|
|
84
|
+
* PUT request.
|
|
105
85
|
*/
|
|
106
86
|
put<R = unknown, D = unknown, P = unknown>(url: string, options?: RequestOptions & {
|
|
107
87
|
data?: D;
|
|
108
88
|
params?: P;
|
|
109
89
|
}): Promise<ApiResult<R>>;
|
|
110
90
|
/**
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
* @param url - The url.
|
|
114
|
-
* @param options - The options for the request.
|
|
115
|
-
* @returns The response data.
|
|
91
|
+
* DELETE request.
|
|
116
92
|
*/
|
|
117
93
|
delete<R = unknown, P = unknown>(url: string, options?: RequestOptions & {
|
|
118
94
|
params?: P;
|
|
119
95
|
}): Promise<ApiResult<R>>;
|
|
120
96
|
/**
|
|
121
|
-
* Upload
|
|
122
|
-
*
|
|
123
|
-
* @param url - The url.
|
|
124
|
-
* @param options - The options for the request.
|
|
125
|
-
* @returns The response data.
|
|
97
|
+
* Upload file via multipart/form-data.
|
|
126
98
|
*/
|
|
127
99
|
upload<R = unknown, P = unknown>(url: string, options?: RequestOptions & {
|
|
128
100
|
params?: P;
|
|
@@ -130,11 +102,7 @@ export declare class HttpClient {
|
|
|
130
102
|
onProgress?: (event: AxiosProgressEvent) => void;
|
|
131
103
|
}): Promise<ApiResult<R>>;
|
|
132
104
|
/**
|
|
133
|
-
* Download
|
|
134
|
-
*
|
|
135
|
-
* @param url - The url.
|
|
136
|
-
* @param options - The options for the request.
|
|
137
|
-
* @returns The response data.
|
|
105
|
+
* Download file as blob and trigger browser download.
|
|
138
106
|
*/
|
|
139
107
|
download<P = unknown>(url: string, options?: RequestOptions & {
|
|
140
108
|
params?: P;
|