@guardian/bridget 3.0.0 → 4.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/User.d.ts +5 -5
  2. package/User.js +19 -5
  3. package/package.json +1 -1
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?: void;
181
+ success?: boolean;
182
182
  }
183
183
  export interface ISignIn__ResultArgs {
184
- success?: void;
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?: void;
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<void>;
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): void | Promise<void>;
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.VOID) {
821
- input.skip(fieldType);
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 value_25 = undefined;
846
- this.success = value_25;
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
- return Promise.resolve(result.success);
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guardian/bridget",
3
- "version": "3.0.0",
3
+ "version": "4.0.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {