From 7a945c4a5c0d5cbeb13e72d589b5636e1adb39f4 Mon Sep 17 00:00:00 2001 From: Peter Reid Date: Mon, 20 Sep 2021 22:15:39 +0100 Subject: [PATCH 01/40] fix(ci): disable jest report step for dependavot --- .github/workflows/build.yml | 5 ++++- docs/api/classes/client_LodestoneClient.default.md | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3d5605f..b9bce74 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,6 +5,9 @@ name: Build, Test & Lint # Controls when the workflow will run on: push: + branches: + - main + - develop pull_request: # Allows you to run this workflow manually from the Actions tab @@ -35,7 +38,7 @@ jobs: - name: Test Report uses: dorny/test-reporter@v1 - if: success() || failure() # run this step even if previous step failed + if: github.actor != 'dependabot-bot' && (success() || failure()) # run this step even if previous step failed with: name: JEST Tests # Name of the check run which will be created path: reports/jest-*.xml # Path to test results diff --git a/docs/api/classes/client_LodestoneClient.default.md b/docs/api/classes/client_LodestoneClient.default.md index d1ba9fb..db74f8d 100644 --- a/docs/api/classes/client_LodestoneClient.default.md +++ b/docs/api/classes/client_LodestoneClient.default.md @@ -29,7 +29,7 @@ Client for interfacing with the Final Fantasy XIV Lodestone #### Defined in -[LodestoneClient.ts:53](https://github.com/XIVStats/lodestone/blob/66019f1/src/client/LodestoneClient.ts#L53) +[LodestoneClient.ts:53](https://github.com/XIVStats/lodestone/blob/21e3be7/src/client/LodestoneClient.ts#L53) ## Properties @@ -43,4 +43,4 @@ An instance will be generated by default, but as a consumer you can provide your #### Defined in -[LodestoneClient.ts:49](https://github.com/XIVStats/lodestone/blob/66019f1/src/client/LodestoneClient.ts#L49) +[LodestoneClient.ts:49](https://github.com/XIVStats/lodestone/blob/21e3be7/src/client/LodestoneClient.ts#L49) From 5315928383fc6be8c9993c50c9c0517a84ec3dd4 Mon Sep 17 00:00:00 2001 From: Peter Reid Date: Mon, 20 Sep 2021 22:18:22 +0100 Subject: [PATCH 02/40] fix(ci): enable automerge for dependabot prs --- .github/workflows/automerge.yml | 1 + docs/api/classes/client_LodestoneClient.default.md | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/automerge.yml b/.github/workflows/automerge.yml index 25394c8..adde499 100644 --- a/.github/workflows/automerge.yml +++ b/.github/workflows/automerge.yml @@ -11,6 +11,7 @@ jobs: contains(github.event.pull_request.labels.*.name, 'pr/auto-approve') && (github.event.pull_request.user.login == 'reidweb-automation' || github.event.pull_request.user.login == 'dependabot[bot]' + || github.event.pull_request.user.login == 'dependabot' || github.event.pull_request.user.login == 'dependabot-preview[bot]') runs-on: ubuntu-latest permissions: diff --git a/docs/api/classes/client_LodestoneClient.default.md b/docs/api/classes/client_LodestoneClient.default.md index db74f8d..6c8b8cc 100644 --- a/docs/api/classes/client_LodestoneClient.default.md +++ b/docs/api/classes/client_LodestoneClient.default.md @@ -29,7 +29,7 @@ Client for interfacing with the Final Fantasy XIV Lodestone #### Defined in -[LodestoneClient.ts:53](https://github.com/XIVStats/lodestone/blob/21e3be7/src/client/LodestoneClient.ts#L53) +[LodestoneClient.ts:53](https://github.com/XIVStats/lodestone/blob/7a945c4/src/client/LodestoneClient.ts#L53) ## Properties @@ -43,4 +43,4 @@ An instance will be generated by default, but as a consumer you can provide your #### Defined in -[LodestoneClient.ts:49](https://github.com/XIVStats/lodestone/blob/21e3be7/src/client/LodestoneClient.ts#L49) +[LodestoneClient.ts:49](https://github.com/XIVStats/lodestone/blob/7a945c4/src/client/LodestoneClient.ts#L49) From 8d90911fca3f5bfbc8992412ced2cf0fb60f42a6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Sep 2021 20:36:23 +0000 Subject: [PATCH 03/40] chore(deps): bump tmpl from 1.0.4 to 1.0.5 Bumps [tmpl](https://github.com/daaku/nodejs-tmpl) from 1.0.4 to 1.0.5. - [Release notes](https://github.com/daaku/nodejs-tmpl/releases) - [Commits](https://github.com/daaku/nodejs-tmpl/commits/v1.0.5) --- updated-dependencies: - dependency-name: tmpl dependency-type: indirect ... Signed-off-by: dependabot[bot] --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index f946270..e81e8a4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11567,9 +11567,9 @@ } }, "tmpl": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.4.tgz", - "integrity": "sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE=", + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", + "integrity": "sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==", "dev": true }, "to-fast-properties": { From 463185d50bbe200257bd6d8ba1d5896c3cb60b8e Mon Sep 17 00:00:00 2001 From: Peter Reid Date: Mon, 20 Sep 2021 22:24:29 +0100 Subject: [PATCH 04/40] fix(ci): remove branch conditions from build --- .github/workflows/build.yml | 3 --- docs/api/classes/client_LodestoneClient.default.md | 4 ++-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b9bce74..2b010cb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,9 +5,6 @@ name: Build, Test & Lint # Controls when the workflow will run on: push: - branches: - - main - - develop pull_request: # Allows you to run this workflow manually from the Actions tab diff --git a/docs/api/classes/client_LodestoneClient.default.md b/docs/api/classes/client_LodestoneClient.default.md index 6c8b8cc..5f74958 100644 --- a/docs/api/classes/client_LodestoneClient.default.md +++ b/docs/api/classes/client_LodestoneClient.default.md @@ -29,7 +29,7 @@ Client for interfacing with the Final Fantasy XIV Lodestone #### Defined in -[LodestoneClient.ts:53](https://github.com/XIVStats/lodestone/blob/7a945c4/src/client/LodestoneClient.ts#L53) +[LodestoneClient.ts:53](https://github.com/XIVStats/lodestone/blob/5315928/src/client/LodestoneClient.ts#L53) ## Properties @@ -43,4 +43,4 @@ An instance will be generated by default, but as a consumer you can provide your #### Defined in -[LodestoneClient.ts:49](https://github.com/XIVStats/lodestone/blob/7a945c4/src/client/LodestoneClient.ts#L49) +[LodestoneClient.ts:49](https://github.com/XIVStats/lodestone/blob/5315928/src/client/LodestoneClient.ts#L49) From df6867f7a7df896a1972421a551e16b57eaab3e8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Sep 2021 21:22:54 +0000 Subject: [PATCH 05/40] chore(deps): bump nth-check from 2.0.0 to 2.0.1 Bumps [nth-check](https://github.com/fb55/nth-check) from 2.0.0 to 2.0.1. - [Release notes](https://github.com/fb55/nth-check/releases) - [Commits](https://github.com/fb55/nth-check/compare/v2.0.0...v2.0.1) --- updated-dependencies: - dependency-name: nth-check dependency-type: indirect ... Signed-off-by: dependabot[bot] --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index e81e8a4..150b83c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9214,9 +9214,9 @@ } }, "nth-check": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.0.0.tgz", - "integrity": "sha512-i4sc/Kj8htBrAiH1viZ0TgU8Y5XqCaV/FziYK6TBczxmeKm3AEFWqqF3195yKudrarqy7Zu80Ra5dobFjn9X/Q==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.0.1.tgz", + "integrity": "sha512-it1vE95zF6dTT9lBsYbxvqh0Soy4SPowchj0UBGj/V6cTPnXXtQOPUbhZ6CmGzAD/rW22LQK6E96pcdJXk4A4w==", "requires": { "boolbase": "^1.0.0" } From f3bda9e97e2828a73890420632e23cca6158c2a9 Mon Sep 17 00:00:00 2001 From: Peter Reid Date: Sun, 7 Nov 2021 21:19:39 +0000 Subject: [PATCH 06/40] test(character): add test for character with shield --- .../classes/client_LodestoneClient.default.md | 6 +- src/entity/__tests__/Character.test.ts | 35 +- src/entity/__tests__/resources/27218992.html | 2700 +++++++++++++++++ 3 files changed, 2735 insertions(+), 6 deletions(-) create mode 100644 src/entity/__tests__/resources/27218992.html diff --git a/docs/api/classes/client_LodestoneClient.default.md b/docs/api/classes/client_LodestoneClient.default.md index 5f74958..649130f 100644 --- a/docs/api/classes/client_LodestoneClient.default.md +++ b/docs/api/classes/client_LodestoneClient.default.md @@ -2,7 +2,7 @@ [client/LodestoneClient](../modules/client_LodestoneClient.md).default -Client for interfacing with the Final Fantasy XIV Lodestone +Client for interfacing with the Final Fantasy XIV Lodestone. ## Table of contents @@ -29,7 +29,7 @@ Client for interfacing with the Final Fantasy XIV Lodestone #### Defined in -[LodestoneClient.ts:53](https://github.com/XIVStats/lodestone/blob/5315928/src/client/LodestoneClient.ts#L53) +[LodestoneClient.ts:53](https://github.com/XIVStats/lodestone/blob/463185d/src/client/LodestoneClient.ts#L53) ## Properties @@ -43,4 +43,4 @@ An instance will be generated by default, but as a consumer you can provide your #### Defined in -[LodestoneClient.ts:49](https://github.com/XIVStats/lodestone/blob/5315928/src/client/LodestoneClient.ts#L49) +[LodestoneClient.ts:49](https://github.com/XIVStats/lodestone/blob/463185d/src/client/LodestoneClient.ts#L49) diff --git a/src/entity/__tests__/Character.test.ts b/src/entity/__tests__/Character.test.ts index bb2cf55..24a72a8 100644 --- a/src/entity/__tests__/Character.test.ts +++ b/src/entity/__tests__/Character.test.ts @@ -32,10 +32,11 @@ import GearCategory from '../GearCategory' describe('Character', () => { describe('when loading character information from HTML', () => { + // Character with Free Company, Grand Company, Full Gear, No Shield const expectedCharacterOne: Character = { id: 11886902, name: "P'tajha Rihll", - server: 'Cerberus', + homeWorld: 'Cerberus', dataCenter: 'Chaos', race: 'Elezen', clan: 'Wildwood', @@ -247,10 +248,11 @@ describe('Character', () => { }, } + // Character with no Grand Company const expectedCharacterTwo: Character = { id: 38531003, name: 'Aurora Nyx', - server: 'Omega', + homeWorld: 'Omega', dataCenter: 'Chaos', race: 'Elezen', clan: 'Wildwood', @@ -262,13 +264,40 @@ describe('Character', () => { grandCompany: undefined, } + // Character with a shield + const expectedCharacterThree: Character = { + id: 11886902, + name: 'Shamir Kotomine', + activeClass: Class.Gladiator, + cityState: 'Limsa Lominsa', + clan: 'Dunesfolk', + homeWorld: 'Cerberus', + title: 'Outlander', + dataCenter: 'Chaos', + freeCompany: 'Cerberus (Chaos)', + gear: { + shield: { + category: GearCategory.Shield, + name: 'Augmented Scaevan Magitek Shield', + id: '92995e4130e', + iLvl: 400, + }, + }, + gender: 'Female', + grandCompany: 'Maelstrom', + grandCompanyRank: 'Storm Corporal', + guardian: 'Halone, the Fury', + nameDay: '8th Sun of the 1st Astral Moon', + race: 'Lalafell', + } + // TODO: Test character with shield - // TODO: test character with no grand company // TODO: test character with no free company describe.each([ [11886902, "P'tajha Rihll", expectedCharacterOne], [38531003, 'Aurora Nyxx', expectedCharacterTwo], + [27218992, 'Shamir Kotmine', expectedCharacterThree], ])('for character %s - %s', (charId, name, expected) => { let resultantCharacter: Character const nonObjectAttributes = Object.entries(expected).filter((pair) => typeof pair[1] !== 'object') diff --git a/src/entity/__tests__/resources/27218992.html b/src/entity/__tests__/resources/27218992.html new file mode 100644 index 0000000..433a617 --- /dev/null +++ b/src/entity/__tests__/resources/27218992.html @@ -0,0 +1,2700 @@ + + + + + + + + + + + Shamir Kotomine | FINAL FANTASY XIV, The Lodestone + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + +
+ + +
+ + + + + + +
+ + + +
+ +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + +

Character

+ + + + + + + +
+ +
+ + + +
+

Character

+ + + +
+ +
+ +
+
+

Outlander

+

Shamir Kotomine

+ +

Cerberus (Chaos)

+
+
+
+ + + + +
+ +
+ +

You have no connection with this character.

+ + + + + +
Follower Requests
+

Before this character can be followed, you must first submit a follower request.
Do you wish to proceed?

+ + + + +
+ +
+ + + + + + +
+ + +

Profile

Display Attributes

Race/Clan/Gender

Lalafell
Dunesfolk / ♀

Nameday

8th Sun of the 1st Astral Moon

Guardian

Halone, the Fury

City-state

Limsa Lominsa

Grand Company

Maelstrom / Storm Corporal

Free Company

Archadian Moogles

Attributes

Strength3117
Dexterity282
Vitality3557
Intelligence179
Mind299

Offensive Properties

Critical Hit Rate1549
Determination1418
Direct Hit Rate365

Defensive Properties

Defense5790
Magic Defense5790

Physical Properties

Attack Power3117
Skill Speed1284

Mental Properties

Attack Magic Potency179
Healing Magic Potency299
Spell Speed365

Role

Tenacity1460
Piety296

LEVEL 71

  • 71
  • 80
  • 72
  • 80
  • -
  • 80
  • -
  • 80
  • 80
  • 80
  • 80
  • -
  • -
  • -
  • -
  • 80
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • HP

    77788
  • MP

    10000

