@ngxs/devtools-plugin 3.7.6 → 3.8.0-dev.master-c341c15

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.
@@ -1,110 +1,15 @@
1
- import { InjectionToken, ɵglobal, Injectable, Inject, Injector, NgZone, NgModule } from '@angular/core';
1
+ import * as i0 from '@angular/core';
2
+ import { InjectionToken, ɵglobal, Injectable, Inject, NgModule } from '@angular/core';
2
3
  import { Store, getActionTypeFromInstance, NGXS_PLUGINS } from '@ngxs/store';
3
4
  import { catchError, tap } from 'rxjs/operators';
4
5
 
5
- /**
6
- * @fileoverview added by tsickle
7
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
8
- */
9
- /**
10
- * Interface for the redux-devtools-extension API.
11
- * @record
12
- */
13
- function NgxsDevtoolsExtension() { }
14
- if (false) {
15
- /**
16
- * @param {?} state
17
- * @return {?}
18
- */
19
- NgxsDevtoolsExtension.prototype.init = function (state) { };
20
- /**
21
- * @param {?} action
22
- * @param {?=} state
23
- * @return {?}
24
- */
25
- NgxsDevtoolsExtension.prototype.send = function (action, state) { };
26
- /**
27
- * @param {?} fn
28
- * @return {?}
29
- */
30
- NgxsDevtoolsExtension.prototype.subscribe = function (fn) { };
31
- }
32
- /**
33
- * @record
34
- */
35
- function NgxsDevtoolsAction() { }
36
- if (false) {
37
- /** @type {?} */
38
- NgxsDevtoolsAction.prototype.type;
39
- /** @type {?} */
40
- NgxsDevtoolsAction.prototype.payload;
41
- /** @type {?} */
42
- NgxsDevtoolsAction.prototype.state;
43
- /** @type {?} */
44
- NgxsDevtoolsAction.prototype.id;
45
- /** @type {?} */
46
- NgxsDevtoolsAction.prototype.source;
47
- }
48
- /**
49
- * @record
50
- */
51
- function NgxsDevtoolsOptions() { }
52
- if (false) {
53
- /**
54
- * The name of the extension
55
- * @type {?|undefined}
56
- */
57
- NgxsDevtoolsOptions.prototype.name;
58
- /**
59
- * Whether the dev tools is enabled or note. Useful for setting during production.
60
- * @type {?|undefined}
61
- */
62
- NgxsDevtoolsOptions.prototype.disabled;
63
- /**
64
- * Max number of entiries to keep.
65
- * @type {?|undefined}
66
- */
67
- NgxsDevtoolsOptions.prototype.maxAge;
68
- /**
69
- * Reformat actions before sending to dev tools
70
- * @type {?|undefined}
71
- */
72
- NgxsDevtoolsOptions.prototype.actionSanitizer;
73
- /**
74
- * Reformat state before sending to devtools
75
- * @type {?|undefined}
76
- */
77
- NgxsDevtoolsOptions.prototype.stateSanitizer;
78
- }
79
- /** @type {?} */
80
6
  const NGXS_DEVTOOLS_OPTIONS = new InjectionToken('NGXS_DEVTOOLS_OPTIONS');
81
7
 
82
- /**
83
- * @fileoverview added by tsickle
84
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
85
- */
86
- /** @enum {string} */
87
- const ReduxDevtoolsActionType = {
88
- Dispatch: 'DISPATCH',
89
- Action: 'ACTION',
90
- };
91
- /** @enum {string} */
92
- const ReduxDevtoolsPayloadType = {
93
- JumpToAction: 'JUMP_TO_ACTION',
94
- JumpToState: 'JUMP_TO_STATE',
95
- ToggleAction: 'TOGGLE_ACTION',
96
- ImportState: 'IMPORT_STATE',
97
- };
98
8
  /**
99
9
  * Adds support for the Redux Devtools extension:
100
10
  * http://extension.remotedev.io/
101
11
  */
102
12
  class NgxsReduxDevtoolsPlugin {
103
- /**
104
- * @param {?} _options
105
- * @param {?} _injector
106
- * @param {?} _ngZone
107
- */
108
13
  constructor(_options, _injector, _ngZone) {
109
14
  this._options = _options;
110
15
  this._injector = _injector;
@@ -114,9 +19,6 @@ class NgxsReduxDevtoolsPlugin {
114
19
  this.unsubscribe = null;
115
20
  this.connect();
116
21
  }
117
- /**
118
- * @return {?}
119
- */
120
22
  ngOnDestroy() {
121
23
  if (this.unsubscribe !== null) {
122
24
  this.unsubscribe();
@@ -127,70 +29,43 @@ class NgxsReduxDevtoolsPlugin {
127
29
  }
128
30
  /**
129
31
  * Lazy get the store for circular dependency issues
130
- * @private
131
- * @return {?}
132
32
  */
133
33
  get store() {
134
34
  return this._injector.get(Store);
135
35
  }
136
36
  /**
137
37
  * Middleware handle function
138
- * @param {?} state
139
- * @param {?} action
140
- * @param {?} next
141
- * @return {?}
142
38
  */
143
39
  handle(state, action, next) {
144
40
  if (!this.devtoolsExtension || this._options.disabled) {
145
41
  return next(state, action);
146
42
  }
147
- return next(state, action).pipe(catchError((/**
148
- * @param {?} error
149
- * @return {?}
150
- */
151
- error => {
152
- /** @type {?} */
43
+ return next(state, action).pipe(catchError(error => {
153
44
  const newState = this.store.snapshot();
154
45
  this.sendToDevTools(state, action, newState);
155
46
  throw error;
156
- })), tap((/**
157
- * @param {?} newState
158
- * @return {?}
159
- */
160
- newState => {
47
+ }), tap(newState => {
161
48
  this.sendToDevTools(state, action, newState);
162
- })));
49
+ }));
163
50
  }
164
- /**
165
- * @private
166
- * @param {?} state
167
- * @param {?} action
168
- * @param {?} newState
169
- * @return {?}
170
- */
171
51
  sendToDevTools(state, action, newState) {
172
- /** @type {?} */
173
52
  const type = getActionTypeFromInstance(action);
174
53
  // if init action, send initial state to dev tools
175
- /** @type {?} */
176
54
  const isInitAction = type === '@@INIT';
177
55
  if (isInitAction) {
178
- (/** @type {?} */ (this.devtoolsExtension)).init(state);
56
+ this.devtoolsExtension.init(state);
179
57
  }
180
58
  else {
181
- (/** @type {?} */ (this.devtoolsExtension)).send(Object.assign({}, action, { action: null, type }), newState);
59
+ this.devtoolsExtension.send(Object.assign(Object.assign({}, action), { action: null, type }), newState);
182
60
  }
183
61
  }
184
62
  /**
185
63
  * Handle the action from the dev tools subscription
186
- * @param {?} action
187
- * @return {?}
188
64
  */
189
65
  dispatched(action) {
190
66
  if (action.type === "DISPATCH" /* Dispatch */) {
191
67
  if (action.payload.type === "JUMP_TO_ACTION" /* JumpToAction */ ||
192
68
  action.payload.type === "JUMP_TO_STATE" /* JumpToState */) {
193
- /** @type {?} */
194
69
  const prevState = JSON.parse(action.state);
195
70
  // This makes the DevTools and Router plugins friends with each other.
196
71
  // We're checking for the `router` state to exist, and it also should
@@ -208,31 +83,18 @@ class NgxsReduxDevtoolsPlugin {
208
83
  }
209
84
  else if (action.payload.type === "IMPORT_STATE" /* ImportState */) {
210
85
  const { actionsById, computedStates, currentStateIndex } = action.payload.nextLiftedState;
211
- (/** @type {?} */ (this.devtoolsExtension)).init(computedStates[0].state);
86
+ this.devtoolsExtension.init(computedStates[0].state);
212
87
  Object.keys(actionsById)
213
- .filter((/**
214
- * @param {?} actionId
215
- * @return {?}
216
- */
217
- actionId => actionId !== '0'))
218
- .forEach((/**
219
- * @param {?} actionId
220
- * @return {?}
221
- */
222
- actionId => (/** @type {?} */ (this.devtoolsExtension)).send(actionsById[actionId], computedStates[actionId].state)));
88
+ .filter(actionId => actionId !== '0')
89
+ .forEach(actionId => this.devtoolsExtension.send(actionsById[actionId], computedStates[actionId].state));
223
90
  this.store.reset(computedStates[currentStateIndex].state);
224
91
  }
225
92
  }
226
93
  else if (action.type === "ACTION" /* Action */) {
227
- /** @type {?} */
228
94
  const actionPayload = JSON.parse(action.payload);
229
95
  this.store.dispatch(actionPayload);
230
96
  }
231
97
  }
232
- /**
233
- * @private
234
- * @return {?}
235
- */
236
98
  connect() {
237
99
  if (!this.globalDevtools || this._options.disabled) {
238
100
  return;
@@ -241,87 +103,31 @@ class NgxsReduxDevtoolsPlugin {
241
103
  // with an extension through `window.postMessage` and message events.
242
104
  // We handle only 2 events; thus, we don't want to run many change detections
243
105
  // because the extension sends events that we don't have to handle.
244
- this.devtoolsExtension = this._ngZone.runOutsideAngular((/**
245
- * @return {?}
246
- */
247
- () => (/** @type {?} */ (this.globalDevtools.connect(this._options)))));
248
- this.unsubscribe = this.devtoolsExtension.subscribe((/**
249
- * @param {?} action
250
- * @return {?}
251
- */
252
- action => {
106
+ this.devtoolsExtension = this._ngZone.runOutsideAngular(() => this.globalDevtools.connect(this._options));
107
+ this.unsubscribe = this.devtoolsExtension.subscribe(action => {
253
108
  if (action.type === "DISPATCH" /* Dispatch */ ||
254
109
  action.type === "ACTION" /* Action */) {
255
- this._ngZone.run((/**
256
- * @return {?}
257
- */
258
- () => {
110
+ this._ngZone.run(() => {
259
111
  this.dispatched(action);
260
- }));
112
+ });
261
113
  }
262
- }));
114
+ });
263
115
  }
264
116
  }
265
- NgxsReduxDevtoolsPlugin.decorators = [
266
- { type: Injectable }
267
- ];
268
- /** @nocollapse */
269
- NgxsReduxDevtoolsPlugin.ctorParameters = () => [
270
- { type: undefined, decorators: [{ type: Inject, args: [NGXS_DEVTOOLS_OPTIONS,] }] },
271
- { type: Injector },
272
- { type: NgZone }
273
- ];
274
- if (false) {
275
- /**
276
- * @type {?}
277
- * @private
278
- */
279
- NgxsReduxDevtoolsPlugin.prototype.devtoolsExtension;
280
- /**
281
- * @type {?}
282
- * @private
283
- */
284
- NgxsReduxDevtoolsPlugin.prototype.globalDevtools;
285
- /**
286
- * @type {?}
287
- * @private
288
- */
289
- NgxsReduxDevtoolsPlugin.prototype.unsubscribe;
290
- /**
291
- * @type {?}
292
- * @private
293
- */
294
- NgxsReduxDevtoolsPlugin.prototype._options;
295
- /**
296
- * @type {?}
297
- * @private
298
- */
299
- NgxsReduxDevtoolsPlugin.prototype._injector;
300
- /**
301
- * @type {?}
302
- * @private
303
- */
304
- NgxsReduxDevtoolsPlugin.prototype._ngZone;
305
- }
117
+ /** @nocollapse */ NgxsReduxDevtoolsPlugin.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: NgxsReduxDevtoolsPlugin, deps: [{ token: NGXS_DEVTOOLS_OPTIONS }, { token: i0.Injector }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Injectable });
118
+ /** @nocollapse */ NgxsReduxDevtoolsPlugin.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: NgxsReduxDevtoolsPlugin });
119
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: NgxsReduxDevtoolsPlugin, decorators: [{
120
+ type: Injectable
121
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
122
+ type: Inject,
123
+ args: [NGXS_DEVTOOLS_OPTIONS]
124
+ }] }, { type: i0.Injector }, { type: i0.NgZone }]; } });
306
125
 
307
- /**
308
- * @fileoverview added by tsickle
309
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
310
- */
311
- /**
312
- * @param {?} options
313
- * @return {?}
314
- */
315
126
  function devtoolsOptionsFactory(options) {
316
127
  return Object.assign({ name: 'NGXS' }, options);
317
128
  }
318
- /** @type {?} */
319
129
  const USER_OPTIONS = new InjectionToken('USER_OPTIONS');
320
130
  class NgxsReduxDevtoolsPluginModule {
321
- /**
322
- * @param {?=} options
323
- * @return {?}
324
- */
325
131
  static forRoot(options) {
326
132
  return {
327
133
  ngModule: NgxsReduxDevtoolsPluginModule,
@@ -344,24 +150,20 @@ class NgxsReduxDevtoolsPluginModule {
344
150
  };
345
151
  }
346
152
  }
347
- NgxsReduxDevtoolsPluginModule.decorators = [
348
- { type: NgModule }
349
- ];
350
-
351
- /**
352
- * @fileoverview added by tsickle
353
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
354
- */
153
+ /** @nocollapse */ NgxsReduxDevtoolsPluginModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: NgxsReduxDevtoolsPluginModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
154
+ /** @nocollapse */ NgxsReduxDevtoolsPluginModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: NgxsReduxDevtoolsPluginModule });
155
+ /** @nocollapse */ NgxsReduxDevtoolsPluginModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: NgxsReduxDevtoolsPluginModule });
156
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0, type: NgxsReduxDevtoolsPluginModule, decorators: [{
157
+ type: NgModule
158
+ }] });
355
159
 
356
160
  /**
357
- * @fileoverview added by tsickle
358
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
161
+ * The public api for consumers of @ngxs/devtools-plugin
359
162
  */
360
163
 
361
164
  /**
362
- * @fileoverview added by tsickle
363
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
165
+ * Generated bundle index. Do not edit.
364
166
  */
365
167
 
366
- export { NGXS_DEVTOOLS_OPTIONS, NgxsReduxDevtoolsPlugin, NgxsReduxDevtoolsPluginModule, devtoolsOptionsFactory as ɵa, USER_OPTIONS as ɵb };
168
+ export { NGXS_DEVTOOLS_OPTIONS, NgxsReduxDevtoolsPlugin, NgxsReduxDevtoolsPluginModule };
367
169
  //# sourceMappingURL=ngxs-devtools-plugin.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ngxs-devtools-plugin.js","sources":["ng://@ngxs/devtools-plugin/src/symbols.ts","ng://@ngxs/devtools-plugin/src/devtools.plugin.ts","ng://@ngxs/devtools-plugin/src/devtools.module.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\n/**\n * Interface for the redux-devtools-extension API.\n */\nexport interface NgxsDevtoolsExtension {\n init(state: any): void;\n send(action: any, state?: any): void;\n subscribe(fn: (message: NgxsDevtoolsAction) => void): VoidFunction;\n}\n\nexport interface NgxsDevtoolsAction {\n type: string;\n payload: any;\n state: any;\n id: number;\n source: string;\n}\n\nexport interface NgxsDevtoolsOptions {\n /**\n * The name of the extension\n */\n name?: string;\n\n /**\n * Whether the dev tools is enabled or note. Useful for setting during production.\n */\n disabled?: boolean;\n\n /**\n * Max number of entiries to keep.\n */\n maxAge?: number;\n\n /**\n * Reformat actions before sending to dev tools\n */\n actionSanitizer?: (action: any) => void;\n\n /**\n * Reformat state before sending to devtools\n */\n stateSanitizer?: (state: any) => void;\n}\n\nexport const NGXS_DEVTOOLS_OPTIONS = new InjectionToken('NGXS_DEVTOOLS_OPTIONS');\n","import { Inject, Injectable, Injector, NgZone, OnDestroy, ɵglobal } from '@angular/core';\nimport { getActionTypeFromInstance, NgxsNextPluginFn, NgxsPlugin, Store } from '@ngxs/store';\nimport { tap, catchError } from 'rxjs/operators';\n\nimport {\n NGXS_DEVTOOLS_OPTIONS,\n NgxsDevtoolsAction,\n NgxsDevtoolsExtension,\n NgxsDevtoolsOptions\n} from './symbols';\n\nconst enum ReduxDevtoolsActionType {\n Dispatch = 'DISPATCH',\n Action = 'ACTION'\n}\n\nconst enum ReduxDevtoolsPayloadType {\n JumpToAction = 'JUMP_TO_ACTION',\n JumpToState = 'JUMP_TO_STATE',\n ToggleAction = 'TOGGLE_ACTION',\n ImportState = 'IMPORT_STATE'\n}\n\n/**\n * Adds support for the Redux Devtools extension:\n * http://extension.remotedev.io/\n */\n@Injectable()\nexport class NgxsReduxDevtoolsPlugin implements OnDestroy, NgxsPlugin {\n private devtoolsExtension: NgxsDevtoolsExtension | null = null;\n private readonly globalDevtools =\n ɵglobal['__REDUX_DEVTOOLS_EXTENSION__'] || ɵglobal['devToolsExtension'];\n\n private unsubscribe: VoidFunction | null = null;\n\n constructor(\n @Inject(NGXS_DEVTOOLS_OPTIONS) private _options: NgxsDevtoolsOptions,\n private _injector: Injector,\n private _ngZone: NgZone\n ) {\n this.connect();\n }\n\n ngOnDestroy(): void {\n if (this.unsubscribe !== null) {\n this.unsubscribe();\n }\n if (this.globalDevtools) {\n this.globalDevtools.disconnect();\n }\n }\n\n /**\n * Lazy get the store for circular dependency issues\n */\n private get store(): Store {\n return this._injector.get<Store>(Store);\n }\n\n /**\n * Middleware handle function\n */\n handle(state: any, action: any, next: NgxsNextPluginFn) {\n if (!this.devtoolsExtension || this._options.disabled) {\n return next(state, action);\n }\n\n return next(state, action).pipe(\n catchError(error => {\n const newState = this.store.snapshot();\n this.sendToDevTools(state, action, newState);\n throw error;\n }),\n tap(newState => {\n this.sendToDevTools(state, action, newState);\n })\n );\n }\n\n private sendToDevTools(state: any, action: any, newState: any) {\n const type = getActionTypeFromInstance(action);\n // if init action, send initial state to dev tools\n const isInitAction = type === '@@INIT';\n if (isInitAction) {\n this.devtoolsExtension!.init(state);\n } else {\n this.devtoolsExtension!.send({ ...action, action: null, type }, newState);\n }\n }\n\n /**\n * Handle the action from the dev tools subscription\n */\n dispatched(action: NgxsDevtoolsAction) {\n if (action.type === ReduxDevtoolsActionType.Dispatch) {\n if (\n action.payload.type === ReduxDevtoolsPayloadType.JumpToAction ||\n action.payload.type === ReduxDevtoolsPayloadType.JumpToState\n ) {\n const prevState = JSON.parse(action.state);\n // This makes the DevTools and Router plugins friends with each other.\n // We're checking for the `router` state to exist, and it also should\n // have the `trigger` property, so we're sure that this is our router\n // state (coming from `@ngxs/router-plugin`). This enables a time-traveling\n // feature since it doesn't only restore the state but also allows the `RouterState`\n // to navigate back when the action is jumped.\n if (prevState.router && prevState.router.trigger) {\n prevState.router.trigger = 'devtools';\n }\n this.store.reset(prevState);\n } else if (action.payload.type === ReduxDevtoolsPayloadType.ToggleAction) {\n console.warn('Skip is not supported at this time.');\n } else if (action.payload.type === ReduxDevtoolsPayloadType.ImportState) {\n const {\n actionsById,\n computedStates,\n currentStateIndex\n } = action.payload.nextLiftedState;\n this.devtoolsExtension!.init(computedStates[0].state);\n Object.keys(actionsById)\n .filter(actionId => actionId !== '0')\n .forEach(actionId =>\n this.devtoolsExtension!.send(actionsById[actionId], computedStates[actionId].state)\n );\n this.store.reset(computedStates[currentStateIndex].state);\n }\n } else if (action.type === ReduxDevtoolsActionType.Action) {\n const actionPayload = JSON.parse(action.payload);\n this.store.dispatch(actionPayload);\n }\n }\n\n private connect(): void {\n if (!this.globalDevtools || this._options.disabled) {\n return;\n }\n\n // The `connect` method adds `message` event listener since it communicates\n // with an extension through `window.postMessage` and message events.\n // We handle only 2 events; thus, we don't want to run many change detections\n // because the extension sends events that we don't have to handle.\n this.devtoolsExtension = this._ngZone.runOutsideAngular(\n () => <NgxsDevtoolsExtension>this.globalDevtools.connect(this._options)\n );\n\n this.unsubscribe = this.devtoolsExtension.subscribe(action => {\n if (\n action.type === ReduxDevtoolsActionType.Dispatch ||\n action.type === ReduxDevtoolsActionType.Action\n ) {\n this._ngZone.run(() => {\n this.dispatched(action);\n });\n }\n });\n }\n}\n","import { NgModule, ModuleWithProviders, InjectionToken } from '@angular/core';\nimport { NGXS_PLUGINS } from '@ngxs/store';\n\nimport { NgxsDevtoolsOptions, NGXS_DEVTOOLS_OPTIONS } from './symbols';\nimport { NgxsReduxDevtoolsPlugin } from './devtools.plugin';\n\nexport function devtoolsOptionsFactory(options: NgxsDevtoolsOptions) {\n return {\n name: 'NGXS',\n ...options\n };\n}\n\nexport const USER_OPTIONS = new InjectionToken('USER_OPTIONS');\n\n@NgModule()\nexport class NgxsReduxDevtoolsPluginModule {\n static forRoot(\n options?: NgxsDevtoolsOptions\n ): ModuleWithProviders<NgxsReduxDevtoolsPluginModule> {\n return {\n ngModule: NgxsReduxDevtoolsPluginModule,\n providers: [\n {\n provide: NGXS_PLUGINS,\n useClass: NgxsReduxDevtoolsPlugin,\n multi: true\n },\n {\n provide: USER_OPTIONS,\n useValue: options\n },\n {\n provide: NGXS_DEVTOOLS_OPTIONS,\n useFactory: devtoolsOptionsFactory,\n deps: [USER_OPTIONS]\n }\n ]\n };\n }\n}\n"],"names":[],"mappings":";;;;;;;;AAAA;;;;AAKA,oCAIC;;;;;;IAHC,4DAAuB;;;;;;IACvB,oEAAqC;;;;;IACrC,8DAAmE;;;;;AAGrE,iCAMC;;;IALC,kCAAa;;IACb,qCAAa;;IACb,mCAAW;;IACX,gCAAW;;IACX,oCAAe;;;;;AAGjB,kCAyBC;;;;;;IAr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AAC,OAAO,CAAC,GAAG;;;gBAAC;oBACf,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;iBACzB,EAAC,CAAC;aACJ;SACF,EAAC,CAAC;KACJ;;;YAhIF,UAAU;;;;4CASN,MAAM,SAAC,qBAAqB;YApCJ,QAAQ;YAAE,MAAM;;;;;;;IA6B3C,oDAA+D;;;;;IAC/D,iDAC0E;;;;;IAE1E,8CAAgD;;;;;IAG9C,2CAAoE;;;;;IACpE,4CAA2B;;;;;IAC3B,0CAAuB;;;;;;;ACtC3B;;;;AAMA,SAAgB,sBAAsB,CAAC,OAA4B;IACjE,uBACE,IAAI,EAAE,MAAM,IACT,OAAO,EACV;CACH;;AAED,MAAa,YAAY,GAAG,IAAI,cAAc,CAAC,cAAc,CAAC;AAG9D,MAAa,6BAA6B;;;;;IACxC,OAAO,OAAO,CACZ,OAA6B;QAE7B,OAAO;YACL,QAAQ,EAAE,6BAA6B;YACvC,SAAS,EAAE;gBACT;oBACE,OAAO,EAAE,YAAY;oBACrB,QAAQ,EAAE,uBAAuB;oBACjC,KAAK,EAAE,IAAI;iBACZ;gBACD;oBACE,OAAO,EAAE,YAAY;oBACrB,QAAQ,EAAE,OAAO;iBAClB;gBACD;oBACE,OAAO,EAAE,qBAAqB;oBAC9B,UAAU,EAAE,sBAAsB;oBAClC,IAAI,EAAE,CAAC,YAAY,CAAC;iBACrB;aACF;SACF,CAAC;KACH;;;YAxBF,QAAQ;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"ngxs-devtools-plugin.js","sources":["../../../packages/devtools-plugin/src/symbols.ts","../../../packages/devtools-plugin/src/devtools.plugin.ts","../../../packages/devtools-plugin/src/devtools.module.ts","../../../packages/devtools-plugin/index.ts","../../../packages/devtools-plugin/ngxs-devtools-plugin.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\n/**\n * Interface for the redux-devtools-extension API.\n */\nexport interface NgxsDevtoolsExtension {\n init(state: any): void;\n send(action: any, state?: any): void;\n subscribe(fn: (message: NgxsDevtoolsAction) => void): VoidFunction;\n}\n\nexport interface NgxsDevtoolsAction {\n type: string;\n payload: any;\n state: any;\n id: number;\n source: string;\n}\n\nexport interface NgxsDevtoolsOptions {\n /**\n * The name of the extension\n */\n name?: string;\n\n /**\n * Whether the dev tools is enabled or note. Useful for setting during production.\n */\n disabled?: boolean;\n\n /**\n * Max number of entiries to keep.\n */\n maxAge?: number;\n\n /**\n * If more than one action is dispatched in the indicated interval, all new actions will be collected\n * and sent at once. It is the joint between performance and speed. When set to 0, all actions will be\n * sent instantly. Set it to a higher value when experiencing perf issues (also maxAge to a lower value).\n * Default is 500 ms.\n */\n latency?: number;\n\n /**\n * string or array of strings as regex - actions types to be hidden in the monitors (while passed to the reducers).\n * If actionsWhitelist specified, actionsBlacklist is ignored.\n */\n actionsBlacklist?: string | string[];\n\n /**\n * string or array of strings as regex - actions types to be shown in the monitors (while passed to the reducers).\n * If actionsWhitelist specified, actionsBlacklist is ignored.\n */\n actionsWhitelist?: string | string[];\n\n /**\n * called for every action before sending, takes state and action object, and returns true in case it allows\n * sending the current data to the monitor. Use it as a more advanced version of\n * actionsBlacklist/actionsWhitelist parameters\n */\n predicate?: (state: any, action: any) => boolean;\n\n /**\n * Reformat actions before sending to dev tools\n */\n actionSanitizer?: (action: any) => void;\n\n /**\n * Reformat state before sending to devtools\n */\n stateSanitizer?: (state: any) => void;\n\n /**\n * If set to true, will include stack trace for every dispatched action\n */\n trace?: boolean | (() => string);\n\n /**\n * Maximum stack trace frames to be stored (in case trace option was provided as true)\n */\n traceLimit?: number;\n}\n\nexport const NGXS_DEVTOOLS_OPTIONS = new InjectionToken('NGXS_DEVTOOLS_OPTIONS');\n","import { Inject, Injectable, Injector, NgZone, OnDestroy, ɵglobal } from '@angular/core';\nimport { getActionTypeFromInstance, NgxsNextPluginFn, NgxsPlugin, Store } from '@ngxs/store';\nimport { tap, catchError } from 'rxjs/operators';\n\nimport {\n NGXS_DEVTOOLS_OPTIONS,\n NgxsDevtoolsAction,\n NgxsDevtoolsExtension,\n NgxsDevtoolsOptions\n} from './symbols';\n\nconst enum ReduxDevtoolsActionType {\n Dispatch = 'DISPATCH',\n Action = 'ACTION'\n}\n\nconst enum ReduxDevtoolsPayloadType {\n JumpToAction = 'JUMP_TO_ACTION',\n JumpToState = 'JUMP_TO_STATE',\n ToggleAction = 'TOGGLE_ACTION',\n ImportState = 'IMPORT_STATE'\n}\n\n/**\n * Adds support for the Redux Devtools extension:\n * http://extension.remotedev.io/\n */\n@Injectable()\nexport class NgxsReduxDevtoolsPlugin implements OnDestroy, NgxsPlugin {\n private devtoolsExtension: NgxsDevtoolsExtension | null = null;\n private readonly globalDevtools =\n ɵglobal['__REDUX_DEVTOOLS_EXTENSION__'] || ɵglobal['devToolsExtension'];\n\n private unsubscribe: VoidFunction | null = null;\n\n constructor(\n @Inject(NGXS_DEVTOOLS_OPTIONS) private _options: NgxsDevtoolsOptions,\n private _injector: Injector,\n private _ngZone: NgZone\n ) {\n this.connect();\n }\n\n ngOnDestroy(): void {\n if (this.unsubscribe !== null) {\n this.unsubscribe();\n }\n if (this.globalDevtools) {\n this.globalDevtools.disconnect();\n }\n }\n\n /**\n * Lazy get the store for circular dependency issues\n */\n private get store(): Store {\n return this._injector.get<Store>(Store);\n }\n\n /**\n * Middleware handle function\n */\n handle(state: any, action: any, next: NgxsNextPluginFn) {\n if (!this.devtoolsExtension || this._options.disabled) {\n return next(state, action);\n }\n\n return next(state, action).pipe(\n catchError(error => {\n const newState = this.store.snapshot();\n this.sendToDevTools(state, action, newState);\n throw error;\n }),\n tap(newState => {\n this.sendToDevTools(state, action, newState);\n })\n );\n }\n\n private sendToDevTools(state: any, action: any, newState: any) {\n const type = getActionTypeFromInstance(action);\n // if init action, send initial state to dev tools\n const isInitAction = type === '@@INIT';\n if (isInitAction) {\n this.devtoolsExtension!.init(state);\n } else {\n this.devtoolsExtension!.send({ ...action, action: null, type }, newState);\n }\n }\n\n /**\n * Handle the action from the dev tools subscription\n */\n dispatched(action: NgxsDevtoolsAction) {\n if (action.type === ReduxDevtoolsActionType.Dispatch) {\n if (\n action.payload.type === ReduxDevtoolsPayloadType.JumpToAction ||\n action.payload.type === ReduxDevtoolsPayloadType.JumpToState\n ) {\n const prevState = JSON.parse(action.state);\n // This makes the DevTools and Router plugins friends with each other.\n // We're checking for the `router` state to exist, and it also should\n // have the `trigger` property, so we're sure that this is our router\n // state (coming from `@ngxs/router-plugin`). This enables a time-traveling\n // feature since it doesn't only restore the state but also allows the `RouterState`\n // to navigate back when the action is jumped.\n if (prevState.router && prevState.router.trigger) {\n prevState.router.trigger = 'devtools';\n }\n this.store.reset(prevState);\n } else if (action.payload.type === ReduxDevtoolsPayloadType.ToggleAction) {\n console.warn('Skip is not supported at this time.');\n } else if (action.payload.type === ReduxDevtoolsPayloadType.ImportState) {\n const {\n actionsById,\n computedStates,\n currentStateIndex\n } = action.payload.nextLiftedState;\n this.devtoolsExtension!.init(computedStates[0].state);\n Object.keys(actionsById)\n .filter(actionId => actionId !== '0')\n .forEach(actionId =>\n this.devtoolsExtension!.send(actionsById[actionId], computedStates[actionId].state)\n );\n this.store.reset(computedStates[currentStateIndex].state);\n }\n } else if (action.type === ReduxDevtoolsActionType.Action) {\n const actionPayload = JSON.parse(action.payload);\n this.store.dispatch(actionPayload);\n }\n }\n\n private connect(): void {\n if (!this.globalDevtools || this._options.disabled) {\n return;\n }\n\n // The `connect` method adds `message` event listener since it communicates\n // with an extension through `window.postMessage` and message events.\n // We handle only 2 events; thus, we don't want to run many change detections\n // because the extension sends events that we don't have to handle.\n this.devtoolsExtension = this._ngZone.runOutsideAngular(\n () => <NgxsDevtoolsExtension>this.globalDevtools.connect(this._options)\n );\n\n this.unsubscribe = this.devtoolsExtension.subscribe(action => {\n if (\n action.type === ReduxDevtoolsActionType.Dispatch ||\n action.type === ReduxDevtoolsActionType.Action\n ) {\n this._ngZone.run(() => {\n this.dispatched(action);\n });\n }\n });\n }\n}\n","import { NgModule, ModuleWithProviders, InjectionToken } from '@angular/core';\nimport { NGXS_PLUGINS } from '@ngxs/store';\n\nimport { NgxsDevtoolsOptions, NGXS_DEVTOOLS_OPTIONS } from './symbols';\nimport { NgxsReduxDevtoolsPlugin } from './devtools.plugin';\n\nexport function devtoolsOptionsFactory(options: NgxsDevtoolsOptions) {\n return {\n name: 'NGXS',\n ...options\n };\n}\n\nexport const USER_OPTIONS = new InjectionToken('USER_OPTIONS');\n\n@NgModule()\nexport class NgxsReduxDevtoolsPluginModule {\n static forRoot(\n options?: NgxsDevtoolsOptions\n ): ModuleWithProviders<NgxsReduxDevtoolsPluginModule> {\n return {\n ngModule: NgxsReduxDevtoolsPluginModule,\n providers: [\n {\n provide: NGXS_PLUGINS,\n useClass: NgxsReduxDevtoolsPlugin,\n multi: true\n },\n {\n provide: USER_OPTIONS,\n useValue: options\n },\n {\n provide: NGXS_DEVTOOLS_OPTIONS,\n useFactory: devtoolsOptionsFactory,\n deps: [USER_OPTIONS]\n }\n ]\n };\n }\n}\n","/**\n * The public api for consumers of @ngxs/devtools-plugin\n */\nexport * from './src/public_api';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;MAmFa,qBAAqB,GAAG,IAAI,cAAc,CAAC,uBAAuB;;AC5D/E;;;AAGG;MAEU,uBAAuB,CAAA;AAOlC,IAAA,WAAA,CACyC,QAA6B,EAC5D,SAAmB,EACnB,OAAe,EAAA;QAFgB,IAAQ,CAAA,QAAA,GAAR,QAAQ,CAAqB;QAC5D,IAAS,CAAA,SAAA,GAAT,SAAS,CAAU;QACnB,IAAO,CAAA,OAAA,GAAP,OAAO,CAAQ;QATjB,IAAiB,CAAA,iBAAA,GAAiC,IAAI,CAAC;QAC9C,IAAc,CAAA,cAAA,GAC7B,OAAO,CAAC,8BAA8B,CAAC,IAAI,OAAO,CAAC,mBAAmB,CAAC,CAAC;QAElE,IAAW,CAAA,WAAA,GAAwB,IAAI,CAAC;QAO9C,IAAI,CA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,EAAA,CAAA,CAAA;+IAA7B,6BAA6B,EAAA,CAAA,CAAA;4FAA7B,6BAA6B,EAAA,UAAA,EAAA,CAAA;kBADzC,QAAQ;;;ACfT;;AAEG;;ACFH;;AAEG;;;;"}
