@ngxs/devtools-plugin 3.7.4 → 3.7.5-dev.master-887cc32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/bundles/ngxs-devtools-plugin.umd.js +387 -378
- package/bundles/ngxs-devtools-plugin.umd.js.map +1 -1
- package/bundles/ngxs-devtools-plugin.umd.min.js +1 -1
- package/bundles/ngxs-devtools-plugin.umd.min.js.map +1 -1
- package/esm2015/index.js +9 -9
- package/esm2015/ngxs-devtools-plugin.js +9 -9
- package/esm2015/src/devtools.module.js +48 -48
- package/esm2015/src/devtools.plugin.js +229 -220
- package/esm2015/src/public_api.js +8 -8
- package/esm2015/src/symbols.js +78 -78
- package/esm5/index.js +9 -9
- package/esm5/ngxs-devtools-plugin.js +9 -9
- package/esm5/src/devtools.module.js +57 -57
- package/esm5/src/devtools.plugin.js +271 -262
- package/esm5/src/public_api.js +8 -8
- package/esm5/src/symbols.js +78 -78
- package/fesm2015/ngxs-devtools-plugin.js +349 -340
- package/fesm2015/ngxs-devtools-plugin.js.map +1 -1
- package/fesm5/ngxs-devtools-plugin.js +396 -387
- package/fesm5/ngxs-devtools-plugin.js.map +1 -1
- package/index.d.ts +4 -4
- package/ngxs-devtools-plugin.d.ts +5 -5
- package/package.json +3 -3
- package/src/devtools.module.d.ts +13 -13
- package/src/devtools.plugin.d.ts +31 -31
- package/src/public_api.d.ts +3 -3
- package/src/symbols.d.ts +39 -39
|
@@ -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';\r\n\r\n/**\r\n * Interface for the redux-devtools-extension API.\r\n */\r\nexport interface NgxsDevtoolsExtension {\r\n init(state: any): void;\r\n send(action: any, state?: any): void;\r\n subscribe(fn: (message: NgxsDevtoolsAction) => void): VoidFunction;\r\n}\r\n\r\nexport interface NgxsDevtoolsAction {\r\n type: string;\r\n payload: any;\r\n state: any;\r\n id: number;\r\n source: string;\r\n}\r\n\r\nexport interface NgxsDevtoolsOptions {\r\n /**\r\n * The name of the extension\r\n */\r\n name?: string;\r\n\r\n /**\r\n * Whether the dev tools is enabled or note. Useful for setting during production.\r\n */\r\n disabled?: boolean;\r\n\r\n /**\r\n * Max number of entiries to keep.\r\n */\r\n maxAge?: number;\r\n\r\n /**\r\n * Reformat actions before sending to dev tools\r\n */\r\n actionSanitizer?: (action: any) => void;\r\n\r\n /**\r\n * Reformat state before sending to devtools\r\n */\r\n stateSanitizer?: (state: any) => void;\r\n}\r\n\r\nexport const NGXS_DEVTOOLS_OPTIONS = new InjectionToken('NGXS_DEVTOOLS_OPTIONS');\r\n","import { Inject, Injectable, Injector, NgZone, OnDestroy, ɵglobal } from '@angular/core';\r\nimport { getActionTypeFromInstance, NgxsNextPluginFn, NgxsPlugin, Store } from '@ngxs/store';\r\nimport { tap, catchError } from 'rxjs/operators';\r\n\r\nimport {\r\n NGXS_DEVTOOLS_OPTIONS,\r\n NgxsDevtoolsAction,\r\n NgxsDevtoolsExtension,\r\n NgxsDevtoolsOptions\r\n} from './symbols';\r\n\r\nconst enum ReduxDevtoolsActionType {\r\n Dispatch = 'DISPATCH',\r\n Action = 'ACTION'\r\n}\r\n\r\nconst enum ReduxDevtoolsPayloadType {\r\n JumpToAction = 'JUMP_TO_ACTION',\r\n JumpToState = 'JUMP_TO_STATE',\r\n ToggleAction = 'TOGGLE_ACTION',\r\n ImportState = 'IMPORT_STATE'\r\n}\r\n\r\n/**\r\n * Adds support for the Redux Devtools extension:\r\n * http://extension.remotedev.io/\r\n */\r\n@Injectable()\r\nexport class NgxsReduxDevtoolsPlugin implements OnDestroy, NgxsPlugin {\r\n private devtoolsExtension: NgxsDevtoolsExtension | null = null;\r\n private readonly globalDevtools =\r\n ɵglobal['__REDUX_DEVTOOLS_EXTENSION__'] || ɵglobal['devToolsExtension'];\r\n\r\n private unsubscribe: VoidFunction | null = null;\r\n\r\n constructor(\r\n @Inject(NGXS_DEVTOOLS_OPTIONS) private _options: NgxsDevtoolsOptions,\r\n private _injector: Injector,\r\n private _ngZone: NgZone\r\n ) {\r\n this.connect();\r\n }\r\n\r\n ngOnDestroy(): void {\r\n if (this.unsubscribe !== null) {\r\n this.unsubscribe();\r\n }\r\n if (this.globalDevtools) {\r\n this.globalDevtools.disconnect();\r\n }\r\n }\r\n\r\n /**\r\n * Lazy get the store for circular dependency issues\r\n */\r\n private get store(): Store {\r\n return this._injector.get<Store>(Store);\r\n }\r\n\r\n /**\r\n * Middleware handle function\r\n */\r\n handle(state: any, action: any, next: NgxsNextPluginFn) {\r\n if (!this.devtoolsExtension || this._options.disabled) {\r\n return next(state, action);\r\n }\r\n\r\n return next(state, action).pipe(\r\n catchError(error => {\r\n const newState = this.store.snapshot();\r\n this.sendToDevTools(state, action, newState);\r\n throw error;\r\n }),\r\n tap(newState => {\r\n this.sendToDevTools(state, action, newState);\r\n })\r\n );\r\n }\r\n\r\n private sendToDevTools(state: any, action: any, newState: any) {\r\n const type = getActionTypeFromInstance(action);\r\n // if init action, send initial state to dev tools\r\n const isInitAction = type === '@@INIT';\r\n if (isInitAction) {\r\n this.devtoolsExtension!.init(state);\r\n } else {\r\n this.devtoolsExtension!.send({ ...action, action: null, type }, newState);\r\n }\r\n }\r\n\r\n /**\r\n * Handle the action from the dev tools subscription\r\n */\r\n dispatched(action: NgxsDevtoolsAction) {\r\n if (action.type === ReduxDevtoolsActionType.Dispatch) {\r\n if (\r\n action.payload.type === ReduxDevtoolsPayloadType.JumpToAction ||\r\n action.payload.type === ReduxDevtoolsPayloadType.JumpToState\r\n ) {\r\n const prevState = JSON.parse(action.state);\r\n this.store.reset(prevState);\r\n } else if (action.payload.type === ReduxDevtoolsPayloadType.ToggleAction) {\r\n console.warn('Skip is not supported at this time.');\r\n } else if (action.payload.type === ReduxDevtoolsPayloadType.ImportState) {\r\n const {\r\n actionsById,\r\n computedStates,\r\n currentStateIndex\r\n } = action.payload.nextLiftedState;\r\n this.devtoolsExtension!.init(computedStates[0].state);\r\n Object.keys(actionsById)\r\n .filter(actionId => actionId !== '0')\r\n .forEach(actionId =>\r\n this.devtoolsExtension!.send(actionsById[actionId], computedStates[actionId].state)\r\n );\r\n this.store.reset(computedStates[currentStateIndex].state);\r\n }\r\n } else if (action.type === ReduxDevtoolsActionType.Action) {\r\n const actionPayload = JSON.parse(action.payload);\r\n this.store.dispatch(actionPayload);\r\n }\r\n }\r\n\r\n private connect(): void {\r\n if (!this.globalDevtools || this._options.disabled) {\r\n return;\r\n }\r\n\r\n // The `connect` method adds `message` event listener since it communicates\r\n // with an extension through `window.postMessage` and message events.\r\n // We handle only 2 events; thus, we don't want to run many change detections\r\n // because the extension sends events that we don't have to handle.\r\n this.devtoolsExtension = this._ngZone.runOutsideAngular(\r\n () => <NgxsDevtoolsExtension>this.globalDevtools.connect(this._options)\r\n );\r\n\r\n this.unsubscribe = this.devtoolsExtension.subscribe(action => {\r\n if (\r\n action.type === ReduxDevtoolsActionType.Dispatch ||\r\n action.type === ReduxDevtoolsActionType.Action\r\n ) {\r\n this._ngZone.run(() => {\r\n this.dispatched(action);\r\n });\r\n }\r\n });\r\n }\r\n}\r\n","import { NgModule, ModuleWithProviders, InjectionToken } from '@angular/core';\r\nimport { NGXS_PLUGINS } from '@ngxs/store';\r\n\r\nimport { NgxsDevtoolsOptions, NGXS_DEVTOOLS_OPTIONS } from './symbols';\r\nimport { NgxsReduxDevtoolsPlugin } from './devtools.plugin';\r\n\r\nexport function devtoolsOptionsFactory(options: NgxsDevtoolsOptions) {\r\n return {\r\n name: 'NGXS',\r\n ...options\r\n };\r\n}\r\n\r\nexport const USER_OPTIONS = new InjectionToken('USER_OPTIONS');\r\n\r\n@NgModule()\r\nexport class NgxsReduxDevtoolsPluginModule {\r\n static forRoot(\r\n options?: NgxsDevtoolsOptions\r\n ): ModuleWithProviders<NgxsReduxDevtoolsPluginModule> {\r\n return {\r\n ngModule: NgxsReduxDevtoolsPluginModule,\r\n providers: [\r\n {\r\n provide: NGXS_PLUGINS,\r\n useClass: NgxsReduxDevtoolsPlugin,\r\n multi: true\r\n },\r\n {\r\n provide: USER_OPTIONS,\r\n useValue: options\r\n },\r\n {\r\n provide: NGXS_DEVTOOLS_OPTIONS,\r\n useFactory: devtoolsOptionsFactory,\r\n deps: [USER_OPTIONS]\r\n }\r\n ]\r\n };\r\n }\r\n}\r\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;;;;;;IArBC,mCAAc;;;;;IAKd,uCAAmB;;;;;IAKnB,qCAAgB;;;;;IAKhB,8CAAwC;;;;;IAKxC,6CAAsC;;;AAGxC,MAAa,qBAAqB,GAAG,IAAI,cAAc,CAAC,uBAAuB,CAAC;;;;;;AC9ChF;;IAYE,UAAW,UAAU;IACrB,QAAS,QAAQ;;;;IAIjB,cAAe,gBAAgB;IAC/B,aAAc,eAAe;IAC7B,cAAe,eAAe;IAC9B,aAAc,cAAc;;;;;;AAQ9B,MAAa,uBAAuB;;;;;;IAOlC,YACyC,QAA6B,EAC5D,SAAmB,EACnB,OAAe;QAFgB,aAAQ,GAAR,QAAQ,CAAqB;QAC5D,cAAS,GAAT,SAAS,CAAU;QACnB,YAAO,GAAP,OAAO,CAAQ;QATjB,sBAAiB,GAAiC,IAAI,CAAC;QAC9C,mBAAc,GAC7B,OAAO,CAAC,8BAA8B,CAAC,IAAI,OAAO,CAAC,mBAAmB,CAAC,CAAC;QAElE,gBAAW,GAAwB,IAAI,CAAC;QAO9C,IAAI,CAAC,OAAO,EAAE,CAAC;KAChB;;;;I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AsB;oBAClC,IAAI,EAAE,CAAC,YAAY,CAAC;iBACrB;aACF;SACF,CAAC;KACH;;;YAxBF,QAAQ;;;;;;;;;;;;;;;;;;;;"}
|
|
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;;;;;;IArBC,mCAAc;;;;;IAKd,uCAAmB;;;;;IAKnB,qCAAgB;;;;;IAKhB,8CAAwC;;;;;IAKxC,6CAAsC;;;AAGxC,MAAa,qBAAqB,GAAG,IAAI,cAAc,CAAC,uBAAuB,CAAC;;;;;;AC9ChF;;IAYE,UAAW,UAAU;IACrB,QAAS,QAAQ;;;;IAIjB,cAAe,gBAAgB;IAC/B,aAAc,eAAe;IAC7B,cAAe,eAAe;IAC9B,aAAc,cAAc;;;;;;AAQ9B,MAAa,uBAAuB;;;;;;IAOlC,YACyC,QAA6B,EAC5D,SAAmB,EACnB,OAAe;QAFgB,aAAQ,GAAR,QAAQ,CAAqB;QAC5D,cAAS,GAAT,SAAS,CAAU;QACnB,YAAO,GAAP,OAAO,CAAQ;QATjB,sBAAiB,GAAiC,IAAI,CAAC;QAC9C,mBAAc,GAC7B,OAAO,CAAC,8BAA8B,CAAC,IAAI,OAAO,CAAC,mBAAmB,CAAC,CAAC;QAElE,gBAAW,GAAwB,IA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