dt-shared-front 2.2.42 → 2.2.43
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/components/input/input.d.ts +1 -1
- package/dist/components/text-area/text-area.d.ts +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/main.css +34 -34
- package/dist/service/index.d.ts +3 -0
- package/dist/service/service.adapter.d.ts +2 -0
- package/dist/service/service.d.ts +27 -0
- package/package.json +2 -1
@@ -0,0 +1,27 @@
|
|
1
|
+
import { AxiosInstance, AxiosRequestConfig } from 'axios';
|
2
|
+
import { IResult } from './service.types';
|
3
|
+
interface IServiceRequestConfig {
|
4
|
+
requestInterceptor?: (req: AxiosRequestConfig<any>) => AxiosRequestConfig<any>;
|
5
|
+
}
|
6
|
+
export interface IBaseServiceStreamOptions {
|
7
|
+
complete?: () => void;
|
8
|
+
init?: (destroy: () => void) => void;
|
9
|
+
error?: (message: string) => void;
|
10
|
+
first?: () => void;
|
11
|
+
}
|
12
|
+
export default class BaseService {
|
13
|
+
protected axios: AxiosInstance;
|
14
|
+
private _params;
|
15
|
+
constructor({ ...params }: IServiceRequestConfig & AxiosRequestConfig);
|
16
|
+
createCancelToken: () => import("axios").CancelTokenSource;
|
17
|
+
private _request;
|
18
|
+
private _requestRPC;
|
19
|
+
protected get: <IResponse = any, IRequest = any>(url: string, options?: AxiosRequestConfig) => Promise<IResult<IResponse>>;
|
20
|
+
protected post: <IResponse = any, IRequest = any>(url: string, data?: IRequest, options?: AxiosRequestConfig) => Promise<IResult<IResponse>>;
|
21
|
+
protected put: <IResponse = any, IRequest = any>(url: string, data?: IRequest, options?: AxiosRequestConfig) => Promise<IResult<IResponse>>;
|
22
|
+
protected patch: <IResponse = any, IRequest = any>(url: string, data?: IRequest, options?: AxiosRequestConfig) => Promise<IResult<IResponse>>;
|
23
|
+
protected remove: <IResponse = any, IRequest = any>(url: string, options?: AxiosRequestConfig) => Promise<IResult<IResponse>>;
|
24
|
+
protected rpc: <IMethod extends (...args: any) => Promise<any>>(method: IMethod, ...params: Parameters<IMethod>) => Promise<IResult<Awaited<ReturnType<IMethod>>>>;
|
25
|
+
protected stream: <IResponse = any, IRequest = any>(url: string, params: IRequest, callback: (res: IResponse, init: boolean) => void, options?: IBaseServiceStreamOptions, adapter?: (res: IResponse) => IResponse) => Promise<void>;
|
26
|
+
}
|
27
|
+
export {};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "dt-shared-front",
|
3
|
-
"version": "2.2.
|
3
|
+
"version": "2.2.43",
|
4
4
|
"description": "Shared components",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"files": [
|
@@ -47,6 +47,7 @@
|
|
47
47
|
"lodash.debounce": "4.0.8",
|
48
48
|
"mini-css-extract-plugin": "^1.6.2",
|
49
49
|
"prettier": "2.7.1",
|
50
|
+
"axios": "0.27.2",
|
50
51
|
"react": "18.3.0",
|
51
52
|
"react-dom": "18.3.0",
|
52
53
|
"react-loading-skeleton": "^3.3.1",
|