@aventusjs/cli 0.0.9 → 0.0.10

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,785 +2,785 @@
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
  }