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/cjs/index.js
CHANGED
|
@@ -14496,7 +14496,7 @@ const parseUserAgent = (userAgent) => {
|
|
|
14496
14496
|
const genRouteHandler = (opts) => {
|
|
14497
14497
|
// Return a route handler
|
|
14498
14498
|
return (req, res, next) => __awaiter(void 0, void 0, void 0, function* () {
|
|
14499
|
-
var _a, _b, _c;
|
|
14499
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
14500
14500
|
// Output params
|
|
14501
14501
|
const output = {};
|
|
14502
14502
|
/*----------------------------------------*/
|
|
@@ -14697,34 +14697,34 @@ const genRouteHandler = (opts) => {
|
|
|
14697
14697
|
// Add launch info to output
|
|
14698
14698
|
output.userId = (launchInfo
|
|
14699
14699
|
? launchInfo.userId
|
|
14700
|
-
: undefined);
|
|
14700
|
+
: ((_b = output.userId) !== null && _b !== void 0 ? _b : undefined));
|
|
14701
14701
|
output.userFirstName = (launchInfo
|
|
14702
14702
|
? launchInfo.userFirstName
|
|
14703
|
-
: undefined);
|
|
14703
|
+
: ((_c = output.userFirstName) !== null && _c !== void 0 ? _c : undefined));
|
|
14704
14704
|
output.userLastName = (launchInfo
|
|
14705
14705
|
? launchInfo.userLastName
|
|
14706
|
-
: undefined);
|
|
14706
|
+
: ((_d = output.userLastName) !== null && _d !== void 0 ? _d : undefined));
|
|
14707
14707
|
output.userEmail = (launchInfo
|
|
14708
14708
|
? launchInfo.userEmail
|
|
14709
|
-
: undefined);
|
|
14709
|
+
: ((_e = output.userEmail) !== null && _e !== void 0 ? _e : undefined));
|
|
14710
14710
|
output.userAvatarURL = (launchInfo
|
|
14711
|
-
? ((
|
|
14712
|
-
: undefined);
|
|
14711
|
+
? ((_f = launchInfo.userImage) !== null && _f !== void 0 ? _f : 'http://www.gravatar.com/avatar/?d=identicon')
|
|
14712
|
+
: ((_g = output.userAvatarURL) !== null && _g !== void 0 ? _g : undefined));
|
|
14713
14713
|
output.isLearner = (launchInfo
|
|
14714
14714
|
? !!launchInfo.isLearner
|
|
14715
|
-
: undefined);
|
|
14715
|
+
: ((_h = output.isLearner) !== null && _h !== void 0 ? _h : undefined));
|
|
14716
14716
|
output.isTTM = (launchInfo
|
|
14717
14717
|
? !!launchInfo.isTTM
|
|
14718
|
-
: undefined);
|
|
14718
|
+
: ((_j = output.isTTM) !== null && _j !== void 0 ? _j : undefined));
|
|
14719
14719
|
output.isAdmin = (launchInfo
|
|
14720
14720
|
? !!launchInfo.isAdmin
|
|
14721
|
-
: undefined);
|
|
14721
|
+
: ((_k = output.isAdmin) !== null && _k !== void 0 ? _k : undefined));
|
|
14722
14722
|
output.courseId = (launchInfo
|
|
14723
|
-
? ((
|
|
14724
|
-
: undefined);
|
|
14723
|
+
? ((_l = output.courseId) !== null && _l !== void 0 ? _l : launchInfo.courseId)
|
|
14724
|
+
: ((_m = output.courseId) !== null && _m !== void 0 ? _m : undefined));
|
|
14725
14725
|
output.courseName = (launchInfo
|
|
14726
14726
|
? launchInfo.contextLabel
|
|
14727
|
-
: undefined);
|
|
14727
|
+
: ((_o = output.courseName) !== null && _o !== void 0 ? _o : undefined));
|
|
14728
14728
|
// Add other session variables
|
|
14729
14729
|
Object.keys(req.session).forEach((propName) => {
|
|
14730
14730
|
// Skip if prop already in output
|
|
@@ -14798,7 +14798,7 @@ const genRouteHandler = (opts) => {
|
|
|
14798
14798
|
* @author Gabe Abrams
|
|
14799
14799
|
*/
|
|
14800
14800
|
const logServerEvent = (logOpts) => __awaiter(void 0, void 0, void 0, function* () {
|
|
14801
|
-
var
|
|
14801
|
+
var _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1;
|
|
14802
14802
|
// NOTE: internally, we slip through an opts.overrideAsClientEvent boolean
|
|
14803
14803
|
// that indicates that this is actually a client event, but we don't
|
|
14804
14804
|
// include that in the LogFunction type because this is internal and
|
|
@@ -14830,24 +14830,24 @@ const genRouteHandler = (opts) => {
|
|
|
14830
14830
|
timestamp,
|
|
14831
14831
|
context: (typeof logOpts.context === 'string'
|
|
14832
14832
|
? logOpts.context
|
|
14833
|
-
: ((
|
|
14834
|
-
subcontext: ((
|
|
14835
|
-
tags: ((
|
|
14836
|
-
level: ((
|
|
14837
|
-
metadata: ((
|
|
14833
|
+
: ((_q = ((_p = logOpts.context) !== null && _p !== void 0 ? _p : {})._) !== null && _q !== void 0 ? _q : LogBuiltInMetadata.Context.Uncategorized)),
|
|
14834
|
+
subcontext: ((_r = logOpts.subcontext) !== null && _r !== void 0 ? _r : LogBuiltInMetadata.Context.Uncategorized),
|
|
14835
|
+
tags: ((_s = logOpts.tags) !== null && _s !== void 0 ? _s : []),
|
|
14836
|
+
level: ((_t = logOpts.level) !== null && _t !== void 0 ? _t : LogLevel$1.Info),
|
|
14837
|
+
metadata: ((_u = logOpts.metadata) !== null && _u !== void 0 ? _u : {}),
|
|
14838
14838
|
};
|
|
14839
14839
|
// Type-specific info
|
|
14840
14840
|
const typeSpecificInfo = (('error' in opts && opts.error)
|
|
14841
14841
|
? {
|
|
14842
14842
|
type: LogType$1.Error,
|
|
14843
|
-
errorMessage: (
|
|
14844
|
-
errorCode: (
|
|
14845
|
-
errorStack: (
|
|
14843
|
+
errorMessage: (_v = logOpts.error.message) !== null && _v !== void 0 ? _v : 'Unknown message',
|
|
14844
|
+
errorCode: (_w = logOpts.error.code) !== null && _w !== void 0 ? _w : ReactKitErrorCode$1.NoCode,
|
|
14845
|
+
errorStack: (_x = logOpts.error.stack) !== null && _x !== void 0 ? _x : 'No stack',
|
|
14846
14846
|
}
|
|
14847
14847
|
: {
|
|
14848
14848
|
type: LogType$1.Action,
|
|
14849
|
-
target: ((
|
|
14850
|
-
action: ((
|
|
14849
|
+
target: ((_y = logOpts.target) !== null && _y !== void 0 ? _y : LogBuiltInMetadata.Target.NoTarget),
|
|
14850
|
+
action: ((_z = logOpts.action) !== null && _z !== void 0 ? _z : LogAction$1.Unknown),
|
|
14851
14851
|
});
|
|
14852
14852
|
// Source-specific info
|
|
14853
14853
|
const sourceSpecificInfo = (logOpts.overrideAsClientEvent
|
|
@@ -14882,7 +14882,7 @@ const genRouteHandler = (opts) => {
|
|
|
14882
14882
|
catch (err) {
|
|
14883
14883
|
// Print because we cannot store the error
|
|
14884
14884
|
// eslint-disable-next-line no-console
|
|
14885
|
-
console.error('Could not log the following:', logOpts, 'due to this error:', ((
|
|
14885
|
+
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);
|
|
14886
14886
|
// Create a dummy log to return
|
|
14887
14887
|
const dummyMainInfo = {
|
|
14888
14888
|
id: '-1',
|