@@ -1,5 +1,5 @@
1
1
  /**
2
2
  * Generated bundle index. Do not edit.
3
3
  */
4
+ /// <amd-module name="@ngxs/devtools-plugin" />
4
5
  export * from './index';
5
- export { USER_OPTIONS as ɵb, devtoolsOptionsFactory as ɵa } from './src/devtools.module';
package/package.json CHANGED
@@ -2,24 +2,21 @@
2
2
  "$schema": "../../node_modules/ng-packagr/package.schema.json",
3
3
  "name": "@ngxs/devtools-plugin",
4
4
  "description": "redux devtools plugin for @ngxs/store",
5
- "version": "3.7.6",
5
+ "version": "3.8.0-dev.master-c341c15",
6
6
  "sideEffects": true,
7
7
  "peerDependencies": {
8
- "@ngxs/store": "^3.7.6 || ^3.7.6-dev",
9
8
  "@angular/core": ">=6.1.0 <16.0.0",
9
+ "@ngxs/store": "^3.8.0 || ^3.8.0-dev",
10
10
  "rxjs": ">=6.5.5"
11
11
  },
12
12
  "main": "bundles/ngxs-devtools-plugin.umd.js",
13
- "module": "fesm5/ngxs-devtools-plugin.js",
13
+ "module": "fesm2015/ngxs-devtools-plugin.js",
14
14
  "es2015": "fesm2015/ngxs-devtools-plugin.js",
