@ngxs/devtools-plugin 3.7.6-dev.master-fb318b1 → 3.7.6-dev.master-40a2210

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,137 +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
- * If more than one action is dispatched in the indicated interval, all new actions will be collected
70
- * and sent at once. It is the joint between performance and speed. When set to 0, all actions will be
71
- * sent instantly. Set it to a higher value when experiencing perf issues (also maxAge to a lower value).
72
- * Default is 500 ms.
73
- * @type {?|undefined}
74
- */
75
- NgxsDevtoolsOptions.prototype.latency;
76
- /**
77
- * string or array of strings as regex - actions types to be hidden in the monitors (while passed to the reducers).
78
- * If actionsWhitelist specified, actionsBlacklist is ignored.
79
- * @type {?|undefined}
80
- */
81
- NgxsDevtoolsOptions.prototype.actionsBlacklist;
82
- /**
83
- * string or array of strings as regex - actions types to be shown in the monitors (while passed to the reducers).
84
- * If actionsWhitelist specified, actionsBlacklist is ignored.
85
- * @type {?|undefined}
86
- */
87
- NgxsDevtoolsOptions.prototype.actionsWhitelist;
88
- /**
89
- * called for every action before sending, takes state and action object, and returns true in case it allows
90
- * sending the current data to the monitor. Use it as a more advanced version of
91
- * actionsBlacklist/actionsWhitelist parameters
92
- * @type {?|undefined}
93
- */
94
- NgxsDevtoolsOptions.prototype.predicate;
95
- /**
96
- * Reformat actions before sending to dev tools
97
- * @type {?|undefined}
98
- */
99
- NgxsDevtoolsOptions.prototype.actionSanitizer;
100
- /**
101
- * Reformat state before sending to devtools
102
- * @type {?|undefined}
103
- */
104
- NgxsDevtoolsOptions.prototype.stateSanitizer;
105
- }
106
- /** @type {?} */
107
6
  const NGXS_DEVTOOLS_OPTIONS = new InjectionToken('NGXS_DEVTOOLS_OPTIONS');
108
7
 
109
- /**
110
- * @fileoverview added by tsickle
111
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
112
- */
113
- /** @enum {string} */
114
- const ReduxDevtoolsActionType = {
115
- Dispatch: 'DISPATCH',
116
- Action: 'ACTION',
117
- };
118
- /** @enum {string} */
119
- const ReduxDevtoolsPayloadType = {
120
- JumpToAction: 'JUMP_TO_ACTION',
121
- JumpToState: 'JUMP_TO_STATE',
122
- ToggleAction: 'TOGGLE_ACTION',
123
- ImportState: 'IMPORT_STATE',
124
- };
125
8
  /**
126
9
  * Adds support for the Redux Devtools extension:
127
10
  * http://extension.remotedev.io/
128
11
  */
