@trackunit/react-core-contexts 0.4.665 → 0.4.667
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/index.cjs.js +8 -5
- package/index.esm.js +9 -6
- package/package.json +3 -3
package/index.cjs.js
CHANGED
|
@@ -37,19 +37,19 @@ const createApolloClient = ({ graphqlManagerUrl, graphqlPublicUrl, graphqlManage
|
|
|
37
37
|
if (!token) {
|
|
38
38
|
token = firstToken;
|
|
39
39
|
}
|
|
40
|
-
const managerGraphQLLink =
|
|
40
|
+
const managerGraphQLLink = client.createHttpLink({
|
|
41
41
|
uri: request => graphqlManagerUrl + "/" + request.operationName,
|
|
42
42
|
});
|
|
43
|
-
const publicGraphQLLink =
|
|
43
|
+
const publicGraphQLLink = client.createHttpLink({
|
|
44
44
|
uri: request => graphqlPublicUrl + "/" + request.operationName,
|
|
45
45
|
});
|
|
46
46
|
const imageUploadGraphQLLink = apolloUploadClient.createUploadLink({
|
|
47
47
|
uri: request => graphqlManagerImageUploadUrl + "/" + request.operationName,
|
|
48
48
|
});
|
|
49
|
-
const internalGraphQLLink =
|
|
49
|
+
const internalGraphQLLink = client.createHttpLink({
|
|
50
50
|
uri: request => graphqlInternalUrl + "/" + request.operationName,
|
|
51
51
|
});
|
|
52
|
-
const reportGraphQLLink =
|
|
52
|
+
const reportGraphQLLink = client.createHttpLink({
|
|
53
53
|
uri: request => graphqlReportUrl + "/" + request.operationName,
|
|
54
54
|
});
|
|
55
55
|
const authLink = context.setContext(async (_, { headers }) => {
|
|
@@ -112,7 +112,10 @@ const createApolloClient = ({ graphqlManagerUrl, graphqlPublicUrl, graphqlManage
|
|
|
112
112
|
},
|
|
113
113
|
});
|
|
114
114
|
const invalidToken = errorResponse.graphQLErrors.some(x => {
|
|
115
|
-
return (
|
|
115
|
+
return (
|
|
116
|
+
// saw it not unnecessary
|
|
117
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
118
|
+
(x.extensions && x.extensions.code === "UNAUTHENTICATED") ||
|
|
116
119
|
x.message.includes("Invalid token specified") ||
|
|
117
120
|
x.message.includes("Access denied! You need to be authorized to perform this action!"));
|
|
118
121
|
});
|
package/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import { ApolloProvider, ApolloClient, InMemoryCache, from, split } from '@apollo/client';
|
|
2
|
+
import { ApolloProvider, createHttpLink, ApolloClient, InMemoryCache, from, split } from '@apollo/client';
|
|
3
3
|
import { setContext } from '@apollo/client/link/context';
|
|
4
4
|
import { onError } from '@apollo/client/link/error';
|
|
5
5
|
import { removeTypenameFromVariables } from '@apollo/client/link/remove-typename';
|
|
@@ -17,19 +17,19 @@ const createApolloClient = ({ graphqlManagerUrl, graphqlPublicUrl, graphqlManage
|
|
|
17
17
|
if (!token) {
|
|
18
18
|
token = firstToken;
|
|
19
19
|
}
|
|
20
|
-
const managerGraphQLLink =
|
|
20
|
+
const managerGraphQLLink = createHttpLink({
|
|
21
21
|
uri: request => graphqlManagerUrl + "/" + request.operationName,
|
|
22
22
|
});
|
|
23
|
-
const publicGraphQLLink =
|
|
23
|
+
const publicGraphQLLink = createHttpLink({
|
|
24
24
|
uri: request => graphqlPublicUrl + "/" + request.operationName,
|
|
25
25
|
});
|
|
26
26
|
const imageUploadGraphQLLink = createUploadLink({
|
|
27
27
|
uri: request => graphqlManagerImageUploadUrl + "/" + request.operationName,
|
|
28
28
|
});
|
|
29
|
-
const internalGraphQLLink =
|
|
29
|
+
const internalGraphQLLink = createHttpLink({
|
|
30
30
|
uri: request => graphqlInternalUrl + "/" + request.operationName,
|
|
31
31
|
});
|
|
32
|
-
const reportGraphQLLink =
|
|
32
|
+
const reportGraphQLLink = createHttpLink({
|
|
33
33
|
uri: request => graphqlReportUrl + "/" + request.operationName,
|
|
34
34
|
});
|
|
35
35
|
const authLink = setContext(async (_, { headers }) => {
|
|
@@ -92,7 +92,10 @@ const createApolloClient = ({ graphqlManagerUrl, graphqlPublicUrl, graphqlManage
|
|
|
92
92
|
},
|
|
93
93
|
});
|
|
94
94
|
const invalidToken = errorResponse.graphQLErrors.some(x => {
|
|
95
|
-
return (
|
|
95
|
+
return (
|
|
96
|
+
// saw it not unnecessary
|
|
97
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
98
|
+
(x.extensions && x.extensions.code === "UNAUTHENTICATED") ||
|
|
96
99
|
x.message.includes("Invalid token specified") ||
|
|
97
100
|
x.message.includes("Access denied! You need to be authorized to perform this action!"));
|
|
98
101
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-core-contexts",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.667",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -10,14 +10,14 @@
|
|
|
10
10
|
"@apollo/client": "3.10.4",
|
|
11
11
|
"@trackunit/react-core-contexts-api": "*",
|
|
12
12
|
"@trackunit/react-core-hooks": "*",
|
|
13
|
-
"apollo-upload-client": "^17.0.0",
|
|
14
13
|
"react": "18.3.1",
|
|
15
14
|
"@js-temporal/polyfill": "^0.4.4",
|
|
16
15
|
"@trackunit/iris-app-runtime-core": "*",
|
|
17
16
|
"jest-fetch-mock": "^3.0.3",
|
|
18
17
|
"@trackunit/i18n-library-translation": "*",
|
|
19
18
|
"@trackunit/react-components": "*",
|
|
20
|
-
"@trackunit/iris-app-api": "*"
|
|
19
|
+
"@trackunit/iris-app-api": "*",
|
|
20
|
+
"apollo-upload-client": "^17.0.0"
|
|
21
21
|
},
|
|
22
22
|
"module": "./index.esm.js",
|
|
23
23
|
"main": "./index.cjs.js",
|