hive-bedrock-api 3.0.0-alpha.31 → 3.0.0-alpha.32
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/lib/index.js +11 -11
- package/lib/processors/game.d.ts +1 -1
- package/lib/processors/game.js +1 -1
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -83,7 +83,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
83
83
|
var hive_bedrock_data_1 = require("hive-bedrock-data");
|
|
84
84
|
var player_1 = __importDefault(require("./processors/player"));
|
|
85
85
|
var player_search_1 = __importDefault(require("./processors/player_search"));
|
|
86
|
-
var game_1 =
|
|
86
|
+
var game_1 = require("./processors/game");
|
|
87
87
|
__exportStar(require("./processors/game"), exports);
|
|
88
88
|
__exportStar(require("./processors/global_statistics"), exports);
|
|
89
89
|
__exportStar(require("./processors/map"), exports);
|
|
@@ -212,11 +212,11 @@ var HiveAPI = /** @class */ (function () {
|
|
|
212
212
|
if (error)
|
|
213
213
|
return [2 /*return*/, { data: null, error: error, meta: meta }];
|
|
214
214
|
if (game)
|
|
215
|
-
return [2 /*return*/, { data: (0, game_1.
|
|
215
|
+
return [2 /*return*/, { data: (0, game_1.processGame)(game, hive_bedrock_data_1.Timeframe.AllTime, false, response), error: null, meta: meta }];
|
|
216
216
|
data = Object.fromEntries(Object.entries(response).map(function (_a) {
|
|
217
217
|
var _b;
|
|
218
218
|
var _c = __read(_a, 2), id = _c[0], res = _c[1];
|
|
219
|
-
return [id, id === "main" ? null : (_b = (0, game_1.
|
|
219
|
+
return [id, id === "main" ? null : (_b = (0, game_1.processGame)(id, hive_bedrock_data_1.Timeframe.AllTime, false, res)) !== null && _b !== void 0 ? _b : null];
|
|
220
220
|
}));
|
|
221
221
|
delete data.main;
|
|
222
222
|
return [2 /*return*/, {
|
|
@@ -242,11 +242,11 @@ var HiveAPI = /** @class */ (function () {
|
|
|
242
242
|
if (error)
|
|
243
243
|
return [2 /*return*/, { data: null, error: error, meta: meta }];
|
|
244
244
|
if (game)
|
|
245
|
-
return [2 /*return*/, { data: (0, game_1.
|
|
245
|
+
return [2 /*return*/, { data: (0, game_1.processGame)(game, hive_bedrock_data_1.Timeframe.Monthly, false, response), error: null, meta: meta }];
|
|
246
246
|
data = Object.fromEntries(Object.entries(response).map(function (_a) {
|
|
247
247
|
var _b;
|
|
248
248
|
var _c = __read(_a, 2), id = _c[0], res = _c[1];
|
|
249
|
-
return [id, id === "main" ? null : (_b = (0, game_1.
|
|
249
|
+
return [id, id === "main" ? null : (_b = (0, game_1.processGame)(id, hive_bedrock_data_1.Timeframe.Monthly, false, res)) !== null && _b !== void 0 ? _b : null];
|
|
250
250
|
}));
|
|
251
251
|
delete data.main;
|
|
252
252
|
return [2 /*return*/, {
|
|
@@ -270,7 +270,7 @@ var HiveAPI = /** @class */ (function () {
|
|
|
270
270
|
_a = _b.sent(), response = _a.data, error = _a.error, meta = _a.meta;
|
|
271
271
|
if (error)
|
|
272
272
|
return [2 /*return*/, { data: null, error: error, meta: meta }];
|
|
273
|
-
return [2 /*return*/, { data: (0, game_1.
|
|
273
|
+
return [2 /*return*/, { data: (0, game_1.processGame)(game, hive_bedrock_data_1.Timeframe.Seasonal, false, response), error: null, meta: meta }];
|
|
274
274
|
}
|
|
275
275
|
});
|
|
276
276
|
});
|
|
@@ -308,7 +308,7 @@ var HiveAPI = /** @class */ (function () {
|
|
|
308
308
|
_a = _b.sent(), response = _a.data, error = _a.error, meta = _a.meta;
|
|
309
309
|
if (error)
|
|
310
310
|
return [2 /*return*/, { data: null, error: error, meta: meta }];
|
|
311
|
-
data = (0, game_1.
|
|
311
|
+
data = (0, game_1.processGame)(game, hive_bedrock_data_1.Timeframe.Monthly, true, response);
|
|
312
312
|
return [2 /*return*/, { data: data, error: null, meta: meta }];
|
|
313
313
|
}
|
|
314
314
|
});
|
|
@@ -336,7 +336,7 @@ var HiveAPI = /** @class */ (function () {
|
|
|
336
336
|
_a = _b.sent(), response = _a.data, error = _a.error, meta = _a.meta;
|
|
337
337
|
if (error)
|
|
338
338
|
return [2 /*return*/, { data: null, error: error, meta: meta }];
|
|
339
|
-
data = response.map(function (res) { return (0, game_1.
|
|
339
|
+
data = response.map(function (res) { return (0, game_1.processGame)(game, hive_bedrock_data_1.Timeframe.AllTime, true, res); });
|
|
340
340
|
return [2 /*return*/, { data: data, error: null, meta: meta }];
|
|
341
341
|
}
|
|
342
342
|
});
|
|
@@ -353,7 +353,7 @@ var HiveAPI = /** @class */ (function () {
|
|
|
353
353
|
_a = _b.sent(), response = _a.data, error = _a.error, meta = _a.meta;
|
|
354
354
|
if (error)
|
|
355
355
|
return [2 /*return*/, { data: null, error: error, meta: meta }];
|
|
356
|
-
data = response.map(function (res) { return (0, game_1.
|
|
356
|
+
data = response.map(function (res) { return (0, game_1.processGame)(game, hive_bedrock_data_1.Timeframe.Monthly, true, res); });
|
|
357
357
|
return [2 /*return*/, { data: data, error: null, meta: meta }];
|
|
358
358
|
}
|
|
359
359
|
});
|
|
@@ -371,7 +371,7 @@ var HiveAPI = /** @class */ (function () {
|
|
|
371
371
|
_a = _b.sent(), response = _a.data, error = _a.error, meta = _a.meta;
|
|
372
372
|
if (error)
|
|
373
373
|
return [2 /*return*/, { data: null, error: error, meta: meta }];
|
|
374
|
-
data = response.map(function (res) { return (0, game_1.
|
|
374
|
+
data = response.map(function (res) { return (0, game_1.processGame)(game, hive_bedrock_data_1.Timeframe.Seasonal, true, res); });
|
|
375
375
|
return [2 /*return*/, { data: data, error: null, meta: meta }];
|
|
376
376
|
}
|
|
377
377
|
});
|
|
@@ -394,7 +394,7 @@ var HiveAPI = /** @class */ (function () {
|
|
|
394
394
|
_a = _b.sent(), response = _a.data, error = _a.error, meta = _a.meta;
|
|
395
395
|
if (error)
|
|
396
396
|
return [2 /*return*/, { data: null, error: error, meta: meta }];
|
|
397
|
-
data = response.map(function (res) { return (0, game_1.
|
|
397
|
+
data = response.map(function (res) { return (0, game_1.processGame)(game, hive_bedrock_data_1.Timeframe.Monthly, true, res); });
|
|
398
398
|
return [2 /*return*/, { data: data, error: null, meta: meta }];
|
|
399
399
|
}
|
|
400
400
|
});
|
package/lib/processors/game.d.ts
CHANGED
|
@@ -269,7 +269,7 @@ export interface ProcessedGame<T extends Timeframe, L extends boolean> {
|
|
|
269
269
|
[Game.TreasureWars]: ProcessedGameWARS & AdditionalStatistics<T, L>;
|
|
270
270
|
[Game.ParkourWorlds]: L extends true ? never : T extends Timeframe.AllTime ? ProcessedGamePARKOUR : never;
|
|
271
271
|
}
|
|
272
|
-
export
|
|
272
|
+
export declare function processGame<G extends Game, T extends Timeframe, L extends boolean>(game: G, timeframe: T, isLeaderboard: L, response: any): ProcessedGame<T, L>[G] | null;
|
|
273
273
|
export interface ProcessedAllGamesResponse {
|
|
274
274
|
player: ProcessedPlayerResponse;
|
|
275
275
|
statistics: {
|
package/lib/processors/game.js
CHANGED
|
@@ -17,7 +17,7 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
17
17
|
};
|
|
18
18
|
var _a;
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.
|
|
20
|
+
exports.processGame = processGame;
|
|
21
21
|
var hive_bedrock_data_1 = require("hive-bedrock-data");
|
|
22
22
|
function processGame(game, timeframe, isLeaderboard, response) {
|
|
23
23
|
var _a;
|