coh-content-db 2.0.0-rc.15 → 2.0.0-rc.17

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.
Files changed (45) hide show
  1. package/.github/workflows/build.yml +1 -1
  2. package/CHANGELOG.md +3 -1
  3. package/README.md +9 -1
  4. package/dist/coh-content-db.d.ts +93 -44
  5. package/dist/coh-content-db.js +230 -121
  6. package/dist/coh-content-db.js.map +1 -1
  7. package/dist/coh-content-db.mjs +228 -121
  8. package/dist/coh-content-db.mjs.map +1 -1
  9. package/jest.config.mjs +1 -0
  10. package/package.json +14 -14
  11. package/src/main/api/badge-data.ts +2 -1
  12. package/src/main/api/contact-data.ts +2 -1
  13. package/src/main/api/level-range-data.ts +4 -0
  14. package/src/main/api/mission-data.ts +3 -29
  15. package/src/main/api/mission-flashback-data.ts +31 -0
  16. package/src/main/api/set-title-data.ts +4 -0
  17. package/src/main/api/zone-data.ts +24 -0
  18. package/src/main/api/zone-type.ts +59 -0
  19. package/src/main/db/alternates.ts +1 -1
  20. package/src/main/db/badge-index.ts +10 -8
  21. package/src/main/db/badge-requirement.ts +1 -1
  22. package/src/main/db/badge.ts +5 -4
  23. package/src/main/db/bundle-header.ts +1 -1
  24. package/src/main/db/contact.ts +5 -4
  25. package/src/main/db/level-range.ts +15 -0
  26. package/src/main/db/mission.ts +9 -8
  27. package/src/main/db/set-title-ids.ts +10 -0
  28. package/src/main/db/zone.ts +29 -0
  29. package/src/main/index.ts +8 -2
  30. package/src/main/util/coalesce-to-array.ts +13 -0
  31. package/src/main/{util.ts → util/links.ts} +8 -22
  32. package/src/test/api/alignment.test.ts +2 -2
  33. package/src/test/api/sex.test.ts +2 -2
  34. package/src/test/api/zone-data.fixture.ts +1 -0
  35. package/src/test/db/badge.test.ts +24 -11
  36. package/src/test/db/contact.test.ts +2 -1
  37. package/src/test/db/level-range.test.ts +47 -0
  38. package/src/test/db/mission.test.ts +8 -6
  39. package/src/test/db/morality-list.test.ts +1 -1
  40. package/src/test/db/set-title-ids.test.ts +19 -0
  41. package/src/test/db/zone.test.ts +45 -0
  42. package/src/test/util/coalese-to-array.test.ts +17 -0
  43. package/src/test/{util.test.ts → util/links.test.ts} +5 -21
  44. package/src/test/{to-date.test.ts → util/to-date.test.ts} +1 -1
  45. /package/src/main/{to-date.ts → util/to-date.ts} +0 -0
@@ -98,12 +98,71 @@ function compareSex(a, b) {
98
98
  return orderA - orderB;
99
99
  }
100
100
 
101
- var __defProp$a = Object.defineProperty;
101
+ const ZONE_TYPE = [
102
+ /**
103
+ * The standard zone type, even if not technically occurring in the 'City' proper.
104
+ */
105
+ "city",
106
+ /**
107
+ * An Ouroboros flashback to a zone as it was in a previous era.
108
+ */
109
+ "echo",
110
+ /**
111
+ * Tutorial zon, usually inaccessible after leaving.
112
+ */
113
+ "tutorial",
114
+ /**
115
+ * Trial zones, like the Abandoned Sewers trial.
116
+ */
117
+ "trial",
118
+ /**
119
+ * Hazard zones like the Hollows.
120
+ */
121
+ "hazard",
122
+ /**
123
+ * Mayhem mission zones.
124
+ */
125
+ "mayhem",
126
+ /**
127
+ * Safeguard mission zones.
128
+ */
129
+ "safeguard",
130
+ /**
131
+ * Exists inside a mission not covered by the other types.
132
+ */
133
+ "mission",
134
+ /**
135
+ * Incarnate trial zones.
136
+ */
137
+ "incarnate",
138
+ /**
139
+ * Cooprative zones where Heroes and Villains can team up for PvE content.
140
+ */
141
+ "co-op",
142
+ /**
143
+ * PvP zones like Bloody Bay.
144
+ */
145
+ "pvp",
146
+ /**
147
+ * Located in an arena PvP map.
148
+ */
149
+ "arena",
150
+ /**
151
+ * A building, usually contained within another zone, like the AE buildings.
152
+ */
153
+ "building",
154
+ /**
155
+ * Stuff like the (Phone only) zone.
156
+ */
157
+ "other"
158
+ ];
159
+
160
+ var __defProp$c = Object.defineProperty;
102
161
  var __typeError$6 = (msg) => {
103
162
  throw TypeError(msg);
104
163
  };
105
- var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
106
- var __publicField$a = (obj, key, value) => __defNormalProp$a(obj, typeof key !== "symbol" ? key + "" : key, value);
164
+ var __defNormalProp$c = (obj, key, value) => key in obj ? __defProp$c(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
165
+ var __publicField$c = (obj, key, value) => __defNormalProp$c(obj, typeof key !== "symbol" ? key + "" : key, value);
107
166
  var __accessCheck$6 = (obj, member, msg) => member.has(obj) || __typeError$6("Cannot " + msg);
108
167
  var __privateGet$5 = (obj, member, getter) => (__accessCheck$6(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
109
168
  var __privateAdd$6 = (obj, member, value) => member.has(obj) ? __typeError$6("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
@@ -112,11 +171,11 @@ var _items$1;
112
171
  class AlignmentList {
113
172
  constructor(items) {
114
173
  __privateAdd$6(this, _items$1);
115
- __publicField$a(this, "hero");
116
- __publicField$a(this, "villain");
117
- __publicField$a(this, "praetorian");
118
- __publicField$a(this, "primal");
119
- __publicField$a(this, "all");
174
+ __publicField$c(this, "hero");
175
+ __publicField$c(this, "villain");
176
+ __publicField$c(this, "praetorian");
177
+ __publicField$c(this, "primal");
178
+ __publicField$c(this, "all");
120
179
  const set = new Set(items ?? [...ALIGNMENT]);
121
180
  this.hero = set.has("hero") || set.has("primal") || set.has("all");
122
181
  this.villain = set.has("villain") || set.has("primal") || set.has("all");
@@ -174,7 +233,7 @@ class Alternates {
174
233
  __privateAdd$5(this, _Alternates_instances);
175
234
  __privateAdd$5(this, _sortedValues, []);
176
235
  if (Array.isArray(value)) {
177
- __privateSet$4(this, _sortedValues, value.sort());
236
+ __privateSet$4(this, _sortedValues, value.toSorted());
178
237
  __privateGet$4(this, _sortedValues).sort((a, b) => __privateMethod$2(this, _Alternates_instances, compareAlternates_fn).call(this, a, b));
179
238
  } else {
180
239
  __privateSet$4(this, _sortedValues, [{ value }]);
@@ -247,60 +306,28 @@ validateKey_fn = function(key) {
247
306
  if (INVALID_KEY_PATTERN.test(key)) throw new Error(`Invalid key: [${key}]; Keys can only contain lowercase characters, numbers and dashes.`);
248
307
  };
249
308
 
250
- var __defProp$9 = Object.defineProperty;
251
- var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
252
- var __publicField$9 = (obj, key, value) => __defNormalProp$9(obj, typeof key !== "symbol" ? key + "" : key, value);
309
+ var __defProp$b = Object.defineProperty;
310
+ var __defNormalProp$b = (obj, key, value) => key in obj ? __defProp$b(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
311
+ var __publicField$b = (obj, key, value) => __defNormalProp$b(obj, typeof key !== "symbol" ? key + "" : key, value);
253
312
  class Archetype {
254
313
  constructor(data) {
255
- __publicField$9(this, "key");
256
- __publicField$9(this, "name");
257
- __publicField$9(this, "description");
314
+ __publicField$b(this, "key");
315
+ __publicField$b(this, "name");
316
+ __publicField$b(this, "description");
258
317
  this.key = new Key(data.key).value;
259
318
  this.name = data.name;
260
319
  this.description = data.description;
261
320
  }
262
321
  }
263
322
 
264
- function badgeUri(target) {
265
- const key = typeof target === "string" ? target : target.key;
266
- return `badge://${key}`;
267
- }
268
- function badgeLink(target) {
269
- const key = typeof target === "string" ? target : target.key;
270
- return `[${key}](${badgeUri(target)})`;
271
- }
272
- function contactUri(target) {
273
- const key = typeof target === "string" ? target : target.key;
274
- return `contact://${key}`;
275
- }
276
- function contactLink(target) {
277
- const key = typeof target === "string" ? target : target.key;
278
- return `[${key}](${contactUri(target)})`;
279
- }
280
- function missionUri(target) {
281
- const key = typeof target === "string" ? target : target.key;
282
- return `mission://${key}`;
283
- }
284
- function missionLink(target) {
285
- const key = typeof target === "string" ? target : target.key;
286
- return `[${key}](${missionUri(target)})`;
287
- }
288
- function zoneUri(target) {
289
- const key = typeof target === "string" ? target : target.key;
290
- return `zone://${key}`;
291
- }
292
- function zoneLink(target) {
293
- const key = typeof target === "string" ? target : target.key;
294
- return `[${key}](${zoneUri(target)})`;
295
- }
296
323
  function coalesceToArray(value) {
297
324
  if (!value) return void 0;
298
325
  return Array.isArray(value) ? value : [value];
299
326
  }
300
327
 
301
- var __defProp$8 = Object.defineProperty;
302
- var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
303
- var __publicField$8 = (obj, key, value) => __defNormalProp$8(obj, typeof key !== "symbol" ? key + "" : key, value);
328
+ var __defProp$a = Object.defineProperty;
329
+ var __defNormalProp$a = (obj, key, value) => key in obj ? __defProp$a(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
330
+ var __publicField$a = (obj, key, value) => __defNormalProp$a(obj, typeof key !== "symbol" ? key + "" : key, value);
304
331
  class BadgeRequirement {
305
332
  constructor(data) {
306
333
  /**
@@ -308,47 +335,47 @@ class BadgeRequirement {
308
335
  *
309
336
  * Keys must be unique and can only contain lowercase letters, numbers and hyphens (`-`).
310
337
  */
311
- __publicField$8(this, "key");
338
+ __publicField$a(this, "key");
312
339
  /**
313
340
  * The requirement type.
314
341
  */
315
- __publicField$8(this, "type");
342
+ __publicField$a(this, "type");
316
343
  /**
317
344
  * If the requirement involves a location, where it is.
318
345
  */
319
- __publicField$8(this, "location");
346
+ __publicField$a(this, "location");
320
347
  /**
321
348
  * If the requirement involves a badge, the badge key.
322
349
  */
323
- __publicField$8(this, "badgeKey");
350
+ __publicField$a(this, "badgeKey");
324
351
  /**
325
352
  * If the requirement involves a mission, the mission key.
326
353
  */
327
- __publicField$8(this, "missionKey");
354
+ __publicField$a(this, "missionKey");
328
355
  /**
329
356
  * If the requirement involves a monument, the text that is displayed thereon.
330
357
  */
331
- __publicField$8(this, "monumentText");
358
+ __publicField$a(this, "monumentText");
332
359
  /**
333
360
  * If the requirement involves crafting an invention, the Level of the invention required.
334
361
  */
335
- __publicField$8(this, "inventionLevel");
362
+ __publicField$a(this, "inventionLevel");
336
363
  /**
337
364
  * If the requirement involves crafting an invention, the types of enhancements that will qualify.
338
365
  */
339
- __publicField$8(this, "inventionTypes");
366
+ __publicField$a(this, "inventionTypes");
340
367
  /**
341
368
  * Number of times the task needs to be repeated.
342
369
  */
343
- __publicField$8(this, "count");
370
+ __publicField$a(this, "count");
344
371
  /**
345
372
  * Additional information about the requirement.
346
373
  */
347
- __publicField$8(this, "notes");
374
+ __publicField$a(this, "notes");
348
375
  /**
349
376
  * List of external links. Wiki, forums, etc.
350
377
  */
351
- __publicField$8(this, "links");
378
+ __publicField$a(this, "links");
352
379
  this.key = new Key(data.key).value;
353
380
  this.type = data.type;
354
381
  this.location = coalesceToArray(data.location);
@@ -363,12 +390,12 @@ class BadgeRequirement {
363
390
  }
364
391
  }
365
392
 
366
- var __defProp$7 = Object.defineProperty;
393
+ var __defProp$9 = Object.defineProperty;
367
394
  var __typeError$3 = (msg) => {
368
395
  throw TypeError(msg);
369
396
  };
370
- var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
371
- var __publicField$7 = (obj, key, value) => __defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
397
+ var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
398
+ var __publicField$9 = (obj, key, value) => __defNormalProp$9(obj, typeof key !== "symbol" ? key + "" : key, value);
372
399
  var __accessCheck$3 = (obj, member, msg) => member.has(obj) || __typeError$3("Cannot " + msg);
373
400
  var __privateGet$2 = (obj, member, getter) => (__accessCheck$3(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
374
401
  var __privateAdd$3 = (obj, member, value) => member.has(obj) ? __typeError$3("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
@@ -377,19 +404,19 @@ var _items;
377
404
  class MoralityList {
378
405
  constructor(items) {
379
406
  __privateAdd$3(this, _items);
380
- __publicField$7(this, "hero");
381
- __publicField$7(this, "vigilante");
382
- __publicField$7(this, "villain");
383
- __publicField$7(this, "rogue");
384
- __publicField$7(this, "resistance");
385
- __publicField$7(this, "loyalist");
386
- __publicField$7(this, "primal");
387
- __publicField$7(this, "praetorian");
388
- __publicField$7(this, "heroic");
389
- __publicField$7(this, "villainous");
390
- __publicField$7(this, "paragonCityAccess");
391
- __publicField$7(this, "rogueIslesAccess");
392
- __publicField$7(this, "all");
407
+ __publicField$9(this, "hero");
408
+ __publicField$9(this, "vigilante");
409
+ __publicField$9(this, "villain");
410
+ __publicField$9(this, "rogue");
411
+ __publicField$9(this, "resistance");
412
+ __publicField$9(this, "loyalist");
413
+ __publicField$9(this, "primal");
414
+ __publicField$9(this, "praetorian");
415
+ __publicField$9(this, "heroic");
416
+ __publicField$9(this, "villainous");
417
+ __publicField$9(this, "paragonCityAccess");
418
+ __publicField$9(this, "rogueIslesAccess");
419
+ __publicField$9(this, "all");
393
420
  const set = new Set(items ?? [...MORALITY]);
394
421
  this.hero = set.has("hero") || set.has("primal") || set.has("heroic") || set.has("paragon-city-access") || set.has("all");
395
422
  this.vigilante = set.has("vigilante") || set.has("primal") || set.has("heroic") || set.has("paragon-city-access") || set.has("rogue-isles-access") || set.has("all");
@@ -464,9 +491,9 @@ class MoralityList {
464
491
  }
465
492
  _items = new WeakMap();
466
493
 
467
- var __defProp$6 = Object.defineProperty;
468
- var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
469
- var __publicField$6 = (obj, key, value) => __defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
494
+ var __defProp$8 = Object.defineProperty;
495
+ var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
496
+ var __publicField$8 = (obj, key, value) => __defNormalProp$8(obj, typeof key !== "symbol" ? key + "" : key, value);
470
497
  class AbstractIndex {
471
498
  /**
472
499
  * Create a new index.
@@ -474,8 +501,8 @@ class AbstractIndex {
474
501
  * @param values Values to index.
475
502
  */
476
503
  constructor(keyField, values) {
477
- __publicField$6(this, "_values", []);
478
- __publicField$6(this, "_hashTable", {});
504
+ __publicField$8(this, "_values", []);
505
+ __publicField$8(this, "_hashTable", {});
479
506
  this._values = values ?? [];
480
507
  this._hashTable = {};
481
508
  for (const value of this.values) {
@@ -506,12 +533,23 @@ function toDate(iso) {
506
533
  return date;
507
534
  }
508
535
 
509
- var __defProp$5 = Object.defineProperty;
536
+ var __defProp$7 = Object.defineProperty;
537
+ var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
538
+ var __publicField$7 = (obj, key, value) => __defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
539
+ class SetTitleIds {
540
+ constructor(value) {
541
+ __publicField$7(this, "primal");
542
+ __publicField$7(this, "praetorian");
543
+ [this.primal, this.praetorian] = value;
544
+ }
545
+ }
546
+
547
+ var __defProp$6 = Object.defineProperty;
510
548
  var __typeError$2 = (msg) => {
511
549
  throw TypeError(msg);
512
550
  };
513
- var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
514
- var __publicField$5 = (obj, key, value) => __defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
551
+ var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
552
+ var __publicField$6 = (obj, key, value) => __defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
515
553
  var __accessCheck$2 = (obj, member, msg) => member.has(obj) || __typeError$2("Cannot " + msg);
516
554
  var __privateGet$1 = (obj, member, getter) => (__accessCheck$2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
517
555
  var __privateAdd$2 = (obj, member, value) => member.has(obj) ? __typeError$2("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
@@ -524,60 +562,60 @@ class Badge {
524
562
  /**
525
563
  * The database key for this badge.
526
564
  */
527
- __publicField$5(this, "key");
565
+ __publicField$6(this, "key");
528
566
  /**
529
567
  * The type of badge.
530
568
  */
531
- __publicField$5(this, "type");
569
+ __publicField$6(this, "type");
532
570
  /**
533
571
  * The name of this badge.
534
572
  *
535
573
  * May vary by character sex or alignment.
536
574
  */
537
- __publicField$5(this, "name");
575
+ __publicField$6(this, "name");
538
576
  /**
539
577
  * The date that the badge was added to the game.
540
578
  */
541
- __publicField$5(this, "releaseDate");
579
+ __publicField$6(this, "releaseDate");
542
580
  /**
543
581
  * The character moralities that this badge is available to.
544
582
  */
545
- __publicField$5(this, "morality");
583
+ __publicField$6(this, "morality");
546
584
  /**
547
585
  * The badge text as it appears in-game. May vary by character sex or alignment.
548
586
  */
549
- __publicField$5(this, "badgeText");
587
+ __publicField$6(this, "badgeText");
550
588
  /**
551
589
  * Short description of how to acquire the badge. Detailed instructions will be in the notes field.
552
590
  */
553
- __publicField$5(this, "acquisition");
591
+ __publicField$6(this, "acquisition");
554
592
  /**
555
593
  * Absolute URL to this badge's icon.
556
594
  *
557
595
  * May vary by character sex or alignment.
558
596
  */
559
- __publicField$5(this, "icon");
597
+ __publicField$6(this, "icon");
560
598
  /**
561
599
  * Freeform notes or tips about the badge.
562
600
  */
563
- __publicField$5(this, "notes");
601
+ __publicField$6(this, "notes");
564
602
  /**
565
603
  * List of external links. Wiki, forums, etc.
566
604
  */
567
- __publicField$5(this, "links");
605
+ __publicField$6(this, "links");
568
606
  /**
569
607
  * The id used with the in-game `/settitle` command to apply the badge.
570
608
  * The first value is the id for primal characters and the (optional) second number is the id for praetorian characters.
571
609
  */
572
- __publicField$5(this, "setTitleId");
610
+ __publicField$6(this, "setTitleId");
573
611
  /**
574
612
  * A description of the effect the badge will have, such as a buff or granting a temporary power.
575
613
  */
576
- __publicField$5(this, "effect");
614
+ __publicField$6(this, "effect");
577
615
  /**
578
616
  * Some badges are not included in the badge total count... such as Flames of Prometheus, which can be removed by redeeming it for a Notice of the Well.
579
617
  */
580
- __publicField$5(this, "ignoreInTotals");
618
+ __publicField$6(this, "ignoreInTotals");
581
619
  this.key = new Key(badgeData.key).value;
582
620
  this.type = badgeData.type;
583
621
  this.name = new Alternates(badgeData.name);
@@ -589,7 +627,7 @@ class Badge {
589
627
  this.notes = badgeData.notes;
590
628
  this.links = badgeData.links ?? [];
591
629
  this.effect = badgeData.effect;
592
- this.setTitleId = badgeData.setTitleId;
630
+ this.setTitleId = badgeData.setTitleId ? new SetTitleIds(badgeData.setTitleId) : void 0;
593
631
  this.ignoreInTotals = badgeData.ignoreInTotals ?? false;
594
632
  __privateSet$1(this, _requirementsIndex, new AbstractIndex("key", badgeData.requirements?.map((x) => new BadgeRequirement(x))));
595
633
  for (const requirement of __privateGet$1(this, _requirementsIndex).values) {
@@ -679,7 +717,7 @@ satisfiesQueryPredicate_fn = function(badge, query) {
679
717
  const queryString = query?.str?.toLowerCase() ?? "";
680
718
  const fields = query?.fields ? new Set(query?.fields) : /* @__PURE__ */ new Set(["name"]);
681
719
  if (fields.size === 0) return true;
682
- return !!(fields.has("name") && badge.name.canonical.some((x) => x.value.toLowerCase().includes(queryString)) || fields.has("badge-text") && badge.badgeText.canonical.some((x) => x.value.toLowerCase().includes(queryString)) || fields.has("acquisition") && badge.acquisition?.toLowerCase().includes(queryString) || fields.has("effect") && badge.effect?.toLowerCase().includes(queryString) || fields.has("notes") && badge.notes?.toLowerCase().includes(queryString) || fields.has("set-title-id") && badge.setTitleId?.some((x) => x?.toString().includes(queryString)));
720
+ return !!(fields.has("name") && badge.name.canonical.some((x) => x.value.toLowerCase().includes(queryString)) || fields.has("badge-text") && badge.badgeText.canonical.some((x) => x.value.toLowerCase().includes(queryString)) || fields.has("acquisition") && badge.acquisition?.toLowerCase().includes(queryString) || fields.has("effect") && badge.effect?.toLowerCase().includes(queryString) || fields.has("notes") && badge.notes?.toLowerCase().includes(queryString) || fields.has("set-title-id") && badge.setTitleId?.primal.toString() === queryString || fields.has("set-title-id") && badge.setTitleId?.praetorian?.toString() === queryString);
683
721
  };
684
722
  satisfiesFilterPredicate_fn = function(badge, filter) {
685
723
  return (!filter?.type || badge.type === filter.type) && (!filter?.zoneKey || badge.zoneKey === filter.zoneKey) && (!filter?.morality || badge.morality.has(filter.morality));
@@ -687,25 +725,25 @@ satisfiesFilterPredicate_fn = function(badge, filter) {
687
725
  sort_fn = function(badges, sort) {
688
726
  switch (sort) {
689
727
  case "name.asc": {
690
- return badges.sort(compareByDefaultName);
728
+ return badges.toSorted(compareByDefaultName);
691
729
  }
692
730
  case "name.desc": {
693
- return badges.sort((a, b) => compareByDefaultName(b, a));
731
+ return badges.toSorted((a, b) => compareByDefaultName(b, a));
694
732
  }
695
733
  case "zone-key.asc": {
696
- return badges.sort(compareByZoneKey);
734
+ return badges.toSorted(compareByZoneKey);
697
735
  }
698
736
  case "zone-key.desc": {
699
- return badges.sort((a, b) => compareByZoneKey(b, a));
737
+ return badges.toSorted((a, b) => compareByZoneKey(b, a));
700
738
  }
701
739
  case "release-date.asc": {
702
- return badges.sort(compareByReleaseDate);
740
+ return badges.toSorted(compareByReleaseDate);
703
741
  }
704
742
  case "release-date.desc": {
705
- return badges.sort((a, b) => compareByReleaseDate(b, a));
743
+ return badges.toSorted((a, b) => compareByReleaseDate(b, a));
706
744
  }
707
745
  case "canonical.desc": {
708
- return badges.reverse();
746
+ return badges.toReversed();
709
747
  }
710
748
  default: {
711
749
  return [...badges];
@@ -713,39 +751,39 @@ sort_fn = function(badges, sort) {
713
751
  }
714
752
  };
715
753
 
716
- var __defProp$4 = Object.defineProperty;
717
- var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
718
- var __publicField$4 = (obj, key, value) => __defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
754
+ var __defProp$5 = Object.defineProperty;
755
+ var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
756
+ var __publicField$5 = (obj, key, value) => __defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
719
757
  class BundleHeader {
720
758
  constructor(data) {
721
759
  /**
722
760
  * Name of the fork this bundle contains data for.
723
761
  */
724
- __publicField$4(this, "name");
762
+ __publicField$5(this, "name");
725
763
  /**
726
764
  * Version number for this data package.
727
765
  */
728
- __publicField$4(this, "version");
766
+ __publicField$5(this, "version");
729
767
  /**
730
768
  * The time this bundle was last updated.
731
769
  */
732
- __publicField$4(this, "lastUpdateTime");
770
+ __publicField$5(this, "lastUpdateTime");
733
771
  /**
734
772
  * Description of the fork.
735
773
  */
736
- __publicField$4(this, "description");
774
+ __publicField$5(this, "description");
737
775
  /**
738
776
  * Url for the repository where the bundle is maintained.
739
777
  */
740
- __publicField$4(this, "repositoryUrl");
778
+ __publicField$5(this, "repositoryUrl");
741
779
  /**
742
780
  * Url for the location of the changelog.
743
781
  */
744
- __publicField$4(this, "changelogUrl");
782
+ __publicField$5(this, "changelogUrl");
745
783
  /**
746
784
  * List of external links. Wiki, forums, etc.
747
785
  */
748
- __publicField$4(this, "links");
786
+ __publicField$5(this, "links");
749
787
  if (!data) throw new Error("Missing header data");
750
788
  this.name = data.name;
751
789
  this.version = data.version;
@@ -757,6 +795,22 @@ class BundleHeader {
757
795
  }
758
796
  }
759
797
 
798
+ var __defProp$4 = Object.defineProperty;
799
+ var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
800
+ var __publicField$4 = (obj, key, value) => __defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
801
+ class LevelRange {
802
+ constructor(value) {
803
+ __publicField$4(this, "min");
804
+ __publicField$4(this, "max");
805
+ if (Array.isArray(value)) {
806
+ this.min = value[0];
807
+ this.max = value[1] === void 0 ? void 0 : value[1];
808
+ } else {
809
+ this.min = value;
810
+ }
811
+ }
812
+ }
813
+
760
814
  var __defProp$3 = Object.defineProperty;
761
815
  var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
762
816
  var __publicField$3 = (obj, key, value) => __defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
@@ -772,12 +826,32 @@ class Zone {
772
826
  * The name of the zone as it appears in-game.
773
827
  */
774
828
  __publicField$3(this, "name");
829
+ /**
830
+ * The type of zone.
831
+ */
832
+ __publicField$3(this, "type");
833
+ /**
834
+ * The character moralities that this zone is accessible by.
835
+ */
836
+ __publicField$3(this, "morality");
837
+ /**
838
+ * The level range this zone is recommended for.
839
+ */
840
+ __publicField$3(this, "levelRange");
841
+ /**
842
+ * Freeform notes or tips about the zone.
843
+ */
844
+ __publicField$3(this, "notes");
775
845
  /**
776
846
  * List of external links. Wiki, forums, etc.
777
847
  */
778
848
  __publicField$3(this, "links");
779
849
  this.key = new Key(data.key).value;
780
850
  this.name = data.name;
851
+ this.type = data.type;
852
+ this.morality = new MoralityList(coalesceToArray(data.morality));
853
+ this.levelRange = data.levelRange ? new LevelRange(data.levelRange) : void 0;
854
+ this.notes = data.notes;
781
855
  this.links = data.links ?? [];
782
856
  }
783
857
  }
@@ -826,7 +900,7 @@ class Contact {
826
900
  this.title = data.title;
827
901
  this.morality = new MoralityList(coalesceToArray(data.morality));
828
902
  this.location = data.location;
829
- this.levelRange = data.levelRange;
903
+ this.levelRange = data.levelRange ? new LevelRange(data.levelRange) : void 0;
830
904
  this.notes = data.notes;
831
905
  this.links = data.links ?? [];
832
906
  }
@@ -882,7 +956,7 @@ class Mission {
882
956
  this.type = data.type;
883
957
  this.morality = new MoralityList(coalesceToArray(data.morality));
884
958
  this.contactKeys = coalesceToArray(data.contactKeys);
885
- this.levelRange = data.levelRange;
959
+ this.levelRange = data.levelRange ? new LevelRange(data.levelRange) : void 0;
886
960
  this.notes = data.notes;
887
961
  this.links = data.links ?? [];
888
962
  this.flashback = createFlashback(data);
@@ -892,7 +966,7 @@ function createFlashback(data) {
892
966
  if (!data.flashback) return void 0;
893
967
  return {
894
968
  id: data.flashback.id,
895
- levelRange: data.flashback.levelRange ?? data.levelRange,
969
+ levelRange: data.flashback.levelRange ? new LevelRange(data.flashback.levelRange) : void 0,
896
970
  name: data.flashback.name ?? data.name,
897
971
  morality: new MoralityList(coalesceToArray(data.flashback.morality ?? data.morality)),
898
972
  notes: data.flashback.notes
@@ -1053,6 +1127,39 @@ class Location {
1053
1127
  }
1054
1128
  }
1055
1129
 
1130
+ function badgeUri(target) {
1131
+ const key = typeof target === "string" ? target : target.key;
1132
+ return `badge://${key}`;
1133
+ }
1134
+ function badgeLink(target) {
1135
+ const key = typeof target === "string" ? target : target.key;
1136
+ return `[${key}](${badgeUri(target)})`;
1137
+ }
1138
+ function contactUri(target) {
1139
+ const key = typeof target === "string" ? target : target.key;
1140
+ return `contact://${key}`;
1141
+ }
1142
+ function contactLink(target) {
1143
+ const key = typeof target === "string" ? target : target.key;
1144
+ return `[${key}](${contactUri(target)})`;
1145
+ }
1146
+ function missionUri(target) {
1147
+ const key = typeof target === "string" ? target : target.key;
1148
+ return `mission://${key}`;
1149
+ }
1150
+ function missionLink(target) {
1151
+ const key = typeof target === "string" ? target : target.key;
1152
+ return `[${key}](${missionUri(target)})`;
1153
+ }
1154
+ function zoneUri(target) {
1155
+ const key = typeof target === "string" ? target : target.key;
1156
+ return `zone://${key}`;
1157
+ }
1158
+ function zoneLink(target) {
1159
+ const key = typeof target === "string" ? target : target.key;
1160
+ return `[${key}](${zoneUri(target)})`;
1161
+ }
1162
+
1056
1163
  exports.ALIGNMENT = ALIGNMENT;
1057
1164
  exports.AlignmentList = AlignmentList;
1058
1165
  exports.Alternates = Alternates;
@@ -1067,16 +1174,18 @@ exports.CohContentDatabase = CohContentDatabase;
1067
1174
  exports.Contact = Contact;
1068
1175
  exports.ENHANCEMENT_CATEGORY = ENHANCEMENT_CATEGORY;
1069
1176
  exports.Key = Key;
1177
+ exports.LevelRange = LevelRange;
1070
1178
  exports.Location = Location;
1071
1179
  exports.MISSION_TYPE = MISSION_TYPE;
1072
1180
  exports.MORALITY = MORALITY;
1073
1181
  exports.Mission = Mission;
1074
1182
  exports.MoralityList = MoralityList;
1075
1183
  exports.SEX = SEX;
1184
+ exports.SetTitleIds = SetTitleIds;
1185
+ exports.ZONE_TYPE = ZONE_TYPE;
1076
1186
  exports.Zone = Zone;
1077
1187
  exports.badgeLink = badgeLink;
1078
1188
  exports.badgeUri = badgeUri;
1079
- exports.coalesceToArray = coalesceToArray;
1080
1189
  exports.compareAlignment = compareAlignment;
1081
1190
  exports.compareByDefaultName = compareByDefaultName;
1082
1191
  exports.compareByReleaseDate = compareByReleaseDate;