dce-reactkit 3.9.1 → 3.9.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.
- package/dist/cjs/index.js +25 -25
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +25 -25
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
- package/src/helpers/genRouteHandler.ts +10 -10
package/dist/esm/index.js
CHANGED
|
@@ -14468,7 +14468,7 @@ const parseUserAgent = (userAgent) => {
|
|
|
14468
14468
|
const genRouteHandler = (opts) => {
|
|
14469
14469
|
// Return a route handler
|
|
14470
14470
|
return (req, res, next) => __awaiter(void 0, void 0, void 0, function* () {
|
|
14471
|
-
var _a, _b, _c;
|
|
14471
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
14472
14472
|
// Output params
|
|
14473
14473
|
const output = {};
|
|
14474
14474
|
/*----------------------------------------*/
|
|
@@ -14669,34 +14669,34 @@ const genRouteHandler = (opts) => {
|
|
|
14669
14669
|
// Add launch info to output
|
|
14670
14670
|
output.userId = (launchInfo
|
|
14671
14671
|
? launchInfo.userId
|
|
14672
|
-
: undefined);
|
|
14672
|
+
: ((_b = output.userId) !== null && _b !== void 0 ? _b : undefined));
|
|
14673
14673
|
output.userFirstName = (launchInfo
|
|
14674
14674
|
? launchInfo.userFirstName
|
|
14675
|
-
: undefined);
|
|
14675
|
+
: ((_c = output.userFirstName) !== null && _c !== void 0 ? _c : undefined));
|
|
14676
14676
|
output.userLastName = (launchInfo
|
|
14677
14677
|
? launchInfo.userLastName
|
|
14678
|
-
: undefined);
|
|
14678
|
+
: ((_d = output.userLastName) !== null && _d !== void 0 ? _d : undefined));
|
|
14679
14679
|
output.userEmail = (launchInfo
|
|
14680
14680
|
? launchInfo.userEmail
|
|
14681
|
-
: undefined);
|
|
14681
|
+
: ((_e = output.userEmail) !== null && _e !== void 0 ? _e : undefined));
|
|
14682
14682
|
output.userAvatarURL = (launchInfo
|
|
14683
|
-
? ((
|
|
14684
|
-
: undefined);
|
|
14683
|
+
? ((_f = launchInfo.userImage) !== null && _f !== void 0 ? _f : 'http://www.gravatar.com/avatar/?d=identicon')
|
|
14684
|
+
: ((_g = output.userAvatarURL) !== null && _g !== void 0 ? _g : undefined));
|
|
14685
14685
|
output.isLearner = (launchInfo
|
|
14686
14686
|
? !!launchInfo.isLearner
|
|
14687
|
-
: undefined);
|
|
14687
|
+
: ((_h = output.isLearner) !== null && _h !== void 0 ? _h : undefined));
|
|
14688
14688
|
output.isTTM = (launchInfo
|
|
14689
14689
|
? !!launchInfo.isTTM
|
|
14690
|
-
: undefined);
|
|
14690
|
+
: ((_j = output.isTTM) !== null && _j !== void 0 ? _j : undefined));
|
|
14691
14691
|
output.isAdmin = (launchInfo
|
|
14692
14692
|
? !!launchInfo.isAdmin
|
|
14693
|
-
: undefined);
|
|
14693
|
+
: ((_k = output.isAdmin) !== null && _k !== void 0 ? _k : undefined));
|
|
14694
14694
|
output.courseId = (launchInfo
|
|
14695
|
-
? ((
|
|
14696
|
-
: undefined);
|
|
14695
|
+
? ((_l = output.courseId) !== null && _l !== void 0 ? _l : launchInfo.courseId)
|
|
14696
|
+
: ((_m = output.courseId) !== null && _m !== void 0 ? _m : undefined));
|
|
14697
14697
|
output.courseName = (launchInfo
|
|
14698
14698
|
? launchInfo.contextLabel
|
|
14699
|
-
: undefined);
|
|
14699
|
+
: ((_o = output.courseName) !== null && _o !== void 0 ? _o : undefined));
|
|
14700
14700
|
// Add other session variables
|
|
14701
14701
|
Object.keys(req.session).forEach((propName) => {
|
|
14702
14702
|
// Skip if prop already in output
|
|
@@ -14770,7 +14770,7 @@ const genRouteHandler = (opts) => {
|
|
|
14770
14770
|
* @author Gabe Abrams
|
|
14771
14771
|
*/
|
|
14772
14772
|
const logServerEvent = (logOpts) => __awaiter(void 0, void 0, void 0, function* () {
|
|
14773
|
-
var
|
|
14773
|
+
var _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1;
|
|
14774
14774
|
// NOTE: internally, we slip through an opts.overrideAsClientEvent boolean
|
|
14775
14775
|
// that indicates that this is actually a client event, but we don't
|
|
14776
14776
|
// include that in the LogFunction type because this is internal and
|
|
@@ -14802,24 +14802,24 @@ const genRouteHandler = (opts) => {
|
|
|
14802
14802
|
timestamp,
|
|
14803
14803
|
context: (typeof logOpts.context === 'string'
|
|
14804
14804
|
? logOpts.context
|
|
14805
|
-
: ((
|
|
14806
|
-
subcontext: ((
|
|
14807
|
-
tags: ((
|
|
14808
|
-
level: ((
|
|
14809
|
-
metadata: ((
|
|
14805
|
+
: ((_q = ((_p = logOpts.context) !== null && _p !== void 0 ? _p : {})._) !== null && _q !== void 0 ? _q : LogBuiltInMetadata.Context.Uncategorized)),
|
|
14806
|
+
subcontext: ((_r = logOpts.subcontext) !== null && _r !== void 0 ? _r : LogBuiltInMetadata.Context.Uncategorized),
|
|
14807
|
+
tags: ((_s = logOpts.tags) !== null && _s !== void 0 ? _s : []),
|
|
14808
|
+
level: ((_t = logOpts.level) !== null && _t !== void 0 ? _t : LogLevel$1.Info),
|
|
14809
|
+
metadata: ((_u = logOpts.metadata) !== null && _u !== void 0 ? _u : {}),
|
|
14810
14810
|
};
|
|
14811
14811
|
// Type-specific info
|
|
14812
14812
|
const typeSpecificInfo = (('error' in opts && opts.error)
|
|
14813
14813
|
? {
|
|
14814
14814
|
type: LogType$1.Error,
|
|
14815
|
-
errorMessage: (
|
|
14816
|
-
errorCode: (
|
|
14817
|
-
errorStack: (
|
|
14815
|
+
errorMessage: (_v = logOpts.error.message) !== null && _v !== void 0 ? _v : 'Unknown message',
|
|
14816
|
+
errorCode: (_w = logOpts.error.code) !== null && _w !== void 0 ? _w : ReactKitErrorCode$1.NoCode,
|
|
14817
|
+
errorStack: (_x = logOpts.error.stack) !== null && _x !== void 0 ? _x : 'No stack',
|
|
14818
14818
|
}
|
|
14819
14819
|
: {
|
|
14820
14820
|
type: LogType$1.Action,
|
|
14821
|
-
target: ((
|
|
14822
|
-
action: ((
|
|
14821
|
+
target: ((_y = logOpts.target) !== null && _y !== void 0 ? _y : LogBuiltInMetadata.Target.NoTarget),
|
|
14822
|
+
action: ((_z = logOpts.action) !== null && _z !== void 0 ? _z : LogAction$1.Unknown),
|
|
14823
14823
|
});
|
|
14824
14824
|
// Source-specific info
|
|
14825
14825
|
const sourceSpecificInfo = (logOpts.overrideAsClientEvent
|
|
@@ -14854,7 +14854,7 @@ const genRouteHandler = (opts) => {
|
|
|
14854
14854
|
catch (err) {
|
|
14855
14855
|
// Print because we cannot store the error
|
|
14856
14856
|
// eslint-disable-next-line no-console
|
|
14857
|
-
console.error('Could not log the following:', logOpts, 'due to this error:', ((
|
|
14857
|
+
console.error('Could not log the following:', logOpts, 'due to this error:', ((_0 = err) !== null && _0 !== void 0 ? _0 : {}).message, ((_1 = err) !== null && _1 !== void 0 ? _1 : {}).stack);
|
|
14858
14858
|
// Create a dummy log to return
|
|
14859
14859
|
const dummyMainInfo = {
|
|
14860
14860
|
id: '-1',
|