@ccmaymay/concrete 4.15.0 → 4.15.1
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/ActiveLearnerClientService.js +249 -249
- package/ActiveLearnerServerService.js +642 -642
- package/AnnotateCommunicationService.js +696 -696
- package/AnnotateWithContextService.js +298 -298
- package/FeedbackService.js +750 -750
- package/FetchCommunicationService.js +709 -709
- package/README.md +125 -0
- package/ResultsServerService.js +2138 -2138
- package/SearchProxyService.js +962 -962
- package/SearchService.js +685 -685
- package/Service.js +373 -373
- package/StoreCommunicationService.js +255 -255
- package/SummarizationService.js +479 -479
- package/access_types.js +168 -168
- package/annotate_types.js +26 -26
- package/audio_types.js +110 -110
- package/cluster_types.js +398 -398
- package/communication_fu.js +432 -432
- package/communication_types.js +845 -845
- package/concrete.js +64 -64
- package/context_types.js +65 -65
- package/email_types.js +477 -477
- package/entities_types.js +658 -658
- package/ex_types.js +82 -82
- package/language_types.js +123 -123
- package/learn_types.js +207 -207
- package/linking_types.js +286 -286
- package/metadata_types.js +926 -926
- package/nitf_types.js +1005 -1005
- package/package.json +26 -5
- package/results_types.js +18 -18
- package/search_types.js +661 -661
- package/services_types.js +384 -384
- package/situations_types.js +1268 -1268
- package/spans_types.js +151 -151
- package/structure_types.js +2311 -2311
- package/summarization_types.js +433 -433
- package/tokenization_fu.js +33 -33
- package/tokentagging_fu.js +241 -241
- package/twitter_types.js +1553 -1553
- package/util.js +117 -117
- package/uuid_types.js +67 -67
package/FeedbackService.js
CHANGED
@@ -1,750 +1,750 @@
|
|
1
|
-
//
|
2
|
-
// Autogenerated by Thrift Compiler (0.15.0)
|
3
|
-
//
|
4
|
-
// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
5
|
-
//
|
6
|
-
"use strict";
|
7
|
-
|
8
|
-
const thrift = require('thrift');
|
9
|
-
const Thrift = thrift.Thrift;
|
10
|
-
const Int64 = require('node-int64');
|
11
|
-
|
12
|
-
const communication_ttypes = require('./communication_types');
|
13
|
-
const services_ttypes = require('./services_types');
|
14
|
-
const structure_ttypes = require('./structure_types');
|
15
|
-
const uuid_ttypes = require('./uuid_types');
|
16
|
-
const metadata_ttypes = require('./metadata_types');
|
17
|
-
const entities_ttypes = require('./entities_types');
|
18
|
-
|
19
|
-
|
20
|
-
const Service = require('./Service');
|
21
|
-
const ServiceClient = Service.Client;
|
22
|
-
const ServiceProcessor = Service.Processor;
|
23
|
-
const ttypes = require('./search_types');
|
24
|
-
//HELPER FUNCTIONS AND STRUCTURES
|
25
|
-
|
26
|
-
const FeedbackService_startFeedback_args = class {
|
27
|
-
constructor(args) {
|
28
|
-
this.results = null;
|
29
|
-
if (args) {
|
30
|
-
if (args.results !== undefined && args.results !== null) {
|
31
|
-
this.results = new ttypes.SearchResult(args.results);
|
32
|
-
}
|
33
|
-
}
|
34
|
-
}
|
35
|
-
|
36
|
-
read (input) {
|
37
|
-
input.readStructBegin();
|
38
|
-
while (true) {
|
39
|
-
const ret = input.readFieldBegin();
|
40
|
-
const ftype = ret.ftype;
|
41
|
-
const fid = ret.fid;
|
42
|
-
if (ftype == Thrift.Type.STOP) {
|
43
|
-
break;
|
44
|
-
}
|
45
|
-
switch (fid) {
|
46
|
-
case 1:
|
47
|
-
if (ftype == Thrift.Type.STRUCT) {
|
48
|
-
this.results = new ttypes.SearchResult();
|
49
|
-
this.results.read(input);
|
50
|
-
} else {
|
51
|
-
input.skip(ftype);
|
52
|
-
}
|
53
|
-
break;
|
54
|
-
case 0:
|
55
|
-
input.skip(ftype);
|
56
|
-
break;
|
57
|
-
default:
|
58
|
-
input.skip(ftype);
|
59
|
-
}
|
60
|
-
input.readFieldEnd();
|
61
|
-
}
|
62
|
-
input.readStructEnd();
|
63
|
-
return;
|
64
|
-
}
|
65
|
-
|
66
|
-
write (output) {
|
67
|
-
output.writeStructBegin('FeedbackService_startFeedback_args');
|
68
|
-
if (this.results !== null && this.results !== undefined) {
|
69
|
-
output.writeFieldBegin('results', Thrift.Type.STRUCT, 1);
|
70
|
-
this.results.write(output);
|
71
|
-
output.writeFieldEnd();
|
72
|
-
}
|
73
|
-
output.writeFieldStop();
|
74
|
-
output.writeStructEnd();
|
75
|
-
return;
|
76
|
-
}
|
77
|
-
|
78
|
-
};
|
79
|
-
const FeedbackService_startFeedback_result = class {
|
80
|
-
constructor(args) {
|
81
|
-
this.ex = null;
|
82
|
-
if (args instanceof services_ttypes.ServicesException) {
|
83
|
-
this.ex = args;
|
84
|
-
return;
|
85
|
-
}
|
86
|
-
if (args) {
|
87
|
-
if (args.ex !== undefined && args.ex !== null) {
|
88
|
-
this.ex = args.ex;
|
89
|
-
}
|
90
|
-
}
|
91
|
-
}
|
92
|
-
|
93
|
-
read (input) {
|
94
|
-
input.readStructBegin();
|
95
|
-
while (true) {
|
96
|
-
const ret = input.readFieldBegin();
|
97
|
-
const ftype = ret.ftype;
|
98
|
-
const fid = ret.fid;
|
99
|
-
if (ftype == Thrift.Type.STOP) {
|
100
|
-
break;
|
101
|
-
}
|
102
|
-
switch (fid) {
|
103
|
-
case 1:
|
104
|
-
if (ftype == Thrift.Type.STRUCT) {
|
105
|
-
this.ex = new services_ttypes.ServicesException();
|
106
|
-
this.ex.read(input);
|
107
|
-
} else {
|
108
|
-
input.skip(ftype);
|
109
|
-
}
|
110
|
-
break;
|
111
|
-
case 0:
|
112
|
-
input.skip(ftype);
|
113
|
-
break;
|
114
|
-
default:
|
115
|
-
input.skip(ftype);
|
116
|
-
}
|
117
|
-
input.readFieldEnd();
|
118
|
-
}
|
119
|
-
input.readStructEnd();
|
120
|
-
return;
|
121
|
-
}
|
122
|
-
|
123
|
-
write (output) {
|
124
|
-
output.writeStructBegin('FeedbackService_startFeedback_result');
|
125
|
-
if (this.ex !== null && this.ex !== undefined) {
|
126
|
-
output.writeFieldBegin('ex', Thrift.Type.STRUCT, 1);
|
127
|
-
this.ex.write(output);
|
128
|
-
output.writeFieldEnd();
|
129
|
-
}
|
130
|
-
output.writeFieldStop();
|
131
|
-
output.writeStructEnd();
|
132
|
-
return;
|
133
|
-
}
|
134
|
-
|
135
|
-
};
|
136
|
-
const FeedbackService_addCommunicationFeedback_args = class {
|
137
|
-
constructor(args) {
|
138
|
-
this.searchResultsId = null;
|
139
|
-
this.communicationId = null;
|
140
|
-
this.feedback = null;
|
141
|
-
if (args) {
|
142
|
-
if (args.searchResultsId !== undefined && args.searchResultsId !== null) {
|
143
|
-
this.searchResultsId = new uuid_ttypes.UUID(args.searchResultsId);
|
144
|
-
}
|
145
|
-
if (args.communicationId !== undefined && args.communicationId !== null) {
|
146
|
-
this.communicationId = args.communicationId;
|
147
|
-
}
|
148
|
-
if (args.feedback !== undefined && args.feedback !== null) {
|
149
|
-
this.feedback = args.feedback;
|
150
|
-
}
|
151
|
-
}
|
152
|
-
}
|
153
|
-
|
154
|
-
read (input) {
|
155
|
-
input.readStructBegin();
|
156
|
-
while (true) {
|
157
|
-
const ret = input.readFieldBegin();
|
158
|
-
const ftype = ret.ftype;
|
159
|
-
const fid = ret.fid;
|
160
|
-
if (ftype == Thrift.Type.STOP) {
|
161
|
-
break;
|
162
|
-
}
|
163
|
-
switch (fid) {
|
164
|
-
case 1:
|
165
|
-
if (ftype == Thrift.Type.STRUCT) {
|
166
|
-
this.searchResultsId = new uuid_ttypes.UUID();
|
167
|
-
this.searchResultsId.read(input);
|
168
|
-
} else {
|
169
|
-
input.skip(ftype);
|
170
|
-
}
|
171
|
-
break;
|
172
|
-
case 2:
|
173
|
-
if (ftype == Thrift.Type.STRING) {
|
174
|
-
this.communicationId = input.readString();
|
175
|
-
} else {
|
176
|
-
input.skip(ftype);
|
177
|
-
}
|
178
|
-
break;
|
179
|
-
case 3:
|
180
|
-
if (ftype == Thrift.Type.I32) {
|
181
|
-
this.feedback = input.readI32();
|
182
|
-
} else {
|
183
|
-
input.skip(ftype);
|
184
|
-
}
|
185
|
-
break;
|
186
|
-
default:
|
187
|
-
input.skip(ftype);
|
188
|
-
}
|
189
|
-
input.readFieldEnd();
|
190
|
-
}
|
191
|
-
input.readStructEnd();
|
192
|
-
return;
|
193
|
-
}
|
194
|
-
|
195
|
-
write (output) {
|
196
|
-
output.writeStructBegin('FeedbackService_addCommunicationFeedback_args');
|
197
|
-
if (this.searchResultsId !== null && this.searchResultsId !== undefined) {
|
198
|
-
output.writeFieldBegin('searchResultsId', Thrift.Type.STRUCT, 1);
|
199
|
-
this.searchResultsId.write(output);
|
200
|
-
output.writeFieldEnd();
|
201
|
-
}
|
202
|
-
if (this.communicationId !== null && this.communicationId !== undefined) {
|
203
|
-
output.writeFieldBegin('communicationId', Thrift.Type.STRING, 2);
|
204
|
-
output.writeString(this.communicationId);
|
205
|
-
output.writeFieldEnd();
|
206
|
-
}
|
207
|
-
if (this.feedback !== null && this.feedback !== undefined) {
|
208
|
-
output.writeFieldBegin('feedback', Thrift.Type.I32, 3);
|
209
|
-
output.writeI32(this.feedback);
|
210
|
-
output.writeFieldEnd();
|
211
|
-
}
|
212
|
-
output.writeFieldStop();
|
213
|
-
output.writeStructEnd();
|
214
|
-
return;
|
215
|
-
}
|
216
|
-
|
217
|
-
};
|
218
|
-
const FeedbackService_addCommunicationFeedback_result = class {
|
219
|
-
constructor(args) {
|
220
|
-
this.ex = null;
|
221
|
-
if (args instanceof services_ttypes.ServicesException) {
|
222
|
-
this.ex = args;
|
223
|
-
return;
|
224
|
-
}
|
225
|
-
if (args) {
|
226
|
-
if (args.ex !== undefined && args.ex !== null) {
|
227
|
-
this.ex = args.ex;
|
228
|
-
}
|
229
|
-
}
|
230
|
-
}
|
231
|
-
|
232
|
-
read (input) {
|
233
|
-
input.readStructBegin();
|
234
|
-
while (true) {
|
235
|
-
const ret = input.readFieldBegin();
|
236
|
-
const ftype = ret.ftype;
|
237
|
-
const fid = ret.fid;
|
238
|
-
if (ftype == Thrift.Type.STOP) {
|
239
|
-
break;
|
240
|
-
}
|
241
|
-
switch (fid) {
|
242
|
-
case 1:
|
243
|
-
if (ftype == Thrift.Type.STRUCT) {
|
244
|
-
this.ex = new services_ttypes.ServicesException();
|
245
|
-
this.ex.read(input);
|
246
|
-
} else {
|
247
|
-
input.skip(ftype);
|
248
|
-
}
|
249
|
-
break;
|
250
|
-
case 0:
|
251
|
-
input.skip(ftype);
|
252
|
-
break;
|
253
|
-
default:
|
254
|
-
input.skip(ftype);
|
255
|
-
}
|
256
|
-
input.readFieldEnd();
|
257
|
-
}
|
258
|
-
input.readStructEnd();
|
259
|
-
return;
|
260
|
-
}
|
261
|
-
|
262
|
-
write (output) {
|
263
|
-
output.writeStructBegin('FeedbackService_addCommunicationFeedback_result');
|
264
|
-
if (this.ex !== null && this.ex !== undefined) {
|
265
|
-
output.writeFieldBegin('ex', Thrift.Type.STRUCT, 1);
|
266
|
-
this.ex.write(output);
|
267
|
-
output.writeFieldEnd();
|
268
|
-
}
|
269
|
-
output.writeFieldStop();
|
270
|
-
output.writeStructEnd();
|
271
|
-
return;
|
272
|
-
}
|
273
|
-
|
274
|
-
};
|
275
|
-
const FeedbackService_addSentenceFeedback_args = class {
|
276
|
-
constructor(args) {
|
277
|
-
this.searchResultsId = null;
|
278
|
-
this.communicationId = null;
|
279
|
-
this.sentenceId = null;
|
280
|
-
this.feedback = null;
|
281
|
-
if (args) {
|
282
|
-
if (args.searchResultsId !== undefined && args.searchResultsId !== null) {
|
283
|
-
this.searchResultsId = new uuid_ttypes.UUID(args.searchResultsId);
|
284
|
-
}
|
285
|
-
if (args.communicationId !== undefined && args.communicationId !== null) {
|
286
|
-
this.communicationId = args.communicationId;
|
287
|
-
}
|
288
|
-
if (args.sentenceId !== undefined && args.sentenceId !== null) {
|
289
|
-
this.sentenceId = new uuid_ttypes.UUID(args.sentenceId);
|
290
|
-
}
|
291
|
-
if (args.feedback !== undefined && args.feedback !== null) {
|
292
|
-
this.feedback = args.feedback;
|
293
|
-
}
|
294
|
-
}
|
295
|
-
}
|
296
|
-
|
297
|
-
read (input) {
|
298
|
-
input.readStructBegin();
|
299
|
-
while (true) {
|
300
|
-
const ret = input.readFieldBegin();
|
301
|
-
const ftype = ret.ftype;
|
302
|
-
const fid = ret.fid;
|
303
|
-
if (ftype == Thrift.Type.STOP) {
|
304
|
-
break;
|
305
|
-
}
|
306
|
-
switch (fid) {
|
307
|
-
case 1:
|
308
|
-
if (ftype == Thrift.Type.STRUCT) {
|
309
|
-
this.searchResultsId = new uuid_ttypes.UUID();
|
310
|
-
this.searchResultsId.read(input);
|
311
|
-
} else {
|
312
|
-
input.skip(ftype);
|
313
|
-
}
|
314
|
-
break;
|
315
|
-
case 2:
|
316
|
-
if (ftype == Thrift.Type.STRING) {
|
317
|
-
this.communicationId = input.readString();
|
318
|
-
} else {
|
319
|
-
input.skip(ftype);
|
320
|
-
}
|
321
|
-
break;
|
322
|
-
case 3:
|
323
|
-
if (ftype == Thrift.Type.STRUCT) {
|
324
|
-
this.sentenceId = new uuid_ttypes.UUID();
|
325
|
-
this.sentenceId.read(input);
|
326
|
-
} else {
|
327
|
-
input.skip(ftype);
|
328
|
-
}
|
329
|
-
break;
|
330
|
-
case 4:
|
331
|
-
if (ftype == Thrift.Type.I32) {
|
332
|
-
this.feedback = input.readI32();
|
333
|
-
} else {
|
334
|
-
input.skip(ftype);
|
335
|
-
}
|
336
|
-
break;
|
337
|
-
default:
|
338
|
-
input.skip(ftype);
|
339
|
-
}
|
340
|
-
input.readFieldEnd();
|
341
|
-
}
|
342
|
-
input.readStructEnd();
|
343
|
-
return;
|
344
|
-
}
|
345
|
-
|
346
|
-
write (output) {
|
347
|
-
output.writeStructBegin('FeedbackService_addSentenceFeedback_args');
|
348
|
-
if (this.searchResultsId !== null && this.searchResultsId !== undefined) {
|
349
|
-
output.writeFieldBegin('searchResultsId', Thrift.Type.STRUCT, 1);
|
350
|
-
this.searchResultsId.write(output);
|
351
|
-
output.writeFieldEnd();
|
352
|
-
}
|
353
|
-
if (this.communicationId !== null && this.communicationId !== undefined) {
|
354
|
-
output.writeFieldBegin('communicationId', Thrift.Type.STRING, 2);
|
355
|
-
output.writeString(this.communicationId);
|
356
|
-
output.writeFieldEnd();
|
357
|
-
}
|
358
|
-
if (this.sentenceId !== null && this.sentenceId !== undefined) {
|
359
|
-
output.writeFieldBegin('sentenceId', Thrift.Type.STRUCT, 3);
|
360
|
-
this.sentenceId.write(output);
|
361
|
-
output.writeFieldEnd();
|
362
|
-
}
|
363
|
-
if (this.feedback !== null && this.feedback !== undefined) {
|
364
|
-
output.writeFieldBegin('feedback', Thrift.Type.I32, 4);
|
365
|
-
output.writeI32(this.feedback);
|
366
|
-
output.writeFieldEnd();
|
367
|
-
}
|
368
|
-
output.writeFieldStop();
|
369
|
-
output.writeStructEnd();
|
370
|
-
return;
|
371
|
-
}
|
372
|
-
|
373
|
-
};
|
374
|
-
const FeedbackService_addSentenceFeedback_result = class {
|
375
|
-
constructor(args) {
|
376
|
-
this.ex = null;
|
377
|
-
if (args instanceof services_ttypes.ServicesException) {
|
378
|
-
this.ex = args;
|
379
|
-
return;
|
380
|
-
}
|
381
|
-
if (args) {
|
382
|
-
if (args.ex !== undefined && args.ex !== null) {
|
383
|
-
this.ex = args.ex;
|
384
|
-
}
|
385
|
-
}
|
386
|
-
}
|
387
|
-
|
388
|
-
read (input) {
|
389
|
-
input.readStructBegin();
|
390
|
-
while (true) {
|
391
|
-
const ret = input.readFieldBegin();
|
392
|
-
const ftype = ret.ftype;
|
393
|
-
const fid = ret.fid;
|
394
|
-
if (ftype == Thrift.Type.STOP) {
|
395
|
-
break;
|
396
|
-
}
|
397
|
-
switch (fid) {
|
398
|
-
case 1:
|
399
|
-
if (ftype == Thrift.Type.STRUCT) {
|
400
|
-
this.ex = new services_ttypes.ServicesException();
|
401
|
-
this.ex.read(input);
|
402
|
-
} else {
|
403
|
-
input.skip(ftype);
|
404
|
-
}
|
405
|
-
break;
|
406
|
-
case 0:
|
407
|
-
input.skip(ftype);
|
408
|
-
break;
|
409
|
-
default:
|
410
|
-
input.skip(ftype);
|
411
|
-
}
|
412
|
-
input.readFieldEnd();
|
413
|
-
}
|
414
|
-
input.readStructEnd();
|
415
|
-
return;
|
416
|
-
}
|
417
|
-
|
418
|
-
write (output) {
|
419
|
-
output.writeStructBegin('FeedbackService_addSentenceFeedback_result');
|
420
|
-
if (this.ex !== null && this.ex !== undefined) {
|
421
|
-
output.writeFieldBegin('ex', Thrift.Type.STRUCT, 1);
|
422
|
-
this.ex.write(output);
|
423
|
-
output.writeFieldEnd();
|
424
|
-
}
|
425
|
-
output.writeFieldStop();
|
426
|
-
output.writeStructEnd();
|
427
|
-
return;
|
428
|
-
}
|
429
|
-
|
430
|
-
};
|
431
|
-
const FeedbackServiceClient = exports.Client = class FeedbackServiceClient extends ServiceClient {
|
432
|
-
constructor(output, pClass) {
|
433
|
-
super(output, pClass);
|
434
|
-
this.output = output;
|
435
|
-
this.pClass = pClass;
|
436
|
-
this._seqid = 0;
|
437
|
-
this._reqs = {};
|
438
|
-
}
|
439
|
-
seqid () { return this._seqid; }
|
440
|
-
new_seqid () { return this._seqid += 1; }
|
441
|
-
|
442
|
-
startFeedback (results) {
|
443
|
-
this._seqid = this.new_seqid();
|
444
|
-
const self = this;
|
445
|
-
return new Promise((resolve, reject) => {
|
446
|
-
self._reqs[self.seqid()] = (error, result) => {
|
447
|
-
return error ? reject(error) : resolve(result);
|
448
|
-
};
|
449
|
-
self.send_startFeedback(results);
|
450
|
-
});
|
451
|
-
}
|
452
|
-
|
453
|
-
send_startFeedback (results) {
|
454
|
-
const output = new this.pClass(this.output);
|
455
|
-
const params = {
|
456
|
-
results: results
|
457
|
-
};
|
458
|
-
const args = new FeedbackService_startFeedback_args(params);
|
459
|
-
try {
|
460
|
-
output.writeMessageBegin('startFeedback', Thrift.MessageType.CALL, this.seqid());
|
461
|
-
args.write(output);
|
462
|
-
output.writeMessageEnd();
|
463
|
-
return this.output.flush();
|
464
|
-
}
|
465
|
-
catch (e) {
|
466
|
-
delete this._reqs[this.seqid()];
|
467
|
-
if (typeof output.reset === 'function') {
|
468
|
-
output.reset();
|
469
|
-
}
|
470
|
-
throw e;
|
471
|
-
}
|
472
|
-
}
|
473
|
-
|
474
|
-
recv_startFeedback (input, mtype, rseqid) {
|
475
|
-
const callback = this._reqs[rseqid] || function() {};
|
476
|
-
delete this._reqs[rseqid];
|
477
|
-
if (mtype == Thrift.MessageType.EXCEPTION) {
|
478
|
-
const x = new Thrift.TApplicationException();
|
479
|
-
x.read(input);
|
480
|
-
input.readMessageEnd();
|
481
|
-
return callback(x);
|
482
|
-
}
|
483
|
-
const result = new FeedbackService_startFeedback_result();
|
484
|
-
result.read(input);
|
485
|
-
input.readMessageEnd();
|
486
|
-
|
487
|
-
if (null !== result.ex) {
|
488
|
-
return callback(result.ex);
|
489
|
-
}
|
490
|
-
callback(null);
|
491
|
-
}
|
492
|
-
|
493
|
-
addCommunicationFeedback (searchResultsId, communicationId, feedback) {
|
494
|
-
this._seqid = this.new_seqid();
|
495
|
-
const self = this;
|
496
|
-
return new Promise((resolve, reject) => {
|
497
|
-
self._reqs[self.seqid()] = (error, result) => {
|
498
|
-
return error ? reject(error) : resolve(result);
|
499
|
-
};
|
500
|
-
self.send_addCommunicationFeedback(searchResultsId, communicationId, feedback);
|
501
|
-
});
|
502
|
-
}
|
503
|
-
|
504
|
-
send_addCommunicationFeedback (searchResultsId, communicationId, feedback) {
|
505
|
-
const output = new this.pClass(this.output);
|
506
|
-
const params = {
|
507
|
-
searchResultsId: searchResultsId,
|
508
|
-
communicationId: communicationId,
|
509
|
-
feedback: feedback
|
510
|
-
};
|
511
|
-
const args = new FeedbackService_addCommunicationFeedback_args(params);
|
512
|
-
try {
|
513
|
-
output.writeMessageBegin('addCommunicationFeedback', Thrift.MessageType.CALL, this.seqid());
|
514
|
-
args.write(output);
|
515
|
-
output.writeMessageEnd();
|
516
|
-
return this.output.flush();
|
517
|
-
}
|
518
|
-
catch (e) {
|
519
|
-
delete this._reqs[this.seqid()];
|
520
|
-
if (typeof output.reset === 'function') {
|
521
|
-
output.reset();
|
522
|
-
}
|
523
|
-
throw e;
|
524
|
-
}
|
525
|
-
}
|
526
|
-
|
527
|
-
recv_addCommunicationFeedback (input, mtype, rseqid) {
|
528
|
-
const callback = this._reqs[rseqid] || function() {};
|
529
|
-
delete this._reqs[rseqid];
|
530
|
-
if (mtype == Thrift.MessageType.EXCEPTION) {
|
531
|
-
const x = new Thrift.TApplicationException();
|
532
|
-
x.read(input);
|
533
|
-
input.readMessageEnd();
|
534
|
-
return callback(x);
|
535
|
-
}
|
536
|
-
const result = new FeedbackService_addCommunicationFeedback_result();
|
537
|
-
result.read(input);
|
538
|
-
input.readMessageEnd();
|
539
|
-
|
540
|
-
if (null !== result.ex) {
|
541
|
-
return callback(result.ex);
|
542
|
-
}
|
543
|
-
callback(null);
|
544
|
-
}
|
545
|
-
|
546
|
-
addSentenceFeedback (searchResultsId, communicationId, sentenceId, feedback) {
|
547
|
-
this._seqid = this.new_seqid();
|
548
|
-
const self = this;
|
549
|
-
return new Promise((resolve, reject) => {
|
550
|
-
self._reqs[self.seqid()] = (error, result) => {
|
551
|
-
return error ? reject(error) : resolve(result);
|
552
|
-
};
|
553
|
-
self.send_addSentenceFeedback(searchResultsId, communicationId, sentenceId, feedback);
|
554
|
-
});
|
555
|
-
}
|
556
|
-
|
557
|
-
send_addSentenceFeedback (searchResultsId, communicationId, sentenceId, feedback) {
|
558
|
-
const output = new this.pClass(this.output);
|
559
|
-
const params = {
|
560
|
-
searchResultsId: searchResultsId,
|
561
|
-
communicationId: communicationId,
|
562
|
-
sentenceId: sentenceId,
|
563
|
-
feedback: feedback
|
564
|
-
};
|
565
|
-
const args = new FeedbackService_addSentenceFeedback_args(params);
|
566
|
-
try {
|
567
|
-
output.writeMessageBegin('addSentenceFeedback', Thrift.MessageType.CALL, this.seqid());
|
568
|
-
args.write(output);
|
569
|
-
output.writeMessageEnd();
|
570
|
-
return this.output.flush();
|
571
|
-
}
|
572
|
-
catch (e) {
|
573
|
-
delete this._reqs[this.seqid()];
|
574
|
-
if (typeof output.reset === 'function') {
|
575
|
-
output.reset();
|
576
|
-
}
|
577
|
-
throw e;
|
578
|
-
}
|
579
|
-
}
|
580
|
-
|
581
|
-
recv_addSentenceFeedback (input, mtype, rseqid) {
|
582
|
-
const callback = this._reqs[rseqid] || function() {};
|
583
|
-
delete this._reqs[rseqid];
|
584
|
-
if (mtype == Thrift.MessageType.EXCEPTION) {
|
585
|
-
const x = new Thrift.TApplicationException();
|
586
|
-
x.read(input);
|
587
|
-
input.readMessageEnd();
|
588
|
-
return callback(x);
|
589
|
-
}
|
590
|
-
const result = new FeedbackService_addSentenceFeedback_result();
|
591
|
-
result.read(input);
|
592
|
-
input.readMessageEnd();
|
593
|
-
|
594
|
-
if (null !== result.ex) {
|
595
|
-
return callback(result.ex);
|
596
|
-
}
|
597
|
-
callback(null);
|
598
|
-
}
|
599
|
-
};
|
600
|
-
const FeedbackServiceProcessor = exports.Processor = class FeedbackServiceProcessor extends ServiceProcessor {
|
601
|
-
constructor(handler) {
|
602
|
-
super(handler);
|
603
|
-
this._handler = handler;
|
604
|
-
}
|
605
|
-
process (input, output) {
|
606
|
-
const r = input.readMessageBegin();
|
607
|
-
if (this['process_' + r.fname]) {
|
608
|
-
return this['process_' + r.fname].call(this, r.rseqid, input, output);
|
609
|
-
} else {
|
610
|
-
input.skip(Thrift.Type.STRUCT);
|
611
|
-
input.readMessageEnd();
|
612
|
-
const x = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN_METHOD, 'Unknown function ' + r.fname);
|
613
|
-
output.writeMessageBegin(r.fname, Thrift.MessageType.EXCEPTION, r.rseqid);
|
614
|
-
x.write(output);
|
615
|
-
output.writeMessageEnd();
|
616
|
-
output.flush();
|
617
|
-
}
|
618
|
-
}
|
619
|
-
process_startFeedback (seqid, input, output) {
|
620
|
-
const args = new FeedbackService_startFeedback_args();
|
621
|
-
args.read(input);
|
622
|
-
input.readMessageEnd();
|
623
|
-
if (this._handler.startFeedback.length === 1) {
|
624
|
-
Promise.resolve(this._handler.startFeedback.bind(this._handler)(
|
625
|
-
args.results
|
626
|
-
)).then(result => {
|
627
|
-
const result_obj = new FeedbackService_startFeedback_result({success: result});
|
628
|
-
output.writeMessageBegin("startFeedback", Thrift.MessageType.REPLY, seqid);
|
629
|
-
result_obj.write(output);
|
630
|
-
output.writeMessageEnd();
|
631
|
-
output.flush();
|
632
|
-
}).catch(err => {
|
633
|
-
let result;
|
634
|
-
if (err instanceof services_ttypes.ServicesException) {
|
635
|
-
result = new FeedbackService_startFeedback_result(err);
|
636
|
-
output.writeMessageBegin("startFeedback", Thrift.MessageType.REPLY, seqid);
|
637
|
-
} else {
|
638
|
-
result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
|
639
|
-
output.writeMessageBegin("startFeedback", Thrift.MessageType.EXCEPTION, seqid);
|
640
|
-
}
|
641
|
-
result.write(output);
|
642
|
-
output.writeMessageEnd();
|
643
|
-
output.flush();
|
644
|
-
});
|
645
|
-
} else {
|
646
|
-
this._handler.startFeedback(args.results, (err, result) => {
|
647
|
-
let result_obj;
|
648
|
-
if ((err === null || typeof err === 'undefined') || err instanceof services_ttypes.ServicesException) {
|
649
|
-
result_obj = new FeedbackService_startFeedback_result((err !== null || typeof err === 'undefined') ? err : {success: result});
|
650
|
-
output.writeMessageBegin("startFeedback", Thrift.MessageType.REPLY, seqid);
|
651
|
-
} else {
|
652
|
-
result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
|
653
|
-
output.writeMessageBegin("startFeedback", Thrift.MessageType.EXCEPTION, seqid);
|
654
|
-
}
|
655
|
-
result_obj.write(output);
|
656
|
-
output.writeMessageEnd();
|
657
|
-
output.flush();
|
658
|
-
});
|
659
|
-
}
|
660
|
-
}
|
661
|
-
process_addCommunicationFeedback (seqid, input, output) {
|
662
|
-
const args = new FeedbackService_addCommunicationFeedback_args();
|
663
|
-
args.read(input);
|
664
|
-
input.readMessageEnd();
|
665
|
-
if (this._handler.addCommunicationFeedback.length === 3) {
|
666
|
-
Promise.resolve(this._handler.addCommunicationFeedback.bind(this._handler)(
|
667
|
-
args.searchResultsId,
|
668
|
-
args.communicationId,
|
669
|
-
args.feedback
|
670
|
-
)).then(result => {
|
671
|
-
const result_obj = new FeedbackService_addCommunicationFeedback_result({success: result});
|
672
|
-
output.writeMessageBegin("addCommunicationFeedback", Thrift.MessageType.REPLY, seqid);
|
673
|
-
result_obj.write(output);
|
674
|
-
output.writeMessageEnd();
|
675
|
-
output.flush();
|
676
|
-
}).catch(err => {
|
677
|
-
let result;
|
678
|
-
if (err instanceof services_ttypes.ServicesException) {
|
679
|
-
result = new FeedbackService_addCommunicationFeedback_result(err);
|
680
|
-
output.writeMessageBegin("addCommunicationFeedback", Thrift.MessageType.REPLY, seqid);
|
681
|
-
} else {
|
682
|
-
result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
|
683
|
-
output.writeMessageBegin("addCommunicationFeedback", Thrift.MessageType.EXCEPTION, seqid);
|
684
|
-
}
|
685
|
-
result.write(output);
|
686
|
-
output.writeMessageEnd();
|
687
|
-
output.flush();
|
688
|
-
});
|
689
|
-
} else {
|
690
|
-
this._handler.addCommunicationFeedback(args.searchResultsId, args.communicationId, args.feedback, (err, result) => {
|
691
|
-
let result_obj;
|
692
|
-
if ((err === null || typeof err === 'undefined') || err instanceof services_ttypes.ServicesException) {
|
693
|
-
result_obj = new FeedbackService_addCommunicationFeedback_result((err !== null || typeof err === 'undefined') ? err : {success: result});
|
694
|
-
output.writeMessageBegin("addCommunicationFeedback", Thrift.MessageType.REPLY, seqid);
|
695
|
-
} else {
|
696
|
-
result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
|
697
|
-
output.writeMessageBegin("addCommunicationFeedback", Thrift.MessageType.EXCEPTION, seqid);
|
698
|
-
}
|
699
|
-
result_obj.write(output);
|
700
|
-
output.writeMessageEnd();
|
701
|
-
output.flush();
|
702
|
-
});
|
703
|
-
}
|
704
|
-
}
|
705
|
-
process_addSentenceFeedback (seqid, input, output) {
|
706
|
-
const args = new FeedbackService_addSentenceFeedback_args();
|
707
|
-
args.read(input);
|
708
|
-
input.readMessageEnd();
|
709
|
-
if (this._handler.addSentenceFeedback.length === 4) {
|
710
|
-
Promise.resolve(this._handler.addSentenceFeedback.bind(this._handler)(
|
711
|
-
args.searchResultsId,
|
712
|
-
args.communicationId,
|
713
|
-
args.sentenceId,
|
714
|
-
args.feedback
|
715
|
-
)).then(result => {
|
716
|
-
const result_obj = new FeedbackService_addSentenceFeedback_result({success: result});
|
717
|
-
output.writeMessageBegin("addSentenceFeedback", Thrift.MessageType.REPLY, seqid);
|
718
|
-
result_obj.write(output);
|
719
|
-
output.writeMessageEnd();
|
720
|
-
output.flush();
|
721
|
-
}).catch(err => {
|
722
|
-
let result;
|
723
|
-
if (err instanceof services_ttypes.ServicesException) {
|
724
|
-
result = new FeedbackService_addSentenceFeedback_result(err);
|
725
|
-
output.writeMessageBegin("addSentenceFeedback", Thrift.MessageType.REPLY, seqid);
|
726
|
-
} else {
|
727
|
-
result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
|
728
|
-
output.writeMessageBegin("addSentenceFeedback", Thrift.MessageType.EXCEPTION, seqid);
|
729
|
-
}
|
730
|
-
result.write(output);
|
731
|
-
output.writeMessageEnd();
|
732
|
-
output.flush();
|
733
|
-
});
|
734
|
-
} else {
|
735
|
-
this._handler.addSentenceFeedback(args.searchResultsId, args.communicationId, args.sentenceId, args.feedback, (err, result) => {
|
736
|
-
let result_obj;
|
737
|
-
if ((err === null || typeof err === 'undefined') || err instanceof services_ttypes.ServicesException) {
|
738
|
-
result_obj = new FeedbackService_addSentenceFeedback_result((err !== null || typeof err === 'undefined') ? err : {success: result});
|
739
|
-
output.writeMessageBegin("addSentenceFeedback", Thrift.MessageType.REPLY, seqid);
|
740
|
-
} else {
|
741
|
-
result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
|
742
|
-
output.writeMessageBegin("addSentenceFeedback", Thrift.MessageType.EXCEPTION, seqid);
|
743
|
-
}
|
744
|
-
result_obj.write(output);
|
745
|
-
output.writeMessageEnd();
|
746
|
-
output.flush();
|
747
|
-
});
|
748
|
-
}
|
749
|
-
}
|
750
|
-
};
|
1
|
+
//
|
2
|
+
// Autogenerated by Thrift Compiler (0.15.0)
|
3
|
+
//
|
4
|
+
// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
5
|
+
//
|
6
|
+
"use strict";
|
7
|
+
|
8
|
+
const thrift = require('thrift');
|
9
|
+
const Thrift = thrift.Thrift;
|
10
|
+
const Int64 = require('node-int64');
|
11
|
+
|
12
|
+
const communication_ttypes = require('./communication_types');
|
13
|
+
const services_ttypes = require('./services_types');
|
14
|
+
const structure_ttypes = require('./structure_types');
|
15
|
+
const uuid_ttypes = require('./uuid_types');
|
16
|
+
const metadata_ttypes = require('./metadata_types');
|
17
|
+
const entities_ttypes = require('./entities_types');
|
18
|
+
|
19
|
+
|
20
|
+
const Service = require('./Service');
|
21
|
+
const ServiceClient = Service.Client;
|
22
|
+
const ServiceProcessor = Service.Processor;
|
23
|
+
const ttypes = require('./search_types');
|
24
|
+
//HELPER FUNCTIONS AND STRUCTURES
|
25
|
+
|
26
|
+
const FeedbackService_startFeedback_args = class {
|
27
|
+
constructor(args) {
|
28
|
+
this.results = null;
|
29
|
+
if (args) {
|
30
|
+
if (args.results !== undefined && args.results !== null) {
|
31
|
+
this.results = new ttypes.SearchResult(args.results);
|
32
|
+
}
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
36
|
+
read (input) {
|
37
|
+
input.readStructBegin();
|
38
|
+
while (true) {
|
39
|
+
const ret = input.readFieldBegin();
|
40
|
+
const ftype = ret.ftype;
|
41
|
+
const fid = ret.fid;
|
42
|
+
if (ftype == Thrift.Type.STOP) {
|
43
|
+
break;
|
44
|
+
}
|
45
|
+
switch (fid) {
|
46
|
+
case 1:
|
47
|
+
if (ftype == Thrift.Type.STRUCT) {
|
48
|
+
this.results = new ttypes.SearchResult();
|
49
|
+
this.results.read(input);
|
50
|
+
} else {
|
51
|
+
input.skip(ftype);
|
52
|
+
}
|
53
|
+
break;
|
54
|
+
case 0:
|
55
|
+
input.skip(ftype);
|
56
|
+
break;
|
57
|
+
default:
|
58
|
+
input.skip(ftype);
|
59
|
+
}
|
60
|
+
input.readFieldEnd();
|
61
|
+
}
|
62
|
+
input.readStructEnd();
|
63
|
+
return;
|
64
|
+
}
|
65
|
+
|
66
|
+
write (output) {
|
67
|
+
output.writeStructBegin('FeedbackService_startFeedback_args');
|
68
|
+
if (this.results !== null && this.results !== undefined) {
|
69
|
+
output.writeFieldBegin('results', Thrift.Type.STRUCT, 1);
|
70
|
+
this.results.write(output);
|
71
|
+
output.writeFieldEnd();
|
72
|
+
}
|
73
|
+
output.writeFieldStop();
|
74
|
+
output.writeStructEnd();
|
75
|
+
return;
|
76
|
+
}
|
77
|
+
|
78
|
+
};
|
79
|
+
const FeedbackService_startFeedback_result = class {
|
80
|
+
constructor(args) {
|
81
|
+
this.ex = null;
|
82
|
+
if (args instanceof services_ttypes.ServicesException) {
|
83
|
+
this.ex = args;
|
84
|
+
return;
|
85
|
+
}
|
86
|
+
if (args) {
|
87
|
+
if (args.ex !== undefined && args.ex !== null) {
|
88
|
+
this.ex = args.ex;
|
89
|
+
}
|
90
|
+
}
|
91
|
+
}
|
92
|
+
|
93
|
+
read (input) {
|
94
|
+
input.readStructBegin();
|
95
|
+
while (true) {
|
96
|
+
const ret = input.readFieldBegin();
|
97
|
+
const ftype = ret.ftype;
|
98
|
+
const fid = ret.fid;
|
99
|
+
if (ftype == Thrift.Type.STOP) {
|
100
|
+
break;
|
101
|
+
}
|
102
|
+
switch (fid) {
|
103
|
+
case 1:
|
104
|
+
if (ftype == Thrift.Type.STRUCT) {
|
105
|
+
this.ex = new services_ttypes.ServicesException();
|
106
|
+
this.ex.read(input);
|
107
|
+
} else {
|
108
|
+
input.skip(ftype);
|
109
|
+
}
|
110
|
+
break;
|
111
|
+
case 0:
|
112
|
+
input.skip(ftype);
|
113
|
+
break;
|
114
|
+
default:
|
115
|
+
input.skip(ftype);
|
116
|
+
}
|
117
|
+
input.readFieldEnd();
|
118
|
+
}
|
119
|
+
input.readStructEnd();
|
120
|
+
return;
|
121
|
+
}
|
122
|
+
|
123
|
+
write (output) {
|
124
|
+
output.writeStructBegin('FeedbackService_startFeedback_result');
|
125
|
+
if (this.ex !== null && this.ex !== undefined) {
|
126
|
+
output.writeFieldBegin('ex', Thrift.Type.STRUCT, 1);
|
127
|
+
this.ex.write(output);
|
128
|
+
output.writeFieldEnd();
|
129
|
+
}
|
130
|
+
output.writeFieldStop();
|
131
|
+
output.writeStructEnd();
|
132
|
+
return;
|
133
|
+
}
|
134
|
+
|
135
|
+
};
|
136
|
+
const FeedbackService_addCommunicationFeedback_args = class {
|
137
|
+
constructor(args) {
|
138
|
+
this.searchResultsId = null;
|
139
|
+
this.communicationId = null;
|
140
|
+
this.feedback = null;
|
141
|
+
if (args) {
|
142
|
+
if (args.searchResultsId !== undefined && args.searchResultsId !== null) {
|
143
|
+
this.searchResultsId = new uuid_ttypes.UUID(args.searchResultsId);
|
144
|
+
}
|
145
|
+
if (args.communicationId !== undefined && args.communicationId !== null) {
|
146
|
+
this.communicationId = args.communicationId;
|
147
|
+
}
|
148
|
+
if (args.feedback !== undefined && args.feedback !== null) {
|
149
|
+
this.feedback = args.feedback;
|
150
|
+
}
|
151
|
+
}
|
152
|
+
}
|
153
|
+
|
154
|
+
read (input) {
|
155
|
+
input.readStructBegin();
|
156
|
+
while (true) {
|
157
|
+
const ret = input.readFieldBegin();
|
158
|
+
const ftype = ret.ftype;
|
159
|
+
const fid = ret.fid;
|
160
|
+
if (ftype == Thrift.Type.STOP) {
|
161
|
+
break;
|
162
|
+
}
|
163
|
+
switch (fid) {
|
164
|
+
case 1:
|
165
|
+
if (ftype == Thrift.Type.STRUCT) {
|
166
|
+
this.searchResultsId = new uuid_ttypes.UUID();
|
167
|
+
this.searchResultsId.read(input);
|
168
|
+
} else {
|
169
|
+
input.skip(ftype);
|
170
|
+
}
|
171
|
+
break;
|
172
|
+
case 2:
|
173
|
+
if (ftype == Thrift.Type.STRING) {
|
174
|
+
this.communicationId = input.readString();
|
175
|
+
} else {
|
176
|
+
input.skip(ftype);
|
177
|
+
}
|
178
|
+
break;
|
179
|
+
case 3:
|
180
|
+
if (ftype == Thrift.Type.I32) {
|
181
|
+
this.feedback = input.readI32();
|
182
|
+
} else {
|
183
|
+
input.skip(ftype);
|
184
|
+
}
|
185
|
+
break;
|
186
|
+
default:
|
187
|
+
input.skip(ftype);
|
188
|
+
}
|
189
|
+
input.readFieldEnd();
|
190
|
+
}
|
191
|
+
input.readStructEnd();
|
192
|
+
return;
|
193
|
+
}
|
194
|
+
|
195
|
+
write (output) {
|
196
|
+
output.writeStructBegin('FeedbackService_addCommunicationFeedback_args');
|
197
|
+
if (this.searchResultsId !== null && this.searchResultsId !== undefined) {
|
198
|
+
output.writeFieldBegin('searchResultsId', Thrift.Type.STRUCT, 1);
|
199
|
+
this.searchResultsId.write(output);
|
200
|
+
output.writeFieldEnd();
|
201
|
+
}
|
202
|
+
if (this.communicationId !== null && this.communicationId !== undefined) {
|
203
|
+
output.writeFieldBegin('communicationId', Thrift.Type.STRING, 2);
|
204
|
+
output.writeString(this.communicationId);
|
205
|
+
output.writeFieldEnd();
|
206
|
+
}
|
207
|
+
if (this.feedback !== null && this.feedback !== undefined) {
|
208
|
+
output.writeFieldBegin('feedback', Thrift.Type.I32, 3);
|
209
|
+
output.writeI32(this.feedback);
|
210
|
+
output.writeFieldEnd();
|
211
|
+
}
|
212
|
+
output.writeFieldStop();
|
213
|
+
output.writeStructEnd();
|
214
|
+
return;
|
215
|
+
}
|
216
|
+
|
217
|
+
};
|
218
|
+
const FeedbackService_addCommunicationFeedback_result = class {
|
219
|
+
constructor(args) {
|
220
|
+
this.ex = null;
|
221
|
+
if (args instanceof services_ttypes.ServicesException) {
|
222
|
+
this.ex = args;
|
223
|
+
return;
|
224
|
+
}
|
225
|
+
if (args) {
|
226
|
+
if (args.ex !== undefined && args.ex !== null) {
|
227
|
+
this.ex = args.ex;
|
228
|
+
}
|
229
|
+
}
|
230
|
+
}
|
231
|
+
|
232
|
+
read (input) {
|
233
|
+
input.readStructBegin();
|
234
|
+
while (true) {
|
235
|
+
const ret = input.readFieldBegin();
|
236
|
+
const ftype = ret.ftype;
|
237
|
+
const fid = ret.fid;
|
238
|
+
if (ftype == Thrift.Type.STOP) {
|
239
|
+
break;
|
240
|
+
}
|
241
|
+
switch (fid) {
|
242
|
+
case 1:
|
243
|
+
if (ftype == Thrift.Type.STRUCT) {
|
244
|
+
this.ex = new services_ttypes.ServicesException();
|
245
|
+
this.ex.read(input);
|
246
|
+
} else {
|
247
|
+
input.skip(ftype);
|
248
|
+
}
|
249
|
+
break;
|
250
|
+
case 0:
|
251
|
+
input.skip(ftype);
|
252
|
+
break;
|
253
|
+
default:
|
254
|
+
input.skip(ftype);
|
255
|
+
}
|
256
|
+
input.readFieldEnd();
|
257
|
+
}
|
258
|
+
input.readStructEnd();
|
259
|
+
return;
|
260
|
+
}
|
261
|
+
|
262
|
+
write (output) {
|
263
|
+
output.writeStructBegin('FeedbackService_addCommunicationFeedback_result');
|
264
|
+
if (this.ex !== null && this.ex !== undefined) {
|
265
|
+
output.writeFieldBegin('ex', Thrift.Type.STRUCT, 1);
|
266
|
+
this.ex.write(output);
|
267
|
+
output.writeFieldEnd();
|
268
|
+
}
|
269
|
+
output.writeFieldStop();
|
270
|
+
output.writeStructEnd();
|
271
|
+
return;
|
272
|
+
}
|
273
|
+
|
274
|
+
};
|
275
|
+
const FeedbackService_addSentenceFeedback_args = class {
|
276
|
+
constructor(args) {
|
277
|
+
this.searchResultsId = null;
|
278
|
+
this.communicationId = null;
|
279
|
+
this.sentenceId = null;
|
280
|
+
this.feedback = null;
|
281
|
+
if (args) {
|
282
|
+
if (args.searchResultsId !== undefined && args.searchResultsId !== null) {
|
283
|
+
this.searchResultsId = new uuid_ttypes.UUID(args.searchResultsId);
|
284
|
+
}
|
285
|
+
if (args.communicationId !== undefined && args.communicationId !== null) {
|
286
|
+
this.communicationId = args.communicationId;
|
287
|
+
}
|
288
|
+
if (args.sentenceId !== undefined && args.sentenceId !== null) {
|
289
|
+
this.sentenceId = new uuid_ttypes.UUID(args.sentenceId);
|
290
|
+
}
|
291
|
+
if (args.feedback !== undefined && args.feedback !== null) {
|
292
|
+
this.feedback = args.feedback;
|
293
|
+
}
|
294
|
+
}
|
295
|
+
}
|
296
|
+
|
297
|
+
read (input) {
|
298
|
+
input.readStructBegin();
|
299
|
+
while (true) {
|
300
|
+
const ret = input.readFieldBegin();
|
301
|
+
const ftype = ret.ftype;
|
302
|
+
const fid = ret.fid;
|
303
|
+
if (ftype == Thrift.Type.STOP) {
|
304
|
+
break;
|
305
|
+
}
|
306
|
+
switch (fid) {
|
307
|
+
case 1:
|
308
|
+
if (ftype == Thrift.Type.STRUCT) {
|
309
|
+
this.searchResultsId = new uuid_ttypes.UUID();
|
310
|
+
this.searchResultsId.read(input);
|
311
|
+
} else {
|
312
|
+
input.skip(ftype);
|
313
|
+
}
|
314
|
+
break;
|
315
|
+
case 2:
|
316
|
+
if (ftype == Thrift.Type.STRING) {
|
317
|
+
this.communicationId = input.readString();
|
318
|
+
} else {
|
319
|
+
input.skip(ftype);
|
320
|
+
}
|
321
|
+
break;
|
322
|
+
case 3:
|
323
|
+
if (ftype == Thrift.Type.STRUCT) {
|
324
|
+
this.sentenceId = new uuid_ttypes.UUID();
|
325
|
+
this.sentenceId.read(input);
|
326
|
+
} else {
|
327
|
+
input.skip(ftype);
|
328
|
+
}
|
329
|
+
break;
|
330
|
+
case 4:
|
331
|
+
if (ftype == Thrift.Type.I32) {
|
332
|
+
this.feedback = input.readI32();
|
333
|
+
} else {
|
334
|
+
input.skip(ftype);
|
335
|
+
}
|
336
|
+
break;
|
337
|
+
default:
|
338
|
+
input.skip(ftype);
|
339
|
+
}
|
340
|
+
input.readFieldEnd();
|
341
|
+
}
|
342
|
+
input.readStructEnd();
|
343
|
+
return;
|
344
|
+
}
|
345
|
+
|
346
|
+
write (output) {
|
347
|
+
output.writeStructBegin('FeedbackService_addSentenceFeedback_args');
|
348
|
+
if (this.searchResultsId !== null && this.searchResultsId !== undefined) {
|
349
|
+
output.writeFieldBegin('searchResultsId', Thrift.Type.STRUCT, 1);
|
350
|
+
this.searchResultsId.write(output);
|
351
|
+
output.writeFieldEnd();
|
352
|
+
}
|
353
|
+
if (this.communicationId !== null && this.communicationId !== undefined) {
|
354
|
+
output.writeFieldBegin('communicationId', Thrift.Type.STRING, 2);
|
355
|
+
output.writeString(this.communicationId);
|
356
|
+
output.writeFieldEnd();
|
357
|
+
}
|
358
|
+
if (this.sentenceId !== null && this.sentenceId !== undefined) {
|
359
|
+
output.writeFieldBegin('sentenceId', Thrift.Type.STRUCT, 3);
|
360
|
+
this.sentenceId.write(output);
|
361
|
+
output.writeFieldEnd();
|
362
|
+
}
|
363
|
+
if (this.feedback !== null && this.feedback !== undefined) {
|
364
|
+
output.writeFieldBegin('feedback', Thrift.Type.I32, 4);
|
365
|
+
output.writeI32(this.feedback);
|
366
|
+
output.writeFieldEnd();
|
367
|
+
}
|
368
|
+
output.writeFieldStop();
|
369
|
+
output.writeStructEnd();
|
370
|
+
return;
|
371
|
+
}
|
372
|
+
|
373
|
+
};
|
374
|
+
const FeedbackService_addSentenceFeedback_result = class {
|
375
|
+
constructor(args) {
|
376
|
+
this.ex = null;
|
377
|
+
if (args instanceof services_ttypes.ServicesException) {
|
378
|
+
this.ex = args;
|
379
|
+
return;
|
380
|
+
}
|
381
|
+
if (args) {
|
382
|
+
if (args.ex !== undefined && args.ex !== null) {
|
383
|
+
this.ex = args.ex;
|
384
|
+
}
|
385
|
+
}
|
386
|
+
}
|
387
|
+
|
388
|
+
read (input) {
|
389
|
+
input.readStructBegin();
|
390
|
+
while (true) {
|
391
|
+
const ret = input.readFieldBegin();
|
392
|
+
const ftype = ret.ftype;
|
393
|
+
const fid = ret.fid;
|
394
|
+
if (ftype == Thrift.Type.STOP) {
|
395
|
+
break;
|
396
|
+
}
|
397
|
+
switch (fid) {
|
398
|
+
case 1:
|
399
|
+
if (ftype == Thrift.Type.STRUCT) {
|
400
|
+
this.ex = new services_ttypes.ServicesException();
|
401
|
+
this.ex.read(input);
|
402
|
+
} else {
|
403
|
+
input.skip(ftype);
|
404
|
+
}
|
405
|
+
break;
|
406
|
+
case 0:
|
407
|
+
input.skip(ftype);
|
408
|
+
break;
|
409
|
+
default:
|
410
|
+
input.skip(ftype);
|
411
|
+
}
|
412
|
+
input.readFieldEnd();
|
413
|
+
}
|
414
|
+
input.readStructEnd();
|
415
|
+
return;
|
416
|
+
}
|
417
|
+
|
418
|
+
write (output) {
|
419
|
+
output.writeStructBegin('FeedbackService_addSentenceFeedback_result');
|
420
|
+
if (this.ex !== null && this.ex !== undefined) {
|
421
|
+
output.writeFieldBegin('ex', Thrift.Type.STRUCT, 1);
|
422
|
+
this.ex.write(output);
|
423
|
+
output.writeFieldEnd();
|
424
|
+
}
|
425
|
+
output.writeFieldStop();
|
426
|
+
output.writeStructEnd();
|
427
|
+
return;
|
428
|
+
}
|
429
|
+
|
430
|
+
};
|
431
|
+
const FeedbackServiceClient = exports.Client = class FeedbackServiceClient extends ServiceClient {
|
432
|
+
constructor(output, pClass) {
|
433
|
+
super(output, pClass);
|
434
|
+
this.output = output;
|
435
|
+
this.pClass = pClass;
|
436
|
+
this._seqid = 0;
|
437
|
+
this._reqs = {};
|
438
|
+
}
|
439
|
+
seqid () { return this._seqid; }
|
440
|
+
new_seqid () { return this._seqid += 1; }
|
441
|
+
|
442
|
+
startFeedback (results) {
|
443
|
+
this._seqid = this.new_seqid();
|
444
|
+
const self = this;
|
445
|
+
return new Promise((resolve, reject) => {
|
446
|
+
self._reqs[self.seqid()] = (error, result) => {
|
447
|
+
return error ? reject(error) : resolve(result);
|
448
|
+
};
|
449
|
+
self.send_startFeedback(results);
|
450
|
+
});
|
451
|
+
}
|
452
|
+
|
453
|
+
send_startFeedback (results) {
|
454
|
+
const output = new this.pClass(this.output);
|
455
|
+
const params = {
|
456
|
+
results: results
|
457
|
+
};
|
458
|
+
const args = new FeedbackService_startFeedback_args(params);
|
459
|
+
try {
|
460
|
+
output.writeMessageBegin('startFeedback', Thrift.MessageType.CALL, this.seqid());
|
461
|
+
args.write(output);
|
462
|
+
output.writeMessageEnd();
|
463
|
+
return this.output.flush();
|
464
|
+
}
|
465
|
+
catch (e) {
|
466
|
+
delete this._reqs[this.seqid()];
|
467
|
+
if (typeof output.reset === 'function') {
|
468
|
+
output.reset();
|
469
|
+
}
|
470
|
+
throw e;
|
471
|
+
}
|
472
|
+
}
|
473
|
+
|
474
|
+
recv_startFeedback (input, mtype, rseqid) {
|
475
|
+
const callback = this._reqs[rseqid] || function() {};
|
476
|
+
delete this._reqs[rseqid];
|
477
|
+
if (mtype == Thrift.MessageType.EXCEPTION) {
|
478
|
+
const x = new Thrift.TApplicationException();
|
479
|
+
x.read(input);
|
480
|
+
input.readMessageEnd();
|
481
|
+
return callback(x);
|
482
|
+
}
|
483
|
+
const result = new FeedbackService_startFeedback_result();
|
484
|
+
result.read(input);
|
485
|
+
input.readMessageEnd();
|
486
|
+
|
487
|
+
if (null !== result.ex) {
|
488
|
+
return callback(result.ex);
|
489
|
+
}
|
490
|
+
callback(null);
|
491
|
+
}
|
492
|
+
|
493
|
+
addCommunicationFeedback (searchResultsId, communicationId, feedback) {
|
494
|
+
this._seqid = this.new_seqid();
|
495
|
+
const self = this;
|
496
|
+
return new Promise((resolve, reject) => {
|
497
|
+
self._reqs[self.seqid()] = (error, result) => {
|
498
|
+
return error ? reject(error) : resolve(result);
|
499
|
+
};
|
500
|
+
self.send_addCommunicationFeedback(searchResultsId, communicationId, feedback);
|
501
|
+
});
|
502
|
+
}
|
503
|
+
|
504
|
+
send_addCommunicationFeedback (searchResultsId, communicationId, feedback) {
|
505
|
+
const output = new this.pClass(this.output);
|
506
|
+
const params = {
|
507
|
+
searchResultsId: searchResultsId,
|
508
|
+
communicationId: communicationId,
|
509
|
+
feedback: feedback
|
510
|
+
};
|
511
|
+
const args = new FeedbackService_addCommunicationFeedback_args(params);
|
512
|
+
try {
|
513
|
+
output.writeMessageBegin('addCommunicationFeedback', Thrift.MessageType.CALL, this.seqid());
|
514
|
+
args.write(output);
|
515
|
+
output.writeMessageEnd();
|
516
|
+
return this.output.flush();
|
517
|
+
}
|
518
|
+
catch (e) {
|
519
|
+
delete this._reqs[this.seqid()];
|
520
|
+
if (typeof output.reset === 'function') {
|
521
|
+
output.reset();
|
522
|
+
}
|
523
|
+
throw e;
|
524
|
+
}
|
525
|
+
}
|
526
|
+
|
527
|
+
recv_addCommunicationFeedback (input, mtype, rseqid) {
|
528
|
+
const callback = this._reqs[rseqid] || function() {};
|
529
|
+
delete this._reqs[rseqid];
|
530
|
+
if (mtype == Thrift.MessageType.EXCEPTION) {
|
531
|
+
const x = new Thrift.TApplicationException();
|
532
|
+
x.read(input);
|
533
|
+
input.readMessageEnd();
|
534
|
+
return callback(x);
|
535
|
+
}
|
536
|
+
const result = new FeedbackService_addCommunicationFeedback_result();
|
537
|
+
result.read(input);
|
538
|
+
input.readMessageEnd();
|
539
|
+
|
540
|
+
if (null !== result.ex) {
|
541
|
+
return callback(result.ex);
|
542
|
+
}
|
543
|
+
callback(null);
|
544
|
+
}
|
545
|
+
|
546
|
+
addSentenceFeedback (searchResultsId, communicationId, sentenceId, feedback) {
|
547
|
+
this._seqid = this.new_seqid();
|
548
|
+
const self = this;
|
549
|
+
return new Promise((resolve, reject) => {
|
550
|
+
self._reqs[self.seqid()] = (error, result) => {
|
551
|
+
return error ? reject(error) : resolve(result);
|
552
|
+
};
|
553
|
+
self.send_addSentenceFeedback(searchResultsId, communicationId, sentenceId, feedback);
|
554
|
+
});
|
555
|
+
}
|
556
|
+
|
557
|
+
send_addSentenceFeedback (searchResultsId, communicationId, sentenceId, feedback) {
|
558
|
+
const output = new this.pClass(this.output);
|
559
|
+
const params = {
|
560
|
+
searchResultsId: searchResultsId,
|
561
|
+
communicationId: communicationId,
|
562
|
+
sentenceId: sentenceId,
|
563
|
+
feedback: feedback
|
564
|
+
};
|
565
|
+
const args = new FeedbackService_addSentenceFeedback_args(params);
|
566
|
+
try {
|
567
|
+
output.writeMessageBegin('addSentenceFeedback', Thrift.MessageType.CALL, this.seqid());
|
568
|
+
args.write(output);
|
569
|
+
output.writeMessageEnd();
|
570
|
+
return this.output.flush();
|
571
|
+
}
|
572
|
+
catch (e) {
|
573
|
+
delete this._reqs[this.seqid()];
|
574
|
+
if (typeof output.reset === 'function') {
|
575
|
+
output.reset();
|
576
|
+
}
|
577
|
+
throw e;
|
578
|
+
}
|
579
|
+
}
|
580
|
+
|
581
|
+
recv_addSentenceFeedback (input, mtype, rseqid) {
|
582
|
+
const callback = this._reqs[rseqid] || function() {};
|
583
|
+
delete this._reqs[rseqid];
|
584
|
+
if (mtype == Thrift.MessageType.EXCEPTION) {
|
585
|
+
const x = new Thrift.TApplicationException();
|
586
|
+
x.read(input);
|
587
|
+
input.readMessageEnd();
|
588
|
+
return callback(x);
|
589
|
+
}
|
590
|
+
const result = new FeedbackService_addSentenceFeedback_result();
|
591
|
+
result.read(input);
|
592
|
+
input.readMessageEnd();
|
593
|
+
|
594
|
+
if (null !== result.ex) {
|
595
|
+
return callback(result.ex);
|
596
|
+
}
|
597
|
+
callback(null);
|
598
|
+
}
|
599
|
+
};
|
600
|
+
const FeedbackServiceProcessor = exports.Processor = class FeedbackServiceProcessor extends ServiceProcessor {
|
601
|
+
constructor(handler) {
|
602
|
+
super(handler);
|
603
|
+
this._handler = handler;
|
604
|
+
}
|
605
|
+
process (input, output) {
|
606
|
+
const r = input.readMessageBegin();
|
607
|
+
if (this['process_' + r.fname]) {
|
608
|
+
return this['process_' + r.fname].call(this, r.rseqid, input, output);
|
609
|
+
} else {
|
610
|
+
input.skip(Thrift.Type.STRUCT);
|
611
|
+
input.readMessageEnd();
|
612
|
+
const x = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN_METHOD, 'Unknown function ' + r.fname);
|
613
|
+
output.writeMessageBegin(r.fname, Thrift.MessageType.EXCEPTION, r.rseqid);
|
614
|
+
x.write(output);
|
615
|
+
output.writeMessageEnd();
|
616
|
+
output.flush();
|
617
|
+
}
|
618
|
+
}
|
619
|
+
process_startFeedback (seqid, input, output) {
|
620
|
+
const args = new FeedbackService_startFeedback_args();
|
621
|
+
args.read(input);
|
622
|
+
input.readMessageEnd();
|
623
|
+
if (this._handler.startFeedback.length === 1) {
|
624
|
+
Promise.resolve(this._handler.startFeedback.bind(this._handler)(
|
625
|
+
args.results
|
626
|
+
)).then(result => {
|
627
|
+
const result_obj = new FeedbackService_startFeedback_result({success: result});
|
628
|
+
output.writeMessageBegin("startFeedback", Thrift.MessageType.REPLY, seqid);
|
629
|
+
result_obj.write(output);
|
630
|
+
output.writeMessageEnd();
|
631
|
+
output.flush();
|
632
|
+
}).catch(err => {
|
633
|
+
let result;
|
634
|
+
if (err instanceof services_ttypes.ServicesException) {
|
635
|
+
result = new FeedbackService_startFeedback_result(err);
|
636
|
+
output.writeMessageBegin("startFeedback", Thrift.MessageType.REPLY, seqid);
|
637
|
+
} else {
|
638
|
+
result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
|
639
|
+
output.writeMessageBegin("startFeedback", Thrift.MessageType.EXCEPTION, seqid);
|
640
|
+
}
|
641
|
+
result.write(output);
|
642
|
+
output.writeMessageEnd();
|
643
|
+
output.flush();
|
644
|
+
});
|
645
|
+
} else {
|
646
|
+
this._handler.startFeedback(args.results, (err, result) => {
|
647
|
+
let result_obj;
|
648
|
+
if ((err === null || typeof err === 'undefined') || err instanceof services_ttypes.ServicesException) {
|
649
|
+
result_obj = new FeedbackService_startFeedback_result((err !== null || typeof err === 'undefined') ? err : {success: result});
|
650
|
+
output.writeMessageBegin("startFeedback", Thrift.MessageType.REPLY, seqid);
|
651
|
+
} else {
|
652
|
+
result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
|
653
|
+
output.writeMessageBegin("startFeedback", Thrift.MessageType.EXCEPTION, seqid);
|
654
|
+
}
|
655
|
+
result_obj.write(output);
|
656
|
+
output.writeMessageEnd();
|
657
|
+
output.flush();
|
658
|
+
});
|
659
|
+
}
|
660
|
+
}
|
661
|
+
process_addCommunicationFeedback (seqid, input, output) {
|
662
|
+
const args = new FeedbackService_addCommunicationFeedback_args();
|
663
|
+
args.read(input);
|
664
|
+
input.readMessageEnd();
|
665
|
+
if (this._handler.addCommunicationFeedback.length === 3) {
|
666
|
+
Promise.resolve(this._handler.addCommunicationFeedback.bind(this._handler)(
|
667
|
+
args.searchResultsId,
|
668
|
+
args.communicationId,
|
669
|
+
args.feedback
|
670
|
+
)).then(result => {
|
671
|
+
const result_obj = new FeedbackService_addCommunicationFeedback_result({success: result});
|
672
|
+
output.writeMessageBegin("addCommunicationFeedback", Thrift.MessageType.REPLY, seqid);
|
673
|
+
result_obj.write(output);
|
674
|
+
output.writeMessageEnd();
|
675
|
+
output.flush();
|
676
|
+
}).catch(err => {
|
677
|
+
let result;
|
678
|
+
if (err instanceof services_ttypes.ServicesException) {
|
679
|
+
result = new FeedbackService_addCommunicationFeedback_result(err);
|
680
|
+
output.writeMessageBegin("addCommunicationFeedback", Thrift.MessageType.REPLY, seqid);
|
681
|
+
} else {
|
682
|
+
result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
|
683
|
+
output.writeMessageBegin("addCommunicationFeedback", Thrift.MessageType.EXCEPTION, seqid);
|
684
|
+
}
|
685
|
+
result.write(output);
|
686
|
+
output.writeMessageEnd();
|
687
|
+
output.flush();
|
688
|
+
});
|
689
|
+
} else {
|
690
|
+
this._handler.addCommunicationFeedback(args.searchResultsId, args.communicationId, args.feedback, (err, result) => {
|
691
|
+
let result_obj;
|
692
|
+
if ((err === null || typeof err === 'undefined') || err instanceof services_ttypes.ServicesException) {
|
693
|
+
result_obj = new FeedbackService_addCommunicationFeedback_result((err !== null || typeof err === 'undefined') ? err : {success: result});
|
694
|
+
output.writeMessageBegin("addCommunicationFeedback", Thrift.MessageType.REPLY, seqid);
|
695
|
+
} else {
|
696
|
+
result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
|
697
|
+
output.writeMessageBegin("addCommunicationFeedback", Thrift.MessageType.EXCEPTION, seqid);
|
698
|
+
}
|
699
|
+
result_obj.write(output);
|
700
|
+
output.writeMessageEnd();
|
701
|
+
output.flush();
|
702
|
+
});
|
703
|
+
}
|
704
|
+
}
|
705
|
+
process_addSentenceFeedback (seqid, input, output) {
|
706
|
+
const args = new FeedbackService_addSentenceFeedback_args();
|
707
|
+
args.read(input);
|
708
|
+
input.readMessageEnd();
|
709
|
+
if (this._handler.addSentenceFeedback.length === 4) {
|
710
|
+
Promise.resolve(this._handler.addSentenceFeedback.bind(this._handler)(
|
711
|
+
args.searchResultsId,
|
712
|
+
args.communicationId,
|
713
|
+
args.sentenceId,
|
714
|
+
args.feedback
|
715
|
+
)).then(result => {
|
716
|
+
const result_obj = new FeedbackService_addSentenceFeedback_result({success: result});
|
717
|
+
output.writeMessageBegin("addSentenceFeedback", Thrift.MessageType.REPLY, seqid);
|
718
|
+
result_obj.write(output);
|
719
|
+
output.writeMessageEnd();
|
720
|
+
output.flush();
|
721
|
+
}).catch(err => {
|
722
|
+
let result;
|
723
|
+
if (err instanceof services_ttypes.ServicesException) {
|
724
|
+
result = new FeedbackService_addSentenceFeedback_result(err);
|
725
|
+
output.writeMessageBegin("addSentenceFeedback", Thrift.MessageType.REPLY, seqid);
|
726
|
+
} else {
|
727
|
+
result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
|
728
|
+
output.writeMessageBegin("addSentenceFeedback", Thrift.MessageType.EXCEPTION, seqid);
|
729
|
+
}
|
730
|
+
result.write(output);
|
731
|
+
output.writeMessageEnd();
|
732
|
+
output.flush();
|
733
|
+
});
|
734
|
+
} else {
|
735
|
+
this._handler.addSentenceFeedback(args.searchResultsId, args.communicationId, args.sentenceId, args.feedback, (err, result) => {
|
736
|
+
let result_obj;
|
737
|
+
if ((err === null || typeof err === 'undefined') || err instanceof services_ttypes.ServicesException) {
|
738
|
+
result_obj = new FeedbackService_addSentenceFeedback_result((err !== null || typeof err === 'undefined') ? err : {success: result});
|
739
|
+
output.writeMessageBegin("addSentenceFeedback", Thrift.MessageType.REPLY, seqid);
|
740
|
+
} else {
|
741
|
+
result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
|
742
|
+
output.writeMessageBegin("addSentenceFeedback", Thrift.MessageType.EXCEPTION, seqid);
|
743
|
+
}
|
744
|
+
result_obj.write(output);
|
745
|
+
output.writeMessageEnd();
|
746
|
+
output.flush();
|
747
|
+
});
|
748
|
+
}
|
749
|
+
}
|
750
|
+
};
|