coh-content-db 2.0.0-rc.2 → 2.0.0-rc.21

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 (120) hide show
  1. package/.editorconfig +10 -11
  2. package/.github/workflows/build.yml +4 -2
  3. package/.github/workflows/pull-request.yml +1 -1
  4. package/.github/workflows/release.yml +1 -1
  5. package/CHANGELOG.md +47 -0
  6. package/README.md +77 -32
  7. package/dist/coh-content-db.d.ts +755 -290
  8. package/dist/coh-content-db.js +1028 -358
  9. package/dist/coh-content-db.js.map +1 -1
  10. package/dist/coh-content-db.mjs +998 -349
  11. package/dist/coh-content-db.mjs.map +1 -1
  12. package/eslint.config.mjs +1 -0
  13. package/jest.config.mjs +1 -0
  14. package/package.json +14 -14
  15. package/src/main/api/alignment.ts +18 -2
  16. package/src/main/api/badge-data.ts +29 -51
  17. package/src/main/api/badge-requirement-data.ts +64 -0
  18. package/src/main/api/badge-requirement-type.ts +32 -0
  19. package/src/main/api/badge-type.ts +15 -15
  20. package/src/main/api/bundle-data.ts +47 -0
  21. package/src/main/api/bundle-header-data.ts +44 -0
  22. package/src/main/api/contact-data.ts +49 -0
  23. package/src/main/api/enhancement-category.ts +26 -26
  24. package/src/main/api/level-range-data.ts +4 -0
  25. package/src/main/api/location-data.ts +28 -0
  26. package/src/main/api/markdown-string.ts +4 -0
  27. package/src/main/api/mission-data.ts +57 -0
  28. package/src/main/api/mission-flashback-data.ts +31 -0
  29. package/src/main/api/mission-type.ts +2 -0
  30. package/src/main/api/morality.ts +49 -0
  31. package/src/main/api/set-title-data.ts +4 -0
  32. package/src/main/api/sex.ts +8 -1
  33. package/src/main/api/variant-context.ts +11 -0
  34. package/src/main/api/variant-data.ts +22 -0
  35. package/src/main/api/zone-data.ts +44 -0
  36. package/src/main/api/zone-type.ts +59 -0
  37. package/src/main/db/abstract-index.ts +37 -0
  38. package/src/main/db/alignment-list.ts +54 -0
  39. package/src/main/db/badge-index.ts +83 -0
  40. package/src/main/db/badge-requirement.ts +81 -0
  41. package/src/main/db/badge-search-options.ts +52 -0
  42. package/src/main/db/badge.ts +97 -74
  43. package/src/main/db/bundle-header.ts +52 -0
  44. package/src/main/db/coh-content-database.ts +123 -14
  45. package/src/main/db/contact.ts +63 -0
  46. package/src/main/db/level-range.ts +15 -0
  47. package/src/main/db/location.ts +30 -0
  48. package/src/main/db/mission.ts +108 -0
  49. package/src/main/db/morality-list.ts +99 -0
  50. package/src/main/db/paged.ts +11 -0
  51. package/src/main/db/set-title-ids.ts +10 -0
  52. package/src/main/db/variants.ts +84 -0
  53. package/src/main/db/zone.ts +57 -0
  54. package/src/main/index.ts +33 -18
  55. package/src/main/util/coalesce-to-array.ts +13 -0
  56. package/src/main/util/links.ts +104 -0
  57. package/src/main/util/to-date.ts +9 -0
  58. package/src/test/api/alignment.test.ts +38 -4
  59. package/src/test/api/badge-data.fixture.ts +2 -15
  60. package/src/test/api/badge-data.test.ts +5 -4
  61. package/src/test/api/badge-requirement-data.fixture.ts +7 -0
  62. package/src/test/api/badge-requirement-type.test.ts +31 -0
  63. package/src/test/api/badge-type.test.ts +5 -5
  64. package/src/test/api/bundle-data.fixture.ts +7 -0
  65. package/src/test/api/bundle-header-data.fixture.ts +8 -0
  66. package/src/test/api/contact-data.fixture.ts +7 -0
  67. package/src/test/api/enhancement-category.test.ts +5 -5
  68. package/src/test/api/mission-data.fixture.ts +12 -0
  69. package/src/test/api/morality.test.ts +31 -0
  70. package/src/test/api/sex.test.ts +33 -1
  71. package/src/test/api/zone-data.fixture.ts +9 -0
  72. package/src/test/db/abstract-index.test.ts +55 -0
  73. package/src/test/db/alignment-list.test.ts +200 -0
  74. package/src/test/db/badge-index.test.ts +653 -0
  75. package/src/test/db/badge-requirement.test.ts +145 -0
  76. package/src/test/db/badge.test.ts +416 -14
  77. package/src/test/db/bundle-header.test.ts +89 -0
  78. package/src/test/db/coh-content-database.test.ts +265 -24
  79. package/src/test/db/contact.test.ts +98 -0
  80. package/src/test/db/level-range.test.ts +47 -0
  81. package/src/test/db/location.test.ts +51 -0
  82. package/src/test/db/mission.test.ts +173 -0
  83. package/src/test/db/morality-list.test.ts +457 -0
  84. package/src/test/db/set-title-ids.test.ts +19 -0
  85. package/src/test/db/variants.test.ts +188 -0
  86. package/src/test/db/zone.test.ts +81 -0
  87. package/src/test/integration.test.ts +16 -0
  88. package/src/test/util/coalese-to-array.test.ts +17 -0
  89. package/src/test/util/links.test.ts +149 -0
  90. package/src/test/util/to-date.test.ts +15 -0
  91. package/src/main/api/alternate-data.ts +0 -22
  92. package/src/main/api/badge-partial-data.ts +0 -65
  93. package/src/main/api/badge-partial-type.ts +0 -8
  94. package/src/main/api/change.ts +0 -14
  95. package/src/main/api/game-map-data.ts +0 -26
  96. package/src/main/api/plaque-type.ts +0 -6
  97. package/src/main/api/server-group-data.ts +0 -65
  98. package/src/main/api/vidiot-map-data.ts +0 -18
  99. package/src/main/api/vidiot-map-point-of-interest-data.ts +0 -30
  100. package/src/main/changelog.ts +0 -20
  101. package/src/main/db/alternates.ts +0 -81
  102. package/src/main/db/badge-partial.ts +0 -35
  103. package/src/main/db/game-map.ts +0 -33
  104. package/src/main/db/server-group.ts +0 -112
  105. package/src/main/db/vidiot-map-point-of-interest.ts +0 -40
  106. package/src/main/db/vidiot-map.ts +0 -25
  107. package/src/main/util.ts +0 -17
  108. package/src/test/api/badge-partial-data.fixture.ts +0 -17
  109. package/src/test/api/badge-partial-type.test.ts +0 -31
  110. package/src/test/api/game-map-data.fixture.ts +0 -10
  111. package/src/test/api/plaque-type.test.ts +0 -31
  112. package/src/test/api/server-group-data.fixture.ts +0 -23
  113. package/src/test/api/server-group-data.test.ts +0 -15
  114. package/src/test/api/vidiot-map-point-of-interest.fixture.ts +0 -10
  115. package/src/test/api/vidiot-map.fixture.ts +0 -9
  116. package/src/test/changelog.test.ts +0 -36
  117. package/src/test/db/alternates.test.ts +0 -223
  118. package/src/test/db/server-group.test.ts +0 -124
  119. package/src/test/index.test.ts +0 -10
  120. package/src/test/util.test.ts +0 -39
@@ -1,124 +0,0 @@
1
- import { ServerGroup } from '../../main'
2
- import { serverGroupDataFixture } from '../api/server-group-data.fixture'
3
- import { badgeDataFixture } from '../api/badge-data.fixture'
4
- import { gameMapDataFixture } from '../api/game-map-data.fixture'
5
- import { archetypeDataFixture } from '../api/archetype-data.fixture'
6
-
7
- describe(ServerGroup.name, () => {
8
- describe('Constructor', () => {
9
- test(`should accept the test fixture`, () => {
10
- new ServerGroup(serverGroupDataFixture.create())
11
- })
12
- })
13
-
14
- describe('archetypes', () => {
15
- test(`should throw an error on duplicate key`, () => {
16
- const data = serverGroupDataFixture.create({
17
- archetypes: [
18
- archetypeDataFixture.create({ key: 'foo' }),
19
- archetypeDataFixture.create({ key: 'foo' }),
20
- ],
21
- })
22
- expect(() => new ServerGroup(data)).toThrow('Duplicate archetype key [foo]')
23
- })
24
-
25
- test(`should accept an empty list`, () => {
26
- const data = serverGroupDataFixture
27
- .omit('archetypes')
28
- .create()
29
- expect(() => new ServerGroup(data).archetypes).toHaveLength(0)
30
- })
31
- })
32
-
33
- describe('badges', () => {
34
- test(`should throw an error on duplicate key`, () => {
35
- const data = serverGroupDataFixture.create({
36
- badges: [
37
- badgeDataFixture.create({ key: 'foo' }),
38
- badgeDataFixture.create({ key: 'foo' }),
39
- ],
40
- })
41
- expect(() => new ServerGroup(data)).toThrow('Duplicate badge key [foo]')
42
- })
43
-
44
- test(`should accept an empty list`, () => {
45
- const data = serverGroupDataFixture
46
- .omit('badges')
47
- .create()
48
- expect(() => new ServerGroup(data).badges).toHaveLength(0)
49
- })
50
- })
51
-
52
- describe('maps', () => {
53
- test(`should throw an error on duplicate map`, () => {
54
- const data = serverGroupDataFixture.create({
55
- maps: [
56
- gameMapDataFixture.create({ key: 'foo' }),
57
- gameMapDataFixture.create({ key: 'foo' }),
58
- ],
59
- })
60
- expect(() => new ServerGroup(data)).toThrow('Duplicate map key [foo]')
61
- })
62
-
63
- test(`should accept an empty list`, () => {
64
- const data = serverGroupDataFixture
65
- .omit('maps')
66
- .create()
67
- expect(() => new ServerGroup(data).maps).toHaveLength(0)
68
- })
69
- })
70
-
71
- describe('getArchetype', () => {
72
- test(`should retrieve archetype from the index`, () => {
73
- const data = serverGroupDataFixture.create({
74
- archetypes: [archetypeDataFixture.create({ key: 'foo' })],
75
- })
76
-
77
- expect(new ServerGroup(data).getArchetype('foo')).not.toBeNull()
78
- })
79
-
80
- test(`should throw error for unknown archetype`, () => {
81
- const data = serverGroupDataFixture.create({
82
- archetypes: [],
83
- })
84
-
85
- expect(() => new ServerGroup(data).getArchetype('foo')).toThrow('Unknown archetype key [foo]')
86
- })
87
- })
88
-
89
- describe('getMap', () => {
90
- test(`should retrieve map from the index`, () => {
91
- const data = serverGroupDataFixture.create({
92
- maps: [gameMapDataFixture.create({ key: 'foo' })],
93
- })
94
-
95
- expect(new ServerGroup(data).getMap('foo')).not.toBeNull()
96
- })
97
-
98
- test(`should throw error for unknown map`, () => {
99
- const data = serverGroupDataFixture.create({
100
- maps: [],
101
- })
102
-
103
- expect(() => new ServerGroup(data).getMap('foo')).toThrow('Unknown map key [foo]')
104
- })
105
- })
106
-
107
- describe('getBadge', () => {
108
- test(`should retrieve badge from the index`, () => {
109
- const data = serverGroupDataFixture.create({
110
- badges: [badgeDataFixture.create({ key: 'foo' })],
111
- })
112
-
113
- expect(new ServerGroup(data).getBadge('foo')).not.toBeNull()
114
- })
115
-
116
- test(`should throw error for unknown badge`, () => {
117
- const data = serverGroupDataFixture.create({
118
- badges: [],
119
- })
120
-
121
- expect(() => new ServerGroup(data).getBadge('foo')).toThrow('Unknown badge key [foo]')
122
- })
123
- })
124
- })
@@ -1,10 +0,0 @@
1
- import * as index from '../main/index'
2
-
3
- test('should export the changelog', () => {
4
- expect(index).toHaveProperty('CHANGELOG')
5
- })
6
-
7
- test('should export badge reference utils', () => {
8
- expect(index).toHaveProperty('createBadgeReference')
9
- expect(index).toHaveProperty('createMapReference')
10
- })
@@ -1,39 +0,0 @@
1
- import { Badge, createBadgeReference, createMapReference, GameMap } from '../main'
2
- import { badgeDataFixture } from './api/badge-data.fixture'
3
- import { gameMapDataFixture } from './api/game-map-data.fixture'
4
-
5
- describe(createBadgeReference.name, () => {
6
- test('should return the expected pattern', () => {
7
- expect(createBadgeReference('foo')).toBe('[badge:foo]')
8
- expect(createBadgeReference('bar')).toBe('[badge:bar]')
9
- expect(createBadgeReference('foo-bar')).toBe('[badge:foo-bar]')
10
- })
11
-
12
- test('should accept a Badge object', () => {
13
- const badge = new Badge(badgeDataFixture.create({ key: 'foo' }))
14
- expect(createBadgeReference(badge)).toBe('[badge:foo]')
15
- })
16
-
17
- test('should accept a BadgeData object', () => {
18
- const badge = badgeDataFixture.create({ key: 'foo' })
19
- expect(createBadgeReference(badge)).toBe('[badge:foo]')
20
- })
21
- })
22
-
23
- describe(createMapReference.name, () => {
24
- test('should return the expected pattern', () => {
25
- expect(createMapReference('foo')).toBe('[map:foo]')
26
- expect(createMapReference('bar')).toBe('[map:bar]')
27
- expect(createMapReference('foo-bar')).toBe('[map:foo-bar]')
28
- })
29
-
30
- test('should accept a GameMap object', () => {
31
- const map = new GameMap(gameMapDataFixture.create({ key: 'foo' }))
32
- expect(createMapReference(map)).toBe('[map:foo]')
33
- })
34
-
35
- test('should accept a GameMapData object', () => {
36
- const map = gameMapDataFixture.create({ key: 'foo' })
37
- expect(createMapReference(map)).toBe('[map:foo]')
38
- })
39
- })