coh-content-db 2.0.0-rc.8 → 2.0.0-rc.9

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,38 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [2.0.0-rc.9] - 2025-04-15
9
+
10
+ ### Added
11
+ - Introduced a simple indexing and search function for badge names, text, and acquisition info.
12
+ - Enabled formal support for Missions and Contacts in badge requirements.
13
+ - Added GitHub Actions for continuous integration (CI).
14
+ - Included `eslint` for linting.
15
+ - Added `jest` for unit testing.
16
+ - CHANGELOG.md
17
+
18
+ ### Changed
19
+ - Redundant interfaces have been replaced with their concrete equivalents.
20
+ - Server groups are now referred to as "forks".
21
+ - Enum types were replaced with union types, and values now use `kebab-case`.
22
+ - The `IServerGroupData` interface was renamed to `BundleData`, and databases are now scoped to a single bundle.
23
+ - `GameMap` was renamed to `Zone`.
24
+ - Badge partials are now referred to as badge requirements.
25
+ - Exploration badge locations were moved into the badge requirements list.
26
+ - References to zones and badges now use a standard Markdown link format (`badge://`, `map://`).
27
+ - Some field names were updated for consistent pluralization (e.g., `name`, `icon`).
28
+ - `VidiotMap` data was folded into `Location` data.
29
+ - `settitle` IDs were consolidated into a single tuple field.
30
+ - Bundle metadata is now found in the `BundleData.header` field.
31
+ - The project license was changed from GNU to [The Unlicense](https://unlicense.org/).
32
+ - Switched the build system from Webpack to Rollup.
33
+
34
+ ### Removed
35
+ - The `serverGroup` property was removed from entities to simplify the object model, since only one context is allowed per database.
36
+ - All third-party dependencies were removed.
37
+ - VidiotMap data was removed from the Zone API.
38
+ - Changelog API is removed in favor of the CHANGELOG.md file in the repository.
package/README.md CHANGED
@@ -8,6 +8,10 @@
8
8
 
9
9
  City of Heroes Content Database
10
10
 
11
+ # Change Log
12
+
13
+ [CHANGELOG.md](CHANGELOG.md)
14
+
11
15
  # Installation
12
16
 
13
17
  ```
@@ -41,14 +45,14 @@ export const TEST_BADGE: BadgeData = {
41
45
  }
42
46
  ```
43
47
 
44
- Then, create a `ContentBundle` instance and load your content into the appropriate field.
48
+ Then, create a `BundleData` instance and load your content into the appropriate field.
45
49
 
46
50
  ```typescript
47
- import { ContentBundle } from './content-bundle'
51
+ import { BundleData } from 'coh-content-db'
48
52
  import { TEST_BADGE } from './test-badge'
49
53
 
50
- export const MY_CONTENT_BUNDLE: ContentBundle = {
51
- name: 'My Content Bundle',
54
+ export const MY_CONTENT_BUNDLE: BundleData = {
55
+ header: { name: 'My Content Bundle' },
52
56
  badges: [TEST_BADGE],
53
57
  }
54
58
  ```
@@ -83,10 +87,23 @@ Create a new database instance, then load a content bundle, such as [coh-content
83
87
 
84
88
  ```typescript
85
89
  import { CohContentDatabase } from 'coh-content-db'
86
- import { Homecoming } from 'coh-content-db-homecoming'
90
+ import { HOMECOMING } from 'coh-content-db-homecoming'
91
+
92
+ const database = new CohContentDatabase()
93
+
94
+ database.load(HOMECOMING)
95
+ ```
96
+
97
+ or from a JSON object:
98
+
99
+ ```typescript
100
+ import { BundleData, CohContentDatabase } from 'coh-content-db'
101
+
102
+ const database = new CohContentDatabase()
87
103
 
88
- const db = new CohContentDatabase()
89
- db.loadBundle(new Homecoming())
104
+ const response = await fetch('https://n15g.github.io/coh-content-db-homecoming/bundle.json')
105
+ const bundle = await response.json() as BundleData
106
+ database.load(bundle)
90
107
  ```
91
108
 
92
109
  #### Access the content
@@ -225,19 +225,21 @@ interface BadgeData {
225
225
  readonly ignoreInTotals?: boolean;
226
226
  }
227
227
 
228
- interface Change {
228
+ interface ZoneData {
229
229
  /**
230
- * The version number in {@link http://semver.org|semver} format.
230
+ * Unique key used to reference this zone.
231
+ *
232
+ * Keys must be unique and can only contain lowercase letters, numbers and hyphens (`-`).
231
233
  */
232
- version: string;
234
+ readonly key: string;
233
235
  /**
234
- * Date of the change.
236
+ * The name of the zone as it appears in-game.
235
237
  */
236
- date: Date;
238
+ readonly name: string;
237
239
  /**
238
- * Description of the change.
240
+ * List of external links. Wiki, forums, etc.
239
241
  */
240
- description: MarkdownString;
242
+ readonly links?: Link[];
241
243
  }
242
244
 
243
245
  interface ContactData {
@@ -277,23 +279,6 @@ interface ContactData {
277
279
  readonly links?: Link[];
278
280
  }
279
281
 
280
- interface ZoneData {
281
- /**
282
- * Unique key used to reference this zone.
283
- *
284
- * Keys must be unique and can only contain lowercase letters, numbers and hyphens (`-`).
285
- */
286
- readonly key: string;
287
- /**
288
- * The name of the zone as it appears in-game.
289
- */
290
- readonly name: string;
291
- /**
292
- * List of external links. Wiki, forums, etc.
293
- */
294
- readonly links?: Link[];
295
- }
296
-
297
282
  declare const MISSION_TYPE: readonly ["story-arc", "mission", "task-force", "strike-force", "trial", "personal-story"];
298
283
  type MissionType = typeof MISSION_TYPE[number];
299
284
 
@@ -363,25 +348,43 @@ interface MissionFlashbackData {
363
348
  }
364
349
 
365
350
  /**
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/).
351
+ * Metadata about a content bundle.
367
352
  */
368
- interface ContentBundle {
353
+ interface BundleHeaderData {
369
354
  /**
370
355
  * Name of the fork this bundle contains data for.
371
356
  */
372
- readonly name: string;
357
+ readonly name?: string;
373
358
  /**
374
359
  * Description of the fork.
375
360
  */
376
361
  readonly description?: MarkdownString;
377
362
  /**
378
- * Repository where the db content package is maintained.
363
+ * Url for the repository where the bundle is maintained.
364
+ */
365
+ readonly repositoryUrl?: string;
366
+ /**
367
+ * Url for the location of the changelog.
379
368
  */
380
- readonly repository?: string;
369
+ readonly changelogUrl?: string;
381
370
  /**
382
371
  * List of external links. Wiki, forums, etc.
383
372
  */
384
373
  readonly links?: Link[];
374
+ /**
375
+ * Version number for this data package.
376
+ */
377
+ readonly version?: string;
378
+ }
379
+
380
+ /**
381
+ * A bundle of game data from a forked instance of the game, such as Homecoming (https://forums.homecomingservers.com/).
382
+ */
383
+ interface BundleData {
384
+ /**
385
+ * Bundle header.
386
+ */
387
+ readonly header?: BundleHeaderData;
385
388
  /**
386
389
  * List of the game server names in this fork.
387
390
  * Torchbearer, Excelsior, etc.
@@ -407,10 +410,6 @@ interface ContentBundle {
407
410
  * List of badges available on this fork.
408
411
  */
409
412
  readonly badges?: BadgeData[];
410
- /**
411
- * Change log for this data package.
412
- */
413
- readonly changelog?: Change[];
414
413
  }
415
414
 
416
415
  declare class AlignmentList {
@@ -700,32 +699,32 @@ declare class BadgeIndex extends AbstractIndex<Badge> {
700
699
  search(options?: BadgeSearchOptions): Paged<Badge>;
701
700
  }
702
701
 
703
- declare class BundleMetadata {
702
+ declare class BundleHeader {
704
703
  /**
705
704
  * Name of the content bundle.
706
705
  */
707
- readonly name: string;
706
+ readonly name?: string;
708
707
  /**
709
708
  * Description of the fork.
710
709
  */
711
710
  readonly description?: MarkdownString;
712
711
  /**
713
- * Repository where the db content package is maintained.
712
+ * Url for the repository where the bundle is maintained.
714
713
  */
715
- readonly repository?: string;
714
+ readonly repositoryUrl?: string;
716
715
  /**
717
- * List of external links. Wiki, forums, etc.
716
+ * Url for the location of the changelog.
718
717
  */
719
- readonly links?: Link[];
718
+ readonly changelogUrl?: string;
720
719
  /**
721
- * Change log for this data package.
720
+ * List of external links. Wiki, forums, etc.
722
721
  */
723
- readonly changelog?: Change[];
722
+ readonly links?: Link[];
724
723
  /**
725
724
  * The current version of the data package.
726
725
  */
727
726
  readonly version?: string;
728
- constructor(bundle: ContentBundle);
727
+ constructor(data: BundleHeaderData | undefined);
729
728
  }
730
729
 
731
730
  declare class Zone {
@@ -855,11 +854,11 @@ declare class CohContentDatabase {
855
854
  * Load the given content bundle, resetting the db if a bundle is already loaded.
856
855
  * @param bundle The bundle to load.
857
856
  */
858
- load(bundle: ContentBundle): void;
857
+ load(bundle: BundleData): void;
859
858
  /**
860
- * Metadata about the content bundle.
859
+ * Header information about the content bundle.
861
860
  */
862
- get metadata(): BundleMetadata | undefined;
861
+ get header(): BundleHeader | undefined;
863
862
  /**
864
863
  * List of the game server names.
865
864
  *
@@ -926,8 +925,6 @@ declare class Key {
926
925
  get value(): string;
927
926
  }
928
927
 
929
- declare const CHANGELOG: Change[];
930
-
931
928
  /**
932
929
  * Returns the URI of the given badge that can be used in {@link MarkdownString} fields.
933
930
  *
@@ -1003,4 +1000,4 @@ declare function zoneLink(target: string | Zone | ZoneData): string;
1003
1000
  */
1004
1001
  declare function coalesceToArray<T>(value?: T | T[]): T[] | undefined;
1005
1002
 
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 };
1003
+ 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, type BundleData, BundleHeader, type BundleHeaderData, CohContentDatabase, Contact, type ContactData, 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 };
@@ -688,8 +688,8 @@ sort_fn = function(badges, sort) {
688
688
  var __defProp$4 = Object.defineProperty;
689
689
  var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
690
690
  var __publicField$4 = (obj, key, value) => __defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
691
- class BundleMetadata {
692
- constructor(bundle) {
691
+ class BundleHeader {
692
+ constructor(data) {
693
693
  /**
694
694
  * Name of the content bundle.
695
695
  */
@@ -699,27 +699,27 @@ class BundleMetadata {
699
699
  */
700
700
  __publicField$4(this, "description");
701
701
  /**
702
- * Repository where the db content package is maintained.
702
+ * Url for the repository where the bundle is maintained.
703
703
  */
704
- __publicField$4(this, "repository");
704
+ __publicField$4(this, "repositoryUrl");
705
705
  /**
706
- * List of external links. Wiki, forums, etc.
706
+ * Url for the location of the changelog.
707
707
  */
708
- __publicField$4(this, "links");
708
+ __publicField$4(this, "changelogUrl");
709
709
  /**
710
- * Change log for this data package.
710
+ * List of external links. Wiki, forums, etc.
711
711
  */
712
- __publicField$4(this, "changelog");
712
+ __publicField$4(this, "links");
713
713
  /**
714
714
  * The current version of the data package.
715
715
  */
716
716
  __publicField$4(this, "version");
717
- this.name = bundle.name;
718
- this.description = bundle.description;
719
- this.repository = bundle.repository;
720
- this.links = bundle.links ?? [];
721
- this.changelog = bundle.changelog ?? [];
722
- this.version = this.changelog?.at(-1)?.version;
717
+ this.name = data?.name;
718
+ this.description = data?.description;
719
+ this.repositoryUrl = data?.repositoryUrl;
720
+ this.changelogUrl = data?.changelogUrl;
721
+ this.links = data?.links ?? [];
722
+ this.version = data?.version;
723
723
  }
724
724
  }
725
725
 
@@ -872,7 +872,7 @@ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot
872
872
  var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
873
873
  var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
874
874
  var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
875
- var _archetypeIndex, _zoneIndex, _contactIndex, _missionIndex, _badgeIndex, _metadata, _servers;
875
+ var _archetypeIndex, _zoneIndex, _contactIndex, _missionIndex, _badgeIndex, _header, _servers;
876
876
  class CohContentDatabase {
877
877
  constructor() {
878
878
  __privateAdd(this, _archetypeIndex, new AbstractIndex("key"));
@@ -880,7 +880,7 @@ class CohContentDatabase {
880
880
  __privateAdd(this, _contactIndex, new AbstractIndex("key"));
881
881
  __privateAdd(this, _missionIndex, new AbstractIndex("key"));
882
882
  __privateAdd(this, _badgeIndex, new BadgeIndex());
883
- __privateAdd(this, _metadata);
883
+ __privateAdd(this, _header);
884
884
  __privateAdd(this, _servers);
885
885
  }
886
886
  /**
@@ -888,7 +888,7 @@ class CohContentDatabase {
888
888
  * @param bundle The bundle to load.
889
889
  */
890
890
  load(bundle) {
891
- __privateSet(this, _metadata, new BundleMetadata(bundle));
891
+ __privateSet(this, _header, new BundleHeader(bundle.header));
892
892
  __privateSet(this, _servers, bundle.servers ?? []);
893
893
  __privateGet(this, _archetypeIndex).load(bundle.archetypes?.map((x) => new Archetype(x)));
894
894
  __privateGet(this, _zoneIndex).load(bundle.zones?.map((x) => new Zone(x)));
@@ -897,10 +897,10 @@ class CohContentDatabase {
897
897
  __privateGet(this, _badgeIndex).load(bundle.badges?.map((x) => new Badge(x)));
898
898
  }
899
899
  /**
900
- * Metadata about the content bundle.
900
+ * Header information about the content bundle.
901
901
  */
902
- get metadata() {
903
- return __privateGet(this, _metadata);
902
+ get header() {
903
+ return __privateGet(this, _header);
904
904
  }
905
905
  /**
906
906
  * List of the game server names.
@@ -990,7 +990,7 @@ _zoneIndex = new WeakMap();
990
990
  _contactIndex = new WeakMap();
991
991
  _missionIndex = new WeakMap();
992
992
  _badgeIndex = new WeakMap();
993
- _metadata = new WeakMap();
993
+ _header = new WeakMap();
994
994
  _servers = new WeakMap();
995
995
 
996
996
  var __defProp = Object.defineProperty;
@@ -1021,34 +1021,6 @@ class Location {
1021
1021
  }
1022
1022
  }
1023
1023
 
1024
- const CHANGELOG = [
1025
- {
1026
- version: "2.0.0",
1027
- date: /* @__PURE__ */ new Date("2025-03-12"),
1028
- description: `* Replaced redundant interfaces with their concrete equivalents.
1029
- * Server groups are now referred to as 'forks'.
1030
- * Replaced enums with union types and changed values to \`kebab-case\`.
1031
- * \`IServerGroupData\` is now \`ContentBundle\` and each database instance is now designed to accept only a single bundle.
1032
- * \`GameMap\` is now \`Zone\`.
1033
- * Removed the \`serverGroup\` property from entities to simplify the object tree given that only a single context can exist per db now.
1034
- * Added a simple indexing and search function for badge names, text and acquisition info.
1035
- * Zone and badge references now follow a standard Markdown link format with a \`badge://\` or \`map://\` protocol.
1036
- * Badge partials are now known as badge requirements.
1037
- * Removed the \`VidiotMap\` API as it was never used or fleshed out properly.
1038
- * Added formal support for Missions and Contacts in badge requirements.
1039
- * Move exploration badge locations into badge requirement list.
1040
- * Standardized pluralization of some field names (name, icon).
1041
- * Combined \`settitle\` ids into a single tuple field.
1042
- * Change from GNU to The Unlicense.
1043
- * Removed all third-party dependencies.
1044
- * Moved from webpack to rollup for packaging.
1045
- * Add eslint for linting.
1046
- * Add jest for unit tests.
1047
- * Added GitHub Actions for CI.
1048
- `
1049
- }
1050
- ];
1051
-
1052
1024
  exports.ALIGNMENT = ALIGNMENT;
1053
1025
  exports.AlignmentList = AlignmentList;
1054
1026
  exports.Alternates = Alternates;
@@ -1058,8 +1030,7 @@ exports.BADGE_TYPE = BADGE_TYPE;
1058
1030
  exports.Badge = Badge;
1059
1031
  exports.BadgeIndex = BadgeIndex;
1060
1032
  exports.BadgeRequirement = BadgeRequirement;
1061
- exports.BundleMetadata = BundleMetadata;
1062
- exports.CHANGELOG = CHANGELOG;
1033
+ exports.BundleHeader = BundleHeader;
1063
1034
  exports.CohContentDatabase = CohContentDatabase;
1064
1035
  exports.Contact = Contact;
1065
1036
  exports.ENHANCEMENT_CATEGORY = ENHANCEMENT_CATEGORY;