diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 3c5f3b5..0000000 --- a/.eslintignore +++ /dev/null @@ -1,2 +0,0 @@ -*.js -*.d.ts \ No newline at end of file diff --git a/.eslintrc.json b/.eslintrc.json index 8022d21..378e4d0 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -15,7 +15,9 @@ "sourceType": "module" }, "ignorePatterns": [ - "build" // Ignore built files + "build", + "*.js", + "*.d.ts" ], "plugins": [ "@typescript-eslint" diff --git a/.gitignore b/.gitignore index d0df6fc..1d89548 100644 --- a/.gitignore +++ b/.gitignore @@ -2,17 +2,15 @@ # nodejs npm-debug.log* -report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json package-lock.json node_modules/ # env .env -.env.test -.env.local +.env.development.local .env.test.local .env.production.local -.env.development.local +.env.local # vscode .vscode/ @@ -41,4 +39,6 @@ docs/ # test test/ -tests/ \ No newline at end of file +tests/ + +coverage/ \ No newline at end of file diff --git a/.prettierignore b/.prettierignore index e82426d..0d20363 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,9 +1,7 @@ .git/ -.github/ # nodejs npm-debug.log* -report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json package.json # log @@ -19,6 +17,5 @@ npm-debug.log* # project LICENSE -tsconfig.tsbuildinfo build/ \ No newline at end of file diff --git a/.prettierrc b/.prettierrc index e647843..4bebd70 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,9 +1,7 @@ { - "embeddedLanguageFormatting": "auto", "printWidth": 200, - "requirePragma": false, - "semi": true, - "singleQuote": false, "tabWidth": 4, - "trailingComma": "none" + "singleQuote": false, + "trailingComma": "none", + "arrowParens": "avoid" } diff --git a/LICENSE b/LICENSE index a11a7d3..2bb0ecd 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2022-2023 ING Project +Copyright (c) 2022-2024 ING Project Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/TODO.md b/TODO.md index b714830..29724a2 100644 --- a/TODO.md +++ b/TODO.md @@ -12,12 +12,6 @@ ### Typescript -**@/riot-api** - -| Type | Name | Progression | -| ------- | ------- | ----------- | -| Service | MatchV1 | Missing | - **@/web-client** | Type | Name | Progression | @@ -28,7 +22,7 @@ | Service | ContractDefinitions | Not Done | | Service | Contracts | Not Done | | Service | CoreGame | Not Done | -| Service | DailyTicket | Not Done | +| Service | DailyTicket | Done | | Service | DisplayNameService | Done | | Service | Favorites | Done | | Service | Latency | Done | @@ -43,20 +37,4 @@ | Service | Session | Done | | Service | Store | Done | ------------ - -### WAIT_FOR_TEST - -Party -- CustomGame.setBalance -- Member.* - - !get - - !setReady - -CoreGame - -Match - -PreGame - -Premier \ No newline at end of file +----------- \ No newline at end of file diff --git a/jest.config.js b/jest.config.js index df8fec9..535929e 100644 --- a/jest.config.js +++ b/jest.config.js @@ -1,21 +1,20 @@ /** @type {import('ts-jest').JestConfigWithTsJest} */ module.exports = { - preset: 'ts-jest', - transform: { - '^.+\\.m?[tj]sx?$': [ - 'ts-jest', - { - tsconfig: 'tsconfig.test.json' - }, + transform: { + "^.+\\.tsx?$": [ + "ts-jest", + { + tsconfig: "tsconfig.test.json" + }, + ], + }, + testEnvironment: "node", + clearMocks: true, + collectCoverage: true, + coverageDirectory: "coverage", + setupFiles: [ + "dotenv/config" ], - }, - testEnvironment: 'node', - clearMocks: true, - collectCoverage: true, - coverageDirectory: "coverage", - coverageProvider: "v8", - setupFiles: [ - "dotenv/config", - "./jest.setup.js" - ], -}; \ No newline at end of file + // 3 minute + testTimeout: 3 * 60 * 1000 +} \ No newline at end of file diff --git a/jest.setup.js b/jest.setup.js deleted file mode 100644 index fa17ee3..0000000 --- a/jest.setup.js +++ /dev/null @@ -1 +0,0 @@ -jest.setTimeout(15 * 60 * 1000); \ No newline at end of file diff --git a/package.json b/package.json index 372da0c..d6715a3 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "format": "prettier --config ./.prettierrc --ignore-path ./.prettierignore --write \"packages/**/*\"", "lint": "npx eslint packages", "compile": "npx tsc --build tsconfig.json", - "compile:clean": "npm exec --workspaces -- npx rimraf \"build\" \"tsconfig.tsbuildinfo\"", + "compile:clean": "npm exec --workspaces -- rimraf \"build\" \"tsconfig.tsbuildinfo\"", "docs": "typedoc", "docs:clean": "rimraf \"docs\"", "clean": "npm run compile:clean && npm run docs:clean", diff --git a/packages/@valapi/auth/LICENSE b/packages/@valapi/auth/LICENSE index a11a7d3..2bb0ecd 100644 --- a/packages/@valapi/auth/LICENSE +++ b/packages/@valapi/auth/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2022-2023 ING Project +Copyright (c) 2022-2024 ING Project Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/@valapi/auth/src/client/AuthCore.ts b/packages/@valapi/auth/src/client/AuthCore.ts index 0601f88..344179b 100644 --- a/packages/@valapi/auth/src/client/AuthCore.ts +++ b/packages/@valapi/auth/src/client/AuthCore.ts @@ -91,7 +91,7 @@ export class AuthCore { "TLS_AES_128_CCM_8_SHA256", "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256" ]; - private static readonly DEFAULT_ClientVersion: string = `release-07.09-shipping-8-1022235`; + private static readonly DEFAULT_ClientVersion: string = `release-08.05-shipping-13-2404755`; private static readonly DEFAULT_ClientPlatform: Required = { platformType: `PC`, platformOS: `Windows`, diff --git a/packages/@valapi/lib/CHANGELOG.md b/packages/@valapi/lib/CHANGELOG.md index 33c850c..0065d74 100644 --- a/packages/@valapi/lib/CHANGELOG.md +++ b/packages/@valapi/lib/CHANGELOG.md @@ -4,23 +4,42 @@ - `ValEncryption.encryptJson(object)` - `ValEncryption.decryptJson(object)` +- `CrosshairHexColor` **Change** - ~~`ValError.fromError`~~ **-->** `ValError.parse` - ~~`ValBase64`~~ **-->** `ValEncryption` -- ~~`[Resources].fromString()`~~ **-->** `[Resources].fromID()` +- ~~`CrosshairColor.fromColor()`~~ **-->** `CrosshairColor.fromName()` +- ~~`CrosshairColor.fromString()`~~ **-->** `CrosshairColor.fromID()` +- ~~`CrosshairColor.fromColorHex()`~~ **-->** `CrosshairHexColor.fromName()` +- ~~`CrosshairColor.fromStringHex()`~~ **-->** `CrosshairHexColor.fromHex()` +- ~~`ItemTypeId.fromString()`~~ **-->** `ItemTypeId.fromID()` +- ~~`Locale.fromString()`~~ **-->** `Locale.fromID()` +- ~~`QueueId.fromString()`~~ **-->** `QueueId.fromID()` +- ~~`Region.fromString()`~~ **-->** `Region.fromID()` **Remove** -- `[Resources].Data` +- `CrosshairColor.Data` +- `ItemTypeId.Data` +- `Locale.Data` +- `QueueId.Data` +- `Region.Data` ### Typescript **Change** -- ~~`[Resources].Identify`~~ **-->** `[Resources].ID` +- ~~`CrosshairColor.Color`~~ **-->** `CrosshairColor.Name` +- ~~`CrosshairColor.Identify`~~ **-->** `CrosshairColor.ID` +- ~~`CrosshairColor.ColorHex`~~ **-->** `CrosshairHexColor.Name` +- ~~`CrosshairColor.IdentifyHex`~~ **-->** `CrosshairHexColor.Hex` +- ~~`ItemTypeId.Identify`~~ **-->** `ItemTypeId.ID` +- ~~`Locale.Identify`~~ **-->** `Locale.ID` +- ~~`QueueId.Identify`~~ **-->** `QueueId.ID` +- ~~`Region.Identify`~~ **-->** `Region.ID` # 3.1.0 diff --git a/packages/@valapi/lib/LICENSE b/packages/@valapi/lib/LICENSE index a11a7d3..2bb0ecd 100644 --- a/packages/@valapi/lib/LICENSE +++ b/packages/@valapi/lib/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2022-2023 ING Project +Copyright (c) 2022-2024 ING Project Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/@valapi/lib/src/__tests__/resource.ts b/packages/@valapi/lib/src/__tests__/resource.ts index 6fecaa8..e2fc6f2 100644 --- a/packages/@valapi/lib/src/__tests__/resource.ts +++ b/packages/@valapi/lib/src/__tests__/resource.ts @@ -1,12 +1,12 @@ -import { CrosshairColor, ItemTypeId, Locale, QueueId, Region } from "../index"; +import { CrosshairColor, CrosshairHexColor, ItemTypeId, Locale, QueueId, Region } from "../index"; describe("lib.resource", () => { test("resources", () => { - expect(CrosshairColor.fromColor("White")).toBe("0"); + expect(CrosshairColor.fromName("White")).toBe("0"); expect(CrosshairColor.fromID("1")).toBe("Green"); - expect(CrosshairColor.fromColorHex("Pink")).toBe("FF00FF"); - expect(CrosshairColor.fromIdHex("00FFFF")).toBe("Cyan"); + expect(CrosshairHexColor.fromName("Pink")).toBe("FF00FF"); + expect(CrosshairHexColor.fromHex("00FFFF")).toBe("Cyan"); expect(ItemTypeId.fromName("Agents")).toBe("01bb38e1-da47-4e6a-9b3d-945fe4655707"); expect(ItemTypeId.fromID("e7c63390-eda7-46e0-bb7a-a6abdacd2433")).toBe("Skins"); diff --git a/packages/@valapi/lib/src/index.ts b/packages/@valapi/lib/src/index.ts index fafad4d..5765624 100644 --- a/packages/@valapi/lib/src/index.ts +++ b/packages/@valapi/lib/src/index.ts @@ -6,6 +6,7 @@ export { ValError } from "./client/ValError"; // resources export * as CrosshairColor from "./resources/CrosshairColor"; +export * as CrosshairHexColor from "./resources/CrosshairHexColor"; export * as ItemTypeId from "./resources/ItemTypeId"; export * as Locale from "./resources/Locale"; export * as QueueId from "./resources/QueueId"; diff --git a/packages/@valapi/lib/src/resources/CrosshairColor.ts b/packages/@valapi/lib/src/resources/CrosshairColor.ts index 8491cb2..644993c 100644 --- a/packages/@valapi/lib/src/resources/CrosshairColor.ts +++ b/packages/@valapi/lib/src/resources/CrosshairColor.ts @@ -1,3 +1,5 @@ +import { ValError } from "../client/ValError"; + export const Default = { White: "0", Green: "1", @@ -10,67 +12,33 @@ export const Default = { Custom: "8" }; -export type Color = keyof typeof Default; -export type ID = (typeof Default)[Color]; +export type Name = keyof typeof Default; +export type ID = (typeof Default)[Name]; /** - * Change from {@link Color} to {@link ID} - * @param {Color} x Color + * Change from {@link Name} to {@link ID} + * @param {Name} x Name * @returns {ID} ID */ -export function fromColor(x: Color): ID | undefined { +export function fromName(x: Name): ID { return Default[x]; } /** - * Change from {@link ID} to {@link Color} + * Change from {@link ID} to {@link Name} * @param {ID} x ID - * @returns {Color} Color + * @returns {Name} Name */ -export function fromID(x: ID): Color | undefined { +export function fromID(x: ID): Name { for (const data of Object.entries(Default)) { if (data[1] == x) { - return data[0]; - } - } - - return undefined; -} - -export const DefaultHex = { - White: "FFFFFF", - Green: "00FF00", - Yellow_Green: "7FFF00", - Green_Yellow: "DFFF00", - Yellow: "FFFF00", - Cyan: "00FFFF", - Pink: "FF00FF", - Red: "FF0000" -}; - -type ColorHex = keyof typeof DefaultHex; -export type IdHex = (typeof DefaultHex)[ColorHex]; - -/** - * Change from {@link Color} to {@link IdHex} - * @param {Color} x Color - * @returns {IdHex} IdHex - */ -export function fromColorHex(x: Color): IdHex | undefined { - return DefaultHex[x]; -} - -/** - * Change from {@link IdHex} to {@link Color} - * @param {IdHex} x IdHex - * @returns {Color} Color - */ -export function fromIdHex(x: IdHex): Color | undefined { - for (const data of Object.entries(DefaultHex)) { - if (data[1] == x) { - return data[0]; + return data[0]; } } - return undefined; + throw new ValError({ + name: "Resource_Error", + message: "Resource Not Found", + data: x + }); } diff --git a/packages/@valapi/lib/src/resources/CrosshairHexColor.ts b/packages/@valapi/lib/src/resources/CrosshairHexColor.ts new file mode 100644 index 0000000..c9144a1 --- /dev/null +++ b/packages/@valapi/lib/src/resources/CrosshairHexColor.ts @@ -0,0 +1,43 @@ +import { ValError } from "../client/ValError"; + +export const Default = { + White: "FFFFFF", + Green: "00FF00", + Yellow_Green: "7FFF00", + Green_Yellow: "DFFF00", + Yellow: "FFFF00", + Cyan: "00FFFF", + Pink: "FF00FF", + Red: "FF0000" +}; + +export type Name = keyof typeof Default; +export type Hex = (typeof Default)[Name]; + +/** + * Change from {@link Name} to {@link Hex} + * @param {Name} x Name + * @returns {Hex} Hex + */ +export function fromName(x: Name): Hex { + return Default[x]; +} + +/** + * Change from {@link Hex} to {@link Name} + * @param {Hex} x Hex + * @returns {Name} Name + */ +export function fromHex(x: Hex): Name { + for (const data of Object.entries(Default)) { + if (data[1] == x) { + return data[0]; + } + } + + throw new ValError({ + name: "Resource_Error", + message: "Resource Not Found", + data: x + }); +} diff --git a/packages/@valapi/lib/src/resources/ItemTypeId.ts b/packages/@valapi/lib/src/resources/ItemTypeId.ts index e9f6d48..614ebe3 100644 --- a/packages/@valapi/lib/src/resources/ItemTypeId.ts +++ b/packages/@valapi/lib/src/resources/ItemTypeId.ts @@ -1,3 +1,5 @@ +import { ValError } from "../client/ValError"; + export const Default = { Agents: "01bb38e1-da47-4e6a-9b3d-945fe4655707", Contracts: "f85cb6f7-33e5-4dc8-b609-ec7212301948", @@ -17,7 +19,7 @@ export type ID = (typeof Default)[Name]; * @param {Name} x Name * @returns {ID} ID */ -export function fromName(x: Name): ID | undefined { +export function fromName(x: Name): ID { return Default[x]; } @@ -26,12 +28,16 @@ export function fromName(x: Name): ID | undefined { * @param {ID} x ID * @returns {Name} Name */ -export function fromID(x: ID): Name | undefined { +export function fromID(x: ID): Name { for (const data of Object.entries(Default)) { if (data[1] == x) { return data[0]; } } - return undefined; + throw new ValError({ + name: "Resource_Error", + message: "Resource Not Found", + data: x + }); } diff --git a/packages/@valapi/lib/src/resources/Locale.ts b/packages/@valapi/lib/src/resources/Locale.ts index 4719a47..e22e59d 100644 --- a/packages/@valapi/lib/src/resources/Locale.ts +++ b/packages/@valapi/lib/src/resources/Locale.ts @@ -1,3 +1,5 @@ +import { ValError } from "../client/ValError"; + export const Default = { Arabic_United_Arab_Emirates: "ar-AE", German_Germany: "de-DE", @@ -28,7 +30,7 @@ export type ID = (typeof Default)[Name]; * @param {Name} x Name * @returns {ID} ID */ -export function fromName(x: Name): ID | undefined { +export function fromName(x: Name): ID { return Default[x]; } @@ -37,12 +39,16 @@ export function fromName(x: Name): ID | undefined { * @param {ID} x ID * @returns {Name} Name */ -export function fromID(x: ID): Name | undefined { +export function fromID(x: ID): Name { for (const data of Object.entries(Default)) { if (data[1] == x) { return data[0]; } } - return undefined; + throw new ValError({ + name: "Resource_Error", + message: "Resource Not Found", + data: x + }); } diff --git a/packages/@valapi/lib/src/resources/QueueId.ts b/packages/@valapi/lib/src/resources/QueueId.ts index 0f2ccb1..3da4d95 100644 --- a/packages/@valapi/lib/src/resources/QueueId.ts +++ b/packages/@valapi/lib/src/resources/QueueId.ts @@ -1,3 +1,5 @@ +import { ValError } from "../client/ValError"; + export const Default = { Unrated: "unrated", Competitive: "competitive", @@ -16,14 +18,14 @@ export const Default = { }; export type Name = keyof typeof Default; -export type ID = Exclude<(typeof Default)[Name], (typeof Default)["New_Map"]>; +export type ID = Exclude<(typeof Default)[Name], (typeof Default)["New_Map"] | "">; /** * Change from {@link Name} to {@link ID} * @param {Name} x Name * @returns {ID} ID */ -export function fromName(x: Name): ID | undefined { +export function fromName(x: Name): ID { return Default[x]; } @@ -32,12 +34,16 @@ export function fromName(x: Name): ID | undefined { * @param {ID} x ID * @returns {Name} Name */ -export function fromID(x: ID): Name | undefined { +export function fromID(x: ID): Name { for (const data of Object.entries(Default)) { if (typeof data[1] == "string" && data[1] == x) { return data[0]; } } - return undefined; + throw new ValError({ + name: "Resource_Error", + message: "Resource Not Found", + data: x + }); } diff --git a/packages/@valapi/lib/src/resources/Region.ts b/packages/@valapi/lib/src/resources/Region.ts index 7f7e356..7a7754c 100644 --- a/packages/@valapi/lib/src/resources/Region.ts +++ b/packages/@valapi/lib/src/resources/Region.ts @@ -1,3 +1,5 @@ +import { ValError } from "../client/ValError"; + export const Default = { North_America: "na", Latin_America: "latam", @@ -16,7 +18,7 @@ export type ID = (typeof Default)[Name]; * @param {Name} x Name * @returns {ID} ID */ -export function fromName(x: Name): ID | undefined { +export function fromName(x: Name): ID { return Default[x]; } @@ -25,12 +27,16 @@ export function fromName(x: Name): ID | undefined { * @param {ID} x ID * @returns {Name} Name */ -export function fromID(x: ID): Name | undefined { +export function fromID(x: ID): Name { for (const data of Object.entries(Default)) { if (data[1] == x) { return data[0]; } } - return undefined; + throw new ValError({ + name: "Resource_Error", + message: "Resource Not Found", + data: x + }); } diff --git a/packages/@valapi/riot-api/LICENSE b/packages/@valapi/riot-api/LICENSE index a11a7d3..2bb0ecd 100644 --- a/packages/@valapi/riot-api/LICENSE +++ b/packages/@valapi/riot-api/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2022-2023 ING Project +Copyright (c) 2022-2024 ING Project Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/@valapi/riot-api/src/__tests__/api.ts b/packages/@valapi/riot-api/src/__tests__/api.ts index d8984ca..1a939d7 100644 --- a/packages/@valapi/riot-api/src/__tests__/api.ts +++ b/packages/@valapi/riot-api/src/__tests__/api.ts @@ -15,8 +15,8 @@ describe("riotapi.api", () => { myClient.ContentV1.contents(Locale.Default.English_United_States), myClient.RankedV1.leaderboardsByAct("3e47230a-463c-a301-eb7d-67bb60357d4f", 10, 0), myClient.StatusV1.platformData() - ]).then((values) => { - values.forEach((element) => { + ]).then(values => { + values.forEach(element => { expect(element.status === 200).toBe(true); expect(element.data).not.toMatchObject({ status: { diff --git a/packages/@valapi/riot-api/src/__tests__/region.ts b/packages/@valapi/riot-api/src/__tests__/region.ts index 469e810..15688e4 100644 --- a/packages/@valapi/riot-api/src/__tests__/region.ts +++ b/packages/@valapi/riot-api/src/__tests__/region.ts @@ -12,8 +12,8 @@ describe("riotapi.region", () => { expect(_region.continent).toBe(continent); expect(_region.url).toMatchObject({ - api: `https://${continent}.api.riotgames.com`, - server: `https://${id}.api.riotgames.com` + region: `https://${id}.api.riotgames.com`, + continent: `https://${continent}.api.riotgames.com` }); }); }); diff --git a/packages/@valapi/riot-api/src/service/MatchV1.ts b/packages/@valapi/riot-api/src/service/MatchV1.ts index 6123d7e..f570d0d 100644 --- a/packages/@valapi/riot-api/src/service/MatchV1.ts +++ b/packages/@valapi/riot-api/src/service/MatchV1.ts @@ -18,14 +18,14 @@ export namespace MatchV1 { isRanked: boolean; seasonId: string; } - + export interface AbilityCastsDto { grenadeCasts: number; ability1Casts: number; ability2Casts: number; ultimateCasts: number; } - + export interface PlayerStatsDto { score: number; roundsPlayed: number; @@ -35,8 +35,7 @@ export namespace MatchV1 { playtimeMillis: number; abilityCasts: MatchV1.AbilityCastsDto; } - - + export interface PlayerDto { puuid: string; gameName: string; @@ -44,17 +43,17 @@ export namespace MatchV1 { teamId: string; partyId: string; characterId: string; - stats: MatchV1.PlayerStatsDto; + stats: MatchV1.PlayerStatsDto; competitiveTier: number; playerCard: string; playerTitle: string; } - + export interface CoachDto { puuid: string; teamId: string; } - + export interface TeamDto { teamId: string; won: boolean; @@ -62,25 +61,24 @@ export namespace MatchV1 { roundsWon: number; numPoints: number; } - + export interface LocationDto { x: number; y: number; } - + export interface PlayerLocationsDto { puuid: string; viewRadians: number; location: MatchV1.LocationDto; } - + export interface FinishingDamageDto { damageType: string; damageItem: string; isSecondaryFireMode: boolean; } - - + export interface KillDto { timeSinceGameStartMillis: number; timeSinceRoundStartMillis: number; @@ -91,7 +89,7 @@ export namespace MatchV1 { playerLocations: Array; finishingDamage: MatchV1.FinishingDamageDto; } - + export interface DamageDto { receiver: string; damage: number; @@ -99,7 +97,7 @@ export namespace MatchV1 { bodyshots: number; headshots: number; } - + export interface EconomyDto { loadoutValue: number; weapon: string; @@ -107,14 +105,14 @@ export namespace MatchV1 { remaining: number; spent: number; } - + export interface AbilityDto { grenadeEffects: string; ability1Effects: string; ability2Effects: string; ultimateEffects: string; } - + export interface PlayerRoundStatsDto { puuid: string; kills: Array; @@ -123,11 +121,11 @@ export namespace MatchV1 { economy: MatchV1.EconomyDto; ability: MatchV1.AbilityDto; } - + export interface RoundResultDto { roundNum: number; roundResult: string; - roundCeremony: string; + roundCeremony: string; winningTeam: string; bombPlanter: string; bombDefuser: string; @@ -141,7 +139,7 @@ export namespace MatchV1 { playerStats: Array; roundResultCode: string; } - + export interface MatchDto { matchInfo: MatchV1.MatchInfoDto; players: Array; diff --git a/packages/@valapi/valorant-api.com/LICENSE b/packages/@valapi/valorant-api.com/LICENSE index a11a7d3..2bb0ecd 100644 --- a/packages/@valapi/valorant-api.com/LICENSE +++ b/packages/@valapi/valorant-api.com/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2022-2023 ING Project +Copyright (c) 2022-2024 ING Project Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/@valapi/valorant-api.com/src/__tests__/api.ts b/packages/@valapi/valorant-api.com/src/__tests__/api.ts index f41d319..644580d 100644 --- a/packages/@valapi/valorant-api.com/src/__tests__/api.ts +++ b/packages/@valapi/valorant-api.com/src/__tests__/api.ts @@ -38,8 +38,8 @@ describe("valapicom.api", () => { myClient.Version.get(), myClient.Weapons.get(), myClient.Weapons.getSkins() - ]).then((values) => { - values.forEach((element) => { + ]).then(values => { + values.forEach(element => { expect(element.status === 200).toBe(true); expect(element.data.data).not.toBe([]); expect(element.data.data).not.toContain([undefined]); diff --git a/packages/@valapi/valorant-api.com/src/client/ValorantApiCom.ts b/packages/@valapi/valorant-api.com/src/client/ValorantApiCom.ts index bd581f6..767e917 100644 --- a/packages/@valapi/valorant-api.com/src/client/ValorantApiCom.ts +++ b/packages/@valapi/valorant-api.com/src/client/ValorantApiCom.ts @@ -103,8 +103,8 @@ export class ValorantApiCom { } }; this.config.axiosConfig.params.responseOptions = Object.entries(this.config.responseOptions) - .filter((x) => x[1]) - .map((x) => x[0]) + .filter(x => x[1]) + .map(x => x[0]) .join(" "); this.axios = axios.create(this.config.axiosConfig); diff --git a/packages/@valapi/web-client/LICENSE b/packages/@valapi/web-client/LICENSE index a11a7d3..2bb0ecd 100644 --- a/packages/@valapi/web-client/LICENSE +++ b/packages/@valapi/web-client/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2022-2023 ING Project +Copyright (c) 2022-2024 ING Project Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/packages/@valapi/web-client/src/__tests__/api.ts b/packages/@valapi/web-client/src/__tests__/api.ts index 98a9ec8..3da8f77 100644 --- a/packages/@valapi/web-client/src/__tests__/api.ts +++ b/packages/@valapi/web-client/src/__tests__/api.ts @@ -20,8 +20,8 @@ describe("webclient.api", () => { myClient.Match.fetchMatchHistory(subject), myClient.Personalization.getPlayerLoadout(subject), myClient.Store.getOffers() - ]).then((values) => { - values.forEach((element) => { + ]).then(values => { + values.forEach(element => { expect(element.status === 200).toBe(true); }); }); diff --git a/packages/@valapi/web-client/src/service/CoreGame.ts b/packages/@valapi/web-client/src/service/CoreGame.ts index 93ac9af..07faf2d 100644 --- a/packages/@valapi/web-client/src/service/CoreGame.ts +++ b/packages/@valapi/web-client/src/service/CoreGame.ts @@ -22,6 +22,7 @@ export namespace CoreGame { AllMUCName: string; TeamMUCName: string; TeamVoiceID: string; + TeamMatchToken: string; IsReconnectable: boolean; ConnectionDetails: { GameServerHosts: Array; @@ -70,6 +71,7 @@ export namespace CoreGame { Loadouts: Array<{ CharacterID: string; Loadout: { + Subject: string; Sprays: { SpraySelections: Array<{ SocketID: string; @@ -77,6 +79,13 @@ export namespace CoreGame { LevelID: string; }>; }; + Expressions: { + AESSelections: Array<{ + SocketID: string; + AssetID: string; + TypeID: string; + }>; + }; Items: Record< string, { diff --git a/packages/@valapi/web-client/src/service/DailyTicket.ts b/packages/@valapi/web-client/src/service/DailyTicket.ts index 89bef23..bb2910b 100644 --- a/packages/@valapi/web-client/src/service/DailyTicket.ts +++ b/packages/@valapi/web-client/src/service/DailyTicket.ts @@ -24,7 +24,6 @@ export namespace DailyTicket { WasPenalized: boolean; BonusesApplied: number; DailyBonusState: [boolean, boolean, boolean, boolean]; - RewardGrants: any; // * unknown }>; } } diff --git a/packages/@valapi/web-client/src/service/Match.ts b/packages/@valapi/web-client/src/service/Match.ts index 717f7aa..70389c4 100644 --- a/packages/@valapi/web-client/src/service/Match.ts +++ b/packages/@valapi/web-client/src/service/Match.ts @@ -55,6 +55,7 @@ export namespace Match { seasonId: string; completionState: string; platformType: string; + premierMatchInfo: any; // * unknown partyRRPenalties: Record; shouldMatchDisablePenalties: boolean; }; @@ -99,11 +100,12 @@ export namespace Match { behaviorFactors: { afkRounds: number; collisions: number; + commsRatingRecovery: number; damageParticipationOutgoing: number; friendlyFireIncoming: number; friendlyFireOutgoing: number; mouseMovement: number; - postGameText: number; + selfDamage: number; stayedInSpawnRounds: number; }; newPlayerExperienceDetails: { diff --git a/packages/@valapi/web-client/src/service/PreGame.ts b/packages/@valapi/web-client/src/service/PreGame.ts index 4b46f47..ea88b5b 100644 --- a/packages/@valapi/web-client/src/service/PreGame.ts +++ b/packages/@valapi/web-client/src/service/PreGame.ts @@ -64,6 +64,7 @@ export namespace PreGame { Mode: string; VoiceSessionID: string; MUCName: string; + TeamMatchToken: string; QueueID: string; ProvisioningFlowID: string; IsRanked: boolean; @@ -77,10 +78,38 @@ export namespace PreGame { export interface Loadout { Loadouts: [ { + Subject: string; Sprays: { - SpraySelections: any; // * unknown + SpraySelections: Array<{ + SocketID: string; + SprayID: string; + LevelID: string; + }>; }; - Items: any; // * unknown + Expressions: { + AESSelections: Array<{ + SocketID: string; + AssetID: string; + TypeID: string; + }>; + }; + Items: Record< + string, + { + ID: string; + TypeID: string; + Sockets: Record< + string, + { + ID: string; + Item: { + ID: string; + TypeID: string; + }; + } + >; + } + >; } ]; LoadoutsValid: boolean; diff --git a/packages/@valapi/web-client/src/service/Store.ts b/packages/@valapi/web-client/src/service/Store.ts index da65615..6ec0e26 100644 --- a/packages/@valapi/web-client/src/service/Store.ts +++ b/packages/@valapi/web-client/src/service/Store.ts @@ -11,6 +11,18 @@ export namespace Store { export interface Wallet { Balances: Store.Currency; + CurrencyLimits: Record< + string, + { + Limits: Record< + string, + { + amount: number; + limitType: string; + } + >; + } + >; } export interface Offer { diff --git a/packages/valorant.ts/src/__tests__/crosshair.ts b/packages/valorant.ts/src/__tests__/crosshair.ts index b39bd57..2d8f64f 100644 --- a/packages/valorant.ts/src/__tests__/crosshair.ts +++ b/packages/valorant.ts/src/__tests__/crosshair.ts @@ -55,7 +55,7 @@ describe("valorant_ts.crosshair", () => { crosshair.import("0;s;1"); - expect(crosshair.find((value) => value.value.path === "0.s")).toStrictEqual({ + expect(crosshair.find(value => value.value.path === "0.s")).toStrictEqual({ type: "Boolean", value: { path: "0.s", diff --git a/packages/valorant.ts/src/index.ts b/packages/valorant.ts/src/index.ts index e79c710..bce6bfa 100644 --- a/packages/valorant.ts/src/index.ts +++ b/packages/valorant.ts/src/index.ts @@ -1,7 +1,7 @@ // packages export { AuthClient, AuthCore, AuthService } from "@valapi/auth"; -export { ValError, ValRegion, CrosshairColor, ItemTypeId, Locale, QueueId, Region, ValEncryption } from "@valapi/lib"; +export { ValError, ValRegion, CrosshairColor, CrosshairHexColor, ItemTypeId, Locale, QueueId, Region, ValEncryption } from "@valapi/lib"; export { RiotApi, RiotApiRegion, RiotApiService } from "@valapi/riot-api"; export { ValorantApiCom, ValorantApiComService } from "@valapi/valorant-api.com"; export { WebClient, WebClientRegion, WebClientService } from "@valapi/web-client"; diff --git a/packages/valorant.ts/src/utils/ValCrosshair.ts b/packages/valorant.ts/src/utils/ValCrosshair.ts index 3857975..3ec9b17 100644 --- a/packages/valorant.ts/src/utils/ValCrosshair.ts +++ b/packages/valorant.ts/src/utils/ValCrosshair.ts @@ -1,4 +1,4 @@ -import { ValError, CrosshairColor } from "@valapi/lib"; +import { ValError, CrosshairColor, CrosshairHexColor } from "@valapi/lib"; export namespace ValCrosshair { export type Category = "0" | "P" | "A" | "S"; @@ -52,7 +52,7 @@ export namespace ValCrosshair { /** * When hex is enable */ - ValCrosshair.Data.String<`${TName}.Hex`, CrosshairColor.IdHex, ["FFFFFF", "00FF00", "7FFF00", "DFFF00", "FFFF00", "00FFFF", "FF00FF", "FF0000"]> + ValCrosshair.Data.String<`${TName}.Hex`, CrosshairHexColor.Hex, ["FFFFFF", "00FF00", "7FFF00", "DFFF00", "FFFF00", "00FFFF", "FF00FF", "FF0000"]> ]; } @@ -163,8 +163,8 @@ export class ValCrosshair { path: "P.u", priority: 5, name: "Primary.Crosshair.Color.Hex", - data: CrosshairColor.fromColorHex("White"), - default: CrosshairColor.fromColorHex("White") + data: CrosshairHexColor.fromName("White"), + default: CrosshairHexColor.fromName("White") }, components: [] } @@ -643,8 +643,8 @@ export class ValCrosshair { path: "A.u", priority: 39, name: "AimDownSights.Crosshair.Color.Hex", - data: CrosshairColor.fromColorHex("White"), - default: CrosshairColor.fromColorHex("White") + data: CrosshairHexColor.fromName("White"), + default: CrosshairHexColor.fromName("White") }, components: [] } @@ -1111,8 +1111,8 @@ export class ValCrosshair { path: "S.t", priority: 73, name: "SniperScope.CenterDot.Color.Hex", - data: CrosshairColor.fromColorHex("White"), - default: CrosshairColor.fromColorHex("White") + data: CrosshairHexColor.fromName("White"), + default: CrosshairHexColor.fromName("White") }, components: [] } @@ -1333,19 +1333,19 @@ export class ValCrosshair { P: [], S: [] }; - _export["0"].map((a) => { + _export["0"].map(a => { _sort["0"].push(a.path); _sort["0"].push(a.value); }); - _export["A"].map((a) => { + _export["A"].map(a => { _sort["A"].push(a.path); _sort["A"].push(a.value); }); - _export["P"].map((a) => { + _export["P"].map(a => { _sort["P"].push(a.path); _sort["P"].push(a.value); }); - _export["S"].map((a) => { + _export["S"].map(a => { _sort["S"].push(a.path); _sort["S"].push(a.value); }); diff --git a/packages/valorant.ts/typedoc.json b/packages/valorant.ts/typedoc.json new file mode 100644 index 0000000..6f090fc --- /dev/null +++ b/packages/valorant.ts/typedoc.json @@ -0,0 +1,5 @@ +{ + "name": "valorant.ts", + "extends": ["../../typedoc.base.json"], + "entryPoints": ["src/index.ts"] +} diff --git a/tsconfig.test.json b/tsconfig.test.json index c79bcb1..0d5a041 100644 --- a/tsconfig.test.json +++ b/tsconfig.test.json @@ -1,8 +1,8 @@ { "compilerOptions": { "composite": true, - "target": "es2022", - "lib": [ "es2022", "es2022.error", "es2021.promise" ], + "target": "es2023", + "lib": [ "es2023", "es2022.error", "es2021.promise" ], "module": "commonjs", "moduleResolution": "node", "resolveJsonModule": true, diff --git a/typedoc.json b/typedoc.json index 60aba7b..d9fe3d9 100644 --- a/typedoc.json +++ b/typedoc.json @@ -5,7 +5,8 @@ "packages/@valapi/lib", "packages/@valapi/riot-api", "packages/@valapi/valorant-api.com", - "packages/@valapi/web-client" + "packages/@valapi/web-client", + "packages/valroant.ts" ], "entryPointStrategy": "packages", "cleanOutputDir": true,