coh-content-db 2.0.0-rc.4 → 2.0.0-rc.6

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 (64) hide show
  1. package/README.md +31 -7
  2. package/dist/coh-content-db.d.ts +353 -185
  3. package/dist/coh-content-db.js +460 -300
  4. package/dist/coh-content-db.js.map +1 -1
  5. package/dist/coh-content-db.mjs +448 -294
  6. package/dist/coh-content-db.mjs.map +1 -1
  7. package/package.json +1 -4
  8. package/src/main/api/alternate-data.ts +2 -2
  9. package/src/main/api/badge-data.ts +21 -19
  10. package/src/main/api/badge-requirement-data.ts +82 -0
  11. package/src/main/api/badge-requirement-type.ts +11 -0
  12. package/src/main/api/change.ts +5 -2
  13. package/src/main/api/contact-data.ts +46 -0
  14. package/src/main/api/content-bundle.ts +12 -7
  15. package/src/main/api/markdown-string.ts +4 -0
  16. package/src/main/api/zone-data.ts +20 -0
  17. package/src/main/changelog.ts +7 -2
  18. package/src/main/db/alignments.ts +17 -0
  19. package/src/main/db/alternates.ts +8 -14
  20. package/src/main/db/badge-index.ts +93 -0
  21. package/src/main/db/badge-requirement.ts +102 -0
  22. package/src/main/db/badge-search-options.ts +51 -0
  23. package/src/main/db/badge.ts +55 -48
  24. package/src/main/db/bundle-metadata.ts +5 -6
  25. package/src/main/db/coh-content-database.ts +65 -40
  26. package/src/main/db/contact.ts +59 -0
  27. package/src/main/db/paged.ts +7 -0
  28. package/src/main/db/zone.ts +28 -0
  29. package/src/main/index.ts +15 -11
  30. package/src/main/util.ts +68 -7
  31. package/src/test/api/alignments.test.ts +40 -0
  32. package/src/test/api/badge-data.fixture.ts +9 -7
  33. package/src/test/api/badge-requirement-data.fixture.ts +17 -0
  34. package/src/test/api/badge-requirement-type.test.ts +31 -0
  35. package/src/test/api/contact-data.fixture.ts +13 -0
  36. package/src/test/api/content-bundle.fixture.ts +2 -2
  37. package/src/test/api/content-bundle.test.ts +1 -1
  38. package/src/test/api/zone-data.fixture.ts +8 -0
  39. package/src/test/db/alternates.test.ts +16 -74
  40. package/src/test/db/badge-index.test.ts +520 -0
  41. package/src/test/db/badge-requirement.test.ts +180 -0
  42. package/src/test/db/badge.test.ts +190 -15
  43. package/src/test/db/coh-content-database.test.ts +125 -18
  44. package/src/test/db/contact.test.ts +96 -0
  45. package/src/test/db/zone.test.ts +36 -0
  46. package/src/test/index.test.ts +6 -2
  47. package/src/test/util.test.ts +91 -18
  48. package/src/main/api/badge-partial-data.ts +0 -65
  49. package/src/main/api/badge-partial-type.ts +0 -8
  50. package/src/main/api/game-map-data.ts +0 -26
  51. package/src/main/api/vidiot-map-data.ts +0 -18
  52. package/src/main/api/vidiot-map-point-of-interest-data.ts +0 -30
  53. package/src/main/db/badge-partial.ts +0 -35
  54. package/src/main/db/badge-search-document.ts +0 -16
  55. package/src/main/db/game-map.ts +0 -33
  56. package/src/main/db/vidiot-map-point-of-interest.ts +0 -40
  57. package/src/main/db/vidiot-map.ts +0 -25
  58. package/src/test/api/badge-partial-data.fixture.ts +0 -17
  59. package/src/test/api/badge-partial-type.test.ts +0 -31
  60. package/src/test/api/game-map-data.fixture.ts +0 -10
  61. package/src/test/api/vidiot-map-point-of-interest.fixture.ts +0 -10
  62. package/src/test/api/vidiot-map.fixture.ts +0 -9
  63. package/src/test/db/badge-search-document.test.ts +0 -35
  64. package/src/test/db/coh-content-database-search.test.ts +0 -119
package/README.md CHANGED
@@ -25,7 +25,7 @@ that can be loaded into the db for consumption by DB consumers such as [Badger](
25
25
 
26
26
  For an example data package, see the [coh-content-db-homecoming](https://github.com/n15g/coh-content-db-homecoming) project.
27
27
 
28
- ### Defining archetypes, map, badges, etc.
28
+ ### Defining archetypes, zones, badges, etc.
29
29
 
30
30
  To define content, create a new instance using the appropriate `Data` interface and provide values for the required fields:
31
31
 
@@ -41,28 +41,52 @@ export const TEST_BADGE: BadgeData = {
41
41
  }
42
42
  ```
43
43
 
44
- Then, create a `ServerGroupData` instance and load your content into the appropriate field.
44
+ Then, create a `ContentBundle` instance and load your content into the appropriate field.
45
45
 
46
46
  ```typescript
47
47
  import { ContentBundle } from './content-bundle'
48
48
  import { TEST_BADGE } from './test-badge'
49
49
 
50
- export const TEST_SERVER_GROUP: ContentBundle = {
50
+ export const MY_CONTENT_BUNDLE: ContentBundle = {
51
51
  name: 'My Content Bundle',
52
52
  badges: [TEST_BADGE],
53
53
  }
54
54
  ```
55
55
 
56
+ ### Markdown and Links
57
+
58
+ Fields with long text values can typically accept [Markdown](https://www.markdownguide.org/) format. These fields will also be typed with the tag type [MarkdownString](src/main/api/markdown-string.ts).
59
+
60
+ Within markdown, you can construct a link to a badge or zone using the special `badge://` and `zone://` protocol indicators that consumer apps can use to provide runtime links or tooltips.
61
+ This replaces the custom `[badge:xyz]` format from v1 and data packages will need to update accordingly.
62
+
63
+ To create a link, use the standard Markdown link format, with the url as following:
64
+
65
+ ```markdown
66
+ This is a link to the [Ghoulish](badge://ghoulish) badge.
67
+ ```
68
+
69
+ There are convenience functions also provided to construct the URI automatically that can be used as follows:
70
+
71
+ ```typescript
72
+ import { badgeLink, badgeUri } from 'coh-content-db'
73
+
74
+ const uri = `This is a link to the [Ghoulish](${badgeUri('ghoulish')}) badge.`
75
+ // This is a link to the [Ghoulish](badge://ghoulish) badge.
76
+ const link = `This is a link to the ${badgeLink('ghoulish')} badge.`
77
+ // This is a link to the [ghoulish](badge://ghoulish) badge.
78
+ ```
79
+
56
80
  ## As a DB consumer
57
81
 
58
82
  Create a new database instance, then load a content bundle, such as [coh-content-db-homecoming](https://github.com/n15g/coh-content-db-homecoming):
59
83
 
60
84
  ```typescript
61
- import { CohContentDatabase } from 'coh-content-db';
62
- import { Homecoming } from 'coh-content-db-homecoming';
85
+ import { CohContentDatabase } from 'coh-content-db'
86
+ import { Homecoming } from 'coh-content-db-homecoming'
63
87
 
64
- const db = new CohContentDatabase();
65
- db.loadBundle(new Homecoming());
88
+ const db = new CohContentDatabase()
89
+ db.loadBundle(new Homecoming())
66
90
  ```
67
91
 
68
92
  #### Access the content