clashofclans.js 3.3.24-dev.a67ca30 → 3.3.24
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/CHANGELOG.md +173 -0
- package/dist/util/Util.d.ts +0 -13
- package/dist/util/Util.js +0 -30
- package/package.json +2 -2
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
|
+
|
|
5
|
+
## 3.1.3 (24-12-2023)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
- Town Hall 16 updates.
|
|
10
|
+
- Removed deprecated builder base properties.
|
|
11
|
+
|
|
12
|
+
## 3.1.3 (13-08-2023)
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
- Switched to `undici` from `node-fetch` for better performance.
|
|
17
|
+
|
|
18
|
+
## 3.1.0 (2023-07-28)
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
- Builder base update and new troop levels.
|
|
23
|
+
|
|
24
|
+
## 3.0.2 (2023-01-15)
|
|
25
|
+
|
|
26
|
+
### Bug Fixes
|
|
27
|
+
|
|
28
|
+
- Conflict with the same name of builder base and home base troops. (#123)
|
|
29
|
+
- Fix the issue with the `Client#getLeagueWar()` method.
|
|
30
|
+
- Typings and documentation for clan capital.
|
|
31
|
+
- Fix the issue with the `Clan#clanCapital` property.
|
|
32
|
+
|
|
33
|
+
### Features
|
|
34
|
+
|
|
35
|
+
- Added `Client#getCapitalRaidSeasons()` method.
|
|
36
|
+
- Added `Client#getCapitalLeagues()` method.
|
|
37
|
+
- Added `Client#getClanCapitalRanks()` method.
|
|
38
|
+
- Added new Super Troops in raw.json file.
|
|
39
|
+
|
|
40
|
+
### Breaking Changes
|
|
41
|
+
|
|
42
|
+
- Using PascalCase instead of SCREAMING_SNAKE_CASE ([#115](https://github.com/clashperk/clashofclans.js/pull/115))
|
|
43
|
+
- `Client#events` and `EventManager` have been removed in favor of `PollingClient` ([#117](https://github.com/clashperk/clashofclans.js/pull/117), [#127](https://github.com/clashperk/clashofclans.js/pull/127))
|
|
44
|
+
|
|
45
|
+
## 2.8.0 (2022-07-22)
|
|
46
|
+
|
|
47
|
+
### Features
|
|
48
|
+
|
|
49
|
+
- Better Throttler with JS generator function. ([#111](https://github.com/clashperk/clashofclans.js/pull/111))
|
|
50
|
+
- Updated raw data from game files. ([#111](https://github.com/clashperk/clashofclans.js/pull/111))
|
|
51
|
+
- New method Util#parseArmyLink has been added. ([#110](https://github.com/clashperk/clashofclans.js/pull/110))
|
|
52
|
+
|
|
53
|
+
## 2.7.0 (2022-05-22)
|
|
54
|
+
|
|
55
|
+
### Features
|
|
56
|
+
|
|
57
|
+
- Some useful QOL methods have been added. ([#106](https://github.com/clashperk/clashofclans.js/pull/106))
|
|
58
|
+
|
|
59
|
+
## 2.6.1 (2022-02-03)
|
|
60
|
+
|
|
61
|
+
### Bug Fixes
|
|
62
|
+
|
|
63
|
+
- New value and typings `notInWar` added for `ClanWarLeagueGroup#state` ([#101](https://github.com/clashperk/clashofclans.js/pull/101))
|
|
64
|
+
- Throw error if `Util.formatTag` / `Util.parseTag` is called with invalid argument ([#102](https://github.com/clashperk/clashofclans.js/pull/101))
|
|
65
|
+
|
|
66
|
+
## 2.6.0 (2022-01-29)
|
|
67
|
+
|
|
68
|
+
## Features
|
|
69
|
+
|
|
70
|
+
- Replaced Keyv with customizable cache store ([#99](https://github.com/clashperk/clashofclans.js/pull/99))
|
|
71
|
+
- Guide for [Internal Caching](https://clashofclans.js.org/guide/internal-caching)
|
|
72
|
+
|
|
73
|
+
## 2.5.2 (2022-01-23)
|
|
74
|
+
|
|
75
|
+
### Bug Fixes
|
|
76
|
+
|
|
77
|
+
- Fix `ClanWar#attacksPerMembers` property ([#97](https://github.com/clashperk/clashofclans.js/pull/97))
|
|
78
|
+
- Bump `node-fetch` from 2.6.6 to 2.6.7 ([#96](https://github.com/clashperk/clashofclans.js/pull/96))
|
|
79
|
+
|
|
80
|
+
## 2.5.1 (2022-01-11)
|
|
81
|
+
|
|
82
|
+
### Bug Fixes
|
|
83
|
+
|
|
84
|
+
- Typings for `ClanWarLeagueGroup#state` property. ([#94](https://github.com/clashperk/clashofclans.js/pull/94))
|
|
85
|
+
|
|
86
|
+
## 2.5.0 (2021-12-30)
|
|
87
|
+
|
|
88
|
+
### Bug Fixes
|
|
89
|
+
|
|
90
|
+
- Fix caching issue with unnecessary/invalid query params. ([#91](https://github.com/clashperk/clashofclans.js/pull/91))
|
|
91
|
+
- Added necessary methods to `RESTManager` class. ([#92](https://github.com/clashperk/clashofclans.js/pull/92))
|
|
92
|
+
|
|
93
|
+
## 2.4.0 (2021-12-28)
|
|
94
|
+
|
|
95
|
+
### Features
|
|
96
|
+
|
|
97
|
+
- `ClanWar#getClanWarLeagueGroup`, `ClanWar#isCWL` and `ClanWar#isFriendly` are now available. ([#87](https://github.com/clashperk/clashofclans.js/pull/87))
|
|
98
|
+
- `RESTOptions#rejectIfNotValid` added to perform `res.ok` operations over `RESTManager` methods. [Know more?](https://clashofclans.js.org/guide/access-raw-data#easy-access) ([#87](https://github.com/clashperk/clashofclans.js/pull/87))
|
|
99
|
+
- `Icon#fileName` and `Icon#sizes` are now available in `Icon` class. ([#87](https://github.com/clashperk/clashofclans.js/pull/87))
|
|
100
|
+
- `Badge#fileName` and `Badge#sizes` are now available in `Badge` class. ([#87](https://github.com/clashperk/clashofclans.js/pull/87))
|
|
101
|
+
|
|
102
|
+
### Deprecations
|
|
103
|
+
|
|
104
|
+
- `ClanWarMember#previousBestOpponentAttack` has been deprecated. Use `ClanWarAttack#previousBestAttack` instead. ([#87](https://github.com/clashperk/clashofclans.js/pull/87))
|
|
105
|
+
|
|
106
|
+
## 2.3.0 (2021-12-17)
|
|
107
|
+
|
|
108
|
+
### Features
|
|
109
|
+
|
|
110
|
+
- BigInt literals issue fixed. ([#84](https://github.com/clashperk/clashofclans.js/pull/84))
|
|
111
|
+
- Some Utility methods renamed. ([#84](https://github.com/clashperk/clashofclans.js/pull/84))
|
|
112
|
+
- `Util.encodeTag()` to `Util.encodeURI()`
|
|
113
|
+
- `Util.encodeTagToId()` to `Util.encodeTag()`
|
|
114
|
+
- `Util.decodeIdToTag()` to `Util.decodeTag()`
|
|
115
|
+
- Added `dps`, `resourceType`, `trainingTime` and `regenerationTime` to the `Unit` class. ([#85](https://github.com/clashperk/clashofclans.js/pull/85))
|
|
116
|
+
|
|
117
|
+
## 2.2.0 (2021-12-16)
|
|
118
|
+
|
|
119
|
+
### Bug Fixes
|
|
120
|
+
|
|
121
|
+
- Show units as per in-game orders. ([#82](https://github.com/clashperk/clashofclans.js/pull/82)) ([6e23d2f](https://github.com/clashperk/clashofclans.js/commit/95cf3001059fd3ede9262e249814178631660d5b))
|
|
122
|
+
- Season end time utility method. ([#82](https://github.com/clashperk/clashofclans.js/pull/82)) ([6e23d2f](https://github.com/clashperk/clashofclans.js/commit/95cf3001059fd3ede9262e249814178631660d5b))
|
|
123
|
+
- Updated raw files for new Troops. ([#82](https://github.com/clashperk/clashofclans.js/pull/82)) ([6e23d2f](https://github.com/clashperk/clashofclans.js/commit/95cf3001059fd3ede9262e249814178631660d5b))
|
|
124
|
+
|
|
125
|
+
### Features
|
|
126
|
+
|
|
127
|
+
- Added `seasonal`, `boostable` and `isLoaded` property to `Unit` class. ([#82](https://github.com/clashperk/clashofclans.js/pull/82)) ([6e23d2f](https://github.com/clashperk/clashofclans.js/commit/95cf3001059fd3ede9262e249814178631660d5b))
|
|
128
|
+
|
|
129
|
+
## 2.1.0 (2021-12-06)
|
|
130
|
+
|
|
131
|
+
### Bug Fixes
|
|
132
|
+
|
|
133
|
+
- Consistency of `ClanWar.attacksPerMember` property. ([#75](https://github.com/clashperk/clashofclans.js/pull/75)) ([6e23d2f](https://github.com/clashperk/clashofclans.js/commit/6e23d2fe0373f56268ffa55d5ac2807c9a2dc2fc))
|
|
134
|
+
|
|
135
|
+
### Features
|
|
136
|
+
|
|
137
|
+
- More utility methods added to `Util` class. ([#76](https://github.com/clashperk/clashofclans.js/pull/76)) ([ff41115](https://github.com/clashperk/clashofclans.js/commit/ff4111530d6293ef1fc54aa916436130fc30a09c))
|
|
138
|
+
|
|
139
|
+
- `Util.formatTag(tag: string): string`
|
|
140
|
+
- `Util.formatDate(date: string): Date`
|
|
141
|
+
- `Util.isValidTag(tag: string): boolean`
|
|
142
|
+
- `Util.encodeTagToId(tag: string): string` (Removed on 2.3.0)
|
|
143
|
+
- `Util.decodeIdToTag(id: string): string` (Removed on 2.3.0)
|
|
144
|
+
|
|
145
|
+
- Support of async/await for custom events ([#79](https://github.com/clashperk/clashofclans.js/pull/79)) ([ff41115](https://github.com/clashperk/clashofclans.js/commit/a23db3786bcca44b8547c70f27773bdb1216f990))
|
|
146
|
+
|
|
147
|
+
## 2.0.2 (2021-11-30)
|
|
148
|
+
|
|
149
|
+
### Bug Fixes
|
|
150
|
+
|
|
151
|
+
- Return `null` for `RankedPlayer.clan` if they are not in the clan. ([#73](https://github.com/clashperk/clashofclans.js/pull/73)) ([ba82327](https://github.com/clashperk/clashofclans.js/commit/ba8232740f4ca9af2bcc7971aca3574612ef25b6))
|
|
152
|
+
- `OverrideOptions` added for `Client#getClans` and `RESTManager#getClans` ([#73](https://github.com/clashperk/clashofclans.js/pull/73)) ([ba82327](https://github.com/clashperk/clashofclans.js/commit/ba8232740f4ca9af2bcc7971aca3574612ef25b6))
|
|
153
|
+
- `SeasonRankedPlayer` class for legend league ranking. ([#73](https://github.com/clashperk/clashofclans.js/pull/73)) ([ba82327](https://github.com/clashperk/clashofclans.js/commit/ba8232740f4ca9af2bcc7971aca3574612ef25b6))
|
|
154
|
+
|
|
155
|
+
## 2.0.1 (2021-11-27)
|
|
156
|
+
|
|
157
|
+
### Bug Fixes
|
|
158
|
+
|
|
159
|
+
- IP retrieval method and Event Loop ([#70](https://github.com/clashperk/clashofclans.js/issues/70)) ([82b84ba](https://github.com/clashperk/clashofclans.js/commit/82b84ba5d96505c43b75e53aa07f547ef0b77778))
|
|
160
|
+
|
|
161
|
+
## 2.0.0 (2021-11-26)
|
|
162
|
+
|
|
163
|
+
This new version is a complete TypeScript rewrite to convert everything from plain (literal JSON) objects to class (constructor) objects and support a lot more features.
|
|
164
|
+
|
|
165
|
+
### Features
|
|
166
|
+
|
|
167
|
+
- HTTP Request Request Retries ([#26](https://github.com/clashperk/clashofclans.js/issues/26)) ([94585f3](https://github.com/clashperk/clashofclans.js/commit/94585f3a84a7175b2d07872f9eb9e42372b95e12))
|
|
168
|
+
- Event Manager and Custom Events ([#37](https://github.com/clashperk/clashofclans.js/issues/37)) ([5027ae6](https://github.com/clashperk/clashofclans.js/commit/5027ae663a8e07175e17384c7e5706f4a1a7afb4))
|
|
169
|
+
- Email Password Login ([#31](https://github.com/clashperk/clashofclans.js/issues/31)) ([4153cd3](https://github.com/clashperk/clashofclans.js/commit/4153cd37ea0e1c71550b9e892105b84d5a407e23))
|
|
170
|
+
- Queue Throttler and Batch Throttler ([#34](https://github.com/clashperk/clashofclans.js/issues/34)) ([3a8f051](https://github.com/clashperk/clashofclans.js/commit/3a8f051552e93b98f89bc7d524acdecddf242718))
|
|
171
|
+
- Override Request Options ([#36](https://github.com/clashperk/clashofclans.js/issues/36)) ([42d7fdd](https://github.com/clashperk/clashofclans.js/commit/42d7fdd36262cc46f23b731f8cffb9daea19d3b0))
|
|
172
|
+
- Internal Caching Options ([#53](https://github.com/clashperk/clashofclans.js/issues/53)) ([984451d](https://github.com/clashperk/clashofclans.js/commit/30ea3240c11866008d0dae514468c0fdbb34ffd0))
|
|
173
|
+
- Additional Properties for Player Units ([#65](https://github.com/clashperk/clashofclans.js/pull/65)) ([aa1696](https://github.com/clashperk/clashofclans.js/commit/aa1696243d96d4fed0250b4282c60522a6482343))
|
package/dist/util/Util.d.ts
CHANGED
|
@@ -48,17 +48,4 @@ export declare class Util extends null {
|
|
|
48
48
|
};
|
|
49
49
|
static allSettled<T>(values: Promise<T>[]): Promise<T[]>;
|
|
50
50
|
static delay(ms: number): Promise<unknown>;
|
|
51
|
-
/** Parse in-game army link into troops and spells count with respective Id's. */
|
|
52
|
-
static parseArmyLink(link: string): {
|
|
53
|
-
units: {
|
|
54
|
-
name: string | null;
|
|
55
|
-
count: number;
|
|
56
|
-
id: number;
|
|
57
|
-
}[];
|
|
58
|
-
spells: {
|
|
59
|
-
name: string | null;
|
|
60
|
-
count: number;
|
|
61
|
-
id: number;
|
|
62
|
-
}[];
|
|
63
|
-
};
|
|
64
51
|
}
|
package/dist/util/Util.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Util = exports.timeoutSignal = void 0;
|
|
4
|
-
const Constants_1 = require("../util/Constants");
|
|
5
4
|
const TAG_CHARACTERS = '0289PYLQGRJCUV';
|
|
6
5
|
const params = [
|
|
7
6
|
'name',
|
|
@@ -142,34 +141,5 @@ class Util extends null {
|
|
|
142
141
|
static async delay(ms) {
|
|
143
142
|
return new Promise((res) => setTimeout(res, ms));
|
|
144
143
|
}
|
|
145
|
-
/** Parse in-game army link into troops and spells count with respective Id's. */
|
|
146
|
-
static parseArmyLink(link) {
|
|
147
|
-
const unitsMatches = /u(?<units>[\d+x-]+)/.exec(link);
|
|
148
|
-
const spellsMatches = /s(?<spells>[\d+x-]+)/.exec(link);
|
|
149
|
-
const unitsPart = unitsMatches?.groups?.units?.split('-') ?? [];
|
|
150
|
-
const spellParts = spellsMatches?.groups?.spells?.split('-') ?? [];
|
|
151
|
-
const units = unitsPart
|
|
152
|
-
.map((parts) => parts.split(/x/))
|
|
153
|
-
.map((parts) => ({
|
|
154
|
-
id: Number(parts[1]),
|
|
155
|
-
total: Number(parts[0])
|
|
156
|
-
}));
|
|
157
|
-
const spells = spellParts
|
|
158
|
-
.map((parts) => parts.split(/x/))
|
|
159
|
-
.map((parts) => ({
|
|
160
|
-
id: Number(parts[1]),
|
|
161
|
-
total: Number(parts[0])
|
|
162
|
-
}));
|
|
163
|
-
return {
|
|
164
|
-
units: units.map((unit) => {
|
|
165
|
-
const _unit = Constants_1.RawData.RawUnits.find((raw) => raw.category === 'troop' && raw.id === unit.id);
|
|
166
|
-
return { name: _unit?.name ?? null, count: unit.total, id: unit.id };
|
|
167
|
-
}),
|
|
168
|
-
spells: spells.map((spell) => {
|
|
169
|
-
const _spell = Constants_1.RawData.RawUnits.find((raw) => raw.category === 'spell' && raw.id === spell.id);
|
|
170
|
-
return { name: _spell?.name ?? null, count: spell.total, id: spell.id };
|
|
171
|
-
})
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
144
|
}
|
|
175
145
|
exports.Util = Util;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clashofclans.js",
|
|
3
|
-
"version": "3.3.24
|
|
3
|
+
"version": "3.3.24",
|
|
4
4
|
"description": "JavaScript library for interacting with the Clash of Clans API",
|
|
5
5
|
"author": "https://clashofclans.js.org",
|
|
6
6
|
"license": "MIT",
|
|
@@ -73,4 +73,4 @@
|
|
|
73
73
|
"engines": {
|
|
74
74
|
"node": ">=18.x"
|
|
75
75
|
}
|
|
76
|
-
}
|
|
76
|
+
}
|