@ccmaymay/concrete 4.15.0
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 -0
- package/ActiveLearnerServerService.js +642 -0
- package/AnnotateCommunicationService.js +696 -0
- package/AnnotateWithContextService.js +298 -0
- package/FeedbackService.js +750 -0
- package/FetchCommunicationService.js +709 -0
- package/LICENSE +31 -0
- package/ResultsServerService.js +2138 -0
- package/SearchProxyService.js +962 -0
- package/SearchService.js +685 -0
- package/Service.js +373 -0
- package/StoreCommunicationService.js +255 -0
- package/SummarizationService.js +479 -0
- package/access_types.js +168 -0
- package/annotate_types.js +26 -0
- package/audio_types.js +110 -0
- package/cluster_types.js +398 -0
- package/communication_fu.js +432 -0
- package/communication_types.js +845 -0
- package/concrete.js +65 -0
- package/context_types.js +65 -0
- package/email_types.js +477 -0
- package/entities_types.js +658 -0
- package/ex_types.js +82 -0
- package/language_types.js +123 -0
- package/learn_types.js +207 -0
- package/linking_types.js +286 -0
- package/metadata_types.js +926 -0
- package/nitf_types.js +1005 -0
- package/package.json +23 -0
- package/results_types.js +18 -0
- package/search_types.js +661 -0
- package/services_types.js +384 -0
- package/situations_types.js +1268 -0
- package/spans_types.js +151 -0
- package/structure_types.js +2311 -0
- package/summarization_types.js +433 -0
- package/tokenization_fu.js +33 -0
- package/tokentagging_fu.js +241 -0
- package/twitter_types.js +1553 -0
- package/util.js +118 -0
- package/uuid_types.js +67 -0
package/Service.js
ADDED
@@ -0,0 +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
|
+
};
|
@@ -0,0 +1,255 @@
|
|
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 StoreCommunicationService_store_args = class {
|
23
|
+
constructor(args) {
|
24
|
+
this.communication = null;
|
25
|
+
if (args) {
|
26
|
+
if (args.communication !== undefined && args.communication !== null) {
|
27
|
+
this.communication = new communication_ttypes.Communication(args.communication);
|
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.communication = new communication_ttypes.Communication();
|
45
|
+
this.communication.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('StoreCommunicationService_store_args');
|
64
|
+
if (this.communication !== null && this.communication !== undefined) {
|
65
|
+
output.writeFieldBegin('communication', Thrift.Type.STRUCT, 1);
|
66
|
+
this.communication.write(output);
|
67
|
+
output.writeFieldEnd();
|
68
|
+
}
|
69
|
+
output.writeFieldStop();
|
70
|
+
output.writeStructEnd();
|
71
|
+
return;
|
72
|
+
}
|
73
|
+
|
74
|
+
};
|
75
|
+
const StoreCommunicationService_store_result = class {
|
76
|
+
constructor(args) {
|
77
|
+
this.ex = null;
|
78
|
+
if (args instanceof services_ttypes.ServicesException) {
|
79
|
+
this.ex = args;
|
80
|
+
return;
|
81
|
+
}
|
82
|
+
if (args) {
|
83
|
+
if (args.ex !== undefined && args.ex !== null) {
|
84
|
+
this.ex = args.ex;
|
85
|
+
}
|
86
|
+
}
|
87
|
+
}
|
88
|
+
|
89
|
+
read (input) {
|
90
|
+
input.readStructBegin();
|
91
|
+
while (true) {
|
92
|
+
const ret = input.readFieldBegin();
|
93
|
+
const ftype = ret.ftype;
|
94
|
+
const fid = ret.fid;
|
95
|
+
if (ftype == Thrift.Type.STOP) {
|
96
|
+
break;
|
97
|
+
}
|
98
|
+
switch (fid) {
|
99
|
+
case 1:
|
100
|
+
if (ftype == Thrift.Type.STRUCT) {
|
101
|
+
this.ex = new services_ttypes.ServicesException();
|
102
|
+
this.ex.read(input);
|
103
|
+
} else {
|
104
|
+
input.skip(ftype);
|
105
|
+
}
|
106
|
+
break;
|
107
|
+
case 0:
|
108
|
+
input.skip(ftype);
|
109
|
+
break;
|
110
|
+
default:
|
111
|
+
input.skip(ftype);
|
112
|
+
}
|
113
|
+
input.readFieldEnd();
|
114
|
+
}
|
115
|
+
input.readStructEnd();
|
116
|
+
return;
|
117
|
+
}
|
118
|
+
|
119
|
+
write (output) {
|
120
|
+
output.writeStructBegin('StoreCommunicationService_store_result');
|
121
|
+
if (this.ex !== null && this.ex !== undefined) {
|
122
|
+
output.writeFieldBegin('ex', Thrift.Type.STRUCT, 1);
|
123
|
+
this.ex.write(output);
|
124
|
+
output.writeFieldEnd();
|
125
|
+
}
|
126
|
+
output.writeFieldStop();
|
127
|
+
output.writeStructEnd();
|
128
|
+
return;
|
129
|
+
}
|
130
|
+
|
131
|
+
};
|
132
|
+
const StoreCommunicationServiceClient = exports.Client = class StoreCommunicationServiceClient extends ServiceClient {
|
133
|
+
constructor(output, pClass) {
|
134
|
+
super(output, pClass);
|
135
|
+
this.output = output;
|
136
|
+
this.pClass = pClass;
|
137
|
+
this._seqid = 0;
|
138
|
+
this._reqs = {};
|
139
|
+
}
|
140
|
+
seqid () { return this._seqid; }
|
141
|
+
new_seqid () { return this._seqid += 1; }
|
142
|
+
|
143
|
+
store (communication) {
|
144
|
+
this._seqid = this.new_seqid();
|
145
|
+
const self = this;
|
146
|
+
return new Promise((resolve, reject) => {
|
147
|
+
self._reqs[self.seqid()] = (error, result) => {
|
148
|
+
return error ? reject(error) : resolve(result);
|
149
|
+
};
|
150
|
+
self.send_store(communication);
|
151
|
+
});
|
152
|
+
}
|
153
|
+
|
154
|
+
send_store (communication) {
|
155
|
+
const output = new this.pClass(this.output);
|
156
|
+
const params = {
|
157
|
+
communication: communication
|
158
|
+
};
|
159
|
+
const args = new StoreCommunicationService_store_args(params);
|
160
|
+
try {
|
161
|
+
output.writeMessageBegin('store', Thrift.MessageType.CALL, this.seqid());
|
162
|
+
args.write(output);
|
163
|
+
output.writeMessageEnd();
|
164
|
+
return this.output.flush();
|
165
|
+
}
|
166
|
+
catch (e) {
|
167
|
+
delete this._reqs[this.seqid()];
|
168
|
+
if (typeof output.reset === 'function') {
|
169
|
+
output.reset();
|
170
|
+
}
|
171
|
+
throw e;
|
172
|
+
}
|
173
|
+
}
|
174
|
+
|
175
|
+
recv_store (input, mtype, rseqid) {
|
176
|
+
const callback = this._reqs[rseqid] || function() {};
|
177
|
+
delete this._reqs[rseqid];
|
178
|
+
if (mtype == Thrift.MessageType.EXCEPTION) {
|
179
|
+
const x = new Thrift.TApplicationException();
|
180
|
+
x.read(input);
|
181
|
+
input.readMessageEnd();
|
182
|
+
return callback(x);
|
183
|
+
}
|
184
|
+
const result = new StoreCommunicationService_store_result();
|
185
|
+
result.read(input);
|
186
|
+
input.readMessageEnd();
|
187
|
+
|
188
|
+
if (null !== result.ex) {
|
189
|
+
return callback(result.ex);
|
190
|
+
}
|
191
|
+
callback(null);
|
192
|
+
}
|
193
|
+
};
|
194
|
+
const StoreCommunicationServiceProcessor = exports.Processor = class StoreCommunicationServiceProcessor extends ServiceProcessor {
|
195
|
+
constructor(handler) {
|
196
|
+
super(handler);
|
197
|
+
this._handler = handler;
|
198
|
+
}
|
199
|
+
process (input, output) {
|
200
|
+
const r = input.readMessageBegin();
|
201
|
+
if (this['process_' + r.fname]) {
|
202
|
+
return this['process_' + r.fname].call(this, r.rseqid, input, output);
|
203
|
+
} else {
|
204
|
+
input.skip(Thrift.Type.STRUCT);
|
205
|
+
input.readMessageEnd();
|
206
|
+
const x = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN_METHOD, 'Unknown function ' + r.fname);
|
207
|
+
output.writeMessageBegin(r.fname, Thrift.MessageType.EXCEPTION, r.rseqid);
|
208
|
+
x.write(output);
|
209
|
+
output.writeMessageEnd();
|
210
|
+
output.flush();
|
211
|
+
}
|
212
|
+
}
|
213
|
+
process_store (seqid, input, output) {
|
214
|
+
const args = new StoreCommunicationService_store_args();
|
215
|
+
args.read(input);
|
216
|
+
input.readMessageEnd();
|
217
|
+
if (this._handler.store.length === 1) {
|
218
|
+
Promise.resolve(this._handler.store.bind(this._handler)(
|
219
|
+
args.communication
|
220
|
+
)).then(result => {
|
221
|
+
const result_obj = new StoreCommunicationService_store_result({success: result});
|
222
|
+
output.writeMessageBegin("store", Thrift.MessageType.REPLY, seqid);
|
223
|
+
result_obj.write(output);
|
224
|
+
output.writeMessageEnd();
|
225
|
+
output.flush();
|
226
|
+
}).catch(err => {
|
227
|
+
let result;
|
228
|
+
if (err instanceof services_ttypes.ServicesException) {
|
229
|
+
result = new StoreCommunicationService_store_result(err);
|
230
|
+
output.writeMessageBegin("store", Thrift.MessageType.REPLY, seqid);
|
231
|
+
} else {
|
232
|
+
result = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
|
233
|
+
output.writeMessageBegin("store", Thrift.MessageType.EXCEPTION, seqid);
|
234
|
+
}
|
235
|
+
result.write(output);
|
236
|
+
output.writeMessageEnd();
|
237
|
+
output.flush();
|
238
|
+
});
|
239
|
+
} else {
|
240
|
+
this._handler.store(args.communication, (err, result) => {
|
241
|
+
let result_obj;
|
242
|
+
if ((err === null || typeof err === 'undefined') || err instanceof services_ttypes.ServicesException) {
|
243
|
+
result_obj = new StoreCommunicationService_store_result((err !== null || typeof err === 'undefined') ? err : {success: result});
|
244
|
+
output.writeMessageBegin("store", Thrift.MessageType.REPLY, seqid);
|
245
|
+
} else {
|
246
|
+
result_obj = new Thrift.TApplicationException(Thrift.TApplicationExceptionType.UNKNOWN, err.message);
|
247
|
+
output.writeMessageBegin("store", Thrift.MessageType.EXCEPTION, seqid);
|
248
|
+
}
|
249
|
+
result_obj.write(output);
|
250
|
+
output.writeMessageEnd();
|
251
|
+
output.flush();
|
252
|
+
});
|
253
|
+
}
|
254
|
+
}
|
255
|
+
};
|