@aventusjs/cli 0.0.10 → 0.0.11

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.
@@ -2,792 +2,792 @@
2
2
  // npm:@aventusjs/sharp
3
3
  //#region js def //
4
4
  declare global {
5
-
5
+
6
6
  namespace AventusSharp{
7
7
  namespace WebSocket {
8
- interface WsRouterOptions {
9
- url: string;
10
- }
8
+ interface WsRouterOptions {
9
+ url: string;
10
+ }
11
11
  }
12
12
 
13
13
  namespace RAM {
14
- type RamWebSocketListenOnStart = {
15
- GetAll: boolean;
16
- GetById: boolean;
17
- Create: boolean;
18
- CreateMany: boolean;
19
- Update: boolean;
20
- UpdateMany: boolean;
21
- Delete: boolean;
22
- DeleteMany: boolean;
23
- };
14
+ type RamWebSocketListenOnStart = {
15
+ GetAll: boolean;
16
+ GetById: boolean;
17
+ Create: boolean;
18
+ CreateMany: boolean;
19
+ Update: boolean;
20
+ UpdateMany: boolean;
21
+ Delete: boolean;
22
+ DeleteMany: boolean;
23
+ };
24
24
  }
25
25
 
26
26
  namespace Data {
27
- abstract class Storable extends Aventus.Data implements Aventus.IData {
28
- Id: number;
29
- /**
30
- * @inerhit
31
- */
32
- toJSON(): any;
33
- }
27
+ abstract class Storable extends Aventus.Data implements Aventus.IData {
28
+ Id: number;
29
+ /**
30
+ * @inerhit
31
+ */
32
+ toJSON(): any;
33
+ }
34
34
  }
35
35
 
36
36
  namespace Data {
37
- abstract class StorableTimestamp extends Data.Storable implements Aventus.IData {
38
- CreatedDate: Date;
39
- UpdatedDate: Date;
40
- }
37
+ abstract class StorableTimestamp extends Data.Storable implements Aventus.IData {
38
+ CreatedDate: Date;
39
+ UpdatedDate: Date;
40
+ }
41
41
  }
42
42
 
43
43
  namespace WebSocket {
44
- enum WsErrorCode {
45
- UnknowError = 0,
46
- CantDefineAssembly = 1,
47
- ConfigError = 2,
48
- MultipleMainEndpoint = 3,
49
- CantGetValueFromBody = 4,
50
- NoConnection = 5,
51
- NoEndPoint = 6,
52
- NoPath = 7
53
- }
44
+ enum WsErrorCode {
45
+ UnknowError = 0,
46
+ CantDefineAssembly = 1,
47
+ ConfigError = 2,
48
+ MultipleMainEndpoint = 3,
49
+ CantGetValueFromBody = 4,
50
+ NoConnection = 5,
51
+ NoEndPoint = 6,
52
+ NoPath = 7
53
+ }
54
54
  }
55
55
 
56
56
  namespace WebSocket {
57
- interface WsRouteSendOptions {
58
- uid?: string;
59
- timeout?: number;
60
- }
57
+ interface WsRouteSendOptions {
58
+ uid?: string;
59
+ timeout?: number;
60
+ }
61
61
  }
62
62
 
63
63
  namespace WebSocket {
64
- interface SocketMessage {
65
- channel: string;
66
- data?: any;
67
- uid?: string;
68
- }
64
+ interface SocketMessage {
65
+ channel: string;
66
+ data?: any;
67
+ uid?: string;
68
+ }
69
69
  }
70
70
 
71
71
  namespace WebSocket {
72
- enum SocketErrorCode {
73
- socketClosed = 0,
74
- timeout = 1,
75
- differentChannel = 2,
76
- unknow = 3
77
- }
72
+ enum SocketErrorCode {
73
+ socketClosed = 0,
74
+ timeout = 1,
75
+ differentChannel = 2,
76
+ unknow = 3
77
+ }
78
78
  }
79
79
 
80
80
  namespace WebSocket {
81
- class Socket {
82
- static Debug: boolean;
83
- private static connections;
84
- static getInstance(url: string, el: any): WebSocket.Socket;
85
- private socket;
86
- private url;
87
- private elements;
88
- private reopenInterval;
89
- onOpen: Aventus.Callback<(ev: Event) => any>;
90
- onClose: Aventus.Callback<(ev: Event) => any>;
91
- onError: Aventus.Callback<(ev: Event) => any>;
92
- onMessage: Aventus.Callback<(ev: MessageEvent<any>) => any>;
93
- get readyState(): number;
94
- protected constructor(url: string, el: any);
95
- protected registerEl(el: any): void;
96
- private createWebSocket;
97
- protected removeSocket(): void;
98
- protected reopen(): void;
99
- close(el: any, code?: number | undefined, reason?: string | undefined): void;
100
- send(data: string | ArrayBufferLike | Blob | ArrayBufferView): void;
101
- /**
102
- * Check if socket is ready
103
- */
104
- isReady(): boolean;
105
- }
81
+ class Socket {
82
+ static Debug: boolean;
83
+ private static connections;
84
+ static getInstance(url: string, el: any): WebSocket.Socket;
85
+ private socket;
86
+ private url;
87
+ private elements;
88
+ private reopenInterval;
89
+ onOpen: Aventus.Callback<(ev: Event) => any>;
90
+ onClose: Aventus.Callback<(ev: Event) => any>;
91
+ onError: Aventus.Callback<(ev: Event) => any>;
92
+ onMessage: Aventus.Callback<(ev: MessageEvent<any>) => any>;
93
+ get readyState(): number;
94
+ protected constructor(url: string, el: any);
95
+ protected registerEl(el: any): void;
96
+ private createWebSocket;
97
+ protected removeSocket(): void;
98
+ protected reopen(): void;
99
+ close(el: any, code?: number | undefined, reason?: string | undefined): void;
100
+ send(data: string | ArrayBufferLike | Blob | ArrayBufferView): void;
101
+ /**
102
+ * Check if socket is ready
103
+ */
104
+ isReady(): boolean;
105
+ }
106
106
  }
107
107
 
108
108
  namespace WebSocket {
109
- interface SocketSendMessageOptions {
110
- channel: string;
111
- body?: {
112
- [key: string | number]: any;
113
- };
114
- timeout?: number;
115
- uid?: string;
116
- }
109
+ interface SocketSendMessageOptions {
110
+ channel: string;
111
+ body?: {
112
+ [key: string | number]: any;
113
+ };
114
+ timeout?: number;
115
+ uid?: string;
116
+ }
117
117
  }
118
118
 
119
119
  namespace WebSocket {
120
- interface SocketRoute<T = any> {
121
- channel: string;
122
- callback: (data: T, params: Aventus.UriParamsValue, uid?: string) => void;
123
- }
120
+ interface SocketRoute<T = any> {
121
+ channel: string;
122
+ callback: (data: T, params: Aventus.UriParamsValue, uid?: string) => void;
123
+ }
124
124
  }
125
125
 
126
126
  namespace Routes {
127
- enum RouteErrorCode {
128
- UnknowError = 0,
129
- FormContentTypeUnknown = 1,
130
- CantGetValueFromBody = 2,
131
- CantMoveFile = 3,
132
- CantCreateFolders = 4,
133
- RouteAlreadyExist = 5
134
- }
127
+ enum RouteErrorCode {
128
+ UnknowError = 0,
129
+ FormContentTypeUnknown = 1,
130
+ CantGetValueFromBody = 2,
131
+ CantMoveFile = 3,
132
+ CantCreateFolders = 4,
133
+ RouteAlreadyExist = 5
134
+ }
135
135
  }
136
136
 
137
137
  namespace Data {
138
- interface IStorableTimestamp extends Aventus.IData {
139
- CreatedDate: Date;
140
- UpdatedDate: Date;
141
- }
138
+ interface IStorableTimestamp extends Aventus.IData {
139
+ CreatedDate: Date;
140
+ UpdatedDate: Date;
141
+ }
142
142
  }
143
143
 
144
144
  namespace Tools {
145
- interface IWithError<T extends Aventus.GenericError> {
146
- }
145
+ interface IWithError<T extends Aventus.GenericError> {
146
+ }
147
147
  }
148
148
 
149
149
  namespace Tools {
150
- interface IResultWithError<T extends Aventus.GenericError> extends Tools.IWithError<T> {
151
- }
150
+ interface IResultWithError<T extends Aventus.GenericError> extends Tools.IWithError<T> {
151
+ }
152
152
  }
153
153
 
154
154
  namespace Data {
155
- enum DataErrorCode {
156
- DefaultDMGenericType = 0,
157
- DMOnlyForceInherit = 1,
158
- TypeNotStorable = 2,
159
- TypeTooMuchStorable = 3,
160
- GenericNotAbstract = 4,
161
- ParentNotAbstract = 5,
162
- InfiniteLoop = 6,
163
- InterfaceNotUnique = 7,
164
- SelfReferecingDependance = 8,
165
- DMNotExist = 9,
166
- DMAlreadyExist = 10,
167
- MethodNotFound = 11,
168
- StorageDisconnected = 12,
169
- StorageNotFound = 13,
170
- NoConnectionInsideStorage = 14,
171
- TypeNotExistInsideStorage = 15,
172
- UnknowError = 16,
173
- NoItemProvided = 17,
174
- NoTransactionInProgress = 18,
175
- WrongType = 19,
176
- NoTypeIdentifierFoundInsideQuery = 20,
177
- ItemNoExistInsideStorage = 21,
178
- ItemAlreadyExist = 22,
179
- ValidationError = 23,
180
- GetAllNotAllowed = 24,
181
- GetByIdNotAllowed = 25,
182
- GetByIdsNotAllowed = 26,
183
- WhereNotAllowed = 27,
184
- CreateNotAllowed = 28,
185
- UpdateNotAllowed = 29,
186
- DeleteNotAllowed = 30,
187
- NumberOfItemsNotMatching = 31,
188
- FieldTypeNotFound = 32,
189
- MemberNotFound = 33,
190
- TooMuchMemberFound = 34,
191
- TypeNotFound = 35,
192
- ReverseLinkNotExist = 36,
193
- ErrorCreatingReverseQuery = 37,
194
- LinkNotSet = 38
195
- }
155
+ enum DataErrorCode {
156
+ DefaultDMGenericType = 0,
157
+ DMOnlyForceInherit = 1,
158
+ TypeNotStorable = 2,
159
+ TypeTooMuchStorable = 3,
160
+ GenericNotAbstract = 4,
161
+ ParentNotAbstract = 5,
162
+ InfiniteLoop = 6,
163
+ InterfaceNotUnique = 7,
164
+ SelfReferecingDependance = 8,
165
+ DMNotExist = 9,
166
+ DMAlreadyExist = 10,
167
+ MethodNotFound = 11,
168
+ StorageDisconnected = 12,
169
+ StorageNotFound = 13,
170
+ NoConnectionInsideStorage = 14,
171
+ TypeNotExistInsideStorage = 15,
172
+ UnknowError = 16,
173
+ NoItemProvided = 17,
174
+ NoTransactionInProgress = 18,
175
+ WrongType = 19,
176
+ NoTypeIdentifierFoundInsideQuery = 20,
177
+ ItemNoExistInsideStorage = 21,
178
+ ItemAlreadyExist = 22,
179
+ ValidationError = 23,
180
+ GetAllNotAllowed = 24,
181
+ GetByIdNotAllowed = 25,
182
+ GetByIdsNotAllowed = 26,
183
+ WhereNotAllowed = 27,
184
+ CreateNotAllowed = 28,
185
+ UpdateNotAllowed = 29,
186
+ DeleteNotAllowed = 30,
187
+ NumberOfItemsNotMatching = 31,
188
+ FieldTypeNotFound = 32,
189
+ MemberNotFound = 33,
190
+ TooMuchMemberFound = 34,
191
+ TypeNotFound = 35,
192
+ ReverseLinkNotExist = 36,
193
+ ErrorCreatingReverseQuery = 37,
194
+ LinkNotSet = 38
195
+ }
196
196
  }
197
197
 
198
198
  namespace Data {
199
- abstract class SharpClass {
200
- /**
201
- * The current namespace
202
- */
203
- get namespace(): string;
204
- /**
205
- * Get the unique type for the data. Define it as the namespace + class name
206
- */
207
- get $type(): string;
208
- /**
209
- * Get the name of the class
210
- */
211
- get className(): string;
212
- /**
213
- * Clone the object by transforming a parsed JSON string back into the original type
214
- */
215
- clone(): this;
216
- /**
217
- * Get a JSON for the current object
218
- */
219
- toJSON(): any;
220
- }
199
+ abstract class SharpClass {
200
+ /**
201
+ * The current namespace
202
+ */
203
+ get namespace(): string;
204
+ /**
205
+ * Get the unique type for the data. Define it as the namespace + class name
206
+ */
207
+ get $type(): string;
208
+ /**
209
+ * Get the name of the class
210
+ */
211
+ get className(): string;
212
+ /**
213
+ * Clone the object by transforming a parsed JSON string back into the original type
214
+ */
215
+ clone(): this;
216
+ /**
217
+ * Get a JSON for the current object
218
+ */
219
+ toJSON(): any;
220
+ }
221
221
  }
222
222
 
223
223
  namespace Data {
224
224
  @Convertible()
225
- class FieldErrorInfo extends Data.SharpClass {
226
- static get Fullname(): string;
227
- Name: string;
228
- }
225
+ class FieldErrorInfo extends Data.SharpClass {
226
+ static get Fullname(): string;
227
+ Name: string;
228
+ }
229
229
  }
230
230
 
231
231
  namespace Data {
232
232
  @Convertible()
233
- class AventusFile {
234
- static get Fullname(): string;
235
- Uri: string;
236
- Upload?: File;
237
- /**
238
- * Get the unique type for the data. Define it as the namespace + class name
239
- */
240
- get $type(): string;
241
- /**
242
- * @inerhit
243
- */
244
- toJSON(): any;
245
- }
246
- }
247
-
248
- type RealDate = Date;
233
+ class AventusFile {
234
+ static get Fullname(): string;
235
+ Uri: string;
236
+ Upload?: File;
237
+ /**
238
+ * Get the unique type for the data. Define it as the namespace + class name
239
+ */
240
+ get $type(): string;
241
+ /**
242
+ * @inerhit
243
+ */
244
+ toJSON(): any;
245
+ }
246
+ }
247
+
248
+ type RealDate = Date;
249
249
 
250
250
  namespace Data {
251
251
  @Convertible()
252
- class Datetime extends Data.SharpClass {
253
- static get Fullname(): string;
254
- DateTime: RealDate;
255
- }
252
+ class Datetime extends Data.SharpClass {
253
+ static get Fullname(): string;
254
+ DateTime: RealDate;
255
+ }
256
256
  }
257
257
 
258
258
  namespace Data {
259
259
  @Convertible()
260
- class Date extends Data.SharpClass {
261
- static get Fullname(): string;
262
- DateTime: RealDate;
263
- }
260
+ class Date extends Data.SharpClass {
261
+ static get Fullname(): string;
262
+ DateTime: RealDate;
263
+ }
264
264
  }
265
265
 
266
266
  namespace Data {
267
267
  @Convertible()
268
- class DataError extends Aventus.GenericError<typeof Data.DataErrorCode> {
269
- static get Fullname(): string;
270
- }
268
+ class DataError extends Aventus.GenericError<typeof Data.DataErrorCode> {
269
+ static get Fullname(): string;
270
+ }
271
271
  }
272
272
 
273
273
  namespace Tools {
274
274
  @Convertible()
275
- class VoidWithError<T extends Aventus.GenericError = Aventus.GenericError> extends Aventus.VoidWithError<T> implements Tools.IWithError<T>, Tools.IWithError<T> {
276
- static get Fullname(): string;
277
- }
275
+ class VoidWithError<T extends Aventus.GenericError = Aventus.GenericError> extends Aventus.VoidWithError<T> implements Tools.IWithError<T>, Tools.IWithError<T> {
276
+ static get Fullname(): string;
277
+ }
278
278
  }
279
279
 
280
280
  namespace Data {
281
281
  @Convertible()
282
- class VoidWithDataError extends Tools.VoidWithError<Data.DataError> {
283
- static get Fullname(): string;
284
- }
282
+ class VoidWithDataError extends Tools.VoidWithError<Data.DataError> {
283
+ static get Fullname(): string;
284
+ }
285
285
  }
286
286
 
287
287
  namespace Tools {
288
288
  @Convertible()
289
- class ResultWithError<T, U extends Aventus.GenericError = Aventus.GenericError> extends Aventus.ResultWithError<T, U> implements Tools.IResultWithError<U>, Tools.IResultWithError<U> {
290
- static get Fullname(): string;
291
- }
289
+ class ResultWithError<T, U extends Aventus.GenericError = Aventus.GenericError> extends Aventus.ResultWithError<T, U> implements Tools.IResultWithError<U>, Tools.IResultWithError<U> {
290
+ static get Fullname(): string;
291
+ }
292
292
  }
293
293
 
294
294
  namespace Routes {
295
- abstract class StorableRouter<T extends Aventus.IData> extends Aventus.HttpRoute {
296
-
297
- GetAll(): Promise<Tools.ResultWithError<T[]>>;
298
- Create(body: {
299
- item: T;
300
- } | FormData): Promise<Tools.ResultWithError<T>>;
301
- CreateMany(body: {
302
- list: T[];
303
- } | FormData): Promise<Tools.ResultWithError<T[]>>;
304
- GetById(id: number): Promise<Tools.ResultWithError<T>>;
305
- GetByIds(body: {
306
- ids: number[];
307
- } | FormData): Promise<Tools.ResultWithError<T[]>>;
308
- Update(id: number, body: {
309
- item: T;
310
- } | FormData): Promise<Tools.ResultWithError<T>>;
311
- UpdateMany(body: {
312
- list: T[];
313
- } | FormData): Promise<Tools.ResultWithError<T[]>>;
314
- Delete(id: number): Promise<Tools.ResultWithError<T>>;
315
- DeleteMany(body: {
316
- ids: number[];
317
- } | FormData): Promise<Tools.ResultWithError<T[]>>;
318
- abstract StorableName(): string;
319
- }
295
+ abstract class StorableRouter<T extends Aventus.IData> extends Aventus.HttpRoute {
296
+
297
+ GetAll(): Promise<Tools.ResultWithError<T[]>>;
298
+ Create(body: {
299
+ item: T;
300
+ } | FormData): Promise<Tools.ResultWithError<T>>;
301
+ CreateMany(body: {
302
+ list: T[];
303
+ } | FormData): Promise<Tools.ResultWithError<T[]>>;
304
+ GetById(id: number): Promise<Tools.ResultWithError<T>>;
305
+ GetByIds(body: {
306
+ ids: number[];
307
+ } | FormData): Promise<Tools.ResultWithError<T[]>>;
308
+ Update(id: number, body: {
309
+ item: T;
310
+ } | FormData): Promise<Tools.ResultWithError<T>>;
311
+ UpdateMany(body: {
312
+ list: T[];
313
+ } | FormData): Promise<Tools.ResultWithError<T[]>>;
314
+ Delete(id: number): Promise<Tools.ResultWithError<T>>;
315
+ DeleteMany(body: {
316
+ ids: number[];
317
+ } | FormData): Promise<Tools.ResultWithError<T[]>>;
318
+ abstract StorableName(): string;
319
+ }
320
320
  }
321
321
 
322
322
  namespace Data {
323
323
  @Convertible()
324
- class ResultWithDataError<T> extends Tools.ResultWithError<T, Data.DataError> {
325
- static get Fullname(): string;
326
- }
324
+ class ResultWithDataError<T> extends Tools.ResultWithError<T, Data.DataError> {
325
+ static get Fullname(): string;
326
+ }
327
327
  }
328
328
 
329
329
  namespace Routes {
330
330
  @Convertible()
331
- class RouteError extends Aventus.GenericError<typeof Routes.RouteErrorCode> {
332
- static get Fullname(): string;
333
- }
331
+ class RouteError extends Aventus.GenericError<typeof Routes.RouteErrorCode> {
332
+ static get Fullname(): string;
333
+ }
334
334
  }
335
335
 
336
336
  namespace Routes {
337
337
  @Convertible()
338
- class ResultWithRouteError<T> extends Tools.ResultWithError<T, Routes.RouteError> {
339
- static get Fullname(): string;
340
- }
338
+ class ResultWithRouteError<T> extends Tools.ResultWithError<T, Routes.RouteError> {
339
+ static get Fullname(): string;
340
+ }
341
341
  }
342
342
 
343
343
  namespace Routes {
344
344
  @Convertible()
345
- class VoidWithRouteError extends Tools.VoidWithError<Routes.RouteError> {
346
- static get Fullname(): string;
347
- }
348
- }
349
-
350
- namespace WebSocket {
351
- type InternalSocketRoute = WebSocket.SocketRoute & Aventus.PreparedUri;
352
- }
353
-
354
- namespace WebSocket {
355
- interface ConnectionOptions {
356
- log?: boolean;
357
- logPrefix?: string;
358
- host?: string;
359
- port?: number;
360
- useHttps?: boolean;
361
- routes?: {
362
- [key: string]: WebSocket.InternalSocketRoute[];
363
- };
364
- /**
365
- * Define the name for the websocket
366
- * It ll open the ws connection on /ws/${socketName}
367
- */
368
- socketName?: string;
369
- /**
370
- * Define if the message must be buffered before the socket open.
371
- * If true, when the socket is opened, all messages in buffered will be sent
372
- */
373
- allowSendBeforeOpen?: boolean;
374
- /**
375
- * Define the websocket connection must be open during creation
376
- */
377
- autoStart?: boolean;
378
- /**
379
- * Define if a /ping msg must be sent
380
- */
381
- sendPing?: number;
382
- }
383
- }
384
-
385
- namespace WebSocket {
386
- class SocketError extends Aventus.GenericError<WebSocket.SocketErrorCode> {
387
- }
388
- }
389
-
390
- namespace WebSocket {
391
- abstract class Connection {
392
- static Debug: boolean;
393
- protected options: Required<WebSocket.ConnectionOptions>;
394
- protected waitingList: {
395
- [uuid: string]: (channel: string, data: any) => void;
396
- };
397
- protected memoryBeforeOpen: WebSocket.SocketSendMessageOptions[];
398
- protected socket?: WebSocket.Socket;
399
- protected actionGuard: Aventus.ActionGuard;
400
- /**
401
- * Create a singleton
402
- */
403
- static getInstance(): WebSocket.Connection;
404
- protected constructor();
405
- readonly onOpen: Aventus.Callback<() => void>;
406
- readonly onClose: Aventus.Callback<(event: Event) => void>;
407
- readonly onError: Aventus.Callback<(event: Event) => void>;
408
- /**
409
- * Define the configuration for your websocket
410
- */
411
- protected abstract configure(options: WebSocket.ConnectionOptions): WebSocket.ConnectionOptions;
412
- /**
413
- * Configure a new Websocket
414
- */
415
- protected _configure(options?: WebSocket.ConnectionOptions): Required<WebSocket.ConnectionOptions>;
416
- private getUrl;
417
- /**
418
- * Add a new route to listen to the websocket
419
- */
420
- addRoute(newRoute: WebSocket.SocketRoute): void;
421
- /**
422
- * The route to remove
423
- * @param route - The route to remove
424
- */
425
- removeRoute(route: WebSocket.SocketRoute): void;
426
- protected openCallback: ((isOpen: boolean) => void) | undefined;
427
- /**
428
- * Try to open the websocket
429
- */
430
- open(): Promise<boolean>;
431
- protected jsonReplacer(key: string, value: any): any;
432
- /**
433
- * Send a message though the websocket
434
- * @param channelName The channel on which the message is sent
435
- * @param data The data to send
436
- * @param options the options to add to the message (typically the uid)
437
- */
438
- sendMessage<T>(options: WebSocket.SocketSendMessageOptions): Promise<Aventus.VoidWithError>;
439
- /**
440
- * Send a message though the websocket and wait one answer give in parameters callbacks
441
- * @param channelName The channel on which the message is sent
442
- * @param body The data to send
443
- * @param timeout The timeout before the request failed
444
- */
445
- sendMessageAndWait<T>(options: WebSocket.SocketSendMessageOptions): Promise<Aventus.ResultWithError<Aventus.ExtractFromError<T>>>;
446
- /**
447
- * Check if socket is ready
448
- */
449
- isReady(): boolean;
450
- protected sendPingTimeout: number;
451
- protected sendPing(): void;
452
- protected startPing(): void;
453
- protected stopPing(): void;
454
- protected _onOpen(): void;
455
- protected errorOccur: boolean;
456
- protected _onError(event: Event): void;
457
- protected _onClose(event: Event): void;
458
- /**
459
- * Close the current connection
460
- */
461
- close(): void;
462
- protected onMessage(event: MessageEvent<any>): void;
463
- /**
464
- * Print a msg inside the console
465
- */
466
- protected log(message: {} | string): void;
467
- }
468
- }
469
-
470
- namespace WebSocket {
471
- class EndPoint extends WebSocket.Connection {
472
- /**
473
- * Create a singleton
474
- */
475
- static getInstance(): WebSocket.EndPoint;
476
- protected constructor();
477
- protected register(): void;
478
- /**
479
- * @inheritdoc
480
- */
481
- protected configure(options: WebSocket.ConnectionOptions): WebSocket.ConnectionOptions;
482
- protected get path(): string;
483
- }
484
- }
485
-
486
- namespace WebSocket {
487
- type WsEndPointType = (abstract new (...args: any[]) => WebSocket.EndPoint);
488
- }
489
-
490
- namespace WebSocket {
491
- abstract class WsEvent<T extends any = any> {
492
- protected endpoint: WebSocket.EndPoint;
493
- onTrigger: Aventus.Callback<(item: Aventus.ExtractFromError<T>, params: Aventus.UriParamsValue, uid?: string) => void>;
494
- protected routeInfo: WebSocket.SocketRoute<Aventus.ExtractFromError<T>>;
495
- protected _listening: boolean;
496
- get listening(): boolean;
497
- getPrefix: () => string;
498
- constructor(endpoint?: WebSocket.EndPoint, getPrefix?: () => string);
499
- init(): void;
500
- /**
501
- * Define the websocket path
502
- */
503
- protected abstract path(): string;
504
- /**
505
- * Override this method to tell that the event must listen when created
506
- */
507
- protected listenOnBoot(): boolean;
508
- /**
509
- * Add the event to the endpoint. After that, the on trigger event can be triggered
510
- */
511
- listen(): void;
512
- /**
513
- * Remove the event from the endpoint. After that, the on trigger event won't be triggered
514
- */
515
- stop(): void;
516
- protected onEvent(data: Aventus.ExtractFromError<T>, params: Aventus.UriParamsValue, uid?: string): void;
517
- }
518
- }
519
-
520
- namespace WebSocket {
521
- type ExtractResultFrom<T extends WebSocket.WsEvent, U = any> = T extends WebSocket.WsEvent<infer U> ? U : never;
522
- }
523
-
524
- namespace WebSocket {
525
- type WsEventType = abstract new (...args: any[]) => WebSocket.WsEvent;
526
- }
527
-
528
- type ExtractResponse<T extends WebSocket.WsEvent<U>, U = any> = T extends WebSocket.WsEvent<infer U> ? Aventus.ResultWithError<Aventus.ExtractFromError<U>> : never;
529
-
530
- namespace WebSocket {
531
- class StorableWsRoute_DeleteMany<T extends Aventus.IData> extends WebSocket.WsEvent<Tools.ResultWithError<T[]>> {
532
- /**
533
- * @inheritdoc
534
- */
535
- protected path(): string;
536
- StorableName: () => string;
537
- constructor(endpoint: WebSocket.EndPoint, getPrefix?: () => string, StorableName?: () => string);
538
- }
539
- }
540
-
541
- namespace WebSocket {
542
- class StorableWsRouter_Delete<T> extends WebSocket.WsEvent<T> {
543
- StorableName: () => string;
544
- constructor(endpoint: WebSocket.EndPoint, getPrefix: () => string, StorableName: () => string);
545
- /**
546
- * @inheritdoc
547
- */
548
- protected path(): string;
549
- }
345
+ class VoidWithRouteError extends Tools.VoidWithError<Routes.RouteError> {
346
+ static get Fullname(): string;
347
+ }
348
+ }
349
+
350
+ namespace WebSocket {
351
+ type InternalSocketRoute = WebSocket.SocketRoute & Aventus.PreparedUri;
352
+ }
353
+
354
+ namespace WebSocket {
355
+ interface ConnectionOptions {
356
+ log?: boolean;
357
+ logPrefix?: string;
358
+ host?: string;
359
+ port?: number;
360
+ useHttps?: boolean;
361
+ routes?: {
362
+ [key: string]: WebSocket.InternalSocketRoute[];
363
+ };
364
+ /**
365
+ * Define the name for the websocket
366
+ * It ll open the ws connection on /ws/${socketName}
367
+ */
368
+ socketName?: string;
369
+ /**
370
+ * Define if the message must be buffered before the socket open.
371
+ * If true, when the socket is opened, all messages in buffered will be sent
372
+ */
373
+ allowSendBeforeOpen?: boolean;
374
+ /**
375
+ * Define the websocket connection must be open during creation
376
+ */
377
+ autoStart?: boolean;
378
+ /**
379
+ * Define if a /ping msg must be sent
380
+ */
381
+ sendPing?: number;
382
+ }
383
+ }
384
+
385
+ namespace WebSocket {
386
+ class SocketError extends Aventus.GenericError<WebSocket.SocketErrorCode> {
387
+ }
388
+ }
389
+
390
+ namespace WebSocket {
391
+ abstract class Connection {
392
+ static Debug: boolean;
393
+ protected options: Required<WebSocket.ConnectionOptions>;
394
+ protected waitingList: {
395
+ [uuid: string]: (channel: string, data: any) => void;
396
+ };
397
+ protected memoryBeforeOpen: WebSocket.SocketSendMessageOptions[];
398
+ protected socket?: WebSocket.Socket;
399
+ protected actionGuard: Aventus.ActionGuard;
400
+ /**
401
+ * Create a singleton
402
+ */
403
+ static getInstance(): WebSocket.Connection;
404
+ protected constructor();
405
+ readonly onOpen: Aventus.Callback<() => void>;
406
+ readonly onClose: Aventus.Callback<(event: Event) => void>;
407
+ readonly onError: Aventus.Callback<(event: Event) => void>;
408
+ /**
409
+ * Define the configuration for your websocket
410
+ */
411
+ protected abstract configure(options: WebSocket.ConnectionOptions): WebSocket.ConnectionOptions;
412
+ /**
413
+ * Configure a new Websocket
414
+ */
415
+ protected _configure(options?: WebSocket.ConnectionOptions): Required<WebSocket.ConnectionOptions>;
416
+ private getUrl;
417
+ /**
418
+ * Add a new route to listen to the websocket
419
+ */
420
+ addRoute(newRoute: WebSocket.SocketRoute): void;
421
+ /**
422
+ * The route to remove
423
+ * @param route - The route to remove
424
+ */
425
+ removeRoute(route: WebSocket.SocketRoute): void;
426
+ protected openCallback: ((isOpen: boolean) => void) | undefined;
427
+ /**
428
+ * Try to open the websocket
429
+ */
430
+ open(): Promise<boolean>;
431
+ protected jsonReplacer(key: string, value: any): any;
432
+ /**
433
+ * Send a message though the websocket
434
+ * @param channelName The channel on which the message is sent
435
+ * @param data The data to send
436
+ * @param options the options to add to the message (typically the uid)
437
+ */
438
+ sendMessage<T>(options: WebSocket.SocketSendMessageOptions): Promise<Aventus.VoidWithError>;
439
+ /**
440
+ * Send a message though the websocket and wait one answer give in parameters callbacks
441
+ * @param channelName The channel on which the message is sent
442
+ * @param body The data to send
443
+ * @param timeout The timeout before the request failed
444
+ */
445
+ sendMessageAndWait<T>(options: WebSocket.SocketSendMessageOptions): Promise<Aventus.ResultWithError<Aventus.ExtractFromError<T>>>;
446
+ /**
447
+ * Check if socket is ready
448
+ */
449
+ isReady(): boolean;
450
+ protected sendPingTimeout: number;
451
+ protected sendPing(): void;
452
+ protected startPing(): void;
453
+ protected stopPing(): void;
454
+ protected _onOpen(): void;
455
+ protected errorOccur: boolean;
456
+ protected _onError(event: Event): void;
457
+ protected _onClose(event: Event): void;
458
+ /**
459
+ * Close the current connection
460
+ */
461
+ close(): void;
462
+ protected onMessage(event: MessageEvent<any>): void;
463
+ /**
464
+ * Print a msg inside the console
465
+ */
466
+ protected log(message: {} | string): void;
467
+ }
468
+ }
469
+
470
+ namespace WebSocket {
471
+ class EndPoint extends WebSocket.Connection {
472
+ /**
473
+ * Create a singleton
474
+ */
475
+ static getInstance(): WebSocket.EndPoint;
476
+ protected constructor();
477
+ protected register(): void;
478
+ /**
479
+ * @inheritdoc
480
+ */
481
+ protected configure(options: WebSocket.ConnectionOptions): WebSocket.ConnectionOptions;
482
+ protected get path(): string;
483
+ }
484
+ }
485
+
486
+ namespace WebSocket {
487
+ type WsEndPointType = (abstract new (...args: any[]) => WebSocket.EndPoint);
488
+ }
489
+
490
+ namespace WebSocket {
491
+ abstract class WsEvent<T extends any = any> {
492
+ protected endpoint: WebSocket.EndPoint;
493
+ onTrigger: Aventus.Callback<(item: Aventus.ExtractFromError<T>, params: Aventus.UriParamsValue, uid?: string) => void>;
494
+ protected routeInfo: WebSocket.SocketRoute<Aventus.ExtractFromError<T>>;
495
+ protected _listening: boolean;
496
+ get listening(): boolean;
497
+ getPrefix: () => string;
498
+ constructor(endpoint?: WebSocket.EndPoint, getPrefix?: () => string);
499
+ init(): void;
500
+ /**
501
+ * Define the websocket path
502
+ */
503
+ protected abstract path(): string;
504
+ /**
505
+ * Override this method to tell that the event must listen when created
506
+ */
507
+ protected listenOnBoot(): boolean;
508
+ /**
509
+ * Add the event to the endpoint. After that, the on trigger event can be triggered
510
+ */
511
+ listen(): void;
512
+ /**
513
+ * Remove the event from the endpoint. After that, the on trigger event won't be triggered
514
+ */
515
+ stop(): void;
516
+ protected onEvent(data: Aventus.ExtractFromError<T>, params: Aventus.UriParamsValue, uid?: string): void;
517
+ }
518
+ }
519
+
520
+ namespace WebSocket {
521
+ type ExtractResultFrom<T extends WebSocket.WsEvent, U = any> = T extends WebSocket.WsEvent<infer U> ? U : never;
522
+ }
523
+
524
+ namespace WebSocket {
525
+ type WsEventType = abstract new (...args: any[]) => WebSocket.WsEvent;
526
+ }
527
+
528
+ type ExtractResponse<T extends WebSocket.WsEvent<U>, U = any> = T extends WebSocket.WsEvent<infer U> ? Aventus.ResultWithError<Aventus.ExtractFromError<U>> : never;
529
+
530
+ namespace WebSocket {
531
+ class StorableWsRoute_DeleteMany<T extends Aventus.IData> extends WebSocket.WsEvent<Tools.ResultWithError<T[]>> {
532
+ /**
533
+ * @inheritdoc
534
+ */
535
+ protected path(): string;
536
+ StorableName: () => string;
537
+ constructor(endpoint: WebSocket.EndPoint, getPrefix?: () => string, StorableName?: () => string);
538
+ }
539
+ }
540
+
541
+ namespace WebSocket {
542
+ class StorableWsRouter_Delete<T> extends WebSocket.WsEvent<T> {
543
+ StorableName: () => string;
544
+ constructor(endpoint: WebSocket.EndPoint, getPrefix: () => string, StorableName: () => string);
545
+ /**
546
+ * @inheritdoc
547
+ */
548
+ protected path(): string;
549
+ }
550
550
  }
551
551
 
552
552
  namespace WebSocket {
553
- class StorableWsRoute_UpdateMany<T extends Aventus.IData> extends WebSocket.WsEvent<Tools.ResultWithError<T[]>> {
554
- /**
555
- * @inheritdoc
556
- */
557
- protected path(): string;
558
- StorableName: () => string;
559
- constructor(endpoint: WebSocket.EndPoint, getPrefix?: () => string, StorableName?: () => string);
560
- }
553
+ class StorableWsRoute_UpdateMany<T extends Aventus.IData> extends WebSocket.WsEvent<Tools.ResultWithError<T[]>> {
554
+ /**
555
+ * @inheritdoc
556
+ */
557
+ protected path(): string;
558
+ StorableName: () => string;
559
+ constructor(endpoint: WebSocket.EndPoint, getPrefix?: () => string, StorableName?: () => string);
560
+ }
561
561
  }
562
562
 
563
563
  namespace WebSocket {
564
- class StorableWsRouter_Update<T> extends WebSocket.WsEvent<T> {
565
- StorableName: () => string;
566
- constructor(endpoint: WebSocket.EndPoint, getPrefix: () => string, StorableName: () => string);
567
- /**
568
- * @inheritdoc
569
- */
570
- protected path(): string;
571
- }
564
+ class StorableWsRouter_Update<T> extends WebSocket.WsEvent<T> {
565
+ StorableName: () => string;
566
+ constructor(endpoint: WebSocket.EndPoint, getPrefix: () => string, StorableName: () => string);
567
+ /**
568
+ * @inheritdoc
569
+ */
570
+ protected path(): string;
571
+ }
572
572
  }
573
573
 
574
574
  namespace WebSocket {
575
- class StorableWsRouter_GetByIds<T> extends WebSocket.WsEvent<T[]> {
576
- StorableName: () => string;
577
- constructor(endpoint: WebSocket.EndPoint, getPrefix: () => string, StorableName: () => string);
578
- /**
579
- * @inheritdoc
580
- */
581
- protected path(): string;
582
- }
575
+ class StorableWsRouter_GetByIds<T> extends WebSocket.WsEvent<T[]> {
576
+ StorableName: () => string;
577
+ constructor(endpoint: WebSocket.EndPoint, getPrefix: () => string, StorableName: () => string);
578
+ /**
579
+ * @inheritdoc
580
+ */
581
+ protected path(): string;
582
+ }
583
583
  }
584
584
 
585
585
  namespace WebSocket {
586
- class StorableWsRouter_GetById<T> extends WebSocket.WsEvent<T> {
587
- StorableName: () => string;
588
- constructor(endpoint: WebSocket.EndPoint, getPrefix: () => string, StorableName: () => string);
589
- /**
590
- * @inheritdoc
591
- */
592
- protected path(): string;
593
- }
586
+ class StorableWsRouter_GetById<T> extends WebSocket.WsEvent<T> {
587
+ StorableName: () => string;
588
+ constructor(endpoint: WebSocket.EndPoint, getPrefix: () => string, StorableName: () => string);
589
+ /**
590
+ * @inheritdoc
591
+ */
592
+ protected path(): string;
593
+ }
594
594
  }
595
595
 
596
596
  namespace WebSocket {
597
- class StorableWsRoute_CreateMany<T extends Aventus.IData> extends WebSocket.WsEvent<Tools.ResultWithError<T[]>> {
598
- /**
599
- * @inheritdoc
600
- */
601
- protected path(): string;
602
- StorableName: () => string;
603
- constructor(endpoint: WebSocket.EndPoint, getPrefix?: () => string, StorableName?: () => string);
604
- }
597
+ class StorableWsRoute_CreateMany<T extends Aventus.IData> extends WebSocket.WsEvent<Tools.ResultWithError<T[]>> {
598
+ /**
599
+ * @inheritdoc
600
+ */
601
+ protected path(): string;
602
+ StorableName: () => string;
603
+ constructor(endpoint: WebSocket.EndPoint, getPrefix?: () => string, StorableName?: () => string);
604
+ }
605
605
  }
606
606
 
607
607
  namespace WebSocket {
608
- class StorableWsRouter_Create<T> extends WebSocket.WsEvent<T> {
609
- StorableName: () => string;
610
- constructor(endpoint: WebSocket.EndPoint, getPrefix: () => string, StorableName: () => string);
611
- /**
612
- * @inheritdoc
613
- */
614
- protected path(): string;
615
- }
608
+ class StorableWsRouter_Create<T> extends WebSocket.WsEvent<T> {
609
+ StorableName: () => string;
610
+ constructor(endpoint: WebSocket.EndPoint, getPrefix: () => string, StorableName: () => string);
611
+ /**
612
+ * @inheritdoc
613
+ */
614
+ protected path(): string;
615
+ }
616
616
  }
617
617
 
618
618
  namespace WebSocket {
619
- class StorableWsRouter_GetAll<T> extends WebSocket.WsEvent<T[]> {
620
- StorableName: () => string;
621
- constructor(endpoint: WebSocket.EndPoint, getPrefix: () => string, StorableName: () => string);
622
- /**
623
- * @inheritdoc
624
- */
625
- protected path(): string;
626
- }
619
+ class StorableWsRouter_GetAll<T> extends WebSocket.WsEvent<T[]> {
620
+ StorableName: () => string;
621
+ constructor(endpoint: WebSocket.EndPoint, getPrefix: () => string, StorableName: () => string);
622
+ /**
623
+ * @inheritdoc
624
+ */
625
+ protected path(): string;
626
+ }
627
627
  }
628
628
 
629
629
  namespace WebSocket {
630
- type RouterRoutes = {
631
- [name: string]: WebSocket.WsEvent;
632
- };
630
+ type RouterRoutes = {
631
+ [name: string]: WebSocket.WsEvent;
632
+ };
633
633
  }
634
634
 
635
635
  namespace WebSocket {
636
- class Router<T extends WebSocket.RouterRoutes> {
637
- readonly endpoint: WebSocket.EndPoint;
638
- events: T;
639
- constructor(endpoint?: WebSocket.EndPoint);
640
- getPrefix(): string;
641
- protected defineEvents(): Partial<T>;
642
- }
636
+ class Router<T extends WebSocket.RouterRoutes> {
637
+ readonly endpoint: WebSocket.EndPoint;
638
+ events: T;
639
+ constructor(endpoint?: WebSocket.EndPoint);
640
+ getPrefix(): string;
641
+ protected defineEvents(): Partial<T>;
642
+ }
643
643
  }
644
644
 
645
645
  namespace WebSocket {
646
- type WsRouterType = abstract new (...args: any[]) => WebSocket.Router<any>;
646
+ type WsRouterType = abstract new (...args: any[]) => WebSocket.Router<any>;
647
647
  }
648
648
 
649
649
  namespace WebSocket {
650
- type StorableWsRouter__Routes<T extends Aventus.IData> = {
651
- GetAll: WebSocket.StorableWsRouter_GetAll<T>;
652
- Create: WebSocket.StorableWsRouter_Create<T>;
653
- CreateMany: WebSocket.StorableWsRoute_CreateMany<T>;
654
- GetById: WebSocket.StorableWsRouter_GetById<T>;
655
- GetByIds: WebSocket.StorableWsRouter_GetByIds<T>;
656
- Update: WebSocket.StorableWsRouter_Update<T>;
657
- UpdateMany: WebSocket.StorableWsRoute_UpdateMany<T>;
658
- Delete: WebSocket.StorableWsRouter_Delete<T>;
659
- DeleteMany: WebSocket.StorableWsRoute_DeleteMany<T>;
660
- };
650
+ type StorableWsRouter__Routes<T extends Aventus.IData> = {
651
+ GetAll: WebSocket.StorableWsRouter_GetAll<T>;
652
+ Create: WebSocket.StorableWsRouter_Create<T>;
653
+ CreateMany: WebSocket.StorableWsRoute_CreateMany<T>;
654
+ GetById: WebSocket.StorableWsRouter_GetById<T>;
655
+ GetByIds: WebSocket.StorableWsRouter_GetByIds<T>;
656
+ Update: WebSocket.StorableWsRouter_Update<T>;
657
+ UpdateMany: WebSocket.StorableWsRoute_UpdateMany<T>;
658
+ Delete: WebSocket.StorableWsRouter_Delete<T>;
659
+ DeleteMany: WebSocket.StorableWsRoute_DeleteMany<T>;
660
+ };
661
661
  }
662
662
 
663
663
  namespace WebSocket {
664
- abstract class StorableWsRouter<T extends Aventus.IData, __Route extends WebSocket.StorableWsRouter__Routes<T> = WebSocket.StorableWsRouter__Routes<T>> extends WebSocket.Router<__Route> {
665
- protected defineEvents(): Partial<__Route>;
666
- GetAll(options?: WebSocket.WsRouteSendOptions): Promise<ExtractResponse<WebSocket.StorableWsRouter_GetAll<T>>>;
667
- Create(body: {
668
- item: T;
669
- } | FormData, options?: WebSocket.WsRouteSendOptions): Promise<ExtractResponse<WebSocket.StorableWsRouter_Create<T>>>;
670
- CreateMany(body: {
671
- list: T[];
672
- } | FormData, options?: WebSocket.WsRouteSendOptions): Promise<ExtractResponse<WebSocket.StorableWsRoute_CreateMany<T>>>;
673
- GetById(id: number, options?: WebSocket.WsRouteSendOptions): Promise<ExtractResponse<WebSocket.StorableWsRouter_GetById<T>>>;
674
- GetByIds(body: {
675
- ids: number[];
676
- } | FormData, options?: WebSocket.WsRouteSendOptions): Promise<ExtractResponse<WebSocket.StorableWsRouter_GetByIds<T>>>;
677
- Update(id: number, body: {
678
- item: T;
679
- } | FormData, options?: WebSocket.WsRouteSendOptions): Promise<ExtractResponse<WebSocket.StorableWsRouter_Update<T>>>;
680
- UpdateMany(body: {
681
- list: T[];
682
- } | FormData, options?: WebSocket.WsRouteSendOptions): Promise<ExtractResponse<WebSocket.StorableWsRoute_UpdateMany<T>>>;
683
- Delete(id: number, options?: WebSocket.WsRouteSendOptions): Promise<ExtractResponse<WebSocket.StorableWsRouter_Delete<T>>>;
684
- DeleteMany(body: {
685
- ids: number[];
686
- } | FormData, options?: WebSocket.WsRouteSendOptions): Promise<ExtractResponse<WebSocket.StorableWsRoute_DeleteMany<T>>>;
687
- abstract StorableName(): string;
688
- }
664
+ abstract class StorableWsRouter<T extends Aventus.IData, __Route extends WebSocket.StorableWsRouter__Routes<T> = WebSocket.StorableWsRouter__Routes<T>> extends WebSocket.Router<__Route> {
665
+ protected defineEvents(): Partial<__Route>;
666
+ GetAll(options?: WebSocket.WsRouteSendOptions): Promise<ExtractResponse<WebSocket.StorableWsRouter_GetAll<T>>>;
667
+ Create(body: {
668
+ item: T;
669
+ } | FormData, options?: WebSocket.WsRouteSendOptions): Promise<ExtractResponse<WebSocket.StorableWsRouter_Create<T>>>;
670
+ CreateMany(body: {
671
+ list: T[];
672
+ } | FormData, options?: WebSocket.WsRouteSendOptions): Promise<ExtractResponse<WebSocket.StorableWsRoute_CreateMany<T>>>;
673
+ GetById(id: number, options?: WebSocket.WsRouteSendOptions): Promise<ExtractResponse<WebSocket.StorableWsRouter_GetById<T>>>;
674
+ GetByIds(body: {
675
+ ids: number[];
676
+ } | FormData, options?: WebSocket.WsRouteSendOptions): Promise<ExtractResponse<WebSocket.StorableWsRouter_GetByIds<T>>>;
677
+ Update(id: number, body: {
678
+ item: T;
679
+ } | FormData, options?: WebSocket.WsRouteSendOptions): Promise<ExtractResponse<WebSocket.StorableWsRouter_Update<T>>>;
680
+ UpdateMany(body: {
681
+ list: T[];
682
+ } | FormData, options?: WebSocket.WsRouteSendOptions): Promise<ExtractResponse<WebSocket.StorableWsRoute_UpdateMany<T>>>;
683
+ Delete(id: number, options?: WebSocket.WsRouteSendOptions): Promise<ExtractResponse<WebSocket.StorableWsRouter_Delete<T>>>;
684
+ DeleteMany(body: {
685
+ ids: number[];
686
+ } | FormData, options?: WebSocket.WsRouteSendOptions): Promise<ExtractResponse<WebSocket.StorableWsRoute_DeleteMany<T>>>;
687
+ abstract StorableName(): string;
688
+ }
689
689
  }
690
690
 
691
691
  namespace WebSocket {
692
692
  @Convertible()
693
- class WsError extends Aventus.GenericError<typeof WebSocket.WsErrorCode> {
694
- static get Fullname(): string;
695
- }
693
+ class WsError extends Aventus.GenericError<typeof WebSocket.WsErrorCode> {
694
+ static get Fullname(): string;
695
+ }
696
696
  }
697
697
 
698
698
  namespace WebSocket {
699
699
  @Convertible()
700
- class ResultWithWsError<T> extends Tools.ResultWithError<T, WebSocket.WsError> {
701
- static get Fullname(): string;
702
- }
700
+ class ResultWithWsError<T> extends Tools.ResultWithError<T, WebSocket.WsError> {
701
+ static get Fullname(): string;
702
+ }
703
703
  }
704
704
 
705
705
  namespace WebSocket {
706
706
  @Convertible()
707
- class VoidWithWsError extends Tools.VoidWithError<WebSocket.WsError> {
708
- static get Fullname(): string;
709
- }
707
+ class VoidWithWsError extends Tools.VoidWithError<WebSocket.WsError> {
708
+ static get Fullname(): string;
709
+ }
710
710
  }
711
711
 
712
712
  namespace RAM {
713
- abstract class RamHttp<T extends Data.Storable> extends Aventus.Ram<T> {
714
- protected getAllDone: boolean;
715
- protected routes: Routes.StorableRouter<T>;
716
- abstract defineRoutes(): Routes.StorableRouter<T>;
717
- protected constructor();
718
- protected beforeGetAll(result: Aventus.ResultRamWithError<Map<number, Aventus.RamItem<T>>>): Promise<void>;
719
- protected beforeGetById(id: number, result: Aventus.ResultRamWithError<Aventus.RamItem<T>>): Promise<void>;
720
- protected beforeGetByIds(ids: number[], result: Aventus.ResultRamWithError<Aventus.RamItem<T>[]>): Promise<void>;
721
- protected beforeCreateItem(item: T, fromList: boolean, result: Aventus.ResultRamWithError<Aventus.RamItem<T>>): Promise<void>;
722
- protected beforeCreateList(list: T[], result: Aventus.ResultRamWithError<Aventus.RamItem<T>[]>): Promise<void>;
723
- protected beforeUpdateItem(item: T, fromList: boolean, result: Aventus.ResultRamWithError<Aventus.RamItem<T>>): Promise<void>;
724
- protected beforeUpdateList(list: T[], result: Aventus.ResultRamWithError<Aventus.RamItem<T>[]>): Promise<void>;
725
- protected beforeDeleteItem(item: T, fromList: boolean, result: Aventus.VoidWithError): Promise<void>;
726
- protected beforeDeleteList(list: T[], result: Aventus.VoidWithError): Promise<void>;
727
- }
713
+ abstract class RamHttp<T extends Data.Storable> extends Aventus.Ram<T> {
714
+ protected getAllDone: boolean;
715
+ protected routes: Routes.StorableRouter<T>;
716
+ abstract defineRoutes(): Routes.StorableRouter<T>;
717
+ protected constructor();
718
+ protected beforeGetAll(result: Aventus.ResultRamWithError<Map<number, Aventus.RamItem<T>>>): Promise<void>;
719
+ protected beforeGetById(id: number, result: Aventus.ResultRamWithError<Aventus.RamItem<T>>): Promise<void>;
720
+ protected beforeGetByIds(ids: number[], result: Aventus.ResultRamWithError<Aventus.RamItem<T>[]>): Promise<void>;
721
+ protected beforeCreateItem(item: T, fromList: boolean, result: Aventus.ResultRamWithError<Aventus.RamItem<T>>): Promise<void>;
722
+ protected beforeCreateList(list: T[], result: Aventus.ResultRamWithError<Aventus.RamItem<T>[]>): Promise<void>;
723
+ protected beforeUpdateItem(item: T, fromList: boolean, result: Aventus.ResultRamWithError<Aventus.RamItem<T>>): Promise<void>;
724
+ protected beforeUpdateList(list: T[], result: Aventus.ResultRamWithError<Aventus.RamItem<T>[]>): Promise<void>;
725
+ protected beforeDeleteItem(item: T, fromList: boolean, result: Aventus.VoidWithError): Promise<void>;
726
+ protected beforeDeleteList(list: T[], result: Aventus.VoidWithError): Promise<void>;
727
+ }
728
728
  }
729
729
 
730
730
  namespace RAM {
731
- abstract class RamWebSocket<T extends Data.Storable> extends Aventus.Ram<T> {
732
- protected getAllDone: boolean;
733
- private routes;
734
- protected otherGetAllLocked: {
735
- [uid: string]: true;
736
- };
737
- protected otherGetByIdLocked: {
738
- [uid: string]: true;
739
- };
740
- protected otherCreateItemLocked: {
741
- [uid: string]: true;
742
- };
743
- protected otherCreateListLocked: {
744
- [uid: string]: true;
745
- };
746
- protected otherUpdateItemLocked: {
747
- [uid: string]: true;
748
- };
749
- protected otherUpdateListLocked: {
750
- [uid: string]: true;
751
- };
752
- protected otherDeleteItemLocked: {
753
- [uid: string]: true;
754
- };
755
- protected otherDeleteListLocked: {
756
- [uid: string]: true;
757
- };
758
- abstract defineRoutes(): WebSocket.StorableWsRouter<T>;
759
- protected constructor();
760
- protected addEventsBindings(): void;
761
- protected listenOnStart(): RAM.RamWebSocketListenOnStart;
762
- protected otherGetAll(items: Aventus.ExtractFromError<T[]>, params: Aventus.UriParams, uid?: string): any;
763
- protected beforeGetAll(result: Aventus.ResultRamWithError<Map<number, Aventus.RamItem<T>>>): Promise<void>;
764
- protected otherGetById(item: Aventus.ExtractFromError<T>, params: Aventus.UriParams, uid?: string): any;
765
- protected beforeGetById(id: number, result: Aventus.ResultRamWithError<Aventus.RamItem<T>>): Promise<void>;
766
- protected beforeGetByIds(ids: number[], result: Aventus.ResultRamWithError<Aventus.RamItem<T>[]>): Promise<void>;
767
- protected otherCreateItem(item: Aventus.ExtractFromError<T>, params: Aventus.UriParams, uid?: string): any;
768
- protected beforeCreateItem(item: T, fromList: boolean, result: Aventus.ResultRamWithError<Aventus.RamItem<T>>): Promise<void>;
769
- protected otherCreateList(items: Aventus.ExtractFromError<T[]>, params: Aventus.UriParams, uid?: string): any;
770
- protected beforeCreateList(list: T[], result: Aventus.ResultRamWithError<Aventus.RamItem<T>[]>): Promise<void>;
771
- protected otherUpdateItem(item: Aventus.ExtractFromError<T>, params: Aventus.UriParams, uid?: string): any;
772
- protected beforeUpdateItem(item: T, fromList: boolean, result: Aventus.ResultRamWithError<Aventus.RamItem<T>>): Promise<void>;
773
- protected otherUpdateList(items: T[], params: Aventus.UriParams, uid?: string): any;
774
- protected beforeUpdateList(list: T[], result: Aventus.ResultRamWithError<Aventus.RamItem<T>[]>): Promise<void>;
775
- protected otherDeleteItem(item: Aventus.ExtractFromError<T>, params: Aventus.UriParams, uid?: string): void;
776
- protected beforeDeleteItem(item: T, fromList: boolean, result: Aventus.VoidWithError): Promise<void>;
777
- protected otherDeleteList(items: T[], params: Aventus.UriParams, uid?: string): void;
778
- protected beforeDeleteList(list: T[], result: Aventus.VoidWithError): Promise<void>;
779
- /**
780
- * Delete element inside Ram without firing delete event
781
- */
782
- protected deleteData(item: Aventus.KeysObject<T>, result: Aventus.ResultRamWithError<Aventus.RamItem<T>>): void;
783
- }
731
+ abstract class RamWebSocket<T extends Data.Storable> extends Aventus.Ram<T> {
732
+ protected getAllDone: boolean;
733
+ private routes;
734
+ protected otherGetAllLocked: {
735
+ [uid: string]: true;
736
+ };
737
+ protected otherGetByIdLocked: {
738
+ [uid: string]: true;
739
+ };
740
+ protected otherCreateItemLocked: {
741
+ [uid: string]: true;
742
+ };
743
+ protected otherCreateListLocked: {
744
+ [uid: string]: true;
745
+ };
746
+ protected otherUpdateItemLocked: {
747
+ [uid: string]: true;
748
+ };
749
+ protected otherUpdateListLocked: {
750
+ [uid: string]: true;
751
+ };
752
+ protected otherDeleteItemLocked: {
753
+ [uid: string]: true;
754
+ };
755
+ protected otherDeleteListLocked: {
756
+ [uid: string]: true;
757
+ };
758
+ abstract defineRoutes(): WebSocket.StorableWsRouter<T>;
759
+ protected constructor();
760
+ protected addEventsBindings(): void;
761
+ protected listenOnStart(): RAM.RamWebSocketListenOnStart;
762
+ protected otherGetAll(items: Aventus.ExtractFromError<T[]>, params: Aventus.UriParams, uid?: string): any;
763
+ protected beforeGetAll(result: Aventus.ResultRamWithError<Map<number, Aventus.RamItem<T>>>): Promise<void>;
764
+ protected otherGetById(item: Aventus.ExtractFromError<T>, params: Aventus.UriParams, uid?: string): any;
765
+ protected beforeGetById(id: number, result: Aventus.ResultRamWithError<Aventus.RamItem<T>>): Promise<void>;
766
+ protected beforeGetByIds(ids: number[], result: Aventus.ResultRamWithError<Aventus.RamItem<T>[]>): Promise<void>;
767
+ protected otherCreateItem(item: Aventus.ExtractFromError<T>, params: Aventus.UriParams, uid?: string): any;
768
+ protected beforeCreateItem(item: T, fromList: boolean, result: Aventus.ResultRamWithError<Aventus.RamItem<T>>): Promise<void>;
769
+ protected otherCreateList(items: Aventus.ExtractFromError<T[]>, params: Aventus.UriParams, uid?: string): any;
770
+ protected beforeCreateList(list: T[], result: Aventus.ResultRamWithError<Aventus.RamItem<T>[]>): Promise<void>;
771
+ protected otherUpdateItem(item: Aventus.ExtractFromError<T>, params: Aventus.UriParams, uid?: string): any;
772
+ protected beforeUpdateItem(item: T, fromList: boolean, result: Aventus.ResultRamWithError<Aventus.RamItem<T>>): Promise<void>;
773
+ protected otherUpdateList(items: T[], params: Aventus.UriParams, uid?: string): any;
774
+ protected beforeUpdateList(list: T[], result: Aventus.ResultRamWithError<Aventus.RamItem<T>[]>): Promise<void>;
775
+ protected otherDeleteItem(item: Aventus.ExtractFromError<T>, params: Aventus.UriParams, uid?: string): void;
776
+ protected beforeDeleteItem(item: T, fromList: boolean, result: Aventus.VoidWithError): Promise<void>;
777
+ protected otherDeleteList(items: T[], params: Aventus.UriParams, uid?: string): void;
778
+ protected beforeDeleteList(list: T[], result: Aventus.VoidWithError): Promise<void>;
779
+ /**
780
+ * Delete element inside Ram without firing delete event
781
+ */
782
+ protected deleteData(item: Aventus.KeysObject<T>, result: Aventus.ResultRamWithError<Aventus.RamItem<T>>): void;
783
+ }
784
784
  }
785
785
 
786
786
  }
787
787
  }
788
788
  //#endregion js def //
789
789
  //#region js src //
790
- {"namespace":"AventusSharp","available":[{"code":"Data.Storable=class Storable extends Aventus.Data {\n Id = 0;\n /**\n * @inerhit\n */\n toJSON() {\n let toAvoid = ['className', 'namespace'];\n return Aventus.Json.classToJson(this, {\n isValidKey: (key) => !toAvoid.includes(key),\n beforeEnd: (result) => {\n let resultTemp = {};\n if (result.$type) {\n resultTemp.$type = result.$type;\n for (let key in result) {\n if (key != '$type') {\n resultTemp[key] = result[key];\n }\n }\n return resultTemp;\n }\n return result;\n }\n });\n }\n}\nData.Storable.Namespace=`AventusSharp.Data`;\r\nData.Storable.$schema={...(Aventus.Data?.$schema ?? {}), \"Id\":\"number\"};\r\nAventus.Converter.register(Data.Storable.Fullname, Data.Storable);\r\n_.Data.Storable=Data.Storable;\r\n","dependances":[{"fullName":"Aventus.Data","isStrong":true},{"fullName":"Aventus.IData","isStrong":true},{"fullName":"Aventus.Json","isStrong":false}],"fullName":"AventusSharp.Data.Storable","required":false,"type":2,"isExported":true,"convertibleName":""},{"code":"Data.StorableTimestamp=class StorableTimestamp extends Data.Storable {\n CreatedDate = new Date();\n UpdatedDate = new Date();\n}\nData.StorableTimestamp.Namespace=`AventusSharp.Data`;\r\nData.StorableTimestamp.$schema={...(Data.Storable?.$schema ?? {}), \"CreatedDate\":\"Date\",\"UpdatedDate\":\"Date\"};\r\nAventus.Converter.register(Data.StorableTimestamp.Fullname, Data.StorableTimestamp);\r\n_.Data.StorableTimestamp=Data.StorableTimestamp;\r\n","dependances":[{"fullName":"AventusSharp.Data.Storable","isStrong":true},{"fullName":"Aventus.IData","isStrong":true},{"fullName":"Date","isStrong":false}],"fullName":"AventusSharp.Data.StorableTimestamp","required":false,"type":2,"isExported":true,"convertibleName":""},{"code":"(function (WsErrorCode) {\n WsErrorCode[WsErrorCode[\"UnknowError\"] = 0] = \"UnknowError\";\n WsErrorCode[WsErrorCode[\"CantDefineAssembly\"] = 1] = \"CantDefineAssembly\";\n WsErrorCode[WsErrorCode[\"ConfigError\"] = 2] = \"ConfigError\";\n WsErrorCode[WsErrorCode[\"MultipleMainEndpoint\"] = 3] = \"MultipleMainEndpoint\";\n WsErrorCode[WsErrorCode[\"CantGetValueFromBody\"] = 4] = \"CantGetValueFromBody\";\n WsErrorCode[WsErrorCode[\"NoConnection\"] = 5] = \"NoConnection\";\n WsErrorCode[WsErrorCode[\"NoEndPoint\"] = 6] = \"NoEndPoint\";\n WsErrorCode[WsErrorCode[\"NoPath\"] = 7] = \"NoPath\";\n})(WebSocket.WsErrorCode || (WebSocket.WsErrorCode = {}));\n_.WebSocket.WsErrorCode=WebSocket.WsErrorCode;\r\n","dependances":[],"fullName":"AventusSharp.WebSocket.WsErrorCode","required":false,"type":6,"isExported":true,"convertibleName":""},{"code":"(function (SocketErrorCode) {\n SocketErrorCode[SocketErrorCode[\"socketClosed\"] = 0] = \"socketClosed\";\n SocketErrorCode[SocketErrorCode[\"timeout\"] = 1] = \"timeout\";\n SocketErrorCode[SocketErrorCode[\"differentChannel\"] = 2] = \"differentChannel\";\n SocketErrorCode[SocketErrorCode[\"unknow\"] = 3] = \"unknow\";\n})(WebSocket.SocketErrorCode || (WebSocket.SocketErrorCode = {}));\n_.WebSocket.SocketErrorCode=WebSocket.SocketErrorCode;\r\n","dependances":[],"fullName":"AventusSharp.WebSocket.SocketErrorCode","required":false,"type":6,"isExported":true,"convertibleName":""},{"code":"WebSocket.Socket=class Socket {\n static Debug = false;\n static connections = {};\n static getInstance(url, el) {\n if (!this.connections[url]) {\n this.connections[url] = new WebSocket.Socket(url, el);\n }\n else {\n this.connections[url].registerEl(el);\n }\n return this.connections[url];\n }\n socket;\n url;\n elements = [];\n reopenInterval = 0;\n onOpen = new Aventus.Callback();\n onClose = new Aventus.Callback();\n onError = new Aventus.Callback();\n onMessage = new Aventus.Callback();\n get readyState() {\n return this.socket.readyState;\n }\n constructor(url, el) {\n this.url = url;\n this.elements = [el];\n this.socket = this.createWebSocket();\n this.reopen = this.reopen.bind(this);\n this.onClose.add(this.reopen);\n }\n registerEl(el) {\n if (!this.elements.includes(el)) {\n this.elements.push(el);\n }\n }\n createWebSocket() {\n this.removeSocket();\n const socket = new window.WebSocket(this.url);\n socket.onopen = (e) => {\n clearInterval(this.reopenInterval);\n this.onOpen.trigger([e]);\n };\n socket.onclose = (e) => {\n this.onClose.trigger([e]);\n };\n socket.onerror = (e) => {\n this.onError.trigger([e]);\n };\n socket.onmessage = (e) => {\n this.onMessage.trigger([e]);\n };\n this.socket = socket;\n return socket;\n }\n removeSocket() {\n if (this.socket) {\n this.socket.onopen = null;\n this.socket.onclose = null;\n this.socket.onerror = null;\n this.socket.onmessage = null;\n this.socket.close();\n }\n }\n reopen() {\n clearInterval(this.reopenInterval);\n this.reopenInterval = setInterval(async () => {\n console.warn(\"try reopen socket \");\n await this.createWebSocket();\n if (this.isReady()) {\n clearInterval(this.reopenInterval);\n }\n }, 5000);\n }\n close(el, code, reason) {\n let index = this.elements.indexOf(el);\n if (index != -1) {\n this.elements.splice(0, 1);\n }\n if (this.elements.length == 0) {\n this.removeSocket();\n delete WebSocket.Socket.connections[this.url];\n }\n }\n send(data) {\n this.socket.send(data);\n }\n /**\n * Check if socket is ready\n */\n isReady() {\n return this.socket.readyState == 1;\n }\n}\nWebSocket.Socket.Namespace=`AventusSharp.WebSocket`;\r\n_.WebSocket.Socket=WebSocket.Socket;\r\n","dependances":[{"fullName":"AventusSharp.WebSocket.Socket","isStrong":false},{"fullName":"WebSocket","isStrong":false},{"fullName":"Aventus.Callback","isStrong":false},{"fullName":"Event","isStrong":false},{"fullName":"MessageEvent","isStrong":false},{"fullName":"ArrayBufferLike","isStrong":false},{"fullName":"Blob","isStrong":false},{"fullName":"ArrayBufferView","isStrong":false}],"fullName":"AventusSharp.WebSocket.Socket","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"(function (RouteErrorCode) {\n RouteErrorCode[RouteErrorCode[\"UnknowError\"] = 0] = \"UnknowError\";\n RouteErrorCode[RouteErrorCode[\"FormContentTypeUnknown\"] = 1] = \"FormContentTypeUnknown\";\n RouteErrorCode[RouteErrorCode[\"CantGetValueFromBody\"] = 2] = \"CantGetValueFromBody\";\n RouteErrorCode[RouteErrorCode[\"CantMoveFile\"] = 3] = \"CantMoveFile\";\n RouteErrorCode[RouteErrorCode[\"CantCreateFolders\"] = 4] = \"CantCreateFolders\";\n RouteErrorCode[RouteErrorCode[\"RouteAlreadyExist\"] = 5] = \"RouteAlreadyExist\";\n})(Routes.RouteErrorCode || (Routes.RouteErrorCode = {}));\n_.Routes.RouteErrorCode=Routes.RouteErrorCode;\r\n","dependances":[],"fullName":"AventusSharp.Routes.RouteErrorCode","required":false,"type":6,"isExported":true,"convertibleName":""},{"code":"(function (DataErrorCode) {\n DataErrorCode[DataErrorCode[\"DefaultDMGenericType\"] = 0] = \"DefaultDMGenericType\";\n DataErrorCode[DataErrorCode[\"DMOnlyForceInherit\"] = 1] = \"DMOnlyForceInherit\";\n DataErrorCode[DataErrorCode[\"TypeNotStorable\"] = 2] = \"TypeNotStorable\";\n DataErrorCode[DataErrorCode[\"TypeTooMuchStorable\"] = 3] = \"TypeTooMuchStorable\";\n DataErrorCode[DataErrorCode[\"GenericNotAbstract\"] = 4] = \"GenericNotAbstract\";\n DataErrorCode[DataErrorCode[\"ParentNotAbstract\"] = 5] = \"ParentNotAbstract\";\n DataErrorCode[DataErrorCode[\"InfiniteLoop\"] = 6] = \"InfiniteLoop\";\n DataErrorCode[DataErrorCode[\"InterfaceNotUnique\"] = 7] = \"InterfaceNotUnique\";\n DataErrorCode[DataErrorCode[\"SelfReferecingDependance\"] = 8] = \"SelfReferecingDependance\";\n DataErrorCode[DataErrorCode[\"DMNotExist\"] = 9] = \"DMNotExist\";\n DataErrorCode[DataErrorCode[\"DMAlreadyExist\"] = 10] = \"DMAlreadyExist\";\n DataErrorCode[DataErrorCode[\"MethodNotFound\"] = 11] = \"MethodNotFound\";\n DataErrorCode[DataErrorCode[\"StorageDisconnected\"] = 12] = \"StorageDisconnected\";\n DataErrorCode[DataErrorCode[\"StorageNotFound\"] = 13] = \"StorageNotFound\";\n DataErrorCode[DataErrorCode[\"NoConnectionInsideStorage\"] = 14] = \"NoConnectionInsideStorage\";\n DataErrorCode[DataErrorCode[\"TypeNotExistInsideStorage\"] = 15] = \"TypeNotExistInsideStorage\";\n DataErrorCode[DataErrorCode[\"UnknowError\"] = 16] = \"UnknowError\";\n DataErrorCode[DataErrorCode[\"NoItemProvided\"] = 17] = \"NoItemProvided\";\n DataErrorCode[DataErrorCode[\"NoTransactionInProgress\"] = 18] = \"NoTransactionInProgress\";\n DataErrorCode[DataErrorCode[\"WrongType\"] = 19] = \"WrongType\";\n DataErrorCode[DataErrorCode[\"NoTypeIdentifierFoundInsideQuery\"] = 20] = \"NoTypeIdentifierFoundInsideQuery\";\n DataErrorCode[DataErrorCode[\"ItemNoExistInsideStorage\"] = 21] = \"ItemNoExistInsideStorage\";\n DataErrorCode[DataErrorCode[\"ItemAlreadyExist\"] = 22] = \"ItemAlreadyExist\";\n DataErrorCode[DataErrorCode[\"ValidationError\"] = 23] = \"ValidationError\";\n DataErrorCode[DataErrorCode[\"GetAllNotAllowed\"] = 24] = \"GetAllNotAllowed\";\n DataErrorCode[DataErrorCode[\"GetByIdNotAllowed\"] = 25] = \"GetByIdNotAllowed\";\n DataErrorCode[DataErrorCode[\"GetByIdsNotAllowed\"] = 26] = \"GetByIdsNotAllowed\";\n DataErrorCode[DataErrorCode[\"WhereNotAllowed\"] = 27] = \"WhereNotAllowed\";\n DataErrorCode[DataErrorCode[\"CreateNotAllowed\"] = 28] = \"CreateNotAllowed\";\n DataErrorCode[DataErrorCode[\"UpdateNotAllowed\"] = 29] = \"UpdateNotAllowed\";\n DataErrorCode[DataErrorCode[\"DeleteNotAllowed\"] = 30] = \"DeleteNotAllowed\";\n DataErrorCode[DataErrorCode[\"NumberOfItemsNotMatching\"] = 31] = \"NumberOfItemsNotMatching\";\n DataErrorCode[DataErrorCode[\"FieldTypeNotFound\"] = 32] = \"FieldTypeNotFound\";\n DataErrorCode[DataErrorCode[\"MemberNotFound\"] = 33] = \"MemberNotFound\";\n DataErrorCode[DataErrorCode[\"TooMuchMemberFound\"] = 34] = \"TooMuchMemberFound\";\n DataErrorCode[DataErrorCode[\"TypeNotFound\"] = 35] = \"TypeNotFound\";\n DataErrorCode[DataErrorCode[\"ReverseLinkNotExist\"] = 36] = \"ReverseLinkNotExist\";\n DataErrorCode[DataErrorCode[\"ErrorCreatingReverseQuery\"] = 37] = \"ErrorCreatingReverseQuery\";\n DataErrorCode[DataErrorCode[\"LinkNotSet\"] = 38] = \"LinkNotSet\";\n})(Data.DataErrorCode || (Data.DataErrorCode = {}));\n_.Data.DataErrorCode=Data.DataErrorCode;\r\n","dependances":[],"fullName":"AventusSharp.Data.DataErrorCode","required":false,"type":6,"isExported":true,"convertibleName":""},{"code":"Data.SharpClass=class SharpClass {\n /**\n * The current namespace\n */\n get namespace() {\n return this.constructor['Namespace'];\n }\n /**\n * Get the unique type for the data. Define it as the namespace + class name\n */\n get $type() {\n return this.constructor['Fullname'];\n }\n /**\n * Get the name of the class\n */\n get className() {\n return this.constructor.name;\n }\n /**\n * Clone the object by transforming a parsed JSON string back into the original type\n */\n clone() {\n return Aventus.Converter.transform(JSON.parse(JSON.stringify(this)));\n }\n /**\n * Get a JSON for the current object\n */\n toJSON() {\n let toAvoid = ['className', 'namespace'];\n return Aventus.Json.classToJson(this, {\n isValidKey: (key) => !toAvoid.includes(key),\n beforeEnd: (result) => {\n let resultTemp = {};\n if (result.$type) {\n resultTemp.$type = result.$type;\n for (let key in result) {\n if (key != '$type') {\n resultTemp[key] = result[key];\n }\n }\n return resultTemp;\n }\n return result;\n }\n });\n }\n}\nData.SharpClass.Namespace=`AventusSharp.Data`;\r\n_.Data.SharpClass=Data.SharpClass;\r\n","dependances":[{"fullName":"Aventus.Converter","isStrong":false},{"fullName":"Aventus.Json","isStrong":false}],"fullName":"AventusSharp.Data.SharpClass","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"Data.FieldErrorInfo=class FieldErrorInfo extends Data.SharpClass {\n static get Fullname() { return \"AventusSharp.Data.FieldErrorInfo, AventusSharp\"; }\n Name;\n}\nData.FieldErrorInfo.Namespace=`AventusSharp.Data`;\r\nData.FieldErrorInfo.$schema={...(Data.SharpClass?.$schema ?? {}), \"Name\":\"string\"};\r\nAventus.Converter.register(Data.FieldErrorInfo.Fullname, Data.FieldErrorInfo);\r\n_.Data.FieldErrorInfo=Data.FieldErrorInfo;\r\n","dependances":[{"fullName":"AventusSharp.Data.SharpClass","isStrong":true},{"fullName":"Convertible","isStrong":false}],"fullName":"AventusSharp.Data.FieldErrorInfo","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"Data.AventusFile=class AventusFile {\n static get Fullname() { return \"AventusSharp.Data.AventusFile, AventusSharp\"; }\n Uri;\n Upload;\n /**\n * Get the unique type for the data. Define it as the namespace + class name\n */\n get $type() {\n return this.constructor['Fullname'];\n }\n /**\n * @inerhit\n */\n toJSON() {\n let toAvoid = ['className', 'namespace'];\n return Aventus.Json.classToJson(this, {\n isValidKey: (key) => !toAvoid.includes(key),\n beforeEnd: (result) => {\n let resultTemp = {};\n if (result.$type) {\n resultTemp.$type = result.$type;\n for (let key in result) {\n if (key != '$type') {\n resultTemp[key] = result[key];\n }\n }\n return resultTemp;\n }\n return result;\n }\n });\n }\n}\nData.AventusFile.Namespace=`AventusSharp.Data`;\r\nData.AventusFile.$schema={\"Uri\":\"string\",\"Upload\":\"File\",\"$type\":\"string\"};\r\nAventus.Converter.register(Data.AventusFile.Fullname, Data.AventusFile);\r\n_.Data.AventusFile=Data.AventusFile;\r\n","dependances":[{"fullName":"Convertible","isStrong":false},{"fullName":"Uri","isStrong":false},{"fullName":"File","isStrong":false},{"fullName":"Aventus.Json","isStrong":false}],"fullName":"AventusSharp.Data.AventusFile","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"Data.Datetime=class Datetime extends Data.SharpClass {\n static get Fullname() { return \"AventusSharp.Data.Datetime, AventusSharp\"; }\n DateTime;\n}\nData.Datetime.Namespace=`AventusSharp.Data`;\r\nData.Datetime.$schema={...(Data.SharpClass?.$schema ?? {}), \"DateTime\":\"AventusSharp.RealDate\"};\r\nAventus.Converter.register(Data.Datetime.Fullname, Data.Datetime);\r\n_.Data.Datetime=Data.Datetime;\r\n","dependances":[{"fullName":"AventusSharp.Data.SharpClass","isStrong":true},{"fullName":"Convertible","isStrong":false},{"fullName":"AventusSharp.RealDate","isStrong":false}],"fullName":"AventusSharp.Data.Datetime","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"Data.Date=class Date extends Data.SharpClass {\n static get Fullname() { return \"AventusSharp.Data.Date, AventusSharp\"; }\n DateTime;\n}\nData.Date.Namespace=`AventusSharp.Data`;\r\nData.Date.$schema={...(Data.SharpClass?.$schema ?? {}), \"DateTime\":\"AventusSharp.RealDate\"};\r\nAventus.Converter.register(Data.Date.Fullname, Data.Date);\r\n_.Data.Date=Data.Date;\r\n","dependances":[{"fullName":"AventusSharp.Data.SharpClass","isStrong":true},{"fullName":"Convertible","isStrong":false},{"fullName":"AventusSharp.RealDate","isStrong":false}],"fullName":"AventusSharp.Data.Date","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"Data.DataError=class DataError extends Aventus.GenericError {\n static get Fullname() { return \"AventusSharp.Data.DataError, AventusSharp\"; }\n}\nData.DataError.Namespace=`AventusSharp.Data`;\r\nData.DataError.$schema={...(Aventus.GenericError?.$schema ?? {}), };\r\nAventus.Converter.register(Data.DataError.Fullname, Data.DataError);\r\n_.Data.DataError=Data.DataError;\r\n","dependances":[{"fullName":"Aventus.GenericError","isStrong":true},{"fullName":"AventusSharp.Data.DataErrorCode","isStrong":true},{"fullName":"Convertible","isStrong":false}],"fullName":"AventusSharp.Data.DataError","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"Tools.VoidWithError=class VoidWithError extends Aventus.VoidWithError {\n static get Fullname() { return \"AventusSharp.Tools.VoidWithError, AventusSharp\"; }\n}\nTools.VoidWithError.Namespace=`AventusSharp.Tools`;\r\nTools.VoidWithError.$schema={...(Aventus.VoidWithError?.$schema ?? {}), };\r\nAventus.Converter.register(Tools.VoidWithError.Fullname, Tools.VoidWithError);\r\n_.Tools.VoidWithError=Tools.VoidWithError;\r\n","dependances":[{"fullName":"Aventus.VoidWithError","isStrong":true},{"fullName":"AventusSharp.Tools.IWithError","isStrong":true},{"fullName":"Convertible","isStrong":false},{"fullName":"Aventus.GenericError","isStrong":false}],"fullName":"AventusSharp.Tools.VoidWithError","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"Data.VoidWithDataError=class VoidWithDataError extends Tools.VoidWithError {\n static get Fullname() { return \"AventusSharp.Data.VoidWithDataError, AventusSharp\"; }\n}\nData.VoidWithDataError.Namespace=`AventusSharp.Data`;\r\nData.VoidWithDataError.$schema={...(Tools.VoidWithError?.$schema ?? {}), };\r\nAventus.Converter.register(Data.VoidWithDataError.Fullname, Data.VoidWithDataError);\r\n_.Data.VoidWithDataError=Data.VoidWithDataError;\r\n","dependances":[{"fullName":"AventusSharp.Tools.VoidWithError","isStrong":true},{"fullName":"AventusSharp.Data.DataError","isStrong":false},{"fullName":"Convertible","isStrong":false}],"fullName":"AventusSharp.Data.VoidWithDataError","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"Tools.ResultWithError=class ResultWithError extends Aventus.ResultWithError {\n static get Fullname() { return \"AventusSharp.Tools.ResultWithError, AventusSharp\"; }\n}\nTools.ResultWithError.Namespace=`AventusSharp.Tools`;\r\nTools.ResultWithError.$schema={...(Aventus.ResultWithError?.$schema ?? {}), };\r\nAventus.Converter.register(Tools.ResultWithError.Fullname, Tools.ResultWithError);\r\n_.Tools.ResultWithError=Tools.ResultWithError;\r\n","dependances":[{"fullName":"Aventus.ResultWithError","isStrong":true},{"fullName":"AventusSharp.Tools.IResultWithError","isStrong":true},{"fullName":"Convertible","isStrong":false},{"fullName":"Aventus.GenericError","isStrong":false}],"fullName":"AventusSharp.Tools.ResultWithError","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"Routes.StorableRouter=class StorableRouter extends Aventus.HttpRoute {\n constructor() {\n super();\n this.GetAll = this.GetAll.bind(this);\n this.Create = this.Create.bind(this);\n this.CreateMany = this.CreateMany.bind(this);\n this.GetById = this.GetById.bind(this);\n this.GetByIds = this.GetByIds.bind(this);\n this.Update = this.Update.bind(this);\n this.UpdateMany = this.UpdateMany.bind(this);\n this.Delete = this.Delete.bind(this);\n this.DeleteMany = this.DeleteMany.bind(this);\n }\n async GetAll() {\n const request = new Aventus.HttpRequest(`${this.getPrefix()}/${this.StorableName()}`, Aventus.HttpMethod.GET);\n return await request.queryJSON(this.router);\n }\n async Create(body) {\n const request = new Aventus.HttpRequest(`${this.getPrefix()}/${this.StorableName()}`, Aventus.HttpMethod.POST);\n request.setBody(body);\n return await request.queryJSON(this.router);\n }\n async CreateMany(body) {\n const request = new Aventus.HttpRequest(`${this.getPrefix()}/${this.StorableName()}s`, Aventus.HttpMethod.POST);\n request.setBody(body);\n return await request.queryJSON(this.router);\n }\n async GetById(id) {\n const request = new Aventus.HttpRequest(`${this.getPrefix()}/${this.StorableName()}/${id}`, Aventus.HttpMethod.GET);\n return await request.queryJSON(this.router);\n }\n async GetByIds(body) {\n const request = new Aventus.HttpRequest(`${this.getPrefix()}/${this.StorableName()}/getbyids`, Aventus.HttpMethod.POST);\n request.setBody(body);\n return await request.queryJSON(this.router);\n }\n async Update(id, body) {\n const request = new Aventus.HttpRequest(`${this.getPrefix()}/${this.StorableName()}/${id}`, Aventus.HttpMethod.PUT);\n request.setBody(body);\n return await request.queryJSON(this.router);\n }\n async UpdateMany(body) {\n const request = new Aventus.HttpRequest(`${this.getPrefix()}/${this.StorableName()}s`, Aventus.HttpMethod.PUT);\n request.setBody(body);\n return await request.queryJSON(this.router);\n }\n async Delete(id) {\n const request = new Aventus.HttpRequest(`${this.getPrefix()}/${this.StorableName()}/${id}`, Aventus.HttpMethod.DELETE);\n return await request.queryJSON(this.router);\n }\n async DeleteMany(body) {\n const request = new Aventus.HttpRequest(`${this.getPrefix()}/${this.StorableName()}s`, Aventus.HttpMethod.DELETE);\n request.setBody(body);\n return await request.queryJSON(this.router);\n }\n}\nRoutes.StorableRouter.Namespace=`AventusSharp.Routes`;\r\n_.Routes.StorableRouter=Routes.StorableRouter;\r\n","dependances":[{"fullName":"Aventus.HttpRoute","isStrong":true},{"fullName":"Aventus.IData","isStrong":false},{"fullName":"BindThis","isStrong":false},{"fullName":"Promise","isStrong":false},{"fullName":"AventusSharp.Tools.ResultWithError","isStrong":false},{"fullName":"Aventus.HttpRequest","isStrong":false},{"fullName":"Aventus.HttpMethod","isStrong":false},{"fullName":"TypeResult","isStrong":false},{"fullName":"FormData","isStrong":false}],"fullName":"AventusSharp.Routes.StorableRouter","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"Data.ResultWithDataError=class ResultWithDataError extends Tools.ResultWithError {\n static get Fullname() { return \"AventusSharp.Data.ResultWithDataError, AventusSharp\"; }\n}\nData.ResultWithDataError.Namespace=`AventusSharp.Data`;\r\nData.ResultWithDataError.$schema={...(Tools.ResultWithError?.$schema ?? {}), };\r\nAventus.Converter.register(Data.ResultWithDataError.Fullname, Data.ResultWithDataError);\r\n_.Data.ResultWithDataError=Data.ResultWithDataError;\r\n","dependances":[{"fullName":"AventusSharp.Tools.ResultWithError","isStrong":true},{"fullName":"AventusSharp.Data.DataError","isStrong":false},{"fullName":"Convertible","isStrong":false}],"fullName":"AventusSharp.Data.ResultWithDataError","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"Routes.RouteError=class RouteError extends Aventus.GenericError {\n static get Fullname() { return \"AventusSharp.Routes.RouteError, AventusSharp\"; }\n}\nRoutes.RouteError.Namespace=`AventusSharp.Routes`;\r\nRoutes.RouteError.$schema={...(Aventus.GenericError?.$schema ?? {}), };\r\nAventus.Converter.register(Routes.RouteError.Fullname, Routes.RouteError);\r\n_.Routes.RouteError=Routes.RouteError;\r\n","dependances":[{"fullName":"Aventus.GenericError","isStrong":true},{"fullName":"AventusSharp.Routes.RouteErrorCode","isStrong":true},{"fullName":"Convertible","isStrong":false}],"fullName":"AventusSharp.Routes.RouteError","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"Routes.ResultWithRouteError=class ResultWithRouteError extends Tools.ResultWithError {\n static get Fullname() { return \"AventusSharp.Routes.ResultWithRouteError, AventusSharp\"; }\n}\nRoutes.ResultWithRouteError.Namespace=`AventusSharp.Routes`;\r\nRoutes.ResultWithRouteError.$schema={...(Tools.ResultWithError?.$schema ?? {}), };\r\nAventus.Converter.register(Routes.ResultWithRouteError.Fullname, Routes.ResultWithRouteError);\r\n_.Routes.ResultWithRouteError=Routes.ResultWithRouteError;\r\n","dependances":[{"fullName":"AventusSharp.Tools.ResultWithError","isStrong":true},{"fullName":"AventusSharp.Routes.RouteError","isStrong":false},{"fullName":"Convertible","isStrong":false}],"fullName":"AventusSharp.Routes.ResultWithRouteError","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"Routes.VoidWithRouteError=class VoidWithRouteError extends Tools.VoidWithError {\n static get Fullname() { return \"AventusSharp.Routes.VoidWithRouteError, AventusSharp\"; }\n}\nRoutes.VoidWithRouteError.Namespace=`AventusSharp.Routes`;\r\nRoutes.VoidWithRouteError.$schema={...(Tools.VoidWithError?.$schema ?? {}), };\r\nAventus.Converter.register(Routes.VoidWithRouteError.Fullname, Routes.VoidWithRouteError);\r\n_.Routes.VoidWithRouteError=Routes.VoidWithRouteError;\r\n","dependances":[{"fullName":"AventusSharp.Tools.VoidWithError","isStrong":true},{"fullName":"AventusSharp.Routes.RouteError","isStrong":false},{"fullName":"Convertible","isStrong":false}],"fullName":"AventusSharp.Routes.VoidWithRouteError","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"WebSocket.SocketError=class SocketError extends Aventus.GenericError {\n}\nWebSocket.SocketError.Namespace=`AventusSharp.WebSocket`;\r\n_.WebSocket.SocketError=WebSocket.SocketError;\r\n","dependances":[{"fullName":"Aventus.GenericError","isStrong":true},{"fullName":"AventusSharp.WebSocket.SocketErrorCode","isStrong":false}],"fullName":"AventusSharp.WebSocket.SocketError","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"WebSocket.Connection=class Connection {\n static Debug = false;\n options;\n waitingList = {};\n memoryBeforeOpen = [];\n socket;\n actionGuard = new Aventus.ActionGuard();\n /**\n * Create a singleton\n */\n static getInstance() {\n return Aventus.Instance.get(WebSocket.Connection);\n }\n constructor() {\n this.options = this._configure(this.configure({}));\n this._onOpen = this._onOpen.bind(this);\n this._onClose = this._onClose.bind(this);\n this._onError = this._onError.bind(this);\n this.onMessage = this.onMessage.bind(this);\n if (this.options.autoStart) {\n this.open();\n }\n }\n onOpen = new Aventus.Callback();\n onClose = new Aventus.Callback();\n onError = new Aventus.Callback();\n /**\n * Configure a new Websocket\n */\n _configure(options = {}) {\n if (!options.host) {\n options.host = window.location.hostname;\n }\n if (!options.hasOwnProperty('useHttps')) {\n options.useHttps = window.location.protocol == \"https:\";\n }\n if (!options.port) {\n if (window.location.port) {\n options.port = parseInt(window.location.port);\n }\n else {\n options.port = options.useHttps ? 443 : 80;\n }\n }\n if (!options.routes) {\n options.routes = {};\n }\n if (!options.socketName) {\n options.socketName = \"\";\n }\n if (options.log === undefined) {\n options.log = WebSocket.Connection.Debug;\n }\n if (options.autoStart === undefined) {\n options.autoStart = true;\n }\n if (options.sendPing !== undefined && options.sendPing <= 0) {\n options.sendPing = undefined;\n }\n if (options.logPrefix === undefined) {\n options.logPrefix = \"\";\n }\n return options;\n }\n getUrl() {\n let protocol = \"ws\";\n if (this.options.useHttps) {\n protocol = \"wss\";\n }\n let url = protocol + \"://\" + this.options.host + \":\" + this.options.port + this.options.socketName;\n return url;\n }\n /**\n * Add a new route to listen to the websocket\n */\n addRoute(newRoute) {\n if (!this.options.routes.hasOwnProperty(newRoute.channel)) {\n this.options.routes[newRoute.channel] = [];\n }\n for (let info of this.options.routes[newRoute.channel]) {\n if (info.callback == newRoute.callback) {\n return;\n }\n }\n const { params, regex } = Aventus.Uri.prepare(newRoute.channel);\n let prepared = {\n callback: newRoute.callback,\n channel: newRoute.channel,\n regex,\n params\n };\n this.options.routes[newRoute.channel].push(prepared);\n }\n /**\n * The route to remove\n * @param route - The route to remove\n */\n removeRoute(route) {\n for (let i = 0; i < this.options.routes[route.channel].length; i++) {\n let info = this.options.routes[route.channel][i];\n if (info.callback == route.callback) {\n this.options.routes[route.channel].splice(i, 1);\n i--;\n }\n }\n }\n openCallback;\n /**\n * Try to open the websocket\n */\n open() {\n return this.actionGuard.run([\"open\"], () => {\n return new Promise((resolve) => {\n try {\n let url = this.getUrl();\n this.log(\"Opening \" + url);\n this.openCallback = (isOpen) => {\n resolve(isOpen);\n };\n this.socket = WebSocket.Socket.getInstance(url, this);\n this.socket.onOpen.add(this._onOpen);\n this.socket.onClose.add(this._onClose);\n this.socket.onError.add(this._onError);\n this.socket.onMessage.add(this.onMessage);\n if (this.socket.isReady()) {\n this._onOpen();\n }\n }\n catch (e) {\n console.log(e);\n resolve(false);\n }\n });\n });\n }\n jsonReplacer(key, value) {\n if (this[key] instanceof Date) {\n return Aventus.DateConverter.converter.toString(this[key]);\n }\n return value;\n }\n /**\n * Send a message though the websocket\n * @param channelName The channel on which the message is sent\n * @param data The data to send\n * @param options the options to add to the message (typically the uid)\n */\n async sendMessage(options) {\n let result = new Tools.VoidWithError();\n if (!this.socket || this.socket.readyState != 1) {\n let isOpen = await this.open();\n if (!isOpen) {\n result.errors.push(new WebSocket.SocketError(WebSocket.SocketErrorCode.socketClosed, \"Socket not ready ! Please ensure that it is open and ready to send message\"));\n this.log('Socket not ready ! Please ensure that it is open and ready to send message');\n if (this.options.allowSendBeforeOpen) {\n this.memoryBeforeOpen.push(options);\n }\n return result;\n }\n }\n if (this.socket && this.socket.readyState == 1) {\n try {\n let message = {\n channel: options.channel,\n };\n if (options.uid) {\n message.uid = options.uid;\n }\n if (options.body) {\n message.data = options.body;\n this.log(message);\n if (typeof options.body != 'string') {\n message.data = JSON.stringify(options.body, this.jsonReplacer);\n }\n }\n else if (options.channel != \"/ping\") {\n this.log(message);\n }\n this.socket.send(JSON.stringify(message));\n }\n catch (e) {\n result.errors.push(new WebSocket.SocketError(WebSocket.SocketErrorCode.unknow, e));\n }\n }\n else {\n result.errors.push(new WebSocket.SocketError(WebSocket.SocketErrorCode.socketClosed, \"Socket not ready ! Please ensure that it is open and ready to send message\"));\n this.log('Socket not ready ! Please ensure that it is open and ready to send message');\n if (this.options.allowSendBeforeOpen) {\n this.memoryBeforeOpen.push(options);\n }\n }\n return result;\n }\n /**\n * Send a message though the websocket and wait one answer give in parameters callbacks\n * @param channelName The channel on which the message is sent\n * @param body The data to send\n * @param timeout The timeout before the request failed\n */\n sendMessageAndWait(options) {\n return new Promise(async (resolve) => {\n let result = new Aventus.ResultWithError();\n try {\n let _uid = options.uid ? options.uid : Aventus.uuidv4();\n options.uid = _uid;\n let timeoutInfo;\n this.waitingList[_uid] = (channel, data) => {\n clearTimeout(timeoutInfo);\n if (channel.toLowerCase() != options.channel.toLowerCase()) {\n result.errors.push(new WebSocket.SocketError(WebSocket.SocketErrorCode.differentChannel, `We sent a message on ${options.channel} but we receive on ${channel}`));\n resolve(result);\n }\n else {\n if (data instanceof Aventus.VoidWithError) {\n for (let error of data.errors) {\n result.errors.push(error);\n }\n if (data instanceof Aventus.ResultWithError) {\n result.result = data.result;\n }\n }\n else {\n result.result = data;\n }\n resolve(result);\n }\n };\n if (options.timeout !== undefined) {\n timeoutInfo = setTimeout(() => {\n delete this.waitingList[_uid];\n result.errors.push(new WebSocket.SocketError(WebSocket.SocketErrorCode.timeout, \"No message received after \" + options.timeout + \"ms\"));\n resolve(result);\n }, options.timeout);\n }\n let sendMessageResult = await this.sendMessage(options);\n if (!sendMessageResult.success) {\n for (let error of sendMessageResult.errors) {\n result.errors.push(error);\n }\n resolve(result);\n }\n }\n catch (e) {\n result.errors.push(new WebSocket.SocketError(WebSocket.SocketErrorCode.unknow, e));\n resolve(result);\n }\n });\n }\n ;\n /**\n * Check if socket is ready\n */\n isReady() {\n if (this.socket && this.socket.isReady()) {\n return true;\n }\n return false;\n }\n sendPingTimeout = 0;\n sendPing() {\n this.sendMessage({\n channel: \"/ping\",\n });\n }\n startPing() {\n clearInterval(this.sendPingTimeout);\n this.sendPingTimeout = setInterval(() => {\n this.sendPing();\n }, 5000);\n }\n stopPing() {\n clearInterval(this.sendPingTimeout);\n }\n _onOpen() {\n if (this.socket?.isReady()) {\n if (this.openCallback) {\n this.openCallback(true);\n this.openCallback = undefined;\n }\n let protocol = \"ws\";\n if (this.options.useHttps) {\n protocol = \"wss\";\n }\n this.log(`Connection successfully established to ${this.getUrl()}!`);\n this.onOpen.trigger([]);\n for (let i = 0; i < this.memoryBeforeOpen.length; i++) {\n this.sendMessage(this.memoryBeforeOpen[i]);\n }\n this.memoryBeforeOpen = [];\n if (this.options.sendPing) {\n this.startPing();\n }\n }\n else {\n if (this.openCallback) {\n this.openCallback(false);\n this.openCallback = undefined;\n }\n }\n }\n errorOccur = false;\n _onError(event) {\n this.errorOccur = true;\n if (this.openCallback) {\n this.openCallback(false);\n this.openCallback = undefined;\n return;\n }\n this.log('An error has occured');\n this.onError.trigger([event]);\n }\n _onClose(event) {\n this.stopPing();\n if (this.errorOccur) {\n this.errorOccur = false;\n return;\n }\n this.log('Closing connection');\n this.onClose.trigger([event]);\n }\n /**\n * Close the current connection\n */\n close() {\n if (this.socket) {\n this.socket.onOpen.remove(this._onOpen);\n this.socket.onClose.remove(this._onClose);\n this.socket.onError.remove(this._onError);\n this.socket.onMessage.remove(this.onMessage);\n this.socket.close(this);\n delete this.socket;\n }\n }\n onMessage(event) {\n let response = JSON.parse(event.data);\n this.log(response);\n let data = {};\n try {\n data = Aventus.Converter.transform(JSON.parse(response.data));\n }\n catch (e) {\n console.error(e);\n }\n for (let channel in this.options.routes) {\n let current = this.options.routes[channel];\n for (let info of current) {\n let params = Aventus.Uri.getParams(info, response.channel);\n if (params) {\n let valueCb = data;\n if (data instanceof Aventus.ResultWithError) {\n valueCb = data.result;\n }\n else if (data instanceof Aventus.VoidWithError) {\n valueCb = undefined;\n }\n info.callback(valueCb, params, response.uid);\n }\n }\n }\n if (response.uid) {\n if (this.waitingList.hasOwnProperty(response.uid)) {\n this.waitingList[response.uid](response.channel, data);\n delete this.waitingList[response.uid];\n }\n }\n }\n /**\n * Print a msg inside the console\n */\n log(message) {\n if (this.options.log) {\n const now = new Date();\n const hours = (now.getHours()).toLocaleString(undefined, { minimumIntegerDigits: 2 });\n const minutes = (now.getMinutes()).toLocaleString(undefined, { minimumIntegerDigits: 2 });\n const seconds = (now.getSeconds()).toLocaleString(undefined, { minimumIntegerDigits: 2 });\n const prefix = this.options.logPrefix ? `[${this.options.logPrefix}] ` : '';\n if (message instanceof Object) {\n let cloneMessage = JSON.parse(JSON.stringify(message, this.jsonReplacer));\n if (cloneMessage.data && typeof cloneMessage.data == 'string') {\n cloneMessage.data = JSON.parse(cloneMessage.data);\n }\n console.log(`${prefix}[${hours}:${minutes}:${seconds}]: `, cloneMessage);\n }\n else {\n console.log(`${prefix}[${hours}:${minutes}:${seconds}]: `, message);\n }\n }\n }\n}\nWebSocket.Connection.Namespace=`AventusSharp.WebSocket`;\r\n_.WebSocket.Connection=WebSocket.Connection;\r\n","dependances":[{"fullName":"Required","isStrong":false},{"fullName":"AventusSharp.WebSocket.ConnectionOptions","isStrong":false},{"fullName":"AventusSharp.WebSocket.SocketSendMessageOptions","isStrong":false},{"fullName":"AventusSharp.WebSocket.Socket","isStrong":false},{"fullName":"Aventus.ActionGuard","isStrong":false},{"fullName":"AventusSharp.WebSocket.Connection","isStrong":false},{"fullName":"Aventus.Instance","isStrong":false},{"fullName":"Aventus.Callback","isStrong":false},{"fullName":"Event","isStrong":false},{"fullName":"AventusSharp.WebSocket.SocketRoute","isStrong":false},{"fullName":"Aventus.Uri","isStrong":false},{"fullName":"AventusSharp.WebSocket.InternalSocketRoute","isStrong":false},{"fullName":"Promise","isStrong":false},{"fullName":"Date","isStrong":false},{"fullName":"Aventus.DateConverter","isStrong":false},{"fullName":"Aventus.VoidWithError","isStrong":false},{"fullName":"AventusSharp.Tools.VoidWithError","isStrong":false},{"fullName":"AventusSharp.WebSocket.SocketError","isStrong":false},{"fullName":"AventusSharp.WebSocket.SocketErrorCode","isStrong":false},{"fullName":"AventusSharp.WebSocket.SocketMessage","isStrong":false},{"fullName":"Aventus.ResultWithError","isStrong":false},{"fullName":"Aventus.ExtractFromError","isStrong":false},{"fullName":"T","isStrong":false},{"fullName":"Aventus.uuidv4","isStrong":false},{"fullName":"MessageEvent","isStrong":false},{"fullName":"Aventus.Converter","isStrong":false}],"fullName":"AventusSharp.WebSocket.Connection","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"WebSocket.EndPoint=class EndPoint extends WebSocket.Connection {\n /**\n * Create a singleton\n */\n static getInstance() {\n return Aventus.Instance.get(WebSocket.EndPoint);\n }\n constructor() {\n super();\n this.register();\n }\n register() {\n }\n /**\n * @inheritdoc\n */\n configure(options) {\n options.socketName = this.path;\n options.sendPing = 5000;\n return options;\n }\n get path() {\n return \"/ws\";\n }\n ;\n}\nWebSocket.EndPoint.Namespace=`AventusSharp.WebSocket`;\r\n_.WebSocket.EndPoint=WebSocket.EndPoint;\r\n","dependances":[{"fullName":"AventusSharp.WebSocket.Connection","isStrong":true},{"fullName":"AventusSharp.WebSocket.EndPoint","isStrong":false},{"fullName":"Aventus.Instance","isStrong":false},{"fullName":"AventusSharp.WebSocket.ConnectionOptions","isStrong":false}],"fullName":"AventusSharp.WebSocket.EndPoint","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"WebSocket.WsEvent=class WsEvent {\n endpoint;\n onTrigger = new Aventus.Callback();\n routeInfo;\n _listening = false;\n get listening() {\n return this._listening;\n }\n getPrefix;\n constructor(endpoint, getPrefix) {\n this.endpoint = endpoint ?? WebSocket.EndPoint.getInstance();\n this.getPrefix = getPrefix ?? (() => \"\");\n this.onEvent = this.onEvent.bind(this);\n }\n init() {\n this.routeInfo = {\n channel: this.path(),\n callback: this.onEvent\n };\n if (this.listenOnBoot()) {\n this.listen();\n }\n }\n /**\n * Override this method to tell that the event must listen when created\n */\n listenOnBoot() {\n return false;\n }\n /**\n * Add the event to the endpoint. After that, the on trigger event can be triggered\n */\n listen() {\n if (!this._listening) {\n this._listening = true;\n if (!this.routeInfo) {\n this.routeInfo = {\n channel: this.path(),\n callback: this.onEvent\n };\n }\n this.endpoint.addRoute(this.routeInfo);\n }\n }\n /**\n * Remove the event from the endpoint. After that, the on trigger event won't be triggered\n */\n stop() {\n if (this._listening) {\n this._listening = false;\n this.endpoint.removeRoute(this.routeInfo);\n }\n }\n onEvent(data, params, uid) {\n this.onTrigger.trigger([data, params, uid]);\n }\n}\nWebSocket.WsEvent.Namespace=`AventusSharp.WebSocket`;\r\n_.WebSocket.WsEvent=WebSocket.WsEvent;\r\n","dependances":[{"fullName":"AventusSharp.WebSocket.EndPoint","isStrong":false},{"fullName":"Aventus.Callback","isStrong":false},{"fullName":"Aventus.ExtractFromError","isStrong":false},{"fullName":"Aventus.UriParamsValue","isStrong":false},{"fullName":"AventusSharp.WebSocket.SocketRoute","isStrong":false}],"fullName":"AventusSharp.WebSocket.WsEvent","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"WebSocket.StorableWsRoute_DeleteMany=class StorableWsRoute_DeleteMany extends WebSocket.WsEvent {\n /**\n * @inheritdoc\n */\n path() {\n return `${this.getPrefix()}/${this.StorableName()}/DeleteMany`;\n }\n StorableName;\n constructor(endpoint, getPrefix, StorableName) {\n super(endpoint, getPrefix);\n this.StorableName = StorableName ?? (() => \"\");\n }\n}\nWebSocket.StorableWsRoute_DeleteMany.Namespace=`AventusSharp.WebSocket`;\r\n_.WebSocket.StorableWsRoute_DeleteMany=WebSocket.StorableWsRoute_DeleteMany;\r\n","dependances":[{"fullName":"AventusSharp.WebSocket.WsEvent","isStrong":true},{"fullName":"AventusSharp.Tools.ResultWithError","isStrong":false},{"fullName":"Aventus.IData","isStrong":false},{"fullName":"AventusSharp.WebSocket.EndPoint","isStrong":false}],"fullName":"AventusSharp.WebSocket.StorableWsRoute_DeleteMany","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"WebSocket.StorableWsRouter_Delete=class StorableWsRouter_Delete extends WebSocket.WsEvent {\n StorableName;\n constructor(endpoint, getPrefix, StorableName) {\n super(endpoint, getPrefix);\n this.StorableName = StorableName;\n }\n /**\n * @inheritdoc\n */\n path() {\n return `${this.getPrefix()}/${this.StorableName()}/{id:number}/Delete`;\n }\n}\nWebSocket.StorableWsRouter_Delete.Namespace=`AventusSharp.WebSocket`;\r\n_.WebSocket.StorableWsRouter_Delete=WebSocket.StorableWsRouter_Delete;\r\n","dependances":[{"fullName":"AventusSharp.WebSocket.WsEvent","isStrong":true},{"fullName":"AventusSharp.WebSocket.EndPoint","isStrong":false}],"fullName":"AventusSharp.WebSocket.StorableWsRouter_Delete","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"WebSocket.StorableWsRoute_UpdateMany=class StorableWsRoute_UpdateMany extends WebSocket.WsEvent {\n /**\n * @inheritdoc\n */\n path() {\n return `${this.getPrefix()}/${this.StorableName()}/UpdateMany`;\n }\n StorableName;\n constructor(endpoint, getPrefix, StorableName) {\n super(endpoint, getPrefix);\n this.StorableName = StorableName ?? (() => \"\");\n }\n}\nWebSocket.StorableWsRoute_UpdateMany.Namespace=`AventusSharp.WebSocket`;\r\n_.WebSocket.StorableWsRoute_UpdateMany=WebSocket.StorableWsRoute_UpdateMany;\r\n","dependances":[{"fullName":"AventusSharp.WebSocket.WsEvent","isStrong":true},{"fullName":"AventusSharp.Tools.ResultWithError","isStrong":false},{"fullName":"Aventus.IData","isStrong":false},{"fullName":"AventusSharp.WebSocket.EndPoint","isStrong":false}],"fullName":"AventusSharp.WebSocket.StorableWsRoute_UpdateMany","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"WebSocket.StorableWsRouter_Update=class StorableWsRouter_Update extends WebSocket.WsEvent {\n StorableName;\n constructor(endpoint, getPrefix, StorableName) {\n super(endpoint, getPrefix);\n this.StorableName = StorableName;\n }\n /**\n * @inheritdoc\n */\n path() {\n return `${this.getPrefix()}/${this.StorableName()}/{id:number}/Update`;\n }\n}\nWebSocket.StorableWsRouter_Update.Namespace=`AventusSharp.WebSocket`;\r\n_.WebSocket.StorableWsRouter_Update=WebSocket.StorableWsRouter_Update;\r\n","dependances":[{"fullName":"AventusSharp.WebSocket.WsEvent","isStrong":true},{"fullName":"AventusSharp.WebSocket.EndPoint","isStrong":false}],"fullName":"AventusSharp.WebSocket.StorableWsRouter_Update","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"WebSocket.StorableWsRouter_GetByIds=class StorableWsRouter_GetByIds extends WebSocket.WsEvent {\n StorableName;\n constructor(endpoint, getPrefix, StorableName) {\n super(endpoint, getPrefix);\n this.StorableName = StorableName;\n }\n /**\n * @inheritdoc\n */\n path() {\n return `${this.getPrefix()}/${this.StorableName()}/getbyids`;\n }\n}\nWebSocket.StorableWsRouter_GetByIds.Namespace=`AventusSharp.WebSocket`;\r\n_.WebSocket.StorableWsRouter_GetByIds=WebSocket.StorableWsRouter_GetByIds;\r\n","dependances":[{"fullName":"AventusSharp.WebSocket.WsEvent","isStrong":true},{"fullName":"AventusSharp.WebSocket.EndPoint","isStrong":false}],"fullName":"AventusSharp.WebSocket.StorableWsRouter_GetByIds","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"WebSocket.StorableWsRouter_GetById=class StorableWsRouter_GetById extends WebSocket.WsEvent {\n StorableName;\n constructor(endpoint, getPrefix, StorableName) {\n super(endpoint, getPrefix);\n this.StorableName = StorableName;\n }\n /**\n * @inheritdoc\n */\n path() {\n return `${this.getPrefix()}/${this.StorableName()}/{id:number}`;\n }\n}\nWebSocket.StorableWsRouter_GetById.Namespace=`AventusSharp.WebSocket`;\r\n_.WebSocket.StorableWsRouter_GetById=WebSocket.StorableWsRouter_GetById;\r\n","dependances":[{"fullName":"AventusSharp.WebSocket.WsEvent","isStrong":true},{"fullName":"AventusSharp.WebSocket.EndPoint","isStrong":false}],"fullName":"AventusSharp.WebSocket.StorableWsRouter_GetById","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"WebSocket.StorableWsRoute_CreateMany=class StorableWsRoute_CreateMany extends WebSocket.WsEvent {\n /**\n * @inheritdoc\n */\n path() {\n return `${this.getPrefix()}/${this.StorableName()}/CreateMany`;\n }\n StorableName;\n constructor(endpoint, getPrefix, StorableName) {\n super(endpoint, getPrefix);\n this.StorableName = StorableName ?? (() => \"\");\n }\n}\nWebSocket.StorableWsRoute_CreateMany.Namespace=`AventusSharp.WebSocket`;\r\n_.WebSocket.StorableWsRoute_CreateMany=WebSocket.StorableWsRoute_CreateMany;\r\n","dependances":[{"fullName":"AventusSharp.WebSocket.WsEvent","isStrong":true},{"fullName":"AventusSharp.Tools.ResultWithError","isStrong":false},{"fullName":"Aventus.IData","isStrong":false},{"fullName":"AventusSharp.WebSocket.EndPoint","isStrong":false}],"fullName":"AventusSharp.WebSocket.StorableWsRoute_CreateMany","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"WebSocket.StorableWsRouter_Create=class StorableWsRouter_Create extends WebSocket.WsEvent {\n StorableName;\n constructor(endpoint, getPrefix, StorableName) {\n super(endpoint, getPrefix);\n this.StorableName = StorableName;\n }\n /**\n * @inheritdoc\n */\n path() {\n return `${this.getPrefix()}/${this.StorableName()}/Create`;\n }\n}\nWebSocket.StorableWsRouter_Create.Namespace=`AventusSharp.WebSocket`;\r\n_.WebSocket.StorableWsRouter_Create=WebSocket.StorableWsRouter_Create;\r\n","dependances":[{"fullName":"AventusSharp.WebSocket.WsEvent","isStrong":true},{"fullName":"AventusSharp.WebSocket.EndPoint","isStrong":false}],"fullName":"AventusSharp.WebSocket.StorableWsRouter_Create","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"WebSocket.StorableWsRouter_GetAll=class StorableWsRouter_GetAll extends WebSocket.WsEvent {\n StorableName;\n constructor(endpoint, getPrefix, StorableName) {\n super(endpoint, getPrefix);\n this.StorableName = StorableName;\n }\n /**\n * @inheritdoc\n */\n path() {\n return `${this.getPrefix()}/${this.StorableName()}`;\n }\n}\nWebSocket.StorableWsRouter_GetAll.Namespace=`AventusSharp.WebSocket`;\r\n_.WebSocket.StorableWsRouter_GetAll=WebSocket.StorableWsRouter_GetAll;\r\n","dependances":[{"fullName":"AventusSharp.WebSocket.WsEvent","isStrong":true},{"fullName":"AventusSharp.WebSocket.EndPoint","isStrong":false}],"fullName":"AventusSharp.WebSocket.StorableWsRouter_GetAll","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"WebSocket.Router=class Router {\n endpoint;\n events;\n constructor(endpoint) {\n this.endpoint = endpoint ?? WebSocket.EndPoint.getInstance();\n this.events = this.defineEvents();\n for (let key in this.events) {\n this.events[key].init();\n }\n }\n getPrefix() {\n return \"\";\n }\n defineEvents() {\n return {};\n }\n}\nWebSocket.Router.Namespace=`AventusSharp.WebSocket`;\r\n_.WebSocket.Router=WebSocket.Router;\r\n","dependances":[{"fullName":"AventusSharp.WebSocket.RouterRoutes","isStrong":false},{"fullName":"AventusSharp.WebSocket.EndPoint","isStrong":false},{"fullName":"Partial","isStrong":false}],"fullName":"AventusSharp.WebSocket.Router","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"WebSocket.StorableWsRouter=class StorableWsRouter extends WebSocket.Router {\n defineEvents() {\n return {\n ...super.defineEvents(),\n GetAll: new WebSocket.StorableWsRouter_GetAll(this.endpoint, this.getPrefix, this.StorableName),\n Create: new WebSocket.StorableWsRouter_Create(this.endpoint, this.getPrefix, this.StorableName),\n CreateMany: new WebSocket.StorableWsRoute_CreateMany(this.endpoint, this.getPrefix, this.StorableName),\n GetById: new WebSocket.StorableWsRouter_GetById(this.endpoint, this.getPrefix, this.StorableName),\n GetByIds: new WebSocket.StorableWsRouter_GetByIds(this.endpoint, this.getPrefix, this.StorableName),\n Update: new WebSocket.StorableWsRouter_Update(this.endpoint, this.getPrefix, this.StorableName),\n UpdateMany: new WebSocket.StorableWsRoute_UpdateMany(this.endpoint, this.getPrefix, this.StorableName),\n Delete: new WebSocket.StorableWsRouter_Delete(this.endpoint, this.getPrefix, this.StorableName),\n DeleteMany: new WebSocket.StorableWsRoute_DeleteMany(this.endpoint, this.getPrefix, this.StorableName),\n };\n }\n async GetAll(options = {}) {\n const info = {\n channel: `${this.getPrefix()}/${this.StorableName()}`,\n ...options,\n };\n return await this.endpoint.sendMessageAndWait(info);\n }\n async Create(body, options = {}) {\n const info = {\n channel: `${this.getPrefix()}/${this.StorableName()}/Create`,\n body: body,\n ...options,\n };\n return await this.endpoint.sendMessageAndWait(info);\n }\n async CreateMany(body, options = {}) {\n const info = {\n channel: `${this.getPrefix()}/${this.StorableName()}/CreateMany`,\n body: body,\n ...options,\n };\n return await this.endpoint.sendMessageAndWait(info);\n }\n async GetById(id, options = {}) {\n const info = {\n channel: `${this.getPrefix()}/${this.StorableName()}/${id}`,\n ...options,\n };\n return await this.endpoint.sendMessageAndWait(info);\n }\n async GetByIds(body, options = {}) {\n const info = {\n channel: `${this.getPrefix()}/${this.StorableName()}/getbyids`,\n body: body,\n ...options,\n };\n return await this.endpoint.sendMessageAndWait(info);\n }\n async Update(id, body, options = {}) {\n const info = {\n channel: `${this.getPrefix()}/${this.StorableName()}/${id}/Update`,\n body: body,\n ...options,\n };\n return await this.endpoint.sendMessageAndWait(info);\n }\n async UpdateMany(body, options = {}) {\n const info = {\n channel: `${this.getPrefix()}/${this.StorableName()}/UpdateMany`,\n body: body,\n ...options,\n };\n return await this.endpoint.sendMessageAndWait(info);\n }\n async Delete(id, options = {}) {\n const info = {\n channel: `${this.getPrefix()}/${this.StorableName()}/${id}/Delete`,\n ...options,\n };\n return await this.endpoint.sendMessageAndWait(info);\n }\n async DeleteMany(body, options = {}) {\n const info = {\n channel: `${this.getPrefix()}/${this.StorableName()}/DeleteMany`,\n body: body,\n ...options,\n };\n return await this.endpoint.sendMessageAndWait(info);\n }\n}\nWebSocket.StorableWsRouter.Namespace=`AventusSharp.WebSocket`;\r\n_.WebSocket.StorableWsRouter=WebSocket.StorableWsRouter;\r\n","dependances":[{"fullName":"AventusSharp.WebSocket.Router","isStrong":true},{"fullName":"Aventus.IData","isStrong":false},{"fullName":"AventusSharp.WebSocket.StorableWsRouter__Routes","isStrong":false},{"fullName":"Partial","isStrong":false},{"fullName":"AventusSharp.WebSocket.StorableWsRouter_GetAll","isStrong":false},{"fullName":"AventusSharp.WebSocket.StorableWsRouter_Create","isStrong":false},{"fullName":"AventusSharp.WebSocket.StorableWsRoute_CreateMany","isStrong":false},{"fullName":"AventusSharp.WebSocket.StorableWsRouter_GetById","isStrong":false},{"fullName":"AventusSharp.WebSocket.StorableWsRouter_GetByIds","isStrong":false},{"fullName":"AventusSharp.WebSocket.StorableWsRouter_Update","isStrong":false},{"fullName":"AventusSharp.WebSocket.StorableWsRoute_UpdateMany","isStrong":false},{"fullName":"AventusSharp.WebSocket.StorableWsRouter_Delete","isStrong":false},{"fullName":"AventusSharp.WebSocket.StorableWsRoute_DeleteMany","isStrong":false},{"fullName":"AventusSharp.WebSocket.WsRouteSendOptions","isStrong":false},{"fullName":"Promise","isStrong":false},{"fullName":"AventusSharp.ExtractResponse","isStrong":false},{"fullName":"AventusSharp.WebSocket.SocketSendMessageOptions","isStrong":false},{"fullName":"FormData","isStrong":false}],"fullName":"AventusSharp.WebSocket.StorableWsRouter","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"WebSocket.WsError=class WsError extends Aventus.GenericError {\n static get Fullname() { return \"AventusSharp.WebSocket.WsError, AventusSharp\"; }\n}\nWebSocket.WsError.Namespace=`AventusSharp.WebSocket`;\r\nWebSocket.WsError.$schema={...(Aventus.GenericError?.$schema ?? {}), };\r\nAventus.Converter.register(WebSocket.WsError.Fullname, WebSocket.WsError);\r\n_.WebSocket.WsError=WebSocket.WsError;\r\n","dependances":[{"fullName":"Aventus.GenericError","isStrong":true},{"fullName":"AventusSharp.WebSocket.WsErrorCode","isStrong":true},{"fullName":"Convertible","isStrong":false}],"fullName":"AventusSharp.WebSocket.WsError","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"WebSocket.ResultWithWsError=class ResultWithWsError extends Tools.ResultWithError {\n static get Fullname() { return \"AventusSharp.WebSocket.ResultWithWsError, AventusSharp\"; }\n}\nWebSocket.ResultWithWsError.Namespace=`AventusSharp.WebSocket`;\r\nWebSocket.ResultWithWsError.$schema={...(Tools.ResultWithError?.$schema ?? {}), };\r\nAventus.Converter.register(WebSocket.ResultWithWsError.Fullname, WebSocket.ResultWithWsError);\r\n_.WebSocket.ResultWithWsError=WebSocket.ResultWithWsError;\r\n","dependances":[{"fullName":"AventusSharp.Tools.ResultWithError","isStrong":true},{"fullName":"AventusSharp.WebSocket.WsError","isStrong":false},{"fullName":"Convertible","isStrong":false}],"fullName":"AventusSharp.WebSocket.ResultWithWsError","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"WebSocket.VoidWithWsError=class VoidWithWsError extends Tools.VoidWithError {\n static get Fullname() { return \"AventusSharp.WebSocket.VoidWithWsError, AventusSharp\"; }\n}\nWebSocket.VoidWithWsError.Namespace=`AventusSharp.WebSocket`;\r\nWebSocket.VoidWithWsError.$schema={...(Tools.VoidWithError?.$schema ?? {}), };\r\nAventus.Converter.register(WebSocket.VoidWithWsError.Fullname, WebSocket.VoidWithWsError);\r\n_.WebSocket.VoidWithWsError=WebSocket.VoidWithWsError;\r\n","dependances":[{"fullName":"AventusSharp.Tools.VoidWithError","isStrong":true},{"fullName":"AventusSharp.WebSocket.WsError","isStrong":false},{"fullName":"Convertible","isStrong":false}],"fullName":"AventusSharp.WebSocket.VoidWithWsError","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"RAM.RamHttp=class RamHttp extends Aventus.Ram {\n getAllDone = false;\n routes;\n constructor() {\n super();\n this.routes = this.defineRoutes();\n }\n async beforeGetAll(result) {\n if (!this.getAllDone) {\n let response = await this.routes.GetAll();\n if (response.success && response.result) {\n for (let item of response.result) {\n let resultTemp = new Aventus.ResultRamWithError();\n await this.addOrUpdateData(item, resultTemp);\n if (!resultTemp.success) {\n result.errors = [...result.errors, ...resultTemp.errors];\n }\n }\n this.getAllDone = true;\n }\n else {\n result.errors = [...result.errors, ...response.errors];\n }\n }\n }\n async beforeGetById(id, result) {\n if (this.records.has(id)) {\n return;\n }\n else {\n let response = await this.routes.GetById(id);\n if (response.success && response.result) {\n let resultTemp = new Aventus.ResultRamWithError();\n await this.addOrUpdateData(response.result, resultTemp);\n if (!resultTemp.success) {\n result.errors = [...result.errors, ...resultTemp.errors];\n }\n else {\n result.result = resultTemp.result;\n }\n }\n else {\n result.errors = [...result.errors, ...response.errors];\n }\n }\n }\n async beforeGetByIds(ids, result) {\n let missingIds = [];\n for (let id of ids) {\n if (!this.records.has(id)) {\n missingIds.push(id);\n }\n }\n if (missingIds.length > 0) {\n result.result = [];\n let response = await this.routes.GetByIds({ ids: missingIds });\n if (response.success && response.result) {\n for (let item of response.result) {\n let resultTemp = new Aventus.ResultRamWithError();\n await this.addOrUpdateData(item, resultTemp);\n if (!resultTemp.success || !resultTemp.result) {\n result.errors = [...result.errors, ...resultTemp.errors];\n }\n else if (!result.result.includes(resultTemp.result)) {\n result.result.push(resultTemp.result);\n }\n }\n }\n else {\n result.errors = [...result.errors, ...response.errors];\n }\n }\n }\n async beforeCreateItem(item, fromList, result) {\n if (fromList) {\n return;\n }\n let response = await this.routes.Create({ item });\n if (response.success && response.result) {\n result.result = this.getObjectForRam(response.result);\n }\n else {\n result.errors = [...result.errors, ...response.errors];\n }\n }\n async beforeCreateList(list, result) {\n let response = await this.routes.CreateMany({ list });\n if (response.success && response.result) {\n result.result = [];\n for (let element of response.result) {\n result.result.push(this.getObjectForRam(element));\n }\n }\n else {\n result.errors = [...result.errors, ...response.errors];\n }\n }\n async beforeUpdateItem(item, fromList, result) {\n if (fromList) {\n return;\n }\n let response = await this.routes.Update(item.Id, { item });\n if (response.success && response.result) {\n result.result = this.getObjectForRam(response.result);\n }\n else {\n result.errors = [...result.errors, ...response.errors];\n }\n }\n async beforeUpdateList(list, result) {\n let response = await this.routes.UpdateMany({ list });\n if (response.success && response.result) {\n result.result = [];\n for (let element of response.result) {\n result.result.push(this.getObjectForRam(element));\n }\n }\n else {\n result.errors = [...result.errors, ...response.errors];\n }\n }\n async beforeDeleteItem(item, fromList, result) {\n if (fromList) {\n return;\n }\n let response = await this.routes.Delete(item.Id);\n if (!response.success) {\n result.errors = [...result.errors, ...response.errors];\n }\n }\n async beforeDeleteList(list, result) {\n let response = await this.routes.DeleteMany({ ids: list.map(t => t.Id) });\n if (!response.success) {\n result.errors = [...result.errors, ...response.errors];\n }\n }\n}\nRAM.RamHttp.Namespace=`AventusSharp.RAM`;\r\n_.RAM.RamHttp=RAM.RamHttp;\r\n","dependances":[{"fullName":"Aventus.Ram","isStrong":true},{"fullName":"AventusSharp.Data.Storable","isStrong":false},{"fullName":"AventusSharp.Routes.StorableRouter","isStrong":false},{"fullName":"Aventus.ResultRamWithError","isStrong":false},{"fullName":"Map","isStrong":false},{"fullName":"Aventus.RamItem","isStrong":false},{"fullName":"Promise","isStrong":false},{"fullName":"Aventus.VoidWithError","isStrong":false}],"fullName":"AventusSharp.RAM.RamHttp","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"RAM.RamWebSocket=class RamWebSocket extends Aventus.Ram {\n getAllDone = false;\n routes;\n otherGetAllLocked = {};\n otherGetByIdLocked = {};\n otherCreateItemLocked = {};\n otherCreateListLocked = {};\n otherUpdateItemLocked = {};\n otherUpdateListLocked = {};\n otherDeleteItemLocked = {};\n otherDeleteListLocked = {};\n constructor() {\n super();\n this.routes = this.defineRoutes();\n this.addEventsBindings();\n this.otherGetAll = this.otherGetAll.bind(this);\n this.otherGetById = this.otherGetById.bind(this);\n this.otherCreateItem = this.otherCreateItem.bind(this);\n this.otherCreateList = this.otherCreateList.bind(this);\n this.otherUpdateItem = this.otherUpdateItem.bind(this);\n this.otherUpdateList = this.otherUpdateList.bind(this);\n this.otherDeleteItem = this.otherDeleteItem.bind(this);\n this.otherDeleteList = this.otherDeleteList.bind(this);\n }\n addEventsBindings() {\n const autoListen = this.listenOnStart();\n this.routes.events.GetAll.onTrigger.add(this.otherGetAll, this);\n if (autoListen.GetAll) {\n this.routes.events.GetAll.listen();\n }\n else {\n this.routes.events.GetAll.stop();\n }\n this.routes.events.GetById.onTrigger.add(this.otherGetById, this);\n if (autoListen.GetById) {\n this.routes.events.GetById.listen();\n }\n else {\n this.routes.events.GetById.stop();\n }\n this.routes.events.Create.onTrigger.add(this.otherCreateItem, this);\n if (autoListen.Create) {\n this.routes.events.Create.listen();\n }\n else {\n this.routes.events.Create.stop();\n }\n this.routes.events.CreateMany.onTrigger.add(this.otherCreateList, this);\n if (autoListen.CreateMany) {\n this.routes.events.CreateMany.listen();\n }\n else {\n this.routes.events.CreateMany.stop();\n }\n this.routes.events.Update.onTrigger.add(this.otherUpdateItem, this);\n if (autoListen.Update) {\n this.routes.events.Update.listen();\n }\n else {\n this.routes.events.Update.stop();\n }\n this.routes.events.UpdateMany.onTrigger.add(this.otherUpdateList, this);\n if (autoListen.UpdateMany) {\n this.routes.events.UpdateMany.listen();\n }\n else {\n this.routes.events.UpdateMany.stop();\n }\n this.routes.events.Delete.onTrigger.add(this.otherDeleteItem, this);\n if (autoListen.Delete) {\n this.routes.events.Delete.listen();\n }\n else {\n this.routes.events.Delete.stop();\n }\n this.routes.events.DeleteMany.onTrigger.add(this.otherDeleteList, this);\n if (autoListen.DeleteMany) {\n this.routes.events.DeleteMany.listen();\n }\n else {\n this.routes.events.DeleteMany.stop();\n }\n }\n listenOnStart() {\n return {\n GetAll: false,\n GetById: false,\n Create: true,\n CreateMany: true,\n Update: true,\n UpdateMany: true,\n Delete: true,\n DeleteMany: true,\n };\n }\n async otherGetAll(items, params, uid) {\n if (uid && this.otherGetAllLocked[uid])\n return;\n for (let item of items) {\n let resultTemp = new Aventus.ResultRamWithError();\n await this.addOrUpdateData(item, resultTemp);\n }\n }\n async beforeGetAll(result) {\n if (!this.getAllDone) {\n let uid = Aventus.uuidv4();\n this.otherGetAllLocked[uid] = true;\n let response = await this.routes.GetAll({ uid });\n delete this.otherGetAllLocked[uid];\n if (!response)\n return;\n if (response.success && response.result) {\n for (let item of response.result) {\n let resultTemp = new Aventus.ResultRamWithError();\n await this.addOrUpdateData(item, resultTemp);\n if (!resultTemp.success) {\n result.errors = [...result.errors, ...resultTemp.errors];\n }\n }\n }\n else {\n result.errors = [...result.errors, ...response.errors];\n }\n }\n }\n async otherGetById(item, params, uid) {\n if (uid && this.otherGetByIdLocked[uid])\n return;\n let resultTemp = new Aventus.ResultRamWithError();\n await this.addOrUpdateData(item, resultTemp);\n }\n async beforeGetById(id, result) {\n if (this.records.has(id)) {\n return;\n }\n else {\n let uid = Aventus.uuidv4();\n this.otherGetByIdLocked[uid] = true;\n let response = await this.routes.GetById(id, { uid });\n delete this.otherGetByIdLocked[uid];\n if (!response)\n return;\n if (response.success && response.result) {\n let resultTemp = new Aventus.ResultRamWithError();\n await this.addOrUpdateData(response.result, resultTemp);\n if (!resultTemp.success) {\n result.errors = [...result.errors, ...resultTemp.errors];\n }\n }\n else {\n result.errors = [...result.errors, ...response.errors];\n }\n }\n }\n async beforeGetByIds(ids, result) {\n let missingIds = [];\n for (let id of ids) {\n if (!this.records.has(id)) {\n missingIds.push(id);\n }\n }\n if (missingIds.length > 0) {\n let response = await this.routes.GetByIds({ ids: missingIds });\n if (response.success && response.result) {\n for (let item of response.result) {\n let resultTemp = new Aventus.ResultRamWithError();\n await this.addOrUpdateData(item, resultTemp);\n if (!resultTemp.success) {\n result.errors = [...result.errors, ...resultTemp.errors];\n }\n }\n }\n else {\n result.errors = [...result.errors, ...response.errors];\n }\n }\n }\n async otherCreateItem(item, params, uid) {\n if (uid && this.otherCreateItemLocked[uid])\n return;\n let resultTemp = new Aventus.ResultRamWithError();\n await this.addOrUpdateData(item, resultTemp);\n if (resultTemp.success && resultTemp.result) {\n this.publish('created', resultTemp.result);\n }\n }\n async beforeCreateItem(item, fromList, result) {\n if (fromList) {\n return;\n }\n let uid = Aventus.uuidv4();\n this.otherCreateItemLocked[uid] = true;\n let response = await this.routes.Create({ item }, { uid });\n delete this.otherCreateItemLocked[uid];\n if (response.success && response.result) {\n result.result = this.getObjectForRam(response.result);\n }\n else {\n result.errors = [...result.errors, ...response.errors];\n }\n }\n async otherCreateList(items, params, uid) {\n if (uid && this.otherCreateListLocked[uid])\n return;\n for (let item of items) {\n let resultTemp = new Aventus.ResultRamWithError();\n await this.addOrUpdateData(item, resultTemp);\n if (resultTemp.success && resultTemp.result) {\n this.publish('created', resultTemp.result);\n }\n }\n }\n async beforeCreateList(list, result) {\n let uid = Aventus.uuidv4();\n this.otherCreateListLocked[uid] = true;\n let response = await this.routes.CreateMany({ list }, { uid });\n delete this.otherCreateListLocked[uid];\n if (response.success && response.result) {\n result.result = [];\n for (let element of response.result) {\n result.result.push(this.getObjectForRam(element));\n }\n }\n else {\n result.errors = [...result.errors, ...response.errors];\n }\n }\n async otherUpdateItem(item, params, uid) {\n if (uid && this.otherUpdateItemLocked[uid])\n return;\n let resultTemp = new Aventus.ResultRamWithError();\n await this.addOrUpdateData(item, resultTemp);\n if (resultTemp.success && resultTemp.result) {\n this.publish('updated', resultTemp.result);\n }\n }\n async beforeUpdateItem(item, fromList, result) {\n if (fromList) {\n return;\n }\n let uid = Aventus.uuidv4();\n this.otherUpdateItemLocked[uid] = true;\n let response = await this.routes.Update(item.Id, { item }, { uid });\n delete this.otherUpdateItemLocked[uid];\n if (response.success && response.result) {\n result.result = this.getObjectForRam(response.result);\n }\n else {\n result.errors = [...result.errors, ...response.errors];\n }\n }\n async otherUpdateList(items, params, uid) {\n if (uid && this.otherUpdateListLocked[uid])\n return;\n for (let item of items) {\n let resultTemp = new Aventus.ResultRamWithError();\n await this.addOrUpdateData(item, resultTemp);\n if (resultTemp.success && resultTemp.result) {\n this.publish('updated', resultTemp.result);\n }\n }\n }\n async beforeUpdateList(list, result) {\n let uid = Aventus.uuidv4();\n this.otherUpdateListLocked[uid] = true;\n let response = await this.routes.UpdateMany({ list }, { uid });\n delete this.otherUpdateListLocked[uid];\n if (response.success && response.result) {\n result.result = [];\n for (let element of response.result) {\n result.result.push(this.getObjectForRam(element));\n }\n }\n else {\n result.errors = [...result.errors, ...response.errors];\n }\n }\n otherDeleteItem(item, params, uid) {\n if (uid && this.otherDeleteItemLocked[uid])\n return;\n let resultTemp = new Aventus.ResultRamWithError();\n this.deleteData(item, resultTemp);\n if (resultTemp.success && resultTemp.result) {\n this.publish('deleted', resultTemp.result);\n this.recordsSubscribers.delete(resultTemp.result.Id);\n }\n }\n async beforeDeleteItem(item, fromList, result) {\n if (fromList) {\n return;\n }\n let uid = Aventus.uuidv4();\n this.otherDeleteItemLocked[uid] = true;\n let response = await this.routes.Delete(item.Id, { uid });\n delete this.otherDeleteItemLocked[uid];\n if (!response.success) {\n result.errors = [...result.errors, ...response.errors];\n }\n }\n otherDeleteList(items, params, uid) {\n if (uid && this.otherDeleteListLocked[uid])\n return;\n for (let item of items) {\n let resultTemp = new Aventus.ResultRamWithError();\n this.deleteData(item, resultTemp);\n if (resultTemp.success && resultTemp.result) {\n this.publish('deleted', resultTemp.result);\n this.recordsSubscribers.delete(resultTemp.result.Id);\n }\n }\n }\n async beforeDeleteList(list, result) {\n let uid = Aventus.uuidv4();\n this.otherDeleteListLocked[uid] = true;\n let response = await this.routes.DeleteMany({ ids: list.map(t => t.Id) }, { uid });\n delete this.otherDeleteListLocked[uid];\n if (!response.success) {\n result.errors = [...result.errors, ...response.errors];\n }\n }\n /**\n * Delete element inside Ram without firing delete event\n */\n deleteData(item, result) {\n try {\n let idWithError = this.getIdWithError(item);\n if (idWithError.success && idWithError.result !== undefined) {\n let id = idWithError.result;\n if (this.records.has(id)) {\n result.result = this.records.get(id);\n this.records.delete(id);\n }\n else {\n result.errors.push(new Aventus.RamError(Aventus.RamErrorCode.noItemInsideRam, \"can't delete the item \" + id + \" because it wasn't found inside ram\"));\n }\n }\n else {\n result.errors = [...result.errors, ...idWithError.errors];\n }\n }\n catch (e) {\n result.errors.push(new Aventus.RamError(Aventus.RamErrorCode.unknow, e));\n }\n }\n}\nRAM.RamWebSocket.Namespace=`AventusSharp.RAM`;\r\n_.RAM.RamWebSocket=RAM.RamWebSocket;\r\n","dependances":[{"fullName":"Aventus.Ram","isStrong":true},{"fullName":"AventusSharp.Data.Storable","isStrong":false},{"fullName":"AventusSharp.WebSocket.StorableWsRouter","isStrong":false},{"fullName":"AventusSharp.RAM.RamWebSocketListenOnStart","isStrong":false},{"fullName":"BindThis","isStrong":false},{"fullName":"Aventus.ExtractFromError","isStrong":false},{"fullName":"Aventus.UriParams","isStrong":false},{"fullName":"Aventus.ResultRamWithError","isStrong":false},{"fullName":"Aventus.RamItem","isStrong":false},{"fullName":"Map","isStrong":false},{"fullName":"Promise","isStrong":false},{"fullName":"Aventus.uuidv4","isStrong":false},{"fullName":"Aventus.VoidWithError","isStrong":false},{"fullName":"Aventus.KeysObject","isStrong":false},{"fullName":"Aventus.RamError","isStrong":false},{"fullName":"Aventus.RamErrorCode","isStrong":false}],"fullName":"AventusSharp.RAM.RamWebSocket","required":false,"type":1,"isExported":true,"convertibleName":""}],"existing":[{"fullName":"AventusSharp.WebSocket.WsRouterOptions","dependances":[]},{"fullName":"AventusSharp.RAM.RamWebSocketListenOnStart","dependances":[]},{"fullName":"AventusSharp.WebSocket.WsRouteSendOptions","dependances":[]},{"fullName":"AventusSharp.WebSocket.SocketMessage","dependances":[]},{"fullName":"AventusSharp.WebSocket.SocketSendMessageOptions","dependances":[]},{"fullName":"AventusSharp.WebSocket.SocketRoute","dependances":[{"fullName":"Aventus.UriParamsValue","isStrong":false}]},{"fullName":"AventusSharp.Data.IStorableTimestamp","dependances":[{"fullName":"Aventus.IData","isStrong":true},{"fullName":"Date","isStrong":false}]},{"fullName":"AventusSharp.Tools.IWithError","dependances":[{"fullName":"Aventus.GenericError","isStrong":false}]},{"fullName":"AventusSharp.Tools.IResultWithError","dependances":[{"fullName":"AventusSharp.Tools.IWithError","isStrong":true},{"fullName":"Aventus.GenericError","isStrong":false}]},{"fullName":"AventusSharp.RealDate","dependances":[{"fullName":"Date","isStrong":false}]},{"fullName":"AventusSharp.WebSocket.InternalSocketRoute","dependances":[{"fullName":"AventusSharp.WebSocket.SocketRoute","isStrong":false},{"fullName":"Aventus.PreparedUri","isStrong":false}]},{"fullName":"AventusSharp.WebSocket.ConnectionOptions","dependances":[{"fullName":"AventusSharp.WebSocket.InternalSocketRoute","isStrong":false}]},{"fullName":"AventusSharp.WebSocket.WsEndPointType","dependances":[{"fullName":"AventusSharp.WebSocket.EndPoint","isStrong":false}]},{"fullName":"AventusSharp.WebSocket.ExtractResultFrom","dependances":[{"fullName":"AventusSharp.WebSocket.WsEvent","isStrong":false},{"fullName":"T","isStrong":false},{"fullName":"U","isStrong":false}]},{"fullName":"AventusSharp.WebSocket.WsEventType","dependances":[{"fullName":"AventusSharp.WebSocket.WsEvent","isStrong":false}]},{"fullName":"AventusSharp.ExtractResponse","dependances":[{"fullName":"AventusSharp.WebSocket.WsEvent","isStrong":false},{"fullName":"U","isStrong":false},{"fullName":"T","isStrong":false},{"fullName":"Aventus.ResultWithError","isStrong":false},{"fullName":"Aventus.ExtractFromError","isStrong":false}]},{"fullName":"AventusSharp.WebSocket.RouterRoutes","dependances":[{"fullName":"AventusSharp.WebSocket.WsEvent","isStrong":false}]},{"fullName":"AventusSharp.WebSocket.WsRouterType","dependances":[{"fullName":"AventusSharp.WebSocket.Router","isStrong":false}]},{"fullName":"AventusSharp.WebSocket.StorableWsRouter__Routes","dependances":[{"fullName":"Aventus.IData","isStrong":false},{"fullName":"AventusSharp.WebSocket.StorableWsRouter_GetAll","isStrong":false},{"fullName":"T","isStrong":false},{"fullName":"AventusSharp.WebSocket.StorableWsRouter_Create","isStrong":false},{"fullName":"AventusSharp.WebSocket.StorableWsRoute_CreateMany","isStrong":false},{"fullName":"AventusSharp.WebSocket.StorableWsRouter_GetById","isStrong":false},{"fullName":"AventusSharp.WebSocket.StorableWsRouter_GetByIds","isStrong":false},{"fullName":"AventusSharp.WebSocket.StorableWsRouter_Update","isStrong":false},{"fullName":"AventusSharp.WebSocket.StorableWsRoute_UpdateMany","isStrong":false},{"fullName":"AventusSharp.WebSocket.StorableWsRouter_Delete","isStrong":false},{"fullName":"AventusSharp.WebSocket.StorableWsRoute_DeleteMany","isStrong":false}]}]}
790
+ {"namespace":"AventusSharp","available":[{"code":"Data.Storable=class Storable extends Aventus.Data {\n Id = 0;\n /**\n * @inerhit\n */\n toJSON() {\n let toAvoid = ['className', 'namespace'];\n return Aventus.Json.classToJson(this, {\n isValidKey: (key) => !toAvoid.includes(key),\n beforeEnd: (result) => {\n let resultTemp = {};\n if (result.$type) {\n resultTemp.$type = result.$type;\n for (let key in result) {\n if (key != '$type') {\n resultTemp[key] = result[key];\n }\n }\n return resultTemp;\n }\n return result;\n }\n });\n }\n}\nData.Storable.Namespace=`AventusSharp.Data`;\r\nData.Storable.$schema={...(Aventus.Data?.$schema ?? {}), \"Id\":\"number\"};\r\nAventus.Converter.register(Data.Storable.Fullname, Data.Storable);\r\n_.Data.Storable=Data.Storable;\r\n","dependances":[{"fullName":"Aventus.Data","isStrong":true},{"fullName":"Aventus.IData","isStrong":true},{"fullName":"Aventus.Json","isStrong":false}],"fullName":"AventusSharp.Data.Storable","required":false,"type":2,"isExported":true,"convertibleName":""},{"code":"Data.StorableTimestamp=class StorableTimestamp extends Data.Storable {\n CreatedDate = new Date();\n UpdatedDate = new Date();\n}\nData.StorableTimestamp.Namespace=`AventusSharp.Data`;\r\nData.StorableTimestamp.$schema={...(Data.Storable?.$schema ?? {}), \"CreatedDate\":\"Date\",\"UpdatedDate\":\"Date\"};\r\nAventus.Converter.register(Data.StorableTimestamp.Fullname, Data.StorableTimestamp);\r\n_.Data.StorableTimestamp=Data.StorableTimestamp;\r\n","dependances":[{"fullName":"AventusSharp.Data.Storable","isStrong":true},{"fullName":"Aventus.IData","isStrong":true},{"fullName":"Date","isStrong":false}],"fullName":"AventusSharp.Data.StorableTimestamp","required":false,"type":2,"isExported":true,"convertibleName":""},{"code":"(function (WsErrorCode) {\n WsErrorCode[WsErrorCode[\"UnknowError\"] = 0] = \"UnknowError\";\n WsErrorCode[WsErrorCode[\"CantDefineAssembly\"] = 1] = \"CantDefineAssembly\";\n WsErrorCode[WsErrorCode[\"ConfigError\"] = 2] = \"ConfigError\";\n WsErrorCode[WsErrorCode[\"MultipleMainEndpoint\"] = 3] = \"MultipleMainEndpoint\";\n WsErrorCode[WsErrorCode[\"CantGetValueFromBody\"] = 4] = \"CantGetValueFromBody\";\n WsErrorCode[WsErrorCode[\"NoConnection\"] = 5] = \"NoConnection\";\n WsErrorCode[WsErrorCode[\"NoEndPoint\"] = 6] = \"NoEndPoint\";\n WsErrorCode[WsErrorCode[\"NoPath\"] = 7] = \"NoPath\";\n})(WebSocket.WsErrorCode || (WebSocket.WsErrorCode = {}));\n_.WebSocket.WsErrorCode=WebSocket.WsErrorCode;\r\n","dependances":[],"fullName":"AventusSharp.WebSocket.WsErrorCode","required":false,"type":6,"isExported":true,"convertibleName":""},{"code":"(function (SocketErrorCode) {\n SocketErrorCode[SocketErrorCode[\"socketClosed\"] = 0] = \"socketClosed\";\n SocketErrorCode[SocketErrorCode[\"timeout\"] = 1] = \"timeout\";\n SocketErrorCode[SocketErrorCode[\"differentChannel\"] = 2] = \"differentChannel\";\n SocketErrorCode[SocketErrorCode[\"unknow\"] = 3] = \"unknow\";\n})(WebSocket.SocketErrorCode || (WebSocket.SocketErrorCode = {}));\n_.WebSocket.SocketErrorCode=WebSocket.SocketErrorCode;\r\n","dependances":[],"fullName":"AventusSharp.WebSocket.SocketErrorCode","required":false,"type":6,"isExported":true,"convertibleName":""},{"code":"WebSocket.Socket=class Socket {\n static Debug = false;\n static connections = {};\n static getInstance(url, el) {\n if (!this.connections[url]) {\n this.connections[url] = new WebSocket.Socket(url, el);\n }\n else {\n this.connections[url].registerEl(el);\n }\n return this.connections[url];\n }\n socket;\n url;\n elements = [];\n reopenInterval = 0;\n onOpen = new Aventus.Callback();\n onClose = new Aventus.Callback();\n onError = new Aventus.Callback();\n onMessage = new Aventus.Callback();\n get readyState() {\n return this.socket.readyState;\n }\n constructor(url, el) {\n this.url = url;\n this.elements = [el];\n this.socket = this.createWebSocket();\n this.reopen = this.reopen.bind(this);\n this.onClose.add(this.reopen);\n }\n registerEl(el) {\n if (!this.elements.includes(el)) {\n this.elements.push(el);\n }\n }\n createWebSocket() {\n this.removeSocket();\n const socket = new window.WebSocket(this.url);\n socket.onopen = (e) => {\n clearInterval(this.reopenInterval);\n this.onOpen.trigger([e]);\n };\n socket.onclose = (e) => {\n this.onClose.trigger([e]);\n };\n socket.onerror = (e) => {\n this.onError.trigger([e]);\n };\n socket.onmessage = (e) => {\n this.onMessage.trigger([e]);\n };\n this.socket = socket;\n return socket;\n }\n removeSocket() {\n if (this.socket) {\n this.socket.onopen = null;\n this.socket.onclose = null;\n this.socket.onerror = null;\n this.socket.onmessage = null;\n this.socket.close();\n }\n }\n reopen() {\n clearInterval(this.reopenInterval);\n this.reopenInterval = setInterval(async () => {\n console.warn(\"try reopen socket \");\n await this.createWebSocket();\n if (this.isReady()) {\n clearInterval(this.reopenInterval);\n }\n }, 5000);\n }\n close(el, code, reason) {\n let index = this.elements.indexOf(el);\n if (index != -1) {\n this.elements.splice(0, 1);\n }\n if (this.elements.length == 0) {\n this.removeSocket();\n delete WebSocket.Socket.connections[this.url];\n }\n }\n send(data) {\n this.socket.send(data);\n }\n /**\n * Check if socket is ready\n */\n isReady() {\n return this.socket.readyState == 1;\n }\n}\nWebSocket.Socket.Namespace=`AventusSharp.WebSocket`;\r\n_.WebSocket.Socket=WebSocket.Socket;\r\n","dependances":[{"fullName":"AventusSharp.WebSocket.Socket","isStrong":false},{"fullName":"WebSocket","isStrong":false},{"fullName":"Aventus.Callback","isStrong":false},{"fullName":"Event","isStrong":false},{"fullName":"MessageEvent","isStrong":false},{"fullName":"ArrayBufferLike","isStrong":false},{"fullName":"Blob","isStrong":false},{"fullName":"ArrayBufferView","isStrong":false}],"fullName":"AventusSharp.WebSocket.Socket","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"(function (RouteErrorCode) {\n RouteErrorCode[RouteErrorCode[\"UnknowError\"] = 0] = \"UnknowError\";\n RouteErrorCode[RouteErrorCode[\"FormContentTypeUnknown\"] = 1] = \"FormContentTypeUnknown\";\n RouteErrorCode[RouteErrorCode[\"CantGetValueFromBody\"] = 2] = \"CantGetValueFromBody\";\n RouteErrorCode[RouteErrorCode[\"CantMoveFile\"] = 3] = \"CantMoveFile\";\n RouteErrorCode[RouteErrorCode[\"CantCreateFolders\"] = 4] = \"CantCreateFolders\";\n RouteErrorCode[RouteErrorCode[\"RouteAlreadyExist\"] = 5] = \"RouteAlreadyExist\";\n})(Routes.RouteErrorCode || (Routes.RouteErrorCode = {}));\n_.Routes.RouteErrorCode=Routes.RouteErrorCode;\r\n","dependances":[],"fullName":"AventusSharp.Routes.RouteErrorCode","required":false,"type":6,"isExported":true,"convertibleName":""},{"code":"(function (DataErrorCode) {\n DataErrorCode[DataErrorCode[\"DefaultDMGenericType\"] = 0] = \"DefaultDMGenericType\";\n DataErrorCode[DataErrorCode[\"DMOnlyForceInherit\"] = 1] = \"DMOnlyForceInherit\";\n DataErrorCode[DataErrorCode[\"TypeNotStorable\"] = 2] = \"TypeNotStorable\";\n DataErrorCode[DataErrorCode[\"TypeTooMuchStorable\"] = 3] = \"TypeTooMuchStorable\";\n DataErrorCode[DataErrorCode[\"GenericNotAbstract\"] = 4] = \"GenericNotAbstract\";\n DataErrorCode[DataErrorCode[\"ParentNotAbstract\"] = 5] = \"ParentNotAbstract\";\n DataErrorCode[DataErrorCode[\"InfiniteLoop\"] = 6] = \"InfiniteLoop\";\n DataErrorCode[DataErrorCode[\"InterfaceNotUnique\"] = 7] = \"InterfaceNotUnique\";\n DataErrorCode[DataErrorCode[\"SelfReferecingDependance\"] = 8] = \"SelfReferecingDependance\";\n DataErrorCode[DataErrorCode[\"DMNotExist\"] = 9] = \"DMNotExist\";\n DataErrorCode[DataErrorCode[\"DMAlreadyExist\"] = 10] = \"DMAlreadyExist\";\n DataErrorCode[DataErrorCode[\"MethodNotFound\"] = 11] = \"MethodNotFound\";\n DataErrorCode[DataErrorCode[\"StorageDisconnected\"] = 12] = \"StorageDisconnected\";\n DataErrorCode[DataErrorCode[\"StorageNotFound\"] = 13] = \"StorageNotFound\";\n DataErrorCode[DataErrorCode[\"NoConnectionInsideStorage\"] = 14] = \"NoConnectionInsideStorage\";\n DataErrorCode[DataErrorCode[\"TypeNotExistInsideStorage\"] = 15] = \"TypeNotExistInsideStorage\";\n DataErrorCode[DataErrorCode[\"UnknowError\"] = 16] = \"UnknowError\";\n DataErrorCode[DataErrorCode[\"NoItemProvided\"] = 17] = \"NoItemProvided\";\n DataErrorCode[DataErrorCode[\"NoTransactionInProgress\"] = 18] = \"NoTransactionInProgress\";\n DataErrorCode[DataErrorCode[\"WrongType\"] = 19] = \"WrongType\";\n DataErrorCode[DataErrorCode[\"NoTypeIdentifierFoundInsideQuery\"] = 20] = \"NoTypeIdentifierFoundInsideQuery\";\n DataErrorCode[DataErrorCode[\"ItemNoExistInsideStorage\"] = 21] = \"ItemNoExistInsideStorage\";\n DataErrorCode[DataErrorCode[\"ItemAlreadyExist\"] = 22] = \"ItemAlreadyExist\";\n DataErrorCode[DataErrorCode[\"ValidationError\"] = 23] = \"ValidationError\";\n DataErrorCode[DataErrorCode[\"GetAllNotAllowed\"] = 24] = \"GetAllNotAllowed\";\n DataErrorCode[DataErrorCode[\"GetByIdNotAllowed\"] = 25] = \"GetByIdNotAllowed\";\n DataErrorCode[DataErrorCode[\"GetByIdsNotAllowed\"] = 26] = \"GetByIdsNotAllowed\";\n DataErrorCode[DataErrorCode[\"WhereNotAllowed\"] = 27] = \"WhereNotAllowed\";\n DataErrorCode[DataErrorCode[\"CreateNotAllowed\"] = 28] = \"CreateNotAllowed\";\n DataErrorCode[DataErrorCode[\"UpdateNotAllowed\"] = 29] = \"UpdateNotAllowed\";\n DataErrorCode[DataErrorCode[\"DeleteNotAllowed\"] = 30] = \"DeleteNotAllowed\";\n DataErrorCode[DataErrorCode[\"NumberOfItemsNotMatching\"] = 31] = \"NumberOfItemsNotMatching\";\n DataErrorCode[DataErrorCode[\"FieldTypeNotFound\"] = 32] = \"FieldTypeNotFound\";\n DataErrorCode[DataErrorCode[\"MemberNotFound\"] = 33] = \"MemberNotFound\";\n DataErrorCode[DataErrorCode[\"TooMuchMemberFound\"] = 34] = \"TooMuchMemberFound\";\n DataErrorCode[DataErrorCode[\"TypeNotFound\"] = 35] = \"TypeNotFound\";\n DataErrorCode[DataErrorCode[\"ReverseLinkNotExist\"] = 36] = \"ReverseLinkNotExist\";\n DataErrorCode[DataErrorCode[\"ErrorCreatingReverseQuery\"] = 37] = \"ErrorCreatingReverseQuery\";\n DataErrorCode[DataErrorCode[\"LinkNotSet\"] = 38] = \"LinkNotSet\";\n})(Data.DataErrorCode || (Data.DataErrorCode = {}));\n_.Data.DataErrorCode=Data.DataErrorCode;\r\n","dependances":[],"fullName":"AventusSharp.Data.DataErrorCode","required":false,"type":6,"isExported":true,"convertibleName":""},{"code":"Data.SharpClass=class SharpClass {\n /**\n * The current namespace\n */\n get namespace() {\n return this.constructor['Namespace'];\n }\n /**\n * Get the unique type for the data. Define it as the namespace + class name\n */\n get $type() {\n return this.constructor['Fullname'];\n }\n /**\n * Get the name of the class\n */\n get className() {\n return this.constructor.name;\n }\n /**\n * Clone the object by transforming a parsed JSON string back into the original type\n */\n clone() {\n return Aventus.Converter.transform(JSON.parse(JSON.stringify(this)));\n }\n /**\n * Get a JSON for the current object\n */\n toJSON() {\n let toAvoid = ['className', 'namespace'];\n return Aventus.Json.classToJson(this, {\n isValidKey: (key) => !toAvoid.includes(key),\n beforeEnd: (result) => {\n let resultTemp = {};\n if (result.$type) {\n resultTemp.$type = result.$type;\n for (let key in result) {\n if (key != '$type') {\n resultTemp[key] = result[key];\n }\n }\n return resultTemp;\n }\n return result;\n }\n });\n }\n}\nData.SharpClass.Namespace=`AventusSharp.Data`;\r\n_.Data.SharpClass=Data.SharpClass;\r\n","dependances":[{"fullName":"Aventus.Converter","isStrong":false},{"fullName":"Aventus.Json","isStrong":false}],"fullName":"AventusSharp.Data.SharpClass","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"Data.FieldErrorInfo=class FieldErrorInfo extends Data.SharpClass {\n static get Fullname() { return \"AventusSharp.Data.FieldErrorInfo, AventusSharp\"; }\n Name;\n}\nData.FieldErrorInfo.Namespace=`AventusSharp.Data`;\r\nData.FieldErrorInfo.$schema={...(Data.SharpClass?.$schema ?? {}), \"Name\":\"string\"};\r\nAventus.Converter.register(Data.FieldErrorInfo.Fullname, Data.FieldErrorInfo);\r\n_.Data.FieldErrorInfo=Data.FieldErrorInfo;\r\n","dependances":[{"fullName":"AventusSharp.Data.SharpClass","isStrong":true},{"fullName":"Convertible","isStrong":false}],"fullName":"AventusSharp.Data.FieldErrorInfo","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"Data.AventusFile=class AventusFile {\n static get Fullname() { return \"AventusSharp.Data.AventusFile, AventusSharp\"; }\n Uri;\n Upload;\n /**\n * Get the unique type for the data. Define it as the namespace + class name\n */\n get $type() {\n return this.constructor['Fullname'];\n }\n /**\n * @inerhit\n */\n toJSON() {\n let toAvoid = ['className', 'namespace'];\n return Aventus.Json.classToJson(this, {\n isValidKey: (key) => !toAvoid.includes(key),\n beforeEnd: (result) => {\n let resultTemp = {};\n if (result.$type) {\n resultTemp.$type = result.$type;\n for (let key in result) {\n if (key != '$type') {\n resultTemp[key] = result[key];\n }\n }\n return resultTemp;\n }\n return result;\n }\n });\n }\n}\nData.AventusFile.Namespace=`AventusSharp.Data`;\r\nData.AventusFile.$schema={\"Uri\":\"string\",\"Upload\":\"File\",\"$type\":\"string\"};\r\nAventus.Converter.register(Data.AventusFile.Fullname, Data.AventusFile);\r\n_.Data.AventusFile=Data.AventusFile;\r\n","dependances":[{"fullName":"Convertible","isStrong":false},{"fullName":"Uri","isStrong":false},{"fullName":"File","isStrong":false},{"fullName":"Aventus.Json","isStrong":false}],"fullName":"AventusSharp.Data.AventusFile","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"Data.Datetime=class Datetime extends Data.SharpClass {\n static get Fullname() { return \"AventusSharp.Data.Datetime, AventusSharp\"; }\n DateTime;\n}\nData.Datetime.Namespace=`AventusSharp.Data`;\r\nData.Datetime.$schema={...(Data.SharpClass?.$schema ?? {}), \"DateTime\":\"AventusSharp.RealDate\"};\r\nAventus.Converter.register(Data.Datetime.Fullname, Data.Datetime);\r\n_.Data.Datetime=Data.Datetime;\r\n","dependances":[{"fullName":"AventusSharp.Data.SharpClass","isStrong":true},{"fullName":"Convertible","isStrong":false},{"fullName":"AventusSharp.RealDate","isStrong":false}],"fullName":"AventusSharp.Data.Datetime","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"Data.Date=class Date extends Data.SharpClass {\n static get Fullname() { return \"AventusSharp.Data.Date, AventusSharp\"; }\n DateTime;\n}\nData.Date.Namespace=`AventusSharp.Data`;\r\nData.Date.$schema={...(Data.SharpClass?.$schema ?? {}), \"DateTime\":\"AventusSharp.RealDate\"};\r\nAventus.Converter.register(Data.Date.Fullname, Data.Date);\r\n_.Data.Date=Data.Date;\r\n","dependances":[{"fullName":"AventusSharp.Data.SharpClass","isStrong":true},{"fullName":"Convertible","isStrong":false},{"fullName":"AventusSharp.RealDate","isStrong":false}],"fullName":"AventusSharp.Data.Date","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"Data.DataError=class DataError extends Aventus.GenericError {\n static get Fullname() { return \"AventusSharp.Data.DataError, AventusSharp\"; }\n}\nData.DataError.Namespace=`AventusSharp.Data`;\r\nData.DataError.$schema={...(Aventus.GenericError?.$schema ?? {}), };\r\nAventus.Converter.register(Data.DataError.Fullname, Data.DataError);\r\n_.Data.DataError=Data.DataError;\r\n","dependances":[{"fullName":"Aventus.GenericError","isStrong":true},{"fullName":"AventusSharp.Data.DataErrorCode","isStrong":true},{"fullName":"Convertible","isStrong":false}],"fullName":"AventusSharp.Data.DataError","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"Tools.VoidWithError=class VoidWithError extends Aventus.VoidWithError {\n static get Fullname() { return \"AventusSharp.Tools.VoidWithError, AventusSharp\"; }\n}\nTools.VoidWithError.Namespace=`AventusSharp.Tools`;\r\nTools.VoidWithError.$schema={...(Aventus.VoidWithError?.$schema ?? {}), };\r\nAventus.Converter.register(Tools.VoidWithError.Fullname, Tools.VoidWithError);\r\n_.Tools.VoidWithError=Tools.VoidWithError;\r\n","dependances":[{"fullName":"Aventus.VoidWithError","isStrong":true},{"fullName":"AventusSharp.Tools.IWithError","isStrong":true},{"fullName":"Convertible","isStrong":false},{"fullName":"Aventus.GenericError","isStrong":false}],"fullName":"AventusSharp.Tools.VoidWithError","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"Data.VoidWithDataError=class VoidWithDataError extends Tools.VoidWithError {\n static get Fullname() { return \"AventusSharp.Data.VoidWithDataError, AventusSharp\"; }\n}\nData.VoidWithDataError.Namespace=`AventusSharp.Data`;\r\nData.VoidWithDataError.$schema={...(Tools.VoidWithError?.$schema ?? {}), };\r\nAventus.Converter.register(Data.VoidWithDataError.Fullname, Data.VoidWithDataError);\r\n_.Data.VoidWithDataError=Data.VoidWithDataError;\r\n","dependances":[{"fullName":"AventusSharp.Tools.VoidWithError","isStrong":true},{"fullName":"AventusSharp.Data.DataError","isStrong":false},{"fullName":"Convertible","isStrong":false}],"fullName":"AventusSharp.Data.VoidWithDataError","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"Tools.ResultWithError=class ResultWithError extends Aventus.ResultWithError {\n static get Fullname() { return \"AventusSharp.Tools.ResultWithError, AventusSharp\"; }\n}\nTools.ResultWithError.Namespace=`AventusSharp.Tools`;\r\nTools.ResultWithError.$schema={...(Aventus.ResultWithError?.$schema ?? {}), };\r\nAventus.Converter.register(Tools.ResultWithError.Fullname, Tools.ResultWithError);\r\n_.Tools.ResultWithError=Tools.ResultWithError;\r\n","dependances":[{"fullName":"Aventus.ResultWithError","isStrong":true},{"fullName":"AventusSharp.Tools.IResultWithError","isStrong":true},{"fullName":"Convertible","isStrong":false},{"fullName":"Aventus.GenericError","isStrong":false}],"fullName":"AventusSharp.Tools.ResultWithError","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"Routes.StorableRouter=class StorableRouter extends Aventus.HttpRoute {\n constructor(router) {\n super(router);\n this.GetAll = this.GetAll.bind(this);\n this.Create = this.Create.bind(this);\n this.CreateMany = this.CreateMany.bind(this);\n this.GetById = this.GetById.bind(this);\n this.GetByIds = this.GetByIds.bind(this);\n this.Update = this.Update.bind(this);\n this.UpdateMany = this.UpdateMany.bind(this);\n this.Delete = this.Delete.bind(this);\n this.DeleteMany = this.DeleteMany.bind(this);\n }\n async GetAll() {\n const request = new Aventus.HttpRequest(`${this.getPrefix()}/${this.StorableName()}`, Aventus.HttpMethod.GET);\n return await request.queryJSON(this.router);\n }\n async Create(body) {\n const request = new Aventus.HttpRequest(`${this.getPrefix()}/${this.StorableName()}`, Aventus.HttpMethod.POST);\n request.setBody(body);\n return await request.queryJSON(this.router);\n }\n async CreateMany(body) {\n const request = new Aventus.HttpRequest(`${this.getPrefix()}/${this.StorableName()}s`, Aventus.HttpMethod.POST);\n request.setBody(body);\n return await request.queryJSON(this.router);\n }\n async GetById(id) {\n const request = new Aventus.HttpRequest(`${this.getPrefix()}/${this.StorableName()}/${id}`, Aventus.HttpMethod.GET);\n return await request.queryJSON(this.router);\n }\n async GetByIds(body) {\n const request = new Aventus.HttpRequest(`${this.getPrefix()}/${this.StorableName()}/getbyids`, Aventus.HttpMethod.POST);\n request.setBody(body);\n return await request.queryJSON(this.router);\n }\n async Update(id, body) {\n const request = new Aventus.HttpRequest(`${this.getPrefix()}/${this.StorableName()}/${id}`, Aventus.HttpMethod.PUT);\n request.setBody(body);\n return await request.queryJSON(this.router);\n }\n async UpdateMany(body) {\n const request = new Aventus.HttpRequest(`${this.getPrefix()}/${this.StorableName()}s`, Aventus.HttpMethod.PUT);\n request.setBody(body);\n return await request.queryJSON(this.router);\n }\n async Delete(id) {\n const request = new Aventus.HttpRequest(`${this.getPrefix()}/${this.StorableName()}/${id}`, Aventus.HttpMethod.DELETE);\n return await request.queryJSON(this.router);\n }\n async DeleteMany(body) {\n const request = new Aventus.HttpRequest(`${this.getPrefix()}/${this.StorableName()}s`, Aventus.HttpMethod.DELETE);\n request.setBody(body);\n return await request.queryJSON(this.router);\n }\n}\nRoutes.StorableRouter.Namespace=`AventusSharp.Routes`;\r\n_.Routes.StorableRouter=Routes.StorableRouter;\r\n","dependances":[{"fullName":"Aventus.HttpRoute","isStrong":true},{"fullName":"Aventus.IData","isStrong":false},{"fullName":"BindThis","isStrong":false},{"fullName":"Promise","isStrong":false},{"fullName":"AventusSharp.Tools.ResultWithError","isStrong":false},{"fullName":"Aventus.HttpRequest","isStrong":false},{"fullName":"Aventus.HttpMethod","isStrong":false},{"fullName":"TypeResult","isStrong":false},{"fullName":"FormData","isStrong":false}],"fullName":"AventusSharp.Routes.StorableRouter","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"Data.ResultWithDataError=class ResultWithDataError extends Tools.ResultWithError {\n static get Fullname() { return \"AventusSharp.Data.ResultWithDataError, AventusSharp\"; }\n}\nData.ResultWithDataError.Namespace=`AventusSharp.Data`;\r\nData.ResultWithDataError.$schema={...(Tools.ResultWithError?.$schema ?? {}), };\r\nAventus.Converter.register(Data.ResultWithDataError.Fullname, Data.ResultWithDataError);\r\n_.Data.ResultWithDataError=Data.ResultWithDataError;\r\n","dependances":[{"fullName":"AventusSharp.Tools.ResultWithError","isStrong":true},{"fullName":"AventusSharp.Data.DataError","isStrong":false},{"fullName":"Convertible","isStrong":false}],"fullName":"AventusSharp.Data.ResultWithDataError","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"Routes.RouteError=class RouteError extends Aventus.GenericError {\n static get Fullname() { return \"AventusSharp.Routes.RouteError, AventusSharp\"; }\n}\nRoutes.RouteError.Namespace=`AventusSharp.Routes`;\r\nRoutes.RouteError.$schema={...(Aventus.GenericError?.$schema ?? {}), };\r\nAventus.Converter.register(Routes.RouteError.Fullname, Routes.RouteError);\r\n_.Routes.RouteError=Routes.RouteError;\r\n","dependances":[{"fullName":"Aventus.GenericError","isStrong":true},{"fullName":"AventusSharp.Routes.RouteErrorCode","isStrong":true},{"fullName":"Convertible","isStrong":false}],"fullName":"AventusSharp.Routes.RouteError","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"Routes.ResultWithRouteError=class ResultWithRouteError extends Tools.ResultWithError {\n static get Fullname() { return \"AventusSharp.Routes.ResultWithRouteError, AventusSharp\"; }\n}\nRoutes.ResultWithRouteError.Namespace=`AventusSharp.Routes`;\r\nRoutes.ResultWithRouteError.$schema={...(Tools.ResultWithError?.$schema ?? {}), };\r\nAventus.Converter.register(Routes.ResultWithRouteError.Fullname, Routes.ResultWithRouteError);\r\n_.Routes.ResultWithRouteError=Routes.ResultWithRouteError;\r\n","dependances":[{"fullName":"AventusSharp.Tools.ResultWithError","isStrong":true},{"fullName":"AventusSharp.Routes.RouteError","isStrong":false},{"fullName":"Convertible","isStrong":false}],"fullName":"AventusSharp.Routes.ResultWithRouteError","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"Routes.VoidWithRouteError=class VoidWithRouteError extends Tools.VoidWithError {\n static get Fullname() { return \"AventusSharp.Routes.VoidWithRouteError, AventusSharp\"; }\n}\nRoutes.VoidWithRouteError.Namespace=`AventusSharp.Routes`;\r\nRoutes.VoidWithRouteError.$schema={...(Tools.VoidWithError?.$schema ?? {}), };\r\nAventus.Converter.register(Routes.VoidWithRouteError.Fullname, Routes.VoidWithRouteError);\r\n_.Routes.VoidWithRouteError=Routes.VoidWithRouteError;\r\n","dependances":[{"fullName":"AventusSharp.Tools.VoidWithError","isStrong":true},{"fullName":"AventusSharp.Routes.RouteError","isStrong":false},{"fullName":"Convertible","isStrong":false}],"fullName":"AventusSharp.Routes.VoidWithRouteError","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"WebSocket.SocketError=class SocketError extends Aventus.GenericError {\n}\nWebSocket.SocketError.Namespace=`AventusSharp.WebSocket`;\r\n_.WebSocket.SocketError=WebSocket.SocketError;\r\n","dependances":[{"fullName":"Aventus.GenericError","isStrong":true},{"fullName":"AventusSharp.WebSocket.SocketErrorCode","isStrong":false}],"fullName":"AventusSharp.WebSocket.SocketError","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"WebSocket.Connection=class Connection {\n static Debug = false;\n options;\n waitingList = {};\n memoryBeforeOpen = [];\n socket;\n actionGuard = new Aventus.ActionGuard();\n /**\n * Create a singleton\n */\n static getInstance() {\n return Aventus.Instance.get(WebSocket.Connection);\n }\n constructor() {\n this.options = this._configure(this.configure({}));\n this._onOpen = this._onOpen.bind(this);\n this._onClose = this._onClose.bind(this);\n this._onError = this._onError.bind(this);\n this.onMessage = this.onMessage.bind(this);\n if (this.options.autoStart) {\n this.open();\n }\n }\n onOpen = new Aventus.Callback();\n onClose = new Aventus.Callback();\n onError = new Aventus.Callback();\n /**\n * Configure a new Websocket\n */\n _configure(options = {}) {\n if (!options.host) {\n options.host = window.location.hostname;\n }\n if (!options.hasOwnProperty('useHttps')) {\n options.useHttps = window.location.protocol == \"https:\";\n }\n if (!options.port) {\n if (window.location.port) {\n options.port = parseInt(window.location.port);\n }\n else {\n options.port = options.useHttps ? 443 : 80;\n }\n }\n if (!options.routes) {\n options.routes = {};\n }\n if (!options.socketName) {\n options.socketName = \"\";\n }\n if (options.log === undefined) {\n options.log = WebSocket.Connection.Debug;\n }\n if (options.autoStart === undefined) {\n options.autoStart = true;\n }\n if (options.sendPing !== undefined && options.sendPing <= 0) {\n options.sendPing = undefined;\n }\n if (options.logPrefix === undefined) {\n options.logPrefix = \"\";\n }\n return options;\n }\n getUrl() {\n let protocol = \"ws\";\n if (this.options.useHttps) {\n protocol = \"wss\";\n }\n let url = protocol + \"://\" + this.options.host + \":\" + this.options.port + this.options.socketName;\n return url;\n }\n /**\n * Add a new route to listen to the websocket\n */\n addRoute(newRoute) {\n if (!this.options.routes.hasOwnProperty(newRoute.channel)) {\n this.options.routes[newRoute.channel] = [];\n }\n for (let info of this.options.routes[newRoute.channel]) {\n if (info.callback == newRoute.callback) {\n return;\n }\n }\n const { params, regex } = Aventus.Uri.prepare(newRoute.channel);\n let prepared = {\n callback: newRoute.callback,\n channel: newRoute.channel,\n regex,\n params\n };\n this.options.routes[newRoute.channel].push(prepared);\n }\n /**\n * The route to remove\n * @param route - The route to remove\n */\n removeRoute(route) {\n for (let i = 0; i < this.options.routes[route.channel].length; i++) {\n let info = this.options.routes[route.channel][i];\n if (info.callback == route.callback) {\n this.options.routes[route.channel].splice(i, 1);\n i--;\n }\n }\n }\n openCallback;\n /**\n * Try to open the websocket\n */\n open() {\n return this.actionGuard.run([\"open\"], () => {\n return new Promise((resolve) => {\n try {\n let url = this.getUrl();\n this.log(\"Opening \" + url);\n this.openCallback = (isOpen) => {\n resolve(isOpen);\n };\n this.socket = WebSocket.Socket.getInstance(url, this);\n this.socket.onOpen.add(this._onOpen);\n this.socket.onClose.add(this._onClose);\n this.socket.onError.add(this._onError);\n this.socket.onMessage.add(this.onMessage);\n if (this.socket.isReady()) {\n this._onOpen();\n }\n }\n catch (e) {\n console.log(e);\n resolve(false);\n }\n });\n });\n }\n jsonReplacer(key, value) {\n if (this[key] instanceof Date) {\n return Aventus.DateConverter.converter.toString(this[key]);\n }\n return value;\n }\n /**\n * Send a message though the websocket\n * @param channelName The channel on which the message is sent\n * @param data The data to send\n * @param options the options to add to the message (typically the uid)\n */\n async sendMessage(options) {\n let result = new Tools.VoidWithError();\n if (!this.socket || this.socket.readyState != 1) {\n let isOpen = await this.open();\n if (!isOpen) {\n result.errors.push(new WebSocket.SocketError(WebSocket.SocketErrorCode.socketClosed, \"Socket not ready ! Please ensure that it is open and ready to send message\"));\n this.log('Socket not ready ! Please ensure that it is open and ready to send message');\n if (this.options.allowSendBeforeOpen) {\n this.memoryBeforeOpen.push(options);\n }\n return result;\n }\n }\n if (this.socket && this.socket.readyState == 1) {\n try {\n let message = {\n channel: options.channel,\n };\n if (options.uid) {\n message.uid = options.uid;\n }\n if (options.body) {\n message.data = options.body;\n this.log(message);\n if (typeof options.body != 'string') {\n message.data = JSON.stringify(options.body, this.jsonReplacer);\n }\n }\n else if (options.channel != \"/ping\") {\n this.log(message);\n }\n this.socket.send(JSON.stringify(message));\n }\n catch (e) {\n result.errors.push(new WebSocket.SocketError(WebSocket.SocketErrorCode.unknow, e));\n }\n }\n else {\n result.errors.push(new WebSocket.SocketError(WebSocket.SocketErrorCode.socketClosed, \"Socket not ready ! Please ensure that it is open and ready to send message\"));\n this.log('Socket not ready ! Please ensure that it is open and ready to send message');\n if (this.options.allowSendBeforeOpen) {\n this.memoryBeforeOpen.push(options);\n }\n }\n return result;\n }\n /**\n * Send a message though the websocket and wait one answer give in parameters callbacks\n * @param channelName The channel on which the message is sent\n * @param body The data to send\n * @param timeout The timeout before the request failed\n */\n sendMessageAndWait(options) {\n return new Promise(async (resolve) => {\n let result = new Aventus.ResultWithError();\n try {\n let _uid = options.uid ? options.uid : Aventus.uuidv4();\n options.uid = _uid;\n let timeoutInfo;\n this.waitingList[_uid] = (channel, data) => {\n clearTimeout(timeoutInfo);\n if (channel.toLowerCase() != options.channel.toLowerCase()) {\n result.errors.push(new WebSocket.SocketError(WebSocket.SocketErrorCode.differentChannel, `We sent a message on ${options.channel} but we receive on ${channel}`));\n resolve(result);\n }\n else {\n if (data instanceof Aventus.VoidWithError) {\n for (let error of data.errors) {\n result.errors.push(error);\n }\n if (data instanceof Aventus.ResultWithError) {\n result.result = data.result;\n }\n }\n else {\n result.result = data;\n }\n resolve(result);\n }\n };\n if (options.timeout !== undefined) {\n timeoutInfo = setTimeout(() => {\n delete this.waitingList[_uid];\n result.errors.push(new WebSocket.SocketError(WebSocket.SocketErrorCode.timeout, \"No message received after \" + options.timeout + \"ms\"));\n resolve(result);\n }, options.timeout);\n }\n let sendMessageResult = await this.sendMessage(options);\n if (!sendMessageResult.success) {\n for (let error of sendMessageResult.errors) {\n result.errors.push(error);\n }\n resolve(result);\n }\n }\n catch (e) {\n result.errors.push(new WebSocket.SocketError(WebSocket.SocketErrorCode.unknow, e));\n resolve(result);\n }\n });\n }\n ;\n /**\n * Check if socket is ready\n */\n isReady() {\n if (this.socket && this.socket.isReady()) {\n return true;\n }\n return false;\n }\n sendPingTimeout = 0;\n sendPing() {\n this.sendMessage({\n channel: \"/ping\",\n });\n }\n startPing() {\n clearInterval(this.sendPingTimeout);\n this.sendPingTimeout = setInterval(() => {\n this.sendPing();\n }, 5000);\n }\n stopPing() {\n clearInterval(this.sendPingTimeout);\n }\n _onOpen() {\n if (this.socket?.isReady()) {\n if (this.openCallback) {\n this.openCallback(true);\n this.openCallback = undefined;\n }\n let protocol = \"ws\";\n if (this.options.useHttps) {\n protocol = \"wss\";\n }\n this.log(`Connection successfully established to ${this.getUrl()}!`);\n this.onOpen.trigger([]);\n for (let i = 0; i < this.memoryBeforeOpen.length; i++) {\n this.sendMessage(this.memoryBeforeOpen[i]);\n }\n this.memoryBeforeOpen = [];\n if (this.options.sendPing) {\n this.startPing();\n }\n }\n else {\n if (this.openCallback) {\n this.openCallback(false);\n this.openCallback = undefined;\n }\n }\n }\n errorOccur = false;\n _onError(event) {\n this.errorOccur = true;\n if (this.openCallback) {\n this.openCallback(false);\n this.openCallback = undefined;\n return;\n }\n this.log('An error has occured');\n this.onError.trigger([event]);\n }\n _onClose(event) {\n this.stopPing();\n if (this.errorOccur) {\n this.errorOccur = false;\n return;\n }\n this.log('Closing connection');\n this.onClose.trigger([event]);\n }\n /**\n * Close the current connection\n */\n close() {\n if (this.socket) {\n this.socket.onOpen.remove(this._onOpen);\n this.socket.onClose.remove(this._onClose);\n this.socket.onError.remove(this._onError);\n this.socket.onMessage.remove(this.onMessage);\n this.socket.close(this);\n delete this.socket;\n }\n }\n onMessage(event) {\n let response = JSON.parse(event.data);\n this.log(response);\n let data = {};\n try {\n data = Aventus.Converter.transform(JSON.parse(response.data));\n }\n catch (e) {\n console.error(e);\n }\n for (let channel in this.options.routes) {\n let current = this.options.routes[channel];\n for (let info of current) {\n let params = Aventus.Uri.getParams(info, response.channel);\n if (params) {\n let valueCb = data;\n if (data instanceof Aventus.ResultWithError) {\n valueCb = data.result;\n }\n else if (data instanceof Aventus.VoidWithError) {\n valueCb = undefined;\n }\n info.callback(valueCb, params, response.uid);\n }\n }\n }\n if (response.uid) {\n if (this.waitingList.hasOwnProperty(response.uid)) {\n this.waitingList[response.uid](response.channel, data);\n delete this.waitingList[response.uid];\n }\n }\n }\n /**\n * Print a msg inside the console\n */\n log(message) {\n if (this.options.log) {\n const now = new Date();\n const hours = (now.getHours()).toLocaleString(undefined, { minimumIntegerDigits: 2 });\n const minutes = (now.getMinutes()).toLocaleString(undefined, { minimumIntegerDigits: 2 });\n const seconds = (now.getSeconds()).toLocaleString(undefined, { minimumIntegerDigits: 2 });\n const prefix = this.options.logPrefix ? `[${this.options.logPrefix}] ` : '';\n if (message instanceof Object) {\n let cloneMessage = JSON.parse(JSON.stringify(message, this.jsonReplacer));\n if (cloneMessage.data && typeof cloneMessage.data == 'string') {\n cloneMessage.data = JSON.parse(cloneMessage.data);\n }\n console.log(`${prefix}[${hours}:${minutes}:${seconds}]: `, cloneMessage);\n }\n else {\n console.log(`${prefix}[${hours}:${minutes}:${seconds}]: `, message);\n }\n }\n }\n}\nWebSocket.Connection.Namespace=`AventusSharp.WebSocket`;\r\n_.WebSocket.Connection=WebSocket.Connection;\r\n","dependances":[{"fullName":"Required","isStrong":false},{"fullName":"AventusSharp.WebSocket.ConnectionOptions","isStrong":false},{"fullName":"AventusSharp.WebSocket.SocketSendMessageOptions","isStrong":false},{"fullName":"AventusSharp.WebSocket.Socket","isStrong":false},{"fullName":"Aventus.ActionGuard","isStrong":false},{"fullName":"AventusSharp.WebSocket.Connection","isStrong":false},{"fullName":"Aventus.Instance","isStrong":false},{"fullName":"Aventus.Callback","isStrong":false},{"fullName":"Event","isStrong":false},{"fullName":"AventusSharp.WebSocket.SocketRoute","isStrong":false},{"fullName":"Aventus.Uri","isStrong":false},{"fullName":"AventusSharp.WebSocket.InternalSocketRoute","isStrong":false},{"fullName":"Promise","isStrong":false},{"fullName":"Date","isStrong":false},{"fullName":"Aventus.DateConverter","isStrong":false},{"fullName":"Aventus.VoidWithError","isStrong":false},{"fullName":"AventusSharp.Tools.VoidWithError","isStrong":false},{"fullName":"AventusSharp.WebSocket.SocketError","isStrong":false},{"fullName":"AventusSharp.WebSocket.SocketErrorCode","isStrong":false},{"fullName":"AventusSharp.WebSocket.SocketMessage","isStrong":false},{"fullName":"Aventus.ResultWithError","isStrong":false},{"fullName":"Aventus.ExtractFromError","isStrong":false},{"fullName":"T","isStrong":false},{"fullName":"Aventus.uuidv4","isStrong":false},{"fullName":"MessageEvent","isStrong":false},{"fullName":"Aventus.Converter","isStrong":false}],"fullName":"AventusSharp.WebSocket.Connection","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"WebSocket.EndPoint=class EndPoint extends WebSocket.Connection {\n /**\n * Create a singleton\n */\n static getInstance() {\n return Aventus.Instance.get(WebSocket.EndPoint);\n }\n constructor() {\n super();\n this.register();\n }\n register() {\n }\n /**\n * @inheritdoc\n */\n configure(options) {\n options.socketName = this.path;\n options.sendPing = 5000;\n return options;\n }\n get path() {\n return \"/ws\";\n }\n ;\n}\nWebSocket.EndPoint.Namespace=`AventusSharp.WebSocket`;\r\n_.WebSocket.EndPoint=WebSocket.EndPoint;\r\n","dependances":[{"fullName":"AventusSharp.WebSocket.Connection","isStrong":true},{"fullName":"AventusSharp.WebSocket.EndPoint","isStrong":false},{"fullName":"Aventus.Instance","isStrong":false},{"fullName":"AventusSharp.WebSocket.ConnectionOptions","isStrong":false}],"fullName":"AventusSharp.WebSocket.EndPoint","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"WebSocket.WsEvent=class WsEvent {\n endpoint;\n onTrigger = new Aventus.Callback();\n routeInfo;\n _listening = false;\n get listening() {\n return this._listening;\n }\n getPrefix;\n constructor(endpoint, getPrefix) {\n this.endpoint = endpoint ?? WebSocket.EndPoint.getInstance();\n this.getPrefix = getPrefix ?? (() => \"\");\n this.onEvent = this.onEvent.bind(this);\n }\n init() {\n this.routeInfo = {\n channel: this.path(),\n callback: this.onEvent\n };\n if (this.listenOnBoot()) {\n this.listen();\n }\n }\n /**\n * Override this method to tell that the event must listen when created\n */\n listenOnBoot() {\n return false;\n }\n /**\n * Add the event to the endpoint. After that, the on trigger event can be triggered\n */\n listen() {\n if (!this._listening) {\n this._listening = true;\n if (!this.routeInfo) {\n this.routeInfo = {\n channel: this.path(),\n callback: this.onEvent\n };\n }\n this.endpoint.addRoute(this.routeInfo);\n }\n }\n /**\n * Remove the event from the endpoint. After that, the on trigger event won't be triggered\n */\n stop() {\n if (this._listening) {\n this._listening = false;\n this.endpoint.removeRoute(this.routeInfo);\n }\n }\n onEvent(data, params, uid) {\n this.onTrigger.trigger([data, params, uid]);\n }\n}\nWebSocket.WsEvent.Namespace=`AventusSharp.WebSocket`;\r\n_.WebSocket.WsEvent=WebSocket.WsEvent;\r\n","dependances":[{"fullName":"AventusSharp.WebSocket.EndPoint","isStrong":false},{"fullName":"Aventus.Callback","isStrong":false},{"fullName":"Aventus.ExtractFromError","isStrong":false},{"fullName":"Aventus.UriParamsValue","isStrong":false},{"fullName":"AventusSharp.WebSocket.SocketRoute","isStrong":false}],"fullName":"AventusSharp.WebSocket.WsEvent","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"WebSocket.StorableWsRoute_DeleteMany=class StorableWsRoute_DeleteMany extends WebSocket.WsEvent {\n /**\n * @inheritdoc\n */\n path() {\n return `${this.getPrefix()}/${this.StorableName()}/DeleteMany`;\n }\n StorableName;\n constructor(endpoint, getPrefix, StorableName) {\n super(endpoint, getPrefix);\n this.StorableName = StorableName ?? (() => \"\");\n }\n}\nWebSocket.StorableWsRoute_DeleteMany.Namespace=`AventusSharp.WebSocket`;\r\n_.WebSocket.StorableWsRoute_DeleteMany=WebSocket.StorableWsRoute_DeleteMany;\r\n","dependances":[{"fullName":"AventusSharp.WebSocket.WsEvent","isStrong":true},{"fullName":"AventusSharp.Tools.ResultWithError","isStrong":false},{"fullName":"Aventus.IData","isStrong":false},{"fullName":"AventusSharp.WebSocket.EndPoint","isStrong":false}],"fullName":"AventusSharp.WebSocket.StorableWsRoute_DeleteMany","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"WebSocket.StorableWsRouter_Delete=class StorableWsRouter_Delete extends WebSocket.WsEvent {\n StorableName;\n constructor(endpoint, getPrefix, StorableName) {\n super(endpoint, getPrefix);\n this.StorableName = StorableName;\n }\n /**\n * @inheritdoc\n */\n path() {\n return `${this.getPrefix()}/${this.StorableName()}/{id:number}/Delete`;\n }\n}\nWebSocket.StorableWsRouter_Delete.Namespace=`AventusSharp.WebSocket`;\r\n_.WebSocket.StorableWsRouter_Delete=WebSocket.StorableWsRouter_Delete;\r\n","dependances":[{"fullName":"AventusSharp.WebSocket.WsEvent","isStrong":true},{"fullName":"AventusSharp.WebSocket.EndPoint","isStrong":false}],"fullName":"AventusSharp.WebSocket.StorableWsRouter_Delete","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"WebSocket.StorableWsRoute_UpdateMany=class StorableWsRoute_UpdateMany extends WebSocket.WsEvent {\n /**\n * @inheritdoc\n */\n path() {\n return `${this.getPrefix()}/${this.StorableName()}/UpdateMany`;\n }\n StorableName;\n constructor(endpoint, getPrefix, StorableName) {\n super(endpoint, getPrefix);\n this.StorableName = StorableName ?? (() => \"\");\n }\n}\nWebSocket.StorableWsRoute_UpdateMany.Namespace=`AventusSharp.WebSocket`;\r\n_.WebSocket.StorableWsRoute_UpdateMany=WebSocket.StorableWsRoute_UpdateMany;\r\n","dependances":[{"fullName":"AventusSharp.WebSocket.WsEvent","isStrong":true},{"fullName":"AventusSharp.Tools.ResultWithError","isStrong":false},{"fullName":"Aventus.IData","isStrong":false},{"fullName":"AventusSharp.WebSocket.EndPoint","isStrong":false}],"fullName":"AventusSharp.WebSocket.StorableWsRoute_UpdateMany","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"WebSocket.StorableWsRouter_Update=class StorableWsRouter_Update extends WebSocket.WsEvent {\n StorableName;\n constructor(endpoint, getPrefix, StorableName) {\n super(endpoint, getPrefix);\n this.StorableName = StorableName;\n }\n /**\n * @inheritdoc\n */\n path() {\n return `${this.getPrefix()}/${this.StorableName()}/{id:number}/Update`;\n }\n}\nWebSocket.StorableWsRouter_Update.Namespace=`AventusSharp.WebSocket`;\r\n_.WebSocket.StorableWsRouter_Update=WebSocket.StorableWsRouter_Update;\r\n","dependances":[{"fullName":"AventusSharp.WebSocket.WsEvent","isStrong":true},{"fullName":"AventusSharp.WebSocket.EndPoint","isStrong":false}],"fullName":"AventusSharp.WebSocket.StorableWsRouter_Update","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"WebSocket.StorableWsRouter_GetByIds=class StorableWsRouter_GetByIds extends WebSocket.WsEvent {\n StorableName;\n constructor(endpoint, getPrefix, StorableName) {\n super(endpoint, getPrefix);\n this.StorableName = StorableName;\n }\n /**\n * @inheritdoc\n */\n path() {\n return `${this.getPrefix()}/${this.StorableName()}/getbyids`;\n }\n}\nWebSocket.StorableWsRouter_GetByIds.Namespace=`AventusSharp.WebSocket`;\r\n_.WebSocket.StorableWsRouter_GetByIds=WebSocket.StorableWsRouter_GetByIds;\r\n","dependances":[{"fullName":"AventusSharp.WebSocket.WsEvent","isStrong":true},{"fullName":"AventusSharp.WebSocket.EndPoint","isStrong":false}],"fullName":"AventusSharp.WebSocket.StorableWsRouter_GetByIds","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"WebSocket.StorableWsRouter_GetById=class StorableWsRouter_GetById extends WebSocket.WsEvent {\n StorableName;\n constructor(endpoint, getPrefix, StorableName) {\n super(endpoint, getPrefix);\n this.StorableName = StorableName;\n }\n /**\n * @inheritdoc\n */\n path() {\n return `${this.getPrefix()}/${this.StorableName()}/{id:number}`;\n }\n}\nWebSocket.StorableWsRouter_GetById.Namespace=`AventusSharp.WebSocket`;\r\n_.WebSocket.StorableWsRouter_GetById=WebSocket.StorableWsRouter_GetById;\r\n","dependances":[{"fullName":"AventusSharp.WebSocket.WsEvent","isStrong":true},{"fullName":"AventusSharp.WebSocket.EndPoint","isStrong":false}],"fullName":"AventusSharp.WebSocket.StorableWsRouter_GetById","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"WebSocket.StorableWsRoute_CreateMany=class StorableWsRoute_CreateMany extends WebSocket.WsEvent {\n /**\n * @inheritdoc\n */\n path() {\n return `${this.getPrefix()}/${this.StorableName()}/CreateMany`;\n }\n StorableName;\n constructor(endpoint, getPrefix, StorableName) {\n super(endpoint, getPrefix);\n this.StorableName = StorableName ?? (() => \"\");\n }\n}\nWebSocket.StorableWsRoute_CreateMany.Namespace=`AventusSharp.WebSocket`;\r\n_.WebSocket.StorableWsRoute_CreateMany=WebSocket.StorableWsRoute_CreateMany;\r\n","dependances":[{"fullName":"AventusSharp.WebSocket.WsEvent","isStrong":true},{"fullName":"AventusSharp.Tools.ResultWithError","isStrong":false},{"fullName":"Aventus.IData","isStrong":false},{"fullName":"AventusSharp.WebSocket.EndPoint","isStrong":false}],"fullName":"AventusSharp.WebSocket.StorableWsRoute_CreateMany","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"WebSocket.StorableWsRouter_Create=class StorableWsRouter_Create extends WebSocket.WsEvent {\n StorableName;\n constructor(endpoint, getPrefix, StorableName) {\n super(endpoint, getPrefix);\n this.StorableName = StorableName;\n }\n /**\n * @inheritdoc\n */\n path() {\n return `${this.getPrefix()}/${this.StorableName()}/Create`;\n }\n}\nWebSocket.StorableWsRouter_Create.Namespace=`AventusSharp.WebSocket`;\r\n_.WebSocket.StorableWsRouter_Create=WebSocket.StorableWsRouter_Create;\r\n","dependances":[{"fullName":"AventusSharp.WebSocket.WsEvent","isStrong":true},{"fullName":"AventusSharp.WebSocket.EndPoint","isStrong":false}],"fullName":"AventusSharp.WebSocket.StorableWsRouter_Create","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"WebSocket.StorableWsRouter_GetAll=class StorableWsRouter_GetAll extends WebSocket.WsEvent {\n StorableName;\n constructor(endpoint, getPrefix, StorableName) {\n super(endpoint, getPrefix);\n this.StorableName = StorableName;\n }\n /**\n * @inheritdoc\n */\n path() {\n return `${this.getPrefix()}/${this.StorableName()}`;\n }\n}\nWebSocket.StorableWsRouter_GetAll.Namespace=`AventusSharp.WebSocket`;\r\n_.WebSocket.StorableWsRouter_GetAll=WebSocket.StorableWsRouter_GetAll;\r\n","dependances":[{"fullName":"AventusSharp.WebSocket.WsEvent","isStrong":true},{"fullName":"AventusSharp.WebSocket.EndPoint","isStrong":false}],"fullName":"AventusSharp.WebSocket.StorableWsRouter_GetAll","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"WebSocket.Router=class Router {\n endpoint;\n events;\n constructor(endpoint) {\n this.endpoint = endpoint ?? WebSocket.EndPoint.getInstance();\n this.events = this.defineEvents();\n for (let key in this.events) {\n this.events[key].init();\n }\n }\n getPrefix() {\n return \"\";\n }\n defineEvents() {\n return {};\n }\n}\nWebSocket.Router.Namespace=`AventusSharp.WebSocket`;\r\n_.WebSocket.Router=WebSocket.Router;\r\n","dependances":[{"fullName":"AventusSharp.WebSocket.RouterRoutes","isStrong":false},{"fullName":"AventusSharp.WebSocket.EndPoint","isStrong":false},{"fullName":"Partial","isStrong":false}],"fullName":"AventusSharp.WebSocket.Router","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"WebSocket.StorableWsRouter=class StorableWsRouter extends WebSocket.Router {\n defineEvents() {\n return {\n ...super.defineEvents(),\n GetAll: new WebSocket.StorableWsRouter_GetAll(this.endpoint, this.getPrefix, this.StorableName),\n Create: new WebSocket.StorableWsRouter_Create(this.endpoint, this.getPrefix, this.StorableName),\n CreateMany: new WebSocket.StorableWsRoute_CreateMany(this.endpoint, this.getPrefix, this.StorableName),\n GetById: new WebSocket.StorableWsRouter_GetById(this.endpoint, this.getPrefix, this.StorableName),\n GetByIds: new WebSocket.StorableWsRouter_GetByIds(this.endpoint, this.getPrefix, this.StorableName),\n Update: new WebSocket.StorableWsRouter_Update(this.endpoint, this.getPrefix, this.StorableName),\n UpdateMany: new WebSocket.StorableWsRoute_UpdateMany(this.endpoint, this.getPrefix, this.StorableName),\n Delete: new WebSocket.StorableWsRouter_Delete(this.endpoint, this.getPrefix, this.StorableName),\n DeleteMany: new WebSocket.StorableWsRoute_DeleteMany(this.endpoint, this.getPrefix, this.StorableName),\n };\n }\n async GetAll(options = {}) {\n const info = {\n channel: `${this.getPrefix()}/${this.StorableName()}`,\n ...options,\n };\n return await this.endpoint.sendMessageAndWait(info);\n }\n async Create(body, options = {}) {\n const info = {\n channel: `${this.getPrefix()}/${this.StorableName()}/Create`,\n body: body,\n ...options,\n };\n return await this.endpoint.sendMessageAndWait(info);\n }\n async CreateMany(body, options = {}) {\n const info = {\n channel: `${this.getPrefix()}/${this.StorableName()}/CreateMany`,\n body: body,\n ...options,\n };\n return await this.endpoint.sendMessageAndWait(info);\n }\n async GetById(id, options = {}) {\n const info = {\n channel: `${this.getPrefix()}/${this.StorableName()}/${id}`,\n ...options,\n };\n return await this.endpoint.sendMessageAndWait(info);\n }\n async GetByIds(body, options = {}) {\n const info = {\n channel: `${this.getPrefix()}/${this.StorableName()}/getbyids`,\n body: body,\n ...options,\n };\n return await this.endpoint.sendMessageAndWait(info);\n }\n async Update(id, body, options = {}) {\n const info = {\n channel: `${this.getPrefix()}/${this.StorableName()}/${id}/Update`,\n body: body,\n ...options,\n };\n return await this.endpoint.sendMessageAndWait(info);\n }\n async UpdateMany(body, options = {}) {\n const info = {\n channel: `${this.getPrefix()}/${this.StorableName()}/UpdateMany`,\n body: body,\n ...options,\n };\n return await this.endpoint.sendMessageAndWait(info);\n }\n async Delete(id, options = {}) {\n const info = {\n channel: `${this.getPrefix()}/${this.StorableName()}/${id}/Delete`,\n ...options,\n };\n return await this.endpoint.sendMessageAndWait(info);\n }\n async DeleteMany(body, options = {}) {\n const info = {\n channel: `${this.getPrefix()}/${this.StorableName()}/DeleteMany`,\n body: body,\n ...options,\n };\n return await this.endpoint.sendMessageAndWait(info);\n }\n}\nWebSocket.StorableWsRouter.Namespace=`AventusSharp.WebSocket`;\r\n_.WebSocket.StorableWsRouter=WebSocket.StorableWsRouter;\r\n","dependances":[{"fullName":"AventusSharp.WebSocket.Router","isStrong":true},{"fullName":"Aventus.IData","isStrong":false},{"fullName":"AventusSharp.WebSocket.StorableWsRouter__Routes","isStrong":false},{"fullName":"Partial","isStrong":false},{"fullName":"AventusSharp.WebSocket.StorableWsRouter_GetAll","isStrong":false},{"fullName":"AventusSharp.WebSocket.StorableWsRouter_Create","isStrong":false},{"fullName":"AventusSharp.WebSocket.StorableWsRoute_CreateMany","isStrong":false},{"fullName":"AventusSharp.WebSocket.StorableWsRouter_GetById","isStrong":false},{"fullName":"AventusSharp.WebSocket.StorableWsRouter_GetByIds","isStrong":false},{"fullName":"AventusSharp.WebSocket.StorableWsRouter_Update","isStrong":false},{"fullName":"AventusSharp.WebSocket.StorableWsRoute_UpdateMany","isStrong":false},{"fullName":"AventusSharp.WebSocket.StorableWsRouter_Delete","isStrong":false},{"fullName":"AventusSharp.WebSocket.StorableWsRoute_DeleteMany","isStrong":false},{"fullName":"AventusSharp.WebSocket.WsRouteSendOptions","isStrong":false},{"fullName":"Promise","isStrong":false},{"fullName":"AventusSharp.ExtractResponse","isStrong":false},{"fullName":"AventusSharp.WebSocket.SocketSendMessageOptions","isStrong":false},{"fullName":"FormData","isStrong":false}],"fullName":"AventusSharp.WebSocket.StorableWsRouter","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"WebSocket.WsError=class WsError extends Aventus.GenericError {\n static get Fullname() { return \"AventusSharp.WebSocket.WsError, AventusSharp\"; }\n}\nWebSocket.WsError.Namespace=`AventusSharp.WebSocket`;\r\nWebSocket.WsError.$schema={...(Aventus.GenericError?.$schema ?? {}), };\r\nAventus.Converter.register(WebSocket.WsError.Fullname, WebSocket.WsError);\r\n_.WebSocket.WsError=WebSocket.WsError;\r\n","dependances":[{"fullName":"Aventus.GenericError","isStrong":true},{"fullName":"AventusSharp.WebSocket.WsErrorCode","isStrong":true},{"fullName":"Convertible","isStrong":false}],"fullName":"AventusSharp.WebSocket.WsError","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"WebSocket.ResultWithWsError=class ResultWithWsError extends Tools.ResultWithError {\n static get Fullname() { return \"AventusSharp.WebSocket.ResultWithWsError, AventusSharp\"; }\n}\nWebSocket.ResultWithWsError.Namespace=`AventusSharp.WebSocket`;\r\nWebSocket.ResultWithWsError.$schema={...(Tools.ResultWithError?.$schema ?? {}), };\r\nAventus.Converter.register(WebSocket.ResultWithWsError.Fullname, WebSocket.ResultWithWsError);\r\n_.WebSocket.ResultWithWsError=WebSocket.ResultWithWsError;\r\n","dependances":[{"fullName":"AventusSharp.Tools.ResultWithError","isStrong":true},{"fullName":"AventusSharp.WebSocket.WsError","isStrong":false},{"fullName":"Convertible","isStrong":false}],"fullName":"AventusSharp.WebSocket.ResultWithWsError","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"WebSocket.VoidWithWsError=class VoidWithWsError extends Tools.VoidWithError {\n static get Fullname() { return \"AventusSharp.WebSocket.VoidWithWsError, AventusSharp\"; }\n}\nWebSocket.VoidWithWsError.Namespace=`AventusSharp.WebSocket`;\r\nWebSocket.VoidWithWsError.$schema={...(Tools.VoidWithError?.$schema ?? {}), };\r\nAventus.Converter.register(WebSocket.VoidWithWsError.Fullname, WebSocket.VoidWithWsError);\r\n_.WebSocket.VoidWithWsError=WebSocket.VoidWithWsError;\r\n","dependances":[{"fullName":"AventusSharp.Tools.VoidWithError","isStrong":true},{"fullName":"AventusSharp.WebSocket.WsError","isStrong":false},{"fullName":"Convertible","isStrong":false}],"fullName":"AventusSharp.WebSocket.VoidWithWsError","required":false,"type":1,"isExported":true,"convertibleName":"Fullname"},{"code":"RAM.RamHttp=class RamHttp extends Aventus.Ram {\n getAllDone = false;\n routes;\n constructor() {\n super();\n this.routes = this.defineRoutes();\n }\n async beforeGetAll(result) {\n if (!this.getAllDone) {\n let response = await this.routes.GetAll();\n if (response.success && response.result) {\n for (let item of response.result) {\n let resultTemp = new Aventus.ResultRamWithError();\n await this.addOrUpdateData(item, resultTemp);\n if (!resultTemp.success) {\n result.errors = [...result.errors, ...resultTemp.errors];\n }\n }\n this.getAllDone = true;\n }\n else {\n result.errors = [...result.errors, ...response.errors];\n }\n }\n }\n async beforeGetById(id, result) {\n if (this.records.has(id)) {\n return;\n }\n else {\n let response = await this.routes.GetById(id);\n if (response.success && response.result) {\n let resultTemp = new Aventus.ResultRamWithError();\n await this.addOrUpdateData(response.result, resultTemp);\n if (!resultTemp.success) {\n result.errors = [...result.errors, ...resultTemp.errors];\n }\n else {\n result.result = resultTemp.result;\n }\n }\n else {\n result.errors = [...result.errors, ...response.errors];\n }\n }\n }\n async beforeGetByIds(ids, result) {\n let missingIds = [];\n for (let id of ids) {\n if (!this.records.has(id)) {\n missingIds.push(id);\n }\n }\n if (missingIds.length > 0) {\n result.result = [];\n let response = await this.routes.GetByIds({ ids: missingIds });\n if (response.success && response.result) {\n for (let item of response.result) {\n let resultTemp = new Aventus.ResultRamWithError();\n await this.addOrUpdateData(item, resultTemp);\n if (!resultTemp.success || !resultTemp.result) {\n result.errors = [...result.errors, ...resultTemp.errors];\n }\n else if (!result.result.includes(resultTemp.result)) {\n result.result.push(resultTemp.result);\n }\n }\n }\n else {\n result.errors = [...result.errors, ...response.errors];\n }\n }\n }\n async beforeCreateItem(item, fromList, result) {\n if (fromList) {\n return;\n }\n let response = await this.routes.Create({ item });\n if (response.success && response.result) {\n result.result = this.getObjectForRam(response.result);\n }\n else {\n result.errors = [...result.errors, ...response.errors];\n }\n }\n async beforeCreateList(list, result) {\n let response = await this.routes.CreateMany({ list });\n if (response.success && response.result) {\n result.result = [];\n for (let element of response.result) {\n result.result.push(this.getObjectForRam(element));\n }\n }\n else {\n result.errors = [...result.errors, ...response.errors];\n }\n }\n async beforeUpdateItem(item, fromList, result) {\n if (fromList) {\n return;\n }\n let response = await this.routes.Update(item.Id, { item });\n if (response.success && response.result) {\n result.result = this.getObjectForRam(response.result);\n }\n else {\n result.errors = [...result.errors, ...response.errors];\n }\n }\n async beforeUpdateList(list, result) {\n let response = await this.routes.UpdateMany({ list });\n if (response.success && response.result) {\n result.result = [];\n for (let element of response.result) {\n result.result.push(this.getObjectForRam(element));\n }\n }\n else {\n result.errors = [...result.errors, ...response.errors];\n }\n }\n async beforeDeleteItem(item, fromList, result) {\n if (fromList) {\n return;\n }\n let response = await this.routes.Delete(item.Id);\n if (!response.success) {\n result.errors = [...result.errors, ...response.errors];\n }\n }\n async beforeDeleteList(list, result) {\n let response = await this.routes.DeleteMany({ ids: list.map(t => t.Id) });\n if (!response.success) {\n result.errors = [...result.errors, ...response.errors];\n }\n }\n}\nRAM.RamHttp.Namespace=`AventusSharp.RAM`;\r\n_.RAM.RamHttp=RAM.RamHttp;\r\n","dependances":[{"fullName":"Aventus.Ram","isStrong":true},{"fullName":"AventusSharp.Data.Storable","isStrong":false},{"fullName":"AventusSharp.Routes.StorableRouter","isStrong":false},{"fullName":"Aventus.ResultRamWithError","isStrong":false},{"fullName":"Map","isStrong":false},{"fullName":"Aventus.RamItem","isStrong":false},{"fullName":"Promise","isStrong":false},{"fullName":"Aventus.VoidWithError","isStrong":false}],"fullName":"AventusSharp.RAM.RamHttp","required":false,"type":1,"isExported":true,"convertibleName":""},{"code":"RAM.RamWebSocket=class RamWebSocket extends Aventus.Ram {\n getAllDone = false;\n routes;\n otherGetAllLocked = {};\n otherGetByIdLocked = {};\n otherCreateItemLocked = {};\n otherCreateListLocked = {};\n otherUpdateItemLocked = {};\n otherUpdateListLocked = {};\n otherDeleteItemLocked = {};\n otherDeleteListLocked = {};\n constructor() {\n super();\n this.routes = this.defineRoutes();\n this.addEventsBindings();\n this.otherGetAll = this.otherGetAll.bind(this);\n this.otherGetById = this.otherGetById.bind(this);\n this.otherCreateItem = this.otherCreateItem.bind(this);\n this.otherCreateList = this.otherCreateList.bind(this);\n this.otherUpdateItem = this.otherUpdateItem.bind(this);\n this.otherUpdateList = this.otherUpdateList.bind(this);\n this.otherDeleteItem = this.otherDeleteItem.bind(this);\n this.otherDeleteList = this.otherDeleteList.bind(this);\n }\n addEventsBindings() {\n const autoListen = this.listenOnStart();\n this.routes.events.GetAll.onTrigger.add(this.otherGetAll, this);\n if (autoListen.GetAll) {\n this.routes.events.GetAll.listen();\n }\n else {\n this.routes.events.GetAll.stop();\n }\n this.routes.events.GetById.onTrigger.add(this.otherGetById, this);\n if (autoListen.GetById) {\n this.routes.events.GetById.listen();\n }\n else {\n this.routes.events.GetById.stop();\n }\n this.routes.events.Create.onTrigger.add(this.otherCreateItem, this);\n if (autoListen.Create) {\n this.routes.events.Create.listen();\n }\n else {\n this.routes.events.Create.stop();\n }\n this.routes.events.CreateMany.onTrigger.add(this.otherCreateList, this);\n if (autoListen.CreateMany) {\n this.routes.events.CreateMany.listen();\n }\n else {\n this.routes.events.CreateMany.stop();\n }\n this.routes.events.Update.onTrigger.add(this.otherUpdateItem, this);\n if (autoListen.Update) {\n this.routes.events.Update.listen();\n }\n else {\n this.routes.events.Update.stop();\n }\n this.routes.events.UpdateMany.onTrigger.add(this.otherUpdateList, this);\n if (autoListen.UpdateMany) {\n this.routes.events.UpdateMany.listen();\n }\n else {\n this.routes.events.UpdateMany.stop();\n }\n this.routes.events.Delete.onTrigger.add(this.otherDeleteItem, this);\n if (autoListen.Delete) {\n this.routes.events.Delete.listen();\n }\n else {\n this.routes.events.Delete.stop();\n }\n this.routes.events.DeleteMany.onTrigger.add(this.otherDeleteList, this);\n if (autoListen.DeleteMany) {\n this.routes.events.DeleteMany.listen();\n }\n else {\n this.routes.events.DeleteMany.stop();\n }\n }\n listenOnStart() {\n return {\n GetAll: false,\n GetById: false,\n Create: true,\n CreateMany: true,\n Update: true,\n UpdateMany: true,\n Delete: true,\n DeleteMany: true,\n };\n }\n async otherGetAll(items, params, uid) {\n if (uid && this.otherGetAllLocked[uid])\n return;\n for (let item of items) {\n let resultTemp = new Aventus.ResultRamWithError();\n await this.addOrUpdateData(item, resultTemp);\n }\n }\n async beforeGetAll(result) {\n if (!this.getAllDone) {\n let uid = Aventus.uuidv4();\n this.otherGetAllLocked[uid] = true;\n let response = await this.routes.GetAll({ uid });\n delete this.otherGetAllLocked[uid];\n if (!response)\n return;\n if (response.success && response.result) {\n for (let item of response.result) {\n let resultTemp = new Aventus.ResultRamWithError();\n await this.addOrUpdateData(item, resultTemp);\n if (!resultTemp.success) {\n result.errors = [...result.errors, ...resultTemp.errors];\n }\n }\n }\n else {\n result.errors = [...result.errors, ...response.errors];\n }\n }\n }\n async otherGetById(item, params, uid) {\n if (uid && this.otherGetByIdLocked[uid])\n return;\n let resultTemp = new Aventus.ResultRamWithError();\n await this.addOrUpdateData(item, resultTemp);\n }\n async beforeGetById(id, result) {\n if (this.records.has(id)) {\n return;\n }\n else {\n let uid = Aventus.uuidv4();\n this.otherGetByIdLocked[uid] = true;\n let response = await this.routes.GetById(id, { uid });\n delete this.otherGetByIdLocked[uid];\n if (!response)\n return;\n if (response.success && response.result) {\n let resultTemp = new Aventus.ResultRamWithError();\n await this.addOrUpdateData(response.result, resultTemp);\n if (!resultTemp.success) {\n result.errors = [...result.errors, ...resultTemp.errors];\n }\n }\n else {\n result.errors = [...result.errors, ...response.errors];\n }\n }\n }\n async beforeGetByIds(ids, result) {\n let missingIds = [];\n for (let id of ids) {\n if (!this.records.has(id)) {\n missingIds.push(id);\n }\n }\n if (missingIds.length > 0) {\n let response = await this.routes.GetByIds({ ids: missingIds });\n if (response.success && response.result) {\n for (let item of response.result) {\n let resultTemp = new Aventus.ResultRamWithError();\n await this.addOrUpdateData(item, resultTemp);\n if (!resultTemp.success) {\n result.errors = [...result.errors, ...resultTemp.errors];\n }\n }\n }\n else {\n result.errors = [...result.errors, ...response.errors];\n }\n }\n }\n async otherCreateItem(item, params, uid) {\n if (uid && this.otherCreateItemLocked[uid])\n return;\n let resultTemp = new Aventus.ResultRamWithError();\n await this.addOrUpdateData(item, resultTemp);\n if (resultTemp.success && resultTemp.result) {\n this.publish('created', resultTemp.result);\n }\n }\n async beforeCreateItem(item, fromList, result) {\n if (fromList) {\n return;\n }\n let uid = Aventus.uuidv4();\n this.otherCreateItemLocked[uid] = true;\n let response = await this.routes.Create({ item }, { uid });\n delete this.otherCreateItemLocked[uid];\n if (response.success && response.result) {\n result.result = this.getObjectForRam(response.result);\n }\n else {\n result.errors = [...result.errors, ...response.errors];\n }\n }\n async otherCreateList(items, params, uid) {\n if (uid && this.otherCreateListLocked[uid])\n return;\n for (let item of items) {\n let resultTemp = new Aventus.ResultRamWithError();\n await this.addOrUpdateData(item, resultTemp);\n if (resultTemp.success && resultTemp.result) {\n this.publish('created', resultTemp.result);\n }\n }\n }\n async beforeCreateList(list, result) {\n let uid = Aventus.uuidv4();\n this.otherCreateListLocked[uid] = true;\n let response = await this.routes.CreateMany({ list }, { uid });\n delete this.otherCreateListLocked[uid];\n if (response.success && response.result) {\n result.result = [];\n for (let element of response.result) {\n result.result.push(this.getObjectForRam(element));\n }\n }\n else {\n result.errors = [...result.errors, ...response.errors];\n }\n }\n async otherUpdateItem(item, params, uid) {\n if (uid && this.otherUpdateItemLocked[uid])\n return;\n let resultTemp = new Aventus.ResultRamWithError();\n await this.addOrUpdateData(item, resultTemp);\n if (resultTemp.success && resultTemp.result) {\n this.publish('updated', resultTemp.result);\n }\n }\n async beforeUpdateItem(item, fromList, result) {\n if (fromList) {\n return;\n }\n let uid = Aventus.uuidv4();\n this.otherUpdateItemLocked[uid] = true;\n let response = await this.routes.Update(item.Id, { item }, { uid });\n delete this.otherUpdateItemLocked[uid];\n if (response.success && response.result) {\n result.result = this.getObjectForRam(response.result);\n }\n else {\n result.errors = [...result.errors, ...response.errors];\n }\n }\n async otherUpdateList(items, params, uid) {\n if (uid && this.otherUpdateListLocked[uid])\n return;\n for (let item of items) {\n let resultTemp = new Aventus.ResultRamWithError();\n await this.addOrUpdateData(item, resultTemp);\n if (resultTemp.success && resultTemp.result) {\n this.publish('updated', resultTemp.result);\n }\n }\n }\n async beforeUpdateList(list, result) {\n let uid = Aventus.uuidv4();\n this.otherUpdateListLocked[uid] = true;\n let response = await this.routes.UpdateMany({ list }, { uid });\n delete this.otherUpdateListLocked[uid];\n if (response.success && response.result) {\n result.result = [];\n for (let element of response.result) {\n result.result.push(this.getObjectForRam(element));\n }\n }\n else {\n result.errors = [...result.errors, ...response.errors];\n }\n }\n otherDeleteItem(item, params, uid) {\n if (uid && this.otherDeleteItemLocked[uid])\n return;\n let resultTemp = new Aventus.ResultRamWithError();\n this.deleteData(item, resultTemp);\n if (resultTemp.success && resultTemp.result) {\n this.publish('deleted', resultTemp.result);\n this.recordsSubscribers.delete(resultTemp.result.Id);\n }\n }\n async beforeDeleteItem(item, fromList, result) {\n if (fromList) {\n return;\n }\n let uid = Aventus.uuidv4();\n this.otherDeleteItemLocked[uid] = true;\n let response = await this.routes.Delete(item.Id, { uid });\n delete this.otherDeleteItemLocked[uid];\n if (!response.success) {\n result.errors = [...result.errors, ...response.errors];\n }\n }\n otherDeleteList(items, params, uid) {\n if (uid && this.otherDeleteListLocked[uid])\n return;\n for (let item of items) {\n let resultTemp = new Aventus.ResultRamWithError();\n this.deleteData(item, resultTemp);\n if (resultTemp.success && resultTemp.result) {\n this.publish('deleted', resultTemp.result);\n this.recordsSubscribers.delete(resultTemp.result.Id);\n }\n }\n }\n async beforeDeleteList(list, result) {\n let uid = Aventus.uuidv4();\n this.otherDeleteListLocked[uid] = true;\n let response = await this.routes.DeleteMany({ ids: list.map(t => t.Id) }, { uid });\n delete this.otherDeleteListLocked[uid];\n if (!response.success) {\n result.errors = [...result.errors, ...response.errors];\n }\n }\n /**\n * Delete element inside Ram without firing delete event\n */\n deleteData(item, result) {\n try {\n let idWithError = this.getIdWithError(item);\n if (idWithError.success && idWithError.result !== undefined) {\n let id = idWithError.result;\n if (this.records.has(id)) {\n result.result = this.records.get(id);\n this.records.delete(id);\n }\n else {\n result.errors.push(new Aventus.RamError(Aventus.RamErrorCode.noItemInsideRam, \"can't delete the item \" + id + \" because it wasn't found inside ram\"));\n }\n }\n else {\n result.errors = [...result.errors, ...idWithError.errors];\n }\n }\n catch (e) {\n result.errors.push(new Aventus.RamError(Aventus.RamErrorCode.unknow, e));\n }\n }\n}\nRAM.RamWebSocket.Namespace=`AventusSharp.RAM`;\r\n_.RAM.RamWebSocket=RAM.RamWebSocket;\r\n","dependances":[{"fullName":"Aventus.Ram","isStrong":true},{"fullName":"AventusSharp.Data.Storable","isStrong":false},{"fullName":"AventusSharp.WebSocket.StorableWsRouter","isStrong":false},{"fullName":"AventusSharp.RAM.RamWebSocketListenOnStart","isStrong":false},{"fullName":"BindThis","isStrong":false},{"fullName":"Aventus.ExtractFromError","isStrong":false},{"fullName":"Aventus.UriParams","isStrong":false},{"fullName":"Aventus.ResultRamWithError","isStrong":false},{"fullName":"Aventus.RamItem","isStrong":false},{"fullName":"Map","isStrong":false},{"fullName":"Promise","isStrong":false},{"fullName":"Aventus.uuidv4","isStrong":false},{"fullName":"Aventus.VoidWithError","isStrong":false},{"fullName":"Aventus.KeysObject","isStrong":false},{"fullName":"Aventus.RamError","isStrong":false},{"fullName":"Aventus.RamErrorCode","isStrong":false}],"fullName":"AventusSharp.RAM.RamWebSocket","required":false,"type":1,"isExported":true,"convertibleName":""}],"existing":[{"fullName":"AventusSharp.WebSocket.WsRouterOptions","dependances":[]},{"fullName":"AventusSharp.RAM.RamWebSocketListenOnStart","dependances":[]},{"fullName":"AventusSharp.WebSocket.WsRouteSendOptions","dependances":[]},{"fullName":"AventusSharp.WebSocket.SocketMessage","dependances":[]},{"fullName":"AventusSharp.WebSocket.SocketSendMessageOptions","dependances":[]},{"fullName":"AventusSharp.WebSocket.SocketRoute","dependances":[{"fullName":"Aventus.UriParamsValue","isStrong":false}]},{"fullName":"AventusSharp.Data.IStorableTimestamp","dependances":[{"fullName":"Aventus.IData","isStrong":true},{"fullName":"Date","isStrong":false}]},{"fullName":"AventusSharp.Tools.IWithError","dependances":[{"fullName":"Aventus.GenericError","isStrong":false}]},{"fullName":"AventusSharp.Tools.IResultWithError","dependances":[{"fullName":"AventusSharp.Tools.IWithError","isStrong":true},{"fullName":"Aventus.GenericError","isStrong":false}]},{"fullName":"AventusSharp.RealDate","dependances":[{"fullName":"Date","isStrong":false}]},{"fullName":"AventusSharp.WebSocket.InternalSocketRoute","dependances":[{"fullName":"AventusSharp.WebSocket.SocketRoute","isStrong":false},{"fullName":"Aventus.PreparedUri","isStrong":false}]},{"fullName":"AventusSharp.WebSocket.ConnectionOptions","dependances":[{"fullName":"AventusSharp.WebSocket.InternalSocketRoute","isStrong":false}]},{"fullName":"AventusSharp.WebSocket.WsEndPointType","dependances":[{"fullName":"AventusSharp.WebSocket.EndPoint","isStrong":false}]},{"fullName":"AventusSharp.WebSocket.ExtractResultFrom","dependances":[{"fullName":"AventusSharp.WebSocket.WsEvent","isStrong":false},{"fullName":"T","isStrong":false},{"fullName":"U","isStrong":false}]},{"fullName":"AventusSharp.WebSocket.WsEventType","dependances":[{"fullName":"AventusSharp.WebSocket.WsEvent","isStrong":false}]},{"fullName":"AventusSharp.ExtractResponse","dependances":[{"fullName":"AventusSharp.WebSocket.WsEvent","isStrong":false},{"fullName":"U","isStrong":false},{"fullName":"T","isStrong":false},{"fullName":"Aventus.ResultWithError","isStrong":false},{"fullName":"Aventus.ExtractFromError","isStrong":false}]},{"fullName":"AventusSharp.WebSocket.RouterRoutes","dependances":[{"fullName":"AventusSharp.WebSocket.WsEvent","isStrong":false}]},{"fullName":"AventusSharp.WebSocket.WsRouterType","dependances":[{"fullName":"AventusSharp.WebSocket.Router","isStrong":false}]},{"fullName":"AventusSharp.WebSocket.StorableWsRouter__Routes","dependances":[{"fullName":"Aventus.IData","isStrong":false},{"fullName":"AventusSharp.WebSocket.StorableWsRouter_GetAll","isStrong":false},{"fullName":"T","isStrong":false},{"fullName":"AventusSharp.WebSocket.StorableWsRouter_Create","isStrong":false},{"fullName":"AventusSharp.WebSocket.StorableWsRoute_CreateMany","isStrong":false},{"fullName":"AventusSharp.WebSocket.StorableWsRouter_GetById","isStrong":false},{"fullName":"AventusSharp.WebSocket.StorableWsRouter_GetByIds","isStrong":false},{"fullName":"AventusSharp.WebSocket.StorableWsRouter_Update","isStrong":false},{"fullName":"AventusSharp.WebSocket.StorableWsRoute_UpdateMany","isStrong":false},{"fullName":"AventusSharp.WebSocket.StorableWsRouter_Delete","isStrong":false},{"fullName":"AventusSharp.WebSocket.StorableWsRoute_DeleteMany","isStrong":false}]}]}
791
791
  //#endregion js src //
792
792
  //#region css def //
793
793
  {}