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