studiokit-scaffolding-js 4.5.5 → 4.5.6-alpha.2
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { History } from 'history';
|
|
2
|
-
import { Store } from 'redux';
|
|
2
|
+
import { AnyAction, Store } from 'redux';
|
|
3
3
|
import { Persistor, PersistState } from 'redux-persist';
|
|
4
4
|
import { BaseReduxState } from '../types';
|
|
5
5
|
export declare type CustomStore<TReduxState extends BaseReduxState> = Store<TReduxState & {
|
|
@@ -7,6 +7,8 @@ export declare type CustomStore<TReduxState extends BaseReduxState> = Store<TRed
|
|
|
7
7
|
}, any> & {
|
|
8
8
|
dispatch: unknown;
|
|
9
9
|
};
|
|
10
|
+
export declare const stripState: (obj: any, parentKey?: any) => any;
|
|
11
|
+
export declare const actionTransformer: (action: AnyAction) => any;
|
|
10
12
|
declare const configureStore: <TReduxState extends BaseReduxState<import("../types").BaseModelsState<import("../types").Group, import("../types").BaseSearchModelsState<import("../types").Group>>>>(history: History<any>) => {
|
|
11
13
|
store: CustomStore<TReduxState>;
|
|
12
14
|
persistor: Persistor;
|
|
@@ -29,6 +29,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
29
29
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
30
|
};
|
|
31
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
+
exports.actionTransformer = exports.stripState = void 0;
|
|
32
33
|
var Sentry = __importStar(require("@sentry/react"));
|
|
33
34
|
var connected_react_router_1 = require("connected-react-router");
|
|
34
35
|
var lodash_1 = require("lodash");
|
|
@@ -43,49 +44,52 @@ var actionCreator_1 = require("./actionCreator");
|
|
|
43
44
|
var actions_1 = require("./actions");
|
|
44
45
|
var configureReducers_1 = __importDefault(require("./configureReducers"));
|
|
45
46
|
var rootSaga_1 = __importDefault(require("./sagas/rootSaga"));
|
|
46
|
-
var
|
|
47
|
-
var
|
|
47
|
+
var keysToFilter = ['puid', 'employeeNumber', 'access_token', 'refresh_token', 'password', 'Password', 'content'];
|
|
48
|
+
var filterData = function (obj) {
|
|
48
49
|
return lodash_1.transform(obj, function (result, value, key) {
|
|
49
|
-
if (
|
|
50
|
+
if (keysToFilter.includes(key)) {
|
|
50
51
|
result[key] = '[Filtered]';
|
|
51
52
|
return;
|
|
52
53
|
}
|
|
53
|
-
result[key] = lodash_1.isPlainObject(value) ?
|
|
54
|
+
result[key] = lodash_1.isPlainObject(value) || lodash_1.isArray(value) ? filterData(value) : value;
|
|
54
55
|
});
|
|
55
56
|
};
|
|
56
57
|
var stripState = function (obj, parentKey) {
|
|
57
58
|
return lodash_1.transform(obj, function (result, value, key) {
|
|
58
|
-
if (lodash_1.isPlainObject(value)) {
|
|
59
|
-
result[key] = stripState(value, key);
|
|
59
|
+
if (lodash_1.isPlainObject(value) || lodash_1.isArray(value)) {
|
|
60
|
+
result[key] = exports.stripState(value, key);
|
|
60
61
|
}
|
|
61
62
|
else if (key === 'id' || parentKey === '_metadata') {
|
|
62
63
|
result[key] = value;
|
|
63
64
|
}
|
|
64
65
|
});
|
|
65
66
|
};
|
|
67
|
+
exports.stripState = stripState;
|
|
68
|
+
var actionTransformer = function (action) {
|
|
69
|
+
var _a;
|
|
70
|
+
// action breadcrumb filtering
|
|
71
|
+
if (
|
|
72
|
+
// do not track API responses
|
|
73
|
+
action.type === studiokit_net_js_1.NET_ACTION.FETCH_RESULT_RECEIVED ||
|
|
74
|
+
action.type === studiokit_net_js_1.NET_ACTION.TRANSIENT_FETCH_RESULT_RECEIVED ||
|
|
75
|
+
// do not track modal actions
|
|
76
|
+
action.type === actions_1.ACTION.MODAL_ENTERING ||
|
|
77
|
+
action.type === actions_1.ACTION.MODAL_EXITED ||
|
|
78
|
+
// do not track API requests for tokens
|
|
79
|
+
(action.type === studiokit_net_js_1.NET_ACTION.DATA_REQUESTED && ((_a = action.data) === null || _a === void 0 ? void 0 : _a.modelName) === 'getToken')) {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
return filterData(action);
|
|
83
|
+
};
|
|
84
|
+
exports.actionTransformer = actionTransformer;
|
|
66
85
|
var configureStore = function (history) {
|
|
67
86
|
var appConfig = configuration_1.getAppConfig();
|
|
68
87
|
var sentryReduxEnhancer = Sentry.createReduxEnhancer({
|
|
69
88
|
stateTransformer: function (state) {
|
|
70
89
|
// Transform the state to remove unneeded data
|
|
71
|
-
return stripState(state);
|
|
90
|
+
return exports.stripState(state);
|
|
72
91
|
},
|
|
73
|
-
actionTransformer:
|
|
74
|
-
var _a;
|
|
75
|
-
// action breadcrumb filtering
|
|
76
|
-
if (
|
|
77
|
-
// do not track API responses
|
|
78
|
-
action.type === studiokit_net_js_1.NET_ACTION.FETCH_RESULT_RECEIVED ||
|
|
79
|
-
action.type === studiokit_net_js_1.NET_ACTION.TRANSIENT_FETCH_RESULT_RECEIVED ||
|
|
80
|
-
// do not track modal actions
|
|
81
|
-
action.type === actions_1.ACTION.MODAL_ENTERING ||
|
|
82
|
-
action.type === actions_1.ACTION.MODAL_EXITED ||
|
|
83
|
-
// do not track API requests for tokens
|
|
84
|
-
(action.type === studiokit_net_js_1.NET_ACTION.DATA_REQUESTED && ((_a = action.data) === null || _a === void 0 ? void 0 : _a.modelName) === 'getToken')) {
|
|
85
|
-
return null;
|
|
86
|
-
}
|
|
87
|
-
return stripSensitiveData(action);
|
|
88
|
-
}
|
|
92
|
+
actionTransformer: exports.actionTransformer
|
|
89
93
|
});
|
|
90
94
|
var sagaMiddleware = redux_saga_1.default();
|
|
91
95
|
var reduxRouterMiddleware = connected_react_router_1.routerMiddleware(history);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "studiokit-scaffolding-js",
|
|
3
|
-
"version": "4.5.
|
|
3
|
+
"version": "4.5.6-alpha.2",
|
|
4
4
|
"description": "Common scaffolding for Studio apps at Purdue",
|
|
5
5
|
"repository": "https://gitlab.com/purdue-informatics/studiokit/studiokit-scaffolding-js",
|
|
6
6
|
"license": "MIT",
|