@guardian/bridget 7.0.0 → 8.0.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.
Files changed (3) hide show
  1. package/Videos.d.ts +23 -20
  2. package/Videos.js +94 -44
  3. package/package.json +1 -1
package/Videos.d.ts CHANGED
@@ -58,17 +58,20 @@ export declare class SendVideoEvent__Args extends thrift.StructLike implements I
58
58
  static write(args: ISendVideoEvent__ArgsArgs, output: thrift.TProtocol): void;
59
59
  write(output: thrift.TProtocol): void;
60
60
  }
61
- export interface IFullscreen__Args {
61
+ export interface ISetFullscreen__Args {
62
+ isFullscreen: boolean;
62
63
  }
63
- export interface IFullscreen__ArgsArgs {
64
+ export interface ISetFullscreen__ArgsArgs {
65
+ isFullscreen: boolean;
64
66
  }
65
- export declare const Fullscreen__ArgsCodec: thrift.IStructCodec<IFullscreen__ArgsArgs, IFullscreen__Args>;
66
- export declare class Fullscreen__Args extends thrift.StructLike implements IFullscreen__Args {
67
+ export declare const SetFullscreen__ArgsCodec: thrift.IStructCodec<ISetFullscreen__ArgsArgs, ISetFullscreen__Args>;
68
+ export declare class SetFullscreen__Args extends thrift.StructLike implements ISetFullscreen__Args {
69
+ isFullscreen: boolean;
67
70
  readonly _annotations: thrift.IThriftAnnotations;
68
71
  readonly _fieldAnnotations: thrift.IFieldAnnotations;
69
- constructor(args?: IFullscreen__ArgsArgs);
70
- static read(input: thrift.TProtocol): Fullscreen__Args;
71
- static write(args: IFullscreen__ArgsArgs, output: thrift.TProtocol): void;
72
+ constructor(args: ISetFullscreen__ArgsArgs);
73
+ static read(input: thrift.TProtocol): SetFullscreen__Args;
74
+ static write(args: ISetFullscreen__ArgsArgs, output: thrift.TProtocol): void;
72
75
  write(output: thrift.TProtocol): void;
73
76
  }
74
77
  export interface IInsertVideos__Result {
@@ -119,20 +122,20 @@ export declare class SendVideoEvent__Result extends thrift.StructLike implements
119
122
  static write(args: ISendVideoEvent__ResultArgs, output: thrift.TProtocol): void;
120
123
  write(output: thrift.TProtocol): void;
121
124
  }
122
- export interface IFullscreen__Result {
123
- success?: void;
125
+ export interface ISetFullscreen__Result {
126
+ success?: boolean;
124
127
  }
125
- export interface IFullscreen__ResultArgs {
126
- success?: void;
128
+ export interface ISetFullscreen__ResultArgs {
129
+ success?: boolean;
127
130
  }
128
- export declare const Fullscreen__ResultCodec: thrift.IStructCodec<IFullscreen__ResultArgs, IFullscreen__Result>;
129
- export declare class Fullscreen__Result extends thrift.StructLike implements IFullscreen__Result {
130
- success?: void;
131
+ export declare const SetFullscreen__ResultCodec: thrift.IStructCodec<ISetFullscreen__ResultArgs, ISetFullscreen__Result>;
132
+ export declare class SetFullscreen__Result extends thrift.StructLike implements ISetFullscreen__Result {
133
+ success?: boolean;
131
134
  readonly _annotations: thrift.IThriftAnnotations;
132
135
  readonly _fieldAnnotations: thrift.IFieldAnnotations;
133
- constructor(args?: IFullscreen__ResultArgs);
134
- static read(input: thrift.TProtocol): Fullscreen__Result;
135
- static write(args: IFullscreen__ResultArgs, output: thrift.TProtocol): void;
136
+ constructor(args?: ISetFullscreen__ResultArgs);
137
+ static read(input: thrift.TProtocol): SetFullscreen__Result;
138
+ static write(args: ISetFullscreen__ResultArgs, output: thrift.TProtocol): void;
136
139
  write(output: thrift.TProtocol): void;
137
140
  }
138
141
  export declare class Client<Context = any> extends thrift.ThriftClient<Context> {
@@ -150,13 +153,13 @@ export declare class Client<Context = any> extends thrift.ThriftClient<Context>
150
153
  insertVideos(videoSlots: Array<VideoSlot.IVideoSlotArgs>, context?: Context): Promise<void>;
151
154
  updateVideos(videoSlots: Array<VideoSlot.IVideoSlotArgs>, context?: Context): Promise<void>;
152
155
  sendVideoEvent(videoEvent: VideoEvent.IVideoEventArgs, context?: Context): Promise<void>;
153
- fullscreen(context?: Context): Promise<void>;
156
+ setFullscreen(isFullscreen: boolean, context?: Context): Promise<boolean>;
154
157
  }
155
158
  export interface IHandler<Context = any> {
156
159
  insertVideos(videoSlots: Array<VideoSlot.IVideoSlot>, context?: Context): void | Promise<void>;
157
160
  updateVideos(videoSlots: Array<VideoSlot.IVideoSlot>, context?: Context): void | Promise<void>;
158
161
  sendVideoEvent(videoEvent: VideoEvent.IVideoEvent, context?: Context): void | Promise<void>;
159
- fullscreen(context?: Context): void | Promise<void>;
162
+ setFullscreen(isFullscreen: boolean, context?: Context): boolean | Promise<boolean>;
160
163
  }
161
164
  export declare class Processor<Context = any> extends thrift.ThriftProcessor<Context, IHandler<Context>> {
162
165
  protected readonly _handler: IHandler<Context>;
@@ -173,5 +176,5 @@ export declare class Processor<Context = any> extends thrift.ThriftProcessor<Con
173
176
  process_insertVideos(requestId: number, input: thrift.TProtocol, output: thrift.TProtocol, context: Context): Promise<Buffer>;
174
177
  process_updateVideos(requestId: number, input: thrift.TProtocol, output: thrift.TProtocol, context: Context): Promise<Buffer>;
175
178
  process_sendVideoEvent(requestId: number, input: thrift.TProtocol, output: thrift.TProtocol, context: Context): Promise<Buffer>;
176
- process_fullscreen(requestId: number, input: thrift.TProtocol, output: thrift.TProtocol, context: Context): Promise<Buffer>;
179
+ process_setFullscreen(requestId: number, input: thrift.TProtocol, output: thrift.TProtocol, context: Context): Promise<Buffer>;
177
180
  }
package/Videos.js CHANGED
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.Processor = exports.Client = exports.Fullscreen__Result = exports.Fullscreen__ResultCodec = exports.SendVideoEvent__Result = exports.SendVideoEvent__ResultCodec = exports.UpdateVideos__Result = exports.UpdateVideos__ResultCodec = exports.InsertVideos__Result = exports.InsertVideos__ResultCodec = exports.Fullscreen__Args = exports.Fullscreen__ArgsCodec = exports.SendVideoEvent__Args = exports.SendVideoEvent__ArgsCodec = exports.UpdateVideos__Args = exports.UpdateVideos__ArgsCodec = exports.InsertVideos__Args = exports.InsertVideos__ArgsCodec = exports.methodParameters = exports.methodNames = exports.methodAnnotations = exports.annotations = exports.serviceName = void 0;
26
+ exports.Processor = exports.Client = exports.SetFullscreen__Result = exports.SetFullscreen__ResultCodec = exports.SendVideoEvent__Result = exports.SendVideoEvent__ResultCodec = exports.UpdateVideos__Result = exports.UpdateVideos__ResultCodec = exports.InsertVideos__Result = exports.InsertVideos__ResultCodec = exports.SetFullscreen__Args = exports.SetFullscreen__ArgsCodec = exports.SendVideoEvent__Args = exports.SendVideoEvent__ArgsCodec = exports.UpdateVideos__Args = exports.UpdateVideos__ArgsCodec = exports.InsertVideos__Args = exports.InsertVideos__ArgsCodec = exports.methodParameters = exports.methodNames = exports.methodAnnotations = exports.annotations = exports.serviceName = void 0;
27
27
  /* tslint:disable */
28
28
  /* eslint-disable */
29
29
  /*
@@ -48,17 +48,17 @@ exports.methodAnnotations = {
48
48
  annotations: {},
49
49
  fieldAnnotations: {}
50
50
  },
51
- fullscreen: {
51
+ setFullscreen: {
52
52
  annotations: {},
53
53
  fieldAnnotations: {}
54
54
  }
55
55
  };
56
- exports.methodNames = ["insertVideos", "updateVideos", "sendVideoEvent", "fullscreen"];
56
+ exports.methodNames = ["insertVideos", "updateVideos", "sendVideoEvent", "setFullscreen"];
57
57
  exports.methodParameters = {
58
58
  insertVideos: 2,
59
59
  updateVideos: 2,
60
60
  sendVideoEvent: 2,
61
- fullscreen: 1
61
+ setFullscreen: 2
62
62
  };
63
63
  exports.InsertVideos__ArgsCodec = {
64
64
  encode(args, output) {
@@ -327,14 +327,26 @@ class SendVideoEvent__Args extends thrift.StructLike {
327
327
  }
328
328
  }
329
329
  exports.SendVideoEvent__Args = SendVideoEvent__Args;
330
- exports.Fullscreen__ArgsCodec = {
330
+ exports.SetFullscreen__ArgsCodec = {
331
331
  encode(args, output) {
332
- output.writeStructBegin("Fullscreen__Args");
332
+ const obj = {
333
+ isFullscreen: args.isFullscreen
334
+ };
335
+ output.writeStructBegin("SetFullscreen__Args");
336
+ if (obj.isFullscreen != null) {
337
+ output.writeFieldBegin("isFullscreen", thrift.TType.BOOL, 1);
338
+ output.writeBool(obj.isFullscreen);
339
+ output.writeFieldEnd();
340
+ }
341
+ else {
342
+ throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[isFullscreen] is unset!");
343
+ }
333
344
  output.writeFieldStop();
334
345
  output.writeStructEnd();
335
346
  return;
336
347
  },
337
348
  decode(input) {
349
+ let _args = {};
338
350
  input.readStructBegin();
339
351
  while (true) {
340
352
  const ret = input.readFieldBegin();
@@ -344,6 +356,15 @@ exports.Fullscreen__ArgsCodec = {
344
356
  break;
345
357
  }
346
358
  switch (fieldId) {
359
+ case 1:
360
+ if (fieldType === thrift.TType.BOOL) {
361
+ const value_15 = input.readBool();
362
+ _args.isFullscreen = value_15;
363
+ }
364
+ else {
365
+ input.skip(fieldType);
366
+ }
367
+ break;
347
368
  default: {
348
369
  input.skip(fieldType);
349
370
  }
@@ -351,26 +372,40 @@ exports.Fullscreen__ArgsCodec = {
351
372
  input.readFieldEnd();
352
373
  }
353
374
  input.readStructEnd();
354
- return {};
375
+ if (_args.isFullscreen !== undefined) {
376
+ return {
377
+ isFullscreen: _args.isFullscreen
378
+ };
379
+ }
380
+ else {
381
+ throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Unable to read SetFullscreen__Args from input");
382
+ }
355
383
  }
356
384
  };
357
- class Fullscreen__Args extends thrift.StructLike {
358
- constructor(args = {}) {
385
+ class SetFullscreen__Args extends thrift.StructLike {
386
+ constructor(args) {
359
387
  super();
360
388
  this._annotations = {};
361
389
  this._fieldAnnotations = {};
390
+ if (args.isFullscreen != null) {
391
+ const value_16 = args.isFullscreen;
392
+ this.isFullscreen = value_16;
393
+ }
394
+ else {
395
+ throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[isFullscreen] is unset!");
396
+ }
362
397
  }
363
398
  static read(input) {
364
- return new Fullscreen__Args(exports.Fullscreen__ArgsCodec.decode(input));
399
+ return new SetFullscreen__Args(exports.SetFullscreen__ArgsCodec.decode(input));
365
400
  }
366
401
  static write(args, output) {
367
- return exports.Fullscreen__ArgsCodec.encode(args, output);
402
+ return exports.SetFullscreen__ArgsCodec.encode(args, output);
368
403
  }
369
404
  write(output) {
370
- return exports.Fullscreen__ArgsCodec.encode(this, output);
405
+ return exports.SetFullscreen__ArgsCodec.encode(this, output);
371
406
  }
372
407
  }
373
- exports.Fullscreen__Args = Fullscreen__Args;
408
+ exports.SetFullscreen__Args = SetFullscreen__Args;
374
409
  exports.InsertVideos__ResultCodec = {
375
410
  encode(args, output) {
376
411
  output.writeStructBegin("InsertVideos__Result");
@@ -415,8 +450,8 @@ class InsertVideos__Result extends thrift.StructLike {
415
450
  this._annotations = {};
416
451
  this._fieldAnnotations = {};
417
452
  if (args.success != null) {
418
- const value_15 = undefined;
419
- this.success = value_15;
453
+ const value_17 = undefined;
454
+ this.success = value_17;
420
455
  }
421
456
  }
422
457
  static read(input) {
@@ -474,8 +509,8 @@ class UpdateVideos__Result extends thrift.StructLike {
474
509
  this._annotations = {};
475
510
  this._fieldAnnotations = {};
476
511
  if (args.success != null) {
477
- const value_16 = undefined;
478
- this.success = value_16;
512
+ const value_18 = undefined;
513
+ this.success = value_18;
479
514
  }
480
515
  }
481
516
  static read(input) {
@@ -533,8 +568,8 @@ class SendVideoEvent__Result extends thrift.StructLike {
533
568
  this._annotations = {};
534
569
  this._fieldAnnotations = {};
535
570
  if (args.success != null) {
536
- const value_17 = undefined;
537
- this.success = value_17;
571
+ const value_19 = undefined;
572
+ this.success = value_19;
538
573
  }
539
574
  }
540
575
  static read(input) {
@@ -548,9 +583,17 @@ class SendVideoEvent__Result extends thrift.StructLike {
548
583
  }
549
584
  }
550
585
  exports.SendVideoEvent__Result = SendVideoEvent__Result;
551
- exports.Fullscreen__ResultCodec = {
586
+ exports.SetFullscreen__ResultCodec = {
552
587
  encode(args, output) {
553
- output.writeStructBegin("Fullscreen__Result");
588
+ const obj = {
589
+ success: args.success
590
+ };
591
+ output.writeStructBegin("SetFullscreen__Result");
592
+ if (obj.success != null) {
593
+ output.writeFieldBegin("success", thrift.TType.BOOL, 0);
594
+ output.writeBool(obj.success);
595
+ output.writeFieldEnd();
596
+ }
554
597
  output.writeFieldStop();
555
598
  output.writeStructEnd();
556
599
  return;
@@ -567,8 +610,9 @@ exports.Fullscreen__ResultCodec = {
567
610
  }
568
611
  switch (fieldId) {
569
612
  case 0:
570
- if (fieldType === thrift.TType.VOID) {
571
- input.skip(fieldType);
613
+ if (fieldType === thrift.TType.BOOL) {
614
+ const value_20 = input.readBool();
615
+ _args.success = value_20;
572
616
  }
573
617
  else {
574
618
  input.skip(fieldType);
@@ -586,27 +630,27 @@ exports.Fullscreen__ResultCodec = {
586
630
  };
587
631
  }
588
632
  };
589
- class Fullscreen__Result extends thrift.StructLike {
633
+ class SetFullscreen__Result extends thrift.StructLike {
590
634
  constructor(args = {}) {
591
635
  super();
592
636
  this._annotations = {};
593
637
  this._fieldAnnotations = {};
594
638
  if (args.success != null) {
595
- const value_18 = undefined;
596
- this.success = value_18;
639
+ const value_21 = args.success;
640
+ this.success = value_21;
597
641
  }
598
642
  }
599
643
  static read(input) {
600
- return new Fullscreen__Result(exports.Fullscreen__ResultCodec.decode(input));
644
+ return new SetFullscreen__Result(exports.SetFullscreen__ResultCodec.decode(input));
601
645
  }
602
646
  static write(args, output) {
603
- return exports.Fullscreen__ResultCodec.encode(args, output);
647
+ return exports.SetFullscreen__ResultCodec.encode(args, output);
604
648
  }
605
649
  write(output) {
606
- return exports.Fullscreen__ResultCodec.encode(this, output);
650
+ return exports.SetFullscreen__ResultCodec.encode(this, output);
607
651
  }
608
652
  }
609
- exports.Fullscreen__Result = Fullscreen__Result;
653
+ exports.SetFullscreen__Result = SetFullscreen__Result;
610
654
  class Client extends thrift.ThriftClient {
611
655
  constructor() {
612
656
  super(...arguments);
@@ -715,28 +759,33 @@ class Client extends thrift.ThriftClient {
715
759
  }
716
760
  });
717
761
  }
718
- fullscreen(context) {
762
+ setFullscreen(isFullscreen, context) {
719
763
  const writer = new this.transport();
720
764
  const output = new this.protocol(writer);
721
- output.writeMessageBegin("fullscreen", thrift.MessageType.CALL, this.incrementRequestId());
722
- const args = {};
723
- exports.Fullscreen__ArgsCodec.encode(args, output);
765
+ output.writeMessageBegin("setFullscreen", thrift.MessageType.CALL, this.incrementRequestId());
766
+ const args = { isFullscreen };
767
+ exports.SetFullscreen__ArgsCodec.encode(args, output);
724
768
  output.writeMessageEnd();
725
769
  return this.connection.send(writer.flush(), context).then((data) => {
726
770
  const reader = this.transport.receiver(data);
727
771
  const input = new this.protocol(reader);
728
772
  try {
729
773
  const { fieldName: fieldName, messageType: messageType } = input.readMessageBegin();
730
- if (fieldName === "fullscreen") {
774
+ if (fieldName === "setFullscreen") {
731
775
  if (messageType === thrift.MessageType.EXCEPTION) {
732
776
  const err = thrift.TApplicationExceptionCodec.decode(input);
733
777
  input.readMessageEnd();
734
778
  return Promise.reject(err);
735
779
  }
736
780
  else {
737
- const result = exports.Fullscreen__ResultCodec.decode(input);
781
+ const result = exports.SetFullscreen__ResultCodec.decode(input);
738
782
  input.readMessageEnd();
739
- return Promise.resolve(result.success);
783
+ if (result.success != null) {
784
+ return Promise.resolve(result.success);
785
+ }
786
+ else {
787
+ return Promise.reject(new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, "setFullscreen failed: unknown result"));
788
+ }
740
789
  }
741
790
  }
742
791
  else {
@@ -782,8 +831,8 @@ class Processor extends thrift.ThriftProcessor {
782
831
  resolve(this.process_sendVideoEvent(requestId, input, output, context));
783
832
  break;
784
833
  }
785
- case "process_fullscreen": {
786
- resolve(this.process_fullscreen(requestId, input, output, context));
834
+ case "process_setFullscreen": {
835
+ resolve(this.process_setFullscreen(requestId, input, output, context));
787
836
  break;
788
837
  }
789
838
  default: {
@@ -872,24 +921,25 @@ class Processor extends thrift.ThriftProcessor {
872
921
  return output.flush();
873
922
  });
874
923
  }
875
- process_fullscreen(requestId, input, output, context) {
924
+ process_setFullscreen(requestId, input, output, context) {
876
925
  return new Promise((resolve, reject) => {
877
926
  try {
927
+ const args = exports.SetFullscreen__ArgsCodec.decode(input);
878
928
  input.readMessageEnd();
879
- resolve(this._handler.fullscreen(context));
929
+ resolve(this._handler.setFullscreen(args.isFullscreen, context));
880
930
  }
881
931
  catch (err) {
882
932
  reject(err);
883
933
  }
884
934
  }).then((data) => {
885
935
  const result = { success: data };
886
- output.writeMessageBegin("fullscreen", thrift.MessageType.REPLY, requestId);
887
- exports.Fullscreen__ResultCodec.encode(result, output);
936
+ output.writeMessageBegin("setFullscreen", thrift.MessageType.REPLY, requestId);
937
+ exports.SetFullscreen__ResultCodec.encode(result, output);
888
938
  output.writeMessageEnd();
889
939
  return output.flush();
890
940
  }).catch((err) => {
891
941
  const result = new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, err.message);
892
- output.writeMessageBegin("fullscreen", thrift.MessageType.EXCEPTION, requestId);
942
+ output.writeMessageBegin("setFullscreen", thrift.MessageType.EXCEPTION, requestId);
893
943
  thrift.TApplicationExceptionCodec.encode(result, output);
894
944
  output.writeMessageEnd();
895
945
  return output.flush();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guardian/bridget",
3
- "version": "7.0.0",
3
+ "version": "8.0.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {