@adminide-stack/user-activity-browser 1.1.3-alpha.17 → 1.1.3-alpha.50

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/lib/index.js CHANGED
@@ -1,102 +1,15 @@
1
- module.exports =
2
- /******/ (function(modules) { // webpackBootstrap
3
- /******/ // The module cache
4
- /******/ var installedModules = {};
5
- /******/
6
- /******/ // The require function
7
- /******/ function __webpack_require__(moduleId) {
8
- /******/
9
- /******/ // Check if module is in cache
10
- /******/ if(installedModules[moduleId]) {
11
- /******/ return installedModules[moduleId].exports;
12
- /******/ }
13
- /******/ // Create a new module (and put it into the cache)
14
- /******/ var module = installedModules[moduleId] = {
15
- /******/ i: moduleId,
16
- /******/ l: false,
17
- /******/ exports: {}
18
- /******/ };
19
- /******/
20
- /******/ // Execute the module function
21
- /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
22
- /******/
23
- /******/ // Flag the module as loaded
24
- /******/ module.l = true;
25
- /******/
26
- /******/ // Return the exports of the module
27
- /******/ return module.exports;
28
- /******/ }
29
- /******/
30
- /******/
31
- /******/ // expose the modules object (__webpack_modules__)
32
- /******/ __webpack_require__.m = modules;
33
- /******/
34
- /******/ // expose the module cache
35
- /******/ __webpack_require__.c = installedModules;
36
- /******/
37
- /******/ // define getter function for harmony exports
38
- /******/ __webpack_require__.d = function(exports, name, getter) {
39
- /******/ if(!__webpack_require__.o(exports, name)) {
40
- /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
41
- /******/ }
42
- /******/ };
43
- /******/
44
- /******/ // define __esModule on exports
45
- /******/ __webpack_require__.r = function(exports) {
46
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
47
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
48
- /******/ }
49
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
50
- /******/ };
51
- /******/
52
- /******/ // create a fake namespace object
53
- /******/ // mode & 1: value is a module id, require it
54
- /******/ // mode & 2: merge all properties of value into the ns
55
- /******/ // mode & 4: return value when already ns object
56
- /******/ // mode & 8|1: behave like require
57
- /******/ __webpack_require__.t = function(value, mode) {
58
- /******/ if(mode & 1) value = __webpack_require__(value);
59
- /******/ if(mode & 8) return value;
60
- /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
61
- /******/ var ns = Object.create(null);
62
- /******/ __webpack_require__.r(ns);
63
- /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
64
- /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
65
- /******/ return ns;
66
- /******/ };
67
- /******/
68
- /******/ // getDefaultExport function for compatibility with non-harmony modules
69
- /******/ __webpack_require__.n = function(module) {
70
- /******/ var getter = module && module.__esModule ?
71
- /******/ function getDefault() { return module['default']; } :
72
- /******/ function getModuleExports() { return module; };
73
- /******/ __webpack_require__.d(getter, 'a', getter);
74
- /******/ return getter;
75
- /******/ };
76
- /******/
77
- /******/ // Object.prototype.hasOwnProperty.call
78
- /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
79
- /******/
80
- /******/ // __webpack_public_path__
81
- /******/ __webpack_require__.p = "";
82
- /******/
83
- /******/
84
- /******/ // Load entry module and return exports
85
- /******/ return __webpack_require__(__webpack_require__.s = "./src/index.tsx");
86
- /******/ })
87
- /************************************************************************/
88
- /******/ ({
1
+ /******/ (() => { // webpackBootstrap
2
+ /******/ "use strict";
3
+ /******/ var __webpack_modules__ = ({
89
4
 
90
5
  /***/ "./src/activity-link.ts":
91
6
  /*!******************************!*\
92
7
  !*** ./src/activity-link.ts ***!
93
8
  \******************************/
94
- /*! no static exports found */
95
- /***/ (function(module, exports, __webpack_require__) {
9
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
96
10
 
97
- "use strict";
98
11
 
99
- Object.defineProperty(exports, "__esModule", { value: true });
12
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
100
13
  exports.activity = void 0;
101
14
  const client_1 = __webpack_require__(/*! @apollo/client */ "@apollo/client");
102
15
  const activity = (subject) => new client_1.ApolloLink((operation, forward) => {
@@ -112,15 +25,13 @@ exports.activity = activity;
112
25
  /*!******************************!*\
113
26
  !*** ./src/apollo-client.ts ***!
114
27
  \******************************/
115
- /*! no static exports found */
116
- /***/ (function(module, exports, __webpack_require__) {
28
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
117
29
 
118
- "use strict";
119
30
 
120
31
  var __importDefault = (this && this.__importDefault) || function (mod) {
121
32
  return (mod && mod.__esModule) ? mod : { "default": mod };
122
33
  };
123
- Object.defineProperty(exports, "__esModule", { value: true });
34
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
124
35
  exports.client = void 0;
125
36
  const http_1 = __webpack_require__(/*! @apollo/client/link/http */ "@apollo/client/link/http");
126
37
  const client_1 = __webpack_require__(/*! @apollo/client */ "@apollo/client");
@@ -142,14 +53,16 @@ exports.client = new client_1.ApolloClient({
142
53
  /*!********************************************!*\
143
54
  !*** ./src/classes/ZipkinGraphqlLogger.ts ***!
144
55
  \********************************************/
145
- /*! no static exports found */
146
- /***/ (function(module, exports, __webpack_require__) {
56
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
147
57
 
148
- "use strict";
149
58
 
150
59
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
151
60
  if (k2 === undefined) k2 = k;
152
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
61
+ var desc = Object.getOwnPropertyDescriptor(m, k);
62
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
63
+ desc = { enumerable: true, get: function() { return m[k]; } };
64
+ }
65
+ Object.defineProperty(o, k2, desc);
153
66
  }) : (function(o, m, k, k2) {
154
67
  if (k2 === undefined) k2 = k;
155
68
  o[k2] = m[k];
@@ -169,13 +82,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
169
82
  var __importDefault = (this && this.__importDefault) || function (mod) {
170
83
  return (mod && mod.__esModule) ? mod : { "default": mod };
171
84
  };
172
- Object.defineProperty(exports, "__esModule", { value: true });
85
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
173
86
  exports.ZipkinGraphqlLogger = void 0;
174
87
  const graphql_tag_1 = __importDefault(__webpack_require__(/*! graphql-tag */ "graphql-tag"));
175
88
  const Logger = __importStar(__webpack_require__(/*! bunyan */ "bunyan"));
176
89
  const { jsonEncoder: { JSON_V1 }, } = __webpack_require__(/*! zipkin */ "zipkin");
177
- const EventEmitter = __webpack_require__(/*! events */ "events").EventEmitter;
178
- const SEND_SPAN_MUTATION = graphql_tag_1.default `
90
+ const EventEmitter = (__webpack_require__(/*! events */ "events").EventEmitter);
91
+ const SEND_SPAN_MUTATION = (0, graphql_tag_1.default) `
179
92
  mutation batch($queue: [String]) {
180
93
  batchSpan(queue: $queue)
181
94
  }
@@ -253,14 +166,16 @@ exports.ZipkinGraphqlLogger = ZipkinGraphqlLogger;
253
166
  /*!********************************************!*\
254
167
  !*** ./src/components/ActivityTracker.tsx ***!
255
168
  \********************************************/
256
- /*! no static exports found */
257
- /***/ (function(module, exports, __webpack_require__) {
169
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
258
170
 
259
- "use strict";
260
171
 
261
172
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
262
173
  if (k2 === undefined) k2 = k;
263
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
174
+ var desc = Object.getOwnPropertyDescriptor(m, k);
175
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
176
+ desc = { enumerable: true, get: function() { return m[k]; } };
177
+ }
178
+ Object.defineProperty(o, k2, desc);
264
179
  }) : (function(o, m, k, k2) {
265
180
  if (k2 === undefined) k2 = k;
266
181
  o[k2] = m[k];
@@ -280,7 +195,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
280
195
  var __importDefault = (this && this.__importDefault) || function (mod) {
281
196
  return (mod && mod.__esModule) ? mod : { "default": mod };
282
197
  };
283
- Object.defineProperty(exports, "__esModule", { value: true });
198
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
284
199
  exports.ActivityTracker = exports.ActivityTrackerComponent = exports.styles = exports.ACTIVITY_DEBOUNCE = void 0;
285
200
  const React = __importStar(__webpack_require__(/*! react */ "react"));
286
201
  const react_idle_timer_1 = __importDefault(__webpack_require__(/*! react-idle-timer */ "react-idle-timer"));
@@ -311,10 +226,10 @@ class ActivityTrackerComponent extends React.Component {
311
226
  this.scheduler = new scheduler_1.ActivityScheduler({});
312
227
  this.scheduler
313
228
  .tick$
314
- .pipe(operators_1.takeUntil(this.stop$), operators_1.map(() => this.scheduler.prepare('user-i', {})), operators_1.flatMap(request => this.scheduler.collect(request))).subscribe(() => { });
315
- this.mouse$ = rxjs_1.fromEvent(document, 'mousemove')
316
- .pipe(operators_1.takeUntil(this.stop$), operators_1.map(() => this.setState({ inactive: false })));
317
- rxjs_1.merge(this.mouse$, this.props.stream).pipe(operators_1.takeUntil(this.stop$), operators_1.debounceTime(exports.ACTIVITY_DEBOUNCE)).subscribe((data) => this.setState({ inactive: true }));
229
+ .pipe((0, operators_1.takeUntil)(this.stop$), (0, operators_1.map)(() => this.scheduler.prepare('user-i', {})), (0, operators_1.flatMap)(request => this.scheduler.collect(request))).subscribe(() => { });
230
+ this.mouse$ = (0, rxjs_1.fromEvent)(document, 'mousemove')
231
+ .pipe((0, operators_1.takeUntil)(this.stop$), (0, operators_1.map)(() => this.setState({ inactive: false })));
232
+ (0, rxjs_1.merge)(this.mouse$, this.props.stream).pipe((0, operators_1.takeUntil)(this.stop$), (0, operators_1.debounceTime)(exports.ACTIVITY_DEBOUNCE)).subscribe((data) => this.setState({ inactive: true }));
318
233
  }
319
234
  componentWillUnmount() {
320
235
  this.stop$.next(-1);
@@ -347,14 +262,16 @@ exports.ActivityTracker = ActivityTrackerComponent;
347
262
  /*!*******************************!*\
348
263
  !*** ./src/graphql-tracer.ts ***!
349
264
  \*******************************/
350
- /*! no static exports found */
351
- /***/ (function(module, exports, __webpack_require__) {
265
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
352
266
 
353
- "use strict";
354
267
 
355
268
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
356
269
  if (k2 === undefined) k2 = k;
357
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
270
+ var desc = Object.getOwnPropertyDescriptor(m, k);
271
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
272
+ desc = { enumerable: true, get: function() { return m[k]; } };
273
+ }
274
+ Object.defineProperty(o, k2, desc);
358
275
  }) : (function(o, m, k, k2) {
359
276
  if (k2 === undefined) k2 = k;
360
277
  o[k2] = m[k];
@@ -374,7 +291,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
374
291
  var __importDefault = (this && this.__importDefault) || function (mod) {
375
292
  return (mod && mod.__esModule) ? mod : { "default": mod };
376
293
  };
377
- Object.defineProperty(exports, "__esModule", { value: true });
294
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
378
295
  exports.tracer = void 0;
379
296
  const apollo_client_1 = __webpack_require__(/*! ./apollo-client */ "./src/apollo-client.ts");
380
297
  const ZipkinGraphqlLogger_1 = __webpack_require__(/*! ./classes/ZipkinGraphqlLogger */ "./src/classes/ZipkinGraphqlLogger.ts");
@@ -399,14 +316,16 @@ exports.tracer = new zipkin_javascript_opentracing_1.default({
399
316
  /*!***********************!*\
400
317
  !*** ./src/index.tsx ***!
401
318
  \***********************/
402
- /*! no static exports found */
403
- /***/ (function(module, exports, __webpack_require__) {
319
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
404
320
 
405
- "use strict";
406
321
 
407
322
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
408
323
  if (k2 === undefined) k2 = k;
409
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
324
+ var desc = Object.getOwnPropertyDescriptor(m, k);
325
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
326
+ desc = { enumerable: true, get: function() { return m[k]; } };
327
+ }
328
+ Object.defineProperty(o, k2, desc);
410
329
  }) : (function(o, m, k, k2) {
411
330
  if (k2 === undefined) k2 = k;
412
331
  o[k2] = m[k];
@@ -423,15 +342,15 @@ var __importStar = (this && this.__importStar) || function (mod) {
423
342
  __setModuleDefault(result, mod);
424
343
  return result;
425
344
  };
426
- Object.defineProperty(exports, "__esModule", { value: true });
345
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
427
346
  const React = __importStar(__webpack_require__(/*! react */ "react"));
428
347
  const rxjs_1 = __webpack_require__(/*! rxjs */ "rxjs");
429
348
  const client_react_1 = __webpack_require__(/*! @common-stack/client-react */ "@common-stack/client-react");
430
349
  const stream = new rxjs_1.Subject();
431
350
  const activity_link_1 = __webpack_require__(/*! ./activity-link */ "./src/activity-link.ts");
432
351
  const ActivityTracker_1 = __webpack_require__(/*! ./components/ActivityTracker */ "./src/components/ActivityTracker.tsx");
433
- exports.default = new client_react_1.Feature({
434
- link: activity_link_1.activity(stream),
352
+ exports["default"] = new client_react_1.Feature({
353
+ link: (0, activity_link_1.activity)(stream),
435
354
  rootComponentFactory: req => React.createElement(ActivityTracker_1.ActivityTracker, { stream: stream }),
436
355
  });
437
356
 
@@ -442,12 +361,10 @@ exports.default = new client_react_1.Feature({
442
361
  /*!**************************!*\
443
362
  !*** ./src/scheduler.ts ***!
444
363
  \**************************/
445
- /*! no static exports found */
446
- /***/ (function(module, exports, __webpack_require__) {
364
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
447
365
 
448
- "use strict";
449
366
 
450
- Object.defineProperty(exports, "__esModule", { value: true });
367
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
451
368
  exports.ActivityScheduler = void 0;
452
369
  const rxjs_1 = __webpack_require__(/*! rxjs */ "rxjs");
453
370
  const opentracing = __webpack_require__(/*! opentracing */ "opentracing");
@@ -456,7 +373,7 @@ class ActivityScheduler {
456
373
  this.client = opentracing.globalTracer();
457
374
  this.span = this.client.startSpan('UserActivity');
458
375
  this.interval = props.interval || 10000;
459
- this.tick$ = rxjs_1.interval(this.interval);
376
+ this.tick$ = (0, rxjs_1.interval)(this.interval);
460
377
  }
461
378
  prepare(user, payload = {}) {
462
379
  const ts = Date.now();
@@ -494,8 +411,7 @@ exports.ActivityScheduler = ActivityScheduler;
494
411
  /*!*********************************!*\
495
412
  !*** external "@apollo/client" ***!
496
413
  \*********************************/
497
- /*! no static exports found */
498
- /***/ (function(module, exports) {
414
+ /***/ ((module) => {
499
415
 
500
416
  module.exports = require("@apollo/client");
501
417
 
@@ -505,8 +421,7 @@ module.exports = require("@apollo/client");
505
421
  /*!***************************************!*\
506
422
  !*** external "@apollo/client/cache" ***!
507
423
  \***************************************/
508
- /*! no static exports found */
509
- /***/ (function(module, exports) {
424
+ /***/ ((module) => {
510
425
 
511
426
  module.exports = require("@apollo/client/cache");
512
427
 
@@ -516,8 +431,7 @@ module.exports = require("@apollo/client/cache");
516
431
  /*!*******************************************!*\
517
432
  !*** external "@apollo/client/link/http" ***!
518
433
  \*******************************************/
519
- /*! no static exports found */
520
- /***/ (function(module, exports) {
434
+ /***/ ((module) => {
521
435
 
522
436
  module.exports = require("@apollo/client/link/http");
523
437
 
@@ -527,8 +441,7 @@ module.exports = require("@apollo/client/link/http");
527
441
  /*!*********************************************!*\
528
442
  !*** external "@common-stack/client-react" ***!
529
443
  \*********************************************/
530
- /*! no static exports found */
531
- /***/ (function(module, exports) {
444
+ /***/ ((module) => {
532
445
 
533
446
  module.exports = require("@common-stack/client-react");
534
447
 
@@ -538,8 +451,7 @@ module.exports = require("@common-stack/client-react");
538
451
  /*!*************************************!*\
539
452
  !*** external "apollo-link-logger" ***!
540
453
  \*************************************/
541
- /*! no static exports found */
542
- /***/ (function(module, exports) {
454
+ /***/ ((module) => {
543
455
 
544
456
  module.exports = require("apollo-link-logger");
545
457
 
@@ -549,8 +461,7 @@ module.exports = require("apollo-link-logger");
549
461
  /*!*************************!*\
550
462
  !*** external "bunyan" ***!
551
463
  \*************************/
552
- /*! no static exports found */
553
- /***/ (function(module, exports) {
464
+ /***/ ((module) => {
554
465
 
555
466
  module.exports = require("bunyan");
556
467
 
@@ -560,8 +471,7 @@ module.exports = require("bunyan");
560
471
  /*!*************************!*\
561
472
  !*** external "events" ***!
562
473
  \*************************/
563
- /*! no static exports found */
564
- /***/ (function(module, exports) {
474
+ /***/ ((module) => {
565
475
 
566
476
  module.exports = require("events");
567
477
 
@@ -571,8 +481,7 @@ module.exports = require("events");
571
481
  /*!******************************!*\
572
482
  !*** external "graphql-tag" ***!
573
483
  \******************************/
574
- /*! no static exports found */
575
- /***/ (function(module, exports) {
484
+ /***/ ((module) => {
576
485
 
577
486
  module.exports = require("graphql-tag");
578
487
 
@@ -582,8 +491,7 @@ module.exports = require("graphql-tag");
582
491
  /*!******************************!*\
583
492
  !*** external "opentracing" ***!
584
493
  \******************************/
585
- /*! no static exports found */
586
- /***/ (function(module, exports) {
494
+ /***/ ((module) => {
587
495
 
588
496
  module.exports = require("opentracing");
589
497
 
@@ -593,8 +501,7 @@ module.exports = require("opentracing");
593
501
  /*!************************!*\
594
502
  !*** external "react" ***!
595
503
  \************************/
596
- /*! no static exports found */
597
- /***/ (function(module, exports) {
504
+ /***/ ((module) => {
598
505
 
599
506
  module.exports = require("react");
600
507
 
@@ -604,8 +511,7 @@ module.exports = require("react");
604
511
  /*!***********************************!*\
605
512
  !*** external "react-idle-timer" ***!
606
513
  \***********************************/
607
- /*! no static exports found */
608
- /***/ (function(module, exports) {
514
+ /***/ ((module) => {
609
515
 
610
516
  module.exports = require("react-idle-timer");
611
517
 
@@ -615,8 +521,7 @@ module.exports = require("react-idle-timer");
615
521
  /*!***********************!*\
616
522
  !*** external "rxjs" ***!
617
523
  \***********************/
618
- /*! no static exports found */
619
- /***/ (function(module, exports) {
524
+ /***/ ((module) => {
620
525
 
621
526
  module.exports = require("rxjs");
622
527
 
@@ -626,8 +531,7 @@ module.exports = require("rxjs");
626
531
  /*!*********************************!*\
627
532
  !*** external "rxjs/operators" ***!
628
533
  \*********************************/
629
- /*! no static exports found */
630
- /***/ (function(module, exports) {
534
+ /***/ ((module) => {
631
535
 
632
536
  module.exports = require("rxjs/operators");
633
537
 
@@ -637,8 +541,7 @@ module.exports = require("rxjs/operators");
637
541
  /*!*************************!*\
638
542
  !*** external "zipkin" ***!
639
543
  \*************************/
640
- /*! no static exports found */
641
- /***/ (function(module, exports) {
544
+ /***/ ((module) => {
642
545
 
643
546
  module.exports = require("zipkin");
644
547
 
@@ -648,12 +551,46 @@ module.exports = require("zipkin");
648
551
  /*!************************************************!*\
649
552
  !*** external "zipkin-javascript-opentracing" ***!
650
553
  \************************************************/
651
- /*! no static exports found */
652
- /***/ (function(module, exports) {
554
+ /***/ ((module) => {
653
555
 
654
556
  module.exports = require("zipkin-javascript-opentracing");
655
557
 
656
558
  /***/ })
657
559
 
658
- /******/ });
560
+ /******/ });
561
+ /************************************************************************/
562
+ /******/ // The module cache
563
+ /******/ var __webpack_module_cache__ = {};
564
+ /******/
565
+ /******/ // The require function
566
+ /******/ function __webpack_require__(moduleId) {
567
+ /******/ // Check if module is in cache
568
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
569
+ /******/ if (cachedModule !== undefined) {
570
+ /******/ return cachedModule.exports;
571
+ /******/ }
572
+ /******/ // Create a new module (and put it into the cache)
573
+ /******/ var module = __webpack_module_cache__[moduleId] = {
574
+ /******/ // no module.id needed
575
+ /******/ // no module.loaded needed
576
+ /******/ exports: {}
577
+ /******/ };
578
+ /******/
579
+ /******/ // Execute the module function
580
+ /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
581
+ /******/
582
+ /******/ // Return the exports of the module
583
+ /******/ return module.exports;
584
+ /******/ }
585
+ /******/
586
+ /************************************************************************/
587
+ /******/
588
+ /******/ // startup
589
+ /******/ // Load entry module and return exports
590
+ /******/ // This entry module is referenced by other modules so it can't be inlined
591
+ /******/ var __webpack_exports__ = __webpack_require__("./src/index.tsx");
592
+ /******/ module.exports = __webpack_exports__;
593
+ /******/
594
+ /******/ })()
595
+ ;
659
596
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///./src/activity-link.ts","webpack:///./src/apollo-client.ts","webpack:///./src/classes/ZipkinGraphqlLogger.ts","webpack:///./src/components/ActivityTracker.tsx","webpack:///./src/graphql-tracer.ts","webpack:///./src/index.tsx","webpack:///./src/scheduler.ts","webpack:///external \"@apollo/client\"","webpack:///external \"@apollo/client/cache\"","webpack:///external \"@apollo/client/link/http\"","webpack:///external \"@common-stack/client-react\"","webpack:///external \"apollo-link-logger\"","webpack:///external \"bunyan\"","webpack:///external \"events\"","webpack:///external \"graphql-tag\"","webpack:///external \"opentracing\"","webpack:///external \"react\"","webpack:///external \"react-idle-timer\"","webpack:///external \"rxjs\"","webpack:///external \"rxjs/operators\"","webpack:///external \"zipkin\"","webpack:///external \"zipkin-javascript-opentracing\""],"names":[],"mappings":";;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDA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K,EAAE,MAAM;YACb,SAAS,EAAE,EAAE;YACb,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;YAChC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;oBACzB,SAAS,EAAE,EAAE;oBACb,KAAK,EAAE,QAAQ,IAAI,EAAE;iBACxB,CAAC,CAAC;SACN,CAAC;IACN,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,OAAgC;QACjD,IAAI;YACA,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YAExC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACnB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;YAClD,OAAO,IAAI,CAAC;SACf;QAAC,OAAO,CAAC,EAAE;YACR,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;YACvC,OAAO,KAAK,CAAC;SAChB;IACL,CAAC;CACJ;AAtCD,8CAsCC;;;;;;;;;;;;AC/CD,2C;;;;;;;;;;;ACAA,iD;;;;;;;;;;;ACAA,qD;;;;;;;;;;;ACAA,uD;;;;;;;;;;;ACAA,+C;;;;;;;;;;;ACAA,mC;;;;;;;;;;;ACAA,mC;;;;;;;;;;;ACAA,wC;;;;;;;;;;;ACAA,wC;;;;;;;;;;;ACAA,kC;;;;;;;;;;;ACAA,6C;;;;;;;;;;;ACAA,iC;;;;;;;;;;;ACAA,2C;;;;;;;;;;;ACAA,mC;;;;;;;;;;;ACAA,0D","file":"index.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./src/index.tsx\");\n","import * as _ from 'lodash';\nimport { Subject } from 'rxjs';\nimport { ApolloLink } from '@apollo/client';\n\nexport const activity = (subject: Subject<any>) =>\n new ApolloLink((operation, forward) => {\n subject.next(true);\n return forward(operation);\n });\n","import { HttpLink } from '@apollo/client/link/http';\nimport { ApolloClient, ApolloLink } from '@apollo/client';\nimport apolloLogger from 'apollo-link-logger';\nimport { InMemoryCache } from '@apollo/client/cache';\n\nconst cache = new InMemoryCache();\n\nexport const client = new ApolloClient({\n cache,\n link: ApolloLink.from([\n apolloLogger,\n new HttpLink({ uri: `http://localhost:8081/graphql` }),\n ]),\n});\n","import gql from 'graphql-tag';\nimport * as Logger from 'bunyan';\nimport { ApolloClient } from '@apollo/client';\n\nconst {\n jsonEncoder: { JSON_V1 },\n } = require('zipkin');\n\nconst EventEmitter = require('events').EventEmitter;\n\nexport interface IZipkinGraphqlLoggerOptions {\n logger?: Logger;\n timeout?: number;\n jsonEncoder?: any;\n httpInterval?: number;\n maxPayloadSize?: number;\n client: ApolloClient<any>;\n}\n\nconst SEND_SPAN_MUTATION = gql`\n mutation batch($queue: [String]) {\n batchSpan(queue: $queue)\n }\n`;\n\nexport class ZipkinGraphqlLogger extends EventEmitter {\n private client: ApolloClient<any>;\n private queue;\n private queueBytes;\n private errorListenerSet;\n private logger;\n private timeout;\n private maxPayloadSize;\n private httpInterval;\n private jsonEncoder;\n\n constructor({\n logger,\n client,\n timeout = 0,\n maxPayloadSize = 0,\n httpInterval = 1000,\n jsonEncoder = JSON_V1,\n }: IZipkinGraphqlLoggerOptions) {\n super();\n this.queue = [];\n this.client = client;\n this.queueBytes = 0;\n this.jsonEncoder = jsonEncoder;\n this.maxPayloadSize = maxPayloadSize;\n this.logger = logger || Logger.createLogger({ name: ZipkinGraphqlLogger.name });\n\n this.errorListenerSet = false;\n\n // req/res timeout in ms, it resets on redirect. 0 to disable (OS limit applies)\n // only supported by node-fetch; silently ignored by browser fetch clients\n // @see https://github.com/bitinn/node-fetch#fetch-options\n this.timeout = timeout;\n\n const timer = setInterval(() => {\n this.processQueue();\n }, httpInterval);\n \n // if (timer.unref) { // unref might not be available in browsers\n // timer.unref(); // Allows Node to terminate instead of blocking on timer\n // }\n }\n\n public _getPayloadSize(nextSpan) {\n // Our payload is in format '[s1,s2,s3]', so we need to add 2 brackets and\n // one comma separator for each payload, including the next span if defined\n return nextSpan\n ? this.queueBytes + 2 + this.queue.length + nextSpan.length\n : this.queueBytes + 2 + Math.min(this.queue.length - 1, 0);\n }\n\n public on(...args) {\n const eventName = args[0];\n // if the instance has an error handler set then we don't need to\n // skips error logging\n if (eventName.toLowerCase() === 'error') {\n this.errorListenerSet = true;\n }\n super.on.apply(this, args);\n }\n\n public logSpan(span) {\n const encodedSpan = this.jsonEncoder.encode(span);\n if (this.maxPayloadSize && this._getPayloadSize(encodedSpan) > this.maxPayloadSize) {\n this.processQueue();\n if (this._getPayloadSize(encodedSpan) > this.maxPayloadSize) {\n // Payload size is too large even with an empty queue, can only drop\n const err = 'Zipkin span got dropped, reason: payload too large';\n if (this.errorListenerSet) {\n this.emit('error', new Error(err));\n } else {\n this.log.error(err);\n }\n return;\n }\n }\n this.queue.push(encodedSpan);\n this.queueBytes += encodedSpan.length;\n }\n\n public processQueue() {\n if (this.queue.length > 0) {\n this.client.mutate({ mutation: SEND_SPAN_MUTATION, variables: { queue: this.queue } });\n\n this.queue.length = 0;\n this.queueBytes = 0;\n }\n }\n}\n","import * as React from 'react';\nimport { compose } from 'redux';\nimport IdleTimer from 'react-idle-timer';\nimport { Subject, Observable, fromEvent, merge } from 'rxjs';\nimport { tracer } from '../graphql-tracer';\nimport { ActivityScheduler } from '../scheduler';\nimport { IActivityScheduler } from '../interfaces';\nimport { takeUntil, map, flatMap, debounceTime } from 'rxjs/operators';\n\nexport interface IActivityTrackerProps {\n stream: Subject<any>;\n}\n\n// export const ACTIVITY_DEBOUNCE = 10000;\nexport const ACTIVITY_DEBOUNCE = 900000;\n\nexport const styles = ({\n footer: ({\n bottom: 0,\n zIndex: '9999',\n width: '100%',\n display: 'flex',\n padding: '0 15px',\n position: 'fixed',\n background: '#fff',\n }),\n});\n\nexport class ActivityTrackerComponent extends React.Component<IActivityTrackerProps, any> {\n public span: any;\n public idle: any;\n public onIdle: any;\n public onActive: any;\n\n public stop$ = new Subject();\n public mouse$: Observable<any>;\n public activity$: Observable<any>;\n public state = { inactive: false };\n public scheduler: IActivityScheduler;\n\n public componentDidMount() {\n this.scheduler = new ActivityScheduler({});\n\n this.scheduler\n .tick$\n .pipe(\n takeUntil(this.stop$),\n map(() => this.scheduler.prepare('user-i', {})),\n flatMap(request => this.scheduler.collect(request)),\n ).subscribe(() => { /** todos */ });\n\n this.mouse$ = fromEvent(document, 'mousemove')\n .pipe(\n takeUntil(this.stop$),\n map(() => this.setState({ inactive: false })),\n );\n\n merge(\n this.mouse$,\n this.props.stream,\n ).pipe(\n takeUntil(this.stop$),\n debounceTime(ACTIVITY_DEBOUNCE),\n\n ).subscribe((data) => this.setState({ inactive: true }));\n }\n\n public componentWillUnmount() {\n this.stop$.next(-1);\n this.stop$.complete();\n\n if (this.span) {\n this.span.finish();\n delete this.span; // Delete span objct from component\n }\n }\n\n private _onActive() {\n this.idle.finish();\n }\n\n private _onIdle() {\n alert('Idle!');\n this.idle = (tracer as any).startSpan('idle', { childOf: this.span });\n this.idle.log({ type: 'ns' });\n }\n\n public render() {\n return (\n <React.Fragment>\n <IdleTimer\n timeout={5000}\n element={document}\n onIdle={this.onIdle}\n onActive={this.onActive}\n >\n {this.props.children}\n </IdleTimer>\n </React.Fragment>\n );\n }\n}\n\nexport const ActivityTracker: any = ActivityTrackerComponent;\n","import * as Logger from 'bunyan';\nimport { client } from './apollo-client';\nimport { ZipkinGraphqlLogger } from './classes/ZipkinGraphqlLogger';\n\nimport * as zipkin from 'zipkin';\nimport * as opentracing from 'opentracing';\nimport { HttpLogger } from 'zipkin-transport-http';\nimport ZipkinOpentracing from 'zipkin-javascript-opentracing';\n\nexport const tracer = new ZipkinOpentracing({\n ctxImpl: new zipkin.ExplicitContext(),\n recorder: new zipkin.BatchRecorder({\n logger: new ZipkinGraphqlLogger({\n client,\n }),\n }),\n kind: 'client',\n serviceName: 'frontend',\n sampler: new zipkin.sampler.CountingSampler(100),\n});\n","import * as React from 'react';\nimport { Subject } from 'rxjs';\nimport { Feature, IRouteData, IMenuPosition } from '@common-stack/client-react';\n\nconst stream = new Subject();\n\nimport { activity } from './activity-link';\nimport { ActivityTracker } from './components/ActivityTracker';\n\nexport default new Feature({\n link: activity(stream),\n rootComponentFactory: req => <ActivityTracker stream={stream} />,\n} as any);\n\n\n","import { Observable, interval } from 'rxjs';\nconst opentracing = require('opentracing');\n\nimport { IActivityScheduler, IActivityCollectRequest } from './interfaces';\n\nexport interface ISchedulerProps {\n interval?: number;\n}\n\nexport class ActivityScheduler implements IActivityScheduler {\n public interval: number;\n public tick$: Observable<number>;\n private client = opentracing.globalTracer();\n private span = this.client.startSpan('UserActivity');\n\n constructor(props: ISchedulerProps) {\n this.interval = props.interval || 10000;\n this.tick$ = interval(this.interval);\n }\n\n public prepare(user, payload = {}): IActivityCollectRequest {\n const ts = Date.now();\n return {\n user,\n scope: 'User',\n timestamp: ts,\n duration: this.interval,\n payload: JSON.stringify(payload),\n annotations: JSON.stringify([{\n timestamp: ts,\n value: `user=${user}`,\n }]),\n };\n }\n\n public async collect(request: IActivityCollectRequest): Promise<boolean> {\n try {\n const ok = await this.span.log(request);\n\n this.span.finish();\n this.span = this.client.startSpan('UserActivity');\n return true;\n } catch (e) {\n console.log('ERROR: ', { e, request });\n return false;\n }\n }\n}\n","module.exports = require(\"@apollo/client\");","module.exports = require(\"@apollo/client/cache\");","module.exports = require(\"@apollo/client/link/http\");","module.exports = require(\"@common-stack/client-react\");","module.exports = require(\"apollo-link-logger\");","module.exports = require(\"bunyan\");","module.exports = require(\"events\");","module.exports = require(\"graphql-tag\");","module.exports = require(\"opentracing\");","module.exports = require(\"react\");","module.exports = require(\"react-idle-timer\");","module.exports = require(\"rxjs\");","module.exports = require(\"rxjs/operators\");","module.exports = require(\"zipkin\");","module.exports = require(\"zipkin-javascript-opentracing\");"],"sourceRoot":""}
1
+ {"version":3,"file":"index.js","mappings":";;;;;;;;;;;;;AAEA,6EAA4C;AAErC,MAAM,QAAQ,GAAG,CAAC,OAAqB,EAAE,EAAE,CAC9C,IAAI,mBAAU,CAAC,CAAC,SAAS,EAAE,OAAO,EAAE,EAAE;IAClC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACnB,OAAO,OAAO,CAAC,SAAS,CAAC,CAAC;AAC9B,CAAC,CAAC,CAAC;AAJM,gBAAQ,YAId;;;;;;;;;;;;;;;;;ACRP,+FAAoD;AACpD,6EAA0D;AAC1D,kHAA8C;AAC9C,wFAAqD;AAErD,MAAM,KAAK,GAAG,IAAI,qBAAa,EAAE,CAAC;AAErB,cAAM,GAAG,IAAI,qBAAY,CAAC;IACnC,KAAK;IACL,IAAI,EAAE,mBAAU,CAAC,IAAI,CAAC;QAClB,4BAAY;QACZ,IAAI,eAAQ,CAAC,EAAE,GAAG,EAAE,+BAA+B,EAAE,CAAC;KACzD,CAAC;CACL,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACbH,6FAA8B;AAC9B,yEAAiC;AAGjC,MAAM,EACF,WAAW,EAAE,EAAE,OAAO,EAAE,GACzB,GAAG,mBAAO,CAAC,sBAAQ,CAAC,CAAC;AAExB,MAAM,YAAY,GAAG,0DAA8B,CAAC;AAWpD,MAAM,kBAAkB,GAAG,yBAAG;;;;CAI7B,CAAC;AAEF,MAAa,mBAAoB,SAAQ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;;;;;ACAA;;;;;;;;;;ACAA;;;;;;;;;;ACAA;;;;;;UCAA;UACA;;UAEA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;;UAEA;UACA;;UAEA;UACA;UACA;;;;UEtBA;UACA;UACA;UACA","sources":["webpack://@adminide-stack/user-activity-browser/./src/activity-link.ts","webpack://@adminide-stack/user-activity-browser/./src/apollo-client.ts","webpack://@adminide-stack/user-activity-browser/./src/classes/ZipkinGraphqlLogger.ts","webpack://@adminide-stack/user-activity-browser/./src/components/ActivityTracker.tsx","webpack://@adminide-stack/user-activity-browser/./src/graphql-tracer.ts","webpack://@adminide-stack/user-activity-browser/./src/index.tsx","webpack://@adminide-stack/user-activity-browser/./src/scheduler.ts","webpack://@adminide-stack/user-activity-browser/external commonjs \"@apollo/client\"","webpack://@adminide-stack/user-activity-browser/external commonjs \"@apollo/client/cache\"","webpack://@adminide-stack/user-activity-browser/external commonjs \"@apollo/client/link/http\"","webpack://@adminide-stack/user-activity-browser/external commonjs \"@common-stack/client-react\"","webpack://@adminide-stack/user-activity-browser/external commonjs \"apollo-link-logger\"","webpack://@adminide-stack/user-activity-browser/external commonjs \"bunyan\"","webpack://@adminide-stack/user-activity-browser/external commonjs \"events\"","webpack://@adminide-stack/user-activity-browser/external commonjs \"graphql-tag\"","webpack://@adminide-stack/user-activity-browser/external commonjs \"opentracing\"","webpack://@adminide-stack/user-activity-browser/external commonjs \"react\"","webpack://@adminide-stack/user-activity-browser/external commonjs \"react-idle-timer\"","webpack://@adminide-stack/user-activity-browser/external commonjs \"rxjs\"","webpack://@adminide-stack/user-activity-browser/external commonjs \"rxjs/operators\"","webpack://@adminide-stack/user-activity-browser/external commonjs \"zipkin\"","webpack://@adminide-stack/user-activity-browser/external commonjs \"zipkin-javascript-opentracing\"","webpack://@adminide-stack/user-activity-browser/webpack/bootstrap","webpack://@adminide-stack/user-activity-browser/webpack/before-startup","webpack://@adminide-stack/user-activity-browser/webpack/startup","webpack://@adminide-stack/user-activity-browser/webpack/after-startup"],"sourcesContent":["import * as _ from 'lodash';\nimport { Subject } from 'rxjs';\nimport { ApolloLink } from '@apollo/client';\n\nexport const activity = (subject: Subject<any>) =>\n new ApolloLink((operation, forward) => {\n subject.next(true);\n return forward(operation);\n });\n","import { HttpLink } from '@apollo/client/link/http';\nimport { ApolloClient, ApolloLink } from '@apollo/client';\nimport apolloLogger from 'apollo-link-logger';\nimport { InMemoryCache } from '@apollo/client/cache';\n\nconst cache = new InMemoryCache();\n\nexport const client = new ApolloClient({\n cache,\n link: ApolloLink.from([\n apolloLogger,\n new HttpLink({ uri: `http://localhost:8081/graphql` }),\n ]),\n});\n","import gql from 'graphql-tag';\nimport * as Logger from 'bunyan';\nimport { ApolloClient } from '@apollo/client';\n\nconst {\n jsonEncoder: { JSON_V1 },\n } = require('zipkin');\n\nconst EventEmitter = require('events').EventEmitter;\n\nexport interface IZipkinGraphqlLoggerOptions {\n logger?: Logger;\n timeout?: number;\n jsonEncoder?: any;\n httpInterval?: number;\n maxPayloadSize?: number;\n client: ApolloClient<any>;\n}\n\nconst SEND_SPAN_MUTATION = gql`\n mutation batch($queue: [String]) {\n batchSpan(queue: $queue)\n }\n`;\n\nexport class ZipkinGraphqlLogger extends EventEmitter {\n private client: ApolloClient<any>;\n private queue;\n private queueBytes;\n private errorListenerSet;\n private logger;\n private timeout;\n private maxPayloadSize;\n private httpInterval;\n private jsonEncoder;\n\n constructor({\n logger,\n client,\n timeout = 0,\n maxPayloadSize = 0,\n httpInterval = 1000,\n jsonEncoder = JSON_V1,\n }: IZipkinGraphqlLoggerOptions) {\n super();\n this.queue = [];\n this.client = client;\n this.queueBytes = 0;\n this.jsonEncoder = jsonEncoder;\n this.maxPayloadSize = maxPayloadSize;\n this.logger = logger || Logger.createLogger({ name: ZipkinGraphqlLogger.name });\n\n this.errorListenerSet = false;\n\n // req/res timeout in ms, it resets on redirect. 0 to disable (OS limit applies)\n // only supported by node-fetch; silently ignored by browser fetch clients\n // @see https://github.com/bitinn/node-fetch#fetch-options\n this.timeout = timeout;\n\n const timer = setInterval(() => {\n this.processQueue();\n }, httpInterval);\n \n // if (timer.unref) { // unref might not be available in browsers\n // timer.unref(); // Allows Node to terminate instead of blocking on timer\n // }\n }\n\n public _getPayloadSize(nextSpan) {\n // Our payload is in format '[s1,s2,s3]', so we need to add 2 brackets and\n // one comma separator for each payload, including the next span if defined\n return nextSpan\n ? this.queueBytes + 2 + this.queue.length + nextSpan.length\n : this.queueBytes + 2 + Math.min(this.queue.length - 1, 0);\n }\n\n public on(...args) {\n const eventName = args[0];\n // if the instance has an error handler set then we don't need to\n // skips error logging\n if (eventName.toLowerCase() === 'error') {\n this.errorListenerSet = true;\n }\n super.on.apply(this, args);\n }\n\n public logSpan(span) {\n const encodedSpan = this.jsonEncoder.encode(span);\n if (this.maxPayloadSize && this._getPayloadSize(encodedSpan) > this.maxPayloadSize) {\n this.processQueue();\n if (this._getPayloadSize(encodedSpan) > this.maxPayloadSize) {\n // Payload size is too large even with an empty queue, can only drop\n const err = 'Zipkin span got dropped, reason: payload too large';\n if (this.errorListenerSet) {\n this.emit('error', new Error(err));\n } else {\n this.log.error(err);\n }\n return;\n }\n }\n this.queue.push(encodedSpan);\n this.queueBytes += encodedSpan.length;\n }\n\n public processQueue() {\n if (this.queue.length > 0) {\n this.client.mutate({ mutation: SEND_SPAN_MUTATION, variables: { queue: this.queue } });\n\n this.queue.length = 0;\n this.queueBytes = 0;\n }\n }\n}\n","import * as React from 'react';\nimport { compose } from 'redux';\nimport IdleTimer from 'react-idle-timer';\nimport { Subject, Observable, fromEvent, merge } from 'rxjs';\nimport { tracer } from '../graphql-tracer';\nimport { ActivityScheduler } from '../scheduler';\nimport { IActivityScheduler } from '../interfaces';\nimport { takeUntil, map, flatMap, debounceTime } from 'rxjs/operators';\n\nexport interface IActivityTrackerProps {\n stream: Subject<any>;\n}\n\n// export const ACTIVITY_DEBOUNCE = 10000;\nexport const ACTIVITY_DEBOUNCE = 900000;\n\nexport const styles = ({\n footer: ({\n bottom: 0,\n zIndex: '9999',\n width: '100%',\n display: 'flex',\n padding: '0 15px',\n position: 'fixed',\n background: '#fff',\n }),\n});\n\nexport class ActivityTrackerComponent extends React.Component<IActivityTrackerProps, any> {\n public span: any;\n public idle: any;\n public onIdle: any;\n public onActive: any;\n\n public stop$ = new Subject();\n public mouse$: Observable<any>;\n public activity$: Observable<any>;\n public state = { inactive: false };\n public scheduler: IActivityScheduler;\n\n public componentDidMount() {\n this.scheduler = new ActivityScheduler({});\n\n this.scheduler\n .tick$\n .pipe(\n takeUntil(this.stop$),\n map(() => this.scheduler.prepare('user-i', {})),\n flatMap(request => this.scheduler.collect(request)),\n ).subscribe(() => { /** todos */ });\n\n this.mouse$ = fromEvent(document, 'mousemove')\n .pipe(\n takeUntil(this.stop$),\n map(() => this.setState({ inactive: false })),\n );\n\n merge(\n this.mouse$,\n this.props.stream,\n ).pipe(\n takeUntil(this.stop$),\n debounceTime(ACTIVITY_DEBOUNCE),\n\n ).subscribe((data) => this.setState({ inactive: true }));\n }\n\n public componentWillUnmount() {\n this.stop$.next(-1);\n this.stop$.complete();\n\n if (this.span) {\n this.span.finish();\n delete this.span; // Delete span objct from component\n }\n }\n\n private _onActive() {\n this.idle.finish();\n }\n\n private _onIdle() {\n alert('Idle!');\n this.idle = (tracer as any).startSpan('idle', { childOf: this.span });\n this.idle.log({ type: 'ns' });\n }\n\n public render() {\n return (\n <React.Fragment>\n <IdleTimer\n timeout={5000}\n element={document}\n onIdle={this.onIdle}\n onActive={this.onActive}\n >\n {this.props.children}\n </IdleTimer>\n </React.Fragment>\n );\n }\n}\n\nexport const ActivityTracker: any = ActivityTrackerComponent;\n","import * as Logger from 'bunyan';\nimport { client } from './apollo-client';\nimport { ZipkinGraphqlLogger } from './classes/ZipkinGraphqlLogger';\n\nimport * as zipkin from 'zipkin';\nimport * as opentracing from 'opentracing';\nimport { HttpLogger } from 'zipkin-transport-http';\nimport ZipkinOpentracing from 'zipkin-javascript-opentracing';\n\nexport const tracer = new ZipkinOpentracing({\n ctxImpl: new zipkin.ExplicitContext(),\n recorder: new zipkin.BatchRecorder({\n logger: new ZipkinGraphqlLogger({\n client,\n }),\n }),\n kind: 'client',\n serviceName: 'frontend',\n sampler: new zipkin.sampler.CountingSampler(100),\n});\n","import * as React from 'react';\nimport { Subject } from 'rxjs';\nimport { Feature, IRouteData, IMenuPosition } from '@common-stack/client-react';\n\nconst stream = new Subject();\n\nimport { activity } from './activity-link';\nimport { ActivityTracker } from './components/ActivityTracker';\n\nexport default new Feature({\n link: activity(stream),\n rootComponentFactory: req => <ActivityTracker stream={stream} />,\n} as any);\n\n\n","import { Observable, interval } from 'rxjs';\nconst opentracing = require('opentracing');\n\nimport { IActivityScheduler, IActivityCollectRequest } from './interfaces';\n\nexport interface ISchedulerProps {\n interval?: number;\n}\n\nexport class ActivityScheduler implements IActivityScheduler {\n public interval: number;\n public tick$: Observable<number>;\n private client = opentracing.globalTracer();\n private span = this.client.startSpan('UserActivity');\n\n constructor(props: ISchedulerProps) {\n this.interval = props.interval || 10000;\n this.tick$ = interval(this.interval);\n }\n\n public prepare(user, payload = {}): IActivityCollectRequest {\n const ts = Date.now();\n return {\n user,\n scope: 'User',\n timestamp: ts,\n duration: this.interval,\n payload: JSON.stringify(payload),\n annotations: JSON.stringify([{\n timestamp: ts,\n value: `user=${user}`,\n }]),\n };\n }\n\n public async collect(request: IActivityCollectRequest): Promise<boolean> {\n try {\n const ok = await this.span.log(request);\n\n this.span.finish();\n this.span = this.client.startSpan('UserActivity');\n return true;\n } catch (e) {\n console.log('ERROR: ', { e, request });\n return false;\n }\n }\n}\n","module.exports = require(\"@apollo/client\");","module.exports = require(\"@apollo/client/cache\");","module.exports = require(\"@apollo/client/link/http\");","module.exports = require(\"@common-stack/client-react\");","module.exports = require(\"apollo-link-logger\");","module.exports = require(\"bunyan\");","module.exports = require(\"events\");","module.exports = require(\"graphql-tag\");","module.exports = require(\"opentracing\");","module.exports = require(\"react\");","module.exports = require(\"react-idle-timer\");","module.exports = require(\"rxjs\");","module.exports = require(\"rxjs/operators\");","module.exports = require(\"zipkin\");","module.exports = require(\"zipkin-javascript-opentracing\");","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","","// startup\n// Load entry module and return exports\n// This entry module is referenced by other modules so it can't be inlined\nvar __webpack_exports__ = __webpack_require__(\"./src/index.tsx\");\n",""],"names":[],"sourceRoot":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminide-stack/user-activity-browser",
3
- "version": "1.1.3-alpha.17",
3
+ "version": "1.1.3-alpha.50",
4
4
  "description": "Sample core for higher packages to depend on",
5
5
  "license": "ISC",
6
6
  "author": "CDMBase LLC",
@@ -54,5 +54,5 @@
54
54
  "typescript": {
55
55
  "definition": "lib/index.d.ts"
56
56
  },
57
- "gitHead": "0232458f42ff3066242bd5e9ea0307f17a31fb5e"
57
+ "gitHead": "9bc2afaf90915c3229be162e6b599b9540edc622"
58
58
  }