@guardian/bridget 8.8.0 → 8.9.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/Audio.d.ts ADDED
@@ -0,0 +1,134 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ import * as thrift from "@creditkarma/thrift-server-core";
4
+ export declare const serviceName: string;
5
+ export declare const annotations: thrift.IThriftAnnotations;
6
+ export declare const methodAnnotations: thrift.IMethodAnnotations;
7
+ export declare const methodNames: Array<string>;
8
+ export declare const methodParameters: {
9
+ [methodName: string]: number;
10
+ };
11
+ export interface IIsAvailable__Args {
12
+ }
13
+ export interface IIsAvailable__ArgsArgs {
14
+ }
15
+ export declare const IsAvailable__ArgsCodec: thrift.IStructCodec<IIsAvailable__ArgsArgs, IIsAvailable__Args>;
16
+ export declare class IsAvailable__Args extends thrift.StructLike implements IIsAvailable__Args {
17
+ readonly _annotations: thrift.IThriftAnnotations;
18
+ readonly _fieldAnnotations: thrift.IFieldAnnotations;
19
+ constructor(args?: IIsAvailable__ArgsArgs);
20
+ static read(input: thrift.TProtocol): IsAvailable__Args;
21
+ static write(args: IIsAvailable__ArgsArgs, output: thrift.TProtocol): void;
22
+ write(output: thrift.TProtocol): void;
23
+ }
24
+ export interface IPlay__Args {
25
+ }
26
+ export interface IPlay__ArgsArgs {
27
+ }
28
+ export declare const Play__ArgsCodec: thrift.IStructCodec<IPlay__ArgsArgs, IPlay__Args>;
29
+ export declare class Play__Args extends thrift.StructLike implements IPlay__Args {
30
+ readonly _annotations: thrift.IThriftAnnotations;
31
+ readonly _fieldAnnotations: thrift.IFieldAnnotations;
32
+ constructor(args?: IPlay__ArgsArgs);
33
+ static read(input: thrift.TProtocol): Play__Args;
34
+ static write(args: IPlay__ArgsArgs, output: thrift.TProtocol): void;
35
+ write(output: thrift.TProtocol): void;
36
+ }
37
+ export interface IIsPlaying__Args {
38
+ }
39
+ export interface IIsPlaying__ArgsArgs {
40
+ }
41
+ export declare const IsPlaying__ArgsCodec: thrift.IStructCodec<IIsPlaying__ArgsArgs, IIsPlaying__Args>;
42
+ export declare class IsPlaying__Args extends thrift.StructLike implements IIsPlaying__Args {
43
+ readonly _annotations: thrift.IThriftAnnotations;
44
+ readonly _fieldAnnotations: thrift.IFieldAnnotations;
45
+ constructor(args?: IIsPlaying__ArgsArgs);
46
+ static read(input: thrift.TProtocol): IsPlaying__Args;
47
+ static write(args: IIsPlaying__ArgsArgs, output: thrift.TProtocol): void;
48
+ write(output: thrift.TProtocol): void;
49
+ }
50
+ export interface IIsAvailable__Result {
51
+ success?: boolean;
52
+ }
53
+ export interface IIsAvailable__ResultArgs {
54
+ success?: boolean;
55
+ }
56
+ export declare const IsAvailable__ResultCodec: thrift.IStructCodec<IIsAvailable__ResultArgs, IIsAvailable__Result>;
57
+ export declare class IsAvailable__Result extends thrift.StructLike implements IIsAvailable__Result {
58
+ success?: boolean;
59
+ readonly _annotations: thrift.IThriftAnnotations;
60
+ readonly _fieldAnnotations: thrift.IFieldAnnotations;
61
+ constructor(args?: IIsAvailable__ResultArgs);
62
+ static read(input: thrift.TProtocol): IsAvailable__Result;
63
+ static write(args: IIsAvailable__ResultArgs, output: thrift.TProtocol): void;
64
+ write(output: thrift.TProtocol): void;
65
+ }
66
+ export interface IPlay__Result {
67
+ success?: void;
68
+ }
69
+ export interface IPlay__ResultArgs {
70
+ success?: void;
71
+ }
72
+ export declare const Play__ResultCodec: thrift.IStructCodec<IPlay__ResultArgs, IPlay__Result>;
73
+ export declare class Play__Result extends thrift.StructLike implements IPlay__Result {
74
+ success?: void;
75
+ readonly _annotations: thrift.IThriftAnnotations;
76
+ readonly _fieldAnnotations: thrift.IFieldAnnotations;
77
+ constructor(args?: IPlay__ResultArgs);
78
+ static read(input: thrift.TProtocol): Play__Result;
79
+ static write(args: IPlay__ResultArgs, output: thrift.TProtocol): void;
80
+ write(output: thrift.TProtocol): void;
81
+ }
82
+ export interface IIsPlaying__Result {
83
+ success?: boolean;
84
+ }
85
+ export interface IIsPlaying__ResultArgs {
86
+ success?: boolean;
87
+ }
88
+ export declare const IsPlaying__ResultCodec: thrift.IStructCodec<IIsPlaying__ResultArgs, IIsPlaying__Result>;
89
+ export declare class IsPlaying__Result extends thrift.StructLike implements IIsPlaying__Result {
90
+ success?: boolean;
91
+ readonly _annotations: thrift.IThriftAnnotations;
92
+ readonly _fieldAnnotations: thrift.IFieldAnnotations;
93
+ constructor(args?: IIsPlaying__ResultArgs);
94
+ static read(input: thrift.TProtocol): IsPlaying__Result;
95
+ static write(args: IIsPlaying__ResultArgs, output: thrift.TProtocol): void;
96
+ write(output: thrift.TProtocol): void;
97
+ }
98
+ export declare class Client<Context = any> extends thrift.ThriftClient<Context> {
99
+ static readonly serviceName: string;
100
+ static readonly annotations: thrift.IThriftAnnotations;
101
+ static readonly methodAnnotations: thrift.IMethodAnnotations;
102
+ static readonly methodNames: Array<string>;
103
+ readonly _serviceName: string;
104
+ readonly _annotations: thrift.IThriftAnnotations;
105
+ readonly _methodAnnotations: thrift.IMethodAnnotations;
106
+ readonly _methodNames: Array<string>;
107
+ readonly _methodParameters?: {
108
+ [methodName: string]: number;
109
+ };
110
+ isAvailable(context?: Context): Promise<boolean>;
111
+ play(context?: Context): Promise<void>;
112
+ isPlaying(context?: Context): Promise<boolean>;
113
+ }
114
+ export interface IHandler<Context = any> {
115
+ isAvailable(context?: Context): boolean | Promise<boolean>;
116
+ play(context?: Context): void | Promise<void>;
117
+ isPlaying(context?: Context): boolean | Promise<boolean>;
118
+ }
119
+ export declare class Processor<Context = any> extends thrift.ThriftProcessor<Context, IHandler<Context>> {
120
+ protected readonly _handler: IHandler<Context>;
121
+ static readonly serviceName: string;
122
+ static readonly annotations: thrift.IThriftAnnotations;
123
+ static readonly methodAnnotations: thrift.IMethodAnnotations;
124
+ static readonly methodNames: Array<string>;
125
+ readonly _serviceName: string;
126
+ readonly _annotations: thrift.IThriftAnnotations;
127
+ readonly _methodAnnotations: thrift.IMethodAnnotations;
128
+ readonly _methodNames: Array<string>;
129
+ constructor(handler: IHandler<Context>);
130
+ process(input: thrift.TProtocol, output: thrift.TProtocol, context: Context): Promise<Buffer>;
131
+ process_isAvailable(requestId: number, input: thrift.TProtocol, output: thrift.TProtocol, context: Context): Promise<Buffer>;
132
+ process_play(requestId: number, input: thrift.TProtocol, output: thrift.TProtocol, context: Context): Promise<Buffer>;
133
+ process_isPlaying(requestId: number, input: thrift.TProtocol, output: thrift.TProtocol, context: Context): Promise<Buffer>;
134
+ }
package/Audio.js ADDED
@@ -0,0 +1,623 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.Processor = exports.Client = exports.IsPlaying__Result = exports.IsPlaying__ResultCodec = exports.Play__Result = exports.Play__ResultCodec = exports.IsAvailable__Result = exports.IsAvailable__ResultCodec = exports.IsPlaying__Args = exports.IsPlaying__ArgsCodec = exports.Play__Args = exports.Play__ArgsCodec = exports.IsAvailable__Args = exports.IsAvailable__ArgsCodec = exports.methodParameters = exports.methodNames = exports.methodAnnotations = exports.annotations = exports.serviceName = void 0;
27
+ /* tslint:disable */
28
+ /* eslint-disable */
29
+ /*
30
+ * Autogenerated by @creditkarma/thrift-typescript v3.7.6
31
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
32
+ */
33
+ const thrift = __importStar(require("@creditkarma/thrift-server-core"));
34
+ exports.serviceName = "Audio";
35
+ exports.annotations = {};
36
+ exports.methodAnnotations = {
37
+ isAvailable: {
38
+ annotations: {},
39
+ fieldAnnotations: {}
40
+ },
41
+ play: {
42
+ annotations: {},
43
+ fieldAnnotations: {}
44
+ },
45
+ isPlaying: {
46
+ annotations: {},
47
+ fieldAnnotations: {}
48
+ }
49
+ };
50
+ exports.methodNames = ["isAvailable", "play", "isPlaying"];
51
+ exports.methodParameters = {
52
+ isAvailable: 1,
53
+ play: 1,
54
+ isPlaying: 1
55
+ };
56
+ exports.IsAvailable__ArgsCodec = {
57
+ encode(args, output) {
58
+ output.writeStructBegin("IsAvailable__Args");
59
+ output.writeFieldStop();
60
+ output.writeStructEnd();
61
+ return;
62
+ },
63
+ decode(input) {
64
+ input.readStructBegin();
65
+ while (true) {
66
+ const ret = input.readFieldBegin();
67
+ const fieldType = ret.fieldType;
68
+ const fieldId = ret.fieldId;
69
+ if (fieldType === thrift.TType.STOP) {
70
+ break;
71
+ }
72
+ switch (fieldId) {
73
+ default: {
74
+ input.skip(fieldType);
75
+ }
76
+ }
77
+ input.readFieldEnd();
78
+ }
79
+ input.readStructEnd();
80
+ return {};
81
+ }
82
+ };
83
+ class IsAvailable__Args extends thrift.StructLike {
84
+ constructor(args = {}) {
85
+ super();
86
+ this._annotations = {};
87
+ this._fieldAnnotations = {};
88
+ }
89
+ static read(input) {
90
+ return new IsAvailable__Args(exports.IsAvailable__ArgsCodec.decode(input));
91
+ }
92
+ static write(args, output) {
93
+ return exports.IsAvailable__ArgsCodec.encode(args, output);
94
+ }
95
+ write(output) {
96
+ return exports.IsAvailable__ArgsCodec.encode(this, output);
97
+ }
98
+ }
99
+ exports.IsAvailable__Args = IsAvailable__Args;
100
+ exports.Play__ArgsCodec = {
101
+ encode(args, output) {
102
+ output.writeStructBegin("Play__Args");
103
+ output.writeFieldStop();
104
+ output.writeStructEnd();
105
+ return;
106
+ },
107
+ decode(input) {
108
+ input.readStructBegin();
109
+ while (true) {
110
+ const ret = input.readFieldBegin();
111
+ const fieldType = ret.fieldType;
112
+ const fieldId = ret.fieldId;
113
+ if (fieldType === thrift.TType.STOP) {
114
+ break;
115
+ }
116
+ switch (fieldId) {
117
+ default: {
118
+ input.skip(fieldType);
119
+ }
120
+ }
121
+ input.readFieldEnd();
122
+ }
123
+ input.readStructEnd();
124
+ return {};
125
+ }
126
+ };
127
+ class Play__Args extends thrift.StructLike {
128
+ constructor(args = {}) {
129
+ super();
130
+ this._annotations = {};
131
+ this._fieldAnnotations = {};
132
+ }
133
+ static read(input) {
134
+ return new Play__Args(exports.Play__ArgsCodec.decode(input));
135
+ }
136
+ static write(args, output) {
137
+ return exports.Play__ArgsCodec.encode(args, output);
138
+ }
139
+ write(output) {
140
+ return exports.Play__ArgsCodec.encode(this, output);
141
+ }
142
+ }
143
+ exports.Play__Args = Play__Args;
144
+ exports.IsPlaying__ArgsCodec = {
145
+ encode(args, output) {
146
+ output.writeStructBegin("IsPlaying__Args");
147
+ output.writeFieldStop();
148
+ output.writeStructEnd();
149
+ return;
150
+ },
151
+ decode(input) {
152
+ input.readStructBegin();
153
+ while (true) {
154
+ const ret = input.readFieldBegin();
155
+ const fieldType = ret.fieldType;
156
+ const fieldId = ret.fieldId;
157
+ if (fieldType === thrift.TType.STOP) {
158
+ break;
159
+ }
160
+ switch (fieldId) {
161
+ default: {
162
+ input.skip(fieldType);
163
+ }
164
+ }
165
+ input.readFieldEnd();
166
+ }
167
+ input.readStructEnd();
168
+ return {};
169
+ }
170
+ };
171
+ class IsPlaying__Args extends thrift.StructLike {
172
+ constructor(args = {}) {
173
+ super();
174
+ this._annotations = {};
175
+ this._fieldAnnotations = {};
176
+ }
177
+ static read(input) {
178
+ return new IsPlaying__Args(exports.IsPlaying__ArgsCodec.decode(input));
179
+ }
180
+ static write(args, output) {
181
+ return exports.IsPlaying__ArgsCodec.encode(args, output);
182
+ }
183
+ write(output) {
184
+ return exports.IsPlaying__ArgsCodec.encode(this, output);
185
+ }
186
+ }
187
+ exports.IsPlaying__Args = IsPlaying__Args;
188
+ exports.IsAvailable__ResultCodec = {
189
+ encode(args, output) {
190
+ const obj = {
191
+ success: args.success
192
+ };
193
+ output.writeStructBegin("IsAvailable__Result");
194
+ if (obj.success != null) {
195
+ output.writeFieldBegin("success", thrift.TType.BOOL, 0);
196
+ output.writeBool(obj.success);
197
+ output.writeFieldEnd();
198
+ }
199
+ output.writeFieldStop();
200
+ output.writeStructEnd();
201
+ return;
202
+ },
203
+ decode(input) {
204
+ let _args = {};
205
+ input.readStructBegin();
206
+ while (true) {
207
+ const ret = input.readFieldBegin();
208
+ const fieldType = ret.fieldType;
209
+ const fieldId = ret.fieldId;
210
+ if (fieldType === thrift.TType.STOP) {
211
+ break;
212
+ }
213
+ switch (fieldId) {
214
+ case 0:
215
+ if (fieldType === thrift.TType.BOOL) {
216
+ const value_1 = input.readBool();
217
+ _args.success = value_1;
218
+ }
219
+ else {
220
+ input.skip(fieldType);
221
+ }
222
+ break;
223
+ default: {
224
+ input.skip(fieldType);
225
+ }
226
+ }
227
+ input.readFieldEnd();
228
+ }
229
+ input.readStructEnd();
230
+ return {
231
+ success: _args.success
232
+ };
233
+ }
234
+ };
235
+ class IsAvailable__Result extends thrift.StructLike {
236
+ constructor(args = {}) {
237
+ super();
238
+ this._annotations = {};
239
+ this._fieldAnnotations = {};
240
+ if (args.success != null) {
241
+ const value_2 = args.success;
242
+ this.success = value_2;
243
+ }
244
+ }
245
+ static read(input) {
246
+ return new IsAvailable__Result(exports.IsAvailable__ResultCodec.decode(input));
247
+ }
248
+ static write(args, output) {
249
+ return exports.IsAvailable__ResultCodec.encode(args, output);
250
+ }
251
+ write(output) {
252
+ return exports.IsAvailable__ResultCodec.encode(this, output);
253
+ }
254
+ }
255
+ exports.IsAvailable__Result = IsAvailable__Result;
256
+ exports.Play__ResultCodec = {
257
+ encode(args, output) {
258
+ output.writeStructBegin("Play__Result");
259
+ output.writeFieldStop();
260
+ output.writeStructEnd();
261
+ return;
262
+ },
263
+ decode(input) {
264
+ let _args = {};
265
+ input.readStructBegin();
266
+ while (true) {
267
+ const ret = input.readFieldBegin();
268
+ const fieldType = ret.fieldType;
269
+ const fieldId = ret.fieldId;
270
+ if (fieldType === thrift.TType.STOP) {
271
+ break;
272
+ }
273
+ switch (fieldId) {
274
+ case 0:
275
+ if (fieldType === thrift.TType.VOID) {
276
+ input.skip(fieldType);
277
+ }
278
+ else {
279
+ input.skip(fieldType);
280
+ }
281
+ break;
282
+ default: {
283
+ input.skip(fieldType);
284
+ }
285
+ }
286
+ input.readFieldEnd();
287
+ }
288
+ input.readStructEnd();
289
+ return {
290
+ success: _args.success
291
+ };
292
+ }
293
+ };
294
+ class Play__Result extends thrift.StructLike {
295
+ constructor(args = {}) {
296
+ super();
297
+ this._annotations = {};
298
+ this._fieldAnnotations = {};
299
+ if (args.success != null) {
300
+ const value_3 = undefined;
301
+ this.success = value_3;
302
+ }
303
+ }
304
+ static read(input) {
305
+ return new Play__Result(exports.Play__ResultCodec.decode(input));
306
+ }
307
+ static write(args, output) {
308
+ return exports.Play__ResultCodec.encode(args, output);
309
+ }
310
+ write(output) {
311
+ return exports.Play__ResultCodec.encode(this, output);
312
+ }
313
+ }
314
+ exports.Play__Result = Play__Result;
315
+ exports.IsPlaying__ResultCodec = {
316
+ encode(args, output) {
317
+ const obj = {
318
+ success: args.success
319
+ };
320
+ output.writeStructBegin("IsPlaying__Result");
321
+ if (obj.success != null) {
322
+ output.writeFieldBegin("success", thrift.TType.BOOL, 0);
323
+ output.writeBool(obj.success);
324
+ output.writeFieldEnd();
325
+ }
326
+ output.writeFieldStop();
327
+ output.writeStructEnd();
328
+ return;
329
+ },
330
+ decode(input) {
331
+ let _args = {};
332
+ input.readStructBegin();
333
+ while (true) {
334
+ const ret = input.readFieldBegin();
335
+ const fieldType = ret.fieldType;
336
+ const fieldId = ret.fieldId;
337
+ if (fieldType === thrift.TType.STOP) {
338
+ break;
339
+ }
340
+ switch (fieldId) {
341
+ case 0:
342
+ if (fieldType === thrift.TType.BOOL) {
343
+ const value_4 = input.readBool();
344
+ _args.success = value_4;
345
+ }
346
+ else {
347
+ input.skip(fieldType);
348
+ }
349
+ break;
350
+ default: {
351
+ input.skip(fieldType);
352
+ }
353
+ }
354
+ input.readFieldEnd();
355
+ }
356
+ input.readStructEnd();
357
+ return {
358
+ success: _args.success
359
+ };
360
+ }
361
+ };
362
+ class IsPlaying__Result extends thrift.StructLike {
363
+ constructor(args = {}) {
364
+ super();
365
+ this._annotations = {};
366
+ this._fieldAnnotations = {};
367
+ if (args.success != null) {
368
+ const value_5 = args.success;
369
+ this.success = value_5;
370
+ }
371
+ }
372
+ static read(input) {
373
+ return new IsPlaying__Result(exports.IsPlaying__ResultCodec.decode(input));
374
+ }
375
+ static write(args, output) {
376
+ return exports.IsPlaying__ResultCodec.encode(args, output);
377
+ }
378
+ write(output) {
379
+ return exports.IsPlaying__ResultCodec.encode(this, output);
380
+ }
381
+ }
382
+ exports.IsPlaying__Result = IsPlaying__Result;
383
+ class Client extends thrift.ThriftClient {
384
+ constructor() {
385
+ super(...arguments);
386
+ this._serviceName = exports.serviceName;
387
+ this._annotations = exports.annotations;
388
+ this._methodAnnotations = exports.methodAnnotations;
389
+ this._methodNames = exports.methodNames;
390
+ this._methodParameters = exports.methodParameters;
391
+ }
392
+ isAvailable(context) {
393
+ const writer = new this.transport();
394
+ const output = new this.protocol(writer);
395
+ output.writeMessageBegin("isAvailable", thrift.MessageType.CALL, this.incrementRequestId());
396
+ const args = {};
397
+ exports.IsAvailable__ArgsCodec.encode(args, output);
398
+ output.writeMessageEnd();
399
+ return this.connection.send(writer.flush(), context).then((data) => {
400
+ const reader = this.transport.receiver(data);
401
+ const input = new this.protocol(reader);
402
+ try {
403
+ const { fieldName: fieldName, messageType: messageType } = input.readMessageBegin();
404
+ if (fieldName === "isAvailable") {
405
+ if (messageType === thrift.MessageType.EXCEPTION) {
406
+ const err = thrift.TApplicationExceptionCodec.decode(input);
407
+ input.readMessageEnd();
408
+ return Promise.reject(err);
409
+ }
410
+ else {
411
+ const result = exports.IsAvailable__ResultCodec.decode(input);
412
+ input.readMessageEnd();
413
+ if (result.success != null) {
414
+ return Promise.resolve(result.success);
415
+ }
416
+ else {
417
+ return Promise.reject(new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, "isAvailable failed: unknown result"));
418
+ }
419
+ }
420
+ }
421
+ else {
422
+ return Promise.reject(new thrift.TApplicationException(thrift.TApplicationExceptionType.WRONG_METHOD_NAME, "Received a response to an unknown RPC function: " + fieldName));
423
+ }
424
+ }
425
+ catch (err) {
426
+ return Promise.reject(err);
427
+ }
428
+ });
429
+ }
430
+ play(context) {
431
+ const writer = new this.transport();
432
+ const output = new this.protocol(writer);
433
+ output.writeMessageBegin("play", thrift.MessageType.CALL, this.incrementRequestId());
434
+ const args = {};
435
+ exports.Play__ArgsCodec.encode(args, output);
436
+ output.writeMessageEnd();
437
+ return this.connection.send(writer.flush(), context).then((data) => {
438
+ const reader = this.transport.receiver(data);
439
+ const input = new this.protocol(reader);
440
+ try {
441
+ const { fieldName: fieldName, messageType: messageType } = input.readMessageBegin();
442
+ if (fieldName === "play") {
443
+ if (messageType === thrift.MessageType.EXCEPTION) {
444
+ const err = thrift.TApplicationExceptionCodec.decode(input);
445
+ input.readMessageEnd();
446
+ return Promise.reject(err);
447
+ }
448
+ else {
449
+ const result = exports.Play__ResultCodec.decode(input);
450
+ input.readMessageEnd();
451
+ return Promise.resolve(result.success);
452
+ }
453
+ }
454
+ else {
455
+ return Promise.reject(new thrift.TApplicationException(thrift.TApplicationExceptionType.WRONG_METHOD_NAME, "Received a response to an unknown RPC function: " + fieldName));
456
+ }
457
+ }
458
+ catch (err) {
459
+ return Promise.reject(err);
460
+ }
461
+ });
462
+ }
463
+ isPlaying(context) {
464
+ const writer = new this.transport();
465
+ const output = new this.protocol(writer);
466
+ output.writeMessageBegin("isPlaying", thrift.MessageType.CALL, this.incrementRequestId());
467
+ const args = {};
468
+ exports.IsPlaying__ArgsCodec.encode(args, output);
469
+ output.writeMessageEnd();
470
+ return this.connection.send(writer.flush(), context).then((data) => {
471
+ const reader = this.transport.receiver(data);
472
+ const input = new this.protocol(reader);
473
+ try {
474
+ const { fieldName: fieldName, messageType: messageType } = input.readMessageBegin();
475
+ if (fieldName === "isPlaying") {
476
+ if (messageType === thrift.MessageType.EXCEPTION) {
477
+ const err = thrift.TApplicationExceptionCodec.decode(input);
478
+ input.readMessageEnd();
479
+ return Promise.reject(err);
480
+ }
481
+ else {
482
+ const result = exports.IsPlaying__ResultCodec.decode(input);
483
+ input.readMessageEnd();
484
+ if (result.success != null) {
485
+ return Promise.resolve(result.success);
486
+ }
487
+ else {
488
+ return Promise.reject(new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, "isPlaying failed: unknown result"));
489
+ }
490
+ }
491
+ }
492
+ else {
493
+ return Promise.reject(new thrift.TApplicationException(thrift.TApplicationExceptionType.WRONG_METHOD_NAME, "Received a response to an unknown RPC function: " + fieldName));
494
+ }
495
+ }
496
+ catch (err) {
497
+ return Promise.reject(err);
498
+ }
499
+ });
500
+ }
501
+ }
502
+ exports.Client = Client;
503
+ Client.serviceName = exports.serviceName;
504
+ Client.annotations = exports.annotations;
505
+ Client.methodAnnotations = exports.methodAnnotations;
506
+ Client.methodNames = exports.methodNames;
507
+ class Processor extends thrift.ThriftProcessor {
508
+ constructor(handler) {
509
+ super();
510
+ this._serviceName = exports.serviceName;
511
+ this._annotations = exports.annotations;
512
+ this._methodAnnotations = exports.methodAnnotations;
513
+ this._methodNames = exports.methodNames;
514
+ this._handler = handler;
515
+ }
516
+ process(input, output, context) {
517
+ return new Promise((resolve, reject) => {
518
+ const metadata = input.readMessageBegin();
519
+ const fieldName = metadata.fieldName;
520
+ const requestId = metadata.requestId;
521
+ const methodName = "process_" + fieldName;
522
+ switch (methodName) {
523
+ case "process_isAvailable": {
524
+ resolve(this.process_isAvailable(requestId, input, output, context));
525
+ break;
526
+ }
527
+ case "process_play": {
528
+ resolve(this.process_play(requestId, input, output, context));
529
+ break;
530
+ }
531
+ case "process_isPlaying": {
532
+ resolve(this.process_isPlaying(requestId, input, output, context));
533
+ break;
534
+ }
535
+ default: {
536
+ input.skip(thrift.TType.STRUCT);
537
+ input.readMessageEnd();
538
+ const errMessage = "Unknown function " + fieldName;
539
+ const err = new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN_METHOD, errMessage);
540
+ output.writeMessageBegin(fieldName, thrift.MessageType.EXCEPTION, requestId);
541
+ thrift.TApplicationExceptionCodec.encode(err, output);
542
+ output.writeMessageEnd();
543
+ resolve(output.flush());
544
+ break;
545
+ }
546
+ }
547
+ });
548
+ }
549
+ process_isAvailable(requestId, input, output, context) {
550
+ return new Promise((resolve, reject) => {
551
+ try {
552
+ input.readMessageEnd();
553
+ resolve(this._handler.isAvailable(context));
554
+ }
555
+ catch (err) {
556
+ reject(err);
557
+ }
558
+ }).then((data) => {
559
+ const result = { success: data };
560
+ output.writeMessageBegin("isAvailable", thrift.MessageType.REPLY, requestId);
561
+ exports.IsAvailable__ResultCodec.encode(result, output);
562
+ output.writeMessageEnd();
563
+ return output.flush();
564
+ }).catch((err) => {
565
+ const result = new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, err.message);
566
+ output.writeMessageBegin("isAvailable", thrift.MessageType.EXCEPTION, requestId);
567
+ thrift.TApplicationExceptionCodec.encode(result, output);
568
+ output.writeMessageEnd();
569
+ return output.flush();
570
+ });
571
+ }
572
+ process_play(requestId, input, output, context) {
573
+ return new Promise((resolve, reject) => {
574
+ try {
575
+ input.readMessageEnd();
576
+ resolve(this._handler.play(context));
577
+ }
578
+ catch (err) {
579
+ reject(err);
580
+ }
581
+ }).then((data) => {
582
+ const result = { success: data };
583
+ output.writeMessageBegin("play", thrift.MessageType.REPLY, requestId);
584
+ exports.Play__ResultCodec.encode(result, output);
585
+ output.writeMessageEnd();
586
+ return output.flush();
587
+ }).catch((err) => {
588
+ const result = new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, err.message);
589
+ output.writeMessageBegin("play", thrift.MessageType.EXCEPTION, requestId);
590
+ thrift.TApplicationExceptionCodec.encode(result, output);
591
+ output.writeMessageEnd();
592
+ return output.flush();
593
+ });
594
+ }
595
+ process_isPlaying(requestId, input, output, context) {
596
+ return new Promise((resolve, reject) => {
597
+ try {
598
+ input.readMessageEnd();
599
+ resolve(this._handler.isPlaying(context));
600
+ }
601
+ catch (err) {
602
+ reject(err);
603
+ }
604
+ }).then((data) => {
605
+ const result = { success: data };
606
+ output.writeMessageBegin("isPlaying", thrift.MessageType.REPLY, requestId);
607
+ exports.IsPlaying__ResultCodec.encode(result, output);
608
+ output.writeMessageEnd();
609
+ return output.flush();
610
+ }).catch((err) => {
611
+ const result = new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, err.message);
612
+ output.writeMessageBegin("isPlaying", thrift.MessageType.EXCEPTION, requestId);
613
+ thrift.TApplicationExceptionCodec.encode(result, output);
614
+ output.writeMessageEnd();
615
+ return output.flush();
616
+ });
617
+ }
618
+ }
619
+ exports.Processor = Processor;
620
+ Processor.serviceName = exports.serviceName;
621
+ Processor.annotations = exports.annotations;
622
+ Processor.methodAnnotations = exports.methodAnnotations;
623
+ Processor.methodNames = exports.methodNames;
package/index.d.ts CHANGED
@@ -28,6 +28,8 @@ import * as Notifications from "./Notifications";
28
28
  export { Notifications as Notifications };
