ag-common 0.0.415 → 0.0.417

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.
@@ -6,7 +6,7 @@ export type TUseCallOpenApi<T> = AxiosWrapper<T> & {
6
6
  loaded: boolean;
7
7
  loadcount: number;
8
8
  /** internally mutate state, but do not refetch. will automatically bump datetime */
9
- setData: React.Dispatch<React.SetStateAction<Omit<TUseCallOpenApi<T>, 'reFetch' | 'setData'>>>;
9
+ setData: React.Dispatch<React.SetStateAction<T>>;
10
10
  };
11
11
  type TUseCallOpenApiInt<T, TDefaultApi> = ICallOpenApi<T, TDefaultApi> & {
12
12
  cacheKey: string;
@@ -69,9 +69,10 @@ const useCallOpenApi = (inConfig) => {
69
69
  return Object.assign(Object.assign({}, resp), { reFetch, setData: (p) => __awaiter(void 0, void 0, void 0, function* () {
70
70
  //wipe cache, or might revert
71
71
  yield (0, cached_1.setOpenApiCacheRaw)(config, undefined);
72
- setResp(p);
73
72
  //ensure datetime is changed, or might get overwritten
74
- setResp((x) => (Object.assign(Object.assign({}, x), { datetime: new Date().getTime() })));
73
+ setResp((x) => (Object.assign(Object.assign({}, x), { datetime: new Date().getTime(), data: typeof p === 'function'
74
+ ? p(x.data)
75
+ : p })));
75
76
  }) });
76
77
  };
77
78
  exports.useCallOpenApi = useCallOpenApi;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ag-common",
3
- "version": "0.0.415",
3
+ "version": "0.0.417",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "author": "Andrei Gec <@andreigec> (https://gec.dev/)",
@@ -34,7 +34,7 @@
34
34
  "@emotion/styled": ">=11"
35
35
  },
36
36
  "devDependencies": {
37
- "@babel/core": "7.20.12",
37
+ "@babel/core": "7.21.0",
38
38
  "@storybook/addon-actions": "6.5.16",
39
39
  "@storybook/addon-docs": "6.5.16",
40
40
  "@storybook/addon-essentials": "6.5.16",
@@ -44,14 +44,14 @@
44
44
  "@storybook/react": "6.5.16",
45
45
  "@storybook/theming": "6.5.16",
46
46
  "@types/jsonwebtoken": "9.0.1",
47
- "@types/node": "18.13.0",
48
- "@types/react": "18.0.27",
49
- "@types/react-dom": "18.0.10",
50
- "@emotion/react": "11.10.5",
51
- "@emotion/styled": "11.10.5",
47
+ "@types/node": "18.14.6",
48
+ "@types/react": "18.0.28",
49
+ "@types/react-dom": "18.0.11",
50
+ "@emotion/react": "11.10.6",
51
+ "@emotion/styled": "11.10.6",
52
52
  "cross-env": "7.0.3",
53
53
  "eslint-config-e7npm": "0.0.8",
54
- "rimraf": "4.1.2"
54
+ "rimraf": "4.4.0"
55
55
  },
56
56
  "files": [
57
57
  "dist/**/*",