@guardian/bridget 3.0.0 → 5.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.
- package/Discussion.d.ts +112 -0
- package/Discussion.js +747 -50
- package/DiscussionBadge.d.ts +17 -0
- package/DiscussionBadge.js +112 -0
- package/DiscussionUserProfile.d.ts +45 -0
- package/DiscussionUserProfile.js +362 -0
- package/GetUserProfileResponse.d.ts +28 -0
- package/GetUserProfileResponse.js +170 -0
- package/User.d.ts +5 -5
- package/User.js +19 -5
- package/index.d.ts +3 -0
- package/index.js +3 -0
- package/package.json +1 -1
|
@@ -0,0 +1,170 @@
|
|
|
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.GetUserProfileResponseCodec = exports.GetUserProfileResponseType = 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
|
+
const DiscussionUserProfile = __importStar(require("./DiscussionUserProfile"));
|
|
35
|
+
var GetUserProfileResponseType;
|
|
36
|
+
(function (GetUserProfileResponseType) {
|
|
37
|
+
GetUserProfileResponseType["GetUserProfileResponseWithProfile"] = "profile";
|
|
38
|
+
GetUserProfileResponseType["GetUserProfileResponseWithError"] = "error";
|
|
39
|
+
})(GetUserProfileResponseType || (exports.GetUserProfileResponseType = GetUserProfileResponseType = {}));
|
|
40
|
+
exports.GetUserProfileResponseCodec = {
|
|
41
|
+
create(args) {
|
|
42
|
+
let _fieldsSet = 0;
|
|
43
|
+
let _returnValue = null;
|
|
44
|
+
if (args.profile != null) {
|
|
45
|
+
_fieldsSet++;
|
|
46
|
+
const value_1 = new DiscussionUserProfile.DiscussionUserProfile(args.profile);
|
|
47
|
+
_returnValue = { profile: value_1 };
|
|
48
|
+
}
|
|
49
|
+
if (args.error != null) {
|
|
50
|
+
_fieldsSet++;
|
|
51
|
+
const value_2 = args.error;
|
|
52
|
+
_returnValue = { error: value_2 };
|
|
53
|
+
}
|
|
54
|
+
if (_fieldsSet > 1) {
|
|
55
|
+
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.INVALID_DATA, "TUnion cannot have more than one value");
|
|
56
|
+
}
|
|
57
|
+
else if (_fieldsSet < 1) {
|
|
58
|
+
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.INVALID_DATA, "TUnion must have one value set");
|
|
59
|
+
}
|
|
60
|
+
if (_returnValue !== null) {
|
|
61
|
+
if (_returnValue.profile !== undefined) {
|
|
62
|
+
return {
|
|
63
|
+
__type: GetUserProfileResponseType.GetUserProfileResponseWithProfile,
|
|
64
|
+
profile: _returnValue.profile
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
return {
|
|
69
|
+
__type: GetUserProfileResponseType.GetUserProfileResponseWithError,
|
|
70
|
+
error: _returnValue.error
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Unable to read data for TUnion");
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
encode(args, output) {
|
|
79
|
+
let _fieldsSet = 0;
|
|
80
|
+
const obj = {
|
|
81
|
+
profile: args.profile,
|
|
82
|
+
error: args.error
|
|
83
|
+
};
|
|
84
|
+
output.writeStructBegin("GetUserProfileResponse");
|
|
85
|
+
if (obj.profile != null) {
|
|
86
|
+
_fieldsSet++;
|
|
87
|
+
output.writeFieldBegin("profile", thrift.TType.STRUCT, 1);
|
|
88
|
+
DiscussionUserProfile.DiscussionUserProfileCodec.encode(obj.profile, output);
|
|
89
|
+
output.writeFieldEnd();
|
|
90
|
+
}
|
|
91
|
+
if (obj.error != null) {
|
|
92
|
+
_fieldsSet++;
|
|
93
|
+
output.writeFieldBegin("error", thrift.TType.I32, 2);
|
|
94
|
+
output.writeI32(obj.error);
|
|
95
|
+
output.writeFieldEnd();
|
|
96
|
+
}
|
|
97
|
+
output.writeFieldStop();
|
|
98
|
+
output.writeStructEnd();
|
|
99
|
+
if (_fieldsSet > 1) {
|
|
100
|
+
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.INVALID_DATA, "TUnion cannot have more than one value");
|
|
101
|
+
}
|
|
102
|
+
else if (_fieldsSet < 1) {
|
|
103
|
+
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.INVALID_DATA, "TUnion must have one value set");
|
|
104
|
+
}
|
|
105
|
+
return;
|
|
106
|
+
},
|
|
107
|
+
decode(input) {
|
|
108
|
+
let _fieldsSet = 0;
|
|
109
|
+
let _returnValue = null;
|
|
110
|
+
input.readStructBegin();
|
|
111
|
+
while (true) {
|
|
112
|
+
const ret = input.readFieldBegin();
|
|
113
|
+
const fieldType = ret.fieldType;
|
|
114
|
+
const fieldId = ret.fieldId;
|
|
115
|
+
if (fieldType === thrift.TType.STOP) {
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
switch (fieldId) {
|
|
119
|
+
case 1:
|
|
120
|
+
if (fieldType === thrift.TType.STRUCT) {
|
|
121
|
+
_fieldsSet++;
|
|
122
|
+
const value_3 = DiscussionUserProfile.DiscussionUserProfileCodec.decode(input);
|
|
123
|
+
_returnValue = { profile: value_3 };
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
input.skip(fieldType);
|
|
127
|
+
}
|
|
128
|
+
break;
|
|
129
|
+
case 2:
|
|
130
|
+
if (fieldType === thrift.TType.I32) {
|
|
131
|
+
_fieldsSet++;
|
|
132
|
+
const value_4 = input.readI32();
|
|
133
|
+
_returnValue = { error: value_4 };
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
input.skip(fieldType);
|
|
137
|
+
}
|
|
138
|
+
break;
|
|
139
|
+
default: {
|
|
140
|
+
input.skip(fieldType);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
input.readFieldEnd();
|
|
144
|
+
}
|
|
145
|
+
input.readStructEnd();
|
|
146
|
+
if (_fieldsSet > 1) {
|
|
147
|
+
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.INVALID_DATA, "TUnion cannot have more than one value");
|
|
148
|
+
}
|
|
149
|
+
else if (_fieldsSet < 1) {
|
|
150
|
+
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.INVALID_DATA, "TUnion must have one value set");
|
|
151
|
+
}
|
|
152
|
+
if (_returnValue !== null) {
|
|
153
|
+
if (_returnValue.profile !== undefined) {
|
|
154
|
+
return {
|
|
155
|
+
__type: GetUserProfileResponseType.GetUserProfileResponseWithProfile,
|
|
156
|
+
profile: _returnValue.profile
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
return {
|
|
161
|
+
__type: GetUserProfileResponseType.GetUserProfileResponseWithError,
|
|
162
|
+
error: _returnValue.error
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
throw new thrift.TProtocolException(thrift.TProtocolExceptionType.UNKNOWN, "Unable to read data for TUnion");
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
};
|
package/User.d.ts
CHANGED
|
@@ -178,14 +178,14 @@ export declare class IsSignedIn__Result extends thrift.StructLike implements IIs
|
|
|
178
178
|
write(output: thrift.TProtocol): void;
|
|
179
179
|
}
|
|
180
180
|
export interface ISignIn__Result {
|
|
181
|
-
success?:
|
|
181
|
+
success?: boolean;
|
|
182
182
|
}
|
|
183
183
|
export interface ISignIn__ResultArgs {
|
|
184
|
-
success?:
|
|
184
|
+
success?: boolean;
|
|
185
185
|
}
|
|
186
186
|
export declare const SignIn__ResultCodec: thrift.IStructCodec<ISignIn__ResultArgs, ISignIn__Result>;
|
|
187
187
|
export declare class SignIn__Result extends thrift.StructLike implements ISignIn__Result {
|
|
188
|
-
success?:
|
|
188
|
+
success?: boolean;
|
|
189
189
|
readonly _annotations: thrift.IThriftAnnotations;
|
|
190
190
|
readonly _fieldAnnotations: thrift.IFieldAnnotations;
|
|
191
191
|
constructor(args?: ISignIn__ResultArgs);
|
|
@@ -210,7 +210,7 @@ export declare class Client<Context = any> extends thrift.ThriftClient<Context>
|
|
|
210
210
|
discussionId(context?: Context): Promise<string>;
|
|
211
211
|
doesCcpaApply(context?: Context): Promise<boolean>;
|
|
212
212
|
isSignedIn(context?: Context): Promise<boolean>;
|
|
213
|
-
signIn(reason: SignInScreenReason.SignInScreenReason, referrer: SignInScreenReferrer.SignInScreenReferrer, context?: Context): Promise<
|
|
213
|
+
signIn(reason: SignInScreenReason.SignInScreenReason, referrer: SignInScreenReferrer.SignInScreenReferrer, context?: Context): Promise<boolean>;
|
|
214
214
|
}
|
|
215
215
|
export interface IHandler<Context = any> {
|
|
216
216
|
isPremium(context?: Context): boolean | Promise<boolean>;
|
|
@@ -218,7 +218,7 @@ export interface IHandler<Context = any> {
|
|
|
218
218
|
discussionId(context?: Context): string | Promise<string>;
|
|
219
219
|
doesCcpaApply(context?: Context): boolean | Promise<boolean>;
|
|
220
220
|
isSignedIn(context?: Context): boolean | Promise<boolean>;
|
|
221
|
-
signIn(reason: SignInScreenReason.SignInScreenReason, referrer: SignInScreenReferrer.SignInScreenReferrer, context?: Context):
|
|
221
|
+
signIn(reason: SignInScreenReason.SignInScreenReason, referrer: SignInScreenReferrer.SignInScreenReferrer, context?: Context): boolean | Promise<boolean>;
|
|
222
222
|
}
|
|
223
223
|
export declare class Processor<Context = any> extends thrift.ThriftProcessor<Context, IHandler<Context>> {
|
|
224
224
|
protected readonly _handler: IHandler<Context>;
|
package/User.js
CHANGED
|
@@ -800,7 +800,15 @@ class IsSignedIn__Result extends thrift.StructLike {
|
|
|
800
800
|
exports.IsSignedIn__Result = IsSignedIn__Result;
|
|
801
801
|
exports.SignIn__ResultCodec = {
|
|
802
802
|
encode(args, output) {
|
|
803
|
+
const obj = {
|
|
804
|
+
success: args.success
|
|
805
|
+
};
|
|
803
806
|
output.writeStructBegin("SignIn__Result");
|
|
807
|
+
if (obj.success != null) {
|
|
808
|
+
output.writeFieldBegin("success", thrift.TType.BOOL, 0);
|
|
809
|
+
output.writeBool(obj.success);
|
|
810
|
+
output.writeFieldEnd();
|
|
811
|
+
}
|
|
804
812
|
output.writeFieldStop();
|
|
805
813
|
output.writeStructEnd();
|
|
806
814
|
return;
|
|
@@ -817,8 +825,9 @@ exports.SignIn__ResultCodec = {
|
|
|
817
825
|
}
|
|
818
826
|
switch (fieldId) {
|
|
819
827
|
case 0:
|
|
820
|
-
if (fieldType === thrift.TType.
|
|
821
|
-
input.
|
|
828
|
+
if (fieldType === thrift.TType.BOOL) {
|
|
829
|
+
const value_25 = input.readBool();
|
|
830
|
+
_args.success = value_25;
|
|
822
831
|
}
|
|
823
832
|
else {
|
|
824
833
|
input.skip(fieldType);
|
|
@@ -842,8 +851,8 @@ class SignIn__Result extends thrift.StructLike {
|
|
|
842
851
|
this._annotations = {};
|
|
843
852
|
this._fieldAnnotations = {};
|
|
844
853
|
if (args.success != null) {
|
|
845
|
-
const
|
|
846
|
-
this.success =
|
|
854
|
+
const value_26 = args.success;
|
|
855
|
+
this.success = value_26;
|
|
847
856
|
}
|
|
848
857
|
}
|
|
849
858
|
static read(input) {
|
|
@@ -1077,7 +1086,12 @@ class Client extends thrift.ThriftClient {
|
|
|
1077
1086
|
else {
|
|
1078
1087
|
const result = exports.SignIn__ResultCodec.decode(input);
|
|
1079
1088
|
input.readMessageEnd();
|
|
1080
|
-
|
|
1089
|
+
if (result.success != null) {
|
|
1090
|
+
return Promise.resolve(result.success);
|
|
1091
|
+
}
|
|
1092
|
+
else {
|
|
1093
|
+
return Promise.reject(new thrift.TApplicationException(thrift.TApplicationExceptionType.UNKNOWN, "signIn failed: unknown result"));
|
|
1094
|
+
}
|
|
1081
1095
|
}
|
|
1082
1096
|
}
|
|
1083
1097
|
else {
|
package/index.d.ts
CHANGED
|
@@ -11,8 +11,11 @@ export * from "./MaybeEpic";
|
|
|
11
11
|
export * from "./VideoSlot";
|
|
12
12
|
export * from "./MetricPaint";
|
|
13
13
|
export * from "./MetricFont";
|
|
14
|
+
export * from "./DiscussionBadge";
|
|
15
|
+
export * from "./DiscussionUserProfile";
|
|
14
16
|
export * from "./DiscussionApiResponse";
|
|
15
17
|
export * from "./Metric";
|
|
18
|
+
export * from "./GetUserProfileResponse";
|
|
16
19
|
export * from "./DiscussionResponse";
|
|
17
20
|
import * as Environment from "./Environment";
|
|
18
21
|
export { Environment as Environment };
|
package/index.js
CHANGED
|
@@ -46,8 +46,11 @@ __exportStar(require("./MaybeEpic"), exports);
|
|
|
46
46
|
__exportStar(require("./VideoSlot"), exports);
|
|
47
47
|
__exportStar(require("./MetricPaint"), exports);
|
|
48
48
|
__exportStar(require("./MetricFont"), exports);
|
|
49
|
+
__exportStar(require("./DiscussionBadge"), exports);
|
|
50
|
+
__exportStar(require("./DiscussionUserProfile"), exports);
|
|
49
51
|
__exportStar(require("./DiscussionApiResponse"), exports);
|
|
50
52
|
__exportStar(require("./Metric"), exports);
|
|
53
|
+
__exportStar(require("./GetUserProfileResponse"), exports);
|
|
51
54
|
__exportStar(require("./DiscussionResponse"), exports);
|
|
52
55
|
const Environment = __importStar(require("./Environment"));
|
|
53
56
|
exports.Environment = Environment;
|