dce-reactkit 3.6.24 → 3.6.25
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 +16 -13
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +16 -13
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
- package/src/helpers/genRouteHandler.ts +8 -0
package/dist/cjs/index.js
CHANGED
|
@@ -42196,7 +42196,7 @@ const parseUserAgent = (userAgent) => {
|
|
|
42196
42196
|
const genRouteHandler = (opts) => {
|
|
42197
42197
|
// Return a route handler
|
|
42198
42198
|
return (req, res, next) => __awaiter(void 0, void 0, void 0, function* () {
|
|
42199
|
-
var _a, _b;
|
|
42199
|
+
var _a, _b, _c;
|
|
42200
42200
|
// Output params
|
|
42201
42201
|
const output = {};
|
|
42202
42202
|
/*----------------------------------------*/
|
|
@@ -42407,6 +42407,9 @@ const genRouteHandler = (opts) => {
|
|
|
42407
42407
|
output.userEmail = (launchInfo
|
|
42408
42408
|
? launchInfo.userEmail
|
|
42409
42409
|
: undefined);
|
|
42410
|
+
output.userAvatarURL = (launchInfo
|
|
42411
|
+
? ((_b = launchInfo.userImage) !== null && _b !== void 0 ? _b : 'http://www.gravatar.com/avatar/?d=identicon')
|
|
42412
|
+
: undefined);
|
|
42410
42413
|
output.isLearner = (launchInfo
|
|
42411
42414
|
? !!launchInfo.isLearner
|
|
42412
42415
|
: undefined);
|
|
@@ -42417,7 +42420,7 @@ const genRouteHandler = (opts) => {
|
|
|
42417
42420
|
? !!launchInfo.isAdmin
|
|
42418
42421
|
: undefined);
|
|
42419
42422
|
output.courseId = (launchInfo
|
|
42420
|
-
? ((
|
|
42423
|
+
? ((_c = output.courseId) !== null && _c !== void 0 ? _c : launchInfo.courseId)
|
|
42421
42424
|
: undefined);
|
|
42422
42425
|
output.courseName = (launchInfo
|
|
42423
42426
|
? launchInfo.contextLabel
|
|
@@ -42495,7 +42498,7 @@ const genRouteHandler = (opts) => {
|
|
|
42495
42498
|
* @author Gabe Abrams
|
|
42496
42499
|
*/
|
|
42497
42500
|
const logServerEvent = (logOpts) => __awaiter(void 0, void 0, void 0, function* () {
|
|
42498
|
-
var
|
|
42501
|
+
var _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
42499
42502
|
// NOTE: internally, we slip through an opts.overrideAsClientEvent boolean
|
|
42500
42503
|
// that indicates that this is actually a client event, but we don't
|
|
42501
42504
|
// include that in the LogFunction type because this is internal and
|
|
@@ -42527,24 +42530,24 @@ const genRouteHandler = (opts) => {
|
|
|
42527
42530
|
timestamp,
|
|
42528
42531
|
context: (typeof logOpts.context === 'string'
|
|
42529
42532
|
? logOpts.context
|
|
42530
|
-
: ((
|
|
42531
|
-
subcontext: ((
|
|
42532
|
-
tags: ((
|
|
42533
|
-
level: ((
|
|
42534
|
-
metadata: ((
|
|
42533
|
+
: ((_e = ((_d = logOpts.context) !== null && _d !== void 0 ? _d : {})._) !== null && _e !== void 0 ? _e : LogBuiltInMetadata.Context.Uncategorized)),
|
|
42534
|
+
subcontext: ((_f = logOpts.subcontext) !== null && _f !== void 0 ? _f : LogBuiltInMetadata.Context.Uncategorized),
|
|
42535
|
+
tags: ((_g = logOpts.tags) !== null && _g !== void 0 ? _g : []),
|
|
42536
|
+
level: ((_h = logOpts.level) !== null && _h !== void 0 ? _h : LogLevel$1.Info),
|
|
42537
|
+
metadata: ((_j = logOpts.metadata) !== null && _j !== void 0 ? _j : {}),
|
|
42535
42538
|
};
|
|
42536
42539
|
// Type-specific info
|
|
42537
42540
|
const typeSpecificInfo = (('error' in opts && opts.error)
|
|
42538
42541
|
? {
|
|
42539
42542
|
type: LogType$1.Error,
|
|
42540
|
-
errorMessage: (
|
|
42541
|
-
errorCode: (
|
|
42542
|
-
errorStack: (
|
|
42543
|
+
errorMessage: (_k = logOpts.error.message) !== null && _k !== void 0 ? _k : 'Unknown message',
|
|
42544
|
+
errorCode: (_l = logOpts.error.code) !== null && _l !== void 0 ? _l : ReactKitErrorCode$1.NoCode,
|
|
42545
|
+
errorStack: (_m = logOpts.error.stack) !== null && _m !== void 0 ? _m : 'No stack',
|
|
42543
42546
|
}
|
|
42544
42547
|
: {
|
|
42545
42548
|
type: LogType$1.Action,
|
|
42546
|
-
target: ((
|
|
42547
|
-
action: ((
|
|
42549
|
+
target: ((_o = logOpts.target) !== null && _o !== void 0 ? _o : LogBuiltInMetadata.Target.NoTarget),
|
|
42550
|
+
action: ((_p = logOpts.action) !== null && _p !== void 0 ? _p : LogAction$1.Unknown),
|
|
42548
42551
|
});
|
|
42549
42552
|
// Source-specific info
|
|
42550
42553
|
const sourceSpecificInfo = (logOpts.overrideAsClientEvent
|