@opexa/portal-sdk 0.0.7 → 0.0.9

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 (39) hide show
  1. package/dist/index.d.ts +0 -3
  2. package/dist/index.js +67 -59
  3. package/dist/index.js.map +1 -1
  4. package/dist/index.mjs +759 -573
  5. package/dist/index.mjs.map +1 -1
  6. package/dist/sdk/index.d.ts +4 -0
  7. package/dist/{sdk.d.ts → sdk/sdk.d.ts} +38 -2
  8. package/dist/{session-manager.d.ts → sdk/session-manager.d.ts} +6 -2
  9. package/dist/{transformer.d.ts → sdk/transformer.d.ts} +1 -1
  10. package/dist/{types.d.ts → sdk/types.d.ts} +121 -95
  11. package/dist/services/account.service.d.ts +3 -2
  12. package/dist/services/auth.service.d.ts +8 -6
  13. package/dist/services/bet-record.d.ts +1 -7
  14. package/dist/services/bonus.d.ts +3 -2
  15. package/dist/services/cashback.d.ts +2 -4
  16. package/dist/services/deposit.d.ts +8 -17
  17. package/dist/services/file.d.ts +20 -10
  18. package/dist/services/file.service.d.ts +1 -1
  19. package/dist/services/game.d.ts +26 -12
  20. package/dist/services/game.service.d.ts +3 -2
  21. package/dist/services/member.d.ts +15 -9
  22. package/dist/services/platform.d.ts +1 -1
  23. package/dist/services/points.d.ts +3 -2
  24. package/dist/services/portal.service.d.ts +1 -1
  25. package/dist/services/promo.d.ts +2 -4
  26. package/dist/services/report.service.d.ts +2 -1
  27. package/dist/services/session.d.ts +64 -9
  28. package/dist/services/types.d.ts +9 -32
  29. package/dist/services/wallet.service.d.ts +3 -1
  30. package/dist/services/withdrawal.d.ts +6 -5
  31. package/dist/utils/graphql-client.d.ts +4 -11
  32. package/dist/utils/rest-client.d.ts +34 -0
  33. package/dist/utils/status-code-to-error.d.ts +3 -0
  34. package/dist/utils/types.d.ts +25 -3
  35. package/package.json +12 -12
  36. package/dist/utils/http-error.d.ts +0 -26
  37. /package/dist/{logger.d.ts → sdk/logger.d.ts} +0 -0
  38. /package/dist/{object-id.d.ts → sdk/object-id.d.ts} +0 -0
  39. /package/dist/{object-type.d.ts → sdk/object-type.d.ts} +0 -0
@@ -1,13 +1,11 @@
1
- import { File } from './file';
1
+ import { File__Ready } from './file';
2
2
  import { DateString, Html } from './types';
3
3
 
4
4
  export type CashbackStatus = 'ACTIVE' | 'INACTIVE';
5
5
  export interface Cashback {
6
6
  id: string;
7
7
  name: string;
8
- banner: Extract<File, {
9
- status: 'READY';
10
- }>;
8
+ banner: File__Ready;
11
9
  status: CashbackStatus;
12
10
  description: Html;
13
11
  activationStartDateTime: DateString;
@@ -1,4 +1,5 @@
1
- import { DateFilterField, DateString, Decimal, EnumFilterField, MutationError, PaginatedQuery, StringFilterField } from './types';
1
+ import { OperationError } from '../utils/types';
2
+ import { DateFilterField, DateString, Decimal, EnumFilterField, PaginatedQuery, StringFilterField } from './types';
2
3
 
3
4
  export type DepositRecordType = 'BANK' | 'GCASH' | 'MANUAL' | 'MAYA' | 'MAYA_APP';
4
5
  export type DepositRecordStatus = 'PENDING' | 'ACCEPTED' | 'APPROVED' | 'REJECTED' | 'CONFIRMED' | 'CANCELLED';
@@ -30,7 +31,7 @@ export interface DepositRecordsQueryVariables {
30
31
  };
31
32
  }
32
33
  export declare const DEPOSIT_RECORDS_QUERY: string;
33
- export type CreateDepositError = MutationError<'DepositPromoMaximumAmountExceededError' | 'DepositPromoMinimumAmountNotMetError' | 'HasActiveBonusError' | 'MaximumDepositAmountExceededError' | 'MinimumDepositAmountNotMetError' | 'MinimumFirstDepositAmountNotMetError' | 'PromoNotEnabledError' | 'WalletDoesNotExistError'>;
34
+ export type CreateDepositError = OperationError<'DepositPromoMaximumAmountExceededError' | 'DepositPromoMinimumAmountNotMetError' | 'HasActiveBonusError' | 'MaximumDepositAmountExceededError' | 'MinimumDepositAmountNotMetError' | 'MinimumFirstDepositAmountNotMetError' | 'PromoNotEnabledError' | 'WalletDoesNotExistError'>;
34
35
  export interface CreateGCashDepositMutation {
35
36
  createGCashDeposit?: CreateDepositError | null;
36
37
  }
@@ -64,20 +65,11 @@ export interface CreateMayaAppDepositMutationVariables {
64
65
  };
65
66
  }
66
67
  export declare const CREATE_MAYA_APP_DEPOSIT_MUTATION: string;
67
- type Deposit__Common = Omit<DepositRecord, 'depositNumber' | 'status'>;
68
- type Deposit__Failed = Deposit__Common & {
69
- status: 'REJECTED' | 'CANCELLED';
70
- checkoutUrl?: string | null;
71
- };
72
- type Deposit__Pending = Deposit__Common & {
73
- status: 'PENDING';
74
- checkoutUrl?: never;
75
- };
76
- type Deposit__Success = Deposit__Common & {
77
- status: 'ACCEPTED' | 'APPROVED' | 'CONFIRMED';
78
- checkoutUrl: string;
79
- };
80
- export type Deposit = Deposit__Failed | Deposit__Pending | Deposit__Success;
68
+ export type DepositType = 'GCASH' | 'MAYA' | 'MAYA_APP';
69
+ export interface Deposit extends Omit<DepositRecord, 'type' | 'depositNumber'> {
70
+ type: DepositType;
71
+ checkoutUrl?: string;
72
+ }
81
73
  export interface DepositQuery {
82
74
  node?: Deposit | null;
83
75
  }
@@ -91,4 +83,3 @@ export interface DepositsCountQuery {
91
83
  };
92
84
  }
93
85
  export declare const DEPOSITS_COUNT_QUERY: string;
94
- export {};
@@ -1,22 +1,32 @@
1
- import { DateString, MutationError } from './types';
1
+ import { OperationError } from '../utils/types';
2
+ import { DateString } from './types';
2
3
 
3
- export type FileStatus = File['status'];
4
- export type File = {
4
+ export type FileStatus = 'UPLOADING' | 'READY' | 'FAILED' | 'DELETED';
5
+ export interface File__Uploading {
5
6
  id: string;
6
7
  url?: never;
7
- status: 'UPLOADING' | 'FAILED';
8
+ status: 'UPLOADING';
8
9
  dateTimeCreated: DateString;
9
- } | {
10
+ }
11
+ export interface File__Failed {
10
12
  id: string;
11
- url: string;
12
- status: 'READY';
13
+ url?: never;
14
+ status: 'FAILED';
13
15
  dateTimeCreated: DateString;
14
- } | {
16
+ }
17
+ export interface File__Deleted {
15
18
  id: string;
16
19
  url?: string | null;
17
20
  status: 'DELETED';
18
21
  dateTimeCreated: DateString;
19
- };
22
+ }
23
+ export interface File__Ready {
24
+ id: string;
25
+ url: string;
26
+ status: 'READY';
27
+ dateTimeCreated: DateString;
28
+ }
29
+ export type File = File__Uploading | File__Failed | File__Deleted | File__Ready;
20
30
  export interface FileQuery {
21
31
  node?: File | null;
22
32
  }
@@ -25,7 +35,7 @@ export interface FileQueryVariables {
25
35
  }
26
36
  export declare const FILE_FRAGMENT: string;
27
37
  export declare const FILE_QUERY: string;
28
- export type UploadPrivateImageFileError = MutationError<'FileFormatNotSupportedError' | 'FileNameTooLongError' | 'FileSizeTooBigError'>;
38
+ export type UploadPrivateImageFileError = OperationError<'FileFormatNotSupportedError' | 'FileNameTooLongError' | 'FileSizeTooBigError'>;
29
39
  export interface UploadPrivateImageFileMutation {
30
40
  uploadPrivateImageFile?: UploadPrivateImageFileError | null;
31
41
  }
@@ -1,6 +1,6 @@
1
1
  import { GraphQLClient } from '../utils/graphql-client';
2
+ import { OperationResult } from '../utils/types';
2
3
  import { File, FileQueryVariables, UploadPrivateImageFileError, UploadPrivateImageFileMutationVariables } from './file';
3
- import { OperationResult } from './types';
4
4
 
