@aventusjs/cli 0.0.13 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Aventus@I18n.package.avt +61 -0
- package/lib/Aventus@Main.package.avt +2019 -1895
- package/lib/Aventus@Php.package.avt +455 -0
- package/lib/Aventus@Sharp.package.avt +679 -631
- package/lib/Aventus@UI.package.avt +1127 -412
- package/lib/emmet/aventus.json +7 -0
- package/lib/templateScript/AventusTemplate.d.ts +118 -0
- package/lib/templateScript/AventusTemplate.ts +420 -0
- package/out/705.RealServer.js +27 -0
- package/out/RealInteraction.js +1 -1
- package/out/RealServer.js +223 -261
- package/out/cli.js +1 -1
- package/package.json +1 -1
- package/lib/bin/CSharpToTypescript/AventusSharp.dll +0 -0
- package/lib/bin/CSharpToTypescript/AventusSharp.pdb +0 -0
- package/lib/bin/CSharpToTypescript/AventusSharp.xml +0 -2151
- package/lib/bin/CSharpToTypescript/BouncyCastle.Cryptography.dll +0 -0
- package/lib/bin/CSharpToTypescript/CSharpToTypescript.deps.json +0 -885
- package/lib/bin/CSharpToTypescript/CSharpToTypescript.dll +0 -0
- package/lib/bin/CSharpToTypescript/CSharpToTypescript.dll.config +0 -707
- package/lib/bin/CSharpToTypescript/CSharpToTypescript.exe +0 -0
- package/lib/bin/CSharpToTypescript/CSharpToTypescript.pdb +0 -0
- package/lib/bin/CSharpToTypescript/CSharpToTypescript.runtimeconfig.json +0 -19
- package/lib/bin/CSharpToTypescript/Google.Protobuf.dll +0 -0
- package/lib/bin/CSharpToTypescript/HttpMultipartParser.dll +0 -0
- package/lib/bin/CSharpToTypescript/Humanizer.dll +0 -0
- package/lib/bin/CSharpToTypescript/K4os.Compression.LZ4.Streams.dll +0 -0
- package/lib/bin/CSharpToTypescript/K4os.Compression.LZ4.dll +0 -0
- package/lib/bin/CSharpToTypescript/K4os.Hash.xxHash.dll +0 -0
- package/lib/bin/CSharpToTypescript/Microsoft.Bcl.AsyncInterfaces.dll +0 -0
- package/lib/bin/CSharpToTypescript/Microsoft.Build.Locator.dll +0 -0
- package/lib/bin/CSharpToTypescript/Microsoft.CodeAnalysis.CSharp.Workspaces.dll +0 -0
- package/lib/bin/CSharpToTypescript/Microsoft.CodeAnalysis.CSharp.dll +0 -0
- package/lib/bin/CSharpToTypescript/Microsoft.CodeAnalysis.Workspaces.MSBuild.dll +0 -0
- package/lib/bin/CSharpToTypescript/Microsoft.CodeAnalysis.Workspaces.dll +0 -0
- package/lib/bin/CSharpToTypescript/Microsoft.CodeAnalysis.dll +0 -0
- package/lib/bin/CSharpToTypescript/Microsoft.IO.RecyclableMemoryStream.dll +0 -0
- package/lib/bin/CSharpToTypescript/Microsoft.Win32.SystemEvents.dll +0 -0
- package/lib/bin/CSharpToTypescript/MySql.Data.dll +0 -0
- package/lib/bin/CSharpToTypescript/Newtonsoft.Json.dll +0 -0
- package/lib/bin/CSharpToTypescript/Scriban.dll +0 -0
- package/lib/bin/CSharpToTypescript/System.Collections.Immutable.dll +0 -0
- package/lib/bin/CSharpToTypescript/System.Composition.AttributedModel.dll +0 -0
- package/lib/bin/CSharpToTypescript/System.Composition.Convention.dll +0 -0
- package/lib/bin/CSharpToTypescript/System.Composition.Hosting.dll +0 -0
- package/lib/bin/CSharpToTypescript/System.Composition.Runtime.dll +0 -0
- package/lib/bin/CSharpToTypescript/System.Composition.TypedParts.dll +0 -0
- package/lib/bin/CSharpToTypescript/System.Configuration.ConfigurationManager.dll +0 -0
- package/lib/bin/CSharpToTypescript/System.Drawing.Common.dll +0 -0
- package/lib/bin/CSharpToTypescript/System.IO.Pipelines.dll +0 -0
- package/lib/bin/CSharpToTypescript/System.Reflection.Metadata.dll +0 -0
- package/lib/bin/CSharpToTypescript/System.Security.Cryptography.ProtectedData.dll +0 -0
- package/lib/bin/CSharpToTypescript/System.Security.Permissions.dll +0 -0
- package/lib/bin/CSharpToTypescript/System.Text.Encoding.CodePages.dll +0 -0
- package/lib/bin/CSharpToTypescript/System.Text.Encodings.Web.dll +0 -0
- package/lib/bin/CSharpToTypescript/System.Text.Json.dll +0 -0
- package/lib/bin/CSharpToTypescript/System.Threading.Channels.dll +0 -0
- package/lib/bin/CSharpToTypescript/System.Windows.Extensions.dll +0 -0
- package/lib/bin/CSharpToTypescript/ZstdSharp.dll +0 -0
- package/lib/bin/CSharpToTypescript/package.json +0 -6
- package/lib/bin/CSharpToTypescript/runtimes/browser/lib/net6.0/System.Text.Encodings.Web.dll +0 -0
- package/lib/bin/CSharpToTypescript/runtimes/win/lib/net6.0/Microsoft.Win32.SystemEvents.dll +0 -0
- package/lib/bin/CSharpToTypescript/runtimes/win/lib/net6.0/System.Drawing.Common.dll +0 -0
- package/lib/bin/CSharpToTypescript/runtimes/win/lib/net6.0/System.Security.Cryptography.ProtectedData.dll +0 -0
- package/lib/bin/CSharpToTypescript/runtimes/win/lib/net6.0/System.Text.Encoding.CodePages.dll +0 -0
- package/lib/bin/CSharpToTypescript/runtimes/win/lib/net6.0/System.Windows.Extensions.dll +0 -0
- package/lib/bin/CSharpToTypescript/runtimes/win/lib/net7.0/System.Security.Cryptography.ProtectedData.dll +0 -0
- package/lib/bin/CSharpToTypescript/runtimes/win/lib/net7.0/System.Windows.Extensions.dll +0 -0
- package/lib/bin/CSharpToTypescript/runtimes/win/lib/net8.0/Microsoft.Win32.SystemEvents.dll +0 -0
- package/lib/bin/CSharpToTypescript/runtimes/win-x64/native/comerr64.dll +0 -0
- package/lib/bin/CSharpToTypescript/runtimes/win-x64/native/gssapi64.dll +0 -0
- package/lib/bin/CSharpToTypescript/runtimes/win-x64/native/k5sprt64.dll +0 -0
- package/lib/bin/CSharpToTypescript/runtimes/win-x64/native/krb5_64.dll +0 -0
- package/lib/bin/CSharpToTypescript/runtimes/win-x64/native/krbcc64.dll +0 -0
|
@@ -1,793 +1,841 @@
|
|
|
1
|
-
// AventusSharp@Main:1.0.
|
|
1
|
+
// AventusSharp@Main:1.0.7
|
|
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
|
-
namespace Data {
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
type RealDate = Date;
|
|
231
|
+
namespace Data.CustomTableMembers {
|
|
232
|
+
abstract class AventusFile<T> {
|
|
233
|
+
Uri: string;
|
|
234
|
+
Upload?: File;
|
|
235
|
+
/**
|
|
236
|
+
* Get the unique type for the data. Define it as the namespace + class name
|
|
237
|
+
*/
|
|
238
|
+
get $type(): string;
|
|
239
|
+
/**
|
|
240
|
+
* @inerhit
|
|
241
|
+
*/
|
|
242
|
+
toJSON(): any;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
type RealDate = Date;
|
|
249
247
|
|
|
250
248
|
namespace Data {
|
|
251
249
|
@Convertible()
|
|
252
|
-
class Datetime extends Data.SharpClass {
|
|
253
|
-
static get Fullname(): string;
|
|
254
|
-
DateTime: RealDate;
|
|
255
|
-
}
|
|
250
|
+
class Datetime extends Data.SharpClass {
|
|
251
|
+
static get Fullname(): string;
|
|
252
|
+
DateTime: RealDate;
|
|
253
|
+
}
|
|
256
254
|
}
|
|
257
255
|
|
|
258
256
|
namespace Data {
|
|
259
257
|
@Convertible()
|
|
260
|
-
class Date extends Data.SharpClass {
|
|
261
|
-
static get Fullname(): string;
|
|
262
|
-
DateTime: RealDate;
|
|
263
|
-
}
|
|
258
|
+
class Date extends Data.SharpClass {
|
|
259
|
+
static get Fullname(): string;
|
|
260
|
+
DateTime: RealDate;
|
|
261
|
+
}
|
|
264
262
|
}
|
|
265
263
|
|
|
266
264
|
namespace Data {
|
|
267
265
|
@Convertible()
|
|
268
|
-
class DataError extends Aventus.GenericError<typeof Data.DataErrorCode> {
|
|
269
|
-
static get Fullname(): string;
|
|
270
|
-
}
|
|
266
|
+
class DataError extends Aventus.GenericError<typeof Data.DataErrorCode> {
|
|
267
|
+
static get Fullname(): string;
|
|
268
|
+
}
|
|
271
269
|
}
|
|
272
270
|
|
|
273
271
|
namespace Tools {
|
|
274
272
|
@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
|
-
}
|
|
273
|
+
class VoidWithError<T extends Aventus.GenericError = Aventus.GenericError> extends Aventus.VoidWithError<T> implements Tools.IWithError<T>, Tools.IWithError<T> {
|
|
274
|
+
static get Fullname(): string;
|
|
275
|
+
}
|
|
278
276
|
}
|
|
279
277
|
|
|
280
278
|
namespace Data {
|
|
281
279
|
@Convertible()
|
|
282
|
-
class VoidWithDataError extends Tools.VoidWithError<Data.DataError> {
|
|
283
|
-
static get Fullname(): string;
|
|
284
|
-
}
|
|
280
|
+
class VoidWithDataError extends Tools.VoidWithError<Data.DataError> {
|
|
281
|
+
static get Fullname(): string;
|
|
282
|
+
}
|
|
285
283
|
}
|
|
286
284
|
|
|
287
285
|
namespace Tools {
|
|
288
286
|
@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
|
-
}
|
|
287
|
+
class ResultWithError<T, U extends Aventus.GenericError = Aventus.GenericError> extends Aventus.ResultWithError<T, U> implements Tools.IResultWithError<U>, Tools.IResultWithError<U> {
|
|
288
|
+
static get Fullname(): string;
|
|
289
|
+
}
|
|
292
290
|
}
|
|
293
291
|
|
|
294
292
|
namespace Routes {
|
|
295
|
-
abstract class StorableRouter<T extends Aventus.IData> extends Aventus.HttpRoute {
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
293
|
+
abstract class StorableRouter<T extends Aventus.IData> extends Aventus.HttpRoute {
|
|
294
|
+
|
|
295
|
+
@BindThis()
|
|
296
|
+
GetAll(): Promise<Tools.ResultWithError<T[]>>;
|
|
297
|
+
@BindThis()
|
|
298
|
+
Create(body: {
|
|
299
|
+
item: T;
|
|
300
|
+
} | FormData): Promise<Tools.ResultWithError<T>>;
|
|
301
|
+
@BindThis()
|
|
302
|
+
CreateMany(body: {
|
|
303
|
+
list: T[];
|
|
304
|
+
} | FormData): Promise<Tools.ResultWithError<T[]>>;
|
|
305
|
+
@BindThis()
|
|
306
|
+
GetById(id: number): Promise<Tools.ResultWithError<T>>;
|
|
307
|
+
@BindThis()
|
|
308
|
+
GetByIds(body: {
|
|
309
|
+
ids: number[];
|
|
310
|
+
} | FormData): Promise<Tools.ResultWithError<T[]>>;
|
|
311
|
+
@BindThis()
|
|
312
|
+
Update(id: number, body: {
|
|
313
|
+
item: T;
|
|
314
|
+
} | FormData): Promise<Tools.ResultWithError<T>>;
|
|
315
|
+
@BindThis()
|
|
316
|
+
UpdateMany(body: {
|
|
317
|
+
list: T[];
|
|
318
|
+
} | FormData): Promise<Tools.ResultWithError<T[]>>;
|
|
319
|
+
@BindThis()
|
|
320
|
+
Delete(id: number): Promise<Tools.ResultWithError<T>>;
|
|
321
|
+
@BindThis()
|
|
322
|
+
DeleteMany(body: {
|
|
323
|
+
ids: number[];
|
|
324
|
+
} | FormData): Promise<Tools.ResultWithError<T[]>>;
|
|
325
|
+
abstract StorableName(): string;
|
|
326
|
+
}
|
|
320
327
|
}
|
|
321
328
|
|
|
322
329
|
namespace Data {
|
|
323
330
|
@Convertible()
|
|
324
|
-
class ResultWithDataError<T> extends Tools.ResultWithError<T, Data.DataError> {
|
|
325
|
-
static get Fullname(): string;
|
|
326
|
-
}
|
|
331
|
+
class ResultWithDataError<T> extends Tools.ResultWithError<T, Data.DataError> {
|
|
332
|
+
static get Fullname(): string;
|
|
333
|
+
}
|
|
327
334
|
}
|
|
328
335
|
|
|
329
336
|
namespace Routes {
|
|
330
337
|
@Convertible()
|
|
331
|
-
class RouteError extends Aventus.GenericError<typeof Routes.RouteErrorCode> {
|
|
332
|
-
static get Fullname(): string;
|
|
333
|
-
}
|
|
338
|
+
class RouteError extends Aventus.GenericError<typeof Routes.RouteErrorCode> {
|
|
339
|
+
static get Fullname(): string;
|
|
340
|
+
}
|
|
334
341
|
}
|
|
335
342
|
|
|
336
343
|
namespace Routes {
|
|
337
344
|
@Convertible()
|
|
338
|
-
class ResultWithRouteError<T> extends Tools.ResultWithError<T, Routes.RouteError> {
|
|
339
|
-
static get Fullname(): string;
|
|
340
|
-
}
|
|
345
|
+
class ResultWithRouteError<T> extends Tools.ResultWithError<T, Routes.RouteError> {
|
|
346
|
+
static get Fullname(): string;
|
|
347
|
+
}
|
|
341
348
|
}
|
|
342
349
|
|
|
343
350
|
namespace Routes {
|
|
344
351
|
@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
|
-
}
|
|
352
|
+
class VoidWithRouteError extends Tools.VoidWithError<Routes.RouteError> {
|
|
353
|
+
static get Fullname(): string;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
namespace WebSocket {
|
|
358
|
+
type InternalSocketRoute = WebSocket.SocketRoute & Aventus.PreparedUri;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
namespace WebSocket {
|
|
362
|
+
interface ConnectionOptions {
|
|
363
|
+
log?: boolean;
|
|
364
|
+
logPrefix?: string;
|
|
365
|
+
host?: string;
|
|
366
|
+
port?: number;
|
|
367
|
+
useHttps?: boolean;
|
|
368
|
+
routes?: {
|
|
369
|
+
[key: string]: WebSocket.InternalSocketRoute[];
|
|
370
|
+
};
|
|
371
|
+
/**
|
|
372
|
+
* Define the name for the websocket
|
|
373
|
+
* It ll open the ws connection on /ws/${socketName}
|
|
374
|
+
*/
|
|
375
|
+
socketName?: string;
|
|
376
|
+
/**
|
|
377
|
+
* Define if the message must be buffered before the socket open.
|
|
378
|
+
* If true, when the socket is opened, all messages in buffered will be sent
|
|
379
|
+
*/
|
|
380
|
+
allowSendBeforeOpen?: boolean;
|
|
381
|
+
/**
|
|
382
|
+
* Define the websocket connection must be open during creation
|
|
383
|
+
*/
|
|
384
|
+
autoStart?: boolean;
|
|
385
|
+
/**
|
|
386
|
+
* Define if a /ping msg must be sent
|
|
387
|
+
*/
|
|
388
|
+
sendPing?: number;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
namespace WebSocket {
|
|
393
|
+
class SocketError extends Aventus.GenericError<WebSocket.SocketErrorCode> {
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
namespace WebSocket {
|
|
398
|
+
abstract class Connection {
|
|
399
|
+
static Debug: boolean;
|
|
400
|
+
protected options: Required<WebSocket.ConnectionOptions>;
|
|
401
|
+
protected waitingList: {
|
|
402
|
+
[uuid: string]: (channel: string, data: any) => void;
|
|
403
|
+
};
|
|
404
|
+
protected memoryBeforeOpen: WebSocket.SocketSendMessageOptions[];
|
|
405
|
+
protected socket?: WebSocket.Socket;
|
|
406
|
+
protected actionGuard: Aventus.ActionGuard;
|
|
407
|
+
/**
|
|
408
|
+
* Create a singleton
|
|
409
|
+
*/
|
|
410
|
+
static getInstance(): WebSocket.Connection;
|
|
411
|
+
protected constructor();
|
|
412
|
+
readonly onOpen: Aventus.Callback<() => void>;
|
|
413
|
+
readonly onClose: Aventus.Callback<(event: Event) => void>;
|
|
414
|
+
readonly onError: Aventus.Callback<(event: Event) => void>;
|
|
415
|
+
/**
|
|
416
|
+
* Define the configuration for your websocket
|
|
417
|
+
*/
|
|
418
|
+
protected abstract configure(options: WebSocket.ConnectionOptions): WebSocket.ConnectionOptions;
|
|
419
|
+
/**
|
|
420
|
+
* Configure a new Websocket
|
|
421
|
+
*/
|
|
422
|
+
protected _configure(options?: WebSocket.ConnectionOptions): Required<WebSocket.ConnectionOptions>;
|
|
423
|
+
private getUrl;
|
|
424
|
+
/**
|
|
425
|
+
* Add a new route to listen to the websocket
|
|
426
|
+
*/
|
|
427
|
+
addRoute(newRoute: WebSocket.SocketRoute): void;
|
|
428
|
+
/**
|
|
429
|
+
* The route to remove
|
|
430
|
+
* @param route - The route to remove
|
|
431
|
+
*/
|
|
432
|
+
removeRoute(route: WebSocket.SocketRoute): void;
|
|
433
|
+
protected openCallback: ((isOpen: boolean) => void) | undefined;
|
|
434
|
+
/**
|
|
435
|
+
* Try to open the websocket
|
|
436
|
+
*/
|
|
437
|
+
open(): Promise<boolean>;
|
|
438
|
+
protected jsonReplacer(key: string, value: any): any;
|
|
439
|
+
/**
|
|
440
|
+
* Send a message though the websocket
|
|
441
|
+
* @param channelName The channel on which the message is sent
|
|
442
|
+
* @param data The data to send
|
|
443
|
+
* @param options the options to add to the message (typically the uid)
|
|
444
|
+
*/
|
|
445
|
+
sendMessage<T>(options: WebSocket.SocketSendMessageOptions): Promise<Aventus.VoidWithError>;
|
|
446
|
+
/**
|
|
447
|
+
* Send a message though the websocket and wait one answer give in parameters callbacks
|
|
448
|
+
* @param channelName The channel on which the message is sent
|
|
449
|
+
* @param body The data to send
|
|
450
|
+
* @param timeout The timeout before the request failed
|
|
451
|
+
*/
|
|
452
|
+
sendMessageAndWait<T>(options: WebSocket.SocketSendMessageOptions): Promise<Aventus.ResultWithError<Aventus.ExtractFromError<T>>>;
|
|
453
|
+
/**
|
|
454
|
+
* Check if socket is ready
|
|
455
|
+
*/
|
|
456
|
+
isReady(): boolean;
|
|
457
|
+
protected sendPingTimeout: number;
|
|
458
|
+
protected sendPing(): void;
|
|
459
|
+
protected startPing(): void;
|
|
460
|
+
protected stopPing(): void;
|
|
461
|
+
protected _onOpen(): void;
|
|
462
|
+
protected errorOccur: boolean;
|
|
463
|
+
protected _onError(event: Event): void;
|
|
464
|
+
protected _onClose(event: Event): void;
|
|
465
|
+
/**
|
|
466
|
+
* Close the current connection
|
|
467
|
+
*/
|
|
468
|
+
close(): void;
|
|
469
|
+
protected onMessage(event: MessageEvent<any>): void;
|
|
470
|
+
/**
|
|
471
|
+
* Print a msg inside the console
|
|
472
|
+
*/
|
|
473
|
+
protected log(message: {} | string): void;
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
namespace WebSocket {
|
|
478
|
+
class EndPoint extends WebSocket.Connection {
|
|
479
|
+
/**
|
|
480
|
+
* Create a singleton
|
|
481
|
+
*/
|
|
482
|
+
static getInstance(): WebSocket.EndPoint;
|
|
483
|
+
protected constructor();
|
|
484
|
+
protected register(): void;
|
|
485
|
+
/**
|
|
486
|
+
* @inheritdoc
|
|
487
|
+
*/
|
|
488
|
+
protected configure(options: WebSocket.ConnectionOptions): WebSocket.ConnectionOptions;
|
|
489
|
+
protected get path(): string;
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
namespace WebSocket {
|
|
494
|
+
type WsEndPointType = (abstract new (...args: any[]) => WebSocket.EndPoint);
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
namespace WebSocket {
|
|
498
|
+
abstract class WsEvent<T extends any = any> {
|
|
499
|
+
protected endpoint: WebSocket.EndPoint;
|
|
500
|
+
onTrigger: Aventus.Callback<(item: Aventus.ExtractFromError<T>, params: Aventus.UriParamsValue, uid?: string) => void>;
|
|
501
|
+
protected routeInfo: WebSocket.SocketRoute<Aventus.ExtractFromError<T>>;
|
|
502
|
+
protected _listening: boolean;
|
|
503
|
+
get listening(): boolean;
|
|
504
|
+
getPrefix: () => string;
|
|
505
|
+
constructor(endpoint?: WebSocket.EndPoint, getPrefix?: () => string);
|
|
506
|
+
init(): void;
|
|
507
|
+
/**
|
|
508
|
+
* Define the websocket path
|
|
509
|
+
*/
|
|
510
|
+
protected abstract path(): string;
|
|
511
|
+
/**
|
|
512
|
+
* Override this method to tell that the event must listen when created
|
|
513
|
+
*/
|
|
514
|
+
protected listenOnBoot(): boolean;
|
|
515
|
+
/**
|
|
516
|
+
* Add the event to the endpoint. After that, the on trigger event can be triggered
|
|
517
|
+
*/
|
|
518
|
+
listen(): void;
|
|
519
|
+
/**
|
|
520
|
+
* Remove the event from the endpoint. After that, the on trigger event won't be triggered
|
|
521
|
+
*/
|
|
522
|
+
stop(): void;
|
|
523
|
+
protected onEvent(data: Aventus.ExtractFromError<T>, params: Aventus.UriParamsValue, uid?: string): void;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
namespace WebSocket {
|
|
528
|
+
type ExtractResultFrom<T extends WebSocket.WsEvent, U = any> = T extends WebSocket.WsEvent<infer U> ? U : never;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
namespace WebSocket {
|
|
532
|
+
type WsEventType = abstract new (...args: any[]) => WebSocket.WsEvent;
|
|
550
533
|
}
|
|
551
534
|
|
|
535
|
+
type ExtractResponse<T extends WebSocket.WsEvent<U>, U = any> = T extends WebSocket.WsEvent<infer U> ? Aventus.ResultWithError<Aventus.ExtractFromError<U>> : never;
|
|
536
|
+
|
|
552
537
|
namespace WebSocket {
|
|
553
|
-
class
|
|
554
|
-
/**
|
|
555
|
-
* @inheritdoc
|
|
556
|
-
*/
|
|
557
|
-
protected path(): string;
|
|
558
|
-
StorableName: () => string;
|
|
559
|
-
constructor(endpoint: WebSocket.EndPoint, getPrefix?: () => string, StorableName?: () => string);
|
|
560
|
-
}
|
|
538
|
+
class StorableWsRoute_DeleteMany<T extends Aventus.IData> extends WebSocket.WsEvent<Tools.ResultWithError<T[]>> {
|
|
539
|
+
/**
|
|
540
|
+
* @inheritdoc
|
|
541
|
+
*/
|
|
542
|
+
protected path(): string;
|
|
543
|
+
StorableName: () => string;
|
|
544
|
+
constructor(endpoint: WebSocket.EndPoint, getPrefix?: () => string, StorableName?: () => string);
|
|
545
|
+
}
|
|
561
546
|
}
|
|
562
547
|
|
|
563
548
|
namespace WebSocket {
|
|
564
|
-
class
|
|
565
|
-
StorableName: () => string;
|
|
566
|
-
constructor(endpoint: WebSocket.EndPoint, getPrefix: () => string, StorableName: () => string);
|
|
567
|
-
/**
|
|
568
|
-
* @inheritdoc
|
|
569
|
-
*/
|
|
570
|
-
protected path(): string;
|
|
571
|
-
}
|
|
549
|
+
class StorableWsRouter_Delete<T> extends WebSocket.WsEvent<T> {
|
|
550
|
+
StorableName: () => string;
|
|
551
|
+
constructor(endpoint: WebSocket.EndPoint, getPrefix: () => string, StorableName: () => string);
|
|
552
|
+
/**
|
|
553
|
+
* @inheritdoc
|
|
554
|
+
*/
|
|
555
|
+
protected path(): string;
|
|
556
|
+
}
|
|
572
557
|
}
|
|
573
558
|
|
|
574
559
|
namespace WebSocket {
|
|
575
|
-
class
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
}
|
|
560
|
+
class StorableWsRoute_UpdateMany<T extends Aventus.IData> extends WebSocket.WsEvent<Tools.ResultWithError<T[]>> {
|
|
561
|
+
/**
|
|
562
|
+
* @inheritdoc
|
|
563
|
+
*/
|
|
564
|
+
protected path(): string;
|
|
565
|
+
StorableName: () => string;
|
|
566
|
+
constructor(endpoint: WebSocket.EndPoint, getPrefix?: () => string, StorableName?: () => string);
|
|
567
|
+
}
|
|
583
568
|
}
|
|
584
569
|
|
|
585
570
|
namespace WebSocket {
|
|
586
|
-
class
|
|
587
|
-
StorableName: () => string;
|
|
588
|
-
constructor(endpoint: WebSocket.EndPoint, getPrefix: () => string, StorableName: () => string);
|
|
589
|
-
/**
|
|
590
|
-
* @inheritdoc
|
|
591
|
-
*/
|
|
592
|
-
protected path(): string;
|
|
593
|
-
}
|
|
571
|
+
class StorableWsRouter_Update<T> extends WebSocket.WsEvent<T> {
|
|
572
|
+
StorableName: () => string;
|
|
573
|
+
constructor(endpoint: WebSocket.EndPoint, getPrefix: () => string, StorableName: () => string);
|
|
574
|
+
/**
|
|
575
|
+
* @inheritdoc
|
|
576
|
+
*/
|
|
577
|
+
protected path(): string;
|
|
578
|
+
}
|
|
594
579
|
}
|
|
595
580
|
|
|
596
581
|
namespace WebSocket {
|
|
597
|
-
class
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
}
|
|
582
|
+
class StorableWsRouter_GetByIds<T> extends WebSocket.WsEvent<T[]> {
|
|
583
|
+
StorableName: () => string;
|
|
584
|
+
constructor(endpoint: WebSocket.EndPoint, getPrefix: () => string, StorableName: () => string);
|
|
585
|
+
/**
|
|
586
|
+
* @inheritdoc
|
|
587
|
+
*/
|
|
588
|
+
protected path(): string;
|
|
589
|
+
}
|
|
605
590
|
}
|
|
606
591
|
|
|
607
592
|
namespace WebSocket {
|
|
608
|
-
class
|
|
609
|
-
StorableName: () => string;
|
|
610
|
-
constructor(endpoint: WebSocket.EndPoint, getPrefix: () => string, StorableName: () => string);
|
|
611
|
-
/**
|
|
612
|
-
* @inheritdoc
|
|
613
|
-
*/
|
|
614
|
-
protected path(): string;
|
|
615
|
-
}
|
|
593
|
+
class StorableWsRouter_GetById<T> extends WebSocket.WsEvent<T> {
|
|
594
|
+
StorableName: () => string;
|
|
595
|
+
constructor(endpoint: WebSocket.EndPoint, getPrefix: () => string, StorableName: () => string);
|
|
596
|
+
/**
|
|
597
|
+
* @inheritdoc
|
|
598
|
+
*/
|
|
599
|
+
protected path(): string;
|
|
600
|
+
}
|
|
616
601
|
}
|
|
617
602
|
|
|
618
603
|
namespace WebSocket {
|
|
619
|
-
class
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
}
|
|
604
|
+
class StorableWsRoute_CreateMany<T extends Aventus.IData> extends WebSocket.WsEvent<Tools.ResultWithError<T[]>> {
|
|
605
|
+
/**
|
|
606
|
+
* @inheritdoc
|
|
607
|
+
*/
|
|
608
|
+
protected path(): string;
|
|
609
|
+
StorableName: () => string;
|
|
610
|
+
constructor(endpoint: WebSocket.EndPoint, getPrefix?: () => string, StorableName?: () => string);
|
|
611
|
+
}
|
|
627
612
|
}
|
|
628
613
|
|
|
629
614
|
namespace WebSocket {
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
615
|
+
class StorableWsRouter_Create<T> extends WebSocket.WsEvent<T> {
|
|
616
|
+
StorableName: () => string;
|
|
617
|
+
constructor(endpoint: WebSocket.EndPoint, getPrefix: () => string, StorableName: () => string);
|
|
618
|
+
/**
|
|
619
|
+
* @inheritdoc
|
|
620
|
+
*/
|
|
621
|
+
protected path(): string;
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
namespace WebSocket {
|
|
626
|
+
class StorableWsRouter_GetAll<T> extends WebSocket.WsEvent<T[]> {
|
|
627
|
+
StorableName: () => string;
|
|
628
|
+
constructor(endpoint: WebSocket.EndPoint, getPrefix: () => string, StorableName: () => string);
|
|
629
|
+
/**
|
|
630
|
+
* @inheritdoc
|
|
631
|
+
*/
|
|
632
|
+
protected path(): string;
|
|
633
|
+
}
|
|
633
634
|
}
|
|
634
635
|
|
|
635
636
|
namespace WebSocket {
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
637
|
+
type RouterRoutes = {
|
|
638
|
+
[name: string]: WebSocket.WsEvent;
|
|
639
|
+
};
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
namespace WebSocket {
|
|
643
|
+
class Router<T extends WebSocket.RouterRoutes> {
|
|
644
|
+
readonly endpoint: WebSocket.EndPoint;
|
|
645
|
+
events: T;
|
|
646
|
+
constructor(endpoint?: WebSocket.EndPoint);
|
|
647
|
+
getPrefix(): string;
|
|
648
|
+
protected defineEvents(): Partial<T>;
|
|
649
|
+
}
|
|
643
650
|
}
|
|
644
651
|
|
|
645
652
|
namespace WebSocket {
|
|
646
|
-
type WsRouterType = abstract new (...args: any[]) => WebSocket.Router<any>;
|
|
653
|
+
type WsRouterType = abstract new (...args: any[]) => WebSocket.Router<any>;
|
|
647
654
|
}
|
|
648
655
|
|
|
649
656
|
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
|
-
};
|
|
657
|
+
type StorableWsRouter__Routes<T extends Aventus.IData> = {
|
|
658
|
+
GetAll: WebSocket.StorableWsRouter_GetAll<T>;
|
|
659
|
+
Create: WebSocket.StorableWsRouter_Create<T>;
|
|
660
|
+
CreateMany: WebSocket.StorableWsRoute_CreateMany<T>;
|
|
661
|
+
GetById: WebSocket.StorableWsRouter_GetById<T>;
|
|
662
|
+
GetByIds: WebSocket.StorableWsRouter_GetByIds<T>;
|
|
663
|
+
Update: WebSocket.StorableWsRouter_Update<T>;
|
|
664
|
+
UpdateMany: WebSocket.StorableWsRoute_UpdateMany<T>;
|
|
665
|
+
Delete: WebSocket.StorableWsRouter_Delete<T>;
|
|
666
|
+
DeleteMany: WebSocket.StorableWsRoute_DeleteMany<T>;
|
|
667
|
+
};
|
|
661
668
|
}
|
|
662
669
|
|
|
663
670
|
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
|
-
}
|
|
671
|
+
abstract class StorableWsRouter<T extends Aventus.IData, __Route extends WebSocket.StorableWsRouter__Routes<T> = WebSocket.StorableWsRouter__Routes<T>> extends WebSocket.Router<__Route> {
|
|
672
|
+
protected defineEvents(): Partial<__Route>;
|
|
673
|
+
GetAll(options?: WebSocket.WsRouteSendOptions): Promise<ExtractResponse<WebSocket.StorableWsRouter_GetAll<T>>>;
|
|
674
|
+
Create(body: {
|
|
675
|
+
item: T;
|
|
676
|
+
} | FormData, options?: WebSocket.WsRouteSendOptions): Promise<ExtractResponse<WebSocket.StorableWsRouter_Create<T>>>;
|
|
677
|
+
CreateMany(body: {
|
|
678
|
+
list: T[];
|
|
679
|
+
} | FormData, options?: WebSocket.WsRouteSendOptions): Promise<ExtractResponse<WebSocket.StorableWsRoute_CreateMany<T>>>;
|
|
680
|
+
GetById(id: number, options?: WebSocket.WsRouteSendOptions): Promise<ExtractResponse<WebSocket.StorableWsRouter_GetById<T>>>;
|
|
681
|
+
GetByIds(body: {
|
|
682
|
+
ids: number[];
|
|
683
|
+
} | FormData, options?: WebSocket.WsRouteSendOptions): Promise<ExtractResponse<WebSocket.StorableWsRouter_GetByIds<T>>>;
|
|
684
|
+
Update(id: number, body: {
|
|
685
|
+
item: T;
|
|
686
|
+
} | FormData, options?: WebSocket.WsRouteSendOptions): Promise<ExtractResponse<WebSocket.StorableWsRouter_Update<T>>>;
|
|
687
|
+
UpdateMany(body: {
|
|
688
|
+
list: T[];
|
|
689
|
+
} | FormData, options?: WebSocket.WsRouteSendOptions): Promise<ExtractResponse<WebSocket.StorableWsRoute_UpdateMany<T>>>;
|
|
690
|
+
Delete(id: number, options?: WebSocket.WsRouteSendOptions): Promise<ExtractResponse<WebSocket.StorableWsRouter_Delete<T>>>;
|
|
691
|
+
DeleteMany(body: {
|
|
692
|
+
ids: number[];
|
|
693
|
+
} | FormData, options?: WebSocket.WsRouteSendOptions): Promise<ExtractResponse<WebSocket.StorableWsRoute_DeleteMany<T>>>;
|
|
694
|
+
abstract StorableName(): string;
|
|
695
|
+
}
|
|
689
696
|
}
|
|
690
697
|
|
|
691
698
|
namespace WebSocket {
|
|
692
699
|
@Convertible()
|
|
693
|
-
class WsError extends Aventus.GenericError<typeof WebSocket.WsErrorCode> {
|
|
694
|
-
static get Fullname(): string;
|
|
695
|
-
}
|
|
700
|
+
class WsError extends Aventus.GenericError<typeof WebSocket.WsErrorCode> {
|
|
701
|
+
static get Fullname(): string;
|
|
702
|
+
}
|
|
696
703
|
}
|
|
697
704
|
|
|
698
705
|
namespace WebSocket {
|
|
699
706
|
@Convertible()
|
|
700
|
-
class ResultWithWsError<T> extends Tools.ResultWithError<T, WebSocket.WsError> {
|
|
701
|
-
static get Fullname(): string;
|
|
702
|
-
}
|
|
707
|
+
class ResultWithWsError<T> extends Tools.ResultWithError<T, WebSocket.WsError> {
|
|
708
|
+
static get Fullname(): string;
|
|
709
|
+
}
|
|
703
710
|
}
|
|
704
711
|
|
|
705
712
|
namespace WebSocket {
|
|
706
713
|
@Convertible()
|
|
707
|
-
class VoidWithWsError extends Tools.VoidWithError<WebSocket.WsError> {
|
|
708
|
-
static get Fullname(): string;
|
|
709
|
-
}
|
|
714
|
+
class VoidWithWsError extends Tools.VoidWithError<WebSocket.WsError> {
|
|
715
|
+
static get Fullname(): string;
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
namespace RAM {
|
|
720
|
+
class RamCompletor<T extends Data.Storable> {
|
|
721
|
+
protected objects: T[];
|
|
722
|
+
protected fields: ___AventusSharp.RAM.ItemField<T, any>[];
|
|
723
|
+
protected error?: Aventus.VoidWithError;
|
|
724
|
+
constructor(objects?: T | T[], error?: Aventus.VoidWithError);
|
|
725
|
+
add<U extends Aventus.IData>(field: ___AventusSharp.RAM.ItemField<T, U>): RAM.RamCompletor<T>;
|
|
726
|
+
run(): Promise<Aventus.VoidWithError>;
|
|
727
|
+
}
|
|
710
728
|
}
|
|
711
729
|
|
|
712
730
|
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
|
-
|
|
722
|
-
protected
|
|
723
|
-
protected
|
|
724
|
-
protected
|
|
725
|
-
protected
|
|
726
|
-
protected
|
|
727
|
-
|
|
731
|
+
abstract class RamHttp<T extends Data.Storable> extends Aventus.Ram<T> {
|
|
732
|
+
protected getAllDone: boolean;
|
|
733
|
+
protected routes: Routes.StorableRouter<T>;
|
|
734
|
+
abstract defineRoutes(): Routes.StorableRouter<T>;
|
|
735
|
+
protected constructor();
|
|
736
|
+
protected beforeGetAll(result: Aventus.ResultRamWithError<Map<number, Aventus.RamItem<T>>>): Promise<void>;
|
|
737
|
+
protected beforeGetById(id: number, result: Aventus.ResultRamWithError<Aventus.RamItem<T>>): Promise<void>;
|
|
738
|
+
protected beforeGetByIds(ids: number[], result: Aventus.ResultRamWithError<Aventus.RamItem<T>[]>): Promise<void>;
|
|
739
|
+
complete(objects?: T | T[], error?: Aventus.VoidWithError): RAM.RamCompletor<T>;
|
|
740
|
+
protected beforeCreateItem(item: T, fromList: boolean, result: Aventus.ResultRamWithError<Aventus.RamItem<T>>): Promise<void>;
|
|
741
|
+
protected beforeCreateList(list: T[], result: Aventus.ResultRamWithError<Aventus.RamItem<T>[]>): Promise<void>;
|
|
742
|
+
protected beforeUpdateItem(item: T, fromList: boolean, result: Aventus.ResultRamWithError<Aventus.RamItem<T>>): Promise<void>;
|
|
743
|
+
protected beforeUpdateList(list: T[], result: Aventus.ResultRamWithError<Aventus.RamItem<T>[]>): Promise<void>;
|
|
744
|
+
protected beforeDeleteItem(item: T, fromList: boolean, result: Aventus.VoidWithError): Promise<void>;
|
|
745
|
+
protected beforeDeleteList(list: T[], result: Aventus.VoidWithError): Promise<void>;
|
|
746
|
+
}
|
|
728
747
|
}
|
|
729
748
|
|
|
730
749
|
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
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
protected
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
protected
|
|
769
|
-
protected
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
protected
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
protected
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
protected
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
750
|
+
abstract class RamWebSocket<T extends Data.Storable> extends Aventus.Ram<T> {
|
|
751
|
+
protected getAllDone: boolean;
|
|
752
|
+
private routes;
|
|
753
|
+
protected otherGetAllLocked: {
|
|
754
|
+
[uid: string]: true;
|
|
755
|
+
};
|
|
756
|
+
protected otherGetByIdLocked: {
|
|
757
|
+
[uid: string]: true;
|
|
758
|
+
};
|
|
759
|
+
protected otherCreateItemLocked: {
|
|
760
|
+
[uid: string]: true;
|
|
761
|
+
};
|
|
762
|
+
protected otherCreateListLocked: {
|
|
763
|
+
[uid: string]: true;
|
|
764
|
+
};
|
|
765
|
+
protected otherUpdateItemLocked: {
|
|
766
|
+
[uid: string]: true;
|
|
767
|
+
};
|
|
768
|
+
protected otherUpdateListLocked: {
|
|
769
|
+
[uid: string]: true;
|
|
770
|
+
};
|
|
771
|
+
protected otherDeleteItemLocked: {
|
|
772
|
+
[uid: string]: true;
|
|
773
|
+
};
|
|
774
|
+
protected otherDeleteListLocked: {
|
|
775
|
+
[uid: string]: true;
|
|
776
|
+
};
|
|
777
|
+
abstract defineRoutes(): WebSocket.StorableWsRouter<T>;
|
|
778
|
+
protected constructor();
|
|
779
|
+
protected addEventsBindings(): void;
|
|
780
|
+
protected listenOnStart(): RAM.RamWebSocketListenOnStart;
|
|
781
|
+
complete(objects?: T | T[], error?: Aventus.VoidWithError): RAM.RamCompletor<T>;
|
|
782
|
+
@BindThis()
|
|
783
|
+
protected otherGetAll(items: Aventus.ExtractFromError<T[]>, params: Aventus.UriParams, uid?: string): any;
|
|
784
|
+
protected beforeGetAll(result: Aventus.ResultRamWithError<Map<number, Aventus.RamItem<T>>>): Promise<void>;
|
|
785
|
+
@BindThis()
|
|
786
|
+
protected otherGetById(item: Aventus.ExtractFromError<T>, params: Aventus.UriParams, uid?: string): any;
|
|
787
|
+
protected beforeGetById(id: number, result: Aventus.ResultRamWithError<Aventus.RamItem<T>>): Promise<void>;
|
|
788
|
+
protected beforeGetByIds(ids: number[], result: Aventus.ResultRamWithError<Aventus.RamItem<T>[]>): Promise<void>;
|
|
789
|
+
@BindThis()
|
|
790
|
+
protected otherCreateItem(item: Aventus.ExtractFromError<T>, params: Aventus.UriParams, uid?: string): any;
|
|
791
|
+
protected beforeCreateItem(item: T, fromList: boolean, result: Aventus.ResultRamWithError<Aventus.RamItem<T>>): Promise<void>;
|
|
792
|
+
@BindThis()
|
|
793
|
+
protected otherCreateList(items: Aventus.ExtractFromError<T[]>, params: Aventus.UriParams, uid?: string): any;
|
|
794
|
+
protected beforeCreateList(list: T[], result: Aventus.ResultRamWithError<Aventus.RamItem<T>[]>): Promise<void>;
|
|
795
|
+
@BindThis()
|
|
796
|
+
protected otherUpdateItem(item: Aventus.ExtractFromError<T>, params: Aventus.UriParams, uid?: string): any;
|
|
797
|
+
protected beforeUpdateItem(item: T, fromList: boolean, result: Aventus.ResultRamWithError<Aventus.RamItem<T>>): Promise<void>;
|
|
798
|
+
@BindThis()
|
|
799
|
+
protected otherUpdateList(items: T[], params: Aventus.UriParams, uid?: string): any;
|
|
800
|
+
protected beforeUpdateList(list: T[], result: Aventus.ResultRamWithError<Aventus.RamItem<T>[]>): Promise<void>;
|
|
801
|
+
@BindThis()
|
|
802
|
+
protected otherDeleteItem(item: Aventus.ExtractFromError<T>, params: Aventus.UriParams, uid?: string): void;
|
|
803
|
+
protected beforeDeleteItem(item: T, fromList: boolean, result: Aventus.VoidWithError): Promise<void>;
|
|
804
|
+
@BindThis()
|
|
805
|
+
protected otherDeleteList(items: T[], params: Aventus.UriParams, uid?: string): void;
|
|
806
|
+
protected beforeDeleteList(list: T[], result: Aventus.VoidWithError): Promise<void>;
|
|
807
|
+
/**
|
|
808
|
+
* Delete element inside Ram without firing delete event
|
|
809
|
+
*/
|
|
810
|
+
protected deleteData(item: Aventus.KeysObject<T>, result: Aventus.ResultRamWithError<Aventus.RamItem<T>>): void;
|
|
811
|
+
}
|
|
784
812
|
}
|
|
785
813
|
|
|
786
814
|
}
|
|
787
815
|
}
|
|
788
|
-
|
|
816
|
+
declare module ___AventusSharp {
|
|
817
|
+
namespace RAM {
|
|
818
|
+
type KeysOfType<T, U> = {
|
|
819
|
+
[K in keyof T]: NonNullable<T[K]> extends U ? K : never;
|
|
820
|
+
}[keyof T];
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
namespace RAM {
|
|
824
|
+
type NumberKeys<T> = {
|
|
825
|
+
[K in keyof T]: T[K] extends number ? K : never;
|
|
826
|
+
}[keyof T];
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
namespace RAM {
|
|
830
|
+
type ItemField<T extends Aventus.IData, U extends Aventus.IData> = {
|
|
831
|
+
id: RAM.NumberKeys<T>;
|
|
832
|
+
obj: RAM.KeysOfType<T, U>;
|
|
833
|
+
ram: typeof Aventus.Ram<U>;
|
|
834
|
+
};
|
|
835
|
+
}
|
|
836
|
+
}//#endregion js def //
|
|
789
837
|
//#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(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}]}]}
|
|
838
|
+
{"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__as1(_.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__as1(_.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__as1(_.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__as1(_.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__as1(_.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__as1(_.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__as1(_.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__as1(_.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__as1(_.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.CustomTableMembers.AventusFile=class AventusFile {\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.CustomTableMembers.AventusFile.Namespace=`AventusSharp.Data.CustomTableMembers`;\r\n__as1(_.Data.CustomTableMembers, 'AventusFile', Data.CustomTableMembers.AventusFile);\r\n","dependances":[{"fullName":"Uri","isStrong":false},{"fullName":"File","isStrong":false},{"fullName":"Aventus.Json","isStrong":false}],"fullName":"AventusSharp.Data.CustomTableMembers.AventusFile","required":false,"type":1,"isExported":true,"convertibleName":""},{"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__as1(_.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__as1(_.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__as1(_.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__as1(_.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__as1(_.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__as1(_.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__as1(_.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__as1(_.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__as1(_.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__as1(_.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__as1(_.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__as1(_.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__as1(_.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__as1(_.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__as1(_.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__as1(_.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__as1(_.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__as1(_.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__as1(_.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__as1(_.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__as1(_.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__as1(_.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__as1(_.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__as1(_.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__as1(_.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__as1(_.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__as1(_.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__as1(_.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__as1(_.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.RamCompletor=class RamCompletor {\n objects = [];\n fields = [];\n error;\n constructor(objects, error) {\n if (!objects) {\n objects = [];\n }\n else if (!Array.isArray(objects)) {\n objects = [objects];\n }\n this.objects = objects;\n this.error = error;\n }\n add(field) {\n this.fields.push(field);\n return this;\n }\n async run() {\n const objects = this.objects;\n const fields = this.fields;\n const result = new Aventus.VoidWithError();\n if (objects.length == 0)\n return result;\n const listIds = {};\n const mapRecords = {};\n for (let field of fields) {\n let objKey = field.obj;\n let idKey = field.id;\n listIds[objKey] = [];\n mapRecords[objKey] = {};\n for (let value of objects) {\n if (value[idKey]) {\n const listId = listIds[objKey];\n const mapRecord = mapRecords[objKey];\n if (value[objKey])\n continue;\n if (!listId.includes(value[idKey]))\n listId.push(value[idKey]);\n if (!mapRecord[value[idKey]]) {\n mapRecord[value[idKey]] = [];\n }\n mapRecord[value[idKey]].push(value);\n }\n }\n }\n for (let field of fields) {\n let objKey = field.obj;\n if (!listIds[objKey] || !mapRecords[objKey])\n continue;\n const listId = listIds[objKey];\n const mapRecord = mapRecords[objKey];\n if (listId.length > 0) {\n const ram = Aventus.Instance.get(field.ram);\n const query = await ram.getByIdsWithError(listId);\n if (query.success && query.result) {\n for (let item of query.result) {\n if (mapRecord[item.Id]) {\n for (let record of mapRecord[item.Id]) {\n record[objKey] = item;\n }\n }\n }\n }\n else {\n result.errors = [...result.errors, ...query.errors];\n if (this.error) {\n this.error.errors = [...this.error.errors, ...query.errors];\n }\n }\n }\n }\n return result;\n }\n}\nRAM.RamCompletor.Namespace=`AventusSharp.RAM`;\r\n__as1(_.RAM, 'RamCompletor', RAM.RamCompletor);\r\n","dependances":[{"fullName":"AventusSharp.Data.Storable","isStrong":false},{"fullName":"AventusSharp.RAM.ItemField","isStrong":false},{"fullName":"Aventus.VoidWithError","isStrong":false},{"fullName":"Aventus.IData","isStrong":false},{"fullName":"U","isStrong":false},{"fullName":"AventusSharp.RAM.RamCompletor","isStrong":false},{"fullName":"Promise","isStrong":false},{"fullName":"Aventus.VoidWithError","isStrong":false},{"fullName":"Aventus.Instance","isStrong":false}],"fullName":"AventusSharp.RAM.RamCompletor","required":false,"type":1,"isExported":true,"convertibleName":""},{"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 complete(objects, error) {\n return new _.RAM.RamCompletor(objects, error);\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__as1(_.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.RamCompletor","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 complete(objects, error) {\n return new _.RAM.RamCompletor(objects, error);\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__as1(_.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":"Aventus.VoidWithError","isStrong":false},{"fullName":"AventusSharp.RAM.RamCompletor","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.RAM.KeysOfType","dependances":[{"fullName":"T","isStrong":false},{"fullName":"NonNullable","isStrong":false},{"fullName":"U","isStrong":false},{"fullName":"K","isStrong":false}]},{"fullName":"AventusSharp.RAM.NumberKeys","dependances":[{"fullName":"T","isStrong":false},{"fullName":"K","isStrong":false}]},{"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}]},{"fullName":"AventusSharp.RAM.ItemField","dependances":[{"fullName":"Aventus.IData","isStrong":false},{"fullName":"AventusSharp.RAM.NumberKeys","isStrong":false},{"fullName":"T","isStrong":false},{"fullName":"AventusSharp.RAM.KeysOfType","isStrong":false},{"fullName":"U","isStrong":false},{"fullName":"Ram","isStrong":false}]}]}
|
|
791
839
|
//#endregion js src //
|
|
792
840
|
//#region css def //
|
|
793
841
|
{}
|
|
@@ -799,5 +847,5 @@ abstract class RamWebSocket<T extends Data.Storable> extends Aventus.Ram<T> {
|
|
|
799
847
|
{}
|
|
800
848
|
//#endregion html //
|
|
801
849
|
//#region dependances //
|
|
802
|
-
|
|
850
|
+
{}
|
|
803
851
|
//#endregion dependances //
|