@rhyster/wow-casc-dbc 2.1.0 → 2.2.0

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/dist/index.cjs CHANGED
@@ -1541,7 +1541,7 @@ class CASCClient {
1541
1541
  };
1542
1542
  }
1543
1543
  async loadRemoteListFile() {
1544
- const url = "https://github.com/wowdev/wow-listfile/releases/download/202402031841/community-listfile.csv";
1544
+ const url = "https://github.com/wowdev/wow-listfile/releases/latest/download/community-listfile.csv";
1545
1545
  const text = await (await fetch(url)).text();
1546
1546
  const lines = text.split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
1547
1547
  lines.forEach((line) => {
@@ -1593,7 +1593,7 @@ class CASCClient {
1593
1593
  const { rootFile } = this.preload;
1594
1594
  const { nameHash2FileDataID } = rootFile;
1595
1595
  const nameHash = getNameHash(name);
1596
- return nameHash2FileDataID.get(nameHash) ?? this.name2FileDataID.get(name);
1596
+ return nameHash2FileDataID.get(nameHash) ?? this.name2FileDataID.get(name.toLowerCase());
1597
1597
  }
1598
1598
  getContentKeysByFileDataID(fileDataID) {
1599
1599
  assert__default(this.preload, "Client not initialized");
@@ -1687,6 +1687,7 @@ class DBDParser {
1687
1687
  __publicField(this, "wdc");
1688
1688
  __publicField(this, "definitions", /* @__PURE__ */ new Map());
1689
1689
  __publicField(this, "columns", []);
1690
+ __publicField(this, "cache", /* @__PURE__ */ new Map());
1690
1691
  this.wdc = wdc;
1691
1692
  }
1692
1693
  async init() {
@@ -1761,6 +1762,9 @@ class DBDParser {
1761
1762
  return this.wdc.getAllIDs();
1762
1763
  }
1763
1764
  getRowData(id) {
1765
+ if (this.cache.has(id)) {
1766
+ return structuredClone(this.cache.get(id));
1767
+ }
1764
1768
  const row = this.wdc.getRowData(id);
1765
1769
  if (!row) {
1766
1770
  return void 0;
@@ -1890,7 +1894,8 @@ class DBDParser {
1890
1894
  }
1891
1895
  });
1892
1896
  }
1893
- return data;
1897
+ this.cache.set(id, data);
1898
+ return structuredClone(data);
1894
1899
  }
1895
1900
  }
1896
1901
 
package/dist/index.d.cts CHANGED
@@ -224,6 +224,7 @@ declare class DBDParser {
224
224
  readonly wdc: WDCReader;
225
225
  readonly definitions: Map<string, string>;
226
226
  columns: Column[];
227
+ private cache;
227
228
  private constructor();
228
229
  private init;
229
230
  static parse(wdc: WDCReader): Promise<DBDParser>;
package/dist/index.d.mts CHANGED
@@ -224,6 +224,7 @@ declare class DBDParser {
224
224
  readonly wdc: WDCReader;
225
225
  readonly definitions: Map<string, string>;
226
226
  columns: Column[];
227
+ private cache;
227
228
  private constructor();
228
229
  private init;
229
230
  static parse(wdc: WDCReader): Promise<DBDParser>;
package/dist/index.d.ts CHANGED
@@ -224,6 +224,7 @@ declare class DBDParser {
224
224
  readonly wdc: WDCReader;
225
225
  readonly definitions: Map<string, string>;
226
226
  columns: Column[];
227
+ private cache;
227
228
  private constructor();
228
229
  private init;
229
230
  static parse(wdc: WDCReader): Promise<DBDParser>;
package/dist/index.mjs CHANGED
@@ -1529,7 +1529,7 @@ class CASCClient {
1529
1529
  };
1530
1530
  }
1531
1531
  async loadRemoteListFile() {
1532
- const url = "https://github.com/wowdev/wow-listfile/releases/download/202402031841/community-listfile.csv";
1532
+ const url = "https://github.com/wowdev/wow-listfile/releases/latest/download/community-listfile.csv";
1533
1533
  const text = await (await fetch(url)).text();
1534
1534
  const lines = text.split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
1535
1535
  lines.forEach((line) => {
@@ -1581,7 +1581,7 @@ class CASCClient {
1581
1581
  const { rootFile } = this.preload;
1582
1582
  const { nameHash2FileDataID } = rootFile;
1583
1583
  const nameHash = getNameHash(name);
1584
- return nameHash2FileDataID.get(nameHash) ?? this.name2FileDataID.get(name);
1584
+ return nameHash2FileDataID.get(nameHash) ?? this.name2FileDataID.get(name.toLowerCase());
1585
1585
  }
1586
1586
  getContentKeysByFileDataID(fileDataID) {
1587
1587
  assert(this.preload, "Client not initialized");
@@ -1675,6 +1675,7 @@ class DBDParser {
1675
1675
  __publicField(this, "wdc");
1676
1676
  __publicField(this, "definitions", /* @__PURE__ */ new Map());
1677
1677
  __publicField(this, "columns", []);
1678
+ __publicField(this, "cache", /* @__PURE__ */ new Map());
1678
1679
  this.wdc = wdc;
1679
1680
  }
1680
1681
  async init() {
@@ -1749,6 +1750,9 @@ class DBDParser {
1749
1750
  return this.wdc.getAllIDs();
1750
1751
  }
1751
1752
  getRowData(id) {
1753
+ if (this.cache.has(id)) {
1754
+ return structuredClone(this.cache.get(id));
1755
+ }
1752
1756
  const row = this.wdc.getRowData(id);
1753
1757
  if (!row) {
1754
1758
  return void 0;
@@ -1878,7 +1882,8 @@ class DBDParser {
1878
1882
  }
1879
1883
  });
1880
1884
  }
1881
- return data;
1885
+ this.cache.set(id, data);
1886
+ return structuredClone(data);
1882
1887
  }
1883
1888
  }
1884
1889
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rhyster/wow-casc-dbc",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "description": "Fetch World of Warcraft data files from CASC and parse DBC/DB2 files.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -40,7 +40,7 @@
40
40
  "@types/async": "^3.2.24",
41
41
  "@types/cli-progress": "^3.11.5",
42
42
  "@types/jest": "^29.5.12",
43
- "@types/node": "^20.11.30",
43
+ "@types/node": "^20.12.2",
44
44
  "@typescript-eslint/eslint-plugin": "^7.4.0",
45
45
  "@typescript-eslint/parser": "^7.4.0",
46
46
  "eslint": "^8.57.0",