@guardian/bridget 8.2.0 → 8.3.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/Commercial.d.ts CHANGED
@@ -41,6 +41,22 @@ export declare class UpdateAdverts__Args extends thrift.StructLike implements IU
41
41
  static write(args: IUpdateAdverts__ArgsArgs, output: thrift.TProtocol): void;
42
42
  write(output: thrift.TProtocol): void;
43
43
  }
44
+ export interface ISendTargetingParams__Args {
45
+ targetingParams: Map<string, string>;
46
+ }
47
+ export interface ISendTargetingParams__ArgsArgs {
48
+ targetingParams: Map<string, string>;
49
+ }
50
+ export declare const SendTargetingParams__ArgsCodec: thrift.IStructCodec<ISendTargetingParams__ArgsArgs, ISendTargetingParams__Args>;
51
+ export declare class SendTargetingParams__Args extends thrift.StructLike implements ISendTargetingParams__Args {
52
+ targetingParams: Map<string, string>;
53
+ readonly _annotations: thrift.IThriftAnnotations;
54
+ readonly _fieldAnnotations: thrift.IFieldAnnotations;
55
+ constructor(args: ISendTargetingParams__ArgsArgs);
56
+ static read(input: thrift.TProtocol): SendTargetingParams__Args;
57
+ static write(args: ISendTargetingParams__ArgsArgs, output: thrift.TProtocol): void;
58
+ write(output: thrift.TProtocol): void;
59
+ }
44
60
  export interface IInsertAdverts__Result {
45
61
  success?: void;
46
62
  }
@@ -73,6 +89,22 @@ export declare class UpdateAdverts__Result extends thrift.StructLike implements
73
89
  static write(args: IUpdateAdverts__ResultArgs, output: thrift.TProtocol): void;
74
90
  write(output: thrift.TProtocol): void;
75
91
  }
92
+ export interface ISendTargetingParams__Result {
93
+ success?: void;
94
+ }
95
+ export interface ISendTargetingParams__ResultArgs {
96
+ success?: void;
97
+ }
98
+ export declare const SendTargetingParams__ResultCodec: thrift.IStructCodec<ISendTargetingParams__ResultArgs, ISendTargetingParams__Result>;
99
+ export declare class SendTargetingParams__Result extends thrift.StructLike implements ISendTargetingParams__Result {
100
+ success?: void;
101
+ readonly _annotations: thrift.IThriftAnnotations;
102
+ readonly _fieldAnnotations: thrift.IFieldAnnotations;
103
+ constructor(args?: ISendTargetingParams__ResultArgs);
104
+ static read(input: thrift.TProtocol): SendTargetingParams__Result;
105
+ static write(args: ISendTargetingParams__ResultArgs, output: thrift.TProtocol): void;
106
+ write(output: thrift.TProtocol): void;
107
+ }
76
108
  export declare class Client<Context = any> extends thrift.ThriftClient<Context> {
77
109
  static readonly serviceName: string;
78
110
  static readonly annotations: thrift.IThriftAnnotations;
@@ -87,10 +119,12 @@ export declare class Client<Context = any> extends thrift.ThriftClient<Context>
87
119
  };
88
120
  insertAdverts(adSlots: Array<AdSlot.IAdSlotArgs>, context?: Context): Promise<void>;
89
121
  updateAdverts(adSlots: Array<AdSlot.IAdSlotArgs>, context?: Context): Promise<void>;
122
+ sendTargetingParams(targetingParams: Map<string, string>, context?: Context): Promise<void>;
90
123
  }
91
124
  export interface IHandler<Context = any> {
92
125
  insertAdverts(adSlots: Array<AdSlot.IAdSlot>, context?: Context): void | Promise<void>;
93
126
  updateAdverts(adSlots: Array<AdSlot.IAdSlot>, context?: Context): void | Promise<void>;
127
+ sendTargetingParams(targetingParams: Map<string, string>, context?: Context): void | Promise<void>;
94
128
  }
95
129
  export declare class Processor<Context = any> extends thrift.ThriftProcessor<Context, IHandler<Context>> {
96
130
  protected readonly _handler: IHandler<Context>;
@@ -106,4 +140,5 @@ export declare class Processor<Context = any> extends thrift.ThriftProcessor<Con
106
140
  process(input: thrift.TProtocol, output: thrift.TProtocol, context: Context): Promise<Buffer>;
107
141
  process_insertAdverts(requestId: number, input: thrift.TProtocol, output: thrift.TProtocol, context: Context): Promise<Buffer>;
108
142
  process_updateAdverts(requestId: number, input: thrift.TProtocol, output: thrift.TProtocol, context: Context): Promise<Buffer>;
143
+ process_sendTargetingParams(requestId: number, input: thrift.TProtocol, output: thrift.TProtocol, context: Context): Promise<Buffer>;
109
144
  }
package/Commercial.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.UpdateAdverts__Result = exports.UpdateAdverts__ResultCodec = exports.InsertAdverts__Result = exports.InsertAdverts__ResultCodec = exports.UpdateAdverts__Args = exports.UpdateAdverts__ArgsCodec = exports.InsertAdverts__Args = exports.InsertAdverts__ArgsCodec = exports.methodParameters = exports.methodNames = exports.methodAnnotations = exports.annotations = exports.serviceName = void 0;
26
+ exports.Processor = exports.Client = exports.SendTargetingParams__Result = exports.SendTargetingParams__ResultCodec = exports.UpdateAdverts__Result = exports.UpdateAdverts__ResultCodec = exports.InsertAdverts__Result = exports.InsertAdverts__ResultCodec = exports.SendTargetingParams__Args = exports.SendTargetingParams__ArgsCodec = exports.UpdateAdverts__Args = exports.UpdateAdverts__ArgsCodec = exports.InsertAdverts__Args = exports.InsertAdverts__ArgsCodec = exports.methodParameters = exports.methodNames = exports.methodAnnotations = exports.annotations = exports.serviceName = void 0;
27
27
  /* tslint:disable */
28
28
  /* eslint-disable */
29
29
  /*
@@ -42,12 +42,17 @@ exports.methodAnnotations = {
42
42
  updateAdverts: {
43
43
  annotations: {},
44
44
  fieldAnnotations: {}
45
+ },
46
+ sendTargetingParams: {
47
+ annotations: {},
48
+ fieldAnnotations: {}
45
49
  }
46
50
  };
47
- exports.methodNames = ["insertAdverts", "updateAdverts"];
51
+ exports.methodNames = ["insertAdverts", "updateAdverts", "sendTargetingParams"];
48
52
  exports.methodParameters = {
49
53
  insertAdverts: 2,
50
- updateAdverts: 2
54
+ updateAdverts: 2,
55
+ sendTargetingParams: 2
51
56
  };
52
57
  exports.InsertAdverts__ArgsCodec = {
53
58
  encode(args, output) {
@@ -237,6 +242,103 @@ class UpdateAdverts__Args extends thrift.StructLike {
237
242
  }
238
243
  }
239
244
  exports.UpdateAdverts__Args = UpdateAdverts__Args;
245
+ exports.SendTargetingParams__ArgsCodec = {
246
+ encode(args, output) {
247
+ const obj = {
248
+ targetingParams: args.targetingParams
249
+ };
250
+ output.writeStructBegin("SendTargetingParams__Args");
251
+ if (obj.targetingParams != null) {
252
+ output.writeFieldBegin("targetingParams", thrift.TType.MAP, 1);
253
+ output.writeMapBegin(thrift.TType.STRING, thrift.TType.STRING, obj.targetingParams.size);
254
+ obj.targetingParams.forEach((value_13, key_1) => {
255
+ output.writeString(key_1);
256
+ output.writeString(value_13);
257
+ });
258
+ output.writeMapEnd();
259
+ output.writeFieldEnd();
260
+ }
261
+ else {
262
+ throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[targetingParams] is unset!");
263
+ }
264
+ output.writeFieldStop();
265
+ output.writeStructEnd();
266
+ return;
267
+ },
268
+ decode(input) {
269
+ let _args = {};
270
+ input.readStructBegin();
271
+ while (true) {
272
+ const ret = input.readFieldBegin();
273
+ const fieldType = ret.fieldType;
274
+ const fieldId = ret.fieldId;
275
+ if (fieldType === thrift.TType.STOP) {
276
+ break;
277
+ }
278
+ switch (fieldId) {
279
+ case 1:
280
+ if (fieldType === thrift.TType.MAP) {
281
+ const value_14 = new Map();
282
+ const metadata_3 = input.readMapBegin();
283
+ const size_3 = metadata_3.size;
284
+ for (let i_3 = 0; i_3 < size_3; i_3++) {
285
+ const key_2 = input.readString();
286
+ const value_15 = input.readString();
287
+ value_14.set(key_2, value_15);
288
+ }
289
+ input.readMapEnd();
290
+ _args.targetingParams = value_14;
291
+ }
292
+ else {
293
+ input.skip(fieldType);
294
+ }
295
+ break;
296
+ default: {
297
+ input.skip(fieldType);
298
+ }
299
+ }
300
+ input.readFieldEnd();
301
+ }
302
+ input.readStructEnd();
303
+ if (_args.targetingParams !== undefined) {
304
+ return {
305
+ targetingParams: _args.targetingParams
306
+ };
307
+ }
308
+ else {
309
+ throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Unable to read SendTargetingParams__Args from input");
310
+ }
311
+ }
312
+ };
313
+ class SendTargetingParams__Args extends thrift.StructLike {
314
+ constructor(args) {
315
+ super();
316
+ this._annotations = {};
317
+ this._fieldAnnotations = {};
318
+ if (args.targetingParams != null) {
319
+ const value_16 = new Map();
320
+ args.targetingParams.forEach((value_17, key_3) => {
321
+ const value_18 = value_17;
322
+ const key_4 = key_3;
323
+ value_16.set(key_4, value_18);
324
+ });
325
+ this.targetingParams = value_16;
326
+ }
327
+ else {
328
+ throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Required field[targetingParams] is unset!");
329
+ }
330
+ }
331
+ static read(input) {
332
+ return new SendTargetingParams__Args(exports.SendTargetingParams__ArgsCodec.decode(input));
333
+ }
334
+ static write(args, output) {
335
+ return exports.SendTargetingParams__ArgsCodec.encode(args, output);
336
+ }
337
+ write(output) {
338
+ return exports.SendTargetingParams__ArgsCodec.encode(this, output);
339
+ }
340
+ }
341
+ exports.SendTargetingParams__Args = SendTargetingParams__Args;
240
342
  exports.InsertAdverts__ResultCodec = {
241
343
  encode(args, output) {
242
344
  output.writeStructBegin("InsertAdverts__Result");
@@ -281,8 +383,8 @@ class InsertAdverts__Result extends thrift.StructLike {
281
383
  this._annotations = {};
282
384
  this._fieldAnnotations = {};
283
385
  if (args.success != null) {
284
- const value_13 = undefined;
285
- this.success = value_13;
386
+ const value_19 = undefined;
387
+ this.success = value_19;
286
388
  }
287
389
  }
288
390
  static read(input) {
@@ -340,8 +442,8 @@ class UpdateAdverts__Result extends thrift.StructLike {
340
442
  this._annotations = {};
341
443
  this._fieldAnnotations = {};
342
444
  if (args.success != null) {
343
- const value_14 = undefined;
344
- this.success = value_14;
445
+ const value_20 = undefined;
446
+ this.success = value_20;
345
447
  }
346
448
  }
347
449
  static read(input) {
@@ -355,6 +457,65 @@ class UpdateAdverts__Result extends thrift.StructLike {
355
457
  }
356
458
  }
357
459
  exports.UpdateAdverts__Result = UpdateAdverts__Result;
460
+ exports.SendTargetingParams__ResultCodec = {
461
+ encode(args, output) {
462
+ output.writeStructBegin("SendTargetingParams__Result");
463
+ output.writeFieldStop();
464
+ output.writeStructEnd();
465
+ return;
466
+ },
467
+ decode(input) {
468
+ let _args = {};
469
+ input.readStructBegin();
470
+ while (true) {
471
+ const ret = input.readFieldBegin();
472
+ const fieldType = ret.fieldType;
473
+ const fieldId = ret.fieldId;
474
+ if (fieldType === thrift.TType.STOP) {
475
+ break;
476
+ }
477
+ switch (fieldId) {
478
+ case 0:
479
+ if (fieldType === thrift.TType.VOID) {
480
+ input.skip(fieldType);
481
+ }
482
+ else {
483
+ input.skip(fieldType);
484
+ }
485
+ break;
486
+ default: {
487
+ input.skip(fieldType);
488
+ }
489
+ }
490
+ input.readFieldEnd();
491
+ }
492
+ input.readStructEnd();
493
+ return {
494
+ success: _args.success
495
+ };
496
+ }
497
+ };
498
+ class SendTargetingParams__Result extends thrift.StructLike {
499
+ constructor(args = {}) {
500
+ super();
501
+ this._annotations = {};
502
+ this._fieldAnnotations = {};
503
+ if (args.success != null) {
504
+ const value_21 = undefined;
505
+ this.success = value_21;
506
+ }
507
+ }
508
+ static read(input) {
509
+ return new SendTargetingParams__Result(exports.SendTargetingParams__ResultCodec.decode(input));
510
+ }
511
+ static write(args, output) {
512
+ return exports.SendTargetingParams__ResultCodec.encode(args, output);
513
+ }
514
+ write(output) {
515
+ return exports.SendTargetingParams__ResultCodec.encode(this, output);
516
+ }
517
+ }
518
+ exports.SendTargetingParams__Result = SendTargetingParams__Result;
358
519
  class Client extends thrift.ThriftClient {
359
520
  constructor() {
360
521
  super(...arguments);
@@ -430,6 +591,39 @@ class Client extends thrift.ThriftClient {
430
591
  }
431
592
  });
432
593
  }
594
+ sendTargetingParams(targetingParams, context) {
595
+ const writer = new this.transport();
596
+ const output = new this.protocol(writer);
597
+ output.writeMessageBegin("sendTargetingParams", thrift.MessageType.CALL, this.incrementRequestId());
598
+ const args = { targetingParams };
599
+ exports.SendTargetingParams__ArgsCodec.encode(args, output);
600
+ output.writeMessageEnd();
601
+ return this.connection.send(writer.flush(), context).then((data) => {
602
+ const reader = this.transport.receiver(data);
603
+ const input = new this.protocol(reader);
604
+ try {
605
+ const { fieldName: fieldName, messageType: messageType } = input.readMessageBegin();
606
+ if (fieldName === "sendTargetingParams") {
607
+ if (messageType === thrift.MessageType.EXCEPTION) {
608
+ const err = thrift.TApplicationExceptionCodec.decode(input);
609
+ input.readMessageEnd();
610
+ return Promise.reject(err);
611
+ }
612
+ else {
613
+ const result = exports.SendTargetingParams__ResultCodec.decode(input);
614
+ input.readMessageEnd();
615
+ return Promise.resolve(result.success);
616
+ }
617
+ }
618
+ else {
619
+ return Promise.reject(new thrift.TApplicationException(thrift.TApplicationExceptionType.WRONG_METHOD_NAME, "Received a response to an unknown RPC function: " + fieldName));
620
+ }
621
+ }
622
+ catch (err) {
623
+ return Promise.reject(err);
624
+ }
625
+ });
626
+ }
433
627
  }
434
628
  exports.Client = Client;
435
629
  Client.serviceName = exports.serviceName;
@@ -460,6 +654,10 @@ class Processor extends thrift.ThriftProcessor {
460
654
  resolve(this.process_updateAdverts(requestId, input, output, context));
461
655
  break;
462
656
  }
657
+ case "process_sendTargetingParams": {
658
+ resolve(this.process_sendTargetingParams(requestId, input, output, context));
659
+ break;
660
+ }
463
661
  default: {
464
662
  input.skip(thrift.TType.STRUCT);
465
663
  input.readMessageEnd();
@@ -522,6 +720,30 @@ class Processor extends thrift.ThriftProcessor {
522
720
  return output.flush();
523
721
  });
524
722
  }
723
+ process_sendTargetingParams(requestId, input, output, context) {
724
+ return new Promise((resolve, reject) => {
725
+ try {
726
+ const args = exports.SendTargetingParams__ArgsCodec.decode(input);
727
+ input.readMessageEnd();
728
+ resolve(this._handler.sendTargetingParams(args.targetingParams, context));
729
+ }
730
+ catch (err) {
731
+ reject(err);
732
+ }
733
+ }).then((data) => {
734
+ const result = { success: data };
735
+ output.writeMessageBegin("sendTargetingParams", thrift.MessageType.REPLY, requestId);
736
+ exports.SendTargetingParams__ResultCodec.encode(result, output);
737
+ output.writeMessageEnd();
738
+ return output.flush();
739
+ }).catch((err) => {
740
+ const result = new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, err.message);
741
+ output.writeMessageBegin("sendTargetingParams", thrift.MessageType.EXCEPTION, requestId);
742
+ thrift.TApplicationExceptionCodec.encode(result, output);
743
+ output.writeMessageEnd();
744
+ return output.flush();
745
+ });
746
+ }
525
747
  }
526
748
  exports.Processor = Processor;
527
749
  Processor.serviceName = exports.serviceName;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guardian/bridget",
3
- "version": "8.2.0",
3
+ "version": "8.3.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {