@opexa/portal-sdk 0.59.107 → 0.59.111
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/README.md +1691 -1634
- package/dist/{chunk-7APXFZ5G.js → chunk-5WRVWQBT.js} +3 -3
- package/dist/chunk-5WRVWQBT.js.map +1 -0
- package/dist/{chunk-LKPG4XPL.js → chunk-DSBYVM5T.js} +83 -8
- package/dist/chunk-DSBYVM5T.js.map +1 -0
- package/dist/{chunk-WVFSGB7Y.js → chunk-ROBGEUSE.js} +2 -2
- package/dist/chunk-ROBGEUSE.js.map +1 -0
- package/dist/index.cjs +123 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -3
- package/dist/index.d.ts +11 -3
- package/dist/index.js +46 -15
- package/dist/index.js.map +1 -1
- package/dist/services/index.cjs +80 -5
- package/dist/services/index.cjs.map +1 -1
- package/dist/services/index.d.cts +7 -5
- package/dist/services/index.d.ts +7 -5
- package/dist/services/index.js +2 -2
- package/dist/{types-BLz1FVd9.d.ts → types-LlyaAtr8.d.ts} +25 -3
- package/dist/{types-B_OD1nx7.d.cts → types-ujZqvY5s.d.cts} +25 -3
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-7APXFZ5G.js.map +0 -1
- package/dist/chunk-LKPG4XPL.js.map +0 -1
- package/dist/chunk-WVFSGB7Y.js.map +0 -1
|
@@ -39,5 +39,5 @@ function callIfFn(value, ...args) {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
export { callIfFn, gql, statusCodeToOperationError };
|
|
42
|
-
//# sourceMappingURL=chunk-
|
|
43
|
-
//# sourceMappingURL=chunk-
|
|
42
|
+
//# sourceMappingURL=chunk-ROBGEUSE.js.map
|
|
43
|
+
//# sourceMappingURL=chunk-ROBGEUSE.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/gql.ts","../src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S,uBAAA;AAClD,CAAA;;;ACtBA,SAAS,WACR,KAAA,EACuC;AACvC,EAAA,OAAO,OAAO,KAAA,KAAU,UAAA;AACzB;AAEO,SAAS,QAAA,CACf,UACG,IAAA,EACF;AACD,EAAA,IAAI,UAAA,CAAyB,KAAK,CAAA,EAAG;AACpC,IAAA,OAAO,KAAA,CAAM,GAAG,IAAI,CAAA;AAAA,EACrB,CAAA,MAAO;AACN,IAAA,OAAO,KAAA;AAAA,EACR;AACD","file":"chunk-ROBGEUSE.js","sourcesContent":["export function gql(strings: TemplateStringsArray, ...values: unknown[]) {\n\tlet result = '';\n\n\tfor (const [index, string] of strings.entries()) {\n\t\tconst value = values.at(index) ?? '';\n\n\t\tresult = `${result}${string}${value}`;\n\t}\n\n\treturn result.trim();\n}\n","import type { HttpError, OperationError } from '../types/index.js';\n\nexport function statusCodeToOperationError(\n\tvalue: number,\n\tmessage?: string,\n): OperationError<HttpError> {\n\tconst e = ERROR_MAP[value] ? ERROR_MAP[value] : ERROR_MAP[500];\n\n\treturn {\n\t\tname: e.name,\n\t\tmessage: message ?? e.message,\n\t};\n}\n\nconst ERROR_MAP: Record<number, OperationError<HttpError>> = {\n\t400: { name: 'HttpBadRequest', message: 'Bad Request' },\n\t401: { name: 'HttpUnauthorized', message: 'Unauthorized' },\n\t403: { name: 'HttpForbidden', message: 'Forbidden' },\n\t404: { name: 'HttpNotFound', message: 'Not Found' },\n\t408: { name: 'HttpRequestTimeout', message: 'Request Timeout' },\n\t429: { name: 'HttpTooManyRequests', message: 'Too Many Requests' },\n\t500: { name: 'HttpInternalServerError', message: 'Internal Server Error' },\n};\n","function isFunction<Return, Args = never>(\n\tvalue: unknown | ((...args: Args[]) => Return),\n): value is (...args: Args[]) => Return {\n\treturn typeof value === 'function';\n}\n\nexport function callIfFn<Return, Args = never>(\n\tvalue: Return | ((...args: Args[]) => Return),\n\t...args: Args[]\n) {\n\tif (isFunction<Return, Args>(value)) {\n\t\treturn value(...args);\n\t} else {\n\t\treturn value;\n\t}\n}\n"]}
|
package/dist/index.cjs
CHANGED
|
@@ -3434,8 +3434,8 @@ var WALLET_GAMES_QUERY = gql`
|
|
|
3434
3434
|
}
|
|
3435
3435
|
}
|
|
3436
3436
|
`;
|
|
3437
|
-
var
|
|
3438
|
-
query
|
|
3437
|
+
var _GAMES_NEXT_QUERY = gql`
|
|
3438
|
+
query _games($first: Int, $after: Cursor, $filter: _GameFilterInput) {
|
|
3439
3439
|
_games(first: $first, after: $after, filter: $filter) {
|
|
3440
3440
|
totalCount
|
|
3441
3441
|
pageInfo {
|
|
@@ -3456,12 +3456,65 @@ var PLATFORM_GAMES_QUERY = gql`
|
|
|
3456
3456
|
hidden
|
|
3457
3457
|
hasFreeBet
|
|
3458
3458
|
hasJackpot
|
|
3459
|
+
image
|
|
3460
|
+
groups {
|
|
3461
|
+
id
|
|
3462
|
+
name
|
|
3463
|
+
}
|
|
3464
|
+
}
|
|
3465
|
+
}
|
|
3466
|
+
}
|
|
3467
|
+
}
|
|
3468
|
+
}
|
|
3469
|
+
`;
|
|
3470
|
+
var _GAMES_NEXT_QUERY__STAGING = gql`
|
|
3471
|
+
query _games($first: Int, $after: Cursor, $filter: _GameFilterInput) {
|
|
3472
|
+
_games(first: $first, after: $after, filter: $filter) {
|
|
3473
|
+
totalCount
|
|
3474
|
+
pageInfo {
|
|
3475
|
+
hasNextPage
|
|
3476
|
+
endCursor
|
|
3477
|
+
}
|
|
3478
|
+
edges {
|
|
3479
|
+
cursor
|
|
3480
|
+
node {
|
|
3481
|
+
... on _Game {
|
|
3482
|
+
id
|
|
3483
|
+
reference
|
|
3484
|
+
name
|
|
3485
|
+
displayName
|
|
3486
|
+
type
|
|
3487
|
+
provider
|
|
3488
|
+
status
|
|
3489
|
+
hidden
|
|
3490
|
+
hasFreeBet
|
|
3491
|
+
hasJackpot
|
|
3492
|
+
returnToPlayer
|
|
3493
|
+
minimumBet
|
|
3494
|
+
maximumBet
|
|
3495
|
+
image
|
|
3496
|
+
groups {
|
|
3497
|
+
id
|
|
3498
|
+
name
|
|
3499
|
+
}
|
|
3459
3500
|
}
|
|
3460
3501
|
}
|
|
3461
3502
|
}
|
|
3462
3503
|
}
|
|
3463
3504
|
}
|
|
3464
3505
|
`;
|
|
3506
|
+
var WALLET_GAMES_BY_NAME_QUERY = gql`
|
|
3507
|
+
query WalletGamesByName(
|
|
3508
|
+
$search: String!
|
|
3509
|
+
$first: Int
|
|
3510
|
+
$filter: _GameFilterInput
|
|
3511
|
+
) {
|
|
3512
|
+
_gamesByName(search: $search, first: $first, filter: $filter) {
|
|
3513
|
+
id
|
|
3514
|
+
name
|
|
3515
|
+
}
|
|
3516
|
+
}
|
|
3517
|
+
`;
|
|
3465
3518
|
var GAME_GROUPS_QUERY = gql`
|
|
3466
3519
|
query GameGroups(
|
|
3467
3520
|
$first: Int
|
|
@@ -5984,8 +6037,10 @@ var TriggerService = class {
|
|
|
5984
6037
|
// src/services/wallet.service.ts
|
|
5985
6038
|
var WalletService = class {
|
|
5986
6039
|
client;
|
|
5987
|
-
|
|
6040
|
+
environment;
|
|
6041
|
+
constructor(client, environment = "development") {
|
|
5988
6042
|
this.client = client;
|
|
6043
|
+
this.environment = environment;
|
|
5989
6044
|
}
|
|
5990
6045
|
async promos() {
|
|
5991
6046
|
const res = await this.client.request(PROMOS_QUERY, void 0);
|
|
@@ -6885,8 +6940,11 @@ var WalletService = class {
|
|
|
6885
6940
|
data: res.data.games
|
|
6886
6941
|
};
|
|
6887
6942
|
}
|
|
6888
|
-
async
|
|
6889
|
-
const res = await this.client.request(
|
|
6943
|
+
async _games(variables) {
|
|
6944
|
+
const res = await this.client.request(
|
|
6945
|
+
this.environment === "production" ? _GAMES_NEXT_QUERY : _GAMES_NEXT_QUERY__STAGING,
|
|
6946
|
+
variables
|
|
6947
|
+
);
|
|
6890
6948
|
if (!res.ok) return res;
|
|
6891
6949
|
if (!res.data._games) {
|
|
6892
6950
|
return {
|
|
@@ -6902,6 +6960,23 @@ var WalletService = class {
|
|
|
6902
6960
|
data: res.data._games
|
|
6903
6961
|
};
|
|
6904
6962
|
}
|
|
6963
|
+
async _gamesByName(variables) {
|
|
6964
|
+
const res = await this.client.request(WALLET_GAMES_BY_NAME_QUERY, variables);
|
|
6965
|
+
if (!res.ok) return res;
|
|
6966
|
+
if (!res.data._gamesByName) {
|
|
6967
|
+
return {
|
|
6968
|
+
ok: false,
|
|
6969
|
+
error: {
|
|
6970
|
+
name: "UnknownError",
|
|
6971
|
+
message: "Something went wrong."
|
|
6972
|
+
}
|
|
6973
|
+
};
|
|
6974
|
+
}
|
|
6975
|
+
return {
|
|
6976
|
+
ok: true,
|
|
6977
|
+
data: res.data._gamesByName
|
|
6978
|
+
};
|
|
6979
|
+
}
|
|
6905
6980
|
async cabinetWithdrawal(variables) {
|
|
6906
6981
|
const res = await this.client.request(CABINET_WITHDRAWAL_QUERY, variables);
|
|
6907
6982
|
return res.ok ? { ok: res.ok, data: res.data.node } : res;
|
|
@@ -8645,6 +8720,7 @@ var Transformer = class {
|
|
|
8645
8720
|
latestBetRecord: this.latestBetRecord.bind(this),
|
|
8646
8721
|
transactionRecord: this.transactionRecord.bind(this),
|
|
8647
8722
|
game: this.game.bind(this),
|
|
8723
|
+
_games: this._games.bind(this),
|
|
8648
8724
|
gameSession: this.gameSession.bind(this),
|
|
8649
8725
|
promo: this.promo.bind(this),
|
|
8650
8726
|
cashback: this.cashback.bind(this),
|
|
@@ -9822,6 +9898,39 @@ var Transformer = class {
|
|
|
9822
9898
|
};
|
|
9823
9899
|
return o;
|
|
9824
9900
|
}
|
|
9901
|
+
_games(data) {
|
|
9902
|
+
const games = data.edges.flatMap(({ cursor, node }) => {
|
|
9903
|
+
if (node.hidden || node.status !== "ACTIVE" || !node.type || !node.provider) {
|
|
9904
|
+
return [];
|
|
9905
|
+
}
|
|
9906
|
+
const name = node.displayName?.trim() || node.name;
|
|
9907
|
+
if (!name) return [];
|
|
9908
|
+
const imageId = objectId.ObjectId.from(node.id).toString("hex");
|
|
9909
|
+
const fallback = `${ENDPOINTS.production.static}/images/${node.provider.toLowerCase()}/thumbnail-${imageId}.webp`;
|
|
9910
|
+
return [
|
|
9911
|
+
{
|
|
9912
|
+
id: node.id,
|
|
9913
|
+
// Wallet's ID is the launch/favorite reference; reference is a provider code.
|
|
9914
|
+
reference: node.id,
|
|
9915
|
+
name,
|
|
9916
|
+
type: node.type,
|
|
9917
|
+
provider: node.provider,
|
|
9918
|
+
images: [
|
|
9919
|
+
...new Set(node.image ? [node.image, fallback] : [fallback])
|
|
9920
|
+
],
|
|
9921
|
+
tags: [],
|
|
9922
|
+
favorite: false,
|
|
9923
|
+
cursor
|
|
9924
|
+
}
|
|
9925
|
+
];
|
|
9926
|
+
});
|
|
9927
|
+
return {
|
|
9928
|
+
_games: games,
|
|
9929
|
+
totalCount: data.totalCount,
|
|
9930
|
+
hasNextPage: data.pageInfo.hasNextPage,
|
|
9931
|
+
endCursor: data.pageInfo.endCursor ?? void 0
|
|
9932
|
+
};
|
|
9933
|
+
}
|
|
9825
9934
|
gameSession(data) {
|
|
9826
9935
|
const o = {
|
|
9827
9936
|
id: data.id,
|
|
@@ -10513,7 +10622,8 @@ var Sdk = class {
|
|
|
10513
10622
|
new GraphQLClient(fileUrl, graphqlClientConfig)
|
|
10514
10623
|
);
|
|
10515
10624
|
const walletService = new WalletService(
|
|
10516
|
-
new GraphQLClient(walletUrl, graphqlClientConfig)
|
|
10625
|
+
new GraphQLClient(walletUrl, graphqlClientConfig),
|
|
10626
|
+
environment
|
|
10517
10627
|
);
|
|
10518
10628
|
const accountService = new AccountService(
|
|
10519
10629
|
new GraphQLClient(accountUrl, graphqlClientConfig),
|
|
@@ -12222,7 +12332,11 @@ var Sdk = class {
|
|
|
12222
12332
|
}
|
|
12223
12333
|
};
|
|
12224
12334
|
}
|
|
12225
|
-
|
|
12335
|
+
/**
|
|
12336
|
+
* Fetches the Wallet-backed platform game catalog with cursor pagination.
|
|
12337
|
+
* Search is applied to `displayName.contains` alongside the supplied filters.
|
|
12338
|
+
*/
|
|
12339
|
+
async _games__next(input) {
|
|
12226
12340
|
let variables;
|
|
12227
12341
|
if (input) {
|
|
12228
12342
|
const { search, ...rest } = input;
|
|
@@ -12237,19 +12351,11 @@ var Sdk = class {
|
|
|
12237
12351
|
}
|
|
12238
12352
|
};
|
|
12239
12353
|
}
|
|
12240
|
-
const res = await this.walletService.
|
|
12354
|
+
const res = await this.walletService._games(variables);
|
|
12241
12355
|
if (!res.ok) return res;
|
|
12242
12356
|
return {
|
|
12243
12357
|
ok: true,
|
|
12244
|
-
data:
|
|
12245
|
-
platformGames: res.data.edges.map(({ cursor, node }) => ({
|
|
12246
|
-
...node,
|
|
12247
|
-
cursor
|
|
12248
|
-
})),
|
|
12249
|
-
totalCount: res.data.totalCount,
|
|
12250
|
-
hasNextPage: res.data.pageInfo.hasNextPage,
|
|
12251
|
-
endCursor: res.data.pageInfo.endCursor ?? void 0
|
|
12252
|
-
}
|
|
12358
|
+
data: this.transformer.transform._games(res.data)
|
|
12253
12359
|
};
|
|
12254
12360
|
}
|
|
12255
12361
|
async gameGroups(input) {
|