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/esm/index.js
CHANGED
|
@@ -42170,7 +42170,7 @@ const parseUserAgent = (userAgent) => {
|
|
|
42170
42170
|
const genRouteHandler = (opts) => {
|
|
42171
42171
|
// Return a route handler
|
|
42172
42172
|
return (req, res, next) => __awaiter(void 0, void 0, void 0, function* () {
|
|
42173
|
-
var _a, _b;
|
|
42173
|
+
var _a, _b, _c;
|
|
42174
42174
|
// Output params
|
|
42175
42175
|
const output = {};
|
|
42176
42176
|
/*----------------------------------------*/
|
|
@@ -42381,6 +42381,9 @@ const genRouteHandler = (opts) => {
|
|
|
42381
42381
|
output.userEmail = (launchInfo
|
|
42382
42382
|
? launchInfo.userEmail
|
|
42383
42383
|
: undefined);
|
|
42384
|
+
output.userAvatarURL = (launchInfo
|
|
42385
|
+
? ((_b = launchInfo.userImage) !== null && _b !== void 0 ? _b : 'http://www.gravatar.com/avatar/?d=identicon')
|
|
42386
|
+
: undefined);
|
|
42384
42387
|
output.isLearner = (launchInfo
|
|
42385
42388
|
? !!launchInfo.isLearner
|
|
42386
42389
|
: undefined);
|
|
@@ -42391,7 +42394,7 @@ const genRouteHandler = (opts) => {
|
|
|
42391
42394
|
? !!launchInfo.isAdmin
|
|
42392
42395
|
: undefined);
|
|
42393
42396
|
output.courseId = (launchInfo
|
|
42394
|
-
? ((
|
|
42397
|
+
? ((_c = output.courseId) !== null && _c !== void 0 ? _c : launchInfo.courseId)
|
|
42395
42398
|
: undefined);
|
|
42396
42399
|
output.courseName = (launchInfo
|
|
42397
42400
|
? launchInfo.contextLabel
|
|
@@ -42469,7 +42472,7 @@ const genRouteHandler = (opts) => {
|
|
|
42469
42472
|
* @author Gabe Abrams
|
|
42470
42473
|
*/
|
|
42471
42474
|
const logServerEvent = (logOpts) => __awaiter(void 0, void 0, void 0, function* () {
|
|
42472
|
-
var
|
|
42475
|
+
var _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
42473
42476
|
// NOTE: internally, we slip through an opts.overrideAsClientEvent boolean
|
|
42474
42477
|
// that indicates that this is actually a client event, but we don't
|
|
42475
42478
|
// include that in the LogFunction type because this is internal and
|
|
@@ -42501,24 +42504,24 @@ const genRouteHandler = (opts) => {
|
|
|
42501
42504
|
timestamp,
|
|
42502
42505
|
context: (typeof logOpts.context === 'string'
|
|
42503
42506
|
? logOpts.context
|
|
42504
|
-
: ((
|
|
42505
|
-
subcontext: ((
|
|
42506
|
-
tags: ((
|
|
42507
|
-
level: ((
|
|
42508
|
-
metadata: ((
|
|
42507
|
+
: ((_e = ((_d = logOpts.context) !== null && _d !== void 0 ? _d : {})._) !== null && _e !== void 0 ? _e : LogBuiltInMetadata.Context.Uncategorized)),
|
|
42508
|
+
subcontext: ((_f = logOpts.subcontext) !== null && _f !== void 0 ? _f : LogBuiltInMetadata.Context.Uncategorized),
|
|
42509
|
+
tags: ((_g = logOpts.tags) !== null && _g !== void 0 ? _g : []),
|
|
42510
|
+
level: ((_h = logOpts.level) !== null && _h !== void 0 ? _h : LogLevel$1.Info),
|
|
42511
|
+
metadata: ((_j = logOpts.metadata) !== null && _j !== void 0 ? _j : {}),
|
|
42509
42512
|
};
|
|
42510
42513
|
// Type-specific info
|
|
42511
42514
|
const typeSpecificInfo = (('error' in opts && opts.error)
|
|
42512
42515
|
? {
|
|
42513
42516
|
type: LogType$1.Error,
|
|
42514
|
-
errorMessage: (
|
|
42515
|
-
errorCode: (
|
|
42516
|
-
errorStack: (
|
|
42517
|
+
errorMessage: (_k = logOpts.error.message) !== null && _k !== void 0 ? _k : 'Unknown message',
|
|
42518
|
+
errorCode: (_l = logOpts.error.code) !== null && _l !== void 0 ? _l : ReactKitErrorCode$1.NoCode,
|
|
42519
|
+
errorStack: (_m = logOpts.error.stack) !== null && _m !== void 0 ? _m : 'No stack',
|
|
42517
42520
|
}
|
|
42518
42521
|
: {
|
|
42519
42522
|
type: LogType$1.Action,
|
|
42520
|
-
target: ((
|
|
42521
|
-
action: ((
|
|
42523
|
+
target: ((_o = logOpts.target) !== null && _o !== void 0 ? _o : LogBuiltInMetadata.Target.NoTarget),
|
|
42524
|
+
action: ((_p = logOpts.action) !== null && _p !== void 0 ? _p : LogAction$1.Unknown),
|
|
42522
42525
|
});
|
|
42523
42526
|
// Source-specific info
|
|
42524
42527
|
const sourceSpecificInfo = (logOpts.overrideAsClientEvent
|