15
- "esm5": "esm5/ngxs-devtools-plugin.js",
16
15
  "esm2015": "esm2015/ngxs-devtools-plugin.js",
17
- "fesm5": "fesm5/ngxs-devtools-plugin.js",
18
16
  "fesm2015": "fesm2015/ngxs-devtools-plugin.js",
19
17
  "typings": "ngxs-devtools-plugin.d.ts",
20
- "metadata": "ngxs-devtools-plugin.metadata.json",
21
18
  "dependencies": {
22
- "tslib": "^1.9.0"
19
+ "tslib": "^2.2.0"
23
20
  },
24
21
  "repository": {
25
22
  "type": "git",
@@ -65,4 +62,4 @@
65
62
  "type": "opencollective",
66
63
  "url": "https://opencollective.com/ngxs"
67
64
  }
68
- }
65
+ }
@@ -1,13 +1,23 @@
1
1
  import { ModuleWithProviders, InjectionToken } from '@angular/core';
2
2
  import { NgxsDevtoolsOptions } from './symbols';
3
+ import * as i0 from "@angular/core";
3
4
  export declare function devtoolsOptionsFactory(options: NgxsDevtoolsOptions): {
4
5
  name: string;
5
6
  disabled?: boolean | undefined;
6
7
  maxAge?: number | undefined;
8
+ latency?: number | undefined;
9
+ actionsBlacklist?: string | string[] | undefined;
10
+ actionsWhitelist?: string | string[] | undefined;
11
+ predicate?: ((state: any, action: any) => boolean) | undefined;
7
12
  actionSanitizer?: ((action: any) => void) | undefined;
8
13
  stateSanitizer?: ((state: any) => void) | undefined;
14
+ trace?: boolean | (() => string) | undefined;
15
+ traceLimit?: number | undefined;
9
16
  };
10
- export declare const USER_OPTIONS: InjectionToken<{}>;
17
+ export declare const USER_OPTIONS: InjectionToken<unknown>;
11
18
  export declare class NgxsReduxDevtoolsPluginModule {
12
19
  static forRoot(options?: NgxsDevtoolsOptions): ModuleWithProviders<NgxsReduxDevtoolsPluginModule>;
20
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgxsReduxDevtoolsPluginModule, never>;
21
+ static ɵmod: i0.ɵɵNgModuleDeclaration<NgxsReduxDevtoolsPluginModule, never, never, never>;
22
+ static ɵinj: i0.ɵɵInjectorDeclaration<NgxsReduxDevtoolsPluginModule>;
13
23
  }
@@ -1,6 +1,7 @@
1
1
  import { Injector, NgZone, OnDestroy } from '@angular/core';
2
2
  import { NgxsNextPluginFn, NgxsPlugin } from '@ngxs/store';
3
3
  import { NgxsDevtoolsAction, NgxsDevtoolsOptions } from './symbols';
4
+ import * as i0 from "@angular/core";
4
5
  /**
5
6
  * Adds support for the Redux Devtools extension:
6
7
  * http://extension.remotedev.io/
@@ -17,7 +18,7 @@ export declare class NgxsReduxDevtoolsPlugin implements OnDestroy, NgxsPlugin {
17
18
  /**
18
19
  * Lazy get the store for circular dependency issues
19
20
  */
20
- private readonly store;
21
+ private get store();
21
22
  /**
22
23
  * Middleware handle function
23
24
  */
@@ -28,4 +29,6 @@ export declare class NgxsReduxDevtoolsPlugin implements OnDestroy, NgxsPlugin {
28
29
  */
29
30
  dispatched(action: NgxsDevtoolsAction): void;
30
31
  private connect;
32
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgxsReduxDevtoolsPlugin, never>;
33
+ static ɵprov: i0.ɵɵInjectableDeclaration<NgxsReduxDevtoolsPlugin>;
31
34
  }
package/src/symbols.d.ts CHANGED
@@ -27,6 +27,29 @@ export interface NgxsDevtoolsOptions {
27
27
  * Max number of entiries to keep.
28
28
  */
29
29
  maxAge?: number;
30
+ /**
31
+ * If more than one action is dispatched in the indicated interval, all new actions will be collected
32
+ * and sent at once. It is the joint between performance and speed. When set to 0, all actions will be
33
+ * sent instantly. Set it to a higher value when experiencing perf issues (also maxAge to a lower value).
34
+ * Default is 500 ms.
35
+ */
36
+ latency?: number;
37
+ /**
38
+ * string or array of strings as regex - actions types to be hidden in the monitors (while passed to the reducers).
39
+ * If actionsWhitelist specified, actionsBlacklist is ignored.
40
+ */
41
+ actionsBlacklist?: string | string[];
42
+ /**
43
+ * string or array of strings as regex - actions types to be shown in the monitors (while passed to the reducers).
44
+ * If actionsWhitelist specified, actionsBlacklist is ignored.
45
+ */
46
+ actionsWhitelist?: string | string[];
47
+ /**
48
+ * called for every action before sending, takes state and action object, and returns true in case it allows
49
+ * sending the current data to the monitor. Use it as a more advanced version of
50
+ * actionsBlacklist/actionsWhitelist parameters
51
+ */
52
+ predicate?: (state: any, action: any) => boolean;
30
53
  /**
31
54
  * Reformat actions before sending to dev tools
32
55
  */
@@ -35,5 +58,13 @@ export interface NgxsDevtoolsOptions {
35
58
  * Reformat state before sending to devtools
36
59
  */
37
60
  stateSanitizer?: (state: any) => void;
61
+ /**
62
+ * If set to true, will include stack trace for every dispatched action
63
+ */
64
+ trace?: boolean | (() => string);
65
+ /**
66
+ * Maximum stack trace frames to be stored (in case trace option was provided as true)
67
+ */
68
+ traceLimit?: number;
38
69
  }
39
- export declare const NGXS_DEVTOOLS_OPTIONS: InjectionToken<{}>;
70
+ export declare const NGXS_DEVTOOLS_OPTIONS: InjectionToken<unknown>;
@@ -1,16 +0,0 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@ngxs/store"),require("rxjs/operators")):"function"==typeof define&&define.amd?define("@ngxs/devtools-plugin",["exports","@angular/core","@ngxs/store","rxjs/operators"],e):e(((t=t||self).ngxs=t.ngxs||{},t.ngxs["devtools-plugin"]={}),t.ng.core,t["ngxs-store"],t.rxjs.operators)}(this,(function(t,e,o,n){"use strict";
2
- /*! *****************************************************************************
3
- Copyright (c) Microsoft Corporation.
4
-
5
- Permission to use, copy, modify, and/or distribute this software for any
6
- purpose with or without fee is hereby granted.
7
-
8
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
9
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
11
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
- PERFORMANCE OF THIS SOFTWARE.
15
- ***************************************************************************** */var s=function(){return(s=Object.assign||function(t){for(var e,o=1,n=arguments.length;o<n;o++)for(var s in e=arguments[o])Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s]);return t}).apply(this,arguments)};var r=new e.InjectionToken("NGXS_DEVTOOLS_OPTIONS"),i=function(){function t(t,o,n){this._options=t,this._injector=o,this._ngZone=n,this.devtoolsExtension=null,this.globalDevtools=e.ɵglobal.__REDUX_DEVTOOLS_EXTENSION__||e.ɵglobal.devToolsExtension,this.unsubscribe=null,this.connect()}return t.prototype.ngOnDestroy=function(){null!==this.unsubscribe&&this.unsubscribe(),this.globalDevtools&&this.globalDevtools.disconnect()},Object.defineProperty(t.prototype,"store",{get:function(){return this._injector.get(o.Store)},enumerable:!0,configurable:!0}),t.prototype.handle=function(t,e,o){var s=this;return!this.devtoolsExtension||this._options.disabled?o(t,e):o(t,e).pipe(n.catchError((function(o){var n=s.store.snapshot();throw s.sendToDevTools(t,e,n),o})),n.tap((function(o){s.sendToDevTools(t,e,o)})))},t.prototype.sendToDevTools=function(t,e,n){var r=o.getActionTypeFromInstance(e);"@@INIT"===r?this.devtoolsExtension.init(t):this.devtoolsExtension.send(s({},e,{action:null,type:r}),n)},t.prototype.dispatched=function(t){var e=this;if("DISPATCH"===t.type){if("JUMP_TO_ACTION"===t.payload.type||"JUMP_TO_STATE"===t.payload.type){var o=JSON.parse(t.state);o.router&&o.router.trigger&&(o.router.trigger="devtools"),this.store.reset(o)}else if("TOGGLE_ACTION"===t.payload.type)console.warn("Skip is not supported at this time.");else if("IMPORT_STATE"===t.payload.type){var n=t.payload.nextLiftedState,s=n.actionsById,r=n.computedStates,i=n.currentStateIndex;this.devtoolsExtension.init(r[0].state),Object.keys(s).filter((function(t){return"0"!==t})).forEach((function(t){return e.devtoolsExtension.send(s[t],r[t].state)})),this.store.reset(r[i].state)}}else if("ACTION"===t.type){var u=JSON.parse(t.payload);this.store.dispatch(u)}},t.prototype.connect=function(){var t=this;this.globalDevtools&&!this._options.disabled&&(this.devtoolsExtension=this._ngZone.runOutsideAngular((function(){return t.globalDevtools.connect(t._options)})),this.unsubscribe=this.devtoolsExtension.subscribe((function(e){"DISPATCH"!==e.type&&"ACTION"!==e.type||t._ngZone.run((function(){t.dispatched(e)}))})))},t.decorators=[{type:e.Injectable}],t.ctorParameters=function(){return[{type:void 0,decorators:[{type:e.Inject,args:[r]}]},{type:e.Injector},{type:e.NgZone}]},t}();function u(t){return s({name:"NGXS"},t)}var a=new e.InjectionToken("USER_OPTIONS"),l=function(){function t(){}return t.forRoot=function(e){return{ngModule:t,providers:[{provide:o.NGXS_PLUGINS,useClass:i,multi:!0},{provide:a,useValue:e},{provide:r,useFactory:u,deps:[a]}]}},t.decorators=[{type:e.NgModule}],t}();t.NGXS_DEVTOOLS_OPTIONS=r,t.NgxsReduxDevtoolsPlugin=i,t.NgxsReduxDevtoolsPluginModule=l,t.ɵa=u,t.ɵb=a,Object.defineProperty(t,"__esModule",{value:!0})}));
16
- //# sourceMappingURL=ngxs-devtools-plugin.umd.min.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../node_modules/tslib/tslib.es6.js","ng://@ngxs/devtools-plugin/src/symbols.ts","ng://@ngxs/devtools-plugin/src/devtools.plugin.ts","ng://@ngxs/devtools-plugin/src/devtools.module.ts"],"names":["__assign","Object","assign","t","s","i","n","arguments","length","p","prototype","hasOwnProperty","call","apply","this","NGXS_DEVTOOLS_OPTIONS","InjectionToken","NgxsReduxDevtoolsPlugin","_options","_injector","_ngZone","devtoolsExtension","globalDevtools","ɵglobal","unsubscribe","connect","ngOnDestroy","disconnect","defineProperty","get","Store","handle","state","action","next","_this","disabled","pipe","catchError","error","newState","store","snapshot","sendToDevTools","tap","type","getActionTypeFromInstance","init","send","dispatched","payload","prevState","JSON","parse","router","trigger","reset","console","warn","_a","nextLiftedState","actionsById_1","actionsById","computedStates_1","computedStates","currentStateIndex","keys","filter","actionId","forEach","actionPayload","dispatch","runOutsideAngular","subscribe","run","Injectable","Inject","args","Injector","NgZone","devtoolsOptionsFactory","options","name","USER_OPTIONS","NgxsReduxDevtoolsPluginModule","forRoot","ngModule","providers","provide","NGXS_PLUGINS","useClass","multi","useValue","useFactory","deps","NgModule"],"mappings":";;;;;;;;;;;;;;oFA6BO,IAAIA,EAAW,WAQlB,OAPAA,EAAWC,OAAOC,QAAU,SAAkBC,GAC1C,IAAK,IAAIC,EAAGC,EAAI,EAAGC,EAAIC,UAAUC,OAAQH,EAAIC,EAAGD,I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AAA,UA4JvC9D,EAjIA,GCrBA,SAAgB+D,EAAuBC,GACrC,OAAAjF,EAAA,CACEkF,KAAM,QACHD,GAIP,IAAaE,EAAe,IAAInE,EAAAA,eAAe,gBAE/CoE,EAAA,WAAA,SAAAA,KAyBA,OAvBSA,EAAAC,QAAP,SACEJ,GAEA,MAAO,CACLK,SAAUF,EACVG,UAAW,CACT,CACEC,QAASC,EAAAA,aACTC,SAAUzE,EACV0E,OAAO,GAET,CACEH,QAASL,EACTS,SAAUX,GAEZ,CACEO,QAASzE,EACT8E,WAAYb,EACZc,KAAM,CAACX,2BApBhBY,EAAAA,WAyBDX,EAzBA","sourcesContent":["/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n 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;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n 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;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport function __createBinding(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n}\r\n\r\nexport function __exportStar(m, exports) {\r\n for (var p in m) if (p !== \"default\" && !exports.hasOwnProperty(p)) exports[p] = m[p];\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n 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); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n 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; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n 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);\r\n 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); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\r\n result.default = mod;\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","import { InjectionToken } from '@angular/core';\n\n/**\n * Interface for the redux-devtools-extension API.\n */\nexport interface NgxsDevtoolsExtension {\n init(state: any): void;\n send(action: any, state?: any): void;\n subscribe(fn: (message: NgxsDevtoolsAction) => void): VoidFunction;\n}\n\nexport interface NgxsDevtoolsAction {\n type: string;\n payload: any;\n state: any;\n id: number;\n source: string;\n}\n\nexport interface NgxsDevtoolsOptions {\n /**\n * The name of the extension\n */\n name?: string;\n\n /**\n * Whether the dev tools is enabled or note. Useful for setting during production.\n */\n disabled?: boolean;\n\n /**\n * Max number of entiries to keep.\n */\n maxAge?: number;\n\n /**\n * Reformat actions before sending to dev tools\n */\n actionSanitizer?: (action: any) => void;\n\n /**\n * Reformat state before sending to devtools\n */\n stateSanitizer?: (state: any) => void;\n}\n\nexport const NGXS_DEVTOOLS_OPTIONS = new InjectionToken('NGXS_DEVTOOLS_OPTIONS');\n","import { Inject, Injectable, Injector, NgZone, OnDestroy, ɵglobal } from '@angular/core';\nimport { getActionTypeFromInstance, NgxsNextPluginFn, NgxsPlugin, Store } from '@ngxs/store';\nimport { tap, catchError } from 'rxjs/operators';\n\nimport {\n NGXS_DEVTOOLS_OPTIONS,\n NgxsDevtoolsAction,\n NgxsDevtoolsExtension,\n NgxsDevtoolsOptions\n} from './symbols';\n\nconst enum ReduxDevtoolsActionType {\n Dispatch = 'DISPATCH',\n Action = 'ACTION'\n}\n\nconst enum ReduxDevtoolsPayloadType {\n JumpToAction = 'JUMP_TO_ACTION',\n JumpToState = 'JUMP_TO_STATE',\n ToggleAction = 'TOGGLE_ACTION',\n ImportState = 'IMPORT_STATE'\n}\n\n/**\n * Adds support for the Redux Devtools extension:\n * http://extension.remotedev.io/\n */\n@Injectable()\nexport class NgxsReduxDevtoolsPlugin implements OnDestroy, NgxsPlugin {\n private devtoolsExtension: NgxsDevtoolsExtension | null = null;\n private readonly globalDevtools =\n ɵglobal['__REDUX_DEVTOOLS_EXTENSION__'] || ɵglobal['devToolsExtension'];\n\n private unsubscribe: VoidFunction | null = null;\n\n constructor(\n @Inject(NGXS_DEVTOOLS_OPTIONS) private _options: NgxsDevtoolsOptions,\n private _injector: Injector,\n private _ngZone: NgZone\n ) {\n this.connect();\n }\n\n ngOnDestroy(): void {\n if (this.unsubscribe !== null) {\n this.unsubscribe();\n }\n if (this.globalDevtools) {\n this.globalDevtools.disconnect();\n }\n }\n\n /**\n * Lazy get the store for circular dependency issues\n */\n private get store(): Store {\n return this._injector.get<Store>(Store);\n }\n\n /**\n * Middleware handle function\n */\n handle(state: any, action: any, next: NgxsNextPluginFn) {\n if (!this.devtoolsExtension || this._options.disabled) {\n return next(state, action);\n }\n\n return next(state, action).pipe(\n catchError(error => {\n const newState = this.store.snapshot();\n this.sendToDevTools(state, action, newState);\n throw error;\n }),\n tap(newState => {\n this.sendToDevTools(state, action, newState);\n })\n );\n }\n\n private sendToDevTools(state: any, action: any, newState: any) {\n const type = getActionTypeFromInstance(action);\n // if init action, send initial state to dev tools\n const isInitAction = type === '@@INIT';\n if (isInitAction) {\n this.devtoolsExtension!.init(state);\n } else {\n this.devtoolsExtension!.send({ ...action, action: null, type }, newState);\n }\n }\n\n /**\n * Handle the action from the dev tools subscription\n */\n dispatched(action: NgxsDevtoolsAction) {\n if (action.type === ReduxDevtoolsActionType.Dispatch) {\n if (\n action.payload.type === ReduxDevtoolsPayloadType.JumpToAction ||\n action.payload.type === ReduxDevtoolsPayloadType.JumpToState\n ) {\n const prevState = JSON.parse(action.state);\n // This makes the DevTools and Router plugins friends with each other.\n // We're checking for the `router` state to exist, and it also should\n // have the `trigger` property, so we're sure that this is our router\n // state (coming from `@ngxs/router-plugin`). This enables a time-traveling\n // feature since it doesn't only restore the state but also allows the `RouterState`\n // to navigate back when the action is jumped.\n if (prevState.router && prevState.router.trigger) {\n prevState.router.trigger = 'devtools';\n }\n this.store.reset(prevState);\n } else if (action.payload.type === ReduxDevtoolsPayloadType.ToggleAction) {\n console.warn('Skip is not supported at this time.');\n } else if (action.payload.type === ReduxDevtoolsPayloadType.ImportState) {\n const {\n actionsById,\n computedStates,\n currentStateIndex\n } = action.payload.nextLiftedState;\n this.devtoolsExtension!.init(computedStates[0].state);\n Object.keys(actionsById)\n .filter(actionId => actionId !== '0')\n .forEach(actionId =>\n this.devtoolsExtension!.send(actionsById[actionId], computedStates[actionId].state)\n );\n this.store.reset(computedStates[currentStateIndex].state);\n }\n } else if (action.type === ReduxDevtoolsActionType.Action) {\n const actionPayload = JSON.parse(action.payload);\n this.store.dispatch(actionPayload);\n }\n }\n\n private connect(): void {\n if (!this.globalDevtools || this._options.disabled) {\n return;\n }\n\n // The `connect` method adds `message` event listener since it communicates\n // with an extension through `window.postMessage` and message events.\n // We handle only 2 events; thus, we don't want to run many change detections\n // because the extension sends events that we don't have to handle.\n this.devtoolsExtension = this._ngZone.runOutsideAngular(\n () => <NgxsDevtoolsExtension>this.globalDevtools.connect(this._options)\n );\n\n this.unsubscribe = this.devtoolsExtension.subscribe(action => {\n if (\n action.type === ReduxDevtoolsActionType.Dispatch ||\n action.type === ReduxDevtoolsActionType.Action\n ) {\n this._ngZone.run(() => {\n this.dispatched(action);\n });\n }\n });\n }\n}\n","import { NgModule, ModuleWithProviders, InjectionToken } from '@angular/core';\nimport { NGXS_PLUGINS } from '@ngxs/store';\n\nimport { NgxsDevtoolsOptions, NGXS_DEVTOOLS_OPTIONS } from './symbols';\nimport { NgxsReduxDevtoolsPlugin } from './devtools.plugin';\n\nexport function devtoolsOptionsFactory(options: NgxsDevtoolsOptions) {\n return {\n name: 'NGXS',\n ...options\n };\n}\n\nexport const USER_OPTIONS = new InjectionToken('USER_OPTIONS');\n\n@NgModule()\nexport class NgxsReduxDevtoolsPluginModule {\n static forRoot(\n options?: NgxsDevtoolsOptions\n ): ModuleWithProviders<NgxsReduxDevtoolsPluginModule> {\n return {\n ngModule: NgxsReduxDevtoolsPluginModule,\n providers: [\n {\n provide: NGXS_PLUGINS,\n useClass: NgxsReduxDevtoolsPlugin,\n multi: true\n },\n {\n provide: USER_OPTIONS,\n useValue: options\n },\n {\n provide: NGXS_DEVTOOLS_OPTIONS,\n useFactory: devtoolsOptionsFactory,\n deps: [USER_OPTIONS]\n }\n ]\n };\n }\n}\n"]}