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