@ngxs/websocket-plugin 3.8.2-dev.master-0fd1fe5 → 3.8.2

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,271 +0,0 @@
1
- import * as i0 from '@angular/core';
2
- import { InjectionToken, Injectable, Inject, APP_INITIALIZER, NgModule, makeEnvironmentProviders } from '@angular/core';
3
- import * as i1 from '@ngxs/store';
4
- import { ofActionDispatched, getValue } from '@ngxs/store';
5
- import { Subject, ReplaySubject, fromEvent } from 'rxjs';
6
- import { takeUntil } from 'rxjs/operators';
7
-
8
- const NG_DEV_MODE = typeof ngDevMode === 'undefined' || ngDevMode;
9
- const NGXS_WEBSOCKET_OPTIONS = new InjectionToken(NG_DEV_MODE ? 'NGXS_WEBSOCKET_OPTIONS' : '');
10
- const USER_OPTIONS = new InjectionToken(NG_DEV_MODE ? 'USER_OPTIONS' : '');
11
- /**
12
- * Action to connect to the websocket. Optionally pass a URL.
13
- */
14
- class ConnectWebSocket {
15
- constructor(payload) {
16
- this.payload = payload;
17
- }
18
- }
19
- ConnectWebSocket.type = '[WebSocket] Connect';
20
- /**
21
- * Action triggered when a error ocurrs
22
- */
23
- class WebsocketMessageError {
24
- constructor(payload) {
25
- this.payload = payload;
26
- }
27
- }
28
- WebsocketMessageError.type = '[WebSocket] Message Error';
29
- /**
30
- * Action to disconnect the websocket.
31
- */
32
- class DisconnectWebSocket {
33
- }
34
- DisconnectWebSocket.type = '[WebSocket] Disconnect';
35
- /**
36
- * Action triggered when websocket is connected
37
- */
38
- class WebSocketConnected {
39
- }
40
- WebSocketConnected.type = '[WebSocket] Connected';
41
- /**
42
- * Action triggered when websocket is disconnected
43
- */
44
- class WebSocketDisconnected {
45
- }
46
- WebSocketDisconnected.type = '[WebSocket] Disconnected';
47
- /**
48
- * Action to send to the server.
49
- */
50
- class SendWebSocketMessage {
51
- constructor(payload) {
52
- this.payload = payload;
53
- }
54
- }
55
- SendWebSocketMessage.type = '[WebSocket] Send Message';
56
- /**
57
- * Action dispatched when the user tries to connect if the connection already exists.
58
- */
59
- class WebSocketConnectionUpdated {
60
- }
61
- WebSocketConnectionUpdated.type = '[WebSocket] Connection Updated';
62
- /**
63
- * This error is thrown where there is no `type` (or custom `typeKey`) property
64
- * on the message that came from the server side socket
65
- */
66
- class TypeKeyPropertyMissingError extends Error {
67
- constructor(typeKey) {
68
- super(`Property ${typeKey} is missing on the socket message`);
69
- }
70
- }
71
-
72
- class WebSocketHandler {
73
- constructor(_store, _ngZone, _actions$, _options) {
74
- this._store = _store;
75
- this._ngZone = _ngZone;
76
- this._actions$ = _actions$;
77
- this._options = _options;
78
- this._socket = null;
79
- this._socketClosed$ = new Subject();
80
- this._typeKey = this._options.typeKey;
81
- this._destroy$ = new ReplaySubject(1);
82
- this._setupActionsListeners();
83
- }
84
- ngOnDestroy() {
85
- this._disconnect(/* forcelyCloseSocket */ true);
86
- this._destroy$.next();
87
- }
88
- _setupActionsListeners() {
89
- this._actions$
90
- .pipe(ofActionDispatched(ConnectWebSocket), takeUntil(this._destroy$))
91
- .subscribe(({ payload }) => {
92
- this.connect(payload);
93
- });
94
- this._actions$
95
- .pipe(ofActionDispatched(DisconnectWebSocket), takeUntil(this._destroy$))
96
- .subscribe(() => {
97
- this._disconnect(/* forcelyCloseSocket */ true);
98
- });
99
- this._actions$
100
- .pipe(ofActionDispatched(SendWebSocketMessage), takeUntil(this._destroy$))
101
- .subscribe(({ payload }) => {
102
- this.send(payload);
103
- });
104
- }
105
- connect(options) {
106
- if (this._socket) {
107
- this._closeConnection(/* forcelyCloseSocket */ true);
108
- this._store.dispatch(new WebSocketConnectionUpdated());
109
- }
110
- // TODO(arturovt): we should not override default config values because this breaks support for having multiple socket connections.
111
- if (options) {
112
- if (options.serializer) {
113
- this._options.serializer = options.serializer;
114
- }
115
- if (options.deserializer) {
116
- this._options.deserializer = options.deserializer;
117
- }
118
- }
119
- this._ngZone.runOutsideAngular(() => {
120
- // We either use options provided in the `ConnectWebSocket` action
121
- // or fallback to default config values.
122
- const url = options?.url || this._options.url;
123
- const protocol = options?.protocol || this._options.protocol;
124
- const binaryType = options?.binaryType || this._options.binaryType;
125
- const socket = (this._socket = protocol
126
- ? new WebSocket(url, protocol)
127
- : new WebSocket(url));
128
- if (binaryType) {
129
- socket.binaryType = binaryType;
130
- }
131
- fromEvent(socket, 'open')
132
- .pipe(takeUntil(this._socketClosed$))
133
- .subscribe(() => this._store.dispatch(new WebSocketConnected()));
134
- fromEvent(socket, 'message')
135
- .pipe(takeUntil(this._socketClosed$))
136
- .subscribe(event => {
137
- const message = this._options.deserializer(event);
138
- const type = getValue(message, this._typeKey);
139
- if (!type) {
140
- throw new TypeKeyPropertyMissingError(this._typeKey);
141
- }
142
- this._store.dispatch({ ...message, type });
143
- });
144
- fromEvent(socket, 'error')
145
- .pipe(takeUntil(this._socketClosed$))
146
- .subscribe(error => {
147
- // The error event indicates that an error has occurred during the
148
- // WebSocket communication, and it is often appropriate to close the
149
- // WebSocket connection when such an error occurs.
150
- // We need to call `_disconnect()` after the error event has been fired.
151
- // This ensures that the WebSocket connection is properly closed to prevent
152
- // potential resource leaks.
153
- this._disconnect(/* forcelyCloseSocket */ true);
154
- this._store.dispatch(new WebsocketMessageError(error));
155
- });
156
- fromEvent(socket, 'close')
157
- .pipe(takeUntil(this._socketClosed$))
158
- .subscribe(event => {
159
- if (event.wasClean) {
160
- // It is not necessary to call `socket.close()` after the `close` event
161
- // has been fired. In fact, calling `socket.close()` within the `close`
162
- // event handler or immediately after the event has been fired can lead
163
- // to unexpected behavior.
164
- this._disconnect(/* forcelyCloseSocket */ false);
165
- }
166
- else {
167
- // If the WebSocket `close` event has been fired and its `wasClean`
168
- // property is falsy, it indicates that the WebSocket connection was
169
- // closed in an unexpected or abnormal manner.
170
- // We should call `socket.close()` in this scenario, we can ensure that
171
- // the WebSocket connection is properly closed.
172
- this._disconnect(/* forcelyCloseSocket */ true);
173
- this._store.dispatch(new WebsocketMessageError(event));
174
- }
175
- });
176
- });
177
- }
178
- _disconnect(forcelyCloseSocket) {
179
- if (this._socket) {
180
- this._closeConnection(forcelyCloseSocket);
181
- this._store.dispatch(new WebSocketDisconnected());
182
- }
183
- }
184
- send(data) {
185
- if (!this._socket) {
186
- throw new Error('You must connect to the socket before sending any data');
187
- }
188
- try {
189
- this._socket.send(this._options.serializer(data));
190
- }
191
- catch (error) {
192
- this._store.dispatch(new WebsocketMessageError(error));
193
- }
194
- }
195
- _closeConnection(forcelyCloseSocket) {
196
- if (forcelyCloseSocket) {
197
- this._socket?.close();
198
- }
199
- this._socket = null;
200
- this._socketClosed$.next();
201
- }
202
- }
203
- /** @nocollapse */ WebSocketHandler.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.4", ngImport: i0, type: WebSocketHandler, deps: [{ token: i1.Store }, { token: i0.NgZone }, { token: i1.Actions }, { token: NGXS_WEBSOCKET_OPTIONS }], target: i0.ɵɵFactoryTarget.Injectable });
204
- /** @nocollapse */ WebSocketHandler.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.4", ngImport: i0, type: WebSocketHandler, providedIn: 'root' });
205
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.4", ngImport: i0, type: WebSocketHandler, decorators: [{
206
- type: Injectable,
207
- args: [{ providedIn: 'root' }]
208
- }], ctorParameters: function () { return [{ type: i1.Store }, { type: i0.NgZone }, { type: i1.Actions }, { type: undefined, decorators: [{
209
- type: Inject,
210
- args: [NGXS_WEBSOCKET_OPTIONS]
211
- }] }]; } });
212
-
213
- function ɵwebsocketOptionsFactory(options) {
214
- return {
215
- reconnectInterval: 5000,
216
- reconnectAttempts: 10,
217
- typeKey: 'type',
218
- deserializer(e) {
219
- return JSON.parse(e.data);
220
- },
221
- serializer(value) {
222
- return JSON.stringify(value);
223
- },
224
- ...options
225
- };
226
- }
227
- function ɵgetProviders(options) {
228
- return [
229
- { provide: USER_OPTIONS, useValue: options },
230
- {
231
- provide: NGXS_WEBSOCKET_OPTIONS,
232
- useFactory: ɵwebsocketOptionsFactory,
233
- deps: [USER_OPTIONS]
234
- },
235
- {
236
- provide: APP_INITIALIZER,
237
- useFactory: () => () => { },
238
- deps: [WebSocketHandler],
239
- multi: true
240
- }
241
- ];
242
- }
243
-
244
- class NgxsWebsocketPluginModule {
245
- static forRoot(options) {
246
- return {
247
- ngModule: NgxsWebsocketPluginModule,
248
- providers: ɵgetProviders(options)
249
- };
250
- }
251
- }
252
- /** @nocollapse */ NgxsWebsocketPluginModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.4", ngImport: i0, type: NgxsWebsocketPluginModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
253
- /** @nocollapse */ NgxsWebsocketPluginModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.4", ngImport: i0, type: NgxsWebsocketPluginModule });
254
- /** @nocollapse */ NgxsWebsocketPluginModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.4", ngImport: i0, type: NgxsWebsocketPluginModule });
255
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.4", ngImport: i0, type: NgxsWebsocketPluginModule, decorators: [{
256
- type: NgModule
257
- }] });
258
- function withNgxsWebSocketPlugin(options) {
259
- return makeEnvironmentProviders(ɵgetProviders(options));
260
- }
261
-
262
- /**
263
- * The public api for consumers of @ngxs/websocket-plugin
264
- */
265
-
266
- /**
267
- * Generated bundle index. Do not edit.
268
- */
269
-
270
- export { ConnectWebSocket, DisconnectWebSocket, NGXS_WEBSOCKET_OPTIONS, NgxsWebsocketPluginModule, SendWebSocketMessage, WebSocketConnected, WebSocketConnectionUpdated, WebSocketDisconnected, WebsocketMessageError, withNgxsWebSocketPlugin };
271
- //# sourceMappingURL=ngxs-websocket-plugin.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ngxs-websocket-plugin.mjs","sources":["../../../packages/websocket-plugin/src/symbols.ts","../../../packages/websocket-plugin/src/websocket-handler.ts","../../../packages/websocket-plugin/src/providers.ts","../../../packages/websocket-plugin/src/websocket.module.ts","../../../packages/websocket-plugin/index.ts","../../../packages/websocket-plugin/ngxs-websocket-plugin.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\ndeclare const ngDevMode: boolean;\n\nconst NG_DEV_MODE = typeof ngDevMode === 'undefined' || ngDevMode;\n\nexport const NGXS_WEBSOCKET_OPTIONS = new InjectionToken<NgxsWebsocketPluginOptions>(\n NG_DEV_MODE ? 'NGXS_WEBSOCKET_OPTIONS' : ''\n);\n\nexport const USER_OPTIONS = new InjectionToken(NG_DEV_MODE ? 'USER_OPTIONS' : '');\n\nexport interface NgxsWebsocketPluginOptions {\n /**\n * URL of the websocket.\n */\n url?: string;\n\n /**\n * Either a single protocol string or an array of protocol strings.\n * These strings are used to indicate sub-protocols, so that a single server\n * can implement multiple WebSocket sub-protocols (for example, you might want one server to be able\n * to handle different types of interactions depending on the specified protocol).\n * If you don't specify a protocol string, an empty string is assumed.\n */\n protocol?: string | string[];\n\n /**\n * Sets the `binaryType` property of the underlying WebSocket.\n */\n binaryType?: 'blob' | 'arraybuffer';\n\n /**\n * The property name to distigunish this type for the store.\n * Default: 'type'\n */\n typeKey?: string;\n\n /**\n * Interval to try and reconnect.\n * Default: 5000\n */\n reconnectInterval?: number;\n\n /**\n * Number of reconnect attemps.\n * Default: 10\n */\n reconnectAttempts?: number;\n\n /**\n * Serializer to call before sending messages\n * Default: `json.stringify`\n */\n serializer?: (data: any) => string;\n\n /**\n * Deseralizer before publishing the message.\n */\n deserializer?: (e: MessageEvent) => any;\n}\n\n/**\n * Action to connect to the websocket. Optionally pass a URL.\n */\nexport class ConnectWebSocket {\n static readonly type = '[WebSocket] Connect';\n\n constructor(public payload?: NgxsWebsocketPluginOptions) {}\n}\n\n/**\n * Action triggered when a error ocurrs\n */\nexport class WebsocketMessageError {\n static readonly type = '[WebSocket] Message Error';\n\n constructor(public payload: any) {}\n}\n\n/**\n * Action to disconnect the websocket.\n */\nexport class DisconnectWebSocket {\n static readonly type = '[WebSocket] Disconnect';\n}\n\n/**\n * Action triggered when websocket is connected\n */\nexport class WebSocketConnected {\n static readonly type = '[WebSocket] Connected';\n}\n\n/**\n * Action triggered when websocket is disconnected\n */\nexport class WebSocketDisconnected {\n static readonly type = '[WebSocket] Disconnected';\n}\n\n/**\n * Action to send to the server.\n */\nexport class SendWebSocketMessage {\n static readonly type = '[WebSocket] Send Message';\n\n constructor(public payload: any) {}\n}\n\n/**\n * Action dispatched when the user tries to connect if the connection already exists.\n */\nexport class WebSocketConnectionUpdated {\n static readonly type = '[WebSocket] Connection Updated';\n}\n\n/**\n * This error is thrown where there is no `type` (or custom `typeKey`) property\n * on the message that came from the server side socket\n */\nexport class TypeKeyPropertyMissingError extends Error {\n constructor(typeKey: string) {\n super(`Property ${typeKey} is missing on the socket message`);\n }\n}\n","import { Injectable, Inject, OnDestroy, NgZone } from '@angular/core';\nimport { Actions, Store, getValue, ofActionDispatched } from '@ngxs/store';\nimport { ReplaySubject, Subject, fromEvent } from 'rxjs';\nimport { takeUntil } from 'rxjs/operators';\n\nimport {\n ConnectWebSocket,\n DisconnectWebSocket,\n SendWebSocketMessage,\n NGXS_WEBSOCKET_OPTIONS,\n NgxsWebsocketPluginOptions,\n WebsocketMessageError,\n WebSocketDisconnected,\n TypeKeyPropertyMissingError,\n WebSocketConnectionUpdated,\n WebSocketConnected\n} from './symbols';\n\n@Injectable({ providedIn: 'root' })\nexport class WebSocketHandler implements OnDestroy {\n private _socket: WebSocket | null = null;\n\n private readonly _socketClosed$ = new Subject<void>();\n\n private readonly _typeKey = this._options.typeKey!;\n\n private readonly _destroy$ = new ReplaySubject<void>(1);\n\n constructor(\n private _store: Store,\n private _ngZone: NgZone,\n private _actions$: Actions,\n @Inject(NGXS_WEBSOCKET_OPTIONS) private _options: NgxsWebsocketPluginOptions\n ) {\n this._setupActionsListeners();\n }\n\n ngOnDestroy(): void {\n this._disconnect(/* forcelyCloseSocket */ true);\n this._destroy$.next();\n }\n\n private _setupActionsListeners(): void {\n this._actions$\n .pipe(ofActionDispatched(ConnectWebSocket), takeUntil(this._destroy$))\n .subscribe(({ payload }) => {\n this.connect(payload);\n });\n\n this._actions$\n .pipe(ofActionDispatched(DisconnectWebSocket), takeUntil(this._destroy$))\n .subscribe(() => {\n this._disconnect(/* forcelyCloseSocket */ true);\n });\n\n this._actions$\n .pipe(ofActionDispatched(SendWebSocketMessage), takeUntil(this._destroy$))\n .subscribe(({ payload }) => {\n this.send(payload);\n });\n }\n\n private connect(options?: NgxsWebsocketPluginOptions): void {\n if (this._socket) {\n this._closeConnection(/* forcelyCloseSocket */ true);\n this._store.dispatch(new WebSocketConnectionUpdated());\n }\n\n // TODO(arturovt): we should not override default config values because this breaks support for having multiple socket connections.\n if (options) {\n if (options.serializer) {\n this._options.serializer = options.serializer;\n }\n\n if (options.deserializer) {\n this._options.deserializer = options.deserializer;\n }\n }\n\n this._ngZone.runOutsideAngular(() => {\n // We either use options provided in the `ConnectWebSocket` action\n // or fallback to default config values.\n const url = options?.url || this._options.url!;\n const protocol = options?.protocol || this._options.protocol;\n const binaryType = options?.binaryType || this._options.binaryType;\n\n const socket = (this._socket = protocol\n ? new WebSocket(url, protocol)\n : new WebSocket(url));\n\n if (binaryType) {\n socket.binaryType = binaryType;\n }\n\n fromEvent(socket, 'open')\n .pipe(takeUntil(this._socketClosed$))\n .subscribe(() => this._store.dispatch(new WebSocketConnected()));\n\n fromEvent<MessageEvent>(socket, 'message')\n .pipe(takeUntil(this._socketClosed$))\n .subscribe(event => {\n const message = this._options.deserializer!(event);\n const type = getValue(message, this._typeKey);\n if (!type) {\n throw new TypeKeyPropertyMissingError(this._typeKey);\n }\n this._store.dispatch({ ...message, type });\n });\n\n fromEvent(socket, 'error')\n .pipe(takeUntil(this._socketClosed$))\n .subscribe(error => {\n // The error event indicates that an error has occurred during the\n // WebSocket communication, and it is often appropriate to close the\n // WebSocket connection when such an error occurs.\n // We need to call `_disconnect()` after the error event has been fired.\n // This ensures that the WebSocket connection is properly closed to prevent\n // potential resource leaks.\n this._disconnect(/* forcelyCloseSocket */ true);\n this._store.dispatch(new WebsocketMessageError(error));\n });\n\n fromEvent<CloseEvent>(socket, 'close')\n .pipe(takeUntil(this._socketClosed$))\n .subscribe(event => {\n if (event.wasClean) {\n // It is not necessary to call `socket.close()` after the `close` event\n // has been fired. In fact, calling `socket.close()` within the `close`\n // event handler or immediately after the event has been fired can lead\n // to unexpected behavior.\n this._disconnect(/* forcelyCloseSocket */ false);\n } else {\n // If the WebSocket `close` event has been fired and its `wasClean`\n // property is falsy, it indicates that the WebSocket connection was\n // closed in an unexpected or abnormal manner.\n // We should call `socket.close()` in this scenario, we can ensure that\n // the WebSocket connection is properly closed.\n this._disconnect(/* forcelyCloseSocket */ true);\n this._store.dispatch(new WebsocketMessageError(event));\n }\n });\n });\n }\n\n private _disconnect(forcelyCloseSocket: boolean): void {\n if (this._socket) {\n this._closeConnection(forcelyCloseSocket);\n this._store.dispatch(new WebSocketDisconnected());\n }\n }\n\n private send(data: any): void {\n if (!this._socket) {\n throw new Error('You must connect to the socket before sending any data');\n }\n\n try {\n this._socket.send(this._options.serializer!(data));\n } catch (error) {\n this._store.dispatch(new WebsocketMessageError(error));\n }\n }\n\n private _closeConnection(forcelyCloseSocket: boolean): void {\n if (forcelyCloseSocket) {\n this._socket?.close();\n }\n this._socket = null;\n this._socketClosed$.next();\n }\n}\n","import { APP_INITIALIZER } from '@angular/core';\n\nimport { WebSocketHandler } from './websocket-handler';\nimport { USER_OPTIONS, NGXS_WEBSOCKET_OPTIONS, NgxsWebsocketPluginOptions } from './symbols';\n\nexport function ɵwebsocketOptionsFactory(options: NgxsWebsocketPluginOptions) {\n return {\n reconnectInterval: 5000,\n reconnectAttempts: 10,\n typeKey: 'type',\n deserializer(e: MessageEvent) {\n return JSON.parse(e.data);\n },\n serializer(value: any) {\n return JSON.stringify(value);\n },\n ...options\n };\n}\n\nexport function ɵgetProviders(options?: NgxsWebsocketPluginOptions) {\n return [\n { provide: USER_OPTIONS, useValue: options },\n {\n provide: NGXS_WEBSOCKET_OPTIONS,\n useFactory: ɵwebsocketOptionsFactory,\n deps: [USER_OPTIONS]\n },\n {\n provide: APP_INITIALIZER,\n useFactory: () => () => {},\n deps: [WebSocketHandler],\n multi: true\n }\n ];\n}\n","import {\n NgModule,\n ModuleWithProviders,\n EnvironmentProviders,\n makeEnvironmentProviders\n} from '@angular/core';\n\nimport { ɵgetProviders } from './providers';\nimport { NgxsWebsocketPluginOptions } from './symbols';\n\n@NgModule()\nexport class NgxsWebsocketPluginModule {\n static forRoot(\n options?: NgxsWebsocketPluginOptions\n ): ModuleWithProviders<NgxsWebsocketPluginModule> {\n return {\n ngModule: NgxsWebsocketPluginModule,\n providers: ɵgetProviders(options)\n };\n }\n}\n\nexport function withNgxsWebSocketPlugin(\n options?: NgxsWebsocketPluginOptions\n): EnvironmentProviders {\n return makeEnvironmentProviders(ɵgetProviders(options));\n}\n","/**\n * The public api for consumers of @ngxs/websocket-plugin\n */\nexport * from './src/public_api';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;AAIA,MAAM,WAAW,GAAG,OAAO,SAAS,KAAK,WAAW,IAAI,SAAS,CAAC;AAErD,MAAA,sBAAsB,GAAG,IAAI,cAAc,CACtD,WAAW,GAAG,wBAAwB,GAAG,EAAE,EAC3C;AAEK,MAAM,YAAY,GAAG,IAAI,cAAc,CAAC,WAAW,GAAG,cAAc,GAAG,EAAE,CAAC,CAAC;AAoDlF;;AAEG;MACU,gBAAgB,CAAA;AAG3B,IAAA,WAAA,CAAmB,OAAoC,EAAA;QAApC,IAAO,CAAA,OAAA,GAAP,OAAO,CAA6B;KAAI;;AAF3C,gBAAI,CAAA,IAAA,GAAG,qBAAqB,CAAC;AAK/C;;AAEG;MACU,qBAAqB,CAAA;AAGh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,aAAa,CAAC,OAAO,CAAC;SAClC,CAAC;KACH;;yIARU,yBAAyB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;0IAAzB,yBAAyB,EAAA,CAAA,CAAA;0IAAzB,yBAAyB,EAAA,CAAA,CAAA;2FAAzB,yBAAyB,EAAA,UAAA,EAAA,CAAA;kBADrC,QAAQ;;AAYH,SAAU,uBAAuB,CACrC,OAAoC,EAAA;AAEpC,IAAA,OAAO,wBAAwB,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC;AAC1D;;AC1BA;;AAEG;;ACFH;;AAEG;;;;"}
@@ -1,31 +0,0 @@
1
- import { WebSocketHandler } from './websocket-handler';
2
- import { NgxsWebsocketPluginOptions } from './symbols';
3
- export declare function ɵwebsocketOptionsFactory(options: NgxsWebsocketPluginOptions): {
4
- url?: string | undefined;
5
- protocol?: string | string[] | undefined;
6
- binaryType?: "blob" | "arraybuffer" | undefined;
7
- typeKey: string;
8
- reconnectInterval: number;
9
- reconnectAttempts: number;
10
- serializer: (data: any) => string;
11
- deserializer: (e: MessageEvent<any>) => any;
12
- };
13
- export declare function ɵgetProviders(options?: NgxsWebsocketPluginOptions): ({
14
- provide: import("@angular/core").InjectionToken<unknown>;
15
- useValue: NgxsWebsocketPluginOptions | undefined;
16
- useFactory?: undefined;
17
- deps?: undefined;
18
- multi?: undefined;
19
- } | {
20
- provide: import("@angular/core").InjectionToken<NgxsWebsocketPluginOptions>;
21
- useFactory: typeof ɵwebsocketOptionsFactory;
22
- deps: import("@angular/core").InjectionToken<unknown>[];
23
- useValue?: undefined;
24
- multi?: undefined;
25
- } | {
26
- provide: import("@angular/core").InjectionToken<readonly (() => void | import("rxjs").Observable<unknown> | Promise<unknown>)[]>;
27
- useFactory: () => () => void;
28
- deps: (typeof WebSocketHandler)[];
29
- multi: boolean;
30
- useValue?: undefined;
31
- })[];
File without changes