studiokit-scaffolding-js 5.2.0 → 6.0.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/lib/components/Dropdowns/GroupsDropdown.d.ts +1 -1
- package/lib/components/Dropdowns/GroupsDropdown.js +1 -2
- package/lib/components/Dropdowns/UserDropdown.js +1 -1
- package/lib/components/Groups/ExternalGroups/Attach.js +3 -3
- package/lib/components/HOC/CollectionComponent.d.ts +2 -2
- package/lib/components/HOC/CollectionComponent.js +1 -2
- package/lib/components/HOC/CollectionFirstItemComponent.js +1 -1
- package/lib/components/HOC/CollectionItemComponent.d.ts +1 -1
- package/lib/components/HOC/CollectionItemComponent.js +1 -2
- package/lib/components/HOC/ConnectedModalComponent.js +7 -2
- package/lib/components/HOC/ModelErrorRedirectComponent.js +3 -2
- package/lib/components/HOC/SearchPersistorComponent.js +1 -1
- package/lib/components/Lti/CreateNonLtiGroupAlertDialog.d.ts +1 -1
- package/lib/components/Notifications.js +2 -1
- package/lib/components/UserRoles/index.d.ts +3 -3
- package/lib/components/UserRoles/index.js +15 -8
- package/lib/constants/fetchErrorData.d.ts +3 -0
- package/lib/constants/fetchErrorData.js +14 -0
- package/lib/constants/mockData.d.ts +9 -1
- package/lib/constants/mockData.js +41 -1
- package/lib/endpointMappings.d.ts +0 -1
- package/lib/endpointMappings.js +6 -8
- package/lib/hooks/useCollection.js +1 -4
- package/lib/hooks/useCollectionConfiguration.d.ts +4 -5
- package/lib/hooks/useCollectionItem.js +1 -4
- package/lib/index.d.ts +1 -0
- package/lib/index.js +8 -1
- package/lib/redux/actionCreator.d.ts +8 -2
- package/lib/redux/actionCreator.js +45 -7
- package/lib/redux/actions/AuthAction.d.ts +53 -0
- package/lib/redux/actions/AuthAction.js +32 -0
- package/lib/redux/actions/ModalAction.d.ts +16 -0
- package/lib/redux/actions/ModalAction.js +8 -0
- package/lib/redux/actions/ModelAction.d.ts +117 -0
- package/lib/redux/actions/ModelAction.js +62 -0
- package/lib/redux/actions/NotificationAction.d.ts +9 -0
- package/lib/redux/actions/NotificationAction.js +8 -0
- package/lib/redux/actions/SearchAction.d.ts +8 -0
- package/lib/redux/actions/SearchAction.js +7 -0
- package/lib/redux/actions/index.d.ts +5 -0
- package/lib/redux/actions/index.js +17 -0
- package/lib/redux/configureReducers.d.ts +3 -2
- package/lib/redux/configureReducers.js +3 -3
- package/lib/redux/configureStore.js +13 -10
- package/lib/redux/helpers.js +1 -3
- package/lib/redux/reducers/authReducer.d.ts +6 -2
- package/lib/redux/reducers/authReducer.js +10 -7
- package/lib/redux/reducers/index.d.ts +2 -2
- package/lib/redux/reducers/index.js +3 -3
- package/lib/redux/reducers/modalsReducer.d.ts +1 -4
- package/lib/redux/reducers/modalsReducer.js +3 -3
- package/lib/redux/reducers/{fetchReducer.d.ts → modelsReducer.d.ts} +11 -5
- package/lib/redux/reducers/{fetchReducer.js → modelsReducer.js} +19 -17
- package/lib/redux/reducers/notificationsReducer.d.ts +2 -5
- package/lib/redux/reducers/notificationsReducer.js +6 -9
- package/lib/redux/reducers/searchReducer.d.ts +1 -4
- package/lib/redux/reducers/searchReducer.js +2 -2
- package/lib/redux/sagas/appInsightsSaga.js +3 -3
- package/lib/redux/sagas/authSaga.d.ts +13 -15
- package/lib/redux/sagas/authSaga.js +111 -115
- package/lib/redux/sagas/caliperSaga.js +9 -8
- package/lib/redux/sagas/clockOffsetSaga.js +1 -1
- package/lib/redux/sagas/configurationSaga.js +1 -1
- package/lib/redux/sagas/downtimeApiErrorSaga.js +5 -5
- package/lib/redux/sagas/googleAnalyticsSaga.js +4 -3
- package/lib/redux/sagas/identityProviderSaga.js +15 -13
- package/lib/redux/sagas/initialDataLoadSaga.js +5 -6
- package/lib/redux/sagas/lockDownBrowserErrorSaga.js +4 -2
- package/lib/redux/sagas/modelFetchSaga.d.ts +65 -0
- package/lib/redux/sagas/modelFetchSaga.js +493 -0
- package/lib/redux/sagas/noStoreSaga.d.ts +12 -11
- package/lib/redux/sagas/noStoreSaga.js +29 -33
- package/lib/redux/sagas/postLoginDataSaga.js +12 -11
- package/lib/redux/sagas/postLoginRedirectSaga.js +2 -2
- package/lib/redux/sagas/rootSaga.js +10 -16
- package/lib/redux/sagas/sentrySaga.js +19 -32
- package/lib/redux/sagas/userIdSaga.js +3 -3
- package/lib/services/fetchService.d.ts +21 -17
- package/lib/services/fetchService.js +80 -64
- package/lib/services/windowService.d.ts +2 -0
- package/lib/services/windowService.js +6 -1
- package/lib/setupTests.js +16 -0
- package/lib/startup.js +6 -3
- package/lib/types/Artifact.d.ts +1 -0
- package/lib/types/Collection.d.ts +21 -21
- package/lib/types/auth/CasV1LoginRequestBody.d.ts +4 -0
- package/lib/types/auth/LocalLoginRequestBody.d.ts +5 -0
- package/lib/types/auth/TokenPersistenceService.d.ts +3 -3
- package/lib/types/auth/index.d.ts +2 -2
- package/lib/types/auth/index.js +2 -2
- package/lib/types/net/ErrorHandler.d.ts +3 -1
- package/lib/types/net/FetchConfig.d.ts +1 -2
- package/lib/types/net/FetchErrorData.d.ts +15 -0
- package/lib/types/net/FetchErrorData.js +8 -0
- package/lib/types/net/HTTPStatusCode.d.ts +11 -0
- package/lib/types/net/HTTPStatusCode.js +15 -0
- package/lib/types/net/Metadata.d.ts +2 -1
- package/lib/types/net/Metadata.js +0 -3
- package/lib/types/net/OAuthToken.js +0 -3
- package/lib/types/net/OAuthTokenOrNull.d.ts +2 -0
- package/lib/types/net/TokenAccessFunction.d.ts +2 -2
- package/lib/types/net/index.d.ts +3 -4
- package/lib/types/net/index.js +3 -4
- package/lib/utils/collection.d.ts +3 -4
- package/lib/utils/collection.js +17 -15
- package/lib/utils/error.d.ts +1 -0
- package/lib/utils/error.js +20 -0
- package/lib/utils/fetch.d.ts +28 -0
- package/lib/utils/fetch.js +195 -0
- package/lib/utils/model.d.ts +2 -2
- package/lib/utils/quill.js +47 -34
- package/lib/utils/user.js +11 -11
- package/package.json +3 -3
- package/lib/redux/actions.d.ts +0 -39
- package/lib/redux/actions.js +0 -65
- package/lib/redux/sagas/fetchSaga.d.ts +0 -97
- package/lib/redux/sagas/fetchSaga.js +0 -661
- package/lib/types/auth/AuthAction.d.ts +0 -6
- package/lib/types/auth/Credentials.d.ts +0 -4
- package/lib/types/net/FetchAction.d.ts +0 -41
- package/lib/types/net/FetchError.d.ts +0 -7
- package/lib/types/net/FetchError.js +0 -5
- package/lib/types/net/LoggerFunction.d.ts +0 -1
- package/lib/types/net/LoggerFunction.js +0 -2
- package/lib/types/net/OAuthTokenResponse.d.ts +0 -2
- package/lib/types/net/OAuthTokenResponse.js +0 -2
- /package/lib/types/auth/{AuthAction.js → CasV1LoginRequestBody.js} +0 -0
- /package/lib/types/auth/{Credentials.js → LocalLoginRequestBody.js} +0 -0
- /package/lib/types/net/{FetchAction.js → OAuthTokenOrNull.js} +0 -0
|
@@ -1,17 +1,55 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
var
|
|
14
|
+
exports.addNotification = exports.dispatchModelRemoveKeyAction = exports.dispatchPeriodicModelFetchTerminateAction = exports.dispatchPeriodicModelFetchRequest = exports.dispatchModelFetchRequest = exports.dispatchAction = exports.setStore = void 0;
|
|
15
|
+
var uuid_1 = require("uuid");
|
|
16
|
+
var actions_1 = require("./actions");
|
|
17
|
+
var NotificationAction_1 = require("./actions/NotificationAction");
|
|
5
18
|
var store;
|
|
6
19
|
var setStore = function (storeParam) {
|
|
7
20
|
store = storeParam;
|
|
8
21
|
};
|
|
9
22
|
exports.setStore = setStore;
|
|
10
|
-
var dispatchAction = function (
|
|
11
|
-
store.dispatch(
|
|
23
|
+
var dispatchAction = function (action) {
|
|
24
|
+
store.dispatch(action);
|
|
12
25
|
};
|
|
13
26
|
exports.dispatchAction = dispatchAction;
|
|
14
|
-
var
|
|
15
|
-
|
|
27
|
+
var dispatchModelFetchRequest = function (action) {
|
|
28
|
+
exports.dispatchAction(__assign({ type: actions_1.MODEL_FETCH_REQUEST_ACTION_TYPE.FETCH_REQUEST }, action));
|
|
29
|
+
};
|
|
30
|
+
exports.dispatchModelFetchRequest = dispatchModelFetchRequest;
|
|
31
|
+
var dispatchPeriodicModelFetchRequest = function (action) {
|
|
32
|
+
exports.dispatchAction(__assign({ type: actions_1.MODEL_FETCH_REQUEST_ACTION_TYPE.PERIODIC_FETCH_REQUEST }, action));
|
|
33
|
+
};
|
|
34
|
+
exports.dispatchPeriodicModelFetchRequest = dispatchPeriodicModelFetchRequest;
|
|
35
|
+
var dispatchPeriodicModelFetchTerminateAction = function (action) {
|
|
36
|
+
exports.dispatchAction(__assign({ type: actions_1.PERIODIC_MODEL_FETCH_TERMINATION_ACTION_TYPE.TERMINATE }, action));
|
|
37
|
+
};
|
|
38
|
+
exports.dispatchPeriodicModelFetchTerminateAction = dispatchPeriodicModelFetchTerminateAction;
|
|
39
|
+
var dispatchModelRemoveKeyAction = function (action) {
|
|
40
|
+
exports.dispatchAction(__assign({ type: actions_1.MODEL_REMOVE_KEY_ACTION_TYPE }, action));
|
|
41
|
+
};
|
|
42
|
+
exports.dispatchModelRemoveKeyAction = dispatchModelRemoveKeyAction;
|
|
43
|
+
var addNotification = function (_a) {
|
|
44
|
+
var text = _a.text, type = _a.type, modalId = _a.modalId;
|
|
45
|
+
exports.dispatchAction({
|
|
46
|
+
type: NotificationAction_1.NOTIFICATION_ACTION_TYPE.ADD_NOTIFICATION,
|
|
47
|
+
notification: {
|
|
48
|
+
id: uuid_1.v4(),
|
|
49
|
+
text: text,
|
|
50
|
+
type: type,
|
|
51
|
+
modalId: modalId
|
|
52
|
+
}
|
|
53
|
+
});
|
|
16
54
|
};
|
|
17
|
-
exports.
|
|
55
|
+
exports.addNotification = addNotification;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Action } from 'redux';
|
|
2
|
+
import { CasV1LoginRequestBody, IdentityProvider } from '../../types';
|
|
3
|
+
import { LocalLoginRequestBody } from '../../types/auth/LocalLoginRequestBody';
|
|
4
|
+
import { OAuthToken, OAuthTokenOrNull } from '../../types/net';
|
|
5
|
+
export declare enum AUTH_ACTION_TYPE {
|
|
6
|
+
CAS_LOGIN_REQUESTED = "auth/CAS_LOGIN_REQUESTED",
|
|
7
|
+
LOGIN_REQUESTED = "auth/LOGIN_REQUESTED",
|
|
8
|
+
LOG_OUT_REQUESTED = "auth/LOG_OUT_REQUESTED",
|
|
9
|
+
TOKEN_REFRESH_FAILED = "auth/TOKEN_REFRESH_FAILED",
|
|
10
|
+
LOGIN_FAILED = "auth/LOGIN_FAILED"
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Action with no additional properties.
|
|
14
|
+
*/
|
|
15
|
+
export interface AuthAction extends Action<AUTH_ACTION_TYPE> {
|
|
16
|
+
}
|
|
17
|
+
export declare enum AUTH_TOKEN_ACTION_TYPE {
|
|
18
|
+
AUTH_INITIALIZED = "auth/INITIALIZED"
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Action with a nullable `oauthToken`.
|
|
22
|
+
*/
|
|
23
|
+
export interface AuthTokenAction extends Action<AUTH_TOKEN_ACTION_TYPE> {
|
|
24
|
+
oauthToken: OAuthTokenOrNull;
|
|
25
|
+
}
|
|
26
|
+
export declare enum AUTH_TOKEN_SUCCESS_ACTION_TYPE {
|
|
27
|
+
GET_TOKEN_SUCCEEDED = "auth/GET_TOKEN_SUCCEEDED",
|
|
28
|
+
TOKEN_REFRESH_SUCCEEDED = "auth/TOKEN_REFRESH_SUCCEEDED"
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Action with an `oauthToken`.
|
|
32
|
+
*/
|
|
33
|
+
export interface AuthTokenSuccessAction extends Action<AUTH_TOKEN_SUCCESS_ACTION_TYPE> {
|
|
34
|
+
oauthToken: OAuthToken;
|
|
35
|
+
}
|
|
36
|
+
export declare enum AUTH_IDENTITY_PROVIDER_REQUEST_ACTION_TYPE {
|
|
37
|
+
IDENTITY_PROVIDER_LOGIN_REQUEST = "auth/IDENTITY_PROVIDER_LOGIN_REQUEST"
|
|
38
|
+
}
|
|
39
|
+
export interface AuthIdentityProviderRequestAction extends Action<AUTH_IDENTITY_PROVIDER_REQUEST_ACTION_TYPE> {
|
|
40
|
+
identityProvider: IdentityProvider;
|
|
41
|
+
}
|
|
42
|
+
export declare enum AUTH_CAS_V1_LOGIN_REQUEST_ACTION_TYPE {
|
|
43
|
+
CAS_V1_LOGIN_REQUEST = "auth/CAS_V1_LOGIN_REQUEST"
|
|
44
|
+
}
|
|
45
|
+
export interface AuthCasV1LoginRequestAction extends Action<AUTH_CAS_V1_LOGIN_REQUEST_ACTION_TYPE> {
|
|
46
|
+
body: CasV1LoginRequestBody;
|
|
47
|
+
}
|
|
48
|
+
export declare enum AUTH_LOCAL_LOGIN_REQUEST_ACTION_TYPE {
|
|
49
|
+
LOCAL_LOGIN_REQUEST = "auth/LOCAL_LOGIN_REQUEST"
|
|
50
|
+
}
|
|
51
|
+
export interface AuthLocalLoginRequestAction extends Action<AUTH_LOCAL_LOGIN_REQUEST_ACTION_TYPE> {
|
|
52
|
+
body: LocalLoginRequestBody;
|
|
53
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AUTH_LOCAL_LOGIN_REQUEST_ACTION_TYPE = exports.AUTH_CAS_V1_LOGIN_REQUEST_ACTION_TYPE = exports.AUTH_IDENTITY_PROVIDER_REQUEST_ACTION_TYPE = exports.AUTH_TOKEN_SUCCESS_ACTION_TYPE = exports.AUTH_TOKEN_ACTION_TYPE = exports.AUTH_ACTION_TYPE = void 0;
|
|
4
|
+
var AUTH_ACTION_TYPE;
|
|
5
|
+
(function (AUTH_ACTION_TYPE) {
|
|
6
|
+
AUTH_ACTION_TYPE["CAS_LOGIN_REQUESTED"] = "auth/CAS_LOGIN_REQUESTED";
|
|
7
|
+
AUTH_ACTION_TYPE["LOGIN_REQUESTED"] = "auth/LOGIN_REQUESTED";
|
|
8
|
+
AUTH_ACTION_TYPE["LOG_OUT_REQUESTED"] = "auth/LOG_OUT_REQUESTED";
|
|
9
|
+
AUTH_ACTION_TYPE["TOKEN_REFRESH_FAILED"] = "auth/TOKEN_REFRESH_FAILED";
|
|
10
|
+
AUTH_ACTION_TYPE["LOGIN_FAILED"] = "auth/LOGIN_FAILED";
|
|
11
|
+
})(AUTH_ACTION_TYPE = exports.AUTH_ACTION_TYPE || (exports.AUTH_ACTION_TYPE = {}));
|
|
12
|
+
var AUTH_TOKEN_ACTION_TYPE;
|
|
13
|
+
(function (AUTH_TOKEN_ACTION_TYPE) {
|
|
14
|
+
AUTH_TOKEN_ACTION_TYPE["AUTH_INITIALIZED"] = "auth/INITIALIZED";
|
|
15
|
+
})(AUTH_TOKEN_ACTION_TYPE = exports.AUTH_TOKEN_ACTION_TYPE || (exports.AUTH_TOKEN_ACTION_TYPE = {}));
|
|
16
|
+
var AUTH_TOKEN_SUCCESS_ACTION_TYPE;
|
|
17
|
+
(function (AUTH_TOKEN_SUCCESS_ACTION_TYPE) {
|
|
18
|
+
AUTH_TOKEN_SUCCESS_ACTION_TYPE["GET_TOKEN_SUCCEEDED"] = "auth/GET_TOKEN_SUCCEEDED";
|
|
19
|
+
AUTH_TOKEN_SUCCESS_ACTION_TYPE["TOKEN_REFRESH_SUCCEEDED"] = "auth/TOKEN_REFRESH_SUCCEEDED";
|
|
20
|
+
})(AUTH_TOKEN_SUCCESS_ACTION_TYPE = exports.AUTH_TOKEN_SUCCESS_ACTION_TYPE || (exports.AUTH_TOKEN_SUCCESS_ACTION_TYPE = {}));
|
|
21
|
+
var AUTH_IDENTITY_PROVIDER_REQUEST_ACTION_TYPE;
|
|
22
|
+
(function (AUTH_IDENTITY_PROVIDER_REQUEST_ACTION_TYPE) {
|
|
23
|
+
AUTH_IDENTITY_PROVIDER_REQUEST_ACTION_TYPE["IDENTITY_PROVIDER_LOGIN_REQUEST"] = "auth/IDENTITY_PROVIDER_LOGIN_REQUEST";
|
|
24
|
+
})(AUTH_IDENTITY_PROVIDER_REQUEST_ACTION_TYPE = exports.AUTH_IDENTITY_PROVIDER_REQUEST_ACTION_TYPE || (exports.AUTH_IDENTITY_PROVIDER_REQUEST_ACTION_TYPE = {}));
|
|
25
|
+
var AUTH_CAS_V1_LOGIN_REQUEST_ACTION_TYPE;
|
|
26
|
+
(function (AUTH_CAS_V1_LOGIN_REQUEST_ACTION_TYPE) {
|
|
27
|
+
AUTH_CAS_V1_LOGIN_REQUEST_ACTION_TYPE["CAS_V1_LOGIN_REQUEST"] = "auth/CAS_V1_LOGIN_REQUEST";
|
|
28
|
+
})(AUTH_CAS_V1_LOGIN_REQUEST_ACTION_TYPE = exports.AUTH_CAS_V1_LOGIN_REQUEST_ACTION_TYPE || (exports.AUTH_CAS_V1_LOGIN_REQUEST_ACTION_TYPE = {}));
|
|
29
|
+
var AUTH_LOCAL_LOGIN_REQUEST_ACTION_TYPE;
|
|
30
|
+
(function (AUTH_LOCAL_LOGIN_REQUEST_ACTION_TYPE) {
|
|
31
|
+
AUTH_LOCAL_LOGIN_REQUEST_ACTION_TYPE["LOCAL_LOGIN_REQUEST"] = "auth/LOCAL_LOGIN_REQUEST";
|
|
32
|
+
})(AUTH_LOCAL_LOGIN_REQUEST_ACTION_TYPE = exports.AUTH_LOCAL_LOGIN_REQUEST_ACTION_TYPE || (exports.AUTH_LOCAL_LOGIN_REQUEST_ACTION_TYPE = {}));
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Action } from 'redux';
|
|
2
|
+
export declare enum MODAL_ACTION_TYPE {
|
|
3
|
+
MODAL_ENTERING = "modals/ENTERING",
|
|
4
|
+
MODAL_EXITED = "modals/EXITED"
|
|
5
|
+
}
|
|
6
|
+
export interface ModalActionValue {
|
|
7
|
+
index: number;
|
|
8
|
+
isFullscreen: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface ModalEnterAction extends Action<MODAL_ACTION_TYPE.MODAL_ENTERING>, ModalActionValue {
|
|
11
|
+
guid: string;
|
|
12
|
+
}
|
|
13
|
+
export interface ModalExitAction extends Action<MODAL_ACTION_TYPE.MODAL_EXITED> {
|
|
14
|
+
guid: string;
|
|
15
|
+
}
|
|
16
|
+
export declare type ModalAction = ModalEnterAction | ModalExitAction;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MODAL_ACTION_TYPE = void 0;
|
|
4
|
+
var MODAL_ACTION_TYPE;
|
|
5
|
+
(function (MODAL_ACTION_TYPE) {
|
|
6
|
+
MODAL_ACTION_TYPE["MODAL_ENTERING"] = "modals/ENTERING";
|
|
7
|
+
MODAL_ACTION_TYPE["MODAL_EXITED"] = "modals/EXITED";
|
|
8
|
+
})(MODAL_ACTION_TYPE = exports.MODAL_ACTION_TYPE || (exports.MODAL_ACTION_TYPE = {}));
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { Action, AnyAction } from 'redux';
|
|
2
|
+
import { FetchErrorData } from '../../types/net/FetchErrorData';
|
|
3
|
+
import { HTTPMethod } from '../../types/net/HTTPMethod';
|
|
4
|
+
export declare enum MODEL_FETCH_REQUEST_ACTION_TYPE {
|
|
5
|
+
FETCH_REQUEST = "models/FETCH_REQUEST",
|
|
6
|
+
PERIODIC_FETCH_REQUEST = "models/PERIODIC_FETCH_REQUEST"
|
|
7
|
+
}
|
|
8
|
+
export interface BaseModelFetchRequestAction<T> extends Action<T> {
|
|
9
|
+
/**
|
|
10
|
+
* The generic path (no Ids) to an `EndpointMapping` and to where the model will be stored in redux under `state.models` (levels separated by a '.').
|
|
11
|
+
*/
|
|
12
|
+
modelName: string;
|
|
13
|
+
/**
|
|
14
|
+
* An array of values to be replaced in the fetch path and redux model path using pattern matching, in order, e.g.
|
|
15
|
+
* `"/collection/{}/subcollection/{}" => "/collection/1/subcollection/2"`
|
|
16
|
+
*/
|
|
17
|
+
pathParams?: Array<string | number | undefined | null>;
|
|
18
|
+
/** A unique identifier used for action dispatchers to correlate responses to requests. Will be attached to the corresponding `ModelFetchResultAction.data`. */
|
|
19
|
+
guid?: string;
|
|
20
|
+
/** The HTTP Method to use for the fetch. Defaults to use value from EndpointMapping, or 'GET'. */
|
|
21
|
+
method?: HTTPMethod;
|
|
22
|
+
/** Key/value pairs of headers to be sent with the request. */
|
|
23
|
+
headers?: Record<string, string>;
|
|
24
|
+
/** Key/value pairs to be added to query as query params. */
|
|
25
|
+
queryParams?: Record<string, string | number | boolean>;
|
|
26
|
+
/** A value to send as the HTTP Body. */
|
|
27
|
+
body?: any;
|
|
28
|
+
/** If true, make the request but do not store the response in redux. */
|
|
29
|
+
noStore?: boolean;
|
|
30
|
+
/** Prevent the use of the default logarithmic backoff retry strategy. */
|
|
31
|
+
noRetry?: boolean;
|
|
32
|
+
/** The contentType to be set in the headers. Defaults to `application/json` */
|
|
33
|
+
contentType?: string;
|
|
34
|
+
/** If true, the `modelsReducer` will replace the existing value in redux, instead of merging the incoming with existing. Passed to `ModelFetchResultAction` */
|
|
35
|
+
replaceValue?: boolean;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Action used to trigger a fetch request for a model. Uses `modelName` to find an `EndpointMapping`, and stores results in the corresponding location in redux under `state.models`.
|
|
39
|
+
*/
|
|
40
|
+
export interface ModelFetchRequestAction extends BaseModelFetchRequestAction<MODEL_FETCH_REQUEST_ACTION_TYPE.FETCH_REQUEST> {
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Action used to trigger a recurring fetch request for a model. Uses `modelName` to find an `EndpointMapping`, and stores results in the corresponding location in redux under `state.models`.
|
|
44
|
+
*/
|
|
45
|
+
export interface PeriodicModelFetchRequestAction extends BaseModelFetchRequestAction<MODEL_FETCH_REQUEST_ACTION_TYPE.PERIODIC_FETCH_REQUEST> {
|
|
46
|
+
/** How often in `ms` milliseconds to re-fetch when used in a recurring fetch scenario. */
|
|
47
|
+
period: number;
|
|
48
|
+
/** An id, from your application, used to cancel the recurring fetch task at a later time. */
|
|
49
|
+
taskId: string;
|
|
50
|
+
}
|
|
51
|
+
export declare enum PERIODIC_MODEL_FETCH_TERMINATION_ACTION_TYPE {
|
|
52
|
+
TERMINATE = "models/PERIODIC_MODEL_FETCH_REQUEST_TERMINATE",
|
|
53
|
+
SUCCEEDED = "models/PERIODIC_MODEL_FETCH_REQUEST_TERMINATE_SUCCEEDED"
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Action used to terminate a periodic model fetch request task, or notify of termination success.
|
|
57
|
+
*/
|
|
58
|
+
export interface PeriodicModelFetchTerminationAction extends Action<PERIODIC_MODEL_FETCH_TERMINATION_ACTION_TYPE> {
|
|
59
|
+
/** The id, from your application, used to cancel a recurring task. */
|
|
60
|
+
taskId: string;
|
|
61
|
+
}
|
|
62
|
+
interface BaseModelStoreAction {
|
|
63
|
+
/** The full object path used to store the result in the redux store under 'state.models'. Includes keys and ids. */
|
|
64
|
+
modelPath: string;
|
|
65
|
+
/** The pre-generated GUID, from your application, that was provided to the `ModelFetchRequestAction`. */
|
|
66
|
+
guid?: string;
|
|
67
|
+
}
|
|
68
|
+
export declare const MODEL_REMOVE_KEY_ACTION_TYPE = "models/REMOVE_KEY";
|
|
69
|
+
/**
|
|
70
|
+
* Action used to remove the model at the target redux `modelPath` key.
|
|
71
|
+
*/
|
|
72
|
+
export interface ModelRemoveKeyAction extends Action<typeof MODEL_REMOVE_KEY_ACTION_TYPE>, Omit<BaseModelStoreAction, 'guid'> {
|
|
73
|
+
}
|
|
74
|
+
export declare enum MODEL_FETCH_START_ACTION_TYPE {
|
|
75
|
+
FETCH_START = "models/FETCH_START",
|
|
76
|
+
TRANSIENT_FETCH_START = "models/TRANSIENT_FETCH_START"
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Action used to update the target redux `modelPath` `_metadata` when a fetch is about to start.
|
|
80
|
+
*/
|
|
81
|
+
export interface ModelFetchStartAction extends Action<MODEL_FETCH_START_ACTION_TYPE>, BaseModelStoreAction {
|
|
82
|
+
}
|
|
83
|
+
export declare enum MODEL_FETCH_RESULT_ACTION_TYPE {
|
|
84
|
+
FETCH_RESULT_RECEIVED = "models/FETCH_RESULT_RECEIVED",
|
|
85
|
+
TRANSIENT_FETCH_RESULT_RECEIVED = "models/TRANSIENT_FETCH_RESULT_RECEIVED"
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Action used to update the target redux `modelPath` when a successful fetch result is received.
|
|
89
|
+
*/
|
|
90
|
+
export interface ModelFetchResultAction extends Action<MODEL_FETCH_RESULT_ACTION_TYPE>, BaseModelStoreAction {
|
|
91
|
+
/** If true, the `modelsReducer` will replace the existing value in redux, instead of merging the incoming with existing. */
|
|
92
|
+
replaceValue?: boolean;
|
|
93
|
+
/** The data returned from a request. */
|
|
94
|
+
data?: any;
|
|
95
|
+
}
|
|
96
|
+
export declare const isModelFetchResultAction: (action: AnyAction) => action is ModelFetchResultAction;
|
|
97
|
+
export declare const isTransientModelFetchResultAction: (action: AnyAction) => action is ModelFetchResultAction;
|
|
98
|
+
export declare enum MODEL_FETCH_ERROR_ACTION_TYPE {
|
|
99
|
+
FETCH_FAILED = "models/FETCH_FAILED",
|
|
100
|
+
TRANSIENT_FETCH_FAILED = "models/TRANSIENT_FETCH_FAILED",
|
|
101
|
+
TRY_FETCH_FAILED = "models/TRY_FETCH_FAILED"
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Action used to update the target redux `modelPath` `_metadata` for a failed fetch.
|
|
105
|
+
*/
|
|
106
|
+
export interface ModelFetchErrorAction extends Action<MODEL_FETCH_ERROR_ACTION_TYPE>, BaseModelStoreAction {
|
|
107
|
+
/** The error data returned from a failed request. */
|
|
108
|
+
errorData?: FetchErrorData;
|
|
109
|
+
}
|
|
110
|
+
export declare const isModelFetchErrorAction: (action: AnyAction) => action is ModelFetchErrorAction;
|
|
111
|
+
export declare const isTransientModelFetchErrorAction: (action: AnyAction) => action is ModelFetchErrorAction;
|
|
112
|
+
export declare const isModelTryFetchErrorAction: (action: AnyAction) => action is ModelFetchErrorAction;
|
|
113
|
+
/**
|
|
114
|
+
* A redux action related to a model fetch request, result, error, or remove key action. To be used by `modelsReducer`.
|
|
115
|
+
*/
|
|
116
|
+
export declare type ModelStoreAction = ModelFetchStartAction | ModelFetchResultAction | ModelFetchErrorAction | ModelRemoveKeyAction;
|
|
117
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isModelTryFetchErrorAction = exports.isTransientModelFetchErrorAction = exports.isModelFetchErrorAction = exports.MODEL_FETCH_ERROR_ACTION_TYPE = exports.isTransientModelFetchResultAction = exports.isModelFetchResultAction = exports.MODEL_FETCH_RESULT_ACTION_TYPE = exports.MODEL_FETCH_START_ACTION_TYPE = exports.MODEL_REMOVE_KEY_ACTION_TYPE = exports.PERIODIC_MODEL_FETCH_TERMINATION_ACTION_TYPE = exports.MODEL_FETCH_REQUEST_ACTION_TYPE = void 0;
|
|
4
|
+
//#region Model Fetch Requests
|
|
5
|
+
var MODEL_FETCH_REQUEST_ACTION_TYPE;
|
|
6
|
+
(function (MODEL_FETCH_REQUEST_ACTION_TYPE) {
|
|
7
|
+
MODEL_FETCH_REQUEST_ACTION_TYPE["FETCH_REQUEST"] = "models/FETCH_REQUEST";
|
|
8
|
+
MODEL_FETCH_REQUEST_ACTION_TYPE["PERIODIC_FETCH_REQUEST"] = "models/PERIODIC_FETCH_REQUEST";
|
|
9
|
+
})(MODEL_FETCH_REQUEST_ACTION_TYPE = exports.MODEL_FETCH_REQUEST_ACTION_TYPE || (exports.MODEL_FETCH_REQUEST_ACTION_TYPE = {}));
|
|
10
|
+
var PERIODIC_MODEL_FETCH_TERMINATION_ACTION_TYPE;
|
|
11
|
+
(function (PERIODIC_MODEL_FETCH_TERMINATION_ACTION_TYPE) {
|
|
12
|
+
PERIODIC_MODEL_FETCH_TERMINATION_ACTION_TYPE["TERMINATE"] = "models/PERIODIC_MODEL_FETCH_REQUEST_TERMINATE";
|
|
13
|
+
PERIODIC_MODEL_FETCH_TERMINATION_ACTION_TYPE["SUCCEEDED"] = "models/PERIODIC_MODEL_FETCH_REQUEST_TERMINATE_SUCCEEDED";
|
|
14
|
+
})(PERIODIC_MODEL_FETCH_TERMINATION_ACTION_TYPE = exports.PERIODIC_MODEL_FETCH_TERMINATION_ACTION_TYPE || (exports.PERIODIC_MODEL_FETCH_TERMINATION_ACTION_TYPE = {}));
|
|
15
|
+
//#region Model Remove Key
|
|
16
|
+
exports.MODEL_REMOVE_KEY_ACTION_TYPE = 'models/REMOVE_KEY';
|
|
17
|
+
//#endregion Model Remove Key
|
|
18
|
+
//#region Model Fetch Start
|
|
19
|
+
var MODEL_FETCH_START_ACTION_TYPE;
|
|
20
|
+
(function (MODEL_FETCH_START_ACTION_TYPE) {
|
|
21
|
+
MODEL_FETCH_START_ACTION_TYPE["FETCH_START"] = "models/FETCH_START";
|
|
22
|
+
MODEL_FETCH_START_ACTION_TYPE["TRANSIENT_FETCH_START"] = "models/TRANSIENT_FETCH_START";
|
|
23
|
+
})(MODEL_FETCH_START_ACTION_TYPE = exports.MODEL_FETCH_START_ACTION_TYPE || (exports.MODEL_FETCH_START_ACTION_TYPE = {}));
|
|
24
|
+
//#endregion Model Fetch Start
|
|
25
|
+
//#region Model Fetch Result
|
|
26
|
+
var MODEL_FETCH_RESULT_ACTION_TYPE;
|
|
27
|
+
(function (MODEL_FETCH_RESULT_ACTION_TYPE) {
|
|
28
|
+
MODEL_FETCH_RESULT_ACTION_TYPE["FETCH_RESULT_RECEIVED"] = "models/FETCH_RESULT_RECEIVED";
|
|
29
|
+
MODEL_FETCH_RESULT_ACTION_TYPE["TRANSIENT_FETCH_RESULT_RECEIVED"] = "models/TRANSIENT_FETCH_RESULT_RECEIVED";
|
|
30
|
+
})(MODEL_FETCH_RESULT_ACTION_TYPE = exports.MODEL_FETCH_RESULT_ACTION_TYPE || (exports.MODEL_FETCH_RESULT_ACTION_TYPE = {}));
|
|
31
|
+
var isModelFetchResultAction = function (action) {
|
|
32
|
+
return action.type === MODEL_FETCH_RESULT_ACTION_TYPE.FETCH_RESULT_RECEIVED ||
|
|
33
|
+
action.type === MODEL_FETCH_RESULT_ACTION_TYPE.TRANSIENT_FETCH_RESULT_RECEIVED;
|
|
34
|
+
};
|
|
35
|
+
exports.isModelFetchResultAction = isModelFetchResultAction;
|
|
36
|
+
var isTransientModelFetchResultAction = function (action) {
|
|
37
|
+
return action.type === MODEL_FETCH_RESULT_ACTION_TYPE.TRANSIENT_FETCH_RESULT_RECEIVED;
|
|
38
|
+
};
|
|
39
|
+
exports.isTransientModelFetchResultAction = isTransientModelFetchResultAction;
|
|
40
|
+
//#endregion Model Fetch Result
|
|
41
|
+
//#region Model Fetch Error
|
|
42
|
+
var MODEL_FETCH_ERROR_ACTION_TYPE;
|
|
43
|
+
(function (MODEL_FETCH_ERROR_ACTION_TYPE) {
|
|
44
|
+
MODEL_FETCH_ERROR_ACTION_TYPE["FETCH_FAILED"] = "models/FETCH_FAILED";
|
|
45
|
+
MODEL_FETCH_ERROR_ACTION_TYPE["TRANSIENT_FETCH_FAILED"] = "models/TRANSIENT_FETCH_FAILED";
|
|
46
|
+
MODEL_FETCH_ERROR_ACTION_TYPE["TRY_FETCH_FAILED"] = "models/TRY_FETCH_FAILED";
|
|
47
|
+
})(MODEL_FETCH_ERROR_ACTION_TYPE = exports.MODEL_FETCH_ERROR_ACTION_TYPE || (exports.MODEL_FETCH_ERROR_ACTION_TYPE = {}));
|
|
48
|
+
var isModelFetchErrorAction = function (action) {
|
|
49
|
+
return action.type === MODEL_FETCH_ERROR_ACTION_TYPE.TRY_FETCH_FAILED ||
|
|
50
|
+
action.type === MODEL_FETCH_ERROR_ACTION_TYPE.FETCH_FAILED ||
|
|
51
|
+
action.type === MODEL_FETCH_ERROR_ACTION_TYPE.TRANSIENT_FETCH_FAILED;
|
|
52
|
+
};
|
|
53
|
+
exports.isModelFetchErrorAction = isModelFetchErrorAction;
|
|
54
|
+
var isTransientModelFetchErrorAction = function (action) {
|
|
55
|
+
return action.type === MODEL_FETCH_ERROR_ACTION_TYPE.TRANSIENT_FETCH_FAILED;
|
|
56
|
+
};
|
|
57
|
+
exports.isTransientModelFetchErrorAction = isTransientModelFetchErrorAction;
|
|
58
|
+
var isModelTryFetchErrorAction = function (action) {
|
|
59
|
+
return action.type === MODEL_FETCH_ERROR_ACTION_TYPE.TRY_FETCH_FAILED;
|
|
60
|
+
};
|
|
61
|
+
exports.isModelTryFetchErrorAction = isModelTryFetchErrorAction;
|
|
62
|
+
//#endregion Model Store Actions
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Action } from 'redux';
|
|
2
|
+
import { Notification } from '../../types/Notification';
|
|
3
|
+
export declare enum NOTIFICATION_ACTION_TYPE {
|
|
4
|
+
ADD_NOTIFICATION = "notifications/ADD_NOTIFICATION",
|
|
5
|
+
REMOVE_NOTIFICATION = "notifications/REMOVE_NOTIFICATION"
|
|
6
|
+
}
|
|
7
|
+
export interface NotificationAction extends Action<NOTIFICATION_ACTION_TYPE> {
|
|
8
|
+
notification: Notification;
|
|
9
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NOTIFICATION_ACTION_TYPE = void 0;
|
|
4
|
+
var NOTIFICATION_ACTION_TYPE;
|
|
5
|
+
(function (NOTIFICATION_ACTION_TYPE) {
|
|
6
|
+
NOTIFICATION_ACTION_TYPE["ADD_NOTIFICATION"] = "notifications/ADD_NOTIFICATION";
|
|
7
|
+
NOTIFICATION_ACTION_TYPE["REMOVE_NOTIFICATION"] = "notifications/REMOVE_NOTIFICATION";
|
|
8
|
+
})(NOTIFICATION_ACTION_TYPE = exports.NOTIFICATION_ACTION_TYPE || (exports.NOTIFICATION_ACTION_TYPE = {}));
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SEARCH_ACTION_TYPE = void 0;
|
|
4
|
+
var SEARCH_ACTION_TYPE;
|
|
5
|
+
(function (SEARCH_ACTION_TYPE) {
|
|
6
|
+
SEARCH_ACTION_TYPE["PERSIST_SEARCH"] = "manage/PERSIST_SEARCH";
|
|
7
|
+
})(SEARCH_ACTION_TYPE = exports.SEARCH_ACTION_TYPE || (exports.SEARCH_ACTION_TYPE = {}));
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./AuthAction"), exports);
|
|
14
|
+
__exportStar(require("./ModelAction"), exports);
|
|
15
|
+
__exportStar(require("./ModalAction"), exports);
|
|
16
|
+
__exportStar(require("./NotificationAction"), exports);
|
|
17
|
+
__exportStar(require("./SearchAction"), exports);
|
|
@@ -3,10 +3,11 @@ import { History } from 'history';
|
|
|
3
3
|
import { Dictionary } from 'lodash';
|
|
4
4
|
import { Reducer } from 'redux';
|
|
5
5
|
import { PersistedState } from 'redux-persist';
|
|
6
|
-
import { BaseModelsState, BaseReduxState
|
|
6
|
+
import { BaseModelsState, BaseReduxState } from '../types';
|
|
7
|
+
import { ModelStoreAction } from './actions/ModelAction';
|
|
7
8
|
export declare const updatePersistBlacklist: (blacklist: string[]) => void;
|
|
8
9
|
export declare const setOtherReducers: (value: Dictionary<Reducer>) => void;
|
|
9
|
-
declare type ConfigureModelsReducerFunction = <TModelsState extends BaseModelsState>(reducer: Reducer<TModelsState,
|
|
10
|
+
declare type ConfigureModelsReducerFunction = <TModelsState extends BaseModelsState>(reducer: Reducer<TModelsState, ModelStoreAction>) => Reducer<TModelsState, ModelStoreAction>;
|
|
10
11
|
/**
|
|
11
12
|
* Sets or clears a "middleware" function that is called when constructing the "models"
|
|
12
13
|
* redux reducer, allowing for modification by the app.
|
|
@@ -80,11 +80,11 @@ var setConfigureModelsReducer = function (value) {
|
|
|
80
80
|
exports.setConfigureModelsReducer = setConfigureModelsReducer;
|
|
81
81
|
//#endregion Setup
|
|
82
82
|
var getModelsReducer = function () {
|
|
83
|
-
var
|
|
83
|
+
var localModelsReducer = reducers_1.modelsReducer;
|
|
84
84
|
if (configureModelsReducer) {
|
|
85
|
-
return configureModelsReducer(
|
|
85
|
+
return configureModelsReducer(localModelsReducer);
|
|
86
86
|
}
|
|
87
|
-
return
|
|
87
|
+
return localModelsReducer;
|
|
88
88
|
};
|
|
89
89
|
var configureReducers = function (history) {
|
|
90
90
|
return redux_persist_1.persistReducer(rootPersistConfig, redux_1.combineReducers(__assign({ auth: redux_persist_1.persistReducer(authPersistConfig, reducers_1.authReducer), notifications: redux_persist_1.persistReducer(notificationsPersistConfig, reducers_1.notificationsReducer), modals: reducers_1.modalsReducer, models: getModelsReducer(), router: connected_react_router_1.connectRouter(history), search: reducers_1.searchReducer }, otherReducers)));
|
|
@@ -43,7 +43,16 @@ var actionCreator_1 = require("./actionCreator");
|
|
|
43
43
|
var actions_1 = require("./actions");
|
|
44
44
|
var configureReducers_1 = __importDefault(require("./configureReducers"));
|
|
45
45
|
var rootSaga_1 = __importDefault(require("./sagas/rootSaga"));
|
|
46
|
-
var keysToFilter = [
|
|
46
|
+
var keysToFilter = [
|
|
47
|
+
'puid',
|
|
48
|
+
'employeeNumber',
|
|
49
|
+
'access_token',
|
|
50
|
+
'refresh_token',
|
|
51
|
+
'password',
|
|
52
|
+
'Password',
|
|
53
|
+
'content',
|
|
54
|
+
'data'
|
|
55
|
+
];
|
|
47
56
|
var filterData = function (obj) {
|
|
48
57
|
return lodash_1.transform(obj, function (result, value, key) {
|
|
49
58
|
if (keysToFilter.includes(key)) {
|
|
@@ -65,17 +74,11 @@ var stripState = function (obj, parentKey) {
|
|
|
65
74
|
};
|
|
66
75
|
exports.stripState = stripState;
|
|
67
76
|
var actionTransformer = function (action) {
|
|
68
|
-
var _a;
|
|
69
77
|
// action breadcrumb filtering
|
|
70
78
|
if (
|
|
71
|
-
// do not track
|
|
72
|
-
action.type === actions_1.
|
|
73
|
-
action.type === actions_1.
|
|
74
|
-
// do not track modal actions
|
|
75
|
-
action.type === actions_1.ACTION.MODAL_ENTERING ||
|
|
76
|
-
action.type === actions_1.ACTION.MODAL_EXITED ||
|
|
77
|
-
// do not track API requests for tokens
|
|
78
|
-
(action.type === actions_1.NET_ACTION.DATA_REQUESTED && ((_a = action.data) === null || _a === void 0 ? void 0 : _a.modelName) === 'getToken')) {
|
|
79
|
+
// do not track modal actions
|
|
80
|
+
action.type === actions_1.MODAL_ACTION_TYPE.MODAL_ENTERING ||
|
|
81
|
+
action.type === actions_1.MODAL_ACTION_TYPE.MODAL_EXITED) {
|
|
79
82
|
return null;
|
|
80
83
|
}
|
|
81
84
|
return filterData(action);
|
package/lib/redux/helpers.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.hasUserData = void 0;
|
|
4
|
-
var hasUserData = function (state) {
|
|
5
|
-
return !!state.models && !!state.models.user && !!state.models.user.userInfo && !!state.models.user.userInfo.id;
|
|
6
|
-
};
|
|
4
|
+
var hasUserData = function (state) { var _a, _b, _c; return !!((_c = (_b = (_a = state.models) === null || _a === void 0 ? void 0 : _a.user) === null || _b === void 0 ? void 0 : _b.userInfo) === null || _c === void 0 ? void 0 : _c.id); };
|
|
7
5
|
exports.hasUserData = hasUserData;
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { AuthState } from '../../types/auth/AuthState';
|
|
2
|
+
import { AuthAction, AuthTokenAction, AuthTokenSuccessAction } from '../actions/AuthAction';
|
|
3
|
+
/**
|
|
4
|
+
* Reducer for updating `auth` in redux.
|
|
5
|
+
*/
|
|
6
|
+
export default function authReducer(state: AuthState | undefined, action: AuthAction | AuthTokenAction | AuthTokenSuccessAction): AuthState;
|
|
@@ -1,40 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var
|
|
3
|
+
var AuthAction_1 = require("../actions/AuthAction");
|
|
4
4
|
var initialState = {
|
|
5
5
|
isInitialized: false,
|
|
6
6
|
isAuthenticating: false,
|
|
7
7
|
isAuthenticated: false,
|
|
8
8
|
didFail: false
|
|
9
9
|
};
|
|
10
|
+
/**
|
|
11
|
+
* Reducer for updating `auth` in redux.
|
|
12
|
+
*/
|
|
10
13
|
function authReducer(state, action) {
|
|
11
14
|
if (state === void 0) { state = initialState; }
|
|
12
15
|
switch (action.type) {
|
|
13
|
-
case
|
|
16
|
+
case AuthAction_1.AUTH_TOKEN_ACTION_TYPE.AUTH_INITIALIZED:
|
|
14
17
|
return Object.assign({}, state, {
|
|
15
18
|
isInitialized: true,
|
|
16
19
|
isAuthenticated: !!action.oauthToken
|
|
17
20
|
});
|
|
18
|
-
case
|
|
19
|
-
case
|
|
21
|
+
case AuthAction_1.AUTH_TOKEN_SUCCESS_ACTION_TYPE.GET_TOKEN_SUCCEEDED:
|
|
22
|
+
case AuthAction_1.AUTH_TOKEN_SUCCESS_ACTION_TYPE.TOKEN_REFRESH_SUCCEEDED:
|
|
20
23
|
return Object.assign({}, state, {
|
|
21
24
|
isAuthenticating: false,
|
|
22
25
|
isAuthenticated: true,
|
|
23
26
|
didFail: false
|
|
24
27
|
});
|
|
25
|
-
case
|
|
28
|
+
case AuthAction_1.AUTH_ACTION_TYPE.LOGIN_REQUESTED:
|
|
26
29
|
return Object.assign({}, state, {
|
|
27
30
|
isAuthenticating: true,
|
|
28
31
|
isAuthenticated: false,
|
|
29
32
|
didFail: false
|
|
30
33
|
});
|
|
31
|
-
case
|
|
34
|
+
case AuthAction_1.AUTH_ACTION_TYPE.LOG_OUT_REQUESTED:
|
|
32
35
|
return Object.assign({}, state, {
|
|
33
36
|
isAuthenticating: false,
|
|
34
37
|
isAuthenticated: false,
|
|
35
38
|
didFail: false
|
|
36
39
|
});
|
|
37
|
-
case
|
|
40
|
+
case AuthAction_1.AUTH_ACTION_TYPE.LOGIN_FAILED:
|
|
38
41
|
return Object.assign({}, state, {
|
|
39
42
|
isAuthenticating: false,
|
|
40
43
|
isAuthenticated: false,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import authReducer from './authReducer';
|
|
2
|
-
import fetchReducer from './fetchReducer';
|
|
3
2
|
import modalsReducer from './modalsReducer';
|
|
3
|
+
import modelsReducer from './modelsReducer';
|
|
4
4
|
import notificationsReducer from './notificationsReducer';
|
|
5
5
|
import searchReducer from './searchReducer';
|
|
6
|
-
export { authReducer,
|
|
6
|
+
export { authReducer, modelsReducer, modalsReducer, notificationsReducer, searchReducer };
|
|
@@ -3,13 +3,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.searchReducer = exports.notificationsReducer = exports.modalsReducer = exports.
|
|
6
|
+
exports.searchReducer = exports.notificationsReducer = exports.modalsReducer = exports.modelsReducer = exports.authReducer = void 0;
|
|
7
7
|
var authReducer_1 = __importDefault(require("./authReducer"));
|
|
8
8
|
exports.authReducer = authReducer_1.default;
|
|
9
|
-
var fetchReducer_1 = __importDefault(require("./fetchReducer"));
|
|
10
|
-
exports.fetchReducer = fetchReducer_1.default;
|
|
11
9
|
var modalsReducer_1 = __importDefault(require("./modalsReducer"));
|
|
12
10
|
exports.modalsReducer = modalsReducer_1.default;
|
|
11
|
+
var modelsReducer_1 = __importDefault(require("./modelsReducer"));
|
|
12
|
+
exports.modelsReducer = modelsReducer_1.default;
|
|
13
13
|
var notificationsReducer_1 = __importDefault(require("./notificationsReducer"));
|
|
14
14
|
exports.notificationsReducer = notificationsReducer_1.default;
|
|
15
15
|
var searchReducer_1 = __importDefault(require("./searchReducer"));
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { Dictionary } from 'lodash';
|
|
2
|
-
import {
|
|
2
|
+
import { ModalAction } from '../actions/ModalAction';
|
|
3
3
|
export interface ModalActionValue {
|
|
4
4
|
index: number;
|
|
5
5
|
isFullscreen: boolean;
|
|
6
6
|
}
|
|
7
|
-
export interface ModalAction extends Action, ModalActionValue {
|
|
8
|
-
guid: string;
|
|
9
|
-
}
|
|
10
7
|
export interface ModalsState extends Dictionary<ModalActionValue> {
|
|
11
8
|
}
|
|
12
9
|
export default function modalsReducer(state: ModalsState | undefined, action: ModalAction): ModalsState;
|
|
@@ -22,7 +22,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
22
22
|
return t;
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
var
|
|
25
|
+
var ModalAction_1 = require("../actions/ModalAction");
|
|
26
26
|
/// state is a dictionary where keys are modal guids, for easy lookup
|
|
27
27
|
var initialState = {};
|
|
28
28
|
function modalsReducer(state, action) {
|
|
@@ -32,7 +32,7 @@ function modalsReducer(state, action) {
|
|
|
32
32
|
var index;
|
|
33
33
|
var isFullscreen;
|
|
34
34
|
switch (action.type) {
|
|
35
|
-
case
|
|
35
|
+
case ModalAction_1.MODAL_ACTION_TYPE.MODAL_ENTERING: {
|
|
36
36
|
guid = action.guid;
|
|
37
37
|
index = action.index;
|
|
38
38
|
isFullscreen = action.isFullscreen;
|
|
@@ -42,7 +42,7 @@ function modalsReducer(state, action) {
|
|
|
42
42
|
var newState = __assign(__assign({}, state), (_a = {}, _a["" + guid] = { index: index, isFullscreen: isFullscreen }, _a));
|
|
43
43
|
return newState;
|
|
44
44
|
}
|
|
45
|
-
case
|
|
45
|
+
case ModalAction_1.MODAL_ACTION_TYPE.MODAL_EXITED: {
|
|
46
46
|
guid = action.guid;
|
|
47
47
|
if (!state[guid]) {
|
|
48
48
|
return state;
|