129
12
  class NgxsReduxDevtoolsPlugin {
130
- /**
131
- * @param {?} _options
132
- * @param {?} _injector
133
- * @param {?} _ngZone
134
- */
135
13
  constructor(_options, _injector, _ngZone) {
136
14
  this._options = _options;
137
15
  this._injector = _injector;
@@ -141,9 +19,6 @@ class NgxsReduxDevtoolsPlugin {
141
19
  this.unsubscribe = null;
142
20
  this.connect();
143
21
  }
144
- /**
145
- * @return {?}
146
- */
147
22
  ngOnDestroy() {
148
23
  if (this.unsubscribe !== null) {
149
24
  this.unsubscribe();
@@ -154,70 +29,43 @@ class NgxsReduxDevtoolsPlugin {
154
29
  }
155
30
  /**
156
31
  * Lazy get the store for circular dependency issues
157
- * @private
158
- * @return {?}
159
32
  */
160
33
  get store() {
161
34
  return this._injector.get(Store);
162
35
  }
163
36
  /**
164
37
  * Middleware handle function
165
- * @param {?} state
166
- * @param {?} action
167
- * @param {?} next
168
- * @return {?}
169
38
  */
170
39
  handle(state, action, next) {
171
40
  if (!this.devtoolsExtension || this._options.disabled) {
172
41
  return next(state, action);
173
42
  }
174
- return next(state, action).pipe(catchError((/**
175
- * @param {?} error
176
- * @return {?}
177
- */
178
- error => {
179
- /** @type {?} */
43
+ return next(state, action).pipe(catchError(error => {
180
44
  const newState = this.store.snapshot();
181
45
  this.sendToDevTools(state, action, newState);
182
46
  throw error;
183
- })), tap((/**
184
- * @param {?} newState
185
- * @return {?}
186
- */
187
- newState => {
47
+ }), tap(newState => {
188
48
  this.sendToDevTools(state, action, newState);
189
- })));
49
+ }));
190
50
  }
191
- /**
192
- * @private
193
- * @param {?} state
194
- * @param {?} action
195
- * @param {?} newState
196
- * @return {?}
197
- */
198
51
  sendToDevTools(state, action, newState) {
199
- /** @type {?} */
200
52
  const type = getActionTypeFromInstance(action);
201
53
  // if init action, send initial state to dev tools
202
- /** @type {?} */
203
54
  const isInitAction = type === '@@INIT';
204
55
  if (isInitAction) {
205
- (/** @type {?} */ (this.devtoolsExtension)).init(state);
56
+ this.devtoolsExtension.init(state);
206
57
  }
207
58
  else {
208
- (/** @type {?} */ (this.devtoolsExtension)).send(Object.assign({}, action, { action: null, type }), newState);
59
+ this.devtoolsExtension.send(Object.assign(Object.assign({}, action), { action: null, type }), newState);
209
60
  }
210
61
  }
211
62
  /**
212
63
  * Handle the action from the dev tools subscription
213
- * @param {?} action
214
- * @return {?}
215
64
  */
216
65
  dispatched(action) {
217
66
  if (action.type === "DISPATCH" /* Dispatch */) {
218
67
  if (action.payload.type === "JUMP_TO_ACTION" /* JumpToAction */ ||
219
68
  action.payload.type === "JUMP_TO_STATE" /* JumpToState */) {
220
- /** @type {?} */
221
69
  const prevState = JSON.parse(action.state);
222
70
  // This makes the DevTools and Router plugins friends with each other.
223
71
  // We're checking for the `router` state to exist, and it also should
@@ -235,31 +83,18 @@ class NgxsReduxDevtoolsPlugin {
235
83
  }
236
84
  else if (action.payload.type === "IMPORT_STATE" /* ImportState */) {
237
85
  const { actionsById, computedStates, currentStateIndex } = action.payload.nextLiftedState;
238
- (/** @type {?} */ (this.devtoolsExtension)).init(computedStates[0].state);
86
+ this.devtoolsExtension.init(computedStates[0].state);
239
87
  Object.keys(actionsById)
240
- .filter((/**
241
- * @param {?} actionId
242
- * @return {?}
243
- */
244
- actionId => actionId !== '0'))
245
- .forEach((/**
246
- * @param {?} actionId
247
- * @return {?}
248
- */
249
- 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));
250
90
  this.store.reset(computedStates[currentStateIndex].state);
251
91
  }
252
92
  }
253
93
  else if (action.type === "ACTION" /* Action */) {
254
- /** @type {?} */
255
94
  const actionPayload = JSON.parse(action.payload);
256
95
  this.store.dispatch(actionPayload);
257
96
  }
258
97
  }
259
- /**
260
- * @private
261
- * @return {?}
262
- */
263
98
  connect() {
264
99
  if (!this.globalDevtools || this._options.disabled) {
265
100
  return;
@@ -268,87 +103,31 @@ class NgxsReduxDevtoolsPlugin {
268
103
  // with an extension through `window.postMessage` and message events.
269
104
  // We handle only 2 events; thus, we don't want to run many change detections
270
105
  // because the extension sends events that we don't have to handle.
271
- this.devtoolsExtension = this._ngZone.runOutsideAngular((/**
272
- * @return {?}
273
- */
274
- () => (/** @type {?} */ (this.globalDevtools.connect(this._options)))));
275
- this.unsubscribe = this.devtoolsExtension.subscribe((/**
276
- * @param {?} action
277
- * @return {?}
278
- */
279
- action => {
106
+ this.devtoolsExtension = this._ngZone.runOutsideAngular(() => this.globalDevtools.connect(this._options));
107
+ this.unsubscribe = this.devtoolsExtension.subscribe(action => {
280
108
  if (action.type === "DISPATCH" /* Dispatch */ ||
281
109
  action.type === "ACTION" /* Action */) {
282
- this._ngZone.run((/**
283
- * @return {?}
284
- */
285
- () => {
110
+ this._ngZone.run(() => {
286
111
  this.dispatched(action);
287
- }));
112
+ });
288
113
  }
289
- }));
114
+ });
290
115
  }
291
116
  }
292
- NgxsReduxDevtoolsPlugin.decorators = [
293
- { type: Injectable }
294
- ];
295
- /** @nocollapse */
296
- NgxsReduxDevtoolsPlugin.ctorParameters = () => [
297
- { type: undefined, decorators: [{ type: Inject, args: [NGXS_DEVTOOLS_OPTIONS,] }] },
298
- { type: Injector },
299
- { type: NgZone }
300
- ];
301
- if (false) {
302
- /**
303
- * @type {?}
304
- * @private
305
- */
306
- NgxsReduxDevtoolsPlugin.prototype.devtoolsExtension;
307
- /**
308
- * @type {?}
309
- * @private
310
- */
311
- NgxsReduxDevtoolsPlugin.prototype.globalDevtools;
312
- /**
313
- * @type {?}
314
- * @private
315
- */
316
- NgxsReduxDevtoolsPlugin.prototype.unsubscribe;
317
- /**
318
- * @type {?}
319
- * @private
320
- */
321
- NgxsReduxDevtoolsPlugin.prototype._options;
322
- /**
323
- * @type {?}
324
- * @private
325
- */
326
- NgxsReduxDevtoolsPlugin.prototype._injector;
327
- /**
328
- * @type {?}
329
- * @private
330
- */
331
- NgxsReduxDevtoolsPlugin.prototype._ngZone;
332
- }
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 }]; } });
333
125
 
334
- /**
335
- * @fileoverview added by tsickle
336
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
337
- */
338
- /**
339
- * @param {?} options
340
- * @return {?}
341
- */
342
126
  function devtoolsOptionsFactory(options) {
343
127
  return Object.assign({ name: 'NGXS' }, options);
344
128
  }
345
- /** @type {?} */
346
129
  const USER_OPTIONS = new InjectionToken('USER_OPTIONS');
347
130
  class NgxsReduxDevtoolsPluginModule {
348
- /**
349
- * @param {?=} options
350
- * @return {?}
351
- */
352
131
  static forRoot(options) {
353
132
  return {
354
133
  ngModule: NgxsReduxDevtoolsPluginModule,
@@ -371,24 +150,20 @@ class NgxsReduxDevtoolsPluginModule {
371
150
  };
372
151
  }
373
152
  }
374
- NgxsReduxDevtoolsPluginModule.decorators = [
375
- { type: NgModule }
376
- ];
377
-
378
- /**
379
- * @fileoverview added by tsickle
380
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
381
- */
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
+ }] });
382
159
 
383
160
  /**
384
- * @fileoverview added by tsickle
385
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
161
+ * The public api for consumers of @ngxs/devtools-plugin
386
162
  */
387
163
 
388
164
  /**
389
- * @fileoverview added by tsickle
390
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
165
+ * Generated bundle index. Do not edit.
391
166
  */
392
167
 
393
- export { NGXS_DEVTOOLS_OPTIONS, NgxsReduxDevtoolsPlugin, NgxsReduxDevtoolsPluginModule, devtoolsOptionsFactory as ɵa, USER_OPTIONS as ɵb };
168
+ export { NGXS_DEVTOOLS_OPTIONS, NgxsReduxDevtoolsPlugin, NgxsReduxDevtoolsPluginModule };
394
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 * 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 /**\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\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,kCAqDC;;;;;;IAjDC,mCAAc;;;;;IAKd,uCAAmB;;;;;IAKnB,qCAAgB;;;;;;;;I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AAC,IAAI,4BACX;gBACA,IAAI,CAAC,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 /**\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\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":";;;;;MA0Ea,qBAAqB,GAAG,IAAI,cAAc,CAAC,uBAAuB;;ACnD/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,CAAC,OAAO,EAAE,CAAC;KAChB;IAED,WAAW,GAAA;AACT,QAAA,IAAI,IAAI,CAAC,WAAW,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AA,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,7 +2,7 @@
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-dev.master-fb318b1",
5
+ "version": "3.7.6-dev.master-40a2210",
6
6
  "sideEffects": true,
7
7
  "peerDependencies": {
8
8
  "@angular/core": ">=6.1.0 <16.0.0",
@@ -10,16 +10,13 @@
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",
@@ -1,5 +1,6 @@
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;
@@ -11,7 +12,10 @@ export declare function devtoolsOptionsFactory(options: NgxsDevtoolsOptions): {
11
12
  actionSanitizer?: ((action: any) => void) | undefined;
12
13
  stateSanitizer?: ((state: any) => void) | undefined;
13
14
  };
14
- export declare const USER_OPTIONS: InjectionToken<{}>;
15
+ export declare const USER_OPTIONS: InjectionToken<unknown>;
15
16
  export declare class NgxsReduxDevtoolsPluginModule {
16
17
  static forRoot(options?: NgxsDevtoolsOptions): ModuleWithProviders<NgxsReduxDevtoolsPluginModule>;
18
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgxsReduxDevtoolsPluginModule, never>;
19
+ static ɵmod: i0.ɵɵNgModuleDeclaration<NgxsReduxDevtoolsPluginModule, never, never, never>;
20
+ static ɵinj: i0.ɵɵInjectorDeclaration<NgxsReduxDevtoolsPluginModule>;
17
21
  }
@@ -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
@@ -59,4 +59,4 @@ export interface NgxsDevtoolsOptions {
59
59
  */
60
60
  stateSanitizer?: (state: any) => void;
61
61
  }
62
- export declare const NGXS_DEVTOOLS_OPTIONS: InjectionToken<{}>;
62
+ 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,EAAI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AC9D,YApCiB+D,EAAAA,gBAAUC,EAAAA,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 * 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 /**\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\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"]}
package/esm5/index.js DELETED
@@ -1,9 +0,0 @@
1
- /**
2
- * @fileoverview added by tsickle
3
- * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
4
- */
5
- /**
6
- * The public api for consumers of @ngxs/devtools-plugin
7
- */
8
- export { NgxsReduxDevtoolsPluginModule, NgxsReduxDevtoolsPlugin, NGXS_DEVTOOLS_OPTIONS } from './src/public_api';
9
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290Ijoibmc6Ly9Abmd4cy9kZXZ0b29scy1wbHVnaW4vIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7O0FBR0EsOEZBQWMsa0JBQWtCLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIFRoZSBwdWJsaWMgYXBpIGZvciBjb25zdW1lcnMgb2YgQG5neHMvZGV2dG9vbHMtcGx1Z2luXG4gKi9cbmV4cG9ydCAqIGZyb20gJy4vc3JjL3B1YmxpY19hcGknO1xuIl19