@rhyster/wow-casc-dbc 2.1.1 → 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
@@ -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
@@ -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.1",
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",