@@ -13,6 +13,8 @@ import {
13
13
// @ts -ignore
14
14
BinaryWriter ,
15
15
// @ts -ignore
16
+ CallReducerFlags ,
17
+ // @ts -ignore
16
18
DBConnectionBuilder ,
17
19
// @ts -ignore
18
20
DBConnectionImpl ,
@@ -105,8 +107,14 @@ const REMOTE_MODULE = {
105
107
dbViewConstructor : ( imp : DBConnectionImpl ) => {
106
108
return new RemoteTables ( imp ) ;
107
109
} ,
108
- reducersConstructor : ( imp : DBConnectionImpl ) => {
109
- return new RemoteReducers ( imp ) ;
110
+ reducersConstructor : (
111
+ imp : DBConnectionImpl ,
112
+ setReducerFlags : SetReducerFlags
113
+ ) => {
114
+ return new RemoteReducers ( imp , setReducerFlags ) ;
115
+ } ,
116
+ setReducerFlagsConstructor : ( ) => {
117
+ return new SetReducerFlags ( ) ;
110
118
} ,
111
119
} ;
112
120
@@ -120,10 +128,17 @@ export type Reducer =
120
128
| { name : 'SetName' ; args : SetName } ;
121
129
122
130
export class RemoteReducers {
123
- constructor ( private connection : DBConnectionImpl ) { }
131
+ constructor (
132
+ private connection : DBConnectionImpl ,
133
+ private setCallReducerFlags : SetReducerFlags
134
+ ) { }
124
135
125
136
identityConnected ( ) {
126
- this . connection . callReducer ( '__identity_connected__' , new Uint8Array ( 0 ) ) ;
137
+ this . connection . callReducer (
138
+ '__identity_connected__' ,
139
+ new Uint8Array ( 0 ) ,
140
+ this . setCallReducerFlags . identityConnectedFlags
141
+ ) ;
127
142
}
128
143
129
144
onIdentityConnected ( callback : ( ctx : EventContext ) => void ) {
@@ -135,7 +150,11 @@ export class RemoteReducers {
135
150
}
136
151
137
152
identityDisconnected ( ) {
138
- this . connection . callReducer ( '__identity_disconnected__' , new Uint8Array ( 0 ) ) ;
153
+ this . connection . callReducer (
154
+ '__identity_disconnected__' ,
155
+ new Uint8Array ( 0 ) ,
156
+ this . setCallReducerFlags . identityDisconnectedFlags
157
+ ) ;
139
158
}
140
159
141
160
onIdentityDisconnected ( callback : ( ctx : EventContext ) => void ) {
@@ -147,7 +166,11 @@ export class RemoteReducers {
147
166
}
148
167
149
168
init ( ) {
150
- this . connection . callReducer ( '__init__' , new Uint8Array ( 0 ) ) ;
169
+ this . connection . callReducer (
170
+ '__init__' ,
171
+ new Uint8Array ( 0 ) ,
172
+ this . setCallReducerFlags . initFlags
173
+ ) ;
151
174
}
152
175
153
176
onInit ( callback : ( ctx : EventContext ) => void ) {
@@ -163,7 +186,11 @@ export class RemoteReducers {
163
186
let __writer = new BinaryWriter ( 1024 ) ;
164
187
SendMessage . getAlgebraicType ( ) . serialize ( __writer , __args ) ;
165
188
let __argsBuffer = __writer . getBuffer ( ) ;
166
- this . connection . callReducer ( 'send_message' , __argsBuffer ) ;
189
+ this . connection . callReducer (
190
+ 'send_message' ,
191
+ __argsBuffer ,
192
+ this . setCallReducerFlags . sendMessageFlags
193
+ ) ;
167
194
}
168
195
169
196
onSendMessage ( callback : ( ctx : EventContext , text : string ) => void ) {
@@ -179,7 +206,11 @@ export class RemoteReducers {
179
206
let __writer = new BinaryWriter ( 1024 ) ;
180
207
SetName . getAlgebraicType ( ) . serialize ( __writer , __args ) ;
181
208
let __argsBuffer = __writer . getBuffer ( ) ;
182
- this . connection . callReducer ( 'set_name' , __argsBuffer ) ;
209
+ this . connection . callReducer (
210
+ 'set_name' ,
211
+ __argsBuffer ,
212
+ this . setCallReducerFlags . setNameFlags
213
+ ) ;
183
214
}
184
215
185
216
onSetName ( callback : ( ctx : EventContext , name : string ) => void ) {
@@ -191,6 +222,29 @@ export class RemoteReducers {
191
222
}
192
223
}
193
224
225
+ export class SetReducerFlags {
226
+ identityConnectedFlags : CallReducerFlags ;
227
+ identityConnected ( flags : CallReducerFlags ) {
228
+ this . identityConnectedFlags = flags ;
229
+ }
230
+ identityDisconnectedFlags : CallReducerFlags ;
231
+ identityDisconnected ( flags : CallReducerFlags ) {
232
+ this . identityDisconnectedFlags = flags ;
233
+ }
234
+ initFlags : CallReducerFlags ;
235
+ init ( flags : CallReducerFlags ) {
236
+ this . initFlags = flags ;
237
+ }
238
+ sendMessageFlags : CallReducerFlags ;
239
+ sendMessage ( flags : CallReducerFlags ) {
240
+ this . sendMessageFlags = flags ;
241
+ }
242
+ setNameFlags : CallReducerFlags ;
243
+ setName ( flags : CallReducerFlags ) {
244
+ this . setNameFlags = flags ;
245
+ }
246
+ }
247
+
194
248
export class RemoteTables {
195
249
constructor ( private connection : DBConnectionImpl ) { }
196
250
@@ -211,7 +265,8 @@ export class RemoteTables {
211
265
212
266
export class DBConnection extends DBConnectionImpl <
213
267
RemoteTables ,
214
- RemoteReducers
268
+ RemoteReducers ,
269
+ SetReducerFlags
215
270
> {
216
271
static builder = ( ) : DBConnectionBuilder < DBConnection > => {
217
272
return new DBConnectionBuilder < DBConnection > (
@@ -224,5 +279,6 @@ export class DBConnection extends DBConnectionImpl<
224
279
export type EventContext = EventContextInterface <
225
280
RemoteTables ,
226
281
RemoteReducers ,
282
+ SetReducerFlags ,
227
283
Reducer
228
284
> ;
0 commit comments