29
29
  import * as ListenToArticle from "./ListenToArticle";
30
30
  export { ListenToArticle as ListenToArticle };
31
+ import * as Audio from "./Audio";
32
+ export { Audio as Audio };
31
33
  import * as User from "./User";
32
34
  export { User as User };
33
35
  import * as Gallery from "./Gallery";
package/index.js CHANGED
@@ -26,7 +26,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
26
26
  return result;
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.Interactives = exports.Interaction = exports.Newsletters = exports.Navigation = exports.AbTesting = exports.Analytics = exports.Discussion = exports.Metrics = exports.Videos = exports.Gallery = exports.User = exports.ListenToArticle = exports.Notifications = exports.Tag = exports.Acquisitions = exports.Commercial = exports.Environment = void 0;
29
+ exports.Interactives = exports.Interaction = exports.Newsletters = exports.Navigation = exports.AbTesting = exports.Analytics = exports.Discussion = exports.Metrics = exports.Videos = exports.Gallery = exports.User = exports.Audio = exports.ListenToArticle = exports.Notifications = exports.Tag = exports.Acquisitions = exports.Commercial = exports.Environment = void 0;
30
30
  /* tslint:disable */
31
31
  /* eslint-disable */
32
32
  /*
@@ -63,6 +63,8 @@ const Notifications = __importStar(require("./Notifications"));
63
63
  exports.Notifications = Notifications;
64
64
  const ListenToArticle = __importStar(require("./ListenToArticle"));
65
65
  exports.ListenToArticle = ListenToArticle;
66
+ const Audio = __importStar(require("./Audio"));
67
+ exports.Audio = Audio;
66
68
  const User = __importStar(require("./User"));
67
69
  exports.User = User;
68
70
  const Gallery = __importStar(require("./Gallery"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guardian/bridget",
3
- "version": "8.8.0",
3
+ "version": "8.9.1",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {