Skip to content

Commit

Permalink
updating legacy code
Browse files Browse the repository at this point in the history
  • Loading branch information
KTNG-3 committed Apr 6, 2024
1 parent 08960ac commit 714eaa5
Show file tree
Hide file tree
Showing 42 changed files with 266 additions and 185 deletions.
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

4 changes: 3 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
"sourceType": "module"
},
"ignorePatterns": [
"build" // Ignore built files
"build",
"*.js",
"*.d.ts"
],
"plugins": [
"@typescript-eslint"
Expand Down
10 changes: 5 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down Expand Up @@ -41,4 +39,6 @@ docs/

# test
test/
tests/
tests/

coverage/
3 changes: 0 additions & 3 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
.git/
.github/

# nodejs
npm-debug.log*
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
package.json

# log
Expand All @@ -19,6 +17,5 @@ npm-debug.log*

# project
LICENSE
tsconfig.tsbuildinfo

build/
8 changes: 3 additions & 5 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
{
"embeddedLanguageFormatting": "auto",
"printWidth": 200,
"requirePragma": false,
"semi": true,
"singleQuote": false,
"tabWidth": 4,
"trailingComma": "none"
"singleQuote": false,
"trailingComma": "none",
"arrowParens": "avoid"
}
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -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
Expand Down
26 changes: 2 additions & 24 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@

### Typescript

**@/riot-api**

| Type | Name | Progression |
| ------- | ------- | ----------- |
| Service | MatchV1 | Missing |

**@/web-client**

| Type | Name | Progression |
Expand All @@ -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 |
Expand All @@ -43,20 +37,4 @@
| Service | Session | Done |
| Service | Store | Done |

-----------

### WAIT_FOR_TEST

Party
- CustomGame.setBalance
- Member.*
- !get
- !setReady

CoreGame

Match

PreGame

Premier
-----------
35 changes: 17 additions & 18 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -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"
],
};
// 3 minute
testTimeout: 3 * 60 * 1000
}
1 change: 0 additions & 1 deletion jest.setup.js

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/@valapi/auth/LICENSE
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion packages/@valapi/auth/src/client/AuthCore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<AuthCore.ClientPlatfrom> = {
platformType: `PC`,
platformOS: `Windows`,
Expand Down
25 changes: 22 additions & 3 deletions packages/@valapi/lib/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion packages/@valapi/lib/LICENSE
Original file line number Diff line number Diff line change
@@ -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
Expand Down
8 changes: 4 additions & 4 deletions packages/@valapi/lib/src/__tests__/resource.ts
Original file line number Diff line number Diff line change
@@ -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");
Expand Down
1 change: 1 addition & 0 deletions packages/@valapi/lib/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
64 changes: 16 additions & 48 deletions packages/@valapi/lib/src/resources/CrosshairColor.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { ValError } from "../client/ValError";

export const Default = <const>{
White: "0",
Green: "1",
Expand All @@ -10,67 +12,33 @@ export const Default = <const>{
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 <ID>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 <Color>data[0];
}
}

return undefined;
}

export const DefaultHex = <const>{
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 <IdHex>DefaultHex[<ColorHex>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 <Color>data[0];
return <Name>data[0];
}
}

return undefined;
throw new ValError({
name: "Resource_Error",
message: "Resource Not Found",
data: x
});
}
Loading

0 comments on commit 714eaa5

Please sign in to comment.