5
5
  export declare class FileService {
6
6
  private client;
@@ -1,4 +1,5 @@
1
- import { DateString, EnumFilterField, MutationError, ObjectIdFilterField, PaginatedQuery, StringFilterField } from './types';
1
+ import { OperationError } from '../utils/types';
2
+ import { DateString, EnumFilterField, ObjectIdFilterField, PaginatedQuery, StringFilterField } from './types';
2
3
 
3
4
  export type GameType = 'SLOTS' | 'SPORTS' | 'BINGO' | 'FISHING' | 'LIVE' | 'GAMES';
4
5
  export type GameProvider__Next = 'DARWIN' | 'MEGABALL' | 'DRBINGO' | 'RTG';
@@ -40,21 +41,33 @@ export interface GamesByNameQueryVariables {
40
41
  }
41
42
  export declare const GAMES_BY_NAME_QUERY: string;
42
43
  export type GameSessionStatus = 'PENDING' | 'STARTING' | 'READY' | 'ENDED' | 'CANCELLED';
43
- export type GameSession = {
44
+ interface GameSession__Common {
44
45
  id: string;
45
46
  game: Game;
46
- status: Extract<GameSessionStatus, 'READY'>;
47
- launchUrl: string;
48
47
  dateTimeCreated: DateString;
49
48
  dateTimeLastUpdated: DateString;
50
- } | {
51
- id: string;
52
- game: Game;
53
- status: Exclude<GameSessionStatus, 'READY'>;
49
+ }
50
+ export interface GameSession__Pending extends GameSession__Common {
51
+ status: 'PENDING';
54
52
  launchUrl?: never;
55
- dateTimeCreated: DateString;
56
- dateTimeLastUpdated: DateString;
57
- };
53
+ }
54
+ export interface GameSession__Starting extends GameSession__Common {
55
+ status: 'STARTING';
56
+ launchUrl?: never;
57
+ }
58
+ export interface GameSession__Ready extends GameSession__Common {
59
+ status: 'READY';
60
+ launchUrl: string;
61
+ }
62
+ export interface GameSession__Ended extends GameSession__Common {
63
+ status: 'ENDED';
64
+ launchUrl?: string | null;
65
+ }
66
+ export interface GameSession__Cancelled extends GameSession__Common {
67
+ status: 'CANCELLED';
68
+ launchUrl?: never;
69
+ }
70
+ export type GameSession = GameSession__Ready | GameSession__Pending | GameSession__Starting | GameSession__Ended | GameSession__Cancelled;
58
71
  export interface GameSessionQuery {
59
72
  node?: GameSession | null;
60
73
  }
@@ -62,7 +75,7 @@ export interface GameSessionQueryVariables {
62
75
  id: string;
63
76
  }
64
77
  export declare const GAME_SESSION_QUERY: string;
65
- export type CreateGameSessionError = MutationError<'GameDoesNotExistError'>;
78
+ export type CreateGameSessionError = OperationError<'GameDoesNotExistError'>;
66
79
  export interface CreateGameSessionMutation {
67
80
  createGameSession?: null | CreateGameSessionError;
68
81
  }
@@ -82,3 +95,4 @@ export interface EndGameSessionMutationVariables {
82
95
  };
83
96
  }
84
97
  export declare const END_GAME_SESSION_MUTATION: string;
98
+ export {};
@@ -1,6 +1,7 @@
1
1
  import { GraphQLClient } from '../utils/graphql-client';
2
+ import { OperationResult } from '../utils/types';
2
3
  import { CreateGameSessionError, CreateGameSessionMutationVariables, EndGameSessionMutationVariables, Game, GameQueryVariables, GameSession, GameSessionQueryVariables, GamesByNameQueryVariables, GamesQueryVariables } from './game';
3
- import { OperationResult, PaginatedQueryResult, UnknownError } from './types';
4
+ import { PaginatedQueryResult } from './types';
4
5
 
