@acrool/react-fetcher 0.0.2-alpha.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/LICENSE +21 -0
- package/README.md +100 -0
- package/dist/AuthStateProvider/AuthStateProvider.d.ts +20 -0
- package/dist/AuthStateProvider/index.d.ts +2 -0
- package/dist/AuthStateProvider/types.d.ts +12 -0
- package/dist/FetcherProvider/AxiosCancelException.d.ts +17 -0
- package/dist/FetcherProvider/FetcherProvider.d.ts +21 -0
- package/dist/FetcherProvider/config.d.ts +2 -0
- package/dist/FetcherProvider/index.d.ts +2 -0
- package/dist/FetcherProvider/types.d.ts +10 -0
- package/dist/FetcherProvider/utils.d.ts +7 -0
- package/dist/acrool-react-fetcher.es.js +2327 -0
- package/dist/exception/SystemException.d.ts +17 -0
- package/dist/exception/index.d.ts +1 -0
- package/dist/fetchers/graphqlFetcher.d.ts +4 -0
- package/dist/fetchers/index.d.ts +2 -0
- package/dist/fetchers/types.d.ts +11 -0
- package/dist/fetchers/utils.d.ts +13 -0
- package/dist/index.d.ts +3 -0
- package/package.json +106 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
interface IResponse {
|
|
2
|
+
message: string;
|
|
3
|
+
code?: string | undefined;
|
|
4
|
+
args?: unknown;
|
|
5
|
+
path?: string;
|
|
6
|
+
}
|
|
7
|
+
export default class SystemException extends Error {
|
|
8
|
+
private readonly response;
|
|
9
|
+
readonly code: any;
|
|
10
|
+
readonly devInfo: any;
|
|
11
|
+
readonly args: any;
|
|
12
|
+
readonly path: any;
|
|
13
|
+
constructor(response: IResponse);
|
|
14
|
+
initName(): void;
|
|
15
|
+
getInfo(): IResponse;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as SystemException } from './SystemException';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { InternalAxiosRequestConfig } from 'axios';
|
|
2
|
+
export interface IFetchOptions extends InternalAxiosRequestConfig {
|
|
3
|
+
requestCode?: string;
|
|
4
|
+
}
|
|
5
|
+
export interface IUseFetcherArgs<TVariables = {}> {
|
|
6
|
+
variables?: TVariables;
|
|
7
|
+
fetchOptions?: IFetchOptions;
|
|
8
|
+
}
|
|
9
|
+
export interface IUseSubscriptionArgs<TVariables> {
|
|
10
|
+
variables?: TVariables;
|
|
11
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type TFileMapVariables = Record<string, any>;
|
|
2
|
+
interface IConvertRes {
|
|
3
|
+
variables: TFileMapVariables;
|
|
4
|
+
map: string[];
|
|
5
|
+
values: File[];
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* 處理表單送出時, 將 data object 轉換成 graphql upload 格式
|
|
9
|
+
* @param originVariables
|
|
10
|
+
* @param parentKey
|
|
11
|
+
*/
|
|
12
|
+
export declare const getVariablesFileMap: <V extends TFileMapVariables | undefined>(originVariables: V, parentKey?: string[]) => IConvertRes;
|
|
13
|
+
export {};
|
package/dist/index.d.ts
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@acrool/react-fetcher",
|
|
3
|
+
"version": "0.0.2-alpha.0",
|
|
4
|
+
"description": "Fetcher library based for Reactjs",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"acrool",
|
|
7
|
+
"react",
|
|
8
|
+
"typescript",
|
|
9
|
+
"fetcher"
|
|
10
|
+
],
|
|
11
|
+
"private": false,
|
|
12
|
+
"type": "module",
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://github.com/acrool/acrool-react-fetcher.git"
|
|
17
|
+
},
|
|
18
|
+
"module": "./dist/acrool-react-fetcher.es.js",
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"exports": {
|
|
21
|
+
".": {
|
|
22
|
+
"types": "./dist/index.d.ts",
|
|
23
|
+
"browser": "./dist/acrool-react-fetcher.es.js",
|
|
24
|
+
"import": "./dist/acrool-react-fetcher.es.js"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist"
|
|
29
|
+
],
|
|
30
|
+
"engines": {
|
|
31
|
+
"node": ">=14"
|
|
32
|
+
},
|
|
33
|
+
"scripts": {
|
|
34
|
+
"dev": "NODE_ENV=development vite build -w",
|
|
35
|
+
"build:claer": "rm -rf ./dist",
|
|
36
|
+
"prepublishOnly": "run-s build",
|
|
37
|
+
"build": "run-s build:claer && tsc && vite build",
|
|
38
|
+
"preview": "vite preview",
|
|
39
|
+
"lint:fix": "eslint ./src --fix",
|
|
40
|
+
"cz": "git-cz",
|
|
41
|
+
"test": "jest",
|
|
42
|
+
"gitlog": "git log --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cblueby %an %Cgreen(%cr)%Creset'",
|
|
43
|
+
"release": "standard-version --release-as",
|
|
44
|
+
"release:major": "standard-version -r major",
|
|
45
|
+
"release:minor": "standard-version -r minor",
|
|
46
|
+
"release:patch": "standard-version -r patch",
|
|
47
|
+
"release:alpha": "standard-version --prerelease alpha"
|
|
48
|
+
},
|
|
49
|
+
"peerDependencies": {
|
|
50
|
+
"react": ">=18.0.0 <20.0.0",
|
|
51
|
+
"react-dom": ">=18.0.0 <20.0.0"
|
|
52
|
+
},
|
|
53
|
+
"dependencies": {
|
|
54
|
+
"@acrool/js-logger": "^1.0.27",
|
|
55
|
+
"@acrool/js-utils": "^3.2.25",
|
|
56
|
+
"axios": "^1.9.0",
|
|
57
|
+
"clsx": "^2.1.1"
|
|
58
|
+
},
|
|
59
|
+
"devDependencies": {
|
|
60
|
+
"@stylistic/eslint-plugin-ts": "^3.0.1",
|
|
61
|
+
"@swc/jest": "^0.2.27",
|
|
62
|
+
"@testing-library/dom": "10.3.1",
|
|
63
|
+
"@testing-library/jest-dom": "^6.6.3",
|
|
64
|
+
"@testing-library/react": "16.0.0",
|
|
65
|
+
"@types/jest": "^29.5.0",
|
|
66
|
+
"@types/node": "20.17.32",
|
|
67
|
+
"@types/react": "^19.1.2",
|
|
68
|
+
"@types/react-dom": "^19.1.2",
|
|
69
|
+
"@typescript-eslint/eslint-plugin": "^8.23.0",
|
|
70
|
+
"@typescript-eslint/parser": "^8.23.0",
|
|
71
|
+
"@vitejs/plugin-react-swc": "^3.0.0",
|
|
72
|
+
"axios-mock-adapter": "^2.1.0",
|
|
73
|
+
"cz-conventional-changelog": "3.3.0",
|
|
74
|
+
"cz-customizable": "6.6.0",
|
|
75
|
+
"eslint": "^9.19.0",
|
|
76
|
+
"eslint-plugin-react": "^7.37.5",
|
|
77
|
+
"eslint-plugin-simple-import-sort": "^10.0.0",
|
|
78
|
+
"identity-obj-proxy": "^3.0.0",
|
|
79
|
+
"jest": "^29.5.0",
|
|
80
|
+
"jest-environment-jsdom": "^29.5.0",
|
|
81
|
+
"msw": "^2.8.4",
|
|
82
|
+
"npm-run-all": "^4.1.5",
|
|
83
|
+
"react": "^19.1.0",
|
|
84
|
+
"react-dom": "^19.1.0",
|
|
85
|
+
"rollup-plugin-visualizer": "^5.9.0",
|
|
86
|
+
"sass": "^1.87.0",
|
|
87
|
+
"standard-version": "^9.5.0",
|
|
88
|
+
"ts-jest": "^29.3.2",
|
|
89
|
+
"ts-node": "10.8.1",
|
|
90
|
+
"tsconfig-paths": "^4.2.0",
|
|
91
|
+
"vite": "^6.0.11",
|
|
92
|
+
"vite-plugin-dts": "^4.5.3",
|
|
93
|
+
"vite-plugin-eslint": "^1.8.1",
|
|
94
|
+
"vite-plugin-svgr": "^4.3.0"
|
|
95
|
+
},
|
|
96
|
+
"config": {
|
|
97
|
+
"commitizen": {
|
|
98
|
+
"path": "node_modules/cz-git"
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
"msw": {
|
|
102
|
+
"workerDirectory": [
|
|
103
|
+
"example/public"
|
|
104
|
+
]
|
|
105
|
+
}
|
|
106
|
+
}
|