@opexa/portal-sdk 0.59.88 → 0.59.89

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/dist/index.cjs CHANGED
@@ -3838,6 +3838,79 @@ var MEMBER_FREE_BET_DROPS_QUERY = gql`
3838
3838
  }
3839
3839
  }
3840
3840
  `;
3841
+ var _GAMES_QUERY = gql`
3842
+ query _Games($first: Int, $after: Cursor, $filter: GameFilterInput) {
3843
+ games(first: $first, after: $after, filter: $filter) {
3844
+ edges {
3845
+ cursor
3846
+ node {
3847
+ ... on Game {
3848
+ id
3849
+ name
3850
+ displayName
3851
+ type
3852
+ provider
3853
+ reference
3854
+ hidden
3855
+ image
3856
+ }
3857
+ }
3858
+ }
3859
+ pageInfo {
3860
+ hasNextPage
3861
+ endCursor
3862
+ }
3863
+ }
3864
+ }
3865
+ `;
3866
+ var _GAME_GROUPS_QUERY = gql`
3867
+ query _GameGroups {
3868
+ gameGroups {
3869
+ id
3870
+ name
3871
+ }
3872
+ }
3873
+ `;
3874
+ var _GAME_GROUP_NODE_QUERY = gql`
3875
+ query _GameGroupNode($id: ObjectId!, $limit: Int, $offset: Int) {
3876
+ node(id: $id) {
3877
+ ... on GameGroup {
3878
+ id
3879
+ name
3880
+ games(limit: $limit, offset: $offset) {
3881
+ id
3882
+ name
3883
+ displayName
3884
+ type
3885
+ provider
3886
+ reference
3887
+ hidden
3888
+ image
3889
+ }
3890
+ }
3891
+ }
3892
+ }
3893
+ `;
3894
+ var _GAME_NODE_QUERY = gql`
3895
+ query _GameNode($id: ObjectId!) {
3896
+ node(id: $id) {
3897
+ ... on Game {
3898
+ id
3899
+ name
3900
+ displayName
3901
+ type
3902
+ provider
3903
+ reference
3904
+ hidden
3905
+ image
3906
+ groups {
3907
+ id
3908
+ name
3909
+ }
3910
+ }
3911
+ }
3912
+ }
3913
+ `;
3841
3914
 
3842
3915
  // src/services/utils.ts
3843
3916
  function createOperationError(code) {
@@ -5242,6 +5315,66 @@ var PortalService = class {
5242
5315
  data: res.data
5243
5316
  };
5244
5317
  }
5318
+ async _games(variables) {
5319
+ const res = await this.client.request(
5320
+ _GAMES_QUERY,
5321
+ variables
5322
+ );
5323
+ if (!res.ok) return res;
5324
+ if (!res.data.games) {
5325
+ return {
5326
+ ok: false,
5327
+ error: {
5328
+ name: "UnknownError",
5329
+ message: "Something went wrong."
5330
+ }
5331
+ };
5332
+ }
5333
+ return {
5334
+ ok: true,
5335
+ data: res.data.games
5336
+ };
5337
+ }
5338
+ async _gameGroups() {
5339
+ const res = await this.client.request(
5340
+ _GAME_GROUPS_QUERY
5341
+ );
5342
+ if (!res.ok) return res;
5343
+ if (!res.data.gameGroups) {
5344
+ return {
5345
+ ok: false,
5346
+ error: {
5347
+ name: "UnknownError",
5348
+ message: "Something went wrong."
5349
+ }
5350
+ };
5351
+ }
5352
+ return {
5353
+ ok: true,
5354
+ data: res.data.gameGroups
5355
+ };
5356
+ }
5357
+ async _gameGroupNode(id, limit, offset) {
5358
+ const res = await this.client.request(
5359
+ _GAME_GROUP_NODE_QUERY,
5360
+ { id, limit, offset }
5361
+ );
5362
+ if (!res.ok) return res;
5363
+ return {
5364
+ ok: true,
5365
+ data: res.data.node
5366
+ };
5367
+ }
5368
+ async _gameNode(id) {
5369
+ const res = await this.client.request(_GAME_NODE_QUERY, {
5370
+ id
5371
+ });
5372
+ if (!res.ok) return res;
5373
+ return {
5374
+ ok: true,
5375
+ data: res.data.node
5376
+ };
5377
+ }
5245
5378
  async recommendedGames() {
5246
5379
  const res = await this.client.request(
5247
5380
  RECOMMENDED_GAMES_QUERY
@@ -11811,6 +11944,92 @@ var Sdk = class {
11811
11944
  data: res.data ?? null
11812
11945
  };
11813
11946
  }
11947
+ /**
11948
+ * Fetches platform-scoped games from the Portal GraphQL API.
11949
+ *
11950
+ * Portal `Game.id` values are platform-game IDs, distinct from Wallet
11951
+ * global-game IDs. Never pass them to Wallet game-management mutations.
11952
+ *
11953
+ * The Portal `games` resolver does not supply `totalCount`, so the
11954
+ * result does not include it. Use `hasNextPage` and `endCursor` for
11955
+ * cursor pagination.
11956
+ *
11957
+ * For player-facing catalogs, pass `filter: { hidden: { equal: false } }`.
11958
+ *
11959
+ * Portal is eventually consistent — refetch or poll after Wallet writes.
11960
+ */
11961
+ async _games(input) {
11962
+ const res = await this.portalService._games(input);
11963
+ if (!res.ok) return res;
11964
+ return {
11965
+ ok: true,
11966
+ data: {
11967
+ _games: res.data.edges.map(({ cursor, node }) => ({
11968
+ ...node,
11969
+ cursor
11970
+ })),
11971
+ hasNextPage: res.data.pageInfo.hasNextPage,
11972
+ endCursor: res.data.pageInfo.endCursor ?? void 0
11973
+ }
11974
+ };
11975
+ }
11976
+ /**
11977
+ * Fetches all game groups for the current platform.
11978
+ *
11979
+ * Portal sorts the result by name ascending. There is no pagination.
11980
+ * An empty array is a valid result (platform with no configured groups).
11981
+ */
11982
+ async _gameGroups() {
11983
+ const res = await this.portalService._gameGroups();
11984
+ if (!res.ok) return res;
11985
+ return {
11986
+ ok: true,
11987
+ data: res.data
11988
+ };
11989
+ }
11990
+ /**
11991
+ * Fetches a single game group and its ordered games via `node(id)`.
11992
+ *
11993
+ * The returned `games` array preserves the Wallet-managed group order.
11994
+ * Missing projected platform games are filtered out by the resolver.
11995
+ * Omit `limit` and `offset` to load the whole group (Wallet caps at 100).
11996
+ *
11997
+ * Returns `{ ok: true, data: null }` when the group is missing, belongs
11998
+ * to another platform, or the platform context is invalid.
11999
+ */
12000
+ async _gameGroup(id, opts) {
12001
+ const res = await this.portalService._gameGroupNode(
12002
+ id,
12003
+ opts?.limit,
12004
+ opts?.offset
12005
+ );
12006
+ if (!res.ok) return res;
12007
+ return {
12008
+ ok: true,
12009
+ data: res.data
12010
+ };
12011
+ }
12012
+ /**
12013
+ * Fetches a single game by Portal platform-game ID via `node(id)`.
12014
+ *
12015
+ * Requires a Portal `Game.id` (platform-game ID). Passing a Wallet
12016
+ * global-game ID returns `null`.
12017
+ *
12018
+ * Includes reverse group membership via `Game.groups`. Legacy Portal
12019
+ * game rows may return an empty `groups` array — treat this as no
12020
+ * known memberships, not a request failure.
12021
+ *
12022
+ * Returns `{ ok: true, data: null }` when the game is missing, belongs
12023
+ * to another platform, or the platform context is invalid.
12024
+ */
12025
+ async _game(id) {
12026
+ const res = await this.portalService._gameNode(id);
12027
+ if (!res.ok) return res;
12028
+ return {
12029
+ ok: true,
12030
+ data: res.data
12031
+ };
12032
+ }
11814
12033
  async games__next(input) {
11815
12034
  const res = await this.cmsPortalService.games__next(input);
11816
12035
  if (!res.ok) return res;