5
6
  export declare class GameService {
6
7
  protected client: GraphQLClient;
@@ -10,5 +11,5 @@ export declare class GameService {
10
11
  gamesByName(variables?: GamesByNameQueryVariables): Promise<OperationResult<never, Game[]>>;
11
12
  gameSession(variables: GameSessionQueryVariables): Promise<OperationResult<never, GameSession | null | undefined>>;
12
13
  createGameSession(variables: CreateGameSessionMutationVariables): Promise<OperationResult<CreateGameSessionError>>;
13
- endGameSession(variables: EndGameSessionMutationVariables): Promise<OperationResult<UnknownError>>;
14
+ endGameSession(variables: EndGameSessionMutationVariables): Promise<OperationResult>;
14
15
  }
@@ -1,5 +1,7 @@
1
+ import { OperationError } from '../utils/types';
1
2
  import { File } from './file';
2
- import { DateString, Decimal, MutationError } from './types';
3
+ import { SecretQuestion } from './session';
4
+ import { DateString, Decimal } from './types';
3
5
 
4
6
  export interface Member {
5
7
  dateTimeLastActive?: DateString | null;
@@ -26,12 +28,16 @@ export interface MemberAccount {
26
28
  mobileNumberVerified?: boolean | null;
27
29
  mobileNumberVerificationRequired?: boolean | null;
28
30
  transactionPassword: boolean;
31
+ secretAnswerSubmitted?: boolean | null;
29
32
  dateTimeCreated: DateString;
30
33
  dateTimeLastUpdated: DateString;
31
34
  }
32
35
  export interface MemberAccountQuery {
33
36
  memberAccount: MemberAccount;
34
37
  }
38
+ /**
39
+ * _aka_ `Query.self`
40
+ */
35
41
  export declare const MEMBER_ACCOUNT_QUERY: string;
36
42
  export interface MemberVerification {
37
43
  id: string;
@@ -50,7 +56,7 @@ export interface MemberVerificationQuery {
50
56
  };
51
57
  }
52
58
  export declare const MEMBER_VERIFICATION_QUERY: string;
53
- export type RegisterMemberAccountError = MutationError<'AccountNameNotAvailableError' | 'InvalidPlatformError' | 'InvalidReCAPTCHAResponseError' | 'InvalidSMSVerificationCodeError' | 'MinimumAgeRequirementError' | 'MobileNumberNotAvailableError'>;
59
+ export type RegisterMemberAccountError = OperationError<'AccountNameNotAvailableError' | 'InvalidPlatformError' | 'InvalidReCAPTCHAResponseError' | 'InvalidSMSVerificationCodeError' | 'MinimumAgeRequirementError' | 'MobileNumberNotAvailableError'>;
54
60
  export interface RegisterMemberAccountMutation {
55
61
  registerMemberAccount?: null | RegisterMemberAccountError;
56
62
  }
@@ -68,7 +74,7 @@ export interface RegisterMemberAccountMutationVariables {
68
74
  reCAPTCHAResponse?: string;
69
75
  }
70
76
  export declare const REGISTER_MEMBER_ACCOUNT_MUTATION: string;
71
- export type UpdateMemberAccountError = MutationError<'AccountNameNotAvailableError' | 'EmailAddressNotAvailableError' | 'InvalidTransactionPasswordError' | 'MobileNumberNotAvailableError' | 'NickNameNotAvailableError' | 'RealNameAlreadySetError' | 'ValidIdAlreadySetError'>;
77
+ export type UpdateMemberAccountError = OperationError<'AccountNameNotAvailableError' | 'EmailAddressNotAvailableError' | 'InvalidTransactionPasswordError' | 'MobileNumberNotAvailableError' | 'NickNameNotAvailableError' | 'RealNameAlreadySetError' | 'ValidIdAlreadySetError'>;
72
78
  export interface UpdateMemberAccountMutation {
73
79
  updateMemberAccount?: null | UpdateMemberAccountError;
74
80
  }
@@ -85,13 +91,13 @@ export interface UpdateMemberAccountMutationVariables {
85
91
  transactionPassword?: string;
86
92
  validId?: string;
87
93
  mobileNumberVerificationRequired?: boolean;
88
- secretQuestion?: string;
94
+ secretQuestion?: SecretQuestion;
89
95
  secretAnswer?: string;
90
96
  };
91
97
  };
92
98
  }
93
99
  export declare const UPDATE_MEMBER_ACCOUNT_MUTATION: string;
94
- export type ResetPasswordError = MutationError<'AccountNotFoundError' | 'InvalidVerificationCodeError'>;
100
+ export type ResetPasswordError = OperationError<'AccountNotFoundError' | 'InvalidVerificationCodeError'>;
95
101
  export interface ResetPasswordMutation {
96
102
  resetPassword?: ResetPasswordError | null;
97
103
  }
@@ -112,7 +118,7 @@ export interface DeleteMemberAccountMutationVariables {
112
118
  };
113
119
  }
114
120
  export declare const DELETE_MEMBER_ACCOUNT_MUTATION: string;
115
- export type SendVerificationCodeError = MutationError<'InvalidPlatformError' | 'NotReadyToSendVerficationCodeError'>;
121
+ export type SendVerificationCodeError = OperationError<'InvalidPlatformError' | 'NotReadyToSendVerficationCodeError'>;
116
122
  export interface SendVerificationCodeMutation {
117
123
  sendVerificationCode?: SendVerificationCodeError | null;
118
124
  }
@@ -123,7 +129,7 @@ export interface SendVerificationCodeMutationVariables {
123
129
  };
124
130
  }
125
131
  export declare const SEND_VERIFICATION_CODE_MUTATION: string;
126
- export type VerifyMobileNumberError = MutationError<'InvalidSMSVerificationCodeError' | 'MobileNumberAlreadyVerifiedError'>;
132
+ export type VerifyMobileNumberError = OperationError<'InvalidSMSVerificationCodeError' | 'MobileNumberAlreadyVerifiedError'>;
127
133
  export interface VerifyMobileNumberMutation {
128
134
  verifyMobileNumber?: VerifyMobileNumberError | null;
129
135
  }
@@ -133,7 +139,7 @@ export interface VerifyMobileNumberMutationVariables {
133
139
  };
134
140
  }