Character Profile

fflogs-pqtaA4nVJXF12fxDkvTH3zPmLWQGwZhM

+ + +
+ + +
+ + + + + + + +
+ +
+
+
+ +
+ + + + +
+ ForumsMog StationOfficial Blog +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+ + + +
+ + + +
+ + + +
+ + + +
+ + + +
+ + + + +
+ + + + + + + + + +
+ + + +
+ + + + + + +
+ + + +
+

Community Wall

+ +
+
+

Recent Activity

+ +
+

+ Filter which items are to be displayed below.
+ + * Notifications for standings updates are shared across all Worlds.
+ * Notifications for PvP team formations are shared for all languages.
+ * Notifications for free company formations are shared for all languages. +
+

+ + +
+
Sort by
Data Center / Home World
Primary language
Displaying
+
+ + +
+
+ + + + + +
+ + + + + + + + + + + + + + +
+ +
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Shamir Kotomine | FINAL FANTASY XIV, The Lodestone + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + +
+ + +
+ + + + + + +
+ + + +
+ +
+ + + + + + + + + + + + + + + + + + + + +
+ + + + +

Character

+ + + + + + + +
+ +
+ + + +
+

Character

+ + + +
+ +
+ +
+
+

Outlander

+

Shamir Kotomine

+ +

Cerberus (Chaos)

+
+
+
+ + + + +
+ +
+ +

You have no connection with this character.

+ + + + + +
Follower Requests
+

Before this character can be followed, you must first submit a follower request.
Do you wish to proceed?

+ + + + +
+ +
+ + + + + + +
+ + +

Profile

Display Attributes

Race/Clan/Gender

Lalafell
Dunesfolk / ♀

Nameday

8th Sun of the 1st Astral Moon

Guardian

Halone, the Fury

City-state

Limsa Lominsa

Grand Company

Maelstrom / Storm Corporal

Free Company

Archadian Moogles

Attributes

Strength3117
Dexterity282
Vitality3557
Intelligence179
Mind299

Offensive Properties

Critical Hit Rate1549
Determination1418
Direct Hit Rate365

Defensive Properties

Defense5790
Magic Defense5790

Physical Properties

Attack Power3117
Skill Speed1284

Mental Properties

Attack Magic Potency179
Healing Magic Potency299
Spell Speed365

Role

Tenacity1460
Piety296

LEVEL 71

  • 71
  • 80
  • 72
  • 80
  • -
  • 80
  • -
  • 80
  • 80
  • 80
  • 80
  • -
  • -
  • -
  • -
  • 80
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • HP

    77788
  • MP

    10000

Character Profile

fflogs-pqtaA4nVJXF12fxDkvTH3zPmLWQGwZhM

+ + +
+ + +
+ + + + + + + +
+ +
+
+
+ +
+ + + + +
+ ForumsMog StationOfficial Blog +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + +
+ + + +
+ + + +
+ + + +
+ + + +
+ + + +
+ + + +
+ + + + +
+ + + + + + + + + +
+ + + +
+ + + + + + +
+ + + +
+

Community Wall

+ +
+
+

Recent Activity

+ +
+

+ Filter which items are to be displayed below.
+ + * Notifications for standings updates are shared across all Worlds.
+ * Notifications for PvP team formations are shared for all languages.
+ * Notifications for free company formations are shared for all languages. +
+

+ + +
+
Sort by
Data Center / Home World
Primary language
Displaying
+
+ + +
+
+ + + + + +
+ + + + + + + + + + + + + + +
+ +
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From c74514c51fdb940c0e6d248e98ad68176d062ba0 Mon Sep 17 00:00:00 2001 From: Peter Reid Date: Sun, 7 Nov 2021 21:21:47 +0000 Subject: [PATCH 07/40] fix(character): rename server attribute to be homeWorld --- .eslintrc.js | 3 +- .../classes/client_LodestoneClient.default.md | 4 +- package-lock.json | 57 + package.json | 1 + src/client/LodestoneClient.ts | 4 +- src/config/DomConfig.ts | 2 +- src/entity/Character.ts | 2 +- src/entity/__tests__/resources/27218992.html | 1337 ----------------- src/interface/ICharacter.ts | 2 +- src/interface/IMappableCharacter.ts | 2 +- 10 files changed, 68 insertions(+), 1346 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 657aced..c296703 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -24,13 +24,14 @@ */ module.exports = { - plugins: ['@typescript-eslint', 'prettier', 'notice'], + plugins: ['@typescript-eslint', 'prettier', 'notice', 'jsdoc'], extends: [ 'eslint:recommended', 'airbnb-typescript', 'prettier', 'plugin:@typescript-eslint/recommended', 'plugin:@typescript-eslint/recommended-requiring-type-checking', + 'plugin:jsdoc/recommended', ], parser: '@typescript-eslint/parser', parserOptions: { diff --git a/docs/api/classes/client_LodestoneClient.default.md b/docs/api/classes/client_LodestoneClient.default.md index 649130f..ca6799b 100644 --- a/docs/api/classes/client_LodestoneClient.default.md +++ b/docs/api/classes/client_LodestoneClient.default.md @@ -29,7 +29,7 @@ Client for interfacing with the Final Fantasy XIV Lodestone. #### Defined in -[LodestoneClient.ts:53](https://github.com/XIVStats/lodestone/blob/463185d/src/client/LodestoneClient.ts#L53) +[LodestoneClient.ts:53](https://github.com/XIVStats/lodestone/blob/f3bda9e/src/client/LodestoneClient.ts#L53) ## Properties @@ -43,4 +43,4 @@ An instance will be generated by default, but as a consumer you can provide your #### Defined in -[LodestoneClient.ts:49](https://github.com/XIVStats/lodestone/blob/463185d/src/client/LodestoneClient.ts#L49) +[LodestoneClient.ts:49](https://github.com/XIVStats/lodestone/blob/f3bda9e/src/client/LodestoneClient.ts#L49) diff --git a/package-lock.json b/package-lock.json index f946270..833c34d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -686,6 +686,17 @@ "chalk": "^4.0.0" } }, + "@es-joy/jsdoccomment": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/@es-joy/jsdoccomment/-/jsdoccomment-0.12.0.tgz", + "integrity": "sha512-Gw4/j9v36IKY8ET+W0GoOzrRw17xjf21EIFFRL3zx21fF5MnqmeNpNi+PU/LKjqLpPb2Pw2XdlJbYM31VVo/PQ==", + "dev": true, + "requires": { + "comment-parser": "1.2.4", + "esquery": "^1.4.0", + "jsdoc-type-pratt-parser": "2.0.0" + } + }, "@eslint/eslintrc": { "version": "0.4.3", "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-0.4.3.tgz", @@ -2455,6 +2466,12 @@ "delayed-stream": "~1.0.0" } }, + "comment-parser": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/comment-parser/-/comment-parser-1.2.4.tgz", + "integrity": "sha512-pm0b+qv+CkWNriSTMsfnjChF9kH0kxz55y44Wo5le9qLxMj5xDQAaEd9ZN1ovSuk9CsrncWaFwgpOMg7ClJwkw==", + "dev": true + }, "commitizen": { "version": "4.2.4", "resolved": "https://registry.npmjs.org/commitizen/-/commitizen-4.2.4.tgz", @@ -3690,6 +3707,34 @@ } } }, + "eslint-plugin-jsdoc": { + "version": "37.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-jsdoc/-/eslint-plugin-jsdoc-37.0.0.tgz", + "integrity": "sha512-Pv5/Y9stNPHJEoF9GM+pcB9nOT4sNToVxv9v5vsyr8tbam0tM4DUKFShtJBZ+fZFdwhFaQU1hGcPQqsjy+dKCQ==", + "dev": true, + "requires": { + "@es-joy/jsdoccomment": "0.12.0", + "comment-parser": "1.2.4", + "debug": "^4.3.2", + "esquery": "^1.4.0", + "jsdoc-type-pratt-parser": "^2.0.0", + "lodash": "^4.17.21", + "regextras": "^0.8.0", + "semver": "^7.3.5", + "spdx-expression-parse": "^3.0.1" + }, + "dependencies": { + "semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + } + } + }, "eslint-plugin-jsx-a11y": { "version": "6.4.1", "resolved": "https://registry.npmjs.org/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.4.1.tgz", @@ -6337,6 +6382,12 @@ "esprima": "^4.0.0" } }, + "jsdoc-type-pratt-parser": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/jsdoc-type-pratt-parser/-/jsdoc-type-pratt-parser-2.0.0.tgz", + "integrity": "sha512-sUuj2j48wxrEpbFjDp1sAesAxPiLT+z0SWVmMafyIINs6Lj5gIPKh3VrkBZu4E/Dv+wHpOot0m6H8zlHQjwqeQ==", + "dev": true + }, "jsdom": { "version": "16.6.0", "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-16.6.0.tgz", @@ -10736,6 +10787,12 @@ "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", "dev": true }, + "regextras": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/regextras/-/regextras-0.8.0.tgz", + "integrity": "sha512-k519uI04Z3SaY0fLX843MRXnDeG2+vHOFsyhiPZvNLe7r8rD2YNRjq4BQLZZ0oAr2NrtvZlICsXysGNFPGa3CQ==", + "dev": true + }, "registry-auth-token": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.2.1.tgz", diff --git a/package.json b/package.json index 479f934..f93f0a0 100644 --- a/package.json +++ b/package.json @@ -84,6 +84,7 @@ "eslint-config-airbnb-typescript": "^12.3.1", "eslint-config-prettier": "^8.3.0", "eslint-plugin-import": "^2.23.4", + "eslint-plugin-jsdoc": "^37.0.0", "eslint-plugin-jsx-a11y": "^6.4.1", "eslint-plugin-notice": "^0.9.10", "eslint-plugin-prettier": "^3.4.0", diff --git a/src/client/LodestoneClient.ts b/src/client/LodestoneClient.ts index 675289e..0c1700d 100644 --- a/src/client/LodestoneClient.ts +++ b/src/client/LodestoneClient.ts @@ -38,7 +38,7 @@ export type OnSuccessFunction = (id: number, character?: Character) => void export type OnErrorFunction = (id: number, error: Error) => void /** - * Client for interfacing with the Final Fantasy XIV Lodestone + * Client for interfacing with the Final Fantasy XIV Lodestone. */ export default class LodestoneClient { /** @@ -50,7 +50,7 @@ export default class LodestoneClient { cheerioInstance: CheerioAPI - constructor(axiosInstance?: AxiosInstance, cheerioInstance?: CheerioAPI) { + public constructor(axiosInstance?: AxiosInstance, cheerioInstance?: CheerioAPI) { this.axiosInstance = axiosInstance || Axios.create({ diff --git a/src/config/DomConfig.ts b/src/config/DomConfig.ts index d06c810..9063343 100644 --- a/src/config/DomConfig.ts +++ b/src/config/DomConfig.ts @@ -45,7 +45,7 @@ export default class DomConfig { useHtml: true, transformationFunction: (value: string) => value.split('
')[1].split('/')[0].trim(), }, - realm: { + homeWorld: { selector: '#character > div.frame__chara.js__toggle_wrapper > a > div.frame__chara__box > p.frame__chara__world', transformationFunction: (value: string) => value.split('(')[0].trim(), diff --git a/src/entity/Character.ts b/src/entity/Character.ts index f1497e2..7004de2 100644 --- a/src/entity/Character.ts +++ b/src/entity/Character.ts @@ -36,7 +36,7 @@ import Level from './Level' export default class Character implements ICharacter { constructor(readonly id: number, readonly name: string) {} - server?: string + homeWorld?: string dataCenter?: string diff --git a/src/entity/__tests__/resources/27218992.html b/src/entity/__tests__/resources/27218992.html index 433a617..29fb337 100644 --- a/src/entity/__tests__/resources/27218992.html +++ b/src/entity/__tests__/resources/27218992.html @@ -1261,1343 +1261,6 @@

Frontline Standings

- - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Shamir Kotomine | FINAL FANTASY XIV, The Lodestone - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - -
- - -
- - - - - - -
- - - -
- -
- - - - - - - - - - - - - - - - - - - - -
- - - - -

Character

- - - - - - - -
- -
- - - -
-

Character

- - - -
- -
- -
-
-

Outlander

-

Shamir Kotomine

- -

Cerberus (Chaos)

-
-
-
- - - - -
- -
- -

You have no connection with this character.

- - - - - -
Follower Requests
-

Before this character can be followed, you must first submit a follower request.
Do you wish to proceed?

- - - - -
- -
- - - - - - -
- - -

Profile

Display Attributes

Race/Clan/Gender

Lalafell
Dunesfolk / ♀

Nameday

8th Sun of the 1st Astral Moon

Guardian

Halone, the Fury

City-state

Limsa Lominsa

Grand Company

Maelstrom / Storm Corporal

Free Company

Archadian Moogles

Attributes

Strength3117
Dexterity282
Vitality3557
Intelligence179
Mind299

Offensive Properties

Critical Hit Rate1549
Determination1418
Direct Hit Rate365

Defensive Properties

Defense5790
Magic Defense5790

Physical Properties

Attack Power3117
Skill Speed1284

Mental Properties

Attack Magic Potency179
Healing Magic Potency299
Spell Speed365

Role

Tenacity1460
Piety296

LEVEL 71

  • 71
  • 80
  • 72
  • 80
  • -
  • 80
  • -
  • 80
  • 80
  • 80
  • 80
  • -
  • -
  • -
  • -
  • 80
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • -
  • HP

    77788
  • MP

    10000

Character Profile

fflogs-pqtaA4nVJXF12fxDkvTH3zPmLWQGwZhM

- - -
- - -
- - - - - - - -
- -
-
-
- -
- - - - -
- ForumsMog StationOfficial Blog -
- - - - - - - - - - - - - - - - - - - - - -
- - - -
- - - -
- - - -
- - - -
- - - -
- - - -
- - - -
- - - - -
- - - - - - - - - -
- - - -
- - - - - - -
- - - -
-

Community Wall

- -
-
-

Recent Activity

- -
-

- Filter which items are to be displayed below.
- - * Notifications for standings updates are shared across all Worlds.
- * Notifications for PvP team formations are shared for all languages.
- * Notifications for free company formations are shared for all languages. -
-

- - -
-
Sort by
Data Center / Home World
Primary language
Displaying
-
- - -
-
- - - - - -
- - - - - - - - - - - - - -
diff --git a/src/interface/ICharacter.ts b/src/interface/ICharacter.ts index 7c5a93e..17769ea 100644 --- a/src/interface/ICharacter.ts +++ b/src/interface/ICharacter.ts @@ -31,7 +31,7 @@ import IClassLevels from './IClassLevels' export default interface ICharacter extends IMappableCharacter { readonly name: string - readonly realm?: string + readonly homeWorld?: string readonly dataCenter?: string diff --git a/src/interface/IMappableCharacter.ts b/src/interface/IMappableCharacter.ts index 3aa8e3b..d025b88 100644 --- a/src/interface/IMappableCharacter.ts +++ b/src/interface/IMappableCharacter.ts @@ -31,7 +31,7 @@ import IClassLevels from './IClassLevels' export interface IMappableCharacter { readonly name: string - readonly realm?: string | IAttributeMapping + readonly homeWorld?: string | IAttributeMapping readonly dataCenter?: string | IAttributeMapping From fef0125d9e070b72618e53a25030a58d37adc286 Mon Sep 17 00:00:00 2001 From: Peter Reid Date: Sat, 4 Dec 2021 15:20:28 +0000 Subject: [PATCH 08/40] feat(character): add support for parsing Reaper and Sage levels and as active class fixes #19 --- .../classes/client_LodestoneClient.default.md | 4 +- src/config/ClassConfig.ts | 18 +- src/entity/Class.ts | 4 +- src/entity/__tests__/Character.test.ts | 122 +- src/entity/__tests__/resources/11886902.html | 244 ++- src/entity/__tests__/resources/18001255.html | 1311 +++++++++++++++++ src/entity/__tests__/resources/28309293.html | 1311 +++++++++++++++++ src/interface/IClassLevels.ts | 4 + 8 files changed, 2830 insertions(+), 188 deletions(-) create mode 100644 src/entity/__tests__/resources/18001255.html create mode 100644 src/entity/__tests__/resources/28309293.html diff --git a/docs/api/classes/client_LodestoneClient.default.md b/docs/api/classes/client_LodestoneClient.default.md index ca6799b..ca4e19d 100644 --- a/docs/api/classes/client_LodestoneClient.default.md +++ b/docs/api/classes/client_LodestoneClient.default.md @@ -29,7 +29,7 @@ Client for interfacing with the Final Fantasy XIV Lodestone. #### Defined in -[LodestoneClient.ts:53](https://github.com/XIVStats/lodestone/blob/f3bda9e/src/client/LodestoneClient.ts#L53) +[LodestoneClient.ts:53](https://github.com/XIVStats/lodestone/blob/c74514c/src/client/LodestoneClient.ts#L53) ## Properties @@ -43,4 +43,4 @@ An instance will be generated by default, but as a consumer you can provide your #### Defined in -[LodestoneClient.ts:49](https://github.com/XIVStats/lodestone/blob/f3bda9e/src/client/LodestoneClient.ts#L49) +[LodestoneClient.ts:49](https://github.com/XIVStats/lodestone/blob/c74514c/src/client/LodestoneClient.ts#L49) diff --git a/src/config/ClassConfig.ts b/src/config/ClassConfig.ts index 476a7b6..57f9fbc 100644 --- a/src/config/ClassConfig.ts +++ b/src/config/ClassConfig.ts @@ -65,11 +65,10 @@ export default class ClassConfig { className: Class.Astrologian, imagePath: 'lds/h/3/umwvB9TpD5eWyIdhVuksPuV__k.png', }, - // Sage - (Not enabling until Endwalker release) - // { - // className: Class.Sage, - // imagePath: 'XXXXXX' - // }, + { + className: Class.Sage, + imagePath: 'lds/h/u/0blXNf6dtQ7j1039qlIpMf8M1E.png', + }, // DPS { className: Class.Pugilist, // Monk @@ -135,11 +134,10 @@ export default class ClassConfig { className: Class.BlueMage, imagePath: 'lds/h/0/SsnnfFXS_AKGbrcBnIEA0J_jUk.png', }, - // Reaper - (Not enabling until Endwalker release) - // { - // className: Class.Reaper, - // imagePath: 'XXXXXX' - // }, + { + className: Class.Reaper, + imagePath: 'lds/h/H/ZEiwU3soVZIobM2RZSG8LnhYEY.png', + }, // DoH { className: Class.Carpenter, diff --git a/src/entity/Class.ts b/src/entity/Class.ts index cf2704d..38b05bb 100644 --- a/src/entity/Class.ts +++ b/src/entity/Class.ts @@ -33,7 +33,7 @@ const enum Class { Conjurer = 'White Mage / Conjurer', Scholar = 'Scholar', Astrologian = 'Astrologian', - // Sage = 'Sage', (Not enabling until Endwalker release) + Sage = 'Sage', // DPS Pugilist = 'Monk / Pugilist', Lancer = 'Dragoon / Lancer', @@ -46,7 +46,7 @@ const enum Class { Arcanist = 'Summoner / Arcanist', RedMage = 'Red Mage', BlueMage = 'Blue Mage (Limited Job)', - // Reaper = 'Reaper', (Not enabling until Endwalker release) + Reaper = 'Reaper', // DoH Carpenter = 'Carpenter', Blacksmith = 'Blacksmith', diff --git a/src/entity/__tests__/Character.test.ts b/src/entity/__tests__/Character.test.ts index 24a72a8..d7ae3e2 100644 --- a/src/entity/__tests__/Character.test.ts +++ b/src/entity/__tests__/Character.test.ts @@ -50,27 +50,27 @@ describe('Character', () => { gear: { arm: { category: GearCategory.Arm, - name: 'Weathered Tishtrya', - id: '000c99173df', - iLvl: 430, + name: 'Exarchic Cane', + id: '8aa1be1728a?hq=1', + iLvl: 510, }, head: { category: GearCategory.Head, - name: 'Ronkan Visor of Healing', - id: '71537a2985f', - iLvl: 440, + name: 'Exarchic Circlet of Healing', + id: '5fffa0cb64b?hq=1', + iLvl: 510, }, body: { category: GearCategory.Body, - name: 'Ronkan Robe of Healing', - id: 'ccc2a4ebfbd', - iLvl: 440, + name: 'Neo-Ishgardian Top of Healing', + id: '96e994d56ae', + iLvl: 480, }, hands: { category: GearCategory.Hands, - name: 'Ronkan Armguards of Healing', - id: '26c8e806fde', - iLvl: 440, + name: 'Neo-Ishgardian Gloves of Healing', + id: '41cccfe5212?hq=1', + iLvl: 480, }, waist: { category: GearCategory.Waist, @@ -80,39 +80,39 @@ describe('Character', () => { }, legs: { category: GearCategory.Legs, - name: 'Edengate Pantaloons of Healing', - id: '82d2ccf47ea', - iLvl: 450, + name: 'Exarchic Hose of Healing', + id: '8421f0db039?hq=1', + iLvl: 510, }, feet: { category: GearCategory.Feet, - name: 'Edengate Sandals of Healing', - id: '71d504e6cfe', - iLvl: 450, + name: 'Exarchic Shoes of Healing', + id: 'c31aef0901f?hq=1', + iLvl: 510, }, earrings: { category: GearCategory.Earrings, - name: 'Ronkan Earrings of Healing', - id: 'c3c1d1140d8', - iLvl: 440, + name: 'Crystarium Earrings of Healing', + id: 'e90fe40b436', + iLvl: 490, }, necklace: { category: GearCategory.Necklace, - name: 'Edengate Choker of Healing', - id: 'dcacaad338a', - iLvl: 450, + name: 'Neo-Ishgardian Choker of Healing', + id: 'e129bc8a2e4', + iLvl: 480, }, bracelets: { category: GearCategory.Bracelets, - name: 'Ronkan Bracelets of Healing', - id: 'c4da6050bab', - iLvl: 440, + name: 'Neo-Ishgardian Wristbands of Healing', + id: '2a6a86be422?hq=1', + iLvl: 480, }, ringOne: { category: GearCategory.Ring, - name: 'Edengate Ring of Healing', - id: 'f38b0ba900a', - iLvl: 450, + name: 'Exarchic Ring of Healing', + id: '54b8ff24b67?hq=1', + iLvl: 510, }, ringTwo: { category: GearCategory.Ring, @@ -149,6 +149,10 @@ describe('Character', () => { class: Class.Conjurer, level: 80, }, + sage: { + class: Class.Sage, + level: 0, + }, scholar: { class: Class.Scholar, level: 71, @@ -173,6 +177,10 @@ describe('Character', () => { class: Class.Samurai, level: 55, }, + reaper: { + class: Class.Reaper, + level: 0, + }, bardArcher: { class: Class.Archer, level: 15, @@ -187,7 +195,7 @@ describe('Character', () => { }, blackMageThaumaturge: { class: Class.Thaumaturge, - level: 74, + level: 77, }, summonerArcanist: { class: Class.Arcanist, @@ -291,6 +299,56 @@ describe('Character', () => { race: 'Lalafell', } + // Character with Sage active + const expectedCharacterFour: Character = { + id: 11886902, + name: 'Sey Moore', + activeClass: Class.Sage, + cityState: 'Gridania', + clan: 'Dunesfolk', + homeWorld: 'Cerberus', + title: 'Monster Hunter', + dataCenter: 'Chaos', + freeCompany: 'Cerberus (Chaos)', + gender: 'Male', + grandCompany: 'Order of the Twin Adder', + grandCompanyRank: 'Serpent Captain', + guardian: 'Rhalgr, the Destroyer', + nameDay: '6th Sun of the 6th Astral Moon', + race: 'Lalafell', + classes: { + sage: { + class: Class.Sage, + level: 76, + }, + }, + } + + // Character with reaper active + const expectedCharacterFive: Character = { + id: 11886902, + name: 'Refler Desu', + activeClass: Class.Reaper, + cityState: "Ul'dah", + clan: 'Xaela', + homeWorld: 'Cerberus', + title: 'The Liberator', + dataCenter: 'Chaos', + freeCompany: 'Cerberus (Chaos)', + gender: 'Female', + grandCompany: 'Maelstrom', + grandCompanyRank: 'Second Storm Lieutenant', + guardian: 'Azeyma, the Warden', + nameDay: '7th Sun of the 1st Astral Moon', + race: 'Au Ra', + classes: { + reaper: { + class: Class.Reaper, + level: 80, + }, + }, + } + // TODO: Test character with shield // TODO: test character with no free company @@ -298,6 +356,8 @@ describe('Character', () => { [11886902, "P'tajha Rihll", expectedCharacterOne], [38531003, 'Aurora Nyxx', expectedCharacterTwo], [27218992, 'Shamir Kotmine', expectedCharacterThree], + [18001255, 'Sey Moore', expectedCharacterFour], + [28309293, 'Refler Desu', expectedCharacterFive], ])('for character %s - %s', (charId, name, expected) => { let resultantCharacter: Character const nonObjectAttributes = Object.entries(expected).filter((pair) => typeof pair[1] !== 'object') diff --git a/src/entity/__tests__/resources/11886902.html b/src/entity/__tests__/resources/11886902.html index 1f6316d..0583637 100644 --- a/src/entity/__tests__/resources/11886902.html +++ b/src/entity/__tests__/resources/11886902.html @@ -22,22 +22,21 @@ ~ SOFTWARE. ~ --> - P'tajha Rihll | FINAL FANTASY XIV, The Lodestone - + @@ -63,23 +62,23 @@ - + - + - @@ -111,6 +110,7 @@ + @@ -122,7 +122,7 @@ - + @@ -162,16 +162,18 @@ var api_uri = '/lodestone/api/'; var static_uri = 'https://img.finalfantasyxiv.com/lds/'; var subdomain = 'eu'; - var csrf_token = 'b26bc24f1f24c965303c59b97d7b35da6dcf2931'; + var csrf_token = 'e757939cc1ada7d5ee307a218a7d4d57a3f247fe'; var cis_origin = 'https://secure.square\u002denix.com'; var ldst_max_image_size = 31457280; var eorzeadb = { cdn_prefix: 'https://img.finalfantasyxiv.com/lds/', - version: '1626758274', + version: '1638499486', version_js_uri: 'https://img.finalfantasyxiv.com/lds/pc/global/js/eorzeadb/version.js', dynamic_tooltip: false }; var cookie_suffix = ''; + var ldst_is_loggedin = false; + var show_achievement = false; @@ -188,7 +190,7 @@ + height="0" width="0" style="display:none;visibility:hidden"> @@ -255,11 +257,11 @@