@wfcd/relics 2.0.27 → 2.0.29

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 ADDED
@@ -0,0 +1,228 @@
1
+ ## [2.0.29](https://github.com/WFCD/warframe-relic-data/compare/v2.0.28...v2.0.29) (2026-02-23)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * pkg contents all dist ([#370](https://github.com/WFCD/warframe-relic-data/issues/370)) ([2217f4b](https://github.com/WFCD/warframe-relic-data/commit/2217f4b72b919d8cd9e57b88d9e7c4093d0cf550))
7
+
8
+ ## [2.0.28](https://github.com/WFCD/warframe-relic-data/compare/v2.0.27...v2.0.28) (2026-02-23)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **#367:** add .toLowerCase to prevent silent misses ([#369](https://github.com/WFCD/warframe-relic-data/issues/369)) ([3505aad](https://github.com/WFCD/warframe-relic-data/commit/3505aada799265b157542db46a9a18bcd300f2aa)), closes [#367](https://github.com/WFCD/warframe-relic-data/issues/367)
14
+
15
+ ## [2.0.27](https://github.com/WFCD/warframe-relic-data/compare/v2.0.26...v2.0.27) (2026-02-22)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * split configs, update to tsdown ([#368](https://github.com/WFCD/warframe-relic-data/issues/368)) ([ddf07bb](https://github.com/WFCD/warframe-relic-data/commit/ddf07bbb7b50d94b79307b7685324c7b7ca26ac4))
21
+
22
+ ## [2.0.26](https://github.com/WFCD/warframe-relic-data/compare/v2.0.25...v2.0.26) (2026-02-22)
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * **#361:** migrate to wfm v2 api ([#366](https://github.com/WFCD/warframe-relic-data/issues/366)) ([bf694b8](https://github.com/WFCD/warframe-relic-data/commit/bf694b859af1f18d6c0573681a8c05f4371ad5f8)), closes [#361](https://github.com/WFCD/warframe-relic-data/issues/361)
28
+
29
+ ## [2.0.25](https://github.com/WFCD/warframe-relic-data/compare/v2.0.24...v2.0.25) (2025-12-13)
30
+
31
+
32
+ ### Bug Fixes
33
+
34
+ * bump warframe-patchlogs from 2.127.0 to 2.148.0 ([#356](https://github.com/WFCD/warframe-relic-data/issues/356)) ([1b1b71c](https://github.com/WFCD/warframe-relic-data/commit/1b1b71c1fa442182559cd54206d30581d33d724b))
35
+
36
+ ## [2.0.24](https://github.com/WFCD/warframe-relic-data/compare/v2.0.23...v2.0.24) (2025-11-29)
37
+
38
+
39
+ ### Bug Fixes
40
+
41
+ * bump warframe-patchlogs from 2.88.0 to 2.88.2 ([#353](https://github.com/WFCD/warframe-relic-data/issues/353)) ([8e1396a](https://github.com/WFCD/warframe-relic-data/commit/8e1396a854095e791c5fe1d3d90072beba44b61e))
42
+
43
+ ## [2.0.23](https://github.com/WFCD/warframe-relic-data/compare/v2.0.22...v2.0.23) (2025-10-25)
44
+
45
+
46
+ ### Bug Fixes
47
+
48
+ * bump warframe-patchlogs from 2.81.0 to 2.86.0 ([#343](https://github.com/WFCD/warframe-relic-data/issues/343)) ([78c6387](https://github.com/WFCD/warframe-relic-data/commit/78c6387cd423273bd90e9c251170e2cf55d21310))
49
+
50
+ ## [2.0.22](https://github.com/WFCD/warframe-relic-data/compare/v2.0.21...v2.0.22) (2025-10-14)
51
+
52
+
53
+ ### Bug Fixes
54
+
55
+ * provenance & oidc ([#337](https://github.com/WFCD/warframe-relic-data/issues/337)) ([031e3b3](https://github.com/WFCD/warframe-relic-data/commit/031e3b319f7662f5c83121b6ec18e67fca268b51))
56
+
57
+ ## [2.0.21](https://github.com/WFCD/warframe-relic-data/compare/v2.0.20...v2.0.21) (2025-03-01)
58
+
59
+
60
+ ### Bug Fixes
61
+
62
+ * bump warframe-patchlogs from 2.61.0 to 2.71.0 ([#294](https://github.com/WFCD/warframe-relic-data/issues/294)) ([b4e2cf9](https://github.com/WFCD/warframe-relic-data/commit/b4e2cf9d1f43470b08629a4ff612bb41493c0a8f))
63
+
64
+ ## [2.0.20](https://github.com/WFCD/warframe-relic-data/compare/v2.0.19...v2.0.20) (2024-12-22)
65
+
66
+
67
+ ### Bug Fixes
68
+
69
+ * bump warframe-patchlogs from 2.52.0 to 2.55.0 ([#279](https://github.com/WFCD/warframe-relic-data/issues/279)) ([0689dc7](https://github.com/WFCD/warframe-relic-data/commit/0689dc7321aad0dd2389853b490430192976607c))
70
+
71
+ ## [2.0.19](https://github.com/WFCD/warframe-relic-data/compare/v2.0.18...v2.0.19) (2024-12-15)
72
+
73
+
74
+ ### Bug Fixes
75
+
76
+ * bump warframe-patchlogs from 2.51.0 to 2.52.0 ([#278](https://github.com/WFCD/warframe-relic-data/issues/278)) ([5a5a40c](https://github.com/WFCD/warframe-relic-data/commit/5a5a40ce80d35cb060102514badee366bda849e2))
77
+
78
+ ## [2.0.18](https://github.com/WFCD/warframe-relic-data/compare/v2.0.17...v2.0.18) (2024-10-19)
79
+
80
+
81
+ ### Bug Fixes
82
+
83
+ * bump warframe-patchlogs from 2.46.0 to 2.48.0 ([#260](https://github.com/WFCD/warframe-relic-data/issues/260)) ([4a44d46](https://github.com/WFCD/warframe-relic-data/commit/4a44d466023269aaa89cf2b9442913aabaf37d66))
84
+
85
+ ## [2.0.17](https://github.com/WFCD/warframe-relic-data/compare/v2.0.16...v2.0.17) (2024-10-15)
86
+
87
+
88
+ ### Bug Fixes
89
+
90
+ * bump warframe-patchlogs from 2.44.0 to 2.46.0 ([#256](https://github.com/WFCD/warframe-relic-data/issues/256)) ([7d97baf](https://github.com/WFCD/warframe-relic-data/commit/7d97baf50f771d76480904a03f0763a3a6ddfda4))
91
+
92
+ ## [2.0.16](https://github.com/WFCD/warframe-relic-data/compare/v2.0.15...v2.0.16) (2024-10-08)
93
+
94
+
95
+ ### Bug Fixes
96
+
97
+ * bump warframe-patchlogs from 2.41.0 to 2.44.0 ([#255](https://github.com/WFCD/warframe-relic-data/issues/255)) ([0ac9a2f](https://github.com/WFCD/warframe-relic-data/commit/0ac9a2f42043921acc4aaa269ba400505ef1cdb3))
98
+
99
+ ## [2.0.15](https://github.com/WFCD/warframe-relic-data/compare/v2.0.14...v2.0.15) (2024-08-24)
100
+
101
+
102
+ ### Bug Fixes
103
+
104
+ * bump warframe-patchlogs from 2.31.0 to 2.34.0 ([#241](https://github.com/WFCD/warframe-relic-data/issues/241)) ([889c218](https://github.com/WFCD/warframe-relic-data/commit/889c21848b4f3698329fb764841a7c1329393e46))
105
+
106
+ ## [2.0.14](https://github.com/WFCD/warframe-relic-data/compare/v2.0.13...v2.0.14) (2024-07-27)
107
+
108
+
109
+ ### Bug Fixes
110
+
111
+ * bump warframe-patchlogs from 2.27.0 to 2.31.0 ([#231](https://github.com/WFCD/warframe-relic-data/issues/231)) ([7e562b4](https://github.com/WFCD/warframe-relic-data/commit/7e562b42df5bf4522bd157cb0a2b989c89d90ed5))
112
+
113
+ ## [2.0.13](https://github.com/WFCD/warframe-relic-data/compare/v2.0.12...v2.0.13) (2024-06-30)
114
+
115
+
116
+ ### Bug Fixes
117
+
118
+ * **patchlogs:** Bump 2.26.0 to 2.27.0 ([#223](https://github.com/WFCD/warframe-relic-data/issues/223)) ([45ad0c6](https://github.com/WFCD/warframe-relic-data/commit/45ad0c693ec19fda26ae5279d382dbe986331c7a))
119
+
120
+ ## [2.0.12](https://github.com/WFCD/warframe-relic-data/compare/v2.0.11...v2.0.12) (2024-05-12)
121
+
122
+
123
+ ### Bug Fixes
124
+
125
+ * bump warframe-patchlogs from 2.16.0 to 2.17.0 ([#210](https://github.com/WFCD/warframe-relic-data/issues/210)) ([cb98746](https://github.com/WFCD/warframe-relic-data/commit/cb987465f5b48fbf9a359bcff3f6a50716f57c74))
126
+
127
+ ## [2.0.11](https://github.com/WFCD/warframe-relic-data/compare/v2.0.10...v2.0.11) (2024-05-04)
128
+
129
+
130
+ ### Bug Fixes
131
+
132
+ * **patchlogs:** bump warframe-patchlogs from 2.14.0 to 2.16.0 ([#207](https://github.com/WFCD/warframe-relic-data/issues/207)) ([03f0e92](https://github.com/WFCD/warframe-relic-data/commit/03f0e920d716912f8e3619aa04efc608e4605489))
133
+
134
+ ## [2.0.10](https://github.com/WFCD/warframe-relic-data/compare/v2.0.9...v2.0.10) (2024-02-18)
135
+
136
+
137
+ ### Bug Fixes
138
+
139
+ * **ci:** clean up peerdeps invoke ([1f48164](https://github.com/WFCD/warframe-relic-data/commit/1f48164342287b54d3babb21fef3ed41af31c519))
140
+
141
+ ## [2.0.9](https://github.com/WFCD/warframe-relic-data/compare/v2.0.8...v2.0.9) (2024-02-18)
142
+
143
+
144
+ ### Bug Fixes
145
+
146
+ * remove install-peerdeps from dev deps ([5a9af27](https://github.com/WFCD/warframe-relic-data/commit/5a9af27fdb0db96c5bcaf560e7c01ea8d8b5c442))
147
+
148
+ ## [2.0.8](https://github.com/WFCD/warframe-relic-data/compare/v2.0.7...v2.0.8) (2023-12-26)
149
+
150
+
151
+ ### Bug Fixes
152
+
153
+ * **patchlogs:** Bump 1.858.0 to 1.868.0 ([#163](https://github.com/WFCD/warframe-relic-data/issues/163)) ([cb3c3fa](https://github.com/WFCD/warframe-relic-data/commit/cb3c3fafd24495f5d3191d9b520467b423e740d1))
154
+
155
+ ## [2.0.7](https://github.com/WFCD/warframe-relic-data/compare/v2.0.6...v2.0.7) (2023-10-21)
156
+
157
+
158
+ ### Bug Fixes
159
+
160
+ * **patchlogs:** Bump 1.849.0 to 1.854.0 ([#141](https://github.com/WFCD/warframe-relic-data/issues/141)) ([eb98a32](https://github.com/WFCD/warframe-relic-data/commit/eb98a327a886e95ad7a207879cdd275cc39ae605))
161
+
162
+ ## [2.0.6](https://github.com/WFCD/warframe-relic-data/compare/v2.0.5...v2.0.6) (2023-09-17)
163
+
164
+
165
+ ### Bug Fixes
166
+
167
+ * **patchlogs:** Bump from 1.842.0 to 1.847.0 ([#127](https://github.com/WFCD/warframe-relic-data/issues/127)) ([e5f2cda](https://github.com/WFCD/warframe-relic-data/commit/e5f2cdadefd177459f347f55ed7b7bcbc9611c8d))
168
+
169
+ ## [2.0.5](https://github.com/WFCD/warframe-relic-data/compare/v2.0.4...v2.0.5) (2023-08-23)
170
+
171
+
172
+ ### Bug Fixes
173
+
174
+ * Bump warframe-patchlogs from 1.837.0 to 1.842.0 ([#114](https://github.com/WFCD/warframe-relic-data/issues/114)) ([2d47b39](https://github.com/WFCD/warframe-relic-data/commit/2d47b39e1bd890dd264db0c99f18a21a68f10c6a))
175
+
176
+ ## [2.0.4](https://github.com/WFCD/warframe-relic-data/compare/v2.0.3...v2.0.4) (2023-06-26)
177
+
178
+
179
+ ### Bug Fixes
180
+
181
+ * Bump warframe-patchlogs from 1.830.0 to 1.834.0 ([#95](https://github.com/WFCD/warframe-relic-data/issues/95)) ([65099d1](https://github.com/WFCD/warframe-relic-data/commit/65099d18734f6c5857e68fb132bb721f237faf84))
182
+
183
+ ## [2.0.3](https://github.com/WFCD/warframe-relic-data/compare/v2.0.2...v2.0.3) (2023-06-03)
184
+
185
+
186
+ ### Bug Fixes
187
+
188
+ * **patchlogs:** Bump warframe-patchlogs from 1.820.0 to 1.830.0 ([#92](https://github.com/WFCD/warframe-relic-data/issues/92)) ([016bd04](https://github.com/WFCD/warframe-relic-data/commit/016bd04db9b2536660df6b4f1760b001e3885422))
189
+
190
+ ## [2.0.2](https://github.com/WFCD/warframe-relic-data/compare/v2.0.1...v2.0.2) (2023-04-29)
191
+
192
+
193
+ ### Bug Fixes
194
+
195
+ * **patchlogs:** Bump warframe-patchlogs from 1.817.0 to 1.820.0 ([#80](https://github.com/WFCD/warframe-relic-data/issues/80)) ([0251d93](https://github.com/WFCD/warframe-relic-data/commit/0251d93b481c0b5633228b8daf6367a9aba149f4))
196
+
197
+ ## [2.0.1](https://github.com/WFCD/warframe-relic-data/compare/v2.0.0...v2.0.1) (2023-03-09)
198
+
199
+
200
+ ### Bug Fixes
201
+
202
+ * **patchlogs:** Bump warframe-patchlogs from 1.795.0 to 1.813.0 ([#63](https://github.com/WFCD/warframe-relic-data/issues/63)) ([aeac5e3](https://github.com/WFCD/warframe-relic-data/commit/aeac5e306cdff1359feb84affa92e936c7da72b2))
203
+
204
+ # [2.0.0](https://github.com/WFCD/warframe-relic-data/compare/v1.0.1...v2.0.0) (2022-10-28)
205
+
206
+
207
+ ### Features
208
+
209
+ * **build:** use the tsup to build the project ([#26](https://github.com/WFCD/warframe-relic-data/issues/26)) ([2f41119](https://github.com/WFCD/warframe-relic-data/commit/2f411194f16e237bd5f55dc582c389c34c86d0fd))
210
+
211
+
212
+ ### BREAKING CHANGES
213
+
214
+ * **build:** bundle files with tsup
215
+
216
+ ## [1.0.1](https://github.com/WFCD/warframe-relic-data/compare/v1.0.0...v1.0.1) (2022-10-12)
217
+
218
+
219
+ ### Performance Improvements
220
+
221
+ * Remove unused 'vaultDate' property ([#17](https://github.com/WFCD/warframe-relic-data/issues/17)) ([5b4d646](https://github.com/WFCD/warframe-relic-data/commit/5b4d646e5dfdc4367b10a008f1ecb045af285088))
222
+
223
+ # 1.0.0 (2022-09-28)
224
+
225
+
226
+ ### Features
227
+
228
+ * logger with level support ([14a81ee](https://github.com/WFCD/warframe-relic-data/commit/14a81eeea0fc8144ef76ec960c8d5e17762211b7))
package/dist/Build.cjs ADDED
@@ -0,0 +1,22 @@
1
+ const require_VersionManager = require('./VersionManager-DkHKfTUL.cjs');
2
+
3
+ //#region src/Build.ts
4
+ /**
5
+ * Entrypoint for the build process.
6
+ */
7
+ async function run() {
8
+ const generator = new require_VersionManager.Generator();
9
+ const versionManager = new require_VersionManager.VersionManager();
10
+ const date = Date.now();
11
+ require_VersionManager.Logger_default.log(`Starting build ${date}`);
12
+ if (await versionManager.updateNeeded()) {
13
+ require_VersionManager.Logger_default.log("Found update, starting generation");
14
+ await generator.generate();
15
+ await generator.writeData();
16
+ await versionManager.writeVersion(date);
17
+ } else require_VersionManager.Logger_default.log("No updates found !");
18
+ require_VersionManager.Logger_default.log("Build finished.");
19
+ }
20
+ run().catch(require_VersionManager.Logger_default.error.bind(require_VersionManager.Logger_default));
21
+
22
+ //#endregion
@@ -0,0 +1 @@
1
+ export { };
@@ -0,0 +1 @@
1
+ export { };
package/dist/Build.mjs ADDED
@@ -0,0 +1,24 @@
1
+ import { t as __name } from "./chunk-Dco9itRc.mjs";
2
+ import { n as Generator, r as Logger_default, t as VersionManager } from "./VersionManager-CGY3TWJF.mjs";
3
+
4
+ //#region src/Build.ts
5
+ /**
6
+ * Entrypoint for the build process.
7
+ */
8
+ async function run() {
9
+ const generator = new Generator();
10
+ const versionManager = new VersionManager();
11
+ const date = Date.now();
12
+ Logger_default.log(`Starting build ${date}`);
13
+ if (await versionManager.updateNeeded()) {
14
+ Logger_default.log("Found update, starting generation");
15
+ await generator.generate();
16
+ await generator.writeData();
17
+ await versionManager.writeVersion(date);
18
+ } else Logger_default.log("No updates found !");
19
+ Logger_default.log("Build finished.");
20
+ }
21
+ run().catch(Logger_default.error.bind(Logger_default));
22
+
23
+ //#endregion
24
+ export { };
@@ -0,0 +1,279 @@
1
+ import { t as __name } from "./chunk-Dco9itRc.mjs";
2
+ import fs from "node:fs/promises";
3
+ import path from "node:path";
4
+ import fetch from "node-fetch";
5
+ import * as console from "node:console";
6
+
7
+ //#region src/Config.ts
8
+ const Config = {
9
+ warframeRelicDropUrl: "https://drops.warframestat.us/data/relics.json",
10
+ warframeMarketItemUrl: "https://api.warframe.market/v2/items",
11
+ warframeItemsUrl: "https://api.warframestat.us/items/search/Relics?by=category",
12
+ warframeRelicDropInfoUrl: "https://drops.warframestat.us/data/info.json",
13
+ warframePatchlogsUrl: "https://raw.githubusercontent.com/WFCD/warframe-patchlogs/master/data/patchlogs.json"
14
+ };
15
+
16
+ //#endregion
17
+ //#region src/Logger.ts
18
+ var LogLevel = /* @__PURE__ */ function(LogLevel) {
19
+ LogLevel[LogLevel["FATAL"] = -1] = "FATAL";
20
+ LogLevel[LogLevel["ERROR"] = 0] = "ERROR";
21
+ LogLevel[LogLevel["LOG"] = 1] = "LOG";
22
+ LogLevel[LogLevel["DEBUG"] = 2] = "DEBUG";
23
+ return LogLevel;
24
+ }(LogLevel || {});
25
+ const fromString = (logLevelIsh) => {
26
+ switch (logLevelIsh === null || logLevelIsh === void 0 ? void 0 : logLevelIsh.toLowerCase()) {
27
+ case "fatal": return LogLevel.FATAL;
28
+ case "error":
29
+ case "bad": return LogLevel.ERROR;
30
+ case "info":
31
+ case "log": return LogLevel.LOG;
32
+ case "debug": return LogLevel.DEBUG;
33
+ default: return LogLevel.FATAL;
34
+ }
35
+ };
36
+ var Logger = class {
37
+ logLevel = fromString(process.env.LOG_LEVEL || "fatal");
38
+ log(message) {
39
+ if (this.logLevel >= LogLevel.LOG) console.log(message);
40
+ }
41
+ error(message) {
42
+ if (this.logLevel >= LogLevel.ERROR) console.error(message);
43
+ }
44
+ debug(message) {
45
+ if (this.logLevel === LogLevel.DEBUG) console.debug(message);
46
+ }
47
+ fatal(message) {
48
+ if (this.logLevel >= LogLevel.FATAL) {
49
+ console.error(`FATAL: ${message}`);
50
+ throw new Error(message);
51
+ }
52
+ }
53
+ };
54
+ var Logger_default = new Logger();
55
+
56
+ //#endregion
57
+ //#region src/Generator.ts
58
+ var Generator = class {
59
+ relicsRaw;
60
+ wfcdItems;
61
+ wfmItems;
62
+ relics;
63
+ constructor() {
64
+ this.relics = [];
65
+ }
66
+ /**
67
+ * Main function to fetch and generate the relic data
68
+ * @returns {Promise<Array<TitaniaRelic>>} The Relics data array
69
+ */
70
+ async generate() {
71
+ Logger_default.log("Starting Generation");
72
+ await this.fetchRawData();
73
+ this.filterWFCDRelics();
74
+ this.generateTitaniaRelics();
75
+ return this.relics;
76
+ }
77
+ /**
78
+ * Fetches all required data from WFCD and WFM.
79
+ */
80
+ async fetchRawData() {
81
+ var _await$relicRequest$j;
82
+ const relicRequest = await fetch(Config.warframeRelicDropUrl);
83
+ if (!relicRequest.ok) {
84
+ Logger_default.error("Failed to fetch Warframe relics from WFCD!");
85
+ return;
86
+ }
87
+ this.relicsRaw = (_await$relicRequest$j = await relicRequest.json()) === null || _await$relicRequest$j === void 0 ? void 0 : _await$relicRequest$j.relics;
88
+ const wfmRequest = await fetch(Config.warframeMarketItemUrl);
89
+ if (!wfmRequest.ok) {
90
+ Logger_default.error("Failed to fetch items from WFM!");
91
+ return;
92
+ }
93
+ this.wfmItems = await wfmRequest.json();
94
+ const wfcdItemRequest = await fetch(Config.warframeItemsUrl);
95
+ if (!wfcdItemRequest.ok) {
96
+ Logger_default.error("Failed to fetch items from WFCD! ");
97
+ return;
98
+ }
99
+ this.wfcdItems = await wfcdItemRequest.json();
100
+ }
101
+ /**
102
+ * Generates the relic data
103
+ * uses WFCD/warframe-drop-data to check what relics exist,
104
+ * and adds information from WFCD/warframe-items and WFM
105
+ */
106
+ generateTitaniaRelics() {
107
+ if (typeof this.relicsRaw === "undefined" || typeof this.wfmItems === "undefined") {
108
+ Logger_default.log("Failed to load relics/item data");
109
+ return;
110
+ }
111
+ const { length } = this.relicsRaw;
112
+ for (let i = 0; i < length; i += 1) {
113
+ const rawRelic = this.relicsRaw[i];
114
+ Logger_default.debug(`[${i + 1}/${length}] ${rawRelic.tier} ${rawRelic.relicName}`);
115
+ const relic = this.generateTitaniaRelic(rawRelic);
116
+ this.relics.push(relic);
117
+ }
118
+ Logger_default.debug(`Finished parsing ${this.relics.length} relics`);
119
+ }
120
+ /**
121
+ * Writes the fully generated data to disk.
122
+ * @param {string} dataDir Directory to store the relic data in. Default: ../data/
123
+ * @param {string} fileName Filename base ex: "Relics" becomes "Relics.json" and "Relics.min.json". Default: "Relics"
124
+ * @param {boolean} generateMin True if a minified json should be generated too. Default: true
125
+ */
126
+ async writeData(dataDir, fileName, generateMin = true) {
127
+ const DataDir = dataDir ?? path.join(__dirname, "..", "data");
128
+ const RelicPath = fileName ? path.join(DataDir, `${fileName}.json`) : path.join(DataDir, "Relics.json");
129
+ await fs.writeFile(RelicPath, JSON.stringify(this.relics, void 0, 4));
130
+ if (generateMin) {
131
+ const RelicMinPath = fileName ? path.join(DataDir, `${fileName}.min.json`) : path.join(DataDir, "Relics.min.json");
132
+ await fs.writeFile(RelicMinPath, JSON.stringify(this.relics));
133
+ }
134
+ }
135
+ /**
136
+ * Generates a single relic from all available data
137
+ * @param {WFCDRelic} rawRelic relic to pull Titania data from
138
+ * @returns {TitaniaRelicReward}
139
+ */
140
+ generateTitaniaRelic(rawRelic) {
141
+ var _this$wfcdItems2;
142
+ var _this$wfmItems2;
143
+ const name = `${rawRelic.tier} ${rawRelic.relicName}`;
144
+ const rewards = rawRelic.rewards.map((rawReward) => {
145
+ var _this$wfmItems;
146
+ var _this$wfcdItems;
147
+ const { chance } = rawReward;
148
+ const { rarity } = rawReward;
149
+ const wfmInfo = (_this$wfmItems = this.wfmItems) === null || _this$wfmItems === void 0 ? void 0 : _this$wfmItems.data.find((x) => {
150
+ return x.i18n.en.name.toLowerCase() === rawReward.itemName.toLowerCase();
151
+ });
152
+ const isSpecial = [
153
+ "Forma",
154
+ "Kuva",
155
+ "Exilus",
156
+ "Riven"
157
+ ].find((x) => rawReward.itemName.toLowerCase().includes(x.toLowerCase()));
158
+ if (!(wfmInfo || isSpecial)) Logger_default.debug(`Failed to find wfm item for ${rawReward.itemName}`);
159
+ const item = {
160
+ name: rawReward.itemName,
161
+ uniqueName: ((_this$wfcdItems = this.wfcdItems) === null || _this$wfcdItems === void 0 || (_this$wfcdItems = _this$wfcdItems.find((x) => x.name.toLowerCase() === `${name.trim()} Intact`.toLowerCase())) === null || _this$wfcdItems === void 0 ? void 0 : _this$wfcdItems.uniqueName) || "",
162
+ warframeMarket: void 0
163
+ };
164
+ if (wfmInfo) item.warframeMarket = {
165
+ id: wfmInfo.id,
166
+ urlName: wfmInfo.slug
167
+ };
168
+ return {
169
+ rarity,
170
+ chance,
171
+ item
172
+ };
173
+ });
174
+ let drops = [];
175
+ const wfcdItem = (_this$wfcdItems2 = this.wfcdItems) === null || _this$wfcdItems2 === void 0 ? void 0 : _this$wfcdItems2.find((x) => x.name.toLowerCase() === `${name.trim()} Intact`.toLowerCase());
176
+ if (!wfcdItem) Logger_default.error(`Failed to get WFCD item for relic: ${name}`);
177
+ if (wfcdItem && wfcdItem.drops) drops = wfcdItem.drops.map((rawDrop) => {
178
+ return {
179
+ rarity: rawDrop.rarity,
180
+ chance: rawDrop.chance,
181
+ location: rawDrop.location
182
+ };
183
+ });
184
+ const wfm = (_this$wfmItems2 = this.wfmItems) === null || _this$wfmItems2 === void 0 ? void 0 : _this$wfmItems2.data.find((x) => {
185
+ return x.i18n.en.name.toLowerCase() === `${name.trim()} Relic`.toLowerCase();
186
+ });
187
+ if (!wfm) Logger_default.error(`Failed to get relic item from wfm: ${name}`);
188
+ return {
189
+ name,
190
+ rewards,
191
+ locations: drops,
192
+ uniqueName: (wfcdItem === null || wfcdItem === void 0 ? void 0 : wfcdItem.uniqueName) || "",
193
+ vaultInfo: { vaulted: drops.length === 0 },
194
+ ...(wfm === null || wfm === void 0 ? void 0 : wfm.id) && (wfm === null || wfm === void 0 ? void 0 : wfm.slug) && { warframeMarket: {
195
+ id: wfm === null || wfm === void 0 ? void 0 : wfm.id,
196
+ urlName: wfm === null || wfm === void 0 ? void 0 : wfm.slug
197
+ } }
198
+ };
199
+ }
200
+ /**
201
+ * Filters WFCD's relic data to only include Intact variants, since we just need the base.
202
+ */
203
+ filterWFCDRelics() {
204
+ var _this$relicsRaw;
205
+ var _this$relicsRaw2;
206
+ var _this$relicsRaw3;
207
+ const before = ((_this$relicsRaw = this.relicsRaw) === null || _this$relicsRaw === void 0 ? void 0 : _this$relicsRaw.length) || 0;
208
+ this.relicsRaw = (_this$relicsRaw2 = this.relicsRaw) === null || _this$relicsRaw2 === void 0 ? void 0 : _this$relicsRaw2.filter((x) => x.state === "Intact");
209
+ Logger_default.log(`Filtered relics to intact variants. Before: ${before} After: ${((_this$relicsRaw3 = this.relicsRaw) === null || _this$relicsRaw3 === void 0 ? void 0 : _this$relicsRaw3.length) || 0}`);
210
+ }
211
+ };
212
+
213
+ //#endregion
214
+ //#region src/VersionManager.ts
215
+ var VersionManager = class {
216
+ versionPath;
217
+ versionRawPath;
218
+ hashPath;
219
+ /**
220
+ * Creates a new VersionManager instance.
221
+ * @param {string} dataDir Folder to write version information to.
222
+ * @constructor
223
+ */
224
+ constructor(dataDir) {
225
+ const DataDir = dataDir ?? path.join(__dirname, "..", "data");
226
+ this.versionPath = path.join(DataDir, "version.json");
227
+ this.versionRawPath = path.join(DataDir, "version.txt");
228
+ this.hashPath = path.join(DataDir, "hash.json");
229
+ }
230
+ /**
231
+ * Checks if the current data needs an update
232
+ */
233
+ async updateNeeded() {
234
+ const infoReq = await fetch(Config.warframeRelicDropInfoUrl);
235
+ if (!infoReq.ok) Logger_default.fatal("Failed to fetch version info!");
236
+ const info = await infoReq.json();
237
+ try {
238
+ await fs.access(this.hashPath);
239
+ return JSON.parse(await fs.readFile(this.hashPath, "utf-8")).hash !== info.hash;
240
+ } catch (ex) {
241
+ return true;
242
+ }
243
+ }
244
+ /**
245
+ * Writes both game and drop version metadata
246
+ * @param {number} timestamp Timestamp the build was started at
247
+ */
248
+ async writeVersion(timestamp) {
249
+ const patchLogsReq = await fetch(Config.warframePatchlogsUrl);
250
+ if (!patchLogsReq.ok) {
251
+ Logger_default.error("Failed to fetch patchlogs");
252
+ return;
253
+ }
254
+ const patchlogs = await patchLogsReq.json();
255
+ const version = patchlogs[0].name.replace(/ \+ /g, "--").replace(/[^0-9\-.]/g, "").trim();
256
+ const hashReq = await fetch(Config.warframeRelicDropInfoUrl);
257
+ if (!hashReq.ok) {
258
+ Logger_default.error("Failed to fetch hashInfo");
259
+ return;
260
+ }
261
+ const hashInfo = await hashReq.json();
262
+ const versionInfo = {
263
+ version,
264
+ title: patchlogs[0].name
265
+ };
266
+ const hashFile = {
267
+ hash: hashInfo.hash,
268
+ deUpdated: hashInfo.modified,
269
+ timestamp
270
+ };
271
+ await fs.writeFile(this.hashPath, JSON.stringify(hashFile, void 0, 2), "utf-8");
272
+ await fs.writeFile(this.versionPath, JSON.stringify(versionInfo, void 0, 2), "utf-8");
273
+ await fs.writeFile(this.versionRawPath, version, "utf-8");
274
+ Logger_default.debug("Finished writing version info");
275
+ }
276
+ };
277
+
278
+ //#endregion
279
+ export { Generator as n, Logger_default as r, VersionManager as t };