135
141
  export declare const VERIFY_MOBILE_NUMBER_MUTATION: string;
136
- export type CreateMemberVerificationError = MutationError<'FileDoesNotExistError' | 'FileNotReadyError' | 'MemberVerificationAlreadyExistsError'>;
142
+ export type CreateMemberVerificationError = OperationError<'FileDoesNotExistError' | 'FileNotReadyError' | 'MemberVerificationAlreadyExistsError'>;
137
143
  export interface CreateMemberVerificationMutation {
138
144
  createMemberVerification?: CreateMemberVerificationError | null;
139
145
  }
@@ -150,7 +156,7 @@ export interface CreateMemberVerificationMutationVariables {
150
156
  };
151
157
  }
152
158
  export declare const CREATE_MEMBER_VERIFICATION_MUTATION: string;
153
- export type UpdateMemberVerificationError = MutationError<'FileDoesNotExistError' | 'FileNotReadyError' | 'MemberVerificationAlreadyApprovedError' | 'MemberVerificationDoesNotExistError'>;
159
+ export type UpdateMemberVerificationError = OperationError<'FileDoesNotExistError' | 'FileNotReadyError' | 'MemberVerificationAlreadyApprovedError' | 'MemberVerificationDoesNotExistError'>;
154
160
  export interface UpdateMemberVerificationMutation {
155
161
  updateMemberVerification?: UpdateMemberVerificationError | null;
156
162
  }
@@ -32,7 +32,7 @@ export interface Platform {
32
32
  gcashWithdrawalGatewaySettings?: WithdrawalGatewaySettings | null;
33
33
  mayaWithdrawalGatewaySettings?: WithdrawalGatewaySettings | null;
34
34
  mayaAppWithdrawalGatewaySettings?: WithdrawalGatewaySettings | null;
35
- pointsClubSettings: PointsClubSettings;
35
+ pointsClubSettings?: PointsClubSettings | null;
36
36
  }
37
37
  export type PlatformQuery = Platform;
38
38
  export declare const PLATFORM_QUERY: string;
@@ -1,4 +1,5 @@
1
- import { DateString, Decimal, MutationError } from './types';
1
+ import { OperationError } from '../utils/types';
2
+ import { DateString, Decimal } from './types';
2
3
 
