@gen3/core 0.10.48 → 0.10.50
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/cjs/index.js +21 -38
- package/dist/cjs/index.js.map +1 -1
- package/dist/dts/features/aiSearch/aiSearchSlice.d.ts +1 -1
- package/dist/dts/features/authz/authzMappingSlice.d.ts +1 -1
- package/dist/dts/features/download/downloadStatusApi.d.ts +1 -1
- package/dist/dts/features/fence/credentialsApi.d.ts +1 -1
- package/dist/dts/features/fence/fenceApi.d.ts +1 -1
- package/dist/dts/features/fence/jwtApi.d.ts +1 -1
- package/dist/dts/features/gen3/gen3Api.d.ts +1 -1
- package/dist/dts/features/gen3Apps/Gen3AppRTKQ.d.ts +8 -9
- package/dist/dts/features/graphQL/graphQLSlice.d.ts +2 -2
- package/dist/dts/features/guppy/guppyApi.d.ts +1 -1
- package/dist/dts/features/guppy/guppyDownloadSlice.d.ts +1 -1
- package/dist/dts/features/metadata/metadataSlice.d.ts +1 -1
- package/dist/dts/features/submission/submissionApi.d.ts +1 -1
- package/dist/dts/features/user/externalLoginsSlice.d.ts +1 -1
- package/dist/dts/features/workspace/workspacesSlice.d.ts +1 -1
- package/dist/dts/hooks.d.ts +23 -10
- package/dist/esm/index.js +24 -39
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.ts +42 -22
- package/package.json +3 -2
- package/dist/dts/api.d.ts +0 -8
package/dist/cjs/index.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
var toolkit = require('@reduxjs/toolkit');
|
|
4
4
|
var react = require('@reduxjs/toolkit/query/react');
|
|
5
|
-
var React = require('react');
|
|
6
|
-
var reactRedux = require('react-redux');
|
|
7
5
|
var cookiesNext = require('cookies-next');
|
|
8
6
|
var query = require('@reduxjs/toolkit/query');
|
|
7
|
+
var React = require('react');
|
|
8
|
+
var reactRedux = require('react-redux');
|
|
9
9
|
var lodash = require('lodash');
|
|
10
10
|
var Queue = require('queue');
|
|
11
11
|
var jsonpathPlus = require('jsonpath-plus');
|
|
@@ -62,32 +62,6 @@ const FILE_DELIMITERS = {
|
|
|
62
62
|
csv: ','
|
|
63
63
|
};
|
|
64
64
|
|
|
65
|
-
// From here down is react-related code. If we wanted to create a UI-agnotic core,
|
|
66
|
-
// we could need to move the following code and the provider into a new workspace,
|
|
67
|
-
// such as core-react.
|
|
68
|
-
/**
|
|
69
|
-
* The initial context is never used in practice. A little casting voodoo to satisfy TS.
|
|
70
|
-
*
|
|
71
|
-
* Note: Should the action type be AnyAction (from redux) or PayloadAction (from redux-toolkit)?
|
|
72
|
-
* If we are creating all of our actions through RTK, then PayloadAction might be the
|
|
73
|
-
* correct opinionated type.
|
|
74
|
-
*/ const CoreContext = React.createContext(undefined);
|
|
75
|
-
const useCoreSelector = reactRedux.createSelectorHook(CoreContext);
|
|
76
|
-
const useCoreDispatch = reactRedux.createDispatchHook(CoreContext);
|
|
77
|
-
const useCoreStore = reactRedux.createStoreHook(CoreContext);
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Creates a custom Redux Toolkit core API
|
|
81
|
-
* See: https://redux-toolkit.js.org/rtk-query/usage/customizing-create-api
|
|
82
|
-
* @returns: created core API.
|
|
83
|
-
*/ const coreCreateApi = react.buildCreateApi(react.coreModule(), react.reactHooksModule({
|
|
84
|
-
hooks: {
|
|
85
|
-
useSelector: useCoreSelector,
|
|
86
|
-
useStore: useCoreStore,
|
|
87
|
-
useDispatch: useCoreDispatch
|
|
88
|
-
}
|
|
89
|
-
}));
|
|
90
|
-
|
|
91
65
|
/**
|
|
92
66
|
* Template for fence error response dict
|
|
93
67
|
* @returns: An error dict response from a RESTFUL API request
|
|
@@ -121,7 +95,7 @@ const useCoreStore = reactRedux.createStoreHook(CoreContext);
|
|
|
121
95
|
});
|
|
122
96
|
};
|
|
123
97
|
|
|
124
|
-
const userAuthApi =
|
|
98
|
+
const userAuthApi = react.createApi({
|
|
125
99
|
reducerPath: 'userAuthApi',
|
|
126
100
|
refetchOnMountOrArgChange: 1800,
|
|
127
101
|
refetchOnReconnect: true,
|
|
@@ -218,7 +192,7 @@ const selectHeadersWithCSRFToken = toolkit.createSelector([
|
|
|
218
192
|
* @param baseQuery: - The template query which the slices will addon to
|
|
219
193
|
* @param endpoints - Base API endpoints that should exist in every slice
|
|
220
194
|
* @returns: The generated base API
|
|
221
|
-
*/ const gen3Api =
|
|
195
|
+
*/ const gen3Api = react.createApi({
|
|
222
196
|
reducerPath: 'gen3Services',
|
|
223
197
|
baseQuery: react.fetchBaseQuery({
|
|
224
198
|
baseUrl: `${GEN3_API}`,
|
|
@@ -358,6 +332,18 @@ const credentialsWithTags = gen3Api.enhanceEndpoints({
|
|
|
358
332
|
});
|
|
359
333
|
const { useGetJWKKeysQuery } = jwtApi;
|
|
360
334
|
|
|
335
|
+
// From here down is react-related code. If we wanted to create a UI-agnotic core,
|
|
336
|
+
// we could need to move the following code and the provider into a new workspace,
|
|
337
|
+
// such as core-react.
|
|
338
|
+
/**
|
|
339
|
+
* The initial context is never used in practice. A little casting voodoo to satisfy TS.
|
|
340
|
+
*
|
|
341
|
+
* Note: Should the action type be AnyAction (from redux) or PayloadAction (from redux-toolkit)?
|
|
342
|
+
* If we are creating all of our actions through RTK, then PayloadAction might be the
|
|
343
|
+
* correct opinionated type.
|
|
344
|
+
*/ const useCoreSelector = reactRedux.useSelector.withTypes();
|
|
345
|
+
const useCoreDispatch = reactRedux.useDispatch.withTypes();
|
|
346
|
+
|
|
361
347
|
const usePrevious = (value)=>{
|
|
362
348
|
const ref = React.useRef();
|
|
363
349
|
React.useEffect(()=>{
|
|
@@ -787,7 +773,7 @@ const cohortReducer = cohortSlice.reducer;
|
|
|
787
773
|
/**
|
|
788
774
|
* Creates a base class core API for guppy API calls.
|
|
789
775
|
* @returns: guppy core API with guppyAPIFetch base query
|
|
790
|
-
*/ const guppyApi =
|
|
776
|
+
*/ const guppyApi = react.createApi({
|
|
791
777
|
reducerPath: 'guppy',
|
|
792
778
|
// TODO: refactor to use fetchBaseQuery
|
|
793
779
|
baseQuery: async (query, api)=>{
|
|
@@ -852,8 +838,7 @@ query.setupListeners(coreStore.dispatch);
|
|
|
852
838
|
|
|
853
839
|
const CoreProvider = ({ children })=>{
|
|
854
840
|
return /*#__PURE__*/ React.createElement(reactRedux.Provider, {
|
|
855
|
-
store: coreStore
|
|
856
|
-
context: CoreContext
|
|
841
|
+
store: coreStore
|
|
857
842
|
}, children);
|
|
858
843
|
};
|
|
859
844
|
|
|
@@ -1095,7 +1080,7 @@ const createAppStore = (options)=>{
|
|
|
1095
1080
|
}
|
|
1096
1081
|
})
|
|
1097
1082
|
});
|
|
1098
|
-
const context = /*#__PURE__*/ React.createContext(
|
|
1083
|
+
const context = /*#__PURE__*/ React.createContext(null);
|
|
1099
1084
|
const useAppSelector = reactRedux.createSelectorHook(context);
|
|
1100
1085
|
const useAppDispatch = reactRedux.createDispatchHook(context);
|
|
1101
1086
|
const useAppStore = reactRedux.createStoreHook(context);
|
|
@@ -1138,8 +1123,8 @@ const createGen3AppWithOwnStore = (options)=>{
|
|
|
1138
1123
|
};
|
|
1139
1124
|
|
|
1140
1125
|
const createAppApiForRTKQ = (reducerPath, baseQuery)=>{
|
|
1141
|
-
const appContext = React__namespace.createContext(
|
|
1142
|
-
const useAppSelector = reactRedux.
|
|
1126
|
+
const appContext = React__namespace.createContext(null);
|
|
1127
|
+
const useAppSelector = reactRedux.useSelector.withTypes();
|
|
1143
1128
|
const useAppDispatch = reactRedux.createDispatchHook(appContext);
|
|
1144
1129
|
const useAppStore = reactRedux.createStoreHook(appContext);
|
|
1145
1130
|
const appCreateApi = react.buildCreateApi(react.coreModule(), react.reactHooksModule({
|
|
@@ -2230,7 +2215,6 @@ const SubmissionGraphqlQuery = `query transactionList {
|
|
|
2230
2215
|
});
|
|
2231
2216
|
const { useGetProjectsQuery, useGetSubmissionGraphQLQuery, useGetProjectsDetailsQuery, useLazyGetProjectsQuery, useLazyGetSubmissionGraphQLQuery, useGetSubmissionsQuery, useGetDictionaryQuery } = submissionApi;
|
|
2232
2217
|
|
|
2233
|
-
exports.CoreContext = CoreContext;
|
|
2234
2218
|
exports.CoreProvider = CoreProvider;
|
|
2235
2219
|
exports.GEN3_API = GEN3_API;
|
|
2236
2220
|
exports.GEN3_AUTHZ_API = GEN3_AUTHZ_API;
|
|
@@ -2333,7 +2317,6 @@ exports.useAskQuestionMutation = useAskQuestionMutation;
|
|
|
2333
2317
|
exports.useAuthorizeFromCredentialsMutation = useAuthorizeFromCredentialsMutation;
|
|
2334
2318
|
exports.useCoreDispatch = useCoreDispatch;
|
|
2335
2319
|
exports.useCoreSelector = useCoreSelector;
|
|
2336
|
-
exports.useCoreStore = useCoreStore;
|
|
2337
2320
|
exports.useDownloadFromGuppyMutation = useDownloadFromGuppyMutation;
|
|
2338
2321
|
exports.useFetchUserDetailsQuery = useFetchUserDetailsQuery;
|
|
2339
2322
|
exports.useGeneralGQLQuery = useGeneralGQLQuery;
|