coh-content-db 2.0.0-rc.1 → 2.0.0-rc.3

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.
@@ -64,25 +64,25 @@ const PLAQUE_TYPE = [
64
64
 
65
65
  const SEX = ["M", "F"];
66
66
 
67
- var __typeError$4 = (msg) => {
67
+ var __typeError$3 = (msg) => {
68
68
  throw TypeError(msg);
69
69
  };
70
- var __accessCheck$4 = (obj, member, msg) => member.has(obj) || __typeError$4("Cannot " + msg);
71
- var __privateGet$4 = (obj, member, getter) => (__accessCheck$4(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
72
- var __privateAdd$4 = (obj, member, value) => member.has(obj) ? __typeError$4("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
73
- var __privateSet$1 = (obj, member, value, setter) => (__accessCheck$4(obj, member, "write to private field"), member.set(obj, value), value);
74
- var __privateMethod$1 = (obj, member, method) => (__accessCheck$4(obj, member, "access private method"), method);
70
+ var __accessCheck$3 = (obj, member, msg) => member.has(obj) || __typeError$3("Cannot " + msg);
71
+ var __privateGet$3 = (obj, member, getter) => (__accessCheck$3(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
72
+ 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);
73
+ var __privateSet$1 = (obj, member, value, setter) => (__accessCheck$3(obj, member, "write to private field"), member.set(obj, value), value);
74
+ var __privateMethod$1 = (obj, member, method) => (__accessCheck$3(obj, member, "access private method"), method);
75
75
  var _value, _Key_instances, validateKey_fn;
76
76
  const INVALID_KEY_PATTERN = /[^a-z0-9-]/;
77
77
  class Key {
78
78
  constructor(value) {
79
- __privateAdd$4(this, _Key_instances);
80
- __privateAdd$4(this, _value);
79
+ __privateAdd$3(this, _Key_instances);
80
+ __privateAdd$3(this, _value);
81
81
  __privateMethod$1(this, _Key_instances, validateKey_fn).call(this, value);
82
82
  __privateSet$1(this, _value, value);
83
83
  }
84
84
  get value() {
85
- return __privateGet$4(this, _value);
85
+ return __privateGet$3(this, _value);
86
86
  }
87
87
  }
88
88
  _value = new WeakMap();
@@ -91,37 +91,37 @@ validateKey_fn = function(key) {
91
91
  if (INVALID_KEY_PATTERN.test(key)) throw new Error(`Invalid key: [${key}]; Keys can only contain lowercase characters, numbers and dashes.`);
92
92
  };
93
93
 
94
- var __defProp$6 = Object.defineProperty;
95
- var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
96
- var __publicField$6 = (obj, key, value) => __defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
94
+ var __defProp$7 = Object.defineProperty;
95
+ var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
96
+ var __publicField$7 = (obj, key, value) => __defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
97
97
  class Archetype {
98
98
  constructor(data) {
99
- __publicField$6(this, "key");
100
- __publicField$6(this, "name");
101
- __publicField$6(this, "description");
99
+ __publicField$7(this, "key");
100
+ __publicField$7(this, "name");
101
+ __publicField$7(this, "description");
102
102
  this.key = new Key(data.key).value;
103
103
  this.name = data.name;
104
104
  this.description = data.description;
105
105
  }
106
106
  }
107
107
 
108
- var __defProp$5 = Object.defineProperty;
109
- var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
110
- var __publicField$5 = (obj, key, value) => __defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
108
+ var __defProp$6 = Object.defineProperty;
109
+ var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
110
+ var __publicField$6 = (obj, key, value) => __defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
111
111
  class BadgePartial {
112
112
  constructor(data) {
113
- __publicField$5(this, "key");
114
- __publicField$5(this, "type");
115
- __publicField$5(this, "mapKey");
116
- __publicField$5(this, "loc");
117
- __publicField$5(this, "plaqueType");
118
- __publicField$5(this, "inscription");
119
- __publicField$5(this, "vidiotMapKey");
120
- __publicField$5(this, "badgeKey");
121
- __publicField$5(this, "inventionLevel");
122
- __publicField$5(this, "inventionTypes");
123
- __publicField$5(this, "inventionCount");
124
- __publicField$5(this, "notes");
113
+ __publicField$6(this, "key");
114
+ __publicField$6(this, "type");
115
+ __publicField$6(this, "mapKey");
116
+ __publicField$6(this, "loc");
117
+ __publicField$6(this, "plaqueType");
118
+ __publicField$6(this, "inscription");
119
+ __publicField$6(this, "vidiotMapKey");
120
+ __publicField$6(this, "badgeKey");
121
+ __publicField$6(this, "inventionLevel");
122
+ __publicField$6(this, "inventionTypes");
123
+ __publicField$6(this, "inventionCount");
124
+ __publicField$6(this, "notes");
125
125
  this.key = new Key(data.key).value;
126
126
  this.type = data.type;
127
127
  this.mapKey = data.mapKey;
@@ -137,42 +137,49 @@ class BadgePartial {
137
137
  }
138
138
  }
139
139
 
140
- var __typeError$3 = (msg) => {
140
+ var __typeError$2 = (msg) => {
141
141
  throw TypeError(msg);
142
142
  };
143
- var __accessCheck$3 = (obj, member, msg) => member.has(obj) || __typeError$3("Cannot " + msg);
144
- var __privateGet$3 = (obj, member, getter) => (__accessCheck$3(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
145
- 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);
146
- var __privateSet = (obj, member, value, setter) => (__accessCheck$3(obj, member, "write to private field"), member.set(obj, value), value);
147
- var __privateMethod = (obj, member, method) => (__accessCheck$3(obj, member, "access private method"), method);
143
+ var __accessCheck$2 = (obj, member, msg) => member.has(obj) || __typeError$2("Cannot " + msg);
144
+ var __privateGet$2 = (obj, member, getter) => (__accessCheck$2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
145
+ 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);
146
+ var __privateSet = (obj, member, value, setter) => (__accessCheck$2(obj, member, "write to private field"), member.set(obj, value), value);
147
+ var __privateMethod = (obj, member, method) => (__accessCheck$2(obj, member, "access private method"), method);
148
148
  var _sortedValues, _Alternates_instances, compareAlternates_fn, compareAlignment_fn, compareSex_fn;
149
149
  const ALIGNMENT_SORT = { H: 2, V: 1, P: 0 };
150
150
  const SEX_SORT = { M: 1, F: 0 };
151
151
  class Alternates {
152
152
  constructor(values) {
153
- __privateAdd$3(this, _Alternates_instances);
154
- __privateAdd$3(this, _sortedValues, []);
153
+ __privateAdd$2(this, _Alternates_instances);
154
+ __privateAdd$2(this, _sortedValues, []);
155
155
  __privateSet(this, _sortedValues, values.sort());
156
- __privateGet$3(this, _sortedValues).sort((a, b) => __privateMethod(this, _Alternates_instances, compareAlternates_fn).call(this, a, b));
156
+ __privateGet$2(this, _sortedValues).sort((a, b) => __privateMethod(this, _Alternates_instances, compareAlternates_fn).call(this, a, b));
157
157
  }
158
158
  getValue(alignment, sex) {
159
- for (let index = __privateGet$3(this, _sortedValues).length; index--; ) {
160
- const entry = __privateGet$3(this, _sortedValues)[index];
159
+ for (let index = __privateGet$2(this, _sortedValues).length; index--; ) {
160
+ const entry = __privateGet$2(this, _sortedValues)[index];
161
161
  if ((entry.alignment === void 0 || entry.alignment === alignment) && (entry.sex === void 0 || entry.sex === sex)) return entry.value;
162
162
  }
163
- return void 0;
163
+ return this.default;
164
164
  }
165
165
  /**
166
166
  * Get the default value for this list of alternates, the value with the highest priority and lowest specificity.
167
167
  */
168
168
  get default() {
169
- return __privateGet$3(this, _sortedValues)[0]?.value;
169
+ return __privateGet$2(this, _sortedValues)[0]?.value;
170
170
  }
171
171
  /**
172
172
  * Get the list of alternates sorted in canonical order (alignment then sex, low to high specificity).
173
173
  */
174
174
  get canonical() {
175
- return __privateGet$3(this, _sortedValues);
175
+ return __privateGet$2(this, _sortedValues);
176
+ }
177
+ /**
178
+ * Create a joined string from the alternate values in canonical order.
179
+ * @param separator Separator to use. Default is ' / '
180
+ */
181
+ toString(separator) {
182
+ return this.canonical.map((x) => x.value).join(separator);
176
183
  }
177
184
  }
178
185
  _sortedValues = new WeakMap();
@@ -206,93 +213,93 @@ compareSex_fn = function(a, b) {
206
213
  return a?.localeCompare(b ?? "") ?? 0;
207
214
  };
208
215
 
209
- var __defProp$4 = Object.defineProperty;
210
- var __typeError$2 = (msg) => {
216
+ var __defProp$5 = Object.defineProperty;
217
+ var __typeError$1 = (msg) => {
211
218
  throw TypeError(msg);
212
219
  };
213
- var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
214
- var __publicField$4 = (obj, key, value) => __defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
215
- var __accessCheck$2 = (obj, member, msg) => member.has(obj) || __typeError$2("Cannot " + msg);
216
- var __privateGet$2 = (obj, member, getter) => (__accessCheck$2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
217
- 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);
220
+ var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
221
+ var __publicField$5 = (obj, key, value) => __defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
222
+ var __accessCheck$1 = (obj, member, msg) => member.has(obj) || __typeError$1("Cannot " + msg);
223
+ var __privateGet$1 = (obj, member, getter) => (__accessCheck$1(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
224
+ var __privateAdd$1 = (obj, member, value) => member.has(obj) ? __typeError$1("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
218
225
  var _partialsIndex;
219
226
  class Badge {
220
227
  constructor(data) {
221
- __privateAdd$2(this, _partialsIndex, {});
228
+ __privateAdd$1(this, _partialsIndex, {});
222
229
  /**
223
230
  * The database key for this badge.
224
231
  */
225
- __publicField$4(this, "key");
232
+ __publicField$5(this, "key");
226
233
  /**
227
234
  * The type of badge.
228
235
  */
229
- __publicField$4(this, "type");
236
+ __publicField$5(this, "type");
230
237
  /**
231
238
  * The name of this badge.
232
239
  *
233
240
  * May vary by character sex or alignment.
234
241
  */
235
- __publicField$4(this, "name");
242
+ __publicField$5(this, "name");
236
243
  /**
237
244
  * The character alignments that this badge is available to.
238
245
  */
239
- __publicField$4(this, "alignment");
246
+ __publicField$5(this, "alignment");
240
247
  /**
241
248
  * The badge text as it appears in-game. May vary by character sex or alignment.
242
249
  */
243
- __publicField$4(this, "badgeText");
250
+ __publicField$5(this, "badgeText");
244
251
  /**
245
252
  * Description of how to acquire the badge.
246
253
  *
247
254
  * Supports {@link https://www.markdownguide.org/|Markdown} format.
248
255
  */
249
- __publicField$4(this, "acquisition");
256
+ __publicField$5(this, "acquisition");
250
257
  /**
251
258
  * Absolute URL to this badge's icon.
252
259
  *
253
260
  * May vary by character sex or alignment.
254
261
  */
255
- __publicField$4(this, "icon");
262
+ __publicField$5(this, "icon");
256
263
  /**
257
264
  * Freeform notes or tips about the badge.
258
265
  *
259
266
  * Supports {@link https://www.markdownguide.org/|Markdown} format.
260
267
  */
261
- __publicField$4(this, "notes");
268
+ __publicField$5(this, "notes");
262
269
  /**
263
270
  * List of external links for this Badge. Wiki, forums, etc.
264
271
  */
265
- __publicField$4(this, "links");
272
+ __publicField$5(this, "links");
266
273
  /**
267
274
  * For exploration badges, the key of the {@link GameMap} that this badge is found on.
268
275
  */
269
- __publicField$4(this, "mapKey");
276
+ __publicField$5(this, "mapKey");
270
277
  /**
271
278
  * For exploration badges, the `/loc` coordinates of the badge on the in-game map.
272
279
  */
273
- __publicField$4(this, "loc");
280
+ __publicField$5(this, "loc");
274
281
  /**
275
282
  * For badges that appear on a Vidiot Map, the number or letter the badge appears as.
276
283
  */
277
- __publicField$4(this, "vidiotMapKey");
284
+ __publicField$5(this, "vidiotMapKey");
278
285
  /**
279
286
  * ID used with the in-game `/settitle` command to apply the badge.
280
287
  */
281
- __publicField$4(this, "setTitle");
288
+ __publicField$5(this, "setTitle");
282
289
  /**
283
290
  * A description of the effect the badge will have, such as a buff or granting a temporary power.
284
291
  *
285
292
  * Supports {@link https://www.markdownguide.org/|Markdown} format.
286
293
  */
287
- __publicField$4(this, "effect");
294
+ __publicField$5(this, "effect");
288
295
  /**
289
296
  * A list of requirements for badges that have partial fulfilment steps, such as visiting plaques for history badges, or collecting other badges for meta-badges like accolades.
290
297
  */
291
- __publicField$4(this, "partials");
298
+ __publicField$5(this, "partials");
292
299
  /**
293
300
  * 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.
294
301
  */
295
- __publicField$4(this, "ignoreInTotals");
302
+ __publicField$5(this, "ignoreInTotals");
296
303
  this.key = new Key(data.key).value;
297
304
  this.type = data.type;
298
305
  this.name = new Alternates(data.name);
@@ -309,23 +316,23 @@ class Badge {
309
316
  this.setTitle = data.setTitle;
310
317
  this.ignoreInTotals = data.ignoreInTotals ?? false;
311
318
  this.partials = data.partials?.map((data2) => {
312
- if (__privateGet$2(this, _partialsIndex)[data2.key] !== void 0) throw new Error(`Duplicate badge partial key [${data2.key}]`);
319
+ if (__privateGet$1(this, _partialsIndex)[data2.key] !== void 0) throw new Error(`Duplicate badge partial key [${data2.key}]`);
313
320
  const badge = new BadgePartial(data2);
314
- __privateGet$2(this, _partialsIndex)[badge.key] = badge;
321
+ __privateGet$1(this, _partialsIndex)[badge.key] = badge;
315
322
  return badge;
316
323
  });
317
324
  }
318
325
  getPartial(key) {
319
- const result = __privateGet$2(this, _partialsIndex)[key];
326
+ const result = __privateGet$1(this, _partialsIndex)[key];
320
327
  if (result === void 0) throw new Error(`Unknown badge partial key [${key}]`);
321
328
  return result;
322
329
  }
323
330
  }
324
331
  _partialsIndex = new WeakMap();
325
332
 
326
- var __defProp$3 = Object.defineProperty;
327
- var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
328
- var __publicField$3 = (obj, key, value) => __defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
333
+ var __defProp$4 = Object.defineProperty;
334
+ var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
335
+ var __publicField$4 = (obj, key, value) => __defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
329
336
  class VidiotMapPointOfInterest {
330
337
  constructor(data) {
331
338
  /**
@@ -333,25 +340,25 @@ class VidiotMapPointOfInterest {
333
340
  *
334
341
  * Screen-space, pixels from top-left `[0, 0]`.
335
342
  */
336
- __publicField$3(this, "pos");
343
+ __publicField$4(this, "pos");
337
344
  /**
338
345
  * Freeform notes about the PoI.
339
346
  *
340
347
  * Supports {@link https://www.markdownguide.org/|Markdown} format.
341
348
  */
342
- __publicField$3(this, "notes");
349
+ __publicField$4(this, "notes");
343
350
  /**
344
351
  * If the POI is a zone transfer, the map it transfers to.
345
352
  */
346
- __publicField$3(this, "mapKey");
353
+ __publicField$4(this, "mapKey");
347
354
  /**
348
355
  * If the POI is a badge, the badge.
349
356
  */
350
- __publicField$3(this, "badgeKey");
357
+ __publicField$4(this, "badgeKey");
351
358
  /**
352
359
  * If the POI is a partial for a badge, the partial key.
353
360
  */
354
- __publicField$3(this, "badgePartialKey");
361
+ __publicField$4(this, "badgePartialKey");
355
362
  this.pos = data.pos;
356
363
  this.notes = data.notes;
357
364
  this.mapKey = data.mapKey;
@@ -360,50 +367,50 @@ class VidiotMapPointOfInterest {
360
367
  }
361
368
  }
362
369
 
363
- var __defProp$2 = Object.defineProperty;
364
- var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
365
- var __publicField$2 = (obj, key, value) => __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
370
+ var __defProp$3 = Object.defineProperty;
371
+ var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
372
+ var __publicField$3 = (obj, key, value) => __defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
366
373
  class VidiotMap {
367
374
  constructor(data) {
368
375
  /**
369
376
  * URL of the map image.
370
377
  */
371
- __publicField$2(this, "imageUrl");
378
+ __publicField$3(this, "imageUrl");
372
379
  /**
373
380
  * Name to display for the Vidiot map.
374
381
  */
375
- __publicField$2(this, "name");
382
+ __publicField$3(this, "name");
376
383
  /**
377
384
  * List of Points of Interest labelled on the image.
378
385
  */
379
- __publicField$2(this, "pointsOfInterest");
386
+ __publicField$3(this, "pointsOfInterest");
380
387
  this.imageUrl = data.imageUrl;
381
388
  this.name = data.name;
382
389
  this.pointsOfInterest = data.pointsOfInterest?.map((data2) => new VidiotMapPointOfInterest(data2));
383
390
  }
384
391
  }
385
392
 
386
- var __defProp$1 = Object.defineProperty;
387
- var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
388
- var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
393
+ var __defProp$2 = Object.defineProperty;
394
+ var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
395
+ var __publicField$2 = (obj, key, value) => __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
389
396
  class GameMap {
390
397
  constructor(data) {
391
398
  /**
392
399
  * The database key for this map.
393
400
  */
394
- __publicField$1(this, "key");
401
+ __publicField$2(this, "key");
395
402
  /**
396
403
  * The name of the map as it appears in-game.
397
404
  */
398
- __publicField$1(this, "name");
405
+ __publicField$2(this, "name");
399
406
  /**
400
407
  * List of external links for this Map. Wiki, forums, etc.
401
408
  */
402
- __publicField$1(this, "links");
409
+ __publicField$2(this, "links");
403
410
  /**
404
411
  * List of Vidiot Map assets for this map.
405
412
  */
406
- __publicField$1(this, "vidiotMaps");
413
+ __publicField$2(this, "vidiotMaps");
407
414
  this.key = new Key(data.key).value;
408
415
  this.name = data.name;
409
416
  this.links = data.links;
@@ -411,43 +418,64 @@ class GameMap {
411
418
  }
412
419
  }
413
420
 
414
- var __defProp = Object.defineProperty;
415
- var __typeError$1 = (msg) => {
416
- throw TypeError(msg);
417
- };
418
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
419
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
420
- var __accessCheck$1 = (obj, member, msg) => member.has(obj) || __typeError$1("Cannot " + msg);
421
- var __privateGet$1 = (obj, member, getter) => (__accessCheck$1(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
422
- var __privateAdd$1 = (obj, member, value) => member.has(obj) ? __typeError$1("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
423
- var _archetypeIndex, _mapIndex, _badgeIndex;
424
- class ServerGroup {
425
- constructor(data) {
426
- __privateAdd$1(this, _archetypeIndex, {});
427
- __privateAdd$1(this, _mapIndex, {});
428
- __privateAdd$1(this, _badgeIndex, {});
429
- /**
430
- * The database key for this server group.
431
- */
432
- __publicField(this, "key");
421
+ var __defProp$1 = Object.defineProperty;
422
+ var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
423
+ var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
424
+ class BundleMetadata {
425
+ constructor(bundle) {
433
426
  /**
434
427
  * Name of the server group.
435
428
  */
436
- __publicField(this, "name");
429
+ __publicField$1(this, "name");
437
430
  /**
438
431
  * Description of the server group.
439
432
  *
440
433
  * Supports {@link https://www.markdownguide.org/|Markdown} format.
441
434
  */
442
- __publicField(this, "description");
435
+ __publicField$1(this, "description");
443
436
  /**
444
437
  * Repository where the db content package is maintained.
445
438
  */
446
- __publicField(this, "repository");
439
+ __publicField$1(this, "repository");
447
440
  /**
448
441
  * List of external links for this Server Group. Wiki, forums, etc.
449
442
  */
450
- __publicField(this, "links");
443
+ __publicField$1(this, "links");
444
+ /**
445
+ * Change log for this data package.
446
+ */
447
+ __publicField$1(this, "changelog");
448
+ this.name = bundle.name;
449
+ this.description = bundle.description;
450
+ this.repository = bundle.repository;
451
+ this.links = bundle.links ?? [];
452
+ this.changelog = bundle.changelog ?? [];
453
+ }
454
+ }
455
+
456
+ var __defProp = Object.defineProperty;
457
+ var __typeError = (msg) => {
458
+ throw TypeError(msg);
459
+ };
460
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
461
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
462
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
463
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
464
+ 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);
465
+ var _archetypeIndex, _mapIndex, _badgeIndex;
466
+ class CohContentDatabase {
467
+ /**
468
+ * Initialize the database with a content bundle.
469
+ * @param bundle The data to load.
470
+ */
471
+ constructor(bundle) {
472
+ __privateAdd(this, _archetypeIndex, {});
473
+ __privateAdd(this, _mapIndex, {});
474
+ __privateAdd(this, _badgeIndex, {});
475
+ /**
476
+ * Metadata about the content bundle.
477
+ */
478
+ __publicField(this, "metadata");
451
479
  /**
452
480
  * List of the game server names in this server group.
453
481
  * Torchbearer, Excelsior, etc.
@@ -465,48 +493,39 @@ class ServerGroup {
465
493
  * List of badges available on this server group.
466
494
  */
467
495
  __publicField(this, "badges");
468
- /**
469
- * Change log for this data package.
470
- */
471
- __publicField(this, "changelog");
472
- this.key = new Key(data.key).value;
473
- this.name = data.name;
474
- this.description = data.description;
475
- this.repository = data.repository;
476
- this.links = data.links;
477
- this.servers = data.servers ?? [];
478
- this.archetypes = data.archetypes?.map((data2) => {
479
- if (__privateGet$1(this, _archetypeIndex)[data2.key] !== void 0) throw new Error(`Duplicate archetype key [${data2.key}]`);
480
- const archetype = new Archetype(data2);
481
- __privateGet$1(this, _archetypeIndex)[archetype.key] = archetype;
496
+ this.metadata = new BundleMetadata(bundle);
497
+ this.servers = bundle.servers ?? [];
498
+ this.archetypes = bundle.archetypes?.map((data) => {
499
+ if (__privateGet(this, _archetypeIndex)[data.key] !== void 0) throw new Error(`Duplicate archetype key [${data.key}]`);
500
+ const archetype = new Archetype(data);
501
+ __privateGet(this, _archetypeIndex)[archetype.key] = archetype;
482
502
  return archetype;
483
503
  }) ?? [];
484
- this.maps = data.maps?.map((data2) => {
485
- if (__privateGet$1(this, _mapIndex)[data2.key] !== void 0) throw new Error(`Duplicate map key [${data2.key}]`);
486
- const map = new GameMap(data2);
487
- __privateGet$1(this, _mapIndex)[map.key] = map;
504
+ this.maps = bundle.maps?.map((data) => {
505
+ if (__privateGet(this, _mapIndex)[data.key] !== void 0) throw new Error(`Duplicate map key [${data.key}]`);
506
+ const map = new GameMap(data);
507
+ __privateGet(this, _mapIndex)[map.key] = map;
488
508
  return map;
489
509
  }) ?? [];
490
- this.badges = data.badges?.map((data2) => {
491
- if (__privateGet$1(this, _badgeIndex)[data2.key] !== void 0) throw new Error(`Duplicate badge key [${data2.key}]`);
492
- const badge = new Badge(data2);
493
- __privateGet$1(this, _badgeIndex)[badge.key] = badge;
510
+ this.badges = bundle.badges?.map((data) => {
511
+ if (__privateGet(this, _badgeIndex)[data.key] !== void 0) throw new Error(`Duplicate badge key [${data.key}]`);
512
+ const badge = new Badge(data);
513
+ __privateGet(this, _badgeIndex)[badge.key] = badge;
494
514
  return badge;
495
515
  }) ?? [];
496
- this.changelog = data.changelog;
497
516
  }
498
517
  getArchetype(key) {
499
- const result = __privateGet$1(this, _archetypeIndex)[key];
518
+ const result = __privateGet(this, _archetypeIndex)[key];
500
519
  if (result === void 0) throw new Error(`Unknown archetype key [${key}]`);
501
520
  return result;
502
521
  }
503
522
  getMap(key) {
504
- const result = __privateGet$1(this, _mapIndex)[key];
523
+ const result = __privateGet(this, _mapIndex)[key];
505
524
  if (result === void 0) throw new Error(`Unknown map key [${key}]`);
506
525
  return result;
507
526
  }
508
527
  getBadge(key) {
509
- const result = __privateGet$1(this, _badgeIndex)[key];
528
+ const result = __privateGet(this, _badgeIndex)[key];
510
529
  if (result === void 0) throw new Error(`Unknown badge key [${key}]`);
511
530
  return result;
512
531
  }
@@ -515,45 +534,24 @@ _archetypeIndex = new WeakMap();
515
534
  _mapIndex = new WeakMap();
516
535
  _badgeIndex = new WeakMap();
517
536
 
518
- var __typeError = (msg) => {
519
- throw TypeError(msg);
520
- };
521
- var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
522
- var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
523
- 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);
524
- var _serverGroups;
525
- class CohContentDatabase {
526
- constructor() {
527
- __privateAdd(this, _serverGroups, {});
528
- }
529
- /**
530
- * Load a server group data package into the database.
531
- * @param data The data to load.
532
- */
533
- loadServerGroupData(data) {
534
- __privateGet(this, _serverGroups)[data.key] = new ServerGroup(data);
535
- }
536
- /**
537
- * Get all the server groups currently loaded in the database.
538
- */
539
- listServerGroups() {
540
- return Object.values(__privateGet(this, _serverGroups));
541
- }
542
- /**
543
- * get a server group by key.
544
- * @param serverGroupKey The key.
545
- */
546
- getServerGroup(serverGroupKey) {
547
- return __privateGet(this, _serverGroups)[serverGroupKey];
548
- }
549
- }
550
- _serverGroups = new WeakMap();
551
-
552
537
  const CHANGELOG = [
553
538
  {
554
539
  version: "2.0.0",
555
540
  date: /* @__PURE__ */ new Date("2025-03-12"),
556
- description: "* Replaced redundant interfaces with their concrete equivalents.\n* Replaced enums with extensible union types; Server groups with new badge types, enhancement types, etc. can now extend them locally.\n* Removed the `serverGroup` property from entities to simplify the object tree; Server group context will need to be managed separately.\n* Standardized pluralization of some field names (name, icon).\n* Combined `settitle` ids into a single tuple field.\n* Change from GNU to The Unlicense.\n* Removed dependency on lodash. There are now no third-party runtime dependencies.\n* Moved from webpack to rollup for packaging.\n* Add eslint for linting.\n* Add jest for unit tests.\n* Added GitHub Actions for CI.\n"
541
+ description: `* Replaced redundant interfaces with their concrete equivalents.
542
+ * Server groups are now referred to as 'forks'.
543
+ * Replaced enums with extensible union types; Forks with new badge types, enhancement types, etc. can now extend them locally.
544
+ * \`IServerGroupData\` is now \`ContentBundle\` and each database instance is now designed to accept only a single server group.
545
+ * Removed the \`serverGroup\` property from entities to simplify the object tree given that only a single context can exist per db now.
546
+ * Standardized pluralization of some field names (name, icon).
547
+ * Combined \`settitle\` ids into a single tuple field.
548
+ * Change from GNU to The Unlicense.
549
+ * Removed dependency on lodash. There are now no third-party runtime dependencies.
550
+ * Moved from webpack to rollup for packaging.
551
+ * Add eslint for linting.
552
+ * Add jest for unit tests.
553
+ * Added GitHub Actions for CI.
554
+ `
557
555
  }
558
556
  ];
559
557
 
@@ -572,6 +570,7 @@ exports.BADGE_PARTIAL_TYPE = BADGE_PARTIAL_TYPE;
572
570
  exports.BADGE_TYPE = BADGE_TYPE;
573
571
  exports.Badge = Badge;
574
572
  exports.BadgePartial = BadgePartial;
573
+ exports.BundleMetadata = BundleMetadata;
575
574
  exports.CHANGELOG = CHANGELOG;
576
575
  exports.CohContentDatabase = CohContentDatabase;
577
576
  exports.ENHANCEMENT_CATEGORY = ENHANCEMENT_CATEGORY;
@@ -579,7 +578,6 @@ exports.GameMap = GameMap;
579
578
  exports.Key = Key;
580
579
  exports.PLAQUE_TYPE = PLAQUE_TYPE;
581
580
  exports.SEX = SEX;
582
- exports.ServerGroup = ServerGroup;
583
581
  exports.VidiotMap = VidiotMap;
584
582
  exports.VidiotMapPointOfInterest = VidiotMapPointOfInterest;
585
583
  exports.createBadgeReference = createBadgeReference;