3
4
  export interface PointsWallet {
4
5
  id: string;
@@ -11,12 +12,12 @@ export interface PointsWalletQuery {
11
12
  pointsWallet?: PointsWallet | null;
12
13
  }
13
14
  export declare const POINTS_TO_CASH_CONVERSION_MUTATION: string;
14
- export type PointsToCashConversionError = MutationError<'InsufficientPointsError'>;
15
15
  export interface PointsToCashConversionMutationVariables {
16
16
  input: {
17
17
  amount: Decimal;
18
18
  };
19
19
  }
20
+ export type PointsToCashConversionError = OperationError<'InsufficientPointsError'>;
20
21
  export interface PointsToCashConversionMutation {
21
22
  pointsToCashConversion?: PointsToCashConversionError | null;
22
23
  }
@@ -1,6 +1,6 @@
1
1
  import { GraphQLClient } from '../utils/graphql-client';
2
+ import { OperationResult } from '../utils/types';
2
3
  import { LatestBetRecord } from './bet-record';
3
- import { OperationResult } from './types';
4
4
 
5
5
  export declare class PortalService {
6
6
  private client;
@@ -1,4 +1,4 @@
1
- import { File } from './file';
1
+ import { File__Ready } from './file';
2
2
  import { DateString, EnumFilterField, Html } from './types';
3
3
 
4
4
  export type PromoType = 'DEPOSIT';
@@ -7,9 +7,7 @@ export interface Promo {
7
7
  id: string;
8
8
  type: PromoType;
9
9
  name: string;
10
- banner: Extract<File, {
11
- status: 'READY';
12
- }>;
10
+ banner: File__Ready;
13
11
  status: PromoStatus;
14
12
  description: Html;
15
13
  minimumBonusAmount?: string | null;
@@ -1,9 +1,10 @@
1
1
  import { GraphQLClient } from '../utils/graphql-client';
2
+ import { OperationResult } from '../utils/types';
2
3
  import { BetRecord, BetRecordsQueryVariables } from './bet-record';
3
4
  import { DepositRecord, DepositRecordsQueryVariables } from './deposit';
4
5
  import { Member } from './member';
5
6
  import { TransactionRecord, TransactionRecordsQueryVariables } from './transaction';
6
- import { OperationResult, PaginatedQueryResult } from './types';
7
+ import { PaginatedQueryResult } from './types';
7
8
  import { WithdrawalRecord, WithdrawalRecordsQueryVariables } from './withdrawal';
8
9
 
9
10
  export declare class ReportService {
@@ -1,26 +1,81 @@
1
- import { DateString, MutationError, UnknownError } from './types';
1
+ import { OperationError } from '../utils/types';
2
+ import { DateString } from './types';
2
3
 
3
- export type CreateSessionError = MutationError<'AccountNotFound' | 'AccountBlacklisted'> | UnknownError;
4
4
  export interface Session {
5
5
  id: string;
6
6
  dateTimeCreated: DateString;
7
7
  }
8
- export interface CreateSessionMutation {
9
- session: Session;
10
- accessToken: string;
11
- refreshToken: string;
12
- }
13
8
  export interface CreateSessionInput__NameAndPassword {
9
+ type: 'NAME_AND_PASSWORD';
14
10
  name: string;
15
11
  password: string;
16
12
  }
17
13
  export interface CreateSessionInput__MobileNumber {
14
+ type: 'MOBILE_NUMBER';
18
15
  mobileNumber: string;
19
16
  verificationCode: string;
20
17
  }
21
- export type CreateSessionInput = CreateSessionInput__NameAndPassword | CreateSessionInput__MobileNumber;
22
- export type RefreshSessionError = UnknownError | MutationError<'InvalidToken' | 'AccountBlacklisted' | 'SessionExpired'>;
18
+ export interface CreateSessionInput__Maya {
19
+ type: 'MAYA';
20
+ sessionId: string;
21
+ }
22
+ export type CreateSessionInput = CreateSessionInput__NameAndPassword | CreateSessionInput__MobileNumber | CreateSessionInput__Maya;
23
+ export type SecretQuestion = 'FIRST_PET' | 'FIRST_CAR' | 'FIRST_SCHOOL' | 'FAVORITE_BOOK' | 'FAVORITE_TEACHER' | 'BEST_CHILDHOOD_FRIEND' | 'BIRTH_PLACE' | 'MOTHERS_MAIDEN_NAME' | 'PARENTS_MET_CITY' | 'FAVORITE_MOVIE';
24
+ export interface Authenticator__SecurityQuestion {
25
+ type: 'SECURITY_QUESTION';
26
+ token: string;
27
+ secretQuestion: SecretQuestion;
28
+ }
29
+ export type Authenticator = Authenticator__SecurityQuestion;
30
+ export type CreateSessionMutation__NameAndPassword = {
31
+ session: Session;
32
+ accessToken?: never;
33
+ refreshToken?: never;
34
+ authenticator: Authenticator;
35
+ } | {
36
+ session: Session;
37
+ accessToken: string;
38
+ refreshToken: string;
39
+ authenticator?: never;
40
+ };
41
+ export interface CreateSessionMutation__MobileNumber {
42
+ session: Session;
43
+ accessToken: string;
44
+ refreshToken: string;
45
+ }
46
+ export interface CreateSessionMutation__Maya {
47
+ session: Session;
48
+ accessToken: string;
49
+ refreshToken: string;
50
+ }
51
+ export type CreateSessionMutation = CreateSessionMutation__NameAndPassword | CreateSessionMutation__MobileNumber | CreateSessionMutation__Maya;
52
+ export type CreateSessionError = OperationError<'AccountNotFound' | 'AccountBlacklisted'>;
53
+ export type RefreshSessionError = OperationError<'InvalidToken' | 'AccountBlacklisted' | 'SessionExpired'>;
23
54
  export interface RefreshSessionMutation {
24
55
  accessToken: string;
25
56
  refreshToken: string;
26
57
  }
58
+ export interface AuthenticateInput__SecurityQuestion {
59
+ type: 'SECURITY_QUESTION';
60
+ token: string;
61
+ secretAnswer: string;
62
+ }
63
+ export type AuthenticateInput = AuthenticateInput__SecurityQuestion;
64
+ export type AuthenticateError = OperationError<'InvalidTokenOrAnswer'>;
65
+ export interface AuthenticateMutation {
66
+ session: Session;
67
+ accessToken: string;
68
+ refreshToken: string;
69
+ }
70
+ export interface MayaSession {
71
+ id: string;
72
+ member?: string;
73
+ dateTimeCreated: DateString;
74
+ }
75
+ export interface MayaSessionQuery {
76
+ mayaSession?: MayaSession | null;
77
+ }
78
+ export interface MayaSessionQueryVariables {
79
+ id: string;
80
+ }
81
+ export declare const MAYA_SESSION_QUERY: string;
@@ -1,8 +1,6 @@
1
- import { HttpError } from '../utils/http-error';
1
+ import { Alias } from '../utils/types';
2
2
 
3
- export type Alias<T> = T & {
4
- _?: never;
5
- };
3
+ export type ID = Alias<string>;
6
4
  export type Decimal = Alias<string>;
7
5
  export type DateString = Alias<string>;
8
6
  export type Html = Alias<string>;
@@ -10,10 +8,13 @@ export interface Edge<T> {
10
8
  cursor: string;
11
9
  node: T;
12
10
  }
13
- export interface PageInfo {
14
- hasNextPage: boolean;
15
- endCursor?: string | null;
16
- }
11
+ export type PageInfo = {
12
+ hasNextPage: false;
13
+ endCursor?: never;
14
+ } | {
15
+ hasNextPage: true;
16
+ endCursor: string;
17
+ };
17
18
  export interface PaginatedQueryResult<T> {
18
19
  edges: Edge<T>[];
19
20
  totalCount: number;
@@ -66,28 +67,4 @@ export interface EnumFilterField<T> {
66
67
  in?: T[];
67
68
  notIn?: T[];
68
69
  }
69
- export interface MutationError<T extends string> {
70
- code: T;
71
- message: string;
72
- }
73
- export type UnknownError = MutationError<'UnknownError'>;
74
70
  export type SortOrder = 'ASC' | 'DESC';
75
- export type OperationResult<E extends MutationError<string> = never, T = never> = [T] extends [
76
- never
77
- ] ? {
78
- ok: false;
79
- data?: never;
80
- error: HttpError | E;
81
- } | {
82
- ok: true;
83
- data?: never;
84
- error?: never;
85
- } : {
86
- ok: false;
87
- data?: never;
88
- error: HttpError | E;
89
- } | {
90
- ok: true;
91
- data: T;
92
- error?: never;
93
- };
@@ -1,10 +1,11 @@
1
+ import { OperationResult } from '../utils/types';
1
2
  import { Bonus, CashbackBonus, ClaimCashbackBonusError, ClaimCashbackBonusMutationVariables } from './bonus';
2
3
  import { Cashback } from './cashback';
3
4
  import { CreateDepositError, CreateGCashDepositMutationVariables, CreateMayaAppDepositMutationVariables, CreateMayaDepositMutationVariables, Deposit, DepositQueryVariables } from './deposit';
4
5
  import { GameService } from './game.service';
5
6
  import { PointsToCashConversionError, PointsToCashConversionMutationVariables, PointsWallet } from './points';
6
7
  import { AvailablePromosQueryVariables, Promo } from './promo';
7
- import { OperationResult } from './types';
8
+ import { MayaSession, MayaSessionQueryVariables } from './session';
8
9
  import { Wallet } from './wallet';
9
10
  import { CreateBankWithdrawalMutationVariables, CreateGCashWithdrawalMutationVariables, CreateMayaAppWithdrawalMutationVariables, CreateMayaWithdrawalMutationVariables, CreateWithdrawalError } from './withdrawal';
10
11
 
@@ -27,4 +28,5 @@ export declare class WalletService extends GameService {
27
28
  remainingDailyWithdrawalsCount(): Promise<OperationResult<never, number>>;
28
29
  pointsWallet(): Promise<OperationResult<never, PointsWallet | null | undefined>>;
29
30
  pointsToCashConversion(variables: PointsToCashConversionMutationVariables): Promise<OperationResult<PointsToCashConversionError>>;
31
+ mayaSession(variables: MayaSessionQueryVariables): Promise<OperationResult<never, MayaSession | null | undefined>>;
30
32
  }
@@ -1,8 +1,9 @@
1
- import { DateFilterField, DateString, Decimal, EnumFilterField, MutationError, PaginatedQuery, StringFilterField } from './types';
1
+ import { OperationError } from '../utils/types';
2
+ import { DateFilterField, DateString, Decimal, EnumFilterField, PaginatedQuery, StringFilterField } from './types';
2
3
 
3
4
  export type Bank = 'AUBKPHMM' | 'MBTCPHMM' | 'BNORPHMM' | 'MKRUPHM1';
4
5
  export type WithdrawalRecordStatus = 'PENDING' | 'APPROVED' | 'REJECTED' | 'CONFIRMED' | 'CANCELLED';
5
- export type WithdrawalRecordType = WithdrawalRecord['type'];
6
+ export type WithdrawalRecordType = 'MANUAL' | 'BANK' | 'GCASH' | 'MAYA_APP';
6
7
  interface Common {
7
8
  id: string;
8
9
  fee: Decimal;
@@ -30,12 +31,12 @@ export interface GCashWithdrawalRecord extends Common {
30
31
  bank?: never;
31
32
  recipientMobileNumber: string;
32
33
  }
33
- export interface MayaWithdrawalRecord extends Common {
34
+ export interface MayaAppWithdrawalRecord extends Common {
34
35
  type: 'MAYA_APP';
35
36
  bank?: never;
36
37
  recipientMobileNumber?: never;
37
38
  }
38
- export type WithdrawalRecord = ManualWithdrawalRecord | BankWithdrawalRecord | GCashWithdrawalRecord | MayaWithdrawalRecord;
39
+ export type WithdrawalRecord = ManualWithdrawalRecord | BankWithdrawalRecord | GCashWithdrawalRecord | MayaAppWithdrawalRecord;
39
40
  export interface WithdrawalRecordsQuery {
40
41
  member: PaginatedQuery<'withdrawalRecords', WithdrawalRecord>;
41
42
  }
@@ -52,7 +53,7 @@ export interface WithdrawalRecordsQueryVariables {
52
53
  };
53
54
  }
54
55
  export declare const WITHDRAWAL_RECORDS_QUERY: string;
55
- export type CreateWithdrawalError = MutationError<'AccountNotVerifiedError' | 'InvalidTransactionPasswordError' | 'InvalidWithdrawalAmountError' | 'MobileNumberNotVerifiedError' | 'NotEnoughBalanceError' | 'WithdrawalDailyLimitExceededError'>;
56
+ export type CreateWithdrawalError = OperationError<'AccountNotVerifiedError' | 'InvalidTransactionPasswordError' | 'InvalidWithdrawalAmountError' | 'MobileNumberNotVerifiedError' | 'NotEnoughBalanceError' | 'WithdrawalDailyLimitExceededError'>;
56
57
  export interface CreateGCashWithdrawalMutation {
57
58
  createGCashWithdrawal?: CreateWithdrawalError | null;
58
59
  }
@@ -1,5 +1,4 @@
1
- import { HttpError } from './http-error';
2
- import { GenericObject } from './types';
1
+ import { GenericObject, OperationResult } from './types';
3
2
 
4
3
  export type GraphQLClientMiddleware = (request: Request) => Request | Promise<Request>;
5
4
  export interface GraphQLClientFetchOptions extends Omit<RequestInit, 'body' | 'method'> {
@@ -8,21 +7,15 @@ export interface GraphQLClientConfig {
8
7
  middlewares?: GraphQLClientMiddleware[];
9
8
  fetchOptions?: GraphQLClientFetchOptions;
10
9
  }
11
- export type GraphQLClientResponse<Data> = {
12
- ok: true;
13
- data: Data;
14
- } | {
15
- ok: false;
16
- error: HttpError;
17
- };
10
+ export type GraphQLClientResponse<Data> = OperationResult<never, Data>;
18
11
  export declare class GraphQLClient {
19
12
  private url;
20
13
  private options;
21
14
  private middlewares;
22
15
  constructor(url: string, config?: GraphQLClientConfig);
23
- request<Data>(query: string, variables?: GenericObject): Promise<GraphQLClientResponse<Data>>;
16
+ request<Data, Variables extends GenericObject = GenericObject>(query: string, variables?: Variables): Promise<OperationResult<never, Data>>;
24
17
  /** Single file upload */
25
- upload<Data>(query: string, variables: GenericObject): Promise<GraphQLClientResponse<Data>>;
18
+ upload<Data, Variables extends GenericObject = GenericObject>(query: string, variables: Variables): Promise<OperationResult<never, Data>>;
26
19
  private exec;
27
20
  private runMiddlewares;
28
21
  private createUploadBody;
@@ -0,0 +1,34 @@
1
+ import { OperationResult } from './types';
2
+
3
+ export type RestClientMiddleware = (req: Request) => Request | Promise<Request>;
4
+ export interface RestClientFetchOptions extends Omit<RequestInit, 'body' | 'method'> {
5
+ }
6
+ export interface RestClientConfig {
7
+ middlewares?: RestClientMiddleware[];
8
+ fetchOptions?: RestClientFetchOptions;
9
+ }
10
+ interface PostOptions {
11
+ body?: Record<string, unknown>;
12
+ headers?: HeadersInit;
13
+ searchParams?: URLSearchParams;
14
+ }
15
+ interface GetOptions {
16
+ headers?: HeadersInit;
17
+ searchParams?: URLSearchParams;
18
+ }
19
+ interface DeleteOptions {
20
+ headers?: HeadersInit;
21
+ searchParams?: URLSearchParams;
22
+ }
23
+ export declare class RestClient {
24
+ private url;
25
+ private options;
26
+ private middlewares;
27
+ constructor(url: string, config?: RestClientConfig);
28
+ post<Data = unknown, Error = never>(path: string, options?: PostOptions): Promise<OperationResult<Error, Data>>;
29
+ get<Data = unknown, Error = never>(path: string, options?: GetOptions): Promise<OperationResult<Error, Data>>;
30
+ delete<Error = never>(path: string, options?: DeleteOptions): Promise<OperationResult<Error>>;
31
+ private runMiddlewares;
32
+ private safeToJson;
33
+ }
34
+ export {};
@@ -0,0 +1,3 @@
1
+ import { HttpError, OperationError } from './types';
2
+
3
+ export declare function statusCodeToError(value: number, message?: string): OperationError<HttpError>;