@next-feature/client 0.1.1 → 0.1.2-2
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/components/api-error-boundary.d.ts +18 -0
- package/hooks/use-api-error.d.ts +10 -0
- package/{src/index.ts → index.d.ts} +6 -6
- package/index.js +4844 -0
- package/lib/client.d.ts +72 -0
- package/lib/config/index.d.ts +20 -0
- package/lib/error.d.ts +35 -0
- package/lib/types/client.d.ts +24 -0
- package/lib/types/index.d.ts +27 -0
- package/lib/utils/axios.d.ts +7 -0
- package/lib/utils/error.d.ts +19 -0
- package/lib/utils/zod.d.ts +10 -0
- package/package.json +1 -1
- package/server.d.ts +0 -0
- package/server.js +1 -0
- package/.babelrc +0 -12
- package/eslint.config.mjs +0 -12
- package/jest.config.cts +0 -10
- package/project.json +0 -32
- package/src/components/api-error-boundary.tsx +0 -58
- package/src/hooks/use-api-error.tsx +0 -39
- package/src/lib/client.ts +0 -431
- package/src/lib/error.ts +0 -169
- package/src/lib/types/index.ts +0 -13
- package/src/lib/utils/error.ts +0 -136
- package/src/lib/utils/helper.ts +0 -20
- package/tsconfig.json +0 -20
- package/tsconfig.lib.json +0 -29
- package/tsconfig.spec.json +0 -23
- package/vite.config.ts +0 -51
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { default as React, Component, ErrorInfo, ReactNode } from 'react';
|
|
2
|
+
import { ApiError } from '../lib/error';
|
|
3
|
+
interface Props {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
fallback?: (error: ApiError) => ReactNode;
|
|
6
|
+
onError?: (error: Error, errorInfo: ErrorInfo) => void;
|
|
7
|
+
}
|
|
8
|
+
interface State {
|
|
9
|
+
hasError: boolean;
|
|
10
|
+
error: Error | null;
|
|
11
|
+
}
|
|
12
|
+
export declare class ApiErrorBoundary extends Component<Props, State> {
|
|
13
|
+
constructor(props: Props);
|
|
14
|
+
static getDerivedStateFromError(error: Error): State;
|
|
15
|
+
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
16
|
+
render(): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode>> | import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ApiError } from '../lib/error';
|
|
2
|
+
interface UseApiErrorResult {
|
|
3
|
+
error: ApiError | null;
|
|
4
|
+
setError: (error: ApiError | null) => void;
|
|
5
|
+
clearError: () => void;
|
|
6
|
+
handleError: (error: unknown) => void;
|
|
7
|
+
errorMessage: string | null;
|
|
8
|
+
}
|
|
9
|
+
export declare function useApiError(): UseApiErrorResult;
|
|
10
|
+
export {};
|
|
@@ -21,10 +21,10 @@
|
|
|
21
21
|
* - Customize src/hooks/use-api-error.tsx
|
|
22
22
|
* - Customize src/components/api-error-boundary.tsx
|
|
23
23
|
*/
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
export
|
|
27
|
-
export
|
|
28
|
-
export * from './lib/
|
|
24
|
+
export { ApiClient } from './lib/client';
|
|
25
|
+
export { ApiError } from './lib/error';
|
|
26
|
+
export * from './lib/types/client';
|
|
27
|
+
export * from './lib/types/index';
|
|
28
|
+
export * from './lib/utils/axios';
|
|
29
29
|
export * from './lib/utils/error';
|
|
30
|
-
export * from './lib/utils/
|
|
30
|
+
export * from './lib/utils/zod';
|