halo-infinite-api 14.2.1 → 14.2.2
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/coverage/lcov-report/authentication/halo-authentication-client.ts.html +1 -1
- package/coverage/lcov-report/authentication/index.html +1 -1
- package/coverage/lcov-report/authentication/xbox-authentication-client.ts.html +1 -1
- package/coverage/lcov-report/core/halo-infinite-client.ts.html +57 -9
- package/coverage/lcov-report/core/index.html +14 -14
- package/coverage/lcov-report/core/request-policy.ts.html +1 -1
- package/coverage/lcov-report/core/token-persisters/in-memory-token-persister.ts.html +1 -1
- package/coverage/lcov-report/core/token-persisters/index.html +18 -18
- package/coverage/lcov-report/core/token-persisters/local-storage-token-persister.ts.html +1 -1
- package/coverage/lcov-report/core/token-persisters/node-fs-token-persister.ts.html +42 -15
- package/coverage/lcov-report/core/token-persisters/token-persister.ts.html +1 -1
- package/coverage/lcov-report/core/token-providers/auto-token-provider.ts.html +1 -1
- package/coverage/lcov-report/core/token-providers/index.html +1 -1
- package/coverage/lcov-report/core/token-providers/spartan-token-provider.ts.html +1 -1
- package/coverage/lcov-report/core/token-providers/static-xsts-ticket-token-spartan-token-provider.ts.html +1 -1
- package/coverage/lcov-report/core/token-providers/xbox-token-provider.ts.html +1 -1
- package/coverage/lcov-report/core/xbox-client.ts.html +1 -1
- package/coverage/lcov-report/endpoints/halo-core-endpoints.ts.html +2 -2
- package/coverage/lcov-report/endpoints/index.html +1 -1
- package/coverage/lcov-report/index.html +60 -45
- package/coverage/lcov-report/models/halo-infinite/api-formatted-date.ts.html +1 -1
- package/coverage/lcov-report/models/halo-infinite/asset-kind.ts.html +1 -1
- package/coverage/lcov-report/models/halo-infinite/asset-version-link.ts.html +1 -1
- package/coverage/lcov-report/models/halo-infinite/asset.ts.html +1 -1
- package/coverage/lcov-report/models/halo-infinite/ban-message.ts.html +97 -0
- package/coverage/lcov-report/models/halo-infinite/ban-summary.ts.html +28 -4
- package/coverage/lcov-report/models/halo-infinite/game-variant-category.ts.html +1 -1
- package/coverage/lcov-report/models/halo-infinite/index.html +25 -10
- package/coverage/lcov-report/models/halo-infinite/match-count.ts.html +1 -1
- package/coverage/lcov-report/models/halo-infinite/match-info.ts.html +1 -1
- package/coverage/lcov-report/models/halo-infinite/match-outcome.ts.html +1 -1
- package/coverage/lcov-report/models/halo-infinite/match-skill.ts.html +1 -1
- package/coverage/lcov-report/models/halo-infinite/match-stats.ts.html +1 -1
- package/coverage/lcov-report/models/halo-infinite/match-type.ts.html +1 -1
- package/coverage/lcov-report/models/halo-infinite/matches-privacy.ts.html +1 -1
- package/coverage/lcov-report/models/halo-infinite/medals-metadata-file.ts.html +1 -1
- package/coverage/lcov-report/models/halo-infinite/player-match-history.ts.html +1 -1
- package/coverage/lcov-report/models/halo-infinite/playlist-csr-container.ts.html +1 -1
- package/coverage/lcov-report/models/halo-infinite/playlist-csr.ts.html +1 -1
- package/coverage/lcov-report/models/halo-infinite/playlist-experience.ts.html +1 -1
- package/coverage/lcov-report/models/halo-infinite/playlist.ts.html +1 -1
- package/coverage/lcov-report/models/halo-infinite/progression-file.ts.html +1 -1
- package/coverage/lcov-report/models/halo-infinite/season.ts.html +1 -1
- package/coverage/lcov-report/models/halo-infinite/service-record.ts.html +1 -1
- package/coverage/lcov-report/models/halo-infinite/settings.ts.html +1 -1
- package/coverage/lcov-report/models/halo-infinite/skill-result.ts.html +1 -1
- package/coverage/lcov-report/models/halo-infinite/stats.ts.html +1 -1
- package/coverage/lcov-report/models/halo-infinite/user-info.ts.html +1 -1
- package/coverage/lcov-report/models/index.html +1 -1
- package/coverage/lcov-report/models/spartan-token-proof.ts.html +1 -1
- package/coverage/lcov-report/models/spartan-token-request.ts.html +1 -1
- package/coverage/lcov-report/models/spartan-token.ts.html +1 -1
- package/coverage/lcov-report/models/xbox-ticket.ts.html +1 -1
- package/coverage/lcov-report/types/import-meta.d.ts.html +100 -0
- package/coverage/lcov-report/types/index.html +116 -0
- package/coverage/lcov-report/util/date-time.ts.html +21 -21
- package/coverage/lcov-report/util/expiry-token-cache.ts.html +2 -2
- package/coverage/lcov-report/util/fetch-function.ts.html +1 -1
- package/coverage/lcov-report/util/global-contants.ts.html +1 -1
- package/coverage/lcov-report/util/index.html +20 -20
- package/coverage/lcov-report/util/keyed-expiry-token-cache.ts.html +27 -27
- package/coverage/lcov-report/util/request-error.ts.html +2 -2
- package/coverage/lcov-report/util/resolvable-promise.ts.html +32 -32
- package/coverage/lcov-report/util/xuid.ts.html +3 -3
- package/coverage/lcov.info +337 -272
- package/dist/core/token-persisters/index.cjs +12 -6
- package/dist/core/token-persisters/index.cjs.map +1 -1
- package/dist/core/token-persisters/index.js +12 -6
- package/dist/core/token-persisters/index.js.map +1 -1
- package/dist/index.cjs +22 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -1
- package/dist/index.d.ts +13 -1
- package/dist/index.js +21 -2
- package/dist/index.js.map +1 -1
- package/jest.config.ts +1 -0
- package/jest.setup.ts +5 -0
- package/package.json +2 -2
- package/scripts/jest-runner.mjs +31 -0
- package/src/core/halo-infinite-client.ts +17 -1
- package/src/core/token-persisters/node-fs-token-persister.ts +15 -6
- package/src/endpoints/halo-core-endpoints.ts +1 -1
- package/src/index.ts +7 -2
- package/src/models/halo-infinite/ban-message.ts +4 -0
- package/src/models/halo-infinite/ban-summary.ts +8 -0
- package/src/types/import-meta.d.ts +5 -0
- package/tests/types/import-meta.d.ts +5 -0
- package/tsconfig.app.json +1 -6
- package/tsconfig.json +9 -10
|
@@ -32,6 +32,7 @@ import { wrapPlayerId, unwrapPlayerId } from "../util/xuid";
|
|
|
32
32
|
import { SeasonCalendarContainer } from "../models/halo-infinite/season";
|
|
33
33
|
import { Settings } from "../models/halo-infinite/settings";
|
|
34
34
|
import { MatchCount } from "src/models/halo-infinite/match-count";
|
|
35
|
+
import { BanMessage } from "../models/halo-infinite/ban-message";
|
|
35
36
|
|
|
36
37
|
export interface ResultContainer<TValue> {
|
|
37
38
|
Id: string;
|
|
@@ -337,7 +338,9 @@ export class HaloInfiniteClient {
|
|
|
337
338
|
init?: Omit<RequestInit, "body" | "method">
|
|
338
339
|
) =>
|
|
339
340
|
this.executeJsonRequest<MatchCount>(
|
|
340
|
-
`https://${HaloCoreEndpoints.StatsOrigin}.${
|
|
341
|
+
`https://${HaloCoreEndpoints.StatsOrigin}.${
|
|
342
|
+
HaloCoreEndpoints.ServiceDomain
|
|
343
|
+
}/hi/players/${wrapPlayerId(playerXuid)}/matches/count`,
|
|
341
344
|
{
|
|
342
345
|
...init,
|
|
343
346
|
method: "get",
|
|
@@ -488,6 +491,19 @@ export class HaloInfiniteClient {
|
|
|
488
491
|
}
|
|
489
492
|
);
|
|
490
493
|
|
|
494
|
+
public getBanMessage(
|
|
495
|
+
banPath: string,
|
|
496
|
+
init?: Omit<RequestInit, "body" | "method">
|
|
497
|
+
): Promise<BanMessage> {
|
|
498
|
+
return this.executeJsonRequest(
|
|
499
|
+
`https://${HaloCoreEndpoints.GameCmsOrigin}.${HaloCoreEndpoints.ServiceDomain}/hi/banning/file/${banPath}`,
|
|
500
|
+
{
|
|
501
|
+
...init,
|
|
502
|
+
method: "get",
|
|
503
|
+
}
|
|
504
|
+
);
|
|
505
|
+
}
|
|
506
|
+
|
|
491
507
|
public getSeasonCalendar = (
|
|
492
508
|
init?: Omit<RequestInit, "body" | "method">
|
|
493
509
|
): Promise<SeasonCalendarContainer> =>
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import type { TokenPersister } from ".";
|
|
2
2
|
|
|
3
|
+
function escapeTokenNameForFilesystem(tokenName: string): string {
|
|
4
|
+
return tokenName.replace(/[^a-zA-Z0-9-_]/g, "_");
|
|
5
|
+
}
|
|
6
|
+
|
|
3
7
|
export const nodeFsTokenPersister: TokenPersister = {
|
|
4
8
|
load: async (tokenName) => {
|
|
5
9
|
const tokenDir =
|
|
6
10
|
process.env.TOKEN_ROOT ||
|
|
7
|
-
(await import("path")).join(
|
|
11
|
+
(await import("path")).join(import.meta.dirname, "./tokens");
|
|
8
12
|
try {
|
|
9
13
|
const json = await (
|
|
10
14
|
await import("fs/promises")
|
|
11
|
-
).readFile(`${tokenDir}/${tokenName}`, {
|
|
15
|
+
).readFile(`${tokenDir}/${escapeTokenNameForFilesystem(tokenName)}`, {
|
|
12
16
|
encoding: "utf-8",
|
|
13
17
|
});
|
|
14
18
|
return JSON.parse(json);
|
|
@@ -23,16 +27,21 @@ export const nodeFsTokenPersister: TokenPersister = {
|
|
|
23
27
|
save: async (tokenName, token) => {
|
|
24
28
|
const tokenDir =
|
|
25
29
|
process.env.TOKEN_ROOT ||
|
|
26
|
-
(await import("path")).join(
|
|
30
|
+
(await import("path")).join(import.meta.dirname, "./tokens");
|
|
27
31
|
await (await import("fs/promises")).mkdir(tokenDir, { recursive: true });
|
|
28
32
|
await (
|
|
29
33
|
await import("fs/promises")
|
|
30
|
-
).writeFile(
|
|
34
|
+
).writeFile(
|
|
35
|
+
`${tokenDir}/${escapeTokenNameForFilesystem(tokenName)}`,
|
|
36
|
+
JSON.stringify(token)
|
|
37
|
+
);
|
|
31
38
|
},
|
|
32
39
|
clear: async (tokenName) => {
|
|
33
40
|
const tokenDir =
|
|
34
41
|
process.env.TOKEN_ROOT ||
|
|
35
|
-
(await import("path")).join(
|
|
36
|
-
await (
|
|
42
|
+
(await import("path")).join(import.meta.dirname, "./tokens");
|
|
43
|
+
await (
|
|
44
|
+
await import("fs/promises")
|
|
45
|
+
).unlink(`${tokenDir}/${escapeTokenNameForFilesystem(tokenName)}`);
|
|
37
46
|
},
|
|
38
47
|
};
|
package/src/index.ts
CHANGED
|
@@ -26,9 +26,14 @@ export {
|
|
|
26
26
|
} from "./models/halo-infinite/asset";
|
|
27
27
|
export { AssetKind } from "./models/halo-infinite/asset-kind";
|
|
28
28
|
export { AssetVersionLink } from "./models/halo-infinite/asset-version-link";
|
|
29
|
-
export {
|
|
29
|
+
export {
|
|
30
|
+
BanSummary,
|
|
31
|
+
BanScope,
|
|
32
|
+
BanType,
|
|
33
|
+
} from "./models/halo-infinite/ban-summary";
|
|
34
|
+
export { BanMessage } from "./models/halo-infinite/ban-message";
|
|
30
35
|
export { GameVariantCategory } from "./models/halo-infinite/game-variant-category";
|
|
31
|
-
export { MatchCount } from
|
|
36
|
+
export { MatchCount } from "./models/halo-infinite/match-count";
|
|
32
37
|
export { MatchInfo } from "./models/halo-infinite/match-info";
|
|
33
38
|
export { MatchOutcome } from "./models/halo-infinite/match-outcome";
|
|
34
39
|
export { MatchSkill } from "./models/halo-infinite/match-skill";
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import { ResultContainer } from "src";
|
|
2
2
|
import { ApiFormattedDate } from "./api-formatted-date";
|
|
3
3
|
|
|
4
|
+
export enum BanType {
|
|
5
|
+
Matchmaking = 1,
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export enum BanScope {
|
|
9
|
+
Global = 1,
|
|
10
|
+
}
|
|
11
|
+
|
|
4
12
|
export interface BanSummary {
|
|
5
13
|
Results: ResultContainer<{
|
|
6
14
|
BansInEffect: {
|
package/tsconfig.app.json
CHANGED
package/tsconfig.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"files": [],
|
|
2
|
+
"files": ["src/types/import-meta.d.ts"],
|
|
3
3
|
"include": [],
|
|
4
4
|
"compilerOptions": {
|
|
5
5
|
"forceConsistentCasingInFileNames": true,
|
|
@@ -19,14 +19,13 @@
|
|
|
19
19
|
"esModuleInterop": false,
|
|
20
20
|
"allowSyntheticDefaultImports": true,
|
|
21
21
|
"strict": true,
|
|
22
|
-
"resolveJsonModule": true
|
|
22
|
+
"resolveJsonModule": true,
|
|
23
|
+
"typeRoots": [
|
|
24
|
+
"./src/types",
|
|
25
|
+
"./node_modules/@types",
|
|
26
|
+
"../../node_modules/@types"
|
|
27
|
+
],
|
|
28
|
+
"types": ["node"]
|
|
23
29
|
},
|
|
24
|
-
"references": [
|
|
25
|
-
{
|
|
26
|
-
"path": "./tsconfig.app.json"
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
"path": "./tsconfig.spec.json"
|
|
30
|
-
}
|
|
31
|
-
]
|
|
30
|
+
"references": []
|
|
32
31
|
}
|