@ngxs/logger-plugin 3.7.6-dev.master-fb318b1 → 3.7.6-dev.master-dcdd391
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/bundles/ngxs-logger-plugin.umd.js +72 -546
- package/bundles/ngxs-logger-plugin.umd.js.map +1 -1
- package/esm2015/index.js +2 -6
- package/esm2015/ngxs-logger-plugin.js +2 -7
- package/esm2015/src/action-logger.js +3 -65
- package/esm2015/src/internals.js +3 -23
- package/esm2015/src/log-writer.js +2 -60
- package/esm2015/src/logger.module.js +10 -23
- package/esm2015/src/logger.plugin.js +14 -58
- package/esm2015/src/public_api.js +2 -6
- package/esm2015/src/symbols.js +1 -32
- package/fesm2015/ngxs-logger-plugin.js +30 -266
- package/fesm2015/ngxs-logger-plugin.js.map +1 -1
- package/ngxs-logger-plugin.d.ts +1 -1
- package/package.json +3 -6
- package/src/logger.module.d.ts +5 -1
- package/src/logger.plugin.d.ts +3 -0
- package/src/symbols.d.ts +1 -1
- package/bundles/ngxs-logger-plugin.umd.min.js +0 -16
- package/bundles/ngxs-logger-plugin.umd.min.js.map +0 -1
- package/esm5/index.js +0 -9
- package/esm5/ngxs-logger-plugin.js +0 -10
- package/esm5/src/action-logger.js +0 -121
- package/esm5/src/internals.js +0 -34
- package/esm5/src/log-writer.js +0 -147
- package/esm5/src/logger.module.js +0 -67
- package/esm5/src/logger.plugin.js +0 -86
- package/esm5/src/public_api.js +0 -8
- package/esm5/src/symbols.js +0 -34
- package/fesm5/ngxs-logger-plugin.js +0 -492
- package/fesm5/ngxs-logger-plugin.js.map +0 -1
- package/ngxs-logger-plugin.metadata.json +0 -1
|
@@ -1,252 +1,31 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
2
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@ngxs/store'), require('rxjs/operators')) :
|
|
3
3
|
typeof define === 'function' && define.amd ? define('@ngxs/logger-plugin', ['exports', '@angular/core', '@ngxs/store', 'rxjs/operators'], factory) :
|
|
4
|
-
(global = global || self, factory((global.ngxs = global.ngxs || {}, global.ngxs[
|
|
5
|
-
}(this, function (exports,
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.ngxs = global.ngxs || {}, global.ngxs["logger-plugin"] = {}), global.ng.core, global["ngxs-store"], global.rxjs.operators));
|
|
5
|
+
})(this, (function (exports, i0, store, operators) { 'use strict';
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
var extendStatics = function(d, b) {
|
|
24
|
-
extendStatics = Object.setPrototypeOf ||
|
|
25
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
26
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
27
|
-
return extendStatics(d, b);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
function __extends(d, b) {
|
|
31
|
-
extendStatics(d, b);
|
|
32
|
-
function __() { this.constructor = d; }
|
|
33
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
var __assign = function() {
|
|
37
|
-
__assign = Object.assign || function __assign(t) {
|
|
38
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
39
|
-
s = arguments[i];
|
|
40
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
41
|
-
}
|
|
42
|
-
return t;
|
|
43
|
-
};
|
|
44
|
-
return __assign.apply(this, arguments);
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
function __rest(s, e) {
|
|
48
|
-
var t = {};
|
|
49
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
50
|
-
t[p] = s[p];
|
|
51
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
52
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
53
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
54
|
-
t[p[i]] = s[p[i]];
|
|
55
|
-
}
|
|
56
|
-
return t;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function __decorate(decorators, target, key, desc) {
|
|
60
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
61
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
62
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
63
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function __param(paramIndex, decorator) {
|
|
67
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function __metadata(metadataKey, metadataValue) {
|
|
71
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
75
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
76
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
77
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
78
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
79
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
80
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
function __generator(thisArg, body) {
|
|
85
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
86
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
87
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
88
|
-
function step(op) {
|
|
89
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
90
|
-
while (_) try {
|
|
91
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
92
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
93
|
-
switch (op[0]) {
|
|
94
|
-
case 0: case 1: t = op; break;
|
|
95
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
96
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
97
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
98
|
-
default:
|
|
99
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
100
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
101
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
102
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
103
|
-
if (t[2]) _.ops.pop();
|
|
104
|
-
_.trys.pop(); continue;
|
|
105
|
-
}
|
|
106
|
-
op = body.call(thisArg, _);
|
|
107
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
108
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
function __createBinding(o, m, k, k2) {
|
|
113
|
-
if (k2 === undefined) k2 = k;
|
|
114
|
-
o[k2] = m[k];
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
function __exportStar(m, exports) {
|
|
118
|
-
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p];
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
function __values(o) {
|
|
122
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
123
|
-
if (m) return m.call(o);
|
|
124
|
-
if (o && typeof o.length === "number") return {
|
|
125
|
-
next: function () {
|
|
126
|
-
if (o && i >= o.length) o = void 0;
|
|
127
|
-
return { value: o && o[i++], done: !o };
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
function __read(o, n) {
|
|
134
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
135
|
-
if (!m) return o;
|
|
136
|
-
var i = m.call(o), r, ar = [], e;
|
|
137
|
-
try {
|
|
138
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
139
|
-
}
|
|
140
|
-
catch (error) { e = { error: error }; }
|
|
141
|
-
finally {
|
|
142
|
-
try {
|
|
143
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
144
|
-
}
|
|
145
|
-
finally { if (e) throw e.error; }
|
|
146
|
-
}
|
|
147
|
-
return ar;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
function __spread() {
|
|
151
|
-
for (var ar = [], i = 0; i < arguments.length; i++)
|
|
152
|
-
ar = ar.concat(__read(arguments[i]));
|
|
153
|
-
return ar;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
function __spreadArrays() {
|
|
157
|
-
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
|
|
158
|
-
for (var r = Array(s), k = 0, i = 0; i < il; i++)
|
|
159
|
-
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
|
|
160
|
-
r[k] = a[j];
|
|
161
|
-
return r;
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
function __await(v) {
|
|
165
|
-
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
169
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
170
|
-
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
171
|
-
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
172
|
-
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
|
173
|
-
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
174
|
-
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
175
|
-
function fulfill(value) { resume("next", value); }
|
|
176
|
-
function reject(value) { resume("throw", value); }
|
|
177
|
-
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
function __asyncDelegator(o) {
|
|
181
|
-
var i, p;
|
|
182
|
-
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
|
183
|
-
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
function __asyncValues(o) {
|
|
187
|
-
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
188
|
-
var m = o[Symbol.asyncIterator], i;
|
|
189
|
-
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
190
|
-
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
191
|
-
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
function __makeTemplateObject(cooked, raw) {
|
|
195
|
-
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
196
|
-
return cooked;
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
function __importStar(mod) {
|
|
200
|
-
if (mod && mod.__esModule) return mod;
|
|
201
|
-
var result = {};
|
|
202
|
-
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
203
|
-
result.default = mod;
|
|
204
|
-
return result;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
function __importDefault(mod) {
|
|
208
|
-
return (mod && mod.__esModule) ? mod : { default: mod };
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
function __classPrivateFieldGet(receiver, privateMap) {
|
|
212
|
-
if (!privateMap.has(receiver)) {
|
|
213
|
-
throw new TypeError("attempted to get private field on non-instance");
|
|
214
|
-
}
|
|
215
|
-
return privateMap.get(receiver);
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
function __classPrivateFieldSet(receiver, privateMap, value) {
|
|
219
|
-
if (!privateMap.has(receiver)) {
|
|
220
|
-
throw new TypeError("attempted to set private field on non-instance");
|
|
221
|
-
}
|
|
222
|
-
privateMap.set(receiver, value);
|
|
223
|
-
return value;
|
|
7
|
+
function _interopNamespace(e) {
|
|
8
|
+
if (e && e.__esModule) return e;
|
|
9
|
+
var n = Object.create(null);
|
|
10
|
+
if (e) {
|
|
11
|
+
Object.keys(e).forEach(function (k) {
|
|
12
|
+
if (k !== 'default') {
|
|
13
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
14
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () { return e[k]; }
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
n["default"] = e;
|
|
22
|
+
return Object.freeze(n);
|
|
224
23
|
}
|
|
225
24
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
/** @type {?} */
|
|
231
|
-
var repeat = (/**
|
|
232
|
-
* @param {?} str
|
|
233
|
-
* @param {?} times
|
|
234
|
-
* @return {?}
|
|
235
|
-
*/
|
|
236
|
-
function (str, times) { return new Array(times + 1).join(str); });
|
|
237
|
-
/** @type {?} */
|
|
238
|
-
var pad = (/**
|
|
239
|
-
* @param {?} num
|
|
240
|
-
* @param {?} maxLength
|
|
241
|
-
* @return {?}
|
|
242
|
-
*/
|
|
243
|
-
function (num, maxLength) {
|
|
244
|
-
return repeat('0', maxLength - num.toString().length) + num;
|
|
245
|
-
});
|
|
246
|
-
/**
|
|
247
|
-
* @param {?} time
|
|
248
|
-
* @return {?}
|
|
249
|
-
*/
|
|
25
|
+
var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
|
|
26
|
+
|
|
27
|
+
var repeat = function (str, times) { return new Array(times + 1).join(str); };
|
|
28
|
+
var pad = function (num, maxLength) { return repeat('0', maxLength - num.toString().length) + num; };
|
|
250
29
|
function formatTime(time) {
|
|
251
30
|
return (pad(time.getHours(), 2) +
|
|
252
31
|
":" +
|
|
@@ -257,143 +36,51 @@
|
|
|
257
36
|
pad(time.getMilliseconds(), 3));
|
|
258
37
|
}
|
|
259
38
|
|
|
260
|
-
/**
|
|
261
|
-
* @fileoverview added by tsickle
|
|
262
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
263
|
-
*/
|
|
264
39
|
var ActionLogger = /** @class */ (function () {
|
|
265
40
|
function ActionLogger(action, store, logWriter) {
|
|
266
41
|
this.action = action;
|
|
267
42
|
this.store = store;
|
|
268
43
|
this.logWriter = logWriter;
|
|
269
44
|
}
|
|
270
|
-
|
|
271
|
-
* @param {?} state
|
|
272
|
-
* @return {?}
|
|
273
|
-
*/
|
|
274
|
-
ActionLogger.prototype.dispatched = /**
|
|
275
|
-
* @param {?} state
|
|
276
|
-
* @return {?}
|
|
277
|
-
*/
|
|
278
|
-
function (state) {
|
|
279
|
-
/** @type {?} */
|
|
45
|
+
ActionLogger.prototype.dispatched = function (state) {
|
|
280
46
|
var actionName = store.getActionTypeFromInstance(this.action);
|
|
281
|
-
/** @type {?} */
|
|
282
47
|
var formattedTime = formatTime(new Date());
|
|
283
|
-
/** @type {?} */
|
|
284
48
|
var message = "action " + actionName + " @ " + formattedTime;
|
|
285
49
|
this.logWriter.startGroup(message);
|
|
286
50
|
// print payload only if at least one property is supplied
|
|
287
51
|
if (this._hasPayload(this.action)) {
|
|
288
|
-
this.logWriter.logGrey('payload',
|
|
52
|
+
this.logWriter.logGrey('payload', Object.assign({}, this.action));
|
|
289
53
|
}
|
|
290
54
|
this.logWriter.logGrey('prev state', state);
|
|
291
55
|
};
|
|
292
|
-
|
|
293
|
-
* @param {?} nextState
|
|
294
|
-
* @return {?}
|
|
295
|
-
*/
|
|
296
|
-
ActionLogger.prototype.completed = /**
|
|
297
|
-
* @param {?} nextState
|
|
298
|
-
* @return {?}
|
|
299
|
-
*/
|
|
300
|
-
function (nextState) {
|
|
56
|
+
ActionLogger.prototype.completed = function (nextState) {
|
|
301
57
|
this.logWriter.logGreen('next state', nextState);
|
|
302
58
|
this.logWriter.endGroup();
|
|
303
59
|
};
|
|
304
|
-
|
|
305
|
-
* @param {?} error
|
|
306
|
-
* @return {?}
|
|
307
|
-
*/
|
|
308
|
-
ActionLogger.prototype.errored = /**
|
|
309
|
-
* @param {?} error
|
|
310
|
-
* @return {?}
|
|
311
|
-
*/
|
|
312
|
-
function (error) {
|
|
60
|
+
ActionLogger.prototype.errored = function (error) {
|
|
313
61
|
this.logWriter.logRedish('next state after error', this.store.snapshot());
|
|
314
62
|
this.logWriter.logRedish('error', error);
|
|
315
63
|
this.logWriter.endGroup();
|
|
316
64
|
};
|
|
317
|
-
|
|
318
|
-
* @private
|
|
319
|
-
* @param {?} event
|
|
320
|
-
* @return {?}
|
|
321
|
-
*/
|
|
322
|
-
ActionLogger.prototype._hasPayload = /**
|
|
323
|
-
* @private
|
|
324
|
-
* @param {?} event
|
|
325
|
-
* @return {?}
|
|
326
|
-
*/
|
|
327
|
-
function (event) {
|
|
328
|
-
/** @type {?} */
|
|
65
|
+
ActionLogger.prototype._hasPayload = function (event) {
|
|
329
66
|
var nonEmptyProperties = this._getNonEmptyProperties(event);
|
|
330
67
|
return nonEmptyProperties.length > 0;
|
|
331
68
|
};
|
|
332
|
-
|
|
333
|
-
* @private
|
|
334
|
-
* @param {?} event
|
|
335
|
-
* @return {?}
|
|
336
|
-
*/
|
|
337
|
-
ActionLogger.prototype._getNonEmptyProperties = /**
|
|
338
|
-
* @private
|
|
339
|
-
* @param {?} event
|
|
340
|
-
* @return {?}
|
|
341
|
-
*/
|
|
342
|
-
function (event) {
|
|
343
|
-
/** @type {?} */
|
|
69
|
+
ActionLogger.prototype._getNonEmptyProperties = function (event) {
|
|
344
70
|
var keys = Object.keys(event);
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
* @param {?} key
|
|
348
|
-
* @return {?}
|
|
349
|
-
*/
|
|
350
|
-
function (key) { return event[key]; }));
|
|
351
|
-
return values.filter((/**
|
|
352
|
-
* @param {?} value
|
|
353
|
-
* @return {?}
|
|
354
|
-
*/
|
|
355
|
-
function (value) { return value !== undefined; }));
|
|
71
|
+
var values = keys.map(function (key) { return event[key]; });
|
|
72
|
+
return values.filter(function (value) { return value !== undefined; });
|
|
356
73
|
};
|
|
357
74
|
return ActionLogger;
|
|
358
75
|
}());
|
|
359
|
-
if (false) {
|
|
360
|
-
/**
|
|
361
|
-
* @type {?}
|
|
362
|
-
* @private
|
|
363
|
-
*/
|
|
364
|
-
ActionLogger.prototype.action;
|
|
365
|
-
/**
|
|
366
|
-
* @type {?}
|
|
367
|
-
* @private
|
|
368
|
-
*/
|
|
369
|
-
ActionLogger.prototype.store;
|
|
370
|
-
/**
|
|
371
|
-
* @type {?}
|
|
372
|
-
* @private
|
|
373
|
-
*/
|
|
374
|
-
ActionLogger.prototype.logWriter;
|
|
375
|
-
}
|
|
376
76
|
|
|
377
|
-
/**
|
|
378
|
-
* @fileoverview added by tsickle
|
|
379
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
380
|
-
*/
|
|
381
77
|
var LogWriter = /** @class */ (function () {
|
|
382
78
|
function LogWriter(options) {
|
|
383
79
|
this.options = options;
|
|
384
|
-
this.options = this.options ||
|
|
80
|
+
this.options = this.options || {};
|
|
385
81
|
this.logger = options.logger || console;
|
|
386
82
|
}
|
|
387
|
-
|
|
388
|
-
* @param {?} message
|
|
389
|
-
* @return {?}
|
|
390
|
-
*/
|
|
391
|
-
LogWriter.prototype.startGroup = /**
|
|
392
|
-
* @param {?} message
|
|
393
|
-
* @return {?}
|
|
394
|
-
*/
|
|
395
|
-
function (message) {
|
|
396
|
-
/** @type {?} */
|
|
83
|
+
LogWriter.prototype.startGroup = function (message) {
|
|
397
84
|
var startGroupFn = this.options.collapsed
|
|
398
85
|
? this.logger.groupCollapsed
|
|
399
86
|
: this.logger.group;
|
|
@@ -404,13 +91,7 @@
|
|
|
404
91
|
console.log(message);
|
|
405
92
|
}
|
|
406
93
|
};
|
|
407
|
-
|
|
408
|
-
* @return {?}
|
|
409
|
-
*/
|
|
410
|
-
LogWriter.prototype.endGroup = /**
|
|
411
|
-
* @return {?}
|
|
412
|
-
*/
|
|
413
|
-
function () {
|
|
94
|
+
LogWriter.prototype.endGroup = function () {
|
|
414
95
|
try {
|
|
415
96
|
this.logger.groupEnd();
|
|
416
97
|
}
|
|
@@ -418,64 +99,19 @@
|
|
|
418
99
|
this.logger.log('—— log end ——');
|
|
419
100
|
}
|
|
420
101
|
};
|
|
421
|
-
|
|
422
|
-
* @param {?} title
|
|
423
|
-
* @param {?} payload
|
|
424
|
-
* @return {?}
|
|
425
|
-
*/
|
|
426
|
-
LogWriter.prototype.logGrey = /**
|
|
427
|
-
* @param {?} title
|
|
428
|
-
* @param {?} payload
|
|
429
|
-
* @return {?}
|
|
430
|
-
*/
|
|
431
|
-
function (title, payload) {
|
|
432
|
-
/** @type {?} */
|
|
102
|
+
LogWriter.prototype.logGrey = function (title, payload) {
|
|
433
103
|
var greyStyle = 'color: #9E9E9E; font-weight: bold';
|
|
434
104
|
this.log(title, greyStyle, payload);
|
|
435
105
|
};
|
|
436
|
-
|
|
437
|
-
* @param {?} title
|
|
438
|
-
* @param {?} payload
|
|
439
|
-
* @return {?}
|
|
440
|
-
*/
|
|
441
|
-
LogWriter.prototype.logGreen = /**
|
|
442
|
-
* @param {?} title
|
|
443
|
-
* @param {?} payload
|
|
444
|
-
* @return {?}
|
|
445
|
-
*/
|
|
446
|
-
function (title, payload) {
|
|
447
|
-
/** @type {?} */
|
|
106
|
+
LogWriter.prototype.logGreen = function (title, payload) {
|
|
448
107
|
var greenStyle = 'color: #4CAF50; font-weight: bold';
|
|
449
108
|
this.log(title, greenStyle, payload);
|
|
450
109
|
};
|
|
451
|
-
|
|
452
|
-
* @param {?} title
|
|
453
|
-
* @param {?} payload
|
|
454
|
-
* @return {?}
|
|
455
|
-
*/
|
|
456
|
-
LogWriter.prototype.logRedish = /**
|
|
457
|
-
* @param {?} title
|
|
458
|
-
* @param {?} payload
|
|
459
|
-
* @return {?}
|
|
460
|
-
*/
|
|
461
|
-
function (title, payload) {
|
|
462
|
-
/** @type {?} */
|
|
110
|
+
LogWriter.prototype.logRedish = function (title, payload) {
|
|
463
111
|
var redishStyle = 'color: #FD8182; font-weight: bold';
|
|
464
112
|
this.log(title, redishStyle, payload);
|
|
465
113
|
};
|
|
466
|
-
|
|
467
|
-
* @param {?} title
|
|
468
|
-
* @param {?} color
|
|
469
|
-
* @param {?} payload
|
|
470
|
-
* @return {?}
|
|
471
|
-
*/
|
|
472
|
-
LogWriter.prototype.log = /**
|
|
473
|
-
* @param {?} title
|
|
474
|
-
* @param {?} color
|
|
475
|
-
* @param {?} payload
|
|
476
|
-
* @return {?}
|
|
477
|
-
*/
|
|
478
|
-
function (title, color, payload) {
|
|
114
|
+
LogWriter.prototype.log = function (title, color, payload) {
|
|
479
115
|
if (this.isIE()) {
|
|
480
116
|
this.logger.log(title, payload);
|
|
481
117
|
}
|
|
@@ -483,22 +119,12 @@
|
|
|
483
119
|
this.logger.log('%c ' + title, color, payload);
|
|
484
120
|
}
|
|
485
121
|
};
|
|
486
|
-
|
|
487
|
-
* @return {?}
|
|
488
|
-
*/
|
|
489
|
-
LogWriter.prototype.isIE = /**
|
|
490
|
-
* @return {?}
|
|
491
|
-
*/
|
|
492
|
-
function () {
|
|
493
|
-
/** @type {?} */
|
|
122
|
+
LogWriter.prototype.isIE = function () {
|
|
494
123
|
var ua = typeof window !== 'undefined' && window.navigator.userAgent
|
|
495
124
|
? window.navigator.userAgent
|
|
496
125
|
: '';
|
|
497
|
-
/** @type {?} */
|
|
498
126
|
var msIE = false;
|
|
499
|
-
/** @type {?} */
|
|
500
127
|
var oldIE = ua.indexOf('MSIE ');
|
|
501
|
-
/** @type {?} */
|
|
502
128
|
var newIE = ua.indexOf('Trident/');
|
|
503
129
|
if (oldIE > -1 || newIE > -1) {
|
|
504
130
|
msIE = true;
|
|
@@ -507,166 +133,57 @@
|
|
|
507
133
|
};
|
|
508
134
|
return LogWriter;
|
|
509
135
|
}());
|
|
510
|
-
if (false) {
|
|
511
|
-
/**
|
|
512
|
-
* @type {?}
|
|
513
|
-
* @private
|
|
514
|
-
*/
|
|
515
|
-
LogWriter.prototype.logger;
|
|
516
|
-
/**
|
|
517
|
-
* @type {?}
|
|
518
|
-
* @private
|
|
519
|
-
*/
|
|
520
|
-
LogWriter.prototype.options;
|
|
521
|
-
}
|
|
522
136
|
|
|
523
|
-
|
|
524
|
-
* @fileoverview added by tsickle
|
|
525
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
526
|
-
*/
|
|
527
|
-
/**
|
|
528
|
-
* @record
|
|
529
|
-
*/
|
|
530
|
-
function NgxsLoggerPluginOptions() { }
|
|
531
|
-
if (false) {
|
|
532
|
-
/**
|
|
533
|
-
* Auto expand logged actions
|
|
534
|
-
* @type {?|undefined}
|
|
535
|
-
*/
|
|
536
|
-
NgxsLoggerPluginOptions.prototype.collapsed;
|
|
537
|
-
/**
|
|
538
|
-
* Provide alternate console.log implementation
|
|
539
|
-
* @type {?|undefined}
|
|
540
|
-
*/
|
|
541
|
-
NgxsLoggerPluginOptions.prototype.logger;
|
|
542
|
-
/**
|
|
543
|
-
* Disable the logger. Useful for prod mode.
|
|
544
|
-
* @type {?|undefined}
|
|
545
|
-
*/
|
|
546
|
-
NgxsLoggerPluginOptions.prototype.disabled;
|
|
547
|
-
/**
|
|
548
|
-
* Predicate for actions to be the logged. Takes action and state snapshot as parameters
|
|
549
|
-
* @type {?|undefined}
|
|
550
|
-
*/
|
|
551
|
-
NgxsLoggerPluginOptions.prototype.filter;
|
|
552
|
-
}
|
|
553
|
-
/** @type {?} */
|
|
554
|
-
var NGXS_LOGGER_PLUGIN_OPTIONS = new core.InjectionToken('NGXS_LOGGER_PLUGIN_OPTIONS');
|
|
137
|
+
var NGXS_LOGGER_PLUGIN_OPTIONS = new i0.InjectionToken('NGXS_LOGGER_PLUGIN_OPTIONS');
|
|
555
138
|
|
|
556
|
-
/**
|
|
557
|
-
* @fileoverview added by tsickle
|
|
558
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
559
|
-
*/
|
|
560
139
|
var NgxsLoggerPlugin = /** @class */ (function () {
|
|
561
140
|
function NgxsLoggerPlugin(_options, _injector) {
|
|
562
141
|
this._options = _options;
|
|
563
142
|
this._injector = _injector;
|
|
564
143
|
}
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
* @param {?} event
|
|
568
|
-
* @param {?} next
|
|
569
|
-
* @return {?}
|
|
570
|
-
*/
|
|
571
|
-
NgxsLoggerPlugin.prototype.handle = /**
|
|
572
|
-
* @param {?} state
|
|
573
|
-
* @param {?} event
|
|
574
|
-
* @param {?} next
|
|
575
|
-
* @return {?}
|
|
576
|
-
*/
|
|
577
|
-
function (state, event, next) {
|
|
578
|
-
if (this._options.disabled || !(/** @type {?} */ (this._options.filter))(event, state)) {
|
|
144
|
+
NgxsLoggerPlugin.prototype.handle = function (state, event, next) {
|
|
145
|
+
if (this._options.disabled || !this._options.filter(event, state)) {
|
|
579
146
|
return next(state, event);
|
|
580
147
|
}
|
|
581
148
|
this._logWriter = this._logWriter || new LogWriter(this._options);
|
|
582
149
|
// Retrieve lazily to avoid cyclic dependency exception
|
|
583
150
|
this._store = this._store || this._injector.get(store.Store);
|
|
584
|
-
/** @type {?} */
|
|
585
151
|
var actionLogger = new ActionLogger(event, this._store, this._logWriter);
|
|
586
152
|
actionLogger.dispatched(state);
|
|
587
|
-
return next(state, event).pipe(operators.tap((
|
|
588
|
-
* @param {?} nextState
|
|
589
|
-
* @return {?}
|
|
590
|
-
*/
|
|
591
|
-
function (nextState) {
|
|
153
|
+
return next(state, event).pipe(operators.tap(function (nextState) {
|
|
592
154
|
actionLogger.completed(nextState);
|
|
593
|
-
})
|
|
594
|
-
* @param {?} error
|
|
595
|
-
* @return {?}
|
|
596
|
-
*/
|
|
597
|
-
function (error) {
|
|
155
|
+
}), operators.catchError(function (error) {
|
|
598
156
|
actionLogger.errored(error);
|
|
599
157
|
throw error;
|
|
600
|
-
}))
|
|
158
|
+
}));
|
|
601
159
|
};
|
|
602
|
-
NgxsLoggerPlugin.decorators = [
|
|
603
|
-
{ type: core.Injectable }
|
|
604
|
-
];
|
|
605
|
-
/** @nocollapse */
|
|
606
|
-
NgxsLoggerPlugin.ctorParameters = function () { return [
|
|
607
|
-
{ type: undefined, decorators: [{ type: core.Inject, args: [NGXS_LOGGER_PLUGIN_OPTIONS,] }] },
|
|
608
|
-
{ type: core.Injector }
|
|
609
|
-
]; };
|
|
610
160
|
return NgxsLoggerPlugin;
|
|
611
161
|
}());
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
NgxsLoggerPlugin.prototype._logWriter;
|
|
623
|
-
/**
|
|
624
|
-
* @type {?}
|
|
625
|
-
* @private
|
|
626
|
-
*/
|
|
627
|
-
NgxsLoggerPlugin.prototype._options;
|
|
628
|
-
/**
|
|
629
|
-
* @type {?}
|
|
630
|
-
* @private
|
|
631
|
-
*/
|
|
632
|
-
NgxsLoggerPlugin.prototype._injector;
|
|
633
|
-
}
|
|
162
|
+
/** @nocollapse */ NgxsLoggerPlugin.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: NgxsLoggerPlugin, deps: [{ token: NGXS_LOGGER_PLUGIN_OPTIONS }, { token: i0__namespace.Injector }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
163
|
+
/** @nocollapse */ NgxsLoggerPlugin.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: NgxsLoggerPlugin });
|
|
164
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: NgxsLoggerPlugin, decorators: [{
|
|
165
|
+
type: i0.Injectable
|
|
166
|
+
}], ctorParameters: function () {
|
|
167
|
+
return [{ type: undefined, decorators: [{
|
|
168
|
+
type: i0.Inject,
|
|
169
|
+
args: [NGXS_LOGGER_PLUGIN_OPTIONS]
|
|
170
|
+
}] }, { type: i0__namespace.Injector }];
|
|
171
|
+
} });
|
|
634
172
|
|
|
635
|
-
|
|
636
|
-
* @fileoverview added by tsickle
|
|
637
|
-
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
638
|
-
*/
|
|
639
|
-
/** @type {?} */
|
|
640
|
-
var USER_OPTIONS = new core.InjectionToken('LOGGER_USER_OPTIONS');
|
|
641
|
-
/**
|
|
642
|
-
* @param {?} options
|
|
643
|
-
* @return {?}
|
|
644
|
-
*/
|
|
173
|
+
var USER_OPTIONS = new i0.InjectionToken('LOGGER_USER_OPTIONS');
|
|
645
174
|
function loggerOptionsFactory(options) {
|
|
646
|
-
/** @type {?} */
|
|
647
175
|
var defaultLoggerOptions = {
|
|
648
176
|
logger: console,
|
|
649
177
|
collapsed: false,
|
|
650
178
|
disabled: false,
|
|
651
|
-
filter: (
|
|
652
|
-
* @return {?}
|
|
653
|
-
*/
|
|
654
|
-
function () { return true; })
|
|
179
|
+
filter: function () { return true; }
|
|
655
180
|
};
|
|
656
|
-
return
|
|
181
|
+
return Object.assign(Object.assign({}, defaultLoggerOptions), options);
|
|
657
182
|
}
|
|
658
183
|
var NgxsLoggerPluginModule = /** @class */ (function () {
|
|
659
184
|
function NgxsLoggerPluginModule() {
|
|
660
185
|
}
|
|
661
|
-
|
|
662
|
-
* @param {?=} options
|
|
663
|
-
* @return {?}
|
|
664
|
-
*/
|
|
665
|
-
NgxsLoggerPluginModule.forRoot = /**
|
|
666
|
-
* @param {?=} options
|
|
667
|
-
* @return {?}
|
|
668
|
-
*/
|
|
669
|
-
function (options) {
|
|
186
|
+
NgxsLoggerPluginModule.forRoot = function (options) {
|
|
670
187
|
return {
|
|
671
188
|
ngModule: NgxsLoggerPluginModule,
|
|
672
189
|
providers: [
|
|
@@ -687,17 +204,26 @@
|
|
|
687
204
|
]
|
|
688
205
|
};
|
|
689
206
|
};
|
|
690
|
-
NgxsLoggerPluginModule.decorators = [
|
|
691
|
-
{ type: core.NgModule }
|
|
692
|
-
];
|
|
693
207
|
return NgxsLoggerPluginModule;
|
|
694
208
|
}());
|
|
209
|
+
/** @nocollapse */ NgxsLoggerPluginModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: NgxsLoggerPluginModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
210
|
+
/** @nocollapse */ NgxsLoggerPluginModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: NgxsLoggerPluginModule });
|
|
211
|
+
/** @nocollapse */ NgxsLoggerPluginModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: NgxsLoggerPluginModule });
|
|
212
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: NgxsLoggerPluginModule, decorators: [{
|
|
213
|
+
type: i0.NgModule
|
|
214
|
+
}] });
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* The public api for consumers of @ngxs/logger-plugin
|
|
218
|
+
*/
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Generated bundle index. Do not edit.
|
|
222
|
+
*/
|
|
695
223
|
|
|
696
224
|
exports.NGXS_LOGGER_PLUGIN_OPTIONS = NGXS_LOGGER_PLUGIN_OPTIONS;
|
|
697
225
|
exports.NgxsLoggerPlugin = NgxsLoggerPlugin;
|
|
698
226
|
exports.NgxsLoggerPluginModule = NgxsLoggerPluginModule;
|
|
699
|
-
exports.ɵa = USER_OPTIONS;
|
|
700
|
-
exports.ɵb = loggerOptionsFactory;
|
|
701
227
|
|
|
702
228
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
703
229
|
|