@guardian/bridget 8.6.0 → 8.7.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/AbTesting.d.ts ADDED
@@ -0,0 +1,70 @@
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 IGetParticipations__Args {
12
+ }
13
+ export interface IGetParticipations__ArgsArgs {
14
+ }
15
+ export declare const GetParticipations__ArgsCodec: thrift.IStructCodec<IGetParticipations__ArgsArgs, IGetParticipations__Args>;
16
+ export declare class GetParticipations__Args extends thrift.StructLike implements IGetParticipations__Args {
17
+ readonly _annotations: thrift.IThriftAnnotations;
18
+ readonly _fieldAnnotations: thrift.IFieldAnnotations;
19
+ constructor(args?: IGetParticipations__ArgsArgs);
20
+ static read(input: thrift.TProtocol): GetParticipations__Args;
21
+ static write(args: IGetParticipations__ArgsArgs, output: thrift.TProtocol): void;
22
+ write(output: thrift.TProtocol): void;
23
+ }
24
+ export interface IGetParticipations__Result {
25
+ success?: Map<string, string>;
26
+ }
27
+ export interface IGetParticipations__ResultArgs {
28
+ success?: Map<string, string>;
29
+ }
30
+ export declare const GetParticipations__ResultCodec: thrift.IStructCodec<IGetParticipations__ResultArgs, IGetParticipations__Result>;
31
+ export declare class GetParticipations__Result extends thrift.StructLike implements IGetParticipations__Result {
32
+ success?: Map<string, string>;
33
+ readonly _annotations: thrift.IThriftAnnotations;
34
+ readonly _fieldAnnotations: thrift.IFieldAnnotations;
35
+ constructor(args?: IGetParticipations__ResultArgs);
36
+ static read(input: thrift.TProtocol): GetParticipations__Result;
37
+ static write(args: IGetParticipations__ResultArgs, output: thrift.TProtocol): void;
38
+ write(output: thrift.TProtocol): void;
39
+ }
40
+ export declare class Client<Context = any> extends thrift.ThriftClient<Context> {
41
+ static readonly serviceName: string;
42
+ static readonly annotations: thrift.IThriftAnnotations;
43
+ static readonly methodAnnotations: thrift.IMethodAnnotations;
44
+ static readonly methodNames: Array<string>;
45
+ readonly _serviceName: string;
46
+ readonly _annotations: thrift.IThriftAnnotations;
47
+ readonly _methodAnnotations: thrift.IMethodAnnotations;
48
+ readonly _methodNames: Array<string>;
49
+ readonly _methodParameters?: {
50
+ [methodName: string]: number;
51
+ };
52
+ getParticipations(context?: Context): Promise<Map<string, string>>;
53
+ }
54
+ export interface IHandler<Context = any> {
55
+ getParticipations(context?: Context): Map<string, string> | Promise<Map<string, string>>;
56
+ }
57
+ export declare class Processor<Context = any> extends thrift.ThriftProcessor<Context, IHandler<Context>> {
58
+ protected readonly _handler: IHandler<Context>;
59
+ static readonly serviceName: string;
60
+ static readonly annotations: thrift.IThriftAnnotations;
61
+ static readonly methodAnnotations: thrift.IMethodAnnotations;
62
+ static readonly methodNames: Array<string>;
63
+ readonly _serviceName: string;
64
+ readonly _annotations: thrift.IThriftAnnotations;
65
+ readonly _methodAnnotations: thrift.IMethodAnnotations;
66
+ readonly _methodNames: Array<string>;
67
+ constructor(handler: IHandler<Context>);
68
+ process(input: thrift.TProtocol, output: thrift.TProtocol, context: Context): Promise<Buffer>;
69
+ process_getParticipations(requestId: number, input: thrift.TProtocol, output: thrift.TProtocol, context: Context): Promise<Buffer>;
70
+ }
package/AbTesting.js ADDED
@@ -0,0 +1,291 @@
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.GetParticipations__Result = exports.GetParticipations__ResultCodec = exports.GetParticipations__Args = exports.GetParticipations__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 = "AbTesting";
35
+ exports.annotations = {};
36
+ exports.methodAnnotations = {
37
+ getParticipations: {
38
+ annotations: {},
39
+ fieldAnnotations: {}
40
+ }
41
+ };
42
+ exports.methodNames = ["getParticipations"];
43
+ exports.methodParameters = {
44
+ getParticipations: 1
45
+ };
46
+ exports.GetParticipations__ArgsCodec = {
47
+ encode(args, output) {
48
+ output.writeStructBegin("GetParticipations__Args");
49
+ output.writeFieldStop();
50
+ output.writeStructEnd();
51
+ return;
52
+ },
53
+ decode(input) {
54
+ input.readStructBegin();
55
+ while (true) {
56
+ const ret = input.readFieldBegin();
57
+ const fieldType = ret.fieldType;
58
+ const fieldId = ret.fieldId;
59
+ if (fieldType === thrift.TType.STOP) {
60
+ break;
61
+ }
62
+ switch (fieldId) {
63
+ default: {
64
+ input.skip(fieldType);
65
+ }
66
+ }
67
+ input.readFieldEnd();
68
+ }
69
+ input.readStructEnd();
70
+ return {};
71
+ }
72
+ };
73
+ class GetParticipations__Args extends thrift.StructLike {
74
+ constructor(args = {}) {
75
+ super();
76
+ this._annotations = {};
77
+ this._fieldAnnotations = {};
78
+ }
79
+ static read(input) {
80
+ return new GetParticipations__Args(exports.GetParticipations__ArgsCodec.decode(input));
81
+ }
82
+ static write(args, output) {
83
+ return exports.GetParticipations__ArgsCodec.encode(args, output);
84
+ }
85
+ write(output) {
86
+ return exports.GetParticipations__ArgsCodec.encode(this, output);
87
+ }
88
+ }
89
+ exports.GetParticipations__Args = GetParticipations__Args;
90
+ exports.GetParticipations__ResultCodec = {
91
+ encode(args, output) {
92
+ const obj = {
93
+ success: args.success
94
+ };
95
+ output.writeStructBegin("GetParticipations__Result");
96
+ if (obj.success != null) {
97
+ output.writeFieldBegin("success", thrift.TType.MAP, 0);
98
+ output.writeMapBegin(thrift.TType.STRING, thrift.TType.STRING, obj.success.size);
99
+ obj.success.forEach((value_1, key_1) => {
100
+ output.writeString(key_1);
101
+ output.writeString(value_1);
102
+ });
103
+ output.writeMapEnd();
104
+ output.writeFieldEnd();
105
+ }
106
+ output.writeFieldStop();
107
+ output.writeStructEnd();
108
+ return;
109
+ },
110
+ decode(input) {
111
+ let _args = {};
112
+ input.readStructBegin();
113
+ while (true) {
114
+ const ret = input.readFieldBegin();
115
+ const fieldType = ret.fieldType;
116
+ const fieldId = ret.fieldId;
117
+ if (fieldType === thrift.TType.STOP) {
118
+ break;
119
+ }
120
+ switch (fieldId) {
121
+ case 0:
122
+ if (fieldType === thrift.TType.MAP) {
123
+ const value_2 = new Map();
124
+ const metadata_1 = input.readMapBegin();
125
+ const size_1 = metadata_1.size;
126
+ for (let i_1 = 0; i_1 < size_1; i_1++) {
127
+ const key_2 = input.readString();
128
+ const value_3 = input.readString();
129
+ value_2.set(key_2, value_3);
130
+ }
131
+ input.readMapEnd();
132
+ _args.success = value_2;
133
+ }
134
+ else {
135
+ input.skip(fieldType);
136
+ }
137
+ break;
138
+ default: {
139
+ input.skip(fieldType);
140
+ }
141
+ }
142
+ input.readFieldEnd();
143
+ }
144
+ input.readStructEnd();
145
+ return {
146
+ success: _args.success
147
+ };
148
+ }
149
+ };
150
+ class GetParticipations__Result extends thrift.StructLike {
151
+ constructor(args = {}) {
152
+ super();
153
+ this._annotations = {};
154
+ this._fieldAnnotations = {};
155
+ if (args.success != null) {
156
+ const value_4 = new Map();
157
+ args.success.forEach((value_5, key_3) => {
158
+ const value_6 = value_5;
159
+ const key_4 = key_3;
160
+ value_4.set(key_4, value_6);
161
+ });
162
+ this.success = value_4;
163
+ }
164
+ }
165
+ static read(input) {
166
+ return new GetParticipations__Result(exports.GetParticipations__ResultCodec.decode(input));
167
+ }
168
+ static write(args, output) {
169
+ return exports.GetParticipations__ResultCodec.encode(args, output);
170
+ }
171
+ write(output) {
172
+ return exports.GetParticipations__ResultCodec.encode(this, output);
173
+ }
174
+ }
175
+ exports.GetParticipations__Result = GetParticipations__Result;
176
+ class Client extends thrift.ThriftClient {
177
+ constructor() {
178
+ super(...arguments);
179
+ this._serviceName = exports.serviceName;
180
+ this._annotations = exports.annotations;
181
+ this._methodAnnotations = exports.methodAnnotations;
182
+ this._methodNames = exports.methodNames;
183
+ this._methodParameters = exports.methodParameters;
184
+ }
185
+ getParticipations(context) {
186
+ const writer = new this.transport();
187
+ const output = new this.protocol(writer);
188
+ output.writeMessageBegin("getParticipations", thrift.MessageType.CALL, this.incrementRequestId());
189
+ const args = {};
190
+ exports.GetParticipations__ArgsCodec.encode(args, output);
191
+ output.writeMessageEnd();
192
+ return this.connection.send(writer.flush(), context).then((data) => {
193
+ const reader = this.transport.receiver(data);
194
+ const input = new this.protocol(reader);
195
+ try {
196
+ const { fieldName: fieldName, messageType: messageType } = input.readMessageBegin();
197
+ if (fieldName === "getParticipations") {
198
+ if (messageType === thrift.MessageType.EXCEPTION) {
199
+ const err = thrift.TApplicationExceptionCodec.decode(input);
200
+ input.readMessageEnd();
201
+ return Promise.reject(err);
202
+ }
203
+ else {
204
+ const result = exports.GetParticipations__ResultCodec.decode(input);
205
+ input.readMessageEnd();
206
+ if (result.success != null) {
207
+ return Promise.resolve(result.success);
208
+ }
209
+ else {
210
+ return Promise.reject(new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, "getParticipations failed: unknown result"));
211
+ }
212
+ }
213
+ }
214
+ else {
215
+ return Promise.reject(new thrift.TApplicationException(thrift.TApplicationExceptionType.WRONG_METHOD_NAME, "Received a response to an unknown RPC function: " + fieldName));
216
+ }
217
+ }
218
+ catch (err) {
219
+ return Promise.reject(err);
220
+ }
221
+ });
222
+ }
223
+ }
224
+ exports.Client = Client;
225
+ Client.serviceName = exports.serviceName;
226
+ Client.annotations = exports.annotations;
227
+ Client.methodAnnotations = exports.methodAnnotations;
228
+ Client.methodNames = exports.methodNames;
229
+ class Processor extends thrift.ThriftProcessor {
230
+ constructor(handler) {
231
+ super();
232
+ this._serviceName = exports.serviceName;
233
+ this._annotations = exports.annotations;
234
+ this._methodAnnotations = exports.methodAnnotations;
235
+ this._methodNames = exports.methodNames;
236
+ this._handler = handler;
237
+ }
238
+ process(input, output, context) {
239
+ return new Promise((resolve, reject) => {
240
+ const metadata = input.readMessageBegin();
241
+ const fieldName = metadata.fieldName;
242
+ const requestId = metadata.requestId;
243
+ const methodName = "process_" + fieldName;
244
+ switch (methodName) {
245
+ case "process_getParticipations": {
246
+ resolve(this.process_getParticipations(requestId, input, output, context));
247
+ break;
248
+ }
249
+ default: {
250
+ input.skip(thrift.TType.STRUCT);
251
+ input.readMessageEnd();
252
+ const errMessage = "Unknown function " + fieldName;
253
+ const err = new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN_METHOD, errMessage);
254
+ output.writeMessageBegin(fieldName, thrift.MessageType.EXCEPTION, requestId);
255
+ thrift.TApplicationExceptionCodec.encode(err, output);
256
+ output.writeMessageEnd();
257
+ resolve(output.flush());
258
+ break;
259
+ }
260
+ }
261
+ });
262
+ }
263
+ process_getParticipations(requestId, input, output, context) {
264
+ return new Promise((resolve, reject) => {
265
+ try {
266
+ input.readMessageEnd();
267
+ resolve(this._handler.getParticipations(context));
268
+ }
269
+ catch (err) {
270
+ reject(err);
271
+ }
272
+ }).then((data) => {
273
+ const result = { success: data };
274
+ output.writeMessageBegin("getParticipations", thrift.MessageType.REPLY, requestId);
275
+ exports.GetParticipations__ResultCodec.encode(result, output);
276
+ output.writeMessageEnd();
277
+ return output.flush();
278
+ }).catch((err) => {
279
+ const result = new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, err.message);
280
+ output.writeMessageBegin("getParticipations", thrift.MessageType.EXCEPTION, requestId);
281
+ thrift.TApplicationExceptionCodec.encode(result, output);
282
+ output.writeMessageEnd();
283
+ return output.flush();
284
+ });
285
+ }
286
+ }
287
+ exports.Processor = Processor;
288
+ Processor.serviceName = exports.serviceName;
289
+ Processor.annotations = exports.annotations;
290
+ Processor.methodAnnotations = exports.methodAnnotations;
291
+ Processor.methodNames = exports.methodNames;
package/index.d.ts CHANGED
@@ -40,6 +40,8 @@ import * as Discussion from "./Discussion";
40
40
  export { Discussion as Discussion };
41
41
  import * as Analytics from "./Analytics";
42
42
  export { Analytics as Analytics };
43
+ import * as AbTesting from "./AbTesting";
44
+ export { AbTesting as AbTesting };
43
45
  import * as Navigation from "./Navigation";
44
46
  export { Navigation as Navigation };
45
47
  import * as Newsletters from "./Newsletters";
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.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.ListenToArticle = exports.Notifications = exports.Tag = exports.Acquisitions = exports.Commercial = exports.Environment = void 0;
30
30
  /* tslint:disable */
31
31
  /* eslint-disable */
32
32
  /*
@@ -75,6 +75,8 @@ const Discussion = __importStar(require("./Discussion"));
75
75
  exports.Discussion = Discussion;
76
76
  const Analytics = __importStar(require("./Analytics"));
77
77
  exports.Analytics = Analytics;
78
+ const AbTesting = __importStar(require("./AbTesting"));
79
+ exports.AbTesting = AbTesting;
78
80
  const Navigation = __importStar(require("./Navigation"));
79
81
  exports.Navigation = Navigation;
80
82
  const Newsletters = __importStar(require("./Newsletters"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guardian/bridget",
3
- "version": "8.6.0",
3
+ "version": "8.7.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {