@ccmaymay/concrete 4.15.0 → 4.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ActiveLearnerClientService.js +249 -249
- package/ActiveLearnerServerService.js +642 -642
- package/AnnotateCommunicationService.js +696 -696
- package/AnnotateWithContextService.js +298 -298
- package/FeedbackService.js +750 -750
- package/FetchCommunicationService.js +709 -709
- package/README.md +125 -0
- package/ResultsServerService.js +2138 -2138
- package/SearchProxyService.js +962 -962
- package/SearchService.js +685 -685
- package/Service.js +373 -373
- package/StoreCommunicationService.js +255 -255
- package/SummarizationService.js +479 -479
- package/access_types.js +168 -168
- package/annotate_types.js +26 -26
- package/audio_types.js +110 -110
- package/cluster_types.js +398 -398
- package/communication_fu.js +432 -432
- package/communication_types.js +845 -845
- package/concrete.js +64 -64
- package/context_types.js +65 -65
- package/email_types.js +477 -477
- package/entities_types.js +658 -658
- package/ex_types.js +82 -82
- package/language_types.js +123 -123
- package/learn_types.js +207 -207
- package/linking_types.js +286 -286
- package/metadata_types.js +926 -926
- package/nitf_types.js +1005 -1005
- package/package.json +26 -5
- package/results_types.js +18 -18
- package/search_types.js +661 -661
- package/services_types.js +384 -384
- package/situations_types.js +1268 -1268
- package/spans_types.js +151 -151
- package/structure_types.js +2311 -2311
- package/summarization_types.js +433 -433
- package/tokenization_fu.js +33 -33
- package/tokentagging_fu.js +241 -241
- package/twitter_types.js +1553 -1553
- package/util.js +117 -117
- package/uuid_types.js +67 -67
package/Service.js
CHANGED
@@ -1,373 +1,373 @@
|
|
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 uuid_ttypes = require('./uuid_types');
|
13
|
-
|
14
|
-
|
15
|
-
const ttypes = require('./services_types');
|
16
|
-
//HELPER FUNCTIONS AND STRUCTURES
|
17
|
-
|
18
|
-
const Service_about_args = class {
|
19
|
-
constructor(args) {
|
20
|
-
}
|
21
|
-
|
22
|
-
read (input) {
|
23
|
-
input.readStructBegin();
|
24
|
-
while (true) {
|
25
|
-
const ret = input.readFieldBegin();
|
26
|
-
const ftype = ret.ftype;
|
27
|
-
if (ftype == Thrift.Type.STOP) {
|
28
|
-
break;
|
29
|
-
}
|
30
|
-
input.skip(ftype);
|
31
|
-
input.readFieldEnd();
|
32
|
-
}
|
33
|
-
input.readStructEnd();
|
34
|
-
return;
|
35
|
-
}
|
36
|
-
|
37
|
-
write (output) {
|
38
|
-
output.writeStructBegin('Service_about_args');
|
39
|
-
output.writeFieldStop();
|
40
|
-
output.writeStructEnd();
|
41
|
-
return;
|
42
|
-
}
|
43
|
-
|
44
|
-
};
|
45
|
-
const Service_about_result = class {
|
46
|
-
constructor(args) {
|
47
|
-
this.success = null;
|
48
|
-
if (args) {
|
49
|
-
if (args.success !== undefined && args.success !== null) {
|
50
|
-
this.success = new ttypes.ServiceInfo(args.success);
|
51
|
-
}
|
52
|
-
}
|
53
|
-
}
|
54
|
-
|
55
|
-
read (input) {
|
56
|
-
input.readStructBegin();
|
57
|
-
while (true) {
|
58
|
-
const ret = input.readFieldBegin();
|
59
|
-
const ftype = ret.ftype;
|
60
|
-
const fid = ret.fid;
|
61
|
-
if (ftype == Thrift.Type.STOP) {
|
62
|
-
break;
|
63
|
-
}
|
64
|
-
switch (fid) {
|
65
|
-
case 0:
|
66
|
-
if (ftype == Thrift.Type.STRUCT) {
|
67
|
-
this.success = new ttypes.ServiceInfo();
|
68
|
-
this.success.read(input);
|
69
|
-
} else {
|
70
|
-
input.skip(ftype);
|
71
|
-
}
|
72
|
-
break;
|
73
|
-
case 0:
|
74
|
-
input.skip(ftype);
|
75
|
-
break;
|
76
|
-
default:
|
77
|
-
input.skip(ftype);
|
78
|
-
}
|
79
|
-
input.readFieldEnd();
|
80
|
-
}
|
81
|
-
input.readStructEnd();
|
82
|
-
return;
|
83
|
-
}
|
84
|
-
|
85
|
-
write (output) {
|
86
|
-
output.writeStructBegin('Service_about_result');
|
87
|
-
if (this.success !== null && this.success !== undefined) {
|
88
|
-
output.writeFieldBegin('success', Thrift.Type.STRUCT, 0);
|
89
|
-
this.success.write(output);
|
90
|
-
output.writeFieldEnd();
|
91
|
-
}
|
92
|
-
output.writeFieldStop();
|
93
|
-
output.writeStructEnd();
|
94
|
-
return;
|
95
|
-
}
|
96
|
-
|
97
|
-
};
|
98
|
-
const Service_alive_args = class {
|
99
|
-
constructor(args) {
|
100
|
-
}
|
101
|
-
|
102
|
-
read (input) {
|
103
|
-
input.readStructBegin();
|
104
|
-
while (true) {
|
105
|
-
const ret = input.readFieldBegin();
|
106
|
-
const ftype = ret.ftype;
|
107
|
-
if (ftype == Thrift.Type.STOP) {
|
108
|
-
break;
|
109
|
-
}
|
110
|
-
input.skip(ftype);
|
111
|
-
input.readFieldEnd();
|
112
|
-
}
|
113
|
-
input.readStructEnd();
|
114
|
-
return;
|
115
|
-
}
|
116
|
-
|
117
|
-
write (output) {
|
118
|
-
output.writeStructBegin('Service_alive_args');
|
119
|
-
output.writeFieldStop();
|
120
|
-
output.writeStructEnd();
|
121
|
-
return;
|
122
|
-
}
|
123
|
-
|
124
|
-
};
|
125
|
-
const Service_alive_result = class {
|
126
|
-
constructor(args) {
|
127
|
-
this.success = null;
|
128
|
-
if (args) {
|
129
|
-
if (args.success !== undefined && args.success !== null) {
|
130
|
-
this.success = args.success;
|
131
|
-
}
|
132
|
-
}
|
133
|
-
}
|
134
|
-
|
135
|
-
read (input) {
|
136
|
-
input.readStructBegin();
|
137
|
-
while (true) {
|
138
|
-
const ret = input.readFieldBegin();
|
139
|
-
const ftype = ret.ftype;
|
140
|
-
const fid = ret.fid;
|
141
|
-
if (ftype == Thrift.Type.STOP) {
|
142
|
-
break;
|
143
|
-
}
|
144
|
-
switch (fid) {
|
145
|
-
case 0:
|
146
|
-
if (ftype == Thrift.Type.BOOL) {
|
147
|
-
this.success = input.readBool();
|
148
|
-
} else {
|
149
|
-
input.skip(ftype);
|
150
|
-
}
|
151
|
-
break;
|
152
|
-
case 0:
|
153
|
-
input.skip(ftype);
|
154
|
-
break;
|
155
|
-
default:
|
156
|
-
input.skip(ftype);
|
157
|
-
}
|
158
|
-
input.readFieldEnd();
|
159
|
-
}
|
160
|
-
input.readStructEnd();
|
161
|
-
return;
|
162
|
-
}
|
163
|
-
|
164
|
-
write (output) {
|
165
|
-
output.writeStructBegin('Service_alive_result');
|
166
|
-
if (this.success !== null && this.success !== undefined) {
|
167
|
-
output.writeFieldBegin('success', Thrift.Type.BOOL, 0);
|
168
|
-
output.writeBool(this.success);
|
169
|
-
output.writeFieldEnd();
|
170
|
-
}
|
171
|
-
output.writeFieldStop();
|
172
|
-
output.writeStructEnd();
|
173
|
-
return;
|
174
|
-
}
|
175
|
-
|
176
|
-
};
|
177
|
-
const ServiceClient = exports.Client = class ServiceClient {
|
178
|
-
constructor(output, pClass) {
|
179
|
-
this.output = output;
|
180
|
-
this.pClass = pClass;
|
181
|
-
this._seqid = 0;
|
182
|
-
this._reqs = {};
|
183
|
-
}
|
184
|
-
seqid () { return this._seqid; }
|
185
|
-
new_seqid () { return this._seqid += 1; }
|
186
|
-
|
187
|
-
about () {
|
188
|
-
this._seqid = this.new_seqid();
|
189
|
-
const self = this;
|
190
|
-
return new Promise((resolve, reject) => {
|
191
|
-
self._reqs[self.seqid()] = (error, result) => {
|
192
|
-
return error ? reject(error) : resolve(result);
|
193
|
-
};
|
194
|
-
self.send_about();
|
195
|
-
});
|
196
|
-
}
|
197
|
-
|
198
|
-
send_about () {
|
199
|
-
const output = new this.pClass(this.output);
|
200
|
-
const args = new Service_about_args();
|
201
|
-
try {
|
202
|
-
output.writeMessageBegin('about', Thrift.MessageType.CALL, this.seqid());
|
203
|
-
args.write(output);
|
204
|
-
output.writeMessageEnd();
|
205
|
-
return this.output.flush();
|
206
|
-
}
|
207
|
-
catch (e) {
|
208
|
-
delete this._reqs[this.seqid()];
|
209
|
-
if (typeof output.reset === 'function') {
|
210
|
-
output.reset();
|
211
|
-
}
|
212
|
-
throw e;
|
213
|
-
}
|
214
|
-
}
|
215
|
-
|
216
|
-
recv_about (input, mtype, rseqid) {
|
217
|
-
const callback = this._reqs[rseqid] || function() {};
|
218
|
-
delete this._reqs[rseqid];
|
219
|
-
if (mtype == Thrift.MessageType.EXCEPTION) {
|
220
|
-
const x = new Thrift.TApplicationException();
|
221
|
-
x.read(input);
|
222
|
-
input.readMessageEnd();
|
223
|
-
return callback(x);
|
224
|
-
}
|
225
|
-
const result = new Service_about_result();
|
226
|
-
result.read(input);
|
227
|
-
input.readMessageEnd();
|
228
|
-
|
229
|
-
if (null !== result.success) {
|
230
|
-
return callback(null, result.success);
|
231
|
-
}
|
232
|
-
return callback('about failed: unknown result');
|
233
|
-
}
|
234
|
-
|
235
|
-
alive () {
|
236
|
-
this._seqid = this.new_seqid();
|
237
|
-
const self = this;
|
238
|
-
return new Promise((resolve, reject) => {
|
239
|
-
self._reqs[self.seqid()] = (error, result) => {
|
240
|
-
return error ? reject(error) : resolve(result);
|
241
|
-
};
|
242
|
-
self.send_alive();
|
243
|
-
});
|
244
|
-
}
|
245
|
-
|
246
|
-
send_alive () {
|
247
|
-
const output = new this.pClass(this.output);
|
248
|
-
const args = new Service_alive_args();
|
249
|
-
try {
|
250
|
-
output.writeMessageBegin('alive', Thrift.MessageType.CALL, this.seqid());
|
251
|
-
args.write(output);
|
252
|
-
output.writeMessageEnd();
|
253
|
-
return this.output.flush();
|
254
|
-
}
|
255
|
-
catch (e) {
|
256
|
-
delete this._reqs[this.seqid()];
|
257
|
-
if (typeof output.reset === 'function') {
|
258
|
-
output.reset();
|
259
|
-
}
|
260
|
-
throw e;
|
261
|
-
}
|
262
|
-
}
|
263
|
-
|
264
|
-
recv_alive (input, mtype, rseqid) {
|
265
|
-
const callback = this._reqs[rseqid] || function() {};
|
266
|
-
delete this._reqs[rseqid];
|
267
|
-
if (mtype == Thrift.MessageType.EXCEPTION) {
|
268
|
-
const x = new Thrift.TApplicationException();
|
269
|
-
x.read(input);
|
270
|
-
input.readMessageEnd();
|
271
|
-
return callback(x);
|
272
|
-
}
|
273
|
-
const result = new Service_alive_result();
|
274
|
-
result.read(input);
|
275
|
-
input.readMessageEnd();
|
276
|
-
|
277
|
-
if (null !== result.success) {
|
278
|
-
return callback(null, result.success);
|
279
|
-
}
|
280
|
-
return callback('alive failed: unknown result');
|
281
|
-
}
|
282
|
-
};
|
283
|
-
const ServiceProcessor = exports.Processor = class ServiceProcessor {
|
284
|
-
constructor(handler) {
|
285
|
-
this._handler = handler;
|
286
|
-
}
|
287
|
-
process (input, output) {
|
288
|
-
const r = input.readMessageBegin();
|
289
|
-
if (this['process_' + r.fname]) {
|
290
|
-
return this['process_' + r.fname].call(this, r.rseqid, input, output);
|
291
|
-
} else {
|
292
|
-
input.skip(Thrift.Type.STRUCT);
|
293
|
-
input.readMessageEnd();
|
294
|
-
const x = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN_METHOD, 'Unknown function ' + r.fname);
|
295
|
-
output.writeMessageBegin(r.fname, Thrift.MessageType.EXCEPTION, r.rseqid);
|
296
|
-
x.write(output);
|
297
|
-
output.writeMessageEnd();
|
298
|
-
output.flush();
|
299
|
-
}
|
300
|
-
}
|
301
|
-
process_about (seqid, input, output) {
|
302
|
-
const args = new Service_about_args();
|
303
|
-
args.read(input);
|
304
|
-
input.readMessageEnd();
|
305
|
-
if (this._handler.about.length === 0) {
|
306
|
-
Promise.resolve(this._handler.about.bind(this._handler)(
|
307
|
-
)).then(result => {
|
308
|
-
const result_obj = new Service_about_result({success: result});
|
309
|
-
output.writeMessageBegin("about", Thrift.MessageType.REPLY, seqid);
|
310
|
-
result_obj.write(output);
|
311
|
-
output.writeMessageEnd();
|
312
|
-
output.flush();
|
313
|
-
}).catch(err => {
|
314
|
-
let result;
|
315
|
-
result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
|
316
|
-
output.writeMessageBegin("about", Thrift.MessageType.EXCEPTION, seqid);
|
317
|
-
result.write(output);
|
318
|
-
output.writeMessageEnd();
|
319
|
-
output.flush();
|
320
|
-
});
|
321
|
-
} else {
|
322
|
-
this._handler.about((err, result) => {
|
323
|
-
let result_obj;
|
324
|
-
if ((err === null || typeof err === 'undefined')) {
|
325
|
-
result_obj = new Service_about_result((err !== null || typeof err === 'undefined') ? err : {success: result});
|
326
|
-
output.writeMessageBegin("about", Thrift.MessageType.REPLY, seqid);
|
327
|
-
} else {
|
328
|
-
result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
|
329
|
-
output.writeMessageBegin("about", Thrift.MessageType.EXCEPTION, seqid);
|
330
|
-
}
|
331
|
-
result_obj.write(output);
|
332
|
-
output.writeMessageEnd();
|
333
|
-
output.flush();
|
334
|
-
});
|
335
|
-
}
|
336
|
-
}
|
337
|
-
process_alive (seqid, input, output) {
|
338
|
-
const args = new Service_alive_args();
|
339
|
-
args.read(input);
|
340
|
-
input.readMessageEnd();
|
341
|
-
if (this._handler.alive.length === 0) {
|
342
|
-
Promise.resolve(this._handler.alive.bind(this._handler)(
|
343
|
-
)).then(result => {
|
344
|
-
const result_obj = new Service_alive_result({success: result});
|
345
|
-
output.writeMessageBegin("alive", Thrift.MessageType.REPLY, seqid);
|
346
|
-
result_obj.write(output);
|
347
|
-
output.writeMessageEnd();
|
348
|
-
output.flush();
|
349
|
-
}).catch(err => {
|
350
|
-
let result;
|
351
|
-
result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
|
352
|
-
output.writeMessageBegin("alive", Thrift.MessageType.EXCEPTION, seqid);
|
353
|
-
result.write(output);
|
354
|
-
output.writeMessageEnd();
|
355
|
-
output.flush();
|
356
|
-
});
|
357
|
-
} else {
|
358
|
-
this._handler.alive((err, result) => {
|
359
|
-
let result_obj;
|
360
|
-
if ((err === null || typeof err === 'undefined')) {
|
361
|
-
result_obj = new Service_alive_result((err !== null || typeof err === 'undefined') ? err : {success: result});
|
362
|
-
output.writeMessageBegin("alive", Thrift.MessageType.REPLY, seqid);
|
363
|
-
} else {
|
364
|
-
result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
|
365
|
-
output.writeMessageBegin("alive", Thrift.MessageType.EXCEPTION, seqid);
|
366
|
-
}
|
367
|
-
result_obj.write(output);
|
368
|
-
output.writeMessageEnd();
|
369
|
-
output.flush();
|
370
|
-
});
|
371
|
-
}
|
372
|
-
}
|
373
|
-
};
|
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 uuid_ttypes = require('./uuid_types');
|
13
|
+
|
14
|
+
|
15
|
+
const ttypes = require('./services_types');
|
16
|
+
//HELPER FUNCTIONS AND STRUCTURES
|
17
|
+
|
18
|
+
const Service_about_args = class {
|
19
|
+
constructor(args) {
|
20
|
+
}
|
21
|
+
|
22
|
+
read (input) {
|
23
|
+
input.readStructBegin();
|
24
|
+
while (true) {
|
25
|
+
const ret = input.readFieldBegin();
|
26
|
+
const ftype = ret.ftype;
|
27
|
+
if (ftype == Thrift.Type.STOP) {
|
28
|
+
break;
|
29
|
+
}
|
30
|
+
input.skip(ftype);
|
31
|
+
input.readFieldEnd();
|
32
|
+
}
|
33
|
+
input.readStructEnd();
|
34
|
+
return;
|
35
|
+
}
|
36
|
+
|
37
|
+
write (output) {
|
38
|
+
output.writeStructBegin('Service_about_args');
|
39
|
+
output.writeFieldStop();
|
40
|
+
output.writeStructEnd();
|
41
|
+
return;
|
42
|
+
}
|
43
|
+
|
44
|
+
};
|
45
|
+
const Service_about_result = class {
|
46
|
+
constructor(args) {
|
47
|
+
this.success = null;
|
48
|
+
if (args) {
|
49
|
+
if (args.success !== undefined && args.success !== null) {
|
50
|
+
this.success = new ttypes.ServiceInfo(args.success);
|
51
|
+
}
|
52
|
+
}
|
53
|
+
}
|
54
|
+
|
55
|
+
read (input) {
|
56
|
+
input.readStructBegin();
|
57
|
+
while (true) {
|
58
|
+
const ret = input.readFieldBegin();
|
59
|
+
const ftype = ret.ftype;
|
60
|
+
const fid = ret.fid;
|
61
|
+
if (ftype == Thrift.Type.STOP) {
|
62
|
+
break;
|
63
|
+
}
|
64
|
+
switch (fid) {
|
65
|
+
case 0:
|
66
|
+
if (ftype == Thrift.Type.STRUCT) {
|
67
|
+
this.success = new ttypes.ServiceInfo();
|
68
|
+
this.success.read(input);
|
69
|
+
} else {
|
70
|
+
input.skip(ftype);
|
71
|
+
}
|
72
|
+
break;
|
73
|
+
case 0:
|
74
|
+
input.skip(ftype);
|
75
|
+
break;
|
76
|
+
default:
|
77
|
+
input.skip(ftype);
|
78
|
+
}
|
79
|
+
input.readFieldEnd();
|
80
|
+
}
|
81
|
+
input.readStructEnd();
|
82
|
+
return;
|
83
|
+
}
|
84
|
+
|
85
|
+
write (output) {
|
86
|
+
output.writeStructBegin('Service_about_result');
|
87
|
+
if (this.success !== null && this.success !== undefined) {
|
88
|
+
output.writeFieldBegin('success', Thrift.Type.STRUCT, 0);
|
89
|
+
this.success.write(output);
|
90
|
+
output.writeFieldEnd();
|
91
|
+
}
|
92
|
+
output.writeFieldStop();
|
93
|
+
output.writeStructEnd();
|
94
|
+
return;
|
95
|
+
}
|
96
|
+
|
97
|
+
};
|
98
|
+
const Service_alive_args = class {
|
99
|
+
constructor(args) {
|
100
|
+
}
|
101
|
+
|
102
|
+
read (input) {
|
103
|
+
input.readStructBegin();
|
104
|
+
while (true) {
|
105
|
+
const ret = input.readFieldBegin();
|
106
|
+
const ftype = ret.ftype;
|
107
|
+
if (ftype == Thrift.Type.STOP) {
|
108
|
+
break;
|
109
|
+
}
|
110
|
+
input.skip(ftype);
|
111
|
+
input.readFieldEnd();
|
112
|
+
}
|
113
|
+
input.readStructEnd();
|
114
|
+
return;
|
115
|
+
}
|
116
|
+
|
117
|
+
write (output) {
|
118
|
+
output.writeStructBegin('Service_alive_args');
|
119
|
+
output.writeFieldStop();
|
120
|
+
output.writeStructEnd();
|
121
|
+
return;
|
122
|
+
}
|
123
|
+
|
124
|
+
};
|
125
|
+
const Service_alive_result = class {
|
126
|
+
constructor(args) {
|
127
|
+
this.success = null;
|
128
|
+
if (args) {
|
129
|
+
if (args.success !== undefined && args.success !== null) {
|
130
|
+
this.success = args.success;
|
131
|
+
}
|
132
|
+
}
|
133
|
+
}
|
134
|
+
|
135
|
+
read (input) {
|
136
|
+
input.readStructBegin();
|
137
|
+
while (true) {
|
138
|
+
const ret = input.readFieldBegin();
|
139
|
+
const ftype = ret.ftype;
|
140
|
+
const fid = ret.fid;
|
141
|
+
if (ftype == Thrift.Type.STOP) {
|
142
|
+
break;
|
143
|
+
}
|
144
|
+
switch (fid) {
|
145
|
+
case 0:
|
146
|
+
if (ftype == Thrift.Type.BOOL) {
|
147
|
+
this.success = input.readBool();
|
148
|
+
} else {
|
149
|
+
input.skip(ftype);
|
150
|
+
}
|
151
|
+
break;
|
152
|
+
case 0:
|
153
|
+
input.skip(ftype);
|
154
|
+
break;
|
155
|
+
default:
|
156
|
+
input.skip(ftype);
|
157
|
+
}
|
158
|
+
input.readFieldEnd();
|
159
|
+
}
|
160
|
+
input.readStructEnd();
|
161
|
+
return;
|
162
|
+
}
|
163
|
+
|
164
|
+
write (output) {
|
165
|
+
output.writeStructBegin('Service_alive_result');
|
166
|
+
if (this.success !== null && this.success !== undefined) {
|
167
|
+
output.writeFieldBegin('success', Thrift.Type.BOOL, 0);
|
168
|
+
output.writeBool(this.success);
|
169
|
+
output.writeFieldEnd();
|
170
|
+
}
|
171
|
+
output.writeFieldStop();
|
172
|
+
output.writeStructEnd();
|
173
|
+
return;
|
174
|
+
}
|
175
|
+
|
176
|
+
};
|
177
|
+
const ServiceClient = exports.Client = class ServiceClient {
|
178
|
+
constructor(output, pClass) {
|
179
|
+
this.output = output;
|
180
|
+
this.pClass = pClass;
|
181
|
+
this._seqid = 0;
|
182
|
+
this._reqs = {};
|
183
|
+
}
|
184
|
+
seqid () { return this._seqid; }
|
185
|
+
new_seqid () { return this._seqid += 1; }
|
186
|
+
|
187
|
+
about () {
|
188
|
+
this._seqid = this.new_seqid();
|
189
|
+
const self = this;
|
190
|
+
return new Promise((resolve, reject) => {
|
191
|
+
self._reqs[self.seqid()] = (error, result) => {
|
192
|
+
return error ? reject(error) : resolve(result);
|
193
|
+
};
|
194
|
+
self.send_about();
|
195
|
+
});
|
196
|
+
}
|
197
|
+
|
198
|
+
send_about () {
|
199
|
+
const output = new this.pClass(this.output);
|
200
|
+
const args = new Service_about_args();
|
201
|
+
try {
|
202
|
+
output.writeMessageBegin('about', Thrift.MessageType.CALL, this.seqid());
|
203
|
+
args.write(output);
|
204
|
+
output.writeMessageEnd();
|
205
|
+
return this.output.flush();
|
206
|
+
}
|
207
|
+
catch (e) {
|
208
|
+
delete this._reqs[this.seqid()];
|
209
|
+
if (typeof output.reset === 'function') {
|
210
|
+
output.reset();
|
211
|
+
}
|
212
|
+
throw e;
|
213
|
+
}
|
214
|
+
}
|
215
|
+
|
216
|
+
recv_about (input, mtype, rseqid) {
|
217
|
+
const callback = this._reqs[rseqid] || function() {};
|
218
|
+
delete this._reqs[rseqid];
|
219
|
+
if (mtype == Thrift.MessageType.EXCEPTION) {
|
220
|
+
const x = new Thrift.TApplicationException();
|
221
|
+
x.read(input);
|
222
|
+
input.readMessageEnd();
|
223
|
+
return callback(x);
|
224
|
+
}
|
225
|
+
const result = new Service_about_result();
|
226
|
+
result.read(input);
|
227
|
+
input.readMessageEnd();
|
228
|
+
|
229
|
+
if (null !== result.success) {
|
230
|
+
return callback(null, result.success);
|
231
|
+
}
|
232
|
+
return callback('about failed: unknown result');
|
233
|
+
}
|
234
|
+
|
235
|
+
alive () {
|
236
|
+
this._seqid = this.new_seqid();
|
237
|
+
const self = this;
|
238
|
+
return new Promise((resolve, reject) => {
|
239
|
+
self._reqs[self.seqid()] = (error, result) => {
|
240
|
+
return error ? reject(error) : resolve(result);
|
241
|
+
};
|
242
|
+
self.send_alive();
|
243
|
+
});
|
244
|
+
}
|
245
|
+
|
246
|
+
send_alive () {
|
247
|
+
const output = new this.pClass(this.output);
|
248
|
+
const args = new Service_alive_args();
|
249
|
+
try {
|
250
|
+
output.writeMessageBegin('alive', Thrift.MessageType.CALL, this.seqid());
|
251
|
+
args.write(output);
|
252
|
+
output.writeMessageEnd();
|
253
|
+
return this.output.flush();
|
254
|
+
}
|
255
|
+
catch (e) {
|
256
|
+
delete this._reqs[this.seqid()];
|
257
|
+
if (typeof output.reset === 'function') {
|
258
|
+
output.reset();
|
259
|
+
}
|
260
|
+
throw e;
|
261
|
+
}
|
262
|
+
}
|
263
|
+
|
264
|
+
recv_alive (input, mtype, rseqid) {
|
265
|
+
const callback = this._reqs[rseqid] || function() {};
|
266
|
+
delete this._reqs[rseqid];
|
267
|
+
if (mtype == Thrift.MessageType.EXCEPTION) {
|
268
|
+
const x = new Thrift.TApplicationException();
|
269
|
+
x.read(input);
|
270
|
+
input.readMessageEnd();
|
271
|
+
return callback(x);
|
272
|
+
}
|
273
|
+
const result = new Service_alive_result();
|
274
|
+
result.read(input);
|
275
|
+
input.readMessageEnd();
|
276
|
+
|
277
|
+
if (null !== result.success) {
|
278
|
+
return callback(null, result.success);
|
279
|
+
}
|
280
|
+
return callback('alive failed: unknown result');
|
281
|
+
}
|
282
|
+
};
|
283
|
+
const ServiceProcessor = exports.Processor = class ServiceProcessor {
|
284
|
+
constructor(handler) {
|
285
|
+
this._handler = handler;
|
286
|
+
}
|
287
|
+
process (input, output) {
|
288
|
+
const r = input.readMessageBegin();
|
289
|
+
if (this['process_' + r.fname]) {
|
290
|
+
return this['process_' + r.fname].call(this, r.rseqid, input, output);
|
291
|
+
} else {
|
292
|
+
input.skip(Thrift.Type.STRUCT);
|
293
|
+
input.readMessageEnd();
|
294
|
+
const x = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN_METHOD, 'Unknown function ' + r.fname);
|
295
|
+
output.writeMessageBegin(r.fname, Thrift.MessageType.EXCEPTION, r.rseqid);
|
296
|
+
x.write(output);
|
297
|
+
output.writeMessageEnd();
|
298
|
+
output.flush();
|
299
|
+
}
|
300
|
+
}
|
301
|
+
process_about (seqid, input, output) {
|
302
|
+
const args = new Service_about_args();
|
303
|
+
args.read(input);
|
304
|
+
input.readMessageEnd();
|
305
|
+
if (this._handler.about.length === 0) {
|
306
|
+
Promise.resolve(this._handler.about.bind(this._handler)(
|
307
|
+
)).then(result => {
|
308
|
+
const result_obj = new Service_about_result({success: result});
|
309
|
+
output.writeMessageBegin("about", Thrift.MessageType.REPLY, seqid);
|
310
|
+
result_obj.write(output);
|
311
|
+
output.writeMessageEnd();
|
312
|
+
output.flush();
|
313
|
+
}).catch(err => {
|
314
|
+
let result;
|
315
|
+
result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
|
316
|
+
output.writeMessageBegin("about", Thrift.MessageType.EXCEPTION, seqid);
|
317
|
+
result.write(output);
|
318
|
+
output.writeMessageEnd();
|
319
|
+
output.flush();
|
320
|
+
});
|
321
|
+
} else {
|
322
|
+
this._handler.about((err, result) => {
|
323
|
+
let result_obj;
|
324
|
+
if ((err === null || typeof err === 'undefined')) {
|
325
|
+
result_obj = new Service_about_result((err !== null || typeof err === 'undefined') ? err : {success: result});
|
326
|
+
output.writeMessageBegin("about", Thrift.MessageType.REPLY, seqid);
|
327
|
+
} else {
|
328
|
+
result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
|
329
|
+
output.writeMessageBegin("about", Thrift.MessageType.EXCEPTION, seqid);
|
330
|
+
}
|
331
|
+
result_obj.write(output);
|
332
|
+
output.writeMessageEnd();
|
333
|
+
output.flush();
|
334
|
+
});
|
335
|
+
}
|
336
|
+
}
|
337
|
+
process_alive (seqid, input, output) {
|
338
|
+
const args = new Service_alive_args();
|
339
|
+
args.read(input);
|
340
|
+
input.readMessageEnd();
|
341
|
+
if (this._handler.alive.length === 0) {
|
342
|
+
Promise.resolve(this._handler.alive.bind(this._handler)(
|
343
|
+
)).then(result => {
|
344
|
+
const result_obj = new Service_alive_result({success: result});
|
345
|
+
output.writeMessageBegin("alive", Thrift.MessageType.REPLY, seqid);
|
346
|
+
result_obj.write(output);
|
347
|
+
output.writeMessageEnd();
|
348
|
+
output.flush();
|
349
|
+
}).catch(err => {
|
350
|
+
let result;
|
351
|
+
result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
|
352
|
+
output.writeMessageBegin("alive", Thrift.MessageType.EXCEPTION, seqid);
|
353
|
+
result.write(output);
|
354
|
+
output.writeMessageEnd();
|
355
|
+
output.flush();
|
356
|
+
});
|
357
|
+
} else {
|
358
|
+
this._handler.alive((err, result) => {
|
359
|
+
let result_obj;
|
360
|
+
if ((err === null || typeof err === 'undefined')) {
|
361
|
+
result_obj = new Service_alive_result((err !== null || typeof err === 'undefined') ? err : {success: result});
|
362
|
+
output.writeMessageBegin("alive", Thrift.MessageType.REPLY, seqid);
|
363
|
+
} else {
|
364
|
+
result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
|
365
|
+
output.writeMessageBegin("alive", Thrift.MessageType.EXCEPTION, seqid);
|
366
|
+
}
|
367
|
+
result_obj.write(output);
|
368
|
+
output.writeMessageEnd();
|
369
|
+
output.flush();
|
370
|
+
});
|
371
|
+
}
|
372
|
+
}
|
373
|
+
};
|