@common-stack/frontend-stack-react 6.0.6-alpha.0 → 6.0.6-alpha.106
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/lib/backend/middlewares/container.js +1 -1
- package/lib/backend/middlewares/error.js +1 -1
- package/lib/config/base-apollo-cache.js +2 -2
- package/lib/config/base-apollo-client.js +16 -4
- package/lib/config/base-redux-config.d.ts +1 -1
- package/lib/config/epic-config.d.ts +2 -2
- package/lib/config/epic-config.js +2 -2
- package/lib/entries/antui/components/ErrorBoundary.js +13 -4
- package/lib/entries/chakraui/components/ErrorBoundary.js +13 -4
- package/package.json +20 -17
- package/lib/entries/chakraui/components/Error500.js +0 -14
|
@@ -64,7 +64,7 @@ const containerMiddleware = async (req, res, next) => {
|
|
|
64
64
|
logger.debug(`Successfully cleaned up - ID: ${requestId}`);
|
|
65
65
|
}
|
|
66
66
|
catch (error) {
|
|
67
|
-
logger.error(
|
|
67
|
+
logger.error(error, 'Error during container cleanup - ID: [%s]', requestId);
|
|
68
68
|
}
|
|
69
69
|
});
|
|
70
70
|
next();
|
|
@@ -4,7 +4,7 @@ const stripCircular = (from, seen) => {
|
|
|
4
4
|
const to = Array.isArray(from) ? [] : {};
|
|
5
5
|
seen = seen || [];
|
|
6
6
|
seen.push(from);
|
|
7
|
-
Object.getOwnPropertyNames(from).forEach(key => {
|
|
7
|
+
Object.getOwnPropertyNames(from).forEach((key) => {
|
|
8
8
|
if (!from[key] || (typeof from[key] !== 'object' && !Array.isArray(from[key]))) {
|
|
9
9
|
to[key] = from[key];
|
|
10
10
|
}
|
|
@@ -14,7 +14,7 @@ const initializeCache = ({ cache, initialState, clientState, logger }) => {
|
|
|
14
14
|
logger.debug('Cache restored with initial state');
|
|
15
15
|
}
|
|
16
16
|
catch (err) {
|
|
17
|
-
logger.error('Error restoring cache'
|
|
17
|
+
logger.error(err, 'Error restoring cache');
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
else {
|
|
@@ -28,7 +28,7 @@ const initializeCache = ({ cache, initialState, clientState, logger }) => {
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
catch (err) {
|
|
31
|
-
logger.error('Error writing to cache'
|
|
31
|
+
logger.error(err, 'Error writing to cache');
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
34
|
}
|
|
@@ -32,7 +32,7 @@ const createApolloClient = ({ scope, isDev, isDebug, isSSR, getDataIdFromObject,
|
|
|
32
32
|
return !!result.find((item) => item && isBoolean(item));
|
|
33
33
|
}
|
|
34
34
|
catch (e) {
|
|
35
|
-
logger.error('Error occurred in retryLink attempt condition'
|
|
35
|
+
logger.error(e, 'Error occurred in retryLink attempt condition');
|
|
36
36
|
throw e;
|
|
37
37
|
}
|
|
38
38
|
},
|
|
@@ -42,9 +42,10 @@ const createApolloClient = ({ scope, isDev, isDebug, isSSR, getDataIdFromObject,
|
|
|
42
42
|
const connectionParams = async () => {
|
|
43
43
|
logger.debug('Getting WebSocket connection parameters');
|
|
44
44
|
const param = {};
|
|
45
|
-
|
|
45
|
+
const promises = await Promise.all(clientState.connectionParams);
|
|
46
|
+
for (const connectionParam of promises) {
|
|
46
47
|
const result = await connectionParam();
|
|
47
|
-
merge(param,
|
|
48
|
+
merge(param, result);
|
|
48
49
|
}
|
|
49
50
|
return param;
|
|
50
51
|
};
|
|
@@ -116,4 +117,15 @@ const createApolloClient = ({ scope, isDev, isDebug, isSSR, getDataIdFromObject,
|
|
|
116
117
|
logger.debug('Created new Apollo client');
|
|
117
118
|
initializeCache({ cache, initialState, clientState, logger });
|
|
118
119
|
return { apolloClient, cache };
|
|
119
|
-
};
|
|
120
|
+
};
|
|
121
|
+
if (__DEV__) {
|
|
122
|
+
// Dynamically import dev messages only in a non-production environment
|
|
123
|
+
import('@apollo/client/dev')
|
|
124
|
+
.then(({ loadErrorMessages, loadDevMessages }) => {
|
|
125
|
+
loadDevMessages();
|
|
126
|
+
loadErrorMessages();
|
|
127
|
+
})
|
|
128
|
+
.catch((error) => {
|
|
129
|
+
console.error('Failed to load Apollo client dev messages', error);
|
|
130
|
+
});
|
|
131
|
+
}export{createApolloClient};
|
|
@@ -20,5 +20,5 @@ interface IReduxStore<S = any> {
|
|
|
20
20
|
* Add any reducers required for this app dirctly in to
|
|
21
21
|
* `combineReducers`
|
|
22
22
|
*/
|
|
23
|
-
export declare const createReduxStore: ({ scope, isDebug, isDev, reducers, rootEpic, enhancers, epicMiddleware, preMiddleware, postMiddleware, middleware, initialState, persistConfig, reduxConfig, }: IReduxStore<any>) => import("
|
|
23
|
+
export declare const createReduxStore: ({ scope, isDebug, isDev, reducers, rootEpic, enhancers, epicMiddleware, preMiddleware, postMiddleware, middleware, initialState, persistConfig, reduxConfig, }: IReduxStore<any>) => import("redux").Store<any, import("redux").UnknownAction, unknown>;
|
|
24
24
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { BehaviorSubject } from 'rxjs';
|
|
2
|
-
export declare const epic$: BehaviorSubject<any
|
|
3
|
-
export declare const rootEpic: (action$: any,
|
|
2
|
+
export declare const epic$: BehaviorSubject<import("redux-observable").Epic<unknown, unknown, void, any>>;
|
|
3
|
+
export declare const rootEpic: (action$: any, state$: any, dependencies: any) => import("rxjs").Observable<unknown>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {combineEpics,ofType}from'redux-observable';import {BehaviorSubject
|
|
1
|
+
import {combineEpics,ofType}from'redux-observable';import {BehaviorSubject,mergeMap,takeUntil}from'rxjs';import features from'../modules.js';const epic$ = new BehaviorSubject(combineEpics(...features.epics));
|
|
2
2
|
// Since we're using mergeMap, by default any new
|
|
3
3
|
// epic that comes in will be merged into the previous
|
|
4
4
|
// one, unless an EPIC_END action is dispatched first,
|
|
5
5
|
// which would cause the old one(s) to be unsubscribed
|
|
6
|
-
const rootEpic = (action$,
|
|
6
|
+
const rootEpic = (action$, state$, dependencies) => epic$.pipe(mergeMap((epic) => epic(action$, state$, dependencies).pipe(takeUntil(action$.pipe(ofType('EPIC_END'))))));export{epic$,rootEpic};
|
|
@@ -1,12 +1,21 @@
|
|
|
1
|
-
import*as React from'react';import {
|
|
1
|
+
import*as React from'react';import {useRouteError,isRouteErrorResponse}from'@remix-run/react';function ErrorBoundary() {
|
|
2
2
|
const error = useRouteError();
|
|
3
3
|
if (isRouteErrorResponse(error)) {
|
|
4
|
-
return React.createElement(
|
|
4
|
+
return (React.createElement("div", null,
|
|
5
|
+
React.createElement("h1", null,
|
|
6
|
+
error.status,
|
|
7
|
+
" ",
|
|
8
|
+
error.statusText),
|
|
9
|
+
React.createElement("p", null, error.data)));
|
|
5
10
|
}
|
|
6
11
|
else if (error instanceof Error) {
|
|
7
|
-
return React.createElement(
|
|
12
|
+
return (React.createElement("div", null,
|
|
13
|
+
React.createElement("h1", null, "Error"),
|
|
14
|
+
React.createElement("p", null, error.message),
|
|
15
|
+
React.createElement("p", null, "The stack trace is:"),
|
|
16
|
+
React.createElement("pre", null, error.stack)));
|
|
8
17
|
}
|
|
9
18
|
else {
|
|
10
|
-
return React.createElement(
|
|
19
|
+
return React.createElement("h1", null, "Unknown Error");
|
|
11
20
|
}
|
|
12
21
|
}export{ErrorBoundary};
|
|
@@ -1,15 +1,24 @@
|
|
|
1
|
-
import*as React from'react';import {useRouteError,isRouteErrorResponse}from'@remix-run/react';
|
|
1
|
+
import*as React from'react';import {useRouteError,isRouteErrorResponse}from'@remix-run/react';function ErrorBoundary() {
|
|
2
2
|
const error = useRouteError();
|
|
3
3
|
React.useEffect(() => {
|
|
4
4
|
console.trace(error);
|
|
5
5
|
}, [error]);
|
|
6
6
|
if (isRouteErrorResponse(error)) {
|
|
7
|
-
return React.createElement(
|
|
7
|
+
return (React.createElement("div", null,
|
|
8
|
+
React.createElement("h1", null,
|
|
9
|
+
error.status,
|
|
10
|
+
" ",
|
|
11
|
+
error.statusText),
|
|
12
|
+
React.createElement("p", null, error.data)));
|
|
8
13
|
}
|
|
9
14
|
else if (error instanceof Error) {
|
|
10
|
-
return React.createElement(
|
|
15
|
+
return (React.createElement("div", null,
|
|
16
|
+
React.createElement("h1", null, "Error"),
|
|
17
|
+
React.createElement("p", null, error.message),
|
|
18
|
+
React.createElement("p", null, "The stack trace is:"),
|
|
19
|
+
React.createElement("pre", null, error.stack)));
|
|
11
20
|
}
|
|
12
21
|
else {
|
|
13
|
-
return React.createElement(
|
|
22
|
+
return React.createElement("h1", null, "Unknown Error");
|
|
14
23
|
}
|
|
15
24
|
}export{ErrorBoundary};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@common-stack/frontend-stack-react",
|
|
3
|
-
"version": "6.0.6-alpha.
|
|
3
|
+
"version": "6.0.6-alpha.106",
|
|
4
4
|
"description": "Client Module for react app",
|
|
5
5
|
"homepage": "https://github.com/cdmbase/fullstack-pro#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -32,18 +32,19 @@
|
|
|
32
32
|
"@apollo/client": "^3.9.0",
|
|
33
33
|
"@cdm-logger/client": "^9.0.3",
|
|
34
34
|
"@cdm-logger/server": "^9.0.3",
|
|
35
|
-
"@
|
|
36
|
-
"@common-stack/client-core": "
|
|
37
|
-
"@common-stack/client-react": "6.0.6-alpha.
|
|
38
|
-
"@common-stack/components-pro": "
|
|
39
|
-
"@common-stack/core": "
|
|
40
|
-
"@common-stack/remix-router-redux": "
|
|
41
|
-
"@common-stack/server-core": "6.0.6-alpha.
|
|
35
|
+
"@common-stack/cache-api-server": "6.0.6-alpha.106",
|
|
36
|
+
"@common-stack/client-core": "6.0.6-alpha.106",
|
|
37
|
+
"@common-stack/client-react": "6.0.6-alpha.106",
|
|
38
|
+
"@common-stack/components-pro": "6.0.6-alpha.91",
|
|
39
|
+
"@common-stack/core": "6.0.6-alpha.106",
|
|
40
|
+
"@common-stack/remix-router-redux": "6.0.6-alpha.91",
|
|
41
|
+
"@common-stack/server-core": "6.0.6-alpha.106",
|
|
42
42
|
"@reduxjs/toolkit": "^2.2.6",
|
|
43
|
-
"@remix-run/express": "
|
|
44
|
-
"@remix-run/node": "
|
|
45
|
-
"@remix-run/react": "
|
|
43
|
+
"@remix-run/express": "~2.10.1",
|
|
44
|
+
"@remix-run/node": "~2.10.1",
|
|
45
|
+
"@remix-run/react": "~2.10.1",
|
|
46
46
|
"@sentry/browser": "~5.11.2",
|
|
47
|
+
"@xstate/react": "^5.0.0",
|
|
47
48
|
"cors": "^2.8.5",
|
|
48
49
|
"cross-fetch": "^4.0.0",
|
|
49
50
|
"dotenv": "^8.2.0",
|
|
@@ -56,7 +57,7 @@
|
|
|
56
57
|
"i18next-browser-languagedetector": "^8.0.0",
|
|
57
58
|
"i18next-fs-backend": "^2.3.1",
|
|
58
59
|
"i18next-http-backend": "^2.5.2",
|
|
59
|
-
"inversify": "
|
|
60
|
+
"inversify": "~6.0.2",
|
|
60
61
|
"ioredis": "^5.4.1",
|
|
61
62
|
"isbot": "^4.1.0",
|
|
62
63
|
"isomorphic-fetch": "^2.2.1",
|
|
@@ -65,15 +66,17 @@
|
|
|
65
66
|
"react-dom": "18.2.0",
|
|
66
67
|
"react-i18next": "^14.1.0",
|
|
67
68
|
"react-redux": "^9.1.1",
|
|
68
|
-
"redux-observable": "^
|
|
69
|
+
"redux-observable": "^3.0.0-rc.2",
|
|
69
70
|
"redux-persist": "^6.0.0",
|
|
70
71
|
"redux-persist-transform-filter": "^0.0.20",
|
|
71
72
|
"reflect-metadata": "^0.1.13",
|
|
72
73
|
"remix-i18next": "~6.1.0",
|
|
73
74
|
"remix-island": "^0.2.0",
|
|
75
|
+
"rxjs": "^7.8.1",
|
|
74
76
|
"serialize-javascript": "^6.0.0",
|
|
75
77
|
"ts-deepmerge": "^7.0.0",
|
|
76
|
-
"ts-invariant": "^0.10.3"
|
|
78
|
+
"ts-invariant": "^0.10.3",
|
|
79
|
+
"xstate": "^5.19.0"
|
|
77
80
|
},
|
|
78
81
|
"devDependencies": {
|
|
79
82
|
"@admin-layout/ant-ui": "^7.3.7-alpha.4",
|
|
@@ -87,9 +90,9 @@
|
|
|
87
90
|
},
|
|
88
91
|
"peerDependencies": {
|
|
89
92
|
"@apollo/client": ">=3.0.0",
|
|
90
|
-
"@remix-run/react": "^2.9.2",
|
|
91
93
|
"react": ">=18",
|
|
92
|
-
"react-dom": ">=18"
|
|
94
|
+
"react-dom": ">=18",
|
|
95
|
+
"redux": ">=5.0.0"
|
|
93
96
|
},
|
|
94
97
|
"publishConfig": {
|
|
95
98
|
"access": "public"
|
|
@@ -97,5 +100,5 @@
|
|
|
97
100
|
"typescript": {
|
|
98
101
|
"definition": "lib/index.d.ts"
|
|
99
102
|
},
|
|
100
|
-
"gitHead": "
|
|
103
|
+
"gitHead": "f5c81f6a5a14f3d4ce27c54e9c467c2371179692"
|
|
101
104
|
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import*as React from'react';import {Box,VStack,Heading,Text,Code,Button}from'@chakra-ui/react';const Error500 = ({ title, status, data }) => {
|
|
2
|
-
const handleReload = () => {
|
|
3
|
-
window.location.reload();
|
|
4
|
-
};
|
|
5
|
-
return (React.createElement(Box, { display: "flex", alignItems: "center", justifyContent: "center", height: "100vh" },
|
|
6
|
-
React.createElement(VStack, { spacing: 4, textAlign: "center" },
|
|
7
|
-
React.createElement(Heading, { as: "h1", size: "xl" },
|
|
8
|
-
"Error ",
|
|
9
|
-
status),
|
|
10
|
-
React.createElement(Text, null, title),
|
|
11
|
-
data && (React.createElement(Box, { maxW: "md", mx: "auto", overflow: "auto" },
|
|
12
|
-
React.createElement(Code, { p: 4, display: "block", whiteSpace: "pre", textAlign: "left" }, typeof data === 'string' ? data : JSON.stringify(data, null, 2)))),
|
|
13
|
-
React.createElement(Button, { colorScheme: "teal", onClick: handleReload }, "Reload"))));
|
|
14
|
-
};export{Error500 as default};
|