hive-bedrock-api 3.0.0-alpha.21 → 3.0.0-alpha.23
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/package.json +2 -2
- package/lib/helpers/fetchEndpoint.d.ts +0 -3
- package/lib/helpers/fetchEndpoint.js +0 -88
- package/lib/helpers/isGame.d.ts +0 -2
- package/lib/helpers/isGame.js +0 -7
- package/lib/helpers/toPoint.d.ts +0 -1
- package/lib/helpers/toPoint.js +0 -10
- package/lib/index.d.ts +0 -101
- package/lib/index.js +0 -404
- package/lib/methods/getAllTimeLeaderboard.d.ts +0 -4
- package/lib/methods/getAllTimeLeaderboard.js +0 -85
- package/lib/methods/getAllTimeStatistics.d.ts +0 -10
- package/lib/methods/getAllTimeStatistics.js +0 -126
- package/lib/methods/getGlobalStatistics.d.ts +0 -3
- package/lib/methods/getGlobalStatistics.js +0 -56
- package/lib/methods/getMaps.d.ts +0 -3
- package/lib/methods/getMaps.js +0 -81
- package/lib/methods/getMetadata.d.ts +0 -3
- package/lib/methods/getMetadata.js +0 -81
- package/lib/methods/getMonthlyLeaderboard.d.ts +0 -11
- package/lib/methods/getMonthlyLeaderboard.js +0 -88
- package/lib/methods/getMonthlyStatistics.d.ts +0 -10
- package/lib/methods/getMonthlyStatistics.js +0 -132
- package/lib/methods/getPlayerInfomation.d.ts +0 -3
- package/lib/methods/getPlayerInfomation.js +0 -72
- package/lib/methods/getSeasonLeaderboard.d.ts +0 -10
- package/lib/methods/getSeasonLeaderboard.js +0 -87
- package/lib/methods/getSeasonStatistics.d.ts +0 -10
- package/lib/methods/getSeasonStatistics.js +0 -87
- package/lib/processors/bed.d.ts +0 -19
- package/lib/processors/bed.js +0 -35
- package/lib/processors/bridge.d.ts +0 -24
- package/lib/processors/bridge.js +0 -40
- package/lib/processors/build.d.ts +0 -19
- package/lib/processors/build.js +0 -35
- package/lib/processors/ctf.d.ts +0 -19
- package/lib/processors/ctf.js +0 -35
- package/lib/processors/dr.d.ts +0 -19
- package/lib/processors/dr.js +0 -35
- package/lib/processors/drop.d.ts +0 -17
- package/lib/processors/drop.js +0 -34
- package/lib/processors/game.d.ts +0 -315
- package/lib/processors/game.js +0 -395
- package/lib/processors/global_statistics.d.ts +0 -9
- package/lib/processors/global_statistics.js +0 -2
- package/lib/processors/grav.d.ts +0 -17
- package/lib/processors/grav.js +0 -34
- package/lib/processors/ground.d.ts +0 -19
- package/lib/processors/ground.js +0 -35
- package/lib/processors/helpers/processBuildRatings.d.ts +0 -8
- package/lib/processors/helpers/processBuildRatings.js +0 -23
- package/lib/processors/helpers/processGameAndXP.d.ts +0 -6
- package/lib/processors/helpers/processGameAndXP.js +0 -10
- package/lib/processors/helpers/processHiderKillsAndDeaths.d.ts +0 -5
- package/lib/processors/helpers/processHiderKillsAndDeaths.js +0 -13
- package/lib/processors/helpers/processKillsAndDeaths.d.ts +0 -5
- package/lib/processors/helpers/processKillsAndDeaths.js +0 -13
- package/lib/processors/helpers/processMurdersAndDeaths.d.ts +0 -5
- package/lib/processors/helpers/processMurdersAndDeaths.js +0 -13
- package/lib/processors/helpers/processPlayedAndVictories.d.ts +0 -6
- package/lib/processors/helpers/processPlayedAndVictories.js +0 -12
- package/lib/processors/hide.d.ts +0 -19
- package/lib/processors/hide.js +0 -35
- package/lib/processors/index.d.ts +0 -12
- package/lib/processors/index.js +0 -73
- package/lib/processors/map.d.ts +0 -8
- package/lib/processors/map.js +0 -2
- package/lib/processors/meta.d.ts +0 -45
- package/lib/processors/meta.js +0 -2
- package/lib/processors/murder.d.ts +0 -19
- package/lib/processors/murder.js +0 -35
- package/lib/processors/parkour.d.ts +0 -5
- package/lib/processors/parkour.js +0 -99
- package/lib/processors/party.d.ts +0 -17
- package/lib/processors/party.js +0 -34
- package/lib/processors/player.d.ts +0 -61
- package/lib/processors/player.js +0 -54
- package/lib/processors/player_search.d.ts +0 -6
- package/lib/processors/player_search.js +0 -11
- package/lib/processors/sg.d.ts +0 -19
- package/lib/processors/sg.js +0 -35
- package/lib/processors/sky.d.ts +0 -19
- package/lib/processors/sky.js +0 -35
- package/lib/processors/wars.d.ts +0 -19
- package/lib/processors/wars.js +0 -35
- package/lib/types/output.d.ts +0 -62
- package/lib/types/output.js +0 -3
- package/lib/types/types.d.ts +0 -24
- package/lib/types/types.js +0 -2
- package/lib/utils.d.ts +0 -21
- package/lib/utils.js +0 -2
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
24
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
-
function step(op) {
|
|
27
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
-
switch (op[0]) {
|
|
32
|
-
case 0: case 1: t = op; break;
|
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
-
default:
|
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
-
if (t[2]) _.ops.pop();
|
|
42
|
-
_.trys.pop(); continue;
|
|
43
|
-
}
|
|
44
|
-
op = body.call(thisArg, _);
|
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
|
-
};
|
|
52
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
-
exports.default = getAllTimeLeaderboard;
|
|
54
|
-
var fetchEndpoint_1 = __importDefault(require("../helpers/fetchEndpoint"));
|
|
55
|
-
var isGame_1 = __importDefault(require("../helpers/isGame"));
|
|
56
|
-
var processors_1 = require("../processors");
|
|
57
|
-
function getAllTimeLeaderboard(game_id, options) {
|
|
58
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
59
|
-
var response, response_data, processed_data;
|
|
60
|
-
return __generator(this, function (_a) {
|
|
61
|
-
switch (_a.label) {
|
|
62
|
-
case 0:
|
|
63
|
-
if (!(0, isGame_1.default)(game_id))
|
|
64
|
-
return [2 /*return*/, {
|
|
65
|
-
status: 404,
|
|
66
|
-
error: {
|
|
67
|
-
code: 404,
|
|
68
|
-
message: "Game not found.",
|
|
69
|
-
},
|
|
70
|
-
data: null,
|
|
71
|
-
}];
|
|
72
|
-
return [4 /*yield*/, (0, fetchEndpoint_1.default)("/game/all/".concat(game_id), options === null || options === void 0 ? void 0 : options.init)];
|
|
73
|
-
case 1:
|
|
74
|
-
response = _a.sent();
|
|
75
|
-
if (response.error)
|
|
76
|
-
return [2 /*return*/, response];
|
|
77
|
-
response_data = response.data;
|
|
78
|
-
processed_data = Array.from(response_data).map(function (statistics) {
|
|
79
|
-
return processors_1.LeaderboardProcessors[game_id](statistics);
|
|
80
|
-
});
|
|
81
|
-
return [2 /*return*/, __assign(__assign({}, response), { data: processed_data, error: null })];
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
});
|
|
85
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Game } from "hive-bedrock-data";
|
|
2
|
-
import { APIResponse, Options } from "../types/types";
|
|
3
|
-
import { AllTimeProcessedStatistics } from "../types/output";
|
|
4
|
-
import { Processed_Player_Statistics } from "../processors/player";
|
|
5
|
-
type AllGameStatisticsPlayer = AllTimeProcessedStatistics & {
|
|
6
|
-
player: Processed_Player_Statistics;
|
|
7
|
-
};
|
|
8
|
-
export default function getAllTimeStatistics(identifier: string, options?: Partial<Options>): Promise<APIResponse<AllGameStatisticsPlayer>>;
|
|
9
|
-
export default function getAllTimeStatistics<G extends Game>(identifier: string, game_id: G, options?: Partial<Options>): Promise<APIResponse<AllTimeProcessedStatistics[G]>>;
|
|
10
|
-
export {};
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
24
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
-
function step(op) {
|
|
27
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
-
switch (op[0]) {
|
|
32
|
-
case 0: case 1: t = op; break;
|
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
-
default:
|
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
-
if (t[2]) _.ops.pop();
|
|
42
|
-
_.trys.pop(); continue;
|
|
43
|
-
}
|
|
44
|
-
op = body.call(thisArg, _);
|
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
var __read = (this && this.__read) || function (o, n) {
|
|
50
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
51
|
-
if (!m) return o;
|
|
52
|
-
var i = m.call(o), r, ar = [], e;
|
|
53
|
-
try {
|
|
54
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
55
|
-
}
|
|
56
|
-
catch (error) { e = { error: error }; }
|
|
57
|
-
finally {
|
|
58
|
-
try {
|
|
59
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
60
|
-
}
|
|
61
|
-
finally { if (e) throw e.error; }
|
|
62
|
-
}
|
|
63
|
-
return ar;
|
|
64
|
-
};
|
|
65
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
66
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
67
|
-
};
|
|
68
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
69
|
-
exports.default = getAllTimeStatistics;
|
|
70
|
-
var isGame_1 = __importDefault(require("../helpers/isGame"));
|
|
71
|
-
var fetchEndpoint_1 = __importDefault(require("../helpers/fetchEndpoint"));
|
|
72
|
-
var processors_1 = require("../processors");
|
|
73
|
-
function getAllTimeStatistics(identifier, game_or_options, options) {
|
|
74
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
75
|
-
var game_id, method_options, response, response_data_1, processed_data_1, response_data, processed_data;
|
|
76
|
-
return __generator(this, function (_a) {
|
|
77
|
-
switch (_a.label) {
|
|
78
|
-
case 0:
|
|
79
|
-
game_id = "all";
|
|
80
|
-
method_options = game_or_options;
|
|
81
|
-
if (typeof game_or_options === "string") {
|
|
82
|
-
game_id = game_or_options;
|
|
83
|
-
method_options = options;
|
|
84
|
-
}
|
|
85
|
-
if (!(0, isGame_1.default)(game_id) && game_id !== "all")
|
|
86
|
-
return [2 /*return*/, {
|
|
87
|
-
status: 404,
|
|
88
|
-
error: {
|
|
89
|
-
code: 404,
|
|
90
|
-
message: "Game not found.",
|
|
91
|
-
},
|
|
92
|
-
data: null,
|
|
93
|
-
}];
|
|
94
|
-
return [4 /*yield*/, (0, fetchEndpoint_1.default)("/game/all/".concat(game_id, "/").concat(identifier), method_options === null || method_options === void 0 ? void 0 : method_options.init)];
|
|
95
|
-
case 1:
|
|
96
|
-
response = _a.sent();
|
|
97
|
-
if (response.error)
|
|
98
|
-
return [2 /*return*/, response];
|
|
99
|
-
if (game_id === "all") {
|
|
100
|
-
response_data_1 = Object.entries(response.data);
|
|
101
|
-
processed_data_1 = Object.fromEntries(response_data_1.map(function (_a) {
|
|
102
|
-
var _b = __read(_a, 2), id = _b[0], statistics = _b[1];
|
|
103
|
-
if (id === "main")
|
|
104
|
-
return ["player", (0, processors_1.PlayerProcessor)(statistics)];
|
|
105
|
-
if (!statistics ||
|
|
106
|
-
!(0, isGame_1.default)(id) ||
|
|
107
|
-
Array.isArray(statistics))
|
|
108
|
-
return [id, null];
|
|
109
|
-
return [
|
|
110
|
-
id,
|
|
111
|
-
typeof processors_1.AllTimeProcessors[id] === "function"
|
|
112
|
-
? processors_1.AllTimeProcessors[id](statistics)
|
|
113
|
-
: null,
|
|
114
|
-
];
|
|
115
|
-
}));
|
|
116
|
-
return [2 /*return*/, __assign(__assign({}, response), { data: processed_data_1 })];
|
|
117
|
-
}
|
|
118
|
-
response_data = response.data;
|
|
119
|
-
if (Array.isArray(response_data))
|
|
120
|
-
return [2 /*return*/, __assign(__assign({}, response), { status: 404, data: null, error: { code: 404, message: "Not Found" } })];
|
|
121
|
-
processed_data = processors_1.AllTimeProcessors[game_id](response_data);
|
|
122
|
-
return [2 /*return*/, __assign(__assign({}, response), { data: processed_data, error: null })];
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
});
|
|
126
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
-
};
|
|
41
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports.default = getGlobalStatistics;
|
|
43
|
-
var fetchEndpoint_1 = __importDefault(require("../helpers/fetchEndpoint"));
|
|
44
|
-
function getGlobalStatistics(options) {
|
|
45
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
46
|
-
var response;
|
|
47
|
-
return __generator(this, function (_a) {
|
|
48
|
-
switch (_a.label) {
|
|
49
|
-
case 0: return [4 /*yield*/, (0, fetchEndpoint_1.default)("/global/statistics", options === null || options === void 0 ? void 0 : options.init)];
|
|
50
|
-
case 1:
|
|
51
|
-
response = _a.sent();
|
|
52
|
-
return [2 /*return*/, response];
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
}
|
package/lib/methods/getMaps.d.ts
DELETED
package/lib/methods/getMaps.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
24
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
-
function step(op) {
|
|
27
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
-
switch (op[0]) {
|
|
32
|
-
case 0: case 1: t = op; break;
|
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
-
default:
|
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
-
if (t[2]) _.ops.pop();
|
|
42
|
-
_.trys.pop(); continue;
|
|
43
|
-
}
|
|
44
|
-
op = body.call(thisArg, _);
|
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
|
-
};
|
|
52
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
-
exports.default = getMaps;
|
|
54
|
-
var fetchEndpoint_1 = __importDefault(require("../helpers/fetchEndpoint"));
|
|
55
|
-
var isGame_1 = __importDefault(require("../helpers/isGame"));
|
|
56
|
-
function getMaps(game_id, options) {
|
|
57
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
58
|
-
var response, data;
|
|
59
|
-
return __generator(this, function (_a) {
|
|
60
|
-
switch (_a.label) {
|
|
61
|
-
case 0:
|
|
62
|
-
if (!(0, isGame_1.default)(game_id))
|
|
63
|
-
return [2 /*return*/, {
|
|
64
|
-
status: 404,
|
|
65
|
-
error: {
|
|
66
|
-
code: 404,
|
|
67
|
-
message: "Game not found.",
|
|
68
|
-
},
|
|
69
|
-
data: null,
|
|
70
|
-
}];
|
|
71
|
-
return [4 /*yield*/, (0, fetchEndpoint_1.default)("/game/map/".concat(game_id), options === null || options === void 0 ? void 0 : options.init)];
|
|
72
|
-
case 1:
|
|
73
|
-
response = _a.sent();
|
|
74
|
-
if (response.error)
|
|
75
|
-
return [2 /*return*/, response];
|
|
76
|
-
data = response.data;
|
|
77
|
-
return [2 /*return*/, __assign(__assign({}, response), { data: data })];
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
24
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
-
function step(op) {
|
|
27
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
-
switch (op[0]) {
|
|
32
|
-
case 0: case 1: t = op; break;
|
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
-
default:
|
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
-
if (t[2]) _.ops.pop();
|
|
42
|
-
_.trys.pop(); continue;
|
|
43
|
-
}
|
|
44
|
-
op = body.call(thisArg, _);
|
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
|
-
};
|
|
52
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
-
exports.default = getMetdata;
|
|
54
|
-
var fetchEndpoint_1 = __importDefault(require("../helpers/fetchEndpoint"));
|
|
55
|
-
var isGame_1 = __importDefault(require("../helpers/isGame"));
|
|
56
|
-
function getMetdata(game_id, options) {
|
|
57
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
58
|
-
var response, data;
|
|
59
|
-
return __generator(this, function (_a) {
|
|
60
|
-
switch (_a.label) {
|
|
61
|
-
case 0:
|
|
62
|
-
if (!(0, isGame_1.default)(game_id))
|
|
63
|
-
return [2 /*return*/, {
|
|
64
|
-
status: 404,
|
|
65
|
-
error: {
|
|
66
|
-
code: 404,
|
|
67
|
-
message: "Game not found.",
|
|
68
|
-
},
|
|
69
|
-
data: null,
|
|
70
|
-
}];
|
|
71
|
-
return [4 /*yield*/, (0, fetchEndpoint_1.default)("/game/meta/".concat(game_id), options === null || options === void 0 ? void 0 : options.init)];
|
|
72
|
-
case 1:
|
|
73
|
-
response = _a.sent();
|
|
74
|
-
if (response.error)
|
|
75
|
-
return [2 /*return*/, response];
|
|
76
|
-
data = response.data;
|
|
77
|
-
return [2 /*return*/, __assign(__assign({}, response), { data: data })];
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Game } from "hive-bedrock-data";
|
|
2
|
-
import { APIResponse, Options } from "../types/types";
|
|
3
|
-
import { MonthlyProcessedLeaderboard } from "../types/output";
|
|
4
|
-
interface MonthlyOptions extends Options {
|
|
5
|
-
month: number;
|
|
6
|
-
year: number;
|
|
7
|
-
amount: number;
|
|
8
|
-
skip: number;
|
|
9
|
-
}
|
|
10
|
-
export default function getMonthlyLeaderboard<G extends Game>(game_id: G, options?: Partial<MonthlyOptions>): Promise<APIResponse<MonthlyProcessedLeaderboard<G>>>;
|
|
11
|
-
export {};
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
24
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
-
function step(op) {
|
|
27
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
29
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
-
switch (op[0]) {
|
|
32
|
-
case 0: case 1: t = op; break;
|
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
-
default:
|
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
-
if (t[2]) _.ops.pop();
|
|
42
|
-
_.trys.pop(); continue;
|
|
43
|
-
}
|
|
44
|
-
op = body.call(thisArg, _);
|
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
|
-
};
|
|
52
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
53
|
-
exports.default = getMonthlyLeaderboard;
|
|
54
|
-
var fetchEndpoint_1 = __importDefault(require("../helpers/fetchEndpoint"));
|
|
55
|
-
var isGame_1 = __importDefault(require("../helpers/isGame"));
|
|
56
|
-
var processors_1 = require("../processors");
|
|
57
|
-
function getMonthlyLeaderboard(game_id, options) {
|
|
58
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
59
|
-
var current_date, endpoint, response, response_data, processed_data;
|
|
60
|
-
var _a, _b, _c, _d;
|
|
61
|
-
return __generator(this, function (_e) {
|
|
62
|
-
switch (_e.label) {
|
|
63
|
-
case 0:
|
|
64
|
-
if (!(0, isGame_1.default)(game_id))
|
|
65
|
-
return [2 /*return*/, {
|
|
66
|
-
status: 404,
|
|
67
|
-
error: {
|
|
68
|
-
code: 404,
|
|
69
|
-
message: "Game not found.",
|
|
70
|
-
},
|
|
71
|
-
data: null,
|
|
72
|
-
}];
|
|
73
|
-
current_date = new Date();
|
|
74
|
-
endpoint = "/game/monthly/".concat(game_id, "/").concat((_a = options === null || options === void 0 ? void 0 : options.year) !== null && _a !== void 0 ? _a : current_date.getFullYear(), "/").concat((_b = options === null || options === void 0 ? void 0 : options.month) !== null && _b !== void 0 ? _b : current_date.getMonth() + 1, "/").concat((_c = options === null || options === void 0 ? void 0 : options.amount) !== null && _c !== void 0 ? _c : 100, "/").concat((_d = options === null || options === void 0 ? void 0 : options.skip) !== null && _d !== void 0 ? _d : 0);
|
|
75
|
-
return [4 /*yield*/, (0, fetchEndpoint_1.default)(endpoint, options === null || options === void 0 ? void 0 : options.init)];
|
|
76
|
-
case 1:
|
|
77
|
-
response = _e.sent();
|
|
78
|
-
if (response.error)
|
|
79
|
-
return [2 /*return*/, response];
|
|
80
|
-
response_data = response.data;
|
|
81
|
-
processed_data = Array.from(response_data).map(function (statistics) {
|
|
82
|
-
return processors_1.LeaderboardProcessors[game_id](statistics);
|
|
83
|
-
});
|
|
84
|
-
return [2 /*return*/, __assign(__assign({}, response), { data: processed_data, error: null })];
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Game } from "hive-bedrock-data";
|
|
2
|
-
import { APIResponse, Options } from "../types/types";
|
|
3
|
-
import { MonthlyProcessedStatistics } from "../types/output";
|
|
4
|
-
interface MonthlyOptions extends Options {
|
|
5
|
-
month: number;
|
|
6
|
-
year: number;
|
|
7
|
-
}
|
|
8
|
-
export default function getMonthlyStatistics(identifier: string, options?: Partial<MonthlyOptions>): Promise<APIResponse<MonthlyProcessedStatistics>>;
|
|
9
|
-
export default function getMonthlyStatistics<G extends Game>(identifier: string, game_id: G, options?: Partial<MonthlyOptions>): Promise<APIResponse<MonthlyProcessedStatistics[G]>>;
|
|
10
|
-
export {};
|