@hyve-sdk/js 2.3.0 → 2.4.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/dist/index.d.mts CHANGED
@@ -125,6 +125,47 @@ interface GameDataBatchItem {
125
125
  /** Dot-notation path targeting a nested field (e.g. "stats.score") */
126
126
  path?: string;
127
127
  }
128
+ /**
129
+ * Persistent Game Data Leaderboard Types
130
+ */
131
+ /** A single entry in the game data leaderboard */
132
+ interface GameDataLeaderboardEntry {
133
+ rank: number;
134
+ username: string;
135
+ avatar_url?: string | null;
136
+ hyve_user_id: string;
137
+ score: number;
138
+ }
139
+ /** The requesting user's position within the leaderboard */
140
+ interface GameDataLeaderboardUserPosition {
141
+ rank: number;
142
+ score: number;
143
+ entry: GameDataLeaderboardEntry;
144
+ }
145
+ /** Response from the game data leaderboard endpoint */
146
+ interface GameDataLeaderboardResponse {
147
+ entries: GameDataLeaderboardEntry[];
148
+ next_cursor?: string | null;
149
+ has_more: boolean;
150
+ /** Present when the authenticated user has data for the queried key */
151
+ user_position?: GameDataLeaderboardUserPosition | null;
152
+ }
153
+ /** Parameters for fetching a game data leaderboard */
154
+ interface GetGameDataLeaderboardParams {
155
+ /** Data key to rank users by (e.g. "high_score", "lines_cleared") */
156
+ key: string;
157
+ /**
158
+ * Dot-notation path to extract a numeric score from a nested JSON value.
159
+ * Leave empty to use the top-level value (e.g. "stats.score").
160
+ */
161
+ score_path?: string;
162
+ /** Sort direction - "asc" or "desc" (default: "desc") */
163
+ sort?: 'asc' | 'desc';
164
+ /** Number of results per page, 1-100 (default: 10) */
165
+ limit?: number;
166
+ /** Pagination cursor from a previous response's next_cursor */
167
+ cursor?: string;
168
+ }
128
169
 
129
170
  /**
130
171
  * Ads Service for Hyve SDK
@@ -586,6 +627,13 @@ declare class HyveClient {
586
627
  * @returns Promise resolving to number of entries deleted
587
628
  */
588
629
  deleteMultipleGameData(keys: string[], storage?: 'cloud' | 'local'): Promise<number>;
630
+ /**
631
+ * Fetch the persistent game data leaderboard for a given key.
632
+ * Rankings are derived from numeric values stored via saveGameData / batchSaveGameData.
633
+ * @param params Leaderboard query parameters (key is required)
634
+ * @returns Promise resolving to the leaderboard response including the caller's position
635
+ */
636
+ getGameDataLeaderboard(params: GetGameDataLeaderboardParams): Promise<GameDataLeaderboardResponse>;
589
637
  /**
590
638
  * Configure storage mode
591
639
  * @param mode Storage mode ('cloud' or 'local')
@@ -1095,4 +1143,4 @@ declare class NativeBridge {
1095
1143
  */
1096
1144
  declare function generateUUID(): string;
1097
1145
 
1098
- export { type AdConfig, type AdResult, type AdType, AdsService, type BatchSaveGameDataResponse, type BatchSaveResultItem, type BillingConfig, BillingPlatform, type BillingProduct, BillingService, CloudStorageAdapter, CrazyGamesService, type DeleteGameDataResponse, type GameDataBatchItem, type GameDataItem, type GameDataOperation, type GameDataValue, type GetGameDataBatchResponse, type GetGameDataResponse, HyveClient, type HyveClientConfig, type Inventory, type InventoryItem, LocalStorageAdapter, Logger, NativeBridge, type NativeMessage, type NativeMessageHandler, NativeMessageType, PlaygamaService, type PurchaseResult, type SaveGameDataResponse, type StorageAdapter, type TelemetryAdditionalData, type TelemetryConfig, type TelemetryEvent, generateUUID, isDomainAllowed, logger, parseUrlParams };
1146
+ export { type AdConfig, type AdResult, type AdType, AdsService, type BatchSaveGameDataResponse, type BatchSaveResultItem, type BillingConfig, BillingPlatform, type BillingProduct, BillingService, CloudStorageAdapter, CrazyGamesService, type DeleteGameDataResponse, type GameDataBatchItem, type GameDataItem, type GameDataLeaderboardEntry, type GameDataLeaderboardResponse, type GameDataLeaderboardUserPosition, type GameDataOperation, type GameDataValue, type GetGameDataBatchResponse, type GetGameDataLeaderboardParams, type GetGameDataResponse, HyveClient, type HyveClientConfig, type Inventory, type InventoryItem, LocalStorageAdapter, Logger, NativeBridge, type NativeMessage, type NativeMessageHandler, NativeMessageType, PlaygamaService, type PurchaseResult, type SaveGameDataResponse, type StorageAdapter, type TelemetryAdditionalData, type TelemetryConfig, type TelemetryEvent, generateUUID, isDomainAllowed, logger, parseUrlParams };
package/dist/index.d.ts CHANGED
@@ -125,6 +125,47 @@ interface GameDataBatchItem {
125
125
  /** Dot-notation path targeting a nested field (e.g. "stats.score") */
126
126
  path?: string;
127
127
  }
128
+ /**
129
+ * Persistent Game Data Leaderboard Types
130
+ */
131
+ /** A single entry in the game data leaderboard */
132
+ interface GameDataLeaderboardEntry {
133
+ rank: number;
134
+ username: string;
135
+ avatar_url?: string | null;
136
+ hyve_user_id: string;
137
+ score: number;
138
+ }
139
+ /** The requesting user's position within the leaderboard */
140
+ interface GameDataLeaderboardUserPosition {
141
+ rank: number;
142
+ score: number;
143
+ entry: GameDataLeaderboardEntry;
144
+ }
145
+ /** Response from the game data leaderboard endpoint */
146
+ interface GameDataLeaderboardResponse {
147
+ entries: GameDataLeaderboardEntry[];
148
+ next_cursor?: string | null;
149
+ has_more: boolean;
150
+ /** Present when the authenticated user has data for the queried key */
151
+ user_position?: GameDataLeaderboardUserPosition | null;
152
+ }
153
+ /** Parameters for fetching a game data leaderboard */
154
+ interface GetGameDataLeaderboardParams {
155
+ /** Data key to rank users by (e.g. "high_score", "lines_cleared") */
156
+ key: string;
157
+ /**
158
+ * Dot-notation path to extract a numeric score from a nested JSON value.
159
+ * Leave empty to use the top-level value (e.g. "stats.score").
160
+ */
161
+ score_path?: string;
162
+ /** Sort direction - "asc" or "desc" (default: "desc") */
163
+ sort?: 'asc' | 'desc';
164
+ /** Number of results per page, 1-100 (default: 10) */
165
+ limit?: number;
166
+ /** Pagination cursor from a previous response's next_cursor */
167
+ cursor?: string;
168
+ }
128
169
 
129
170
  /**
130
171
  * Ads Service for Hyve SDK
@@ -586,6 +627,13 @@ declare class HyveClient {
586
627
  * @returns Promise resolving to number of entries deleted
587
628
  */
588
629
  deleteMultipleGameData(keys: string[], storage?: 'cloud' | 'local'): Promise<number>;
630
+ /**
631
+ * Fetch the persistent game data leaderboard for a given key.
632
+ * Rankings are derived from numeric values stored via saveGameData / batchSaveGameData.
633
+ * @param params Leaderboard query parameters (key is required)
634
+ * @returns Promise resolving to the leaderboard response including the caller's position
635
+ */
636
+ getGameDataLeaderboard(params: GetGameDataLeaderboardParams): Promise<GameDataLeaderboardResponse>;
589
637
  /**
590
638
  * Configure storage mode
591
639
  * @param mode Storage mode ('cloud' or 'local')
@@ -1095,4 +1143,4 @@ declare class NativeBridge {
1095
1143
  */
1096
1144
  declare function generateUUID(): string;
1097
1145
 
1098
- export { type AdConfig, type AdResult, type AdType, AdsService, type BatchSaveGameDataResponse, type BatchSaveResultItem, type BillingConfig, BillingPlatform, type BillingProduct, BillingService, CloudStorageAdapter, CrazyGamesService, type DeleteGameDataResponse, type GameDataBatchItem, type GameDataItem, type GameDataOperation, type GameDataValue, type GetGameDataBatchResponse, type GetGameDataResponse, HyveClient, type HyveClientConfig, type Inventory, type InventoryItem, LocalStorageAdapter, Logger, NativeBridge, type NativeMessage, type NativeMessageHandler, NativeMessageType, PlaygamaService, type PurchaseResult, type SaveGameDataResponse, type StorageAdapter, type TelemetryAdditionalData, type TelemetryConfig, type TelemetryEvent, generateUUID, isDomainAllowed, logger, parseUrlParams };
1146
+ export { type AdConfig, type AdResult, type AdType, AdsService, type BatchSaveGameDataResponse, type BatchSaveResultItem, type BillingConfig, BillingPlatform, type BillingProduct, BillingService, CloudStorageAdapter, CrazyGamesService, type DeleteGameDataResponse, type GameDataBatchItem, type GameDataItem, type GameDataLeaderboardEntry, type GameDataLeaderboardResponse, type GameDataLeaderboardUserPosition, type GameDataOperation, type GameDataValue, type GetGameDataBatchResponse, type GetGameDataLeaderboardParams, type GetGameDataResponse, HyveClient, type HyveClientConfig, type Inventory, type InventoryItem, LocalStorageAdapter, Logger, NativeBridge, type NativeMessage, type NativeMessageHandler, NativeMessageType, PlaygamaService, type PurchaseResult, type SaveGameDataResponse, type StorageAdapter, type TelemetryAdditionalData, type TelemetryConfig, type TelemetryEvent, generateUUID, isDomainAllowed, logger, parseUrlParams };
package/dist/index.js CHANGED
@@ -2044,6 +2044,26 @@ var HyveClient = class {
2044
2044
  logger.info(`Deleted ${deletedCount} game data entries from ${storageMode}`);
2045
2045
  return deletedCount;
2046
2046
  }
2047
+ /**
2048
+ * Fetch the persistent game data leaderboard for a given key.
2049
+ * Rankings are derived from numeric values stored via saveGameData / batchSaveGameData.
2050
+ * @param params Leaderboard query parameters (key is required)
2051
+ * @returns Promise resolving to the leaderboard response including the caller's position
2052
+ */
2053
+ async getGameDataLeaderboard(params) {
2054
+ const gameId = this.requireGameId();
2055
+ logger.debug(`Fetching game data leaderboard: ${gameId}/${params.key}`);
2056
+ const query = new URLSearchParams({ game_id: gameId, key: params.key });
2057
+ if (params.score_path) query.set("score_path", params.score_path);
2058
+ if (params.sort) query.set("sort", params.sort);
2059
+ if (params.limit !== void 0) query.set("limit", params.limit.toString());
2060
+ if (params.cursor) query.set("cursor", params.cursor);
2061
+ const response = await this.callApi(
2062
+ `/api/v1/leaderboards/game-data?${query}`
2063
+ );
2064
+ logger.info(`Game data leaderboard fetched: ${response.entries.length} entries`);
2065
+ return response;
2066
+ }
2047
2067
  /**
2048
2068
  * Configure storage mode
2049
2069
  * @param mode Storage mode ('cloud' or 'local')
package/dist/index.mjs CHANGED
@@ -2004,6 +2004,26 @@ var HyveClient = class {
2004
2004
  logger.info(`Deleted ${deletedCount} game data entries from ${storageMode}`);
2005
2005
  return deletedCount;
2006
2006
  }
2007
+ /**
2008
+ * Fetch the persistent game data leaderboard for a given key.
2009
+ * Rankings are derived from numeric values stored via saveGameData / batchSaveGameData.
2010
+ * @param params Leaderboard query parameters (key is required)
2011
+ * @returns Promise resolving to the leaderboard response including the caller's position
2012
+ */
2013
+ async getGameDataLeaderboard(params) {
2014
+ const gameId = this.requireGameId();
2015
+ logger.debug(`Fetching game data leaderboard: ${gameId}/${params.key}`);
2016
+ const query = new URLSearchParams({ game_id: gameId, key: params.key });
2017
+ if (params.score_path) query.set("score_path", params.score_path);
2018
+ if (params.sort) query.set("sort", params.sort);
2019
+ if (params.limit !== void 0) query.set("limit", params.limit.toString());
2020
+ if (params.cursor) query.set("cursor", params.cursor);
2021
+ const response = await this.callApi(
2022
+ `/api/v1/leaderboards/game-data?${query}`
2023
+ );
2024
+ logger.info(`Game data leaderboard fetched: ${response.entries.length} entries`);
2025
+ return response;
2026
+ }
2007
2027
  /**
2008
2028
  * Configure storage mode
2009
2029
  * @param mode Storage mode ('cloud' or 'local')
package/dist/react.d.mts CHANGED
@@ -81,6 +81,47 @@ interface GameDataBatchItem {
81
81
  /** Dot-notation path targeting a nested field (e.g. "stats.score") */
82
82
  path?: string;
83
83
  }
84
+ /**
85
+ * Persistent Game Data Leaderboard Types
86
+ */
87
+ /** A single entry in the game data leaderboard */
88
+ interface GameDataLeaderboardEntry {
89
+ rank: number;
90
+ username: string;
91
+ avatar_url?: string | null;
92
+ hyve_user_id: string;
93
+ score: number;
94
+ }
95
+ /** The requesting user's position within the leaderboard */
96
+ interface GameDataLeaderboardUserPosition {
97
+ rank: number;
98
+ score: number;
99
+ entry: GameDataLeaderboardEntry;
100
+ }
101
+ /** Response from the game data leaderboard endpoint */
102
+ interface GameDataLeaderboardResponse {
103
+ entries: GameDataLeaderboardEntry[];
104
+ next_cursor?: string | null;
105
+ has_more: boolean;
106
+ /** Present when the authenticated user has data for the queried key */
107
+ user_position?: GameDataLeaderboardUserPosition | null;
108
+ }
109
+ /** Parameters for fetching a game data leaderboard */
110
+ interface GetGameDataLeaderboardParams {
111
+ /** Data key to rank users by (e.g. "high_score", "lines_cleared") */
112
+ key: string;
113
+ /**
114
+ * Dot-notation path to extract a numeric score from a nested JSON value.
115
+ * Leave empty to use the top-level value (e.g. "stats.score").
116
+ */
117
+ score_path?: string;
118
+ /** Sort direction - "asc" or "desc" (default: "desc") */
119
+ sort?: 'asc' | 'desc';
120
+ /** Number of results per page, 1-100 (default: 10) */
121
+ limit?: number;
122
+ /** Pagination cursor from a previous response's next_cursor */
123
+ cursor?: string;
124
+ }
84
125
 
85
126
  /**
86
127
  * Ads Service for Hyve SDK
@@ -361,6 +402,13 @@ declare class HyveClient {
361
402
  * @returns Promise resolving to number of entries deleted
362
403
  */
363
404
  deleteMultipleGameData(keys: string[], storage?: 'cloud' | 'local'): Promise<number>;
405
+ /**
406
+ * Fetch the persistent game data leaderboard for a given key.
407
+ * Rankings are derived from numeric values stored via saveGameData / batchSaveGameData.
408
+ * @param params Leaderboard query parameters (key is required)
409
+ * @returns Promise resolving to the leaderboard response including the caller's position
410
+ */
411
+ getGameDataLeaderboard(params: GetGameDataLeaderboardParams): Promise<GameDataLeaderboardResponse>;
364
412
  /**
365
413
  * Configure storage mode
366
414
  * @param mode Storage mode ('cloud' or 'local')
package/dist/react.d.ts CHANGED
@@ -81,6 +81,47 @@ interface GameDataBatchItem {
81
81
  /** Dot-notation path targeting a nested field (e.g. "stats.score") */
82
82
  path?: string;
83
83
  }
84
+ /**
85
+ * Persistent Game Data Leaderboard Types
86
+ */
87
+ /** A single entry in the game data leaderboard */
88
+ interface GameDataLeaderboardEntry {
89
+ rank: number;
90
+ username: string;
91
+ avatar_url?: string | null;
92
+ hyve_user_id: string;
93
+ score: number;
94
+ }
95
+ /** The requesting user's position within the leaderboard */
96
+ interface GameDataLeaderboardUserPosition {
97
+ rank: number;
98
+ score: number;
99
+ entry: GameDataLeaderboardEntry;
100
+ }
101
+ /** Response from the game data leaderboard endpoint */
102
+ interface GameDataLeaderboardResponse {
103
+ entries: GameDataLeaderboardEntry[];
104
+ next_cursor?: string | null;
105
+ has_more: boolean;
106
+ /** Present when the authenticated user has data for the queried key */
107
+ user_position?: GameDataLeaderboardUserPosition | null;
108
+ }
109
+ /** Parameters for fetching a game data leaderboard */
110
+ interface GetGameDataLeaderboardParams {
111
+ /** Data key to rank users by (e.g. "high_score", "lines_cleared") */
112
+ key: string;
113
+ /**
114
+ * Dot-notation path to extract a numeric score from a nested JSON value.
115
+ * Leave empty to use the top-level value (e.g. "stats.score").
116
+ */
117
+ score_path?: string;
118
+ /** Sort direction - "asc" or "desc" (default: "desc") */
119
+ sort?: 'asc' | 'desc';
120
+ /** Number of results per page, 1-100 (default: 10) */
121
+ limit?: number;
122
+ /** Pagination cursor from a previous response's next_cursor */
123
+ cursor?: string;
124
+ }
84
125
 
85
126
  /**
86
127
  * Ads Service for Hyve SDK
@@ -361,6 +402,13 @@ declare class HyveClient {
361
402
  * @returns Promise resolving to number of entries deleted
362
403
  */
363
404
  deleteMultipleGameData(keys: string[], storage?: 'cloud' | 'local'): Promise<number>;
405
+ /**
406
+ * Fetch the persistent game data leaderboard for a given key.
407
+ * Rankings are derived from numeric values stored via saveGameData / batchSaveGameData.
408
+ * @param params Leaderboard query parameters (key is required)
409
+ * @returns Promise resolving to the leaderboard response including the caller's position
410
+ */
411
+ getGameDataLeaderboard(params: GetGameDataLeaderboardParams): Promise<GameDataLeaderboardResponse>;
364
412
  /**
365
413
  * Configure storage mode
366
414
  * @param mode Storage mode ('cloud' or 'local')
package/dist/react.js CHANGED
@@ -1995,6 +1995,26 @@ var HyveClient = class {
1995
1995
  logger.info(`Deleted ${deletedCount} game data entries from ${storageMode}`);
1996
1996
  return deletedCount;
1997
1997
  }
1998
+ /**
1999
+ * Fetch the persistent game data leaderboard for a given key.
2000
+ * Rankings are derived from numeric values stored via saveGameData / batchSaveGameData.
2001
+ * @param params Leaderboard query parameters (key is required)
2002
+ * @returns Promise resolving to the leaderboard response including the caller's position
2003
+ */
2004
+ async getGameDataLeaderboard(params) {
2005
+ const gameId = this.requireGameId();
2006
+ logger.debug(`Fetching game data leaderboard: ${gameId}/${params.key}`);
2007
+ const query = new URLSearchParams({ game_id: gameId, key: params.key });
2008
+ if (params.score_path) query.set("score_path", params.score_path);
2009
+ if (params.sort) query.set("sort", params.sort);
2010
+ if (params.limit !== void 0) query.set("limit", params.limit.toString());
2011
+ if (params.cursor) query.set("cursor", params.cursor);
2012
+ const response = await this.callApi(
2013
+ `/api/v1/leaderboards/game-data?${query}`
2014
+ );
2015
+ logger.info(`Game data leaderboard fetched: ${response.entries.length} entries`);
2016
+ return response;
2017
+ }
1998
2018
  /**
1999
2019
  * Configure storage mode
2000
2020
  * @param mode Storage mode ('cloud' or 'local')
package/dist/react.mjs CHANGED
@@ -1974,6 +1974,26 @@ var HyveClient = class {
1974
1974
  logger.info(`Deleted ${deletedCount} game data entries from ${storageMode}`);
1975
1975
  return deletedCount;
1976
1976
  }
1977
+ /**
1978
+ * Fetch the persistent game data leaderboard for a given key.
1979
+ * Rankings are derived from numeric values stored via saveGameData / batchSaveGameData.
1980
+ * @param params Leaderboard query parameters (key is required)
1981
+ * @returns Promise resolving to the leaderboard response including the caller's position
1982
+ */
1983
+ async getGameDataLeaderboard(params) {
1984
+ const gameId = this.requireGameId();
1985
+ logger.debug(`Fetching game data leaderboard: ${gameId}/${params.key}`);
1986
+ const query = new URLSearchParams({ game_id: gameId, key: params.key });
1987
+ if (params.score_path) query.set("score_path", params.score_path);
1988
+ if (params.sort) query.set("sort", params.sort);
1989
+ if (params.limit !== void 0) query.set("limit", params.limit.toString());
1990
+ if (params.cursor) query.set("cursor", params.cursor);
1991
+ const response = await this.callApi(
1992
+ `/api/v1/leaderboards/game-data?${query}`
1993
+ );
1994
+ logger.info(`Game data leaderboard fetched: ${response.entries.length} entries`);
1995
+ return response;
1996
+ }
1977
1997
  /**
1978
1998
  * Configure storage mode
1979
1999
  * @param mode Storage mode ('cloud' or 'local')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyve-sdk/js",
3
- "version": "2.3.0",
3
+ "version": "2.4.0",
4
4
  "description": "Hyve SDK - TypeScript wrapper for Hyve game server integration",
5
5
  "private": false,
6
6
  "publishConfig": {