coh-content-db 2.0.0-rc.8 → 2.0.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.
Files changed (74) hide show
  1. package/.github/workflows/build.yml +3 -1
  2. package/CHANGELOG.md +47 -0
  3. package/README.md +48 -17
  4. package/dist/coh-content-db.d.ts +257 -200
  5. package/dist/coh-content-db.js +509 -339
  6. package/dist/coh-content-db.js.map +1 -1
  7. package/dist/coh-content-db.mjs +501 -335
  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 +13 -7
  12. package/src/main/api/{content-bundle.ts → bundle-data.ts} +5 -27
  13. package/src/main/api/bundle-header-data.ts +44 -0
  14. package/src/main/api/contact-data.ts +2 -1
  15. package/src/main/api/level-range-data.ts +4 -0
  16. package/src/main/api/mission-data.ts +3 -29
  17. package/src/main/api/mission-flashback-data.ts +31 -0
  18. package/src/main/api/morality.ts +27 -9
  19. package/src/main/api/set-title-data.ts +4 -0
  20. package/src/main/api/variant-context.ts +11 -0
  21. package/src/main/api/{alternate-data.ts → variant-data.ts} +4 -4
  22. package/src/main/api/zone-data.ts +24 -0
  23. package/src/main/api/zone-type.ts +59 -0
  24. package/src/main/db/abstract-index.ts +12 -16
  25. package/src/main/db/badge-index.ts +53 -27
  26. package/src/main/db/badge-requirement.ts +1 -1
  27. package/src/main/db/badge-search-options.ts +15 -14
  28. package/src/main/db/badge.ts +46 -29
  29. package/src/main/db/bundle-header.ts +52 -0
  30. package/src/main/db/coh-content-database.ts +22 -22
  31. package/src/main/db/contact.ts +5 -4
  32. package/src/main/db/level-range.ts +15 -0
  33. package/src/main/db/mission.ts +11 -10
  34. package/src/main/db/paged.ts +7 -3
  35. package/src/main/db/set-title-ids.ts +10 -0
  36. package/src/main/db/variants.ts +84 -0
  37. package/src/main/db/zone.ts +29 -0
  38. package/src/main/index.ts +14 -8
  39. package/src/main/util/coalesce-to-array.ts +13 -0
  40. package/src/main/{util.ts → util/links.ts} +8 -22
  41. package/src/main/util/to-date.ts +9 -0
  42. package/src/test/api/alignment.test.ts +2 -2
  43. package/src/test/api/badge-data.fixture.ts +1 -0
  44. package/src/test/api/badge-data.test.ts +1 -0
  45. package/src/test/api/bundle-data.fixture.ts +7 -0
  46. package/src/test/api/bundle-header-data.fixture.ts +8 -0
  47. package/src/test/api/morality.test.ts +31 -0
  48. package/src/test/api/sex.test.ts +2 -2
  49. package/src/test/api/zone-data.fixture.ts +1 -0
  50. package/src/test/db/abstract-index.test.ts +12 -43
  51. package/src/test/db/badge-index.test.ts +197 -101
  52. package/src/test/db/badge.test.ts +122 -16
  53. package/src/test/db/bundle-header.test.ts +89 -0
  54. package/src/test/db/coh-content-database.test.ts +137 -178
  55. package/src/test/db/contact.test.ts +2 -1
  56. package/src/test/db/level-range.test.ts +47 -0
  57. package/src/test/db/mission.test.ts +8 -6
  58. package/src/test/db/morality-list.test.ts +1 -1
  59. package/src/test/db/set-title-ids.test.ts +19 -0
  60. package/src/test/db/{alternates.test.ts → variants.test.ts} +24 -24
  61. package/src/test/db/zone.test.ts +45 -0
  62. package/src/test/integration.test.ts +16 -0
  63. package/src/test/util/coalese-to-array.test.ts +17 -0
  64. package/src/test/{util.test.ts → util/links.test.ts} +5 -21
  65. package/src/test/util/to-date.test.ts +15 -0
  66. package/src/main/api/change.ts +0 -17
  67. package/src/main/changelog.ts +0 -29
  68. package/src/main/db/alternates.ts +0 -67
  69. package/src/main/db/bundle-metadata.ts +0 -45
  70. package/src/test/api/content-bundle.fixture.ts +0 -6
  71. package/src/test/api/content-bundle.test.ts +0 -14
  72. package/src/test/changelog.test.ts +0 -36
  73. package/src/test/db/bundle-metadata.test.ts +0 -84
  74. package/src/test/index.test.ts +0 -14
@@ -11,28 +11,6 @@ type AlignmentExtended = Alignment
11
11
  | 'all';
12
12
  declare function compareAlignment(a?: Alignment, b?: Alignment): number;
13
13
 
14
- declare const SEX: readonly ["M", "F"];
15
- type Sex = typeof SEX[number];
16
- declare function compareSex(a?: Sex, b?: Sex): number;
17
-
18
- /**
19
- * Some badge values differ based on the alignment or sex of the character.
20
- */
21
- interface AlternateData<V> {
22
- /**
23
- * The character alignment this alternate applies to.
24
- */
25
- readonly alignment?: Alignment;
26
- /**
27
- * The character sex this alternate applies to.
28
- */
29
- readonly sex?: Sex;
30
- /**
31
- * The value for this combination.
32
- */
33
- readonly value: V;
34
- }
35
-
36
14
  interface ArchetypeData {
37
15
  readonly key: string;
38
16
  readonly name: string;
@@ -131,37 +109,41 @@ interface BadgeRequirementData {
131
109
  declare const BADGE_TYPE: readonly ["exploration", "history", "accomplishment", "achievement", "accolade", "gladiator", "veteran", "pvp", "invention", "defeat", "event", "ouroboros", "consignment", "day-job", "architect-entertainment"];
132
110
  type BadgeType = typeof BADGE_TYPE[number];
133
111
 
134
- declare const MORALITY: readonly ["hero", "vigilante", "villain", "rogue", "resistance", "loyalist"];
135
- type Morality = typeof MORALITY[number];
136
- type MoralityExtended = Morality
137
- /**
138
- * Any of the Primal Earth moralities - Hero, Vigilante, Villain, Rogue.
139
- */
140
- | 'primal'
141
- /**
142
- * Either of the Praetorian Earth moralities - Resistance or Loyalist.
143
- */
144
- | 'praetorian'
145
- /**
146
- * The moralities that roll up to the Hero {@link Alignment} - Hero and Vigilante.
147
- */
148
- | 'heroic'
149
- /**
150
- * The moralities that roll up to the Villain {@link Alignment} - Villain and Rogue.
151
- */
152
- | 'villainous'
112
+ declare const SEX: readonly ["M", "F"];
113
+ type Sex = typeof SEX[number];
114
+ declare function compareSex(a?: Sex, b?: Sex): number;
115
+
153
116
  /**
154
- * Moralities with access to Paragon City - Hero, Vigilante and Rogue.
117
+ * Some badge values differ based on the alignment or sex of a character.
155
118
  */
156
- | 'paragon-city-access'
119
+ interface VariantData<V> {
120
+ /**
121
+ * The character alignment this variant applies to.
122
+ */
123
+ readonly alignment?: Alignment;
124
+ /**
125
+ * The character sex this variant applies to.
126
+ */
127
+ readonly sex?: Sex;
128
+ /**
129
+ * The value for this combination.
130
+ */
131
+ readonly value: V;
132
+ }
133
+
134
+ declare const MORALITY: readonly ["hero", "vigilante", "villain", "rogue", "resistance", "loyalist"];
135
+ declare const MORALITY_EXTENDED: readonly ["hero", "vigilante", "villain", "rogue", "resistance", "loyalist", "primal", "praetorian", "heroic", "villainous", "paragon-city-access", "rogue-isles-access", "all"];
136
+ type Morality = typeof MORALITY[number];
137
+ type MoralityExtended = typeof MORALITY_EXTENDED[number];
157
138
  /**
158
- * Moralities with access to the Rogue Isles - Villain, Rogue and Vigilante.
139
+ * Maps a morality to the underlying alignment
159
140
  */
160
- | 'rogue-isles-access'
141
+ declare const MoralityMap: Record<Morality | Alignment, Alignment>;
142
+
161
143
  /**
162
- * All the moralities.
144
+ * The id, or a pair of ids [primal, praetorian] that are used with the /settitle command to set a badge
163
145
  */
164
- | 'all';
146
+ type SetTitleData = [number, number?];
165
147
 
166
148
  interface BadgeData {
167
149
  /**
@@ -177,9 +159,13 @@ interface BadgeData {
177
159
  /**
178
160
  * The name of this badge.
179
161
  *
180
- * If the value differs by sex or alignment, include an {@link AlternateData} for each variant.
162
+ * If the value differs by sex or alignment, include an {@link VariantData} for each variant.
181
163
  */
182
- readonly name: string | AlternateData<string>[];
164
+ readonly name: string | VariantData<string>[];
165
+ /**
166
+ * The date that the badge was added to the game.
167
+ */
168
+ readonly releaseDate: string;
183
169
  /**
184
170
  * The {@link MoralityExtended|moralities} that this badge is available to. If undefined then all moralities will be assumed.
185
171
  */
@@ -187,7 +173,7 @@ interface BadgeData {
187
173
  /**
188
174
  * The badge text as it appears in-game. May vary by character sex or alignment.
189
175
  */
190
- readonly badgeText?: AlternateData<MarkdownString>[] | MarkdownString;
176
+ readonly badgeText?: VariantData<MarkdownString>[] | MarkdownString;
191
177
  /**
192
178
  * Short description of how to acquire the badge. Detailed instructions should go in the notes field.
193
179
  */
@@ -195,9 +181,9 @@ interface BadgeData {
195
181
  /**
196
182
  * List of absolute URLs for this badge's icons.
197
183
  *
198
- * If the value differs by sex or alignment, include an {@link AlternateData} for each variant.
184
+ * If the value differs by sex or alignment, include an {@link VariantData} for each variant.
199
185
  */
200
- readonly icon?: string | AlternateData<string>[];
186
+ readonly icon?: string | VariantData<string>[];
201
187
  /**
202
188
  * Freeform notes or tips about the badge.
203
189
  */
@@ -210,7 +196,7 @@ interface BadgeData {
210
196
  * The id used with the in-game `/settitle` command to apply the badge.
211
197
  * The first value is the id for primal characters and the (optional) second number is the id for praetorian characters.
212
198
  */
213
- readonly setTitleId?: [number, number?];
199
+ readonly setTitleId?: SetTitleData;
214
200
  /**
215
201
  * A description of the effect the badge will have, such as a buff or granting a temporary power.
216
202
  */
@@ -225,19 +211,45 @@ interface BadgeData {
225
211
  readonly ignoreInTotals?: boolean;
226
212
  }
227
213
 
228
- interface Change {
214
+ declare const ZONE_TYPE: readonly ["city", "echo", "tutorial", "trial", "hazard", "mayhem", "safeguard", "mission", "incarnate", "co-op", "pvp", "arena", "building", "other"];
215
+ type ZoneType = typeof ZONE_TYPE[number];
216
+
217
+ /**
218
+ * Can be an array of [min, max], just the [min], or a number representing the minimum value
219
+ */
220
+ type LevelRangeData = [number, number?] | number;
221
+
222
+ interface ZoneData {
223
+ /**
224
+ * Unique key used to reference this zone.
225
+ *
226
+ * Keys must be unique and can only contain lowercase letters, numbers and hyphens (`-`).
227
+ */
228
+ readonly key: string;
229
+ /**
230
+ * The name of the zone as it appears in-game.
231
+ */
232
+ readonly name: string;
233
+ /**
234
+ * The type of zone.
235
+ */
236
+ readonly type: ZoneType;
237
+ /**
238
+ * The character moralities that this zone is accessible by.
239
+ */
240
+ readonly morality?: MoralityExtended | MoralityExtended[];
229
241
  /**
230
- * The version number in {@link http://semver.org|semver} format.
242
+ * The level range this zone is recommended for.
231
243
  */
232
- version: string;
244
+ readonly levelRange?: LevelRangeData;
233
245
  /**
234
- * Date of the change.
246
+ * Freeform notes or tips about the zone.
235
247
  */
236
- date: Date;
248
+ readonly notes?: MarkdownString;
237
249
  /**
238
- * Description of the change.
250
+ * List of external links. Wiki, forums, etc.
239
251
  */
240
- description: MarkdownString;
252
+ readonly links?: Link[];
241
253
  }
242
254
 
243
255
  interface ContactData {
@@ -266,7 +278,7 @@ interface ContactData {
266
278
  /**
267
279
  * The level range this contact will offer missions for.
268
280
  */
269
- readonly levelRange?: [number, number?];
281
+ readonly levelRange?: LevelRangeData;
270
282
  /**
271
283
  * Freeform notes or tips about the contact.
272
284
  */
@@ -277,26 +289,32 @@ interface ContactData {
277
289
  readonly links?: Link[];
278
290
  }
279
291
 
280
- interface ZoneData {
292
+ declare const MISSION_TYPE: readonly ["story-arc", "mission", "task-force", "strike-force", "trial", "personal-story"];
293
+ type MissionType = typeof MISSION_TYPE[number];
294
+
295
+ interface MissionFlashbackData {
281
296
  /**
282
- * Unique key used to reference this zone.
283
- *
284
- * Keys must be unique and can only contain lowercase letters, numbers and hyphens (`-`).
297
+ * The id of the mission as seen in the Flashback menu, i.e. '14.01'.
285
298
  */
286
- readonly key: string;
299
+ readonly id: string;
287
300
  /**
288
- * The name of the zone as it appears in-game.
301
+ * The level range this mission appears under as a Flashback.
289
302
  */
290
- readonly name: string;
303
+ readonly levelRange?: LevelRangeData;
291
304
  /**
292
- * List of external links. Wiki, forums, etc.
305
+ * The name as it appears in the Flashback list. Leave undefined if the same as the base mission.
293
306
  */
294
- readonly links?: Link[];
307
+ readonly name?: string;
308
+ /**
309
+ * The character moralities that the mission will appear for in the Flashback list. Leave undefined if the same as the base mission.
310
+ */
311
+ readonly morality?: MoralityExtended | MoralityExtended[];
312
+ /**
313
+ * Freeform notes or tips about the Flashback version of the mission.
314
+ */
315
+ readonly notes?: MarkdownString;
295
316
  }
296
317
 
297
- declare const MISSION_TYPE: readonly ["story-arc", "mission", "task-force", "strike-force", "trial", "personal-story"];
298
- type MissionType = typeof MISSION_TYPE[number];
299
-
300
318
  interface MissionData {
301
319
  /**
302
320
  * Unique key used to reference this mission.
@@ -325,7 +343,7 @@ interface MissionData {
325
343
  /**
326
344
  * The level range this mission is available for.
327
345
  */
328
- readonly levelRange?: [number, number?];
346
+ readonly levelRange?: LevelRangeData;
329
347
  /**
330
348
  * Freeform notes or tips about the mission.
331
349
  */
@@ -339,49 +357,51 @@ interface MissionData {
339
357
  */
340
358
  readonly flashback?: MissionFlashbackData;
341
359
  }
342
- interface MissionFlashbackData {
343
- /**
344
- * The id of the mission as seen in the Flashback menu, i.e. '14.01'.
345
- */
346
- readonly id: string;
347
- /**
348
- * The level range this mission appears under as a Flashback. Leave undefined if the same as the base mission.
349
- */
350
- readonly levelRange?: [number, number?];
351
- /**
352
- * The name as it appears in the Flashback list. Leave undefined if the same as the base mission.
353
- */
354
- readonly name?: string;
355
- /**
356
- * The character moralities that the mission will appear for in the Flashback list. Leave undefined if the same as the base mission.
357
- */
358
- readonly morality?: MoralityExtended | MoralityExtended[];
359
- /**
360
- * Freeform notes or tips about the Flashback version of the mission.
361
- */
362
- readonly notes?: MarkdownString;
363
- }
364
360
 
365
361
  /**
366
- * A content bundle holds the data that makes up one forked instance of the game since the original sunset, such as Homecoming (https://forums.homecomingservers.com/).
362
+ * Metadata about a content bundle.
367
363
  */
368
- interface ContentBundle {
364
+ interface BundleHeaderData {
369
365
  /**
370
366
  * Name of the fork this bundle contains data for.
371
367
  */
372
368
  readonly name: string;
369
+ /**
370
+ * Version number for this data package.
371
+ */
372
+ readonly version: string;
373
+ /**
374
+ * The time this bundle was last updated.
375
+ *
376
+ * Must be an ISO-8601 string in UTC.
377
+ */
378
+ readonly lastUpdateTime: string;
373
379
  /**
374
380
  * Description of the fork.
375
381
  */
376
382
  readonly description?: MarkdownString;
377
383
  /**
378
- * Repository where the db content package is maintained.
384
+ * Url for the repository where the bundle is maintained.
379
385
  */
380
- readonly repository?: string;
386
+ readonly repositoryUrl?: string;
387
+ /**
388
+ * Url for the location of the changelog.
389
+ */
390
+ readonly changelogUrl?: string;
381
391
  /**
382
392
  * List of external links. Wiki, forums, etc.
383
393
  */
384
394
  readonly links?: Link[];
395
+ }
396
+
397
+ /**
398
+ * A bundle of game data from a forked instance of the game, such as Homecoming (https://forums.homecomingservers.com/).
399
+ */
400
+ interface BundleData {
401
+ /**
402
+ * Bundle header.
403
+ */
404
+ readonly header: BundleHeaderData;
385
405
  /**
386
406
  * List of the game server names in this fork.
387
407
  * Torchbearer, Excelsior, etc.
@@ -407,10 +427,14 @@ interface ContentBundle {
407
427
  * List of badges available on this fork.
408
428
  */
409
429
  readonly badges?: BadgeData[];
410
- /**
411
- * Change log for this data package.
412
- */
413
- readonly changelog?: Change[];
430
+ }
431
+
432
+ /**
433
+ * For badges, aspects like the name, icon, or badge text can vary depending on context, such as the alignment or sex of the character.
434
+ */
435
+ interface VariantContext {
436
+ readonly morality?: Morality | Alignment;
437
+ readonly sex?: Sex;
414
438
  }
415
439
 
416
440
  declare class AlignmentList {
@@ -425,29 +449,6 @@ declare class AlignmentList {
425
449
  has(alignment?: AlignmentExtended): boolean;
426
450
  }
427
451
 
428
- declare class Alternates<T> {
429
- #private;
430
- /**
431
- * Create an alternate set from either a list of categorized values, or a single value when there are no alternates.
432
- * @param value List of alternates, or a single value.
433
- */
434
- constructor(value: AlternateData<T>[] | T);
435
- getValue(alignment?: Alignment, sex?: Sex): T | undefined;
436
- /**
437
- * Get the default value for this list of alternates, the value with the highest priority and lowest specificity.
438
- */
439
- get default(): AlternateData<T> | undefined;
440
- /**
441
- * Get the list of alternates sorted in canonical order (alignment then sex, low to high specificity).
442
- */
443
- get canonical(): AlternateData<T>[];
444
- /**
445
- * Create a joined string from the alternate values in canonical order.
446
- * @param separator Separator to use. Default is ' / '
447
- */
448
- toString(separator: string): string;
449
- }
450
-
451
452
  declare class Archetype {
452
453
  readonly key: string;
453
454
  readonly name: string;
@@ -525,6 +526,38 @@ declare class BadgeRequirement {
525
526
  constructor(data: BadgeRequirementData);
526
527
  }
527
528
 
529
+ declare class Variants<T> {
530
+ #private;
531
+ /**
532
+ * Create a variant set from either a list of categorized values, or a single value when there are no variants.
533
+ * @param value List of variants, or a single value.
534
+ */
535
+ constructor(value: VariantData<T>[] | T);
536
+ /**
537
+ * Get a variant by context
538
+ * @param context The context
539
+ */
540
+ getVariant(context?: VariantContext): VariantData<T> | undefined;
541
+ /**
542
+ * Get a value by variant context
543
+ * @param context The context
544
+ */
545
+ getValue(context?: VariantContext): T | undefined;
546
+ /**
547
+ * Get the default value for this list of variants, the value with the highest priority and lowest specificity.
548
+ */
549
+ get default(): VariantData<T> | undefined;
550
+ /**
551
+ * Get the list of variants sorted in canonical order (alignment then sex, low to high specificity).
552
+ */
553
+ get canonical(): VariantData<T>[];
554
+ /**
555
+ * Create a joined string from the variant values in canonical order.
556
+ * @param separator Separator to use. Default is ' / '
557
+ */
558
+ toString(separator: string): string;
559
+ }
560
+
528
561
  declare class MoralityList {
529
562
  #private;
530
563
  readonly hero: boolean;
@@ -545,6 +578,12 @@ declare class MoralityList {
545
578
  has(morality?: MoralityExtended): boolean;
546
579
  }
547
580
 
581
+ declare class SetTitleIds {
582
+ readonly primal: number;
583
+ readonly praetorian?: number;
584
+ constructor(value: SetTitleData);
585
+ }
586
+
548
587
  declare class Badge {
549
588
  #private;
550
589
  /**
@@ -560,7 +599,11 @@ declare class Badge {
560
599
  *
561
600
  * May vary by character sex or alignment.
562
601
  */
563
- readonly name: Alternates<string>;
602
+ readonly name: Variants<string>;
603
+ /**
604
+ * The date that the badge was added to the game.
605
+ */
606
+ readonly releaseDate: Date;
564
607
  /**
565
608
  * The character moralities that this badge is available to.
566
609
  */
@@ -568,7 +611,7 @@ declare class Badge {
568
611
  /**
569
612
  * The badge text as it appears in-game. May vary by character sex or alignment.
570
613
  */
571
- readonly badgeText: Alternates<MarkdownString>;
614
+ readonly badgeText: Variants<MarkdownString>;
572
615
  /**
573
616
  * Short description of how to acquire the badge. Detailed instructions will be in the notes field.
574
617
  */
@@ -578,7 +621,7 @@ declare class Badge {
578
621
  *
579
622
  * May vary by character sex or alignment.
580
623
  */
581
- readonly icon: Alternates<string>;
624
+ readonly icon: Variants<string>;
582
625
  /**
583
626
  * Freeform notes or tips about the badge.
584
627
  */
@@ -591,21 +634,21 @@ declare class Badge {
591
634
  * The id used with the in-game `/settitle` command to apply the badge.
592
635
  * The first value is the id for primal characters and the (optional) second number is the id for praetorian characters.
593
636
  */
594
- readonly setTitleId?: [number, number?];
637
+ readonly setTitleId?: SetTitleIds;
595
638
  /**
596
639
  * A description of the effect the badge will have, such as a buff or granting a temporary power.
597
640
  */
598
641
  readonly effect?: MarkdownString;
599
- /**
600
- * Represents the requirements for badges with multiple fulfillment steps, such as visiting monuments for history badges, completing missions, or collecting other badges.
601
- */
602
- readonly requirements?: BadgeRequirement[];
603
642
  /**
604
643
  * 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.
605
644
  */
606
645
  readonly ignoreInTotals: boolean;
607
646
  constructor(badgeData: BadgeData);
608
- getRequirement(key: string): BadgeRequirement;
647
+ /**
648
+ * Represents the requirements for badges with multiple fulfillment steps, such as visiting monuments for history badges, completing missions, or collecting other badges.
649
+ */
650
+ get requirements(): BadgeRequirement[];
651
+ getRequirement(key: string): BadgeRequirement | undefined;
609
652
  /**
610
653
  * Return a list of all the zone keys referenced by this badge.
611
654
  */
@@ -615,9 +658,12 @@ declare class Badge {
615
658
  */
616
659
  get zoneKey(): string | undefined;
617
660
  }
618
- declare function compareByDefaultName(a?: Badge, b?: Badge): number;
661
+ declare function compareByName(a?: Badge, b?: Badge, context?: VariantContext): number;
619
662
  declare function compareByZoneKey(a?: Badge, b?: Badge): number;
663
+ declare function compareByReleaseDate(a?: Badge, b?: Badge): number;
620
664
 
665
+ type BadgeQueryableField = 'name' | 'badge-text' | 'acquisition' | 'notes' | 'effect' | 'set-title-id';
666
+ type BadgeSort = `${'canonical' | 'name' | 'zone-key' | 'release-date'}.${'asc' | 'desc'}`;
621
667
  interface BadgeSearchOptions {
622
668
  /**
623
669
  * Text-based search.
@@ -626,14 +672,7 @@ interface BadgeSearchOptions {
626
672
  */
627
673
  query?: {
628
674
  str?: string;
629
- on?: {
630
- name?: boolean;
631
- badgeText?: boolean;
632
- acquisition?: boolean;
633
- notes?: boolean;
634
- effect?: boolean;
635
- setTitle?: boolean;
636
- };
675
+ fields?: BadgeQueryableField[];
637
676
  };
638
677
  /**
639
678
  * Filter results matching the given values.
@@ -641,17 +680,19 @@ interface BadgeSearchOptions {
641
680
  filter?: {
642
681
  type?: BadgeType;
643
682
  zoneKey?: string;
644
- morality?: MoralityExtended;
683
+ morality?: Morality;
684
+ predicate?: (badge: Badge) => boolean;
645
685
  };
686
+ /**
687
+ * Adjust search results based on a given variant context (morality or sex of a character).
688
+ */
689
+ context?: VariantContext;
646
690
  /**
647
691
  * Sort results.
648
692
  *
649
693
  * Badges are assumed to be in canonical order in the content bundle, and should match the in-game display order.
650
694
  */
651
- sort?: {
652
- by?: 'canonical' | 'badge-name' | 'zone-key';
653
- dir?: 'asc' | 'desc';
654
- };
695
+ sort?: BadgeSort;
655
696
  /**
656
697
  * The page (1-based)
657
698
  */
@@ -664,29 +705,30 @@ interface BadgeSearchOptions {
664
705
 
665
706
  interface Paged<T> {
666
707
  items: T[];
667
- page: number;
708
+ matchedItemCount: number;
709
+ totalItemCount: number;
668
710
  pageSize?: number;
669
- totalItems: number;
670
- totalPages: number;
711
+ pageIndex: number;
712
+ pageNumber: number;
713
+ totalPageCount: number;
671
714
  }
672
715
 
673
716
  type KeysOfType<T, V> = {
674
717
  [P in keyof T]: T[P] extends V ? P : never;
675
718
  }[keyof T];
676
719
  declare class AbstractIndex<T> {
677
- #private;
678
720
  protected _values: T[];
679
721
  protected _hashTable: Record<string, T>;
680
- constructor(keyField: KeysOfType<T, string>);
681
722
  /**
682
- * Return all indexed values
723
+ * Create a new index.
724
+ * @param keyField The field of the values that will act as the key.
725
+ * @param values Values to index.
683
726
  */
684
- get values(): T[];
727
+ constructor(keyField: KeysOfType<T, string>, values: T[] | undefined);
685
728
  /**
686
- * Load the given list of values into the index, replacing any existing data.
687
- * @param values List of values.
729
+ * Return all indexed values
688
730
  */
689
- load(values: T[] | undefined): void;
731
+ get values(): T[];
690
732
  /**
691
733
  * Get a value from the index
692
734
  * @param key Key string
@@ -696,36 +738,46 @@ declare class AbstractIndex<T> {
696
738
 
697
739
  declare class BadgeIndex extends AbstractIndex<Badge> {
698
740
  #private;
699
- constructor();
741
+ constructor(values: Badge[] | undefined);
700
742
  search(options?: BadgeSearchOptions): Paged<Badge>;
701
743
  }
702
744
 
703
- declare class BundleMetadata {
745
+ declare class BundleHeader {
704
746
  /**
705
- * Name of the content bundle.
747
+ * Name of the fork this bundle contains data for.
706
748
  */
707
749
  readonly name: string;
708
750
  /**
709
- * Description of the fork.
751
+ * Version number for this data package.
710
752
  */
711
- readonly description?: MarkdownString;
753
+ readonly version: string;
712
754
  /**
713
- * Repository where the db content package is maintained.
755
+ * The time this bundle was last updated.
714
756
  */
715
- readonly repository?: string;
757
+ readonly lastUpdateTime: Date;
716
758
  /**
717
- * List of external links. Wiki, forums, etc.
759
+ * Description of the fork.
718
760
  */
719
- readonly links?: Link[];
761
+ readonly description?: MarkdownString;
762
+ /**
763
+ * Url for the repository where the bundle is maintained.
764
+ */
765
+ readonly repositoryUrl?: string;
720
766
  /**
721
- * Change log for this data package.
767
+ * Url for the location of the changelog.
722
768
  */
723
- readonly changelog?: Change[];
769
+ readonly changelogUrl?: string;
724
770
  /**
725
- * The current version of the data package.
771
+ * List of external links. Wiki, forums, etc.
726
772
  */
727
- readonly version?: string;
728
- constructor(bundle: ContentBundle);
773
+ readonly links?: Link[];
774
+ constructor(data: BundleHeaderData);
775
+ }
776
+
777
+ declare class LevelRange {
778
+ readonly min: number;
779
+ readonly max?: number;
780
+ constructor(value: LevelRangeData);
729
781
  }
730
782
 
731
783
  declare class Zone {
@@ -739,6 +791,22 @@ declare class Zone {
739
791
  * The name of the zone as it appears in-game.
740
792
  */
741
793
  readonly name: string;
794
+ /**
795
+ * The type of zone.
796
+ */
797
+ readonly type: ZoneType;
798
+ /**
799
+ * The character moralities that this zone is accessible by.
800
+ */
801
+ readonly morality: MoralityList;
802
+ /**
803
+ * The level range this zone is recommended for.
804
+ */
805
+ readonly levelRange?: LevelRange;
806
+ /**
807
+ * Freeform notes or tips about the zone.
808
+ */
809
+ readonly notes?: MarkdownString;
742
810
  /**
743
811
  * List of external links. Wiki, forums, etc.
744
812
  */
@@ -764,7 +832,7 @@ declare class Contact {
764
832
  /**
765
833
  * The character moralities that this contact will interact with.
766
834
  */
767
- readonly morality?: MoralityList;
835
+ readonly morality: MoralityList;
768
836
  /**
769
837
  * The location of this contact.
770
838
  */
@@ -772,7 +840,7 @@ declare class Contact {
772
840
  /**
773
841
  * The level range this contact will offer missions for.
774
842
  */
775
- readonly levelRange?: [number, number?];
843
+ readonly levelRange?: LevelRange;
776
844
  /**
777
845
  * Freeform notes or tips about the contact.
778
846
  */
@@ -812,7 +880,7 @@ declare class Mission {
812
880
  /**
813
881
  * The level range this mission is available for.
814
882
  */
815
- readonly levelRange?: [number, number?];
883
+ readonly levelRange?: LevelRange;
816
884
  /**
817
885
  * Freeform notes or tips about the mission.
818
886
  */
@@ -830,17 +898,17 @@ declare class Mission {
830
898
  */
831
899
  readonly id: string;
832
900
  /**
833
- * The level range this mission appears under as a Flashback. Leave undefined if the same as the base mission.
901
+ * The level range this mission appears under as a Flashback.
834
902
  */
835
- readonly levelRange?: [number, number?];
903
+ readonly levelRange?: LevelRange;
836
904
  /**
837
- * The name as it appears in the Flashback list. Leave undefined if the same as the base mission.
905
+ * The name as it appears in the Flashback list.
838
906
  */
839
- readonly name?: string;
907
+ readonly name: string;
840
908
  /**
841
- * The character moralities that the mission will appear for in the Flashback list. Leave undefined if the same as the base mission.
909
+ * The character moralities that the mission will appear for in the Flashback list.
842
910
  */
843
- readonly morality?: MoralityList;
911
+ readonly morality: MoralityList;
844
912
  /**
845
913
  * Freeform notes or tips about the Flashback version of the mission.
846
914
  */
@@ -852,14 +920,14 @@ declare class Mission {
852
920
  declare class CohContentDatabase {
853
921
  #private;
854
922
  /**
855
- * Load the given content bundle, resetting the db if a bundle is already loaded.
923
+ * Create a db instance from the given content bundle.
856
924
  * @param bundle The bundle to load.
857
925
  */
858
- load(bundle: ContentBundle): void;
926
+ constructor(bundle: BundleData);
859
927
  /**
860
- * Metadata about the content bundle.
928
+ * Header information about the content bundle.
861
929
  */
862
- get metadata(): BundleMetadata | undefined;
930
+ get header(): BundleHeader;
863
931
  /**
864
932
  * List of the game server names.
865
933
  *
@@ -926,8 +994,6 @@ declare class Key {
926
994
  get value(): string;
927
995
  }
928
996
 
929
- declare const CHANGELOG: Change[];
930
-
931
997
  /**
932
998
  * Returns the URI of the given badge that can be used in {@link MarkdownString} fields.
933
999
  *
@@ -992,15 +1058,6 @@ declare function zoneUri(target: string | Zone | ZoneData): string;
992
1058
  * @param target The {@link Zone} or zone key to target.
993
1059
  */
994
1060
  declare function zoneLink(target: string | Zone | ZoneData): string;
995
- /**
996
- * For fields that accept either an array of values or a single value, coalesces the value to an array.
997
- *
998
- * Arrays are returned as-is.
999
- * Single values are returned as a single-value array.
1000
- * Undefined values are returned as undefined.
1001
- *
1002
- * @param value The value to coalesce.
1003
- */
1004
- declare function coalesceToArray<T>(value?: T | T[]): T[] | undefined;
1005
1061
 
1006
- export { ALIGNMENT, type Alignment, type AlignmentExtended, AlignmentList, type AlternateData, Alternates, Archetype, type ArchetypeData, BADGE_REQUIREMENT_TYPE, BADGE_TYPE, Badge, type BadgeData, BadgeIndex, BadgeRequirement, type BadgeRequirementData, type BadgeRequirementType, type BadgeSearchOptions, type BadgeType, BundleMetadata, CHANGELOG, type Change, CohContentDatabase, Contact, type ContactData, type ContentBundle, type Coords, ENHANCEMENT_CATEGORY, type EnhancementCategory, Key, type Link, Location, type LocationData, type LocationIcon, MISSION_TYPE, MORALITY, type MarkdownString, Mission, type MissionData, type MissionFlashbackData, type MissionType, type Morality, type MoralityExtended, MoralityList, type Paged, SEX, type Sex, Zone, type ZoneData, badgeLink, badgeUri, coalesceToArray, compareAlignment, compareByDefaultName, compareByZoneKey, compareSex, contactLink, contactUri, missionLink, missionUri, zoneLink, zoneUri };
1062
+ export { ALIGNMENT, AlignmentList, Archetype, BADGE_REQUIREMENT_TYPE, BADGE_TYPE, Badge, BadgeIndex, BadgeRequirement, BundleHeader, CohContentDatabase, Contact, ENHANCEMENT_CATEGORY, Key, LevelRange, Location, MISSION_TYPE, MORALITY, MORALITY_EXTENDED, Mission, MoralityList, MoralityMap, SEX, SetTitleIds, Variants, ZONE_TYPE, Zone, badgeLink, badgeUri, compareAlignment, compareByName, compareByReleaseDate, compareByZoneKey, compareSex, contactLink, contactUri, missionLink, missionUri, zoneLink, zoneUri };
1063
+ export type { Alignment, AlignmentExtended, ArchetypeData, BadgeData, BadgeQueryableField, BadgeRequirementData, BadgeRequirementType, BadgeSearchOptions, BadgeSort, BadgeType, BundleData, BundleHeaderData, ContactData, Coords, EnhancementCategory, LevelRangeData, Link, LocationData, LocationIcon, MarkdownString, MissionData, MissionFlashbackData, MissionType, Morality, MoralityExtended, Paged, SetTitleData, Sex, VariantContext, VariantData, ZoneData, ZoneType };