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.
- package/README.md +31 -7
- package/dist/coh-content-db.d.ts +353 -185
- package/dist/coh-content-db.js +460 -300
- package/dist/coh-content-db.js.map +1 -1
- package/dist/coh-content-db.mjs +448 -294
- package/dist/coh-content-db.mjs.map +1 -1
- package/package.json +1 -4
- package/src/main/api/alternate-data.ts +2 -2
- package/src/main/api/badge-data.ts +21 -19
- package/src/main/api/badge-requirement-data.ts +82 -0
- package/src/main/api/badge-requirement-type.ts +11 -0
- package/src/main/api/change.ts +5 -2
- package/src/main/api/contact-data.ts +46 -0
- package/src/main/api/content-bundle.ts +12 -7
- package/src/main/api/markdown-string.ts +4 -0
- package/src/main/api/zone-data.ts +20 -0
- package/src/main/changelog.ts +7 -2
- package/src/main/db/alignments.ts +17 -0
- package/src/main/db/alternates.ts +8 -14
- package/src/main/db/badge-index.ts +93 -0
- package/src/main/db/badge-requirement.ts +102 -0
- package/src/main/db/badge-search-options.ts +51 -0
- package/src/main/db/badge.ts +55 -48
- package/src/main/db/bundle-metadata.ts +5 -6
- package/src/main/db/coh-content-database.ts +65 -40
- package/src/main/db/contact.ts +59 -0
- package/src/main/db/paged.ts +7 -0
- package/src/main/db/zone.ts +28 -0
- package/src/main/index.ts +15 -11
- package/src/main/util.ts +68 -7
- package/src/test/api/alignments.test.ts +40 -0
- package/src/test/api/badge-data.fixture.ts +9 -7
- package/src/test/api/badge-requirement-data.fixture.ts +17 -0
- package/src/test/api/badge-requirement-type.test.ts +31 -0
- package/src/test/api/contact-data.fixture.ts +13 -0
- package/src/test/api/content-bundle.fixture.ts +2 -2
- package/src/test/api/content-bundle.test.ts +1 -1
- package/src/test/api/zone-data.fixture.ts +8 -0
- package/src/test/db/alternates.test.ts +16 -74
- package/src/test/db/badge-index.test.ts +520 -0
- package/src/test/db/badge-requirement.test.ts +180 -0
- package/src/test/db/badge.test.ts +190 -15
- package/src/test/db/coh-content-database.test.ts +125 -18
- package/src/test/db/contact.test.ts +96 -0
- package/src/test/db/zone.test.ts +36 -0
- package/src/test/index.test.ts +6 -2
- package/src/test/util.test.ts +91 -18
- package/src/main/api/badge-partial-data.ts +0 -65
- package/src/main/api/badge-partial-type.ts +0 -8
- package/src/main/api/game-map-data.ts +0 -26
- package/src/main/api/vidiot-map-data.ts +0 -18
- package/src/main/api/vidiot-map-point-of-interest-data.ts +0 -30
- package/src/main/db/badge-partial.ts +0 -35
- package/src/main/db/badge-search-document.ts +0 -16
- package/src/main/db/game-map.ts +0 -33
- package/src/main/db/vidiot-map-point-of-interest.ts +0 -40
- package/src/main/db/vidiot-map.ts +0 -25
- package/src/test/api/badge-partial-data.fixture.ts +0 -17
- package/src/test/api/badge-partial-type.test.ts +0 -31
- package/src/test/api/game-map-data.fixture.ts +0 -10
- package/src/test/api/vidiot-map-point-of-interest.fixture.ts +0 -10
- package/src/test/api/vidiot-map.fixture.ts +0 -9
- package/src/test/db/badge-search-document.test.ts +0 -35
- 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,
|
|
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 `
|
|
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
|
|
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
|