optolith-database-schema 0.12.0 → 0.13.0
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 +33 -0
- package/lib/cache/newApplicationsAndUses.d.ts +17 -0
- package/lib/cache/newApplicationsAndUses.js +67 -0
- package/lib/cacheConfig.d.ts +4 -0
- package/lib/cacheConfig.js +1 -0
- package/lib/config/cache.d.ts +7 -0
- package/lib/config/cache.js +4 -0
- package/lib/main.d.ts +42 -0
- package/lib/main.js +44 -0
- package/lib/typeConfig.d.ts +2 -0
- package/lib/types/Advantage.js +4 -2
- package/lib/types/AnimalDisease.js +4 -2
- package/lib/types/AnimalType.js +4 -2
- package/lib/types/ArcaneBardTradition.js +4 -2
- package/lib/types/ArcaneDancerTradition.js +4 -2
- package/lib/types/Aspect.js +4 -2
- package/lib/types/Attribute.js +5 -3
- package/lib/types/Blessing.js +4 -2
- package/lib/types/Cantrip.js +4 -2
- package/lib/types/Ceremony.js +4 -2
- package/lib/types/CombatTechnique_Close.js +4 -2
- package/lib/types/CombatTechnique_Ranged.js +4 -2
- package/lib/types/Condition.js +4 -2
- package/lib/types/Continent.js +4 -2
- package/lib/types/Culture.d.ts +4 -17
- package/lib/types/Culture.js +4 -40
- package/lib/types/DerivedCharacteristic.js +4 -2
- package/lib/types/Disadvantage.js +4 -2
- package/lib/types/Disease.js +4 -2
- package/lib/types/Element.js +4 -2
- package/lib/types/ExperienceLevel.js +4 -2
- package/lib/types/EyeColor.js +4 -2
- package/lib/types/FamiliarsTrick.js +4 -2
- package/lib/types/HairColor.js +4 -2
- package/lib/types/Kirchenpraegung.js +4 -2
- package/lib/types/Lessons_Curriculum.js +4 -2
- package/lib/types/Lessons_Guideline.js +4 -2
- package/lib/types/LiturgicalChant.js +4 -2
- package/lib/types/Locale.js +3 -1
- package/lib/types/MetaCondition.js +4 -2
- package/lib/types/PactCategory.js +4 -2
- package/lib/types/Patron.d.ts +2 -12
- package/lib/types/Patron.js +4 -22
- package/lib/types/PatronCategory.js +4 -2
- package/lib/types/PersonalityTrait.js +4 -2
- package/lib/types/Profession.d.ts +1 -5
- package/lib/types/Profession.js +4 -8
- package/lib/types/Property.js +4 -2
- package/lib/types/Race.d.ts +68 -134
- package/lib/types/Race.js +4 -13
- package/lib/types/Region.js +4 -2
- package/lib/types/Ritual.js +4 -2
- package/lib/types/Service.d.ts +1 -4
- package/lib/types/Service.js +4 -7
- package/lib/types/SexPractice.js +4 -2
- package/lib/types/Skill.d.ts +2 -10
- package/lib/types/Skill.js +4 -21
- package/lib/types/SkillGroup.js +4 -2
- package/lib/types/SkillModificationLevel.d.ts +1 -4
- package/lib/types/SkillModificationLevel.js +4 -7
- package/lib/types/SocialStatus.js +4 -2
- package/lib/types/Spell.js +4 -2
- package/lib/types/State.js +4 -2
- package/lib/types/Talisman.d.ts +1 -7
- package/lib/types/Talisman.js +4 -10
- package/lib/types/TargetCategory.js +4 -2
- package/lib/types/UI.d.ts +171 -128
- package/lib/types/UI.js +2 -0
- package/lib/types/_Activatable.d.ts +5 -19
- package/lib/types/_Activatable.js +1 -40
- package/lib/types/_ActivatableSelectOptionCategory.d.ts +1 -4
- package/lib/types/_ActivatableSelectOptionCategory.js +1 -8
- package/lib/types/_ActivatableSkillCastingTime.d.ts +1 -4
- package/lib/types/_ActivatableSkillCastingTime.js +1 -5
- package/lib/types/_ActivatableSkillCheckResultBased.d.ts +2 -8
- package/lib/types/_ActivatableSkillCheckResultBased.js +1 -16
- package/lib/types/_ActivatableSkillDuration.d.ts +1 -12
- package/lib/types/_ActivatableSkillDuration.js +1 -13
- package/lib/types/_ActivatableSkillRange.d.ts +1 -4
- package/lib/types/_ActivatableSkillRange.js +1 -5
- package/lib/types/_Dice.d.ts +1 -5
- package/lib/types/_Dice.js +1 -9
- package/lib/types/_DiseasePoison.d.ts +2 -6
- package/lib/types/_DiseasePoison.js +1 -11
- package/lib/types/_ImprovementCost.d.ts +1 -6
- package/lib/types/_ImprovementCost.js +1 -10
- package/lib/types/_Sex.d.ts +1 -4
- package/lib/types/_Sex.js +1 -8
- package/lib/types/_SkillCheck.d.ts +1 -8
- package/lib/types/_SkillCheck.js +1 -13
- package/lib/types/equipment/EquipmentPackage.js +4 -2
- package/lib/types/equipment/item/Alchemicum.js +4 -2
- package/lib/types/equipment/item/Ammunition.js +4 -2
- package/lib/types/equipment/item/Animal.js +4 -2
- package/lib/types/equipment/item/AnimalCare.js +4 -2
- package/lib/types/equipment/item/Armor.js +4 -2
- package/lib/types/equipment/item/BandageOrRemedy.js +4 -2
- package/lib/types/equipment/item/Book.js +4 -2
- package/lib/types/equipment/item/CeremonialItem.js +4 -2
- package/lib/types/equipment/item/Clothes.js +4 -2
- package/lib/types/equipment/item/Container.js +4 -2
- package/lib/types/equipment/item/Elixir.js +4 -2
- package/lib/types/equipment/item/EquipmentOfBlessedOnes.js +4 -2
- package/lib/types/equipment/item/GemOrPreciousStone.js +4 -2
- package/lib/types/equipment/item/IlluminationLightSource.d.ts +1 -3
- package/lib/types/equipment/item/IlluminationLightSource.js +4 -6
- package/lib/types/equipment/item/IlluminationRefillsOrSupplies.js +4 -2
- package/lib/types/equipment/item/Jewelry.js +4 -2
- package/lib/types/equipment/item/Liebesspielzeug.js +4 -2
- package/lib/types/equipment/item/LuxuryGood.js +4 -2
- package/lib/types/equipment/item/MagicalArtifact.js +4 -2
- package/lib/types/equipment/item/MusicalInstrument.js +4 -2
- package/lib/types/equipment/item/OrienteeringAid.js +4 -2
- package/lib/types/equipment/item/Poison.d.ts +3 -15
- package/lib/types/equipment/item/Poison.js +4 -20
- package/lib/types/equipment/item/RopeOrChain.js +4 -2
- package/lib/types/equipment/item/Stationary.js +4 -2
- package/lib/types/equipment/item/ThievesTool.js +4 -2
- package/lib/types/equipment/item/ToolOfTheTrade.js +4 -2
- package/lib/types/equipment/item/TravelGearOrTool.js +4 -2
- package/lib/types/equipment/item/Vehicle.js +4 -2
- package/lib/types/equipment/item/Weapon.js +4 -2
- package/lib/types/equipment/item/WeaponAccessory.js +4 -2
- package/lib/types/equipment/item/_Herbary.d.ts +2 -14
- package/lib/types/equipment/item/_Herbary.js +1 -19
- package/lib/types/equipment/item/sub/ArmorType.js +4 -2
- package/lib/types/equipment/item/sub/Reach.js +4 -2
- package/lib/types/magicalActions/AnimistPower.js +4 -2
- package/lib/types/magicalActions/AnimistPower_Tribe.js +4 -2
- package/lib/types/magicalActions/Curse.js +4 -2
- package/lib/types/magicalActions/DominationRitual.js +4 -2
- package/lib/types/magicalActions/ElvenMagicalSong.js +4 -2
- package/lib/types/magicalActions/GeodeRitual.js +4 -2
- package/lib/types/magicalActions/JesterTrick.js +4 -2
- package/lib/types/magicalActions/MagicalDance.js +4 -2
- package/lib/types/magicalActions/MagicalMelody.js +4 -2
- package/lib/types/magicalActions/MagicalRune.js +4 -2
- package/lib/types/magicalActions/ZibiljaRitual.js +4 -2
- package/lib/types/magicalActions/_MusicTradition.d.ts +2 -8
- package/lib/types/magicalActions/_MusicTradition.js +1 -10
- package/lib/types/magicalActions/_SkillReference.d.ts +1 -4
- package/lib/types/magicalActions/_SkillReference.js +1 -5
- package/lib/types/prerequisites/single/PrimaryAttributePrerequisite.d.ts +1 -4
- package/lib/types/prerequisites/single/PrimaryAttributePrerequisite.js +1 -5
- package/lib/types/prerequisites/single/RatedMinimumNumberPrerequisite.d.ts +1 -5
- package/lib/types/prerequisites/single/RatedMinimumNumberPrerequisite.js +1 -6
- package/lib/types/prerequisites/single/SexualCharacteristicPrerequisite.d.ts +1 -4
- package/lib/types/prerequisites/single/SexualCharacteristicPrerequisite.js +1 -5
- package/lib/types/prerequisites/single/TextPrerequisite.d.ts +2 -8
- package/lib/types/prerequisites/single/TextPrerequisite.js +1 -10
- package/lib/types/prerequisites/single/TraditionPrerequisite.d.ts +2 -8
- package/lib/types/prerequisites/single/TraditionPrerequisite.js +1 -18
- package/lib/types/rule/CoreRule.d.ts +1 -4
- package/lib/types/rule/CoreRule.js +4 -7
- package/lib/types/rule/FocusRule.js +4 -2
- package/lib/types/rule/FocusRule_Subject.js +4 -2
- package/lib/types/rule/OptionalRule.js +4 -2
- package/lib/types/source/Publication.d.ts +1 -6
- package/lib/types/source/Publication.js +4 -12
- package/lib/types/specialAbility/AdvancedCombatSpecialAbility.js +4 -2
- package/lib/types/specialAbility/AdvancedKarmaSpecialAbility.js +4 -2
- package/lib/types/specialAbility/AdvancedMagicalSpecialAbility.js +4 -2
- package/lib/types/specialAbility/AdvancedSkillSpecialAbility.js +4 -2
- package/lib/types/specialAbility/AncestorGlyph.js +4 -2
- package/lib/types/specialAbility/BlessedTradition.js +4 -2
- package/lib/types/specialAbility/BrawlingSpecialAbility.js +4 -2
- package/lib/types/specialAbility/CeremonialItemSpecialAbility.js +4 -2
- package/lib/types/specialAbility/CombatSpecialAbility.js +4 -2
- package/lib/types/specialAbility/CombatStyleSpecialAbility.js +4 -2
- package/lib/types/specialAbility/CommandSpecialAbility.js +4 -2
- package/lib/types/specialAbility/FamiliarSpecialAbility.js +4 -2
- package/lib/types/specialAbility/FatePointSexSpecialAbility.js +4 -2
- package/lib/types/specialAbility/FatePointSpecialAbility.js +4 -2
- package/lib/types/specialAbility/GeneralSpecialAbility.js +4 -2
- package/lib/types/specialAbility/KarmaSpecialAbility.js +4 -2
- package/lib/types/specialAbility/LiturgicalStyleSpecialAbility.js +4 -2
- package/lib/types/specialAbility/LycantropicGift.js +4 -2
- package/lib/types/specialAbility/MagicStyleSpecialAbility.js +4 -2
- package/lib/types/specialAbility/MagicalSign.js +4 -2
- package/lib/types/specialAbility/MagicalSpecialAbility.js +4 -2
- package/lib/types/specialAbility/MagicalTradition.js +4 -2
- package/lib/types/specialAbility/PactGift.d.ts +2 -8
- package/lib/types/specialAbility/PactGift.js +4 -12
- package/lib/types/specialAbility/ProtectiveWardingCircleSpecialAbility.js +4 -2
- package/lib/types/specialAbility/Sermon.js +4 -2
- package/lib/types/specialAbility/SexSpecialAbility.js +4 -2
- package/lib/types/specialAbility/SikaryanDrainSpecialAbility.js +4 -2
- package/lib/types/specialAbility/SkillStyleSpecialAbility.js +4 -2
- package/lib/types/specialAbility/VampiricGift.js +4 -2
- package/lib/types/specialAbility/Vision.js +4 -2
- package/lib/types/specialAbility/sub/Language.js +4 -2
- package/lib/types/specialAbility/sub/Script.js +4 -2
- package/lib/types/specialAbility/sub/TradeSecret.js +4 -2
- package/lib/types/traditionArtifacts/ArcaneOrbEnchantment.js +4 -2
- package/lib/types/traditionArtifacts/AttireEnchantment.js +4 -2
- package/lib/types/traditionArtifacts/BowlEnchantment.js +4 -2
- package/lib/types/traditionArtifacts/CauldronEnchantment.js +4 -2
- package/lib/types/traditionArtifacts/ChronicleEnchantment.js +4 -2
- package/lib/types/traditionArtifacts/DaggerRitual.js +4 -2
- package/lib/types/traditionArtifacts/FoolsHatEnchantment.js +4 -2
- package/lib/types/traditionArtifacts/InstrumentEnchantment.js +4 -2
- package/lib/types/traditionArtifacts/Krallenkettenzauber.js +4 -2
- package/lib/types/traditionArtifacts/OrbEnchantment.js +4 -2
- package/lib/types/traditionArtifacts/RingEnchantment.js +4 -2
- package/lib/types/traditionArtifacts/SickleRitual.js +4 -2
- package/lib/types/traditionArtifacts/SpellSwordEnchantment.js +4 -2
- package/lib/types/traditionArtifacts/StaffEnchantment.js +4 -2
- package/lib/types/traditionArtifacts/ToyEnchantment.js +4 -2
- package/lib/types/traditionArtifacts/Trinkhornzauber.js +4 -2
- package/lib/types/traditionArtifacts/WandEnchantment.js +4 -2
- package/lib/types/traditionArtifacts/WeaponEnchantment.js +4 -2
- package/lib/types/traditionArtifacts/sub/AnimalShape.js +4 -2
- package/lib/types/traditionArtifacts/sub/AnimalShapePath.js +4 -2
- package/lib/types/traditionArtifacts/sub/AnimalShapeSize.js +4 -2
- package/lib/types/traditionArtifacts/sub/Brew.js +4 -2
- package/lib/validation/builders/naming.d.ts +3 -1
- package/lib/validation/builders/naming.js +9 -6
- package/lib/validation/filename.d.ts +1 -1
- package/lib/validation/filename.js +1 -1
- package/lib/validation/raw.d.ts +1 -1
- package/lib/validation/raw.js +3 -4
- package/package.json +2 -2
- package/schema/Culture.schema.json +31 -13
- package/schema/Patron.schema.json +26 -10
- package/schema/Profession.schema.json +10 -4
- package/schema/Race.schema.json +79 -208
- package/schema/Service.schema.json +7 -3
- package/schema/Skill.schema.json +20 -8
- package/schema/SkillModificationLevel.schema.json +7 -3
- package/schema/Talisman.schema.json +16 -6
- package/schema/UI.schema.json +502 -304
- package/schema/_Activatable.schema.json +32 -14
- package/schema/_ActivatableSelectOptionCategory.schema.json +7 -3
- package/schema/_ActivatableSkillCastingTime.schema.json +7 -3
- package/schema/_ActivatableSkillCheckResultBased.schema.json +14 -6
- package/schema/_ActivatableSkillDuration.schema.json +31 -11
- package/schema/_ActivatableSkillRange.schema.json +7 -3
- package/schema/_Dice.schema.json +10 -4
- package/schema/_DiseasePoison.schema.json +10 -4
- package/schema/_ImprovementCost.schema.json +13 -5
- package/schema/_Sex.schema.json +7 -3
- package/schema/_SkillCheck.schema.json +19 -7
- package/schema/equipment/item/IlluminationLightSource.schema.json +4 -2
- package/schema/equipment/item/Poison.schema.json +30 -12
- package/schema/equipment/item/_Herbary.schema.json +32 -12
- package/schema/magicalActions/_MusicTradition.schema.json +14 -6
- package/schema/magicalActions/_SkillReference.schema.json +7 -3
- package/schema/prerequisites/single/PrimaryAttributePrerequisite.schema.json +7 -3
- package/schema/prerequisites/single/RatedMinimumNumberPrerequisite.schema.json +10 -4
- package/schema/prerequisites/single/SexualCharacteristicPrerequisite.schema.json +7 -3
- package/schema/prerequisites/single/TextPrerequisite.schema.json +14 -6
- package/schema/prerequisites/single/TraditionPrerequisite.schema.json +14 -6
- package/schema/rule/CoreRule.schema.json +7 -3
- package/schema/source/Publication.schema.json +13 -5
- package/schema/specialAbility/PactGift.schema.json +14 -6
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,39 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [0.13.0](https://github.com/elyukai/optolith-database-schema/compare/v0.12.1...v0.13.0) (2023-10-03)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### ⚠ BREAKING CHANGES
|
|
9
|
+
|
|
10
|
+
* change and add lots of new translations with new key format
|
|
11
|
+
* replace all enums with union types to enable type-only usage
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* cache capability ([45cf7bf](https://github.com/elyukai/optolith-database-schema/commit/45cf7bfd3e43f2786926633b0c5e2eee8982d965))
|
|
16
|
+
* change and add lots of new translations with new key format ([3068ee9](https://github.com/elyukai/optolith-database-schema/commit/3068ee94ed6a6d0a021704f92af18984d33bb53b))
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
20
|
+
|
|
21
|
+
* typo in getFilenamePrefixAsNumericId ([802349e](https://github.com/elyukai/optolith-database-schema/commit/802349ea5b566682e0fb7bbd45811bda1800a686))
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
* replace all enums with union types to enable type-only usage ([fe5aa11](https://github.com/elyukai/optolith-database-schema/commit/fe5aa116f8fc922c3b6150d2bc663ddde5e8f104))
|
|
25
|
+
|
|
26
|
+
### [0.12.1](https://github.com/elyukai/optolith-database-schema/compare/v0.12.0...v0.12.1) (2023-06-11)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Features
|
|
30
|
+
|
|
31
|
+
* provide function to get raw validation results ([c4bf451](https://github.com/elyukai/optolith-database-schema/commit/c4bf451195f7b754edf15ef43cd5363baafdd1d4))
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Bug Fixes
|
|
35
|
+
|
|
36
|
+
* use different file name validation patterns per type ([8e3915f](https://github.com/elyukai/optolith-database-schema/commit/8e3915f716823b971068018acba196b900fc390c))
|
|
37
|
+
|
|
5
38
|
## [0.12.0](https://github.com/elyukai/optolith-database-schema/compare/v0.11.9...v0.12.0) (2023-06-03)
|
|
6
39
|
|
|
7
40
|
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { CacheConfig } from "../cacheConfig.js";
|
|
2
|
+
import type { SkillApplication, SkillUse } from "../types/_Activatable.js";
|
|
3
|
+
import type { ActivatableIdentifier } from "../types/_IdentifierGroup.js";
|
|
4
|
+
export type NewApplication = {
|
|
5
|
+
source: ActivatableIdentifier;
|
|
6
|
+
data: SkillApplication;
|
|
7
|
+
requiredSkillRating?: number;
|
|
8
|
+
};
|
|
9
|
+
export type Use = {
|
|
10
|
+
source: ActivatableIdentifier;
|
|
11
|
+
data: SkillUse;
|
|
12
|
+
};
|
|
13
|
+
export type NewApplicationsAndUsesCache = {
|
|
14
|
+
newApplications: Record<number, NewApplication[]>;
|
|
15
|
+
uses: Record<number, Use[]>;
|
|
16
|
+
};
|
|
17
|
+
export declare const config: CacheConfig<NewApplicationsAndUsesCache>;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
export const config = {
|
|
2
|
+
builder(database) {
|
|
3
|
+
const cache = {
|
|
4
|
+
newApplications: {},
|
|
5
|
+
uses: {},
|
|
6
|
+
};
|
|
7
|
+
const addNewApplicationsAndUses = (activatable, activatableId) => {
|
|
8
|
+
if (activatable.skill_applications) {
|
|
9
|
+
for (const newApplication of activatable.skill_applications) {
|
|
10
|
+
const pair = { source: activatableId, data: newApplication };
|
|
11
|
+
if (newApplication.skill.tag === "Single") {
|
|
12
|
+
const previous = (cache.newApplications[newApplication.skill.single.id.skill] ??= []);
|
|
13
|
+
previous.push(pair);
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
for (const skill of newApplication.skill.multiple.list) {
|
|
17
|
+
const previous = (cache.newApplications[skill.id.skill] ??= []);
|
|
18
|
+
previous.push(pair);
|
|
19
|
+
}
|
|
20
|
+
if (newApplication.skill.multiple.required_skill_rating !== undefined) {
|
|
21
|
+
pair.requiredSkillRating = newApplication.skill.multiple.required_skill_rating;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (activatable.skill_uses) {
|
|
27
|
+
for (const use of activatable.skill_uses) {
|
|
28
|
+
const pair = { source: activatableId, data: use };
|
|
29
|
+
if (use.skill.tag === "Single") {
|
|
30
|
+
const previous = (cache.uses[use.skill.single.id.skill] ??= []);
|
|
31
|
+
previous.push(pair);
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
for (const skill of use.skill.multiple.list) {
|
|
35
|
+
const previous = (cache.uses[skill.id.skill] ??= []);
|
|
36
|
+
previous.push(pair);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
const entries = [
|
|
43
|
+
[database.advancedCombatSpecialAbilities, n => ({ tag: "AdvancedCombatSpecialAbility", advanced_combat_special_ability: n })],
|
|
44
|
+
[database.advancedKarmaSpecialAbilities, n => ({ tag: "AdvancedKarmaSpecialAbility", advanced_karma_special_ability: n })],
|
|
45
|
+
[database.advancedMagicalSpecialAbilities, n => ({ tag: "AdvancedMagicalSpecialAbility", advanced_magical_special_ability: n })],
|
|
46
|
+
[database.advancedSkillSpecialAbilities, n => ({ tag: "AdvancedSkillSpecialAbility", advanced_skill_special_ability: n })],
|
|
47
|
+
[database.advantages, n => ({ tag: "Advantage", advantage: n })],
|
|
48
|
+
[database.blessedTraditions, n => ({ tag: "BlessedTradition", blessed_tradition: n })],
|
|
49
|
+
[database.ceremonialItemSpecialAbilities, n => ({ tag: "CeremonialItemSpecialAbility", ceremonial_item_special_ability: n })],
|
|
50
|
+
[database.combatSpecialAbilities, n => ({ tag: "CombatSpecialAbility", combat_special_ability: n })],
|
|
51
|
+
[database.combatStyleSpecialAbilities, n => ({ tag: "CombatStyleSpecialAbility", combat_style_special_ability: n })],
|
|
52
|
+
[database.fatePointSpecialAbilities, n => ({ tag: "FatePointSpecialAbility", fate_point_special_ability: n })],
|
|
53
|
+
[database.generalSpecialAbilities, n => ({ tag: "GeneralSpecialAbility", general_special_ability: n })],
|
|
54
|
+
[database.liturgicalStyleSpecialAbilities, n => ({ tag: "LiturgicalStyleSpecialAbility", liturgical_style_special_ability: n })],
|
|
55
|
+
[database.magicStyleSpecialAbilities, n => ({ tag: "MagicStyleSpecialAbility", magic_style_special_ability: n })],
|
|
56
|
+
[database.magicalSpecialAbilities, n => ({ tag: "MagicalSpecialAbility", magical_special_ability: n })],
|
|
57
|
+
[database.magicalTraditions, n => ({ tag: "MagicalTradition", magical_tradition: n })],
|
|
58
|
+
[database.sexSpecialAbilities, n => ({ tag: "SexSpecialAbility", sex_special_ability: n })],
|
|
59
|
+
];
|
|
60
|
+
entries.forEach(([entityEntries, createId]) => {
|
|
61
|
+
entityEntries.forEach(([numericId, activatable]) => {
|
|
62
|
+
addNewApplicationsAndUses(activatable, createId(numericId));
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
return cache;
|
|
66
|
+
}
|
|
67
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as NewApplicationsAndUses from "../cache/newApplicationsAndUses.js";
|
|
2
|
+
export type CacheMap = {
|
|
3
|
+
newApplicationsAndUses: NewApplicationsAndUses.NewApplicationsAndUsesCache;
|
|
4
|
+
};
|
|
5
|
+
export declare const cacheMap: {
|
|
6
|
+
newApplicationsAndUses: import("../cacheConfig.js").CacheConfig<NewApplicationsAndUses.NewApplicationsAndUsesCache>;
|
|
7
|
+
};
|
package/lib/main.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { CacheMap } from "./config/cache.js";
|
|
1
2
|
import { TypeId, TypeMap } from "./config/types.js";
|
|
2
3
|
import "./helpers/array.js";
|
|
3
4
|
import { Result } from "./helpers/result.js";
|
|
4
5
|
import { IntegrityError } from "./validation/builders/integrity.js";
|
|
5
6
|
import { FileNameError } from "./validation/builders/naming.js";
|
|
6
7
|
import { SchemaError } from "./validation/builders/schema.js";
|
|
8
|
+
import { TypeValidationResult } from "./validation/raw.js";
|
|
7
9
|
/**
|
|
8
10
|
* Options for validating data files.
|
|
9
11
|
*/
|
|
@@ -26,6 +28,12 @@ export type TypeValidationError = IntegrityError | FileNameError | SchemaError;
|
|
|
26
28
|
export type ValidResults = {
|
|
27
29
|
[K in keyof TypeMap]: [id: TypeId<K>, data: TypeMap[K]][];
|
|
28
30
|
};
|
|
31
|
+
/**
|
|
32
|
+
* A map of all entries, grouped by entity type.
|
|
33
|
+
*/
|
|
34
|
+
export type RawResults = {
|
|
35
|
+
[K in keyof TypeMap]: TypeValidationResult<K>[];
|
|
36
|
+
};
|
|
29
37
|
/**
|
|
30
38
|
* A dictionary of entity types and their data’s associated locations.
|
|
31
39
|
*/
|
|
@@ -51,4 +59,38 @@ export declare const getAllValidDataOrErrors: (entityDirPaths: EntityDirectoryPa
|
|
|
51
59
|
* @returns The valid data.
|
|
52
60
|
*/
|
|
53
61
|
export declare const getAllValidData: (entityDirPaths: EntityDirectoryPaths, options?: ValidationOptions) => Promise<ValidResults>;
|
|
62
|
+
/**
|
|
63
|
+
* Returns all data as a map of entity types to their validation results.
|
|
64
|
+
* @param entityDirPaths THe paths to the directories containing the data to be
|
|
65
|
+
* validated.
|
|
66
|
+
* @param options Configuration options for the validation.
|
|
67
|
+
* @returns The validation results.
|
|
68
|
+
*/
|
|
69
|
+
export declare const getRawResults: (entityDirPaths: EntityDirectoryPaths, options?: ValidationOptions) => Promise<RawResults>;
|
|
70
|
+
/**
|
|
71
|
+
* A dictionary of cache types and their associated location.
|
|
72
|
+
*/
|
|
73
|
+
export type CachePaths = {
|
|
74
|
+
[K in keyof CacheMap]: string;
|
|
75
|
+
};
|
|
76
|
+
export type CacheOptions = {
|
|
77
|
+
/**
|
|
78
|
+
* Whether to pretty-print the JSON. Default is `false`.
|
|
79
|
+
*/
|
|
80
|
+
pretty?: boolean;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Builds the cache and writes it to the specified paths in JSON format.
|
|
84
|
+
* @param cachePaths The absolute paths to write each cache to.
|
|
85
|
+
* @param validResults The data to build the cache from. Usually the result of
|
|
86
|
+
* `getAllValidData`.
|
|
87
|
+
* @param options Configuration options for building the cache.
|
|
88
|
+
*/
|
|
89
|
+
export declare const buildCache: (cachePaths: CachePaths, validResults: ValidResults, options?: CacheOptions) => Promise<void>;
|
|
90
|
+
/**
|
|
91
|
+
* Reads the cache from the specified paths in JSON format.
|
|
92
|
+
* @param cachePaths The absolute paths to read each cache from.
|
|
93
|
+
* @returns
|
|
94
|
+
*/
|
|
95
|
+
export declare const getCache: (cachePaths: CachePaths) => Promise<CacheMap>;
|
|
54
96
|
export {};
|
package/lib/main.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
2
|
+
import { dirname } from "node:path";
|
|
3
|
+
import { cacheMap } from "./config/cache.js";
|
|
1
4
|
import "./helpers/array.js";
|
|
2
5
|
import { mapSecond } from "./helpers/pair.js";
|
|
3
6
|
import { Result, error, isError, isOk, ok } from "./helpers/result.js";
|
|
@@ -53,3 +56,44 @@ export const getAllValidData = async (entityDirPaths, options = {}) => {
|
|
|
53
56
|
const rawResultMap = await getRawValidationResults(entityDirPaths, options);
|
|
54
57
|
return filterResultMapByValidData(rawResultMap);
|
|
55
58
|
};
|
|
59
|
+
/**
|
|
60
|
+
* Returns all data as a map of entity types to their validation results.
|
|
61
|
+
* @param entityDirPaths THe paths to the directories containing the data to be
|
|
62
|
+
* validated.
|
|
63
|
+
* @param options Configuration options for the validation.
|
|
64
|
+
* @returns The validation results.
|
|
65
|
+
*/
|
|
66
|
+
export const getRawResults = async (entityDirPaths, options = {}) => {
|
|
67
|
+
const rawResultMap = await getRawValidationResults(entityDirPaths, options);
|
|
68
|
+
return Object.fromEntries(rawResultMap);
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Builds the cache and writes it to the specified paths in JSON format.
|
|
72
|
+
* @param cachePaths The absolute paths to write each cache to.
|
|
73
|
+
* @param validResults The data to build the cache from. Usually the result of
|
|
74
|
+
* `getAllValidData`.
|
|
75
|
+
* @param options Configuration options for building the cache.
|
|
76
|
+
*/
|
|
77
|
+
export const buildCache = async (cachePaths, validResults, options = {}) => {
|
|
78
|
+
const { pretty = false } = options;
|
|
79
|
+
for (const [cacheName, cachePath] of Object.entries(cachePaths)) {
|
|
80
|
+
const cacheConfig = cacheMap[cacheName];
|
|
81
|
+
const cacheData = cacheConfig.builder(validResults);
|
|
82
|
+
await mkdir(dirname(cachePath), { recursive: true });
|
|
83
|
+
await writeFile(cachePath, JSON.stringify(cacheData, null, pretty ? 2 : undefined), "utf-8");
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Reads the cache from the specified paths in JSON format.
|
|
88
|
+
* @param cachePaths The absolute paths to read each cache from.
|
|
89
|
+
* @returns
|
|
90
|
+
*/
|
|
91
|
+
export const getCache = async (cachePaths) => {
|
|
92
|
+
const cache = {};
|
|
93
|
+
for (const [cacheName, cachePath] of Object.entries(cachePaths)) {
|
|
94
|
+
const cacheConfig = cacheMap[cacheName];
|
|
95
|
+
const cacheData = JSON.parse(await readFile(cachePath, "utf-8"));
|
|
96
|
+
cache[cacheName] = cacheData;
|
|
97
|
+
}
|
|
98
|
+
return cache;
|
|
99
|
+
};
|
package/lib/typeConfig.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { IntegrityValidator } from "./validation/builders/integrity.js";
|
|
2
|
+
import { FileNameValidator } from "./validation/builders/naming.js";
|
|
2
3
|
import { SchemaValidator } from "./validation/builders/schema.js";
|
|
3
4
|
export type TypeConfig<T, ID extends string | number = number> = {
|
|
4
5
|
name: string;
|
|
5
6
|
id: (data: T, filepath: string) => ID;
|
|
6
7
|
integrityValidator: IntegrityValidator<T>;
|
|
7
8
|
schemaValidator: SchemaValidator<T>;
|
|
9
|
+
fileNameValidator: FileNameValidator;
|
|
8
10
|
};
|
package/lib/types/Advantage.js
CHANGED
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
* @main Advantage
|
|
3
3
|
*/
|
|
4
4
|
import { todo } from "../validation/builders/integrity.js";
|
|
5
|
+
import { validateEntityFileName } from "../validation/builders/naming.js";
|
|
5
6
|
import { createSchemaValidator } from "../validation/builders/schema.js";
|
|
6
|
-
import {
|
|
7
|
+
import { getFilenamePrefixAsNumericId } from "../validation/filename.js";
|
|
7
8
|
export const config = {
|
|
8
9
|
name: "Advantage",
|
|
9
|
-
id:
|
|
10
|
+
id: getFilenamePrefixAsNumericId,
|
|
10
11
|
integrityValidator: todo("Advantage"),
|
|
11
12
|
schemaValidator: createSchemaValidator(import.meta.url),
|
|
13
|
+
fileNameValidator: validateEntityFileName,
|
|
12
14
|
};
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
* @main AnimalDisease
|
|
3
3
|
*/
|
|
4
4
|
import { todo } from "../validation/builders/integrity.js";
|
|
5
|
+
import { validateEntityFileName } from "../validation/builders/naming.js";
|
|
5
6
|
import { createSchemaValidator } from "../validation/builders/schema.js";
|
|
6
|
-
import {
|
|
7
|
+
import { getFilenamePrefixAsNumericId } from "../validation/filename.js";
|
|
7
8
|
export const config = {
|
|
8
9
|
name: "AnimalDisease",
|
|
9
|
-
id:
|
|
10
|
+
id: getFilenamePrefixAsNumericId,
|
|
10
11
|
integrityValidator: todo("AnimalDisease"),
|
|
11
12
|
schemaValidator: createSchemaValidator(import.meta.url),
|
|
13
|
+
fileNameValidator: validateEntityFileName,
|
|
12
14
|
};
|
package/lib/types/AnimalType.js
CHANGED
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
* @main AnimalType
|
|
3
3
|
*/
|
|
4
4
|
import { todo } from "../validation/builders/integrity.js";
|
|
5
|
+
import { validateEntityFileName } from "../validation/builders/naming.js";
|
|
5
6
|
import { createSchemaValidator } from "../validation/builders/schema.js";
|
|
6
|
-
import {
|
|
7
|
+
import { getFilenamePrefixAsNumericId } from "../validation/filename.js";
|
|
7
8
|
export const config = {
|
|
8
9
|
name: "AnimalType",
|
|
9
|
-
id:
|
|
10
|
+
id: getFilenamePrefixAsNumericId,
|
|
10
11
|
integrityValidator: todo("AnimalType"),
|
|
11
12
|
schemaValidator: createSchemaValidator(import.meta.url),
|
|
13
|
+
fileNameValidator: validateEntityFileName,
|
|
12
14
|
};
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
* @main ArcaneBardTradition
|
|
3
3
|
*/
|
|
4
4
|
import { todo } from "../validation/builders/integrity.js";
|
|
5
|
+
import { validateEntityFileName } from "../validation/builders/naming.js";
|
|
5
6
|
import { createSchemaValidator } from "../validation/builders/schema.js";
|
|
6
|
-
import {
|
|
7
|
+
import { getFilenamePrefixAsNumericId } from "../validation/filename.js";
|
|
7
8
|
export const config = {
|
|
8
9
|
name: "ArcaneBardTradition",
|
|
9
|
-
id:
|
|
10
|
+
id: getFilenamePrefixAsNumericId,
|
|
10
11
|
integrityValidator: todo("ArcaneBardTradition"),
|
|
11
12
|
schemaValidator: createSchemaValidator(import.meta.url),
|
|
13
|
+
fileNameValidator: validateEntityFileName,
|
|
12
14
|
};
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
* @main ArcaneDancerTradition
|
|
3
3
|
*/
|
|
4
4
|
import { todo } from "../validation/builders/integrity.js";
|
|
5
|
+
import { validateEntityFileName } from "../validation/builders/naming.js";
|
|
5
6
|
import { createSchemaValidator } from "../validation/builders/schema.js";
|
|
6
|
-
import {
|
|
7
|
+
import { getFilenamePrefixAsNumericId } from "../validation/filename.js";
|
|
7
8
|
export const config = {
|
|
8
9
|
name: "ArcaneDancerTradition",
|
|
9
|
-
id:
|
|
10
|
+
id: getFilenamePrefixAsNumericId,
|
|
10
11
|
integrityValidator: todo("ArcaneDancerTradition"),
|
|
11
12
|
schemaValidator: createSchemaValidator(import.meta.url),
|
|
13
|
+
fileNameValidator: validateEntityFileName,
|
|
12
14
|
};
|
package/lib/types/Aspect.js
CHANGED
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
* @main Aspect
|
|
3
3
|
*/
|
|
4
4
|
import { todo } from "../validation/builders/integrity.js";
|
|
5
|
+
import { validateEntityFileName } from "../validation/builders/naming.js";
|
|
5
6
|
import { createSchemaValidator } from "../validation/builders/schema.js";
|
|
6
|
-
import {
|
|
7
|
+
import { getFilenamePrefixAsNumericId } from "../validation/filename.js";
|
|
7
8
|
export const config = {
|
|
8
9
|
name: "Aspect",
|
|
9
|
-
id:
|
|
10
|
+
id: getFilenamePrefixAsNumericId,
|
|
10
11
|
integrityValidator: todo("Aspect"),
|
|
11
12
|
schemaValidator: createSchemaValidator(import.meta.url),
|
|
13
|
+
fileNameValidator: validateEntityFileName,
|
|
12
14
|
};
|
package/lib/types/Attribute.js
CHANGED
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
* @main Attribute
|
|
3
3
|
*/
|
|
4
4
|
import { getReferencialIntegrityErrorsForTranslatable, reduceIntegrityValidationResults, validateEntityIntegrity } from "../validation/builders/integrity.js";
|
|
5
|
+
import { validateEntityFileName } from "../validation/builders/naming.js";
|
|
5
6
|
import { createSchemaValidator } from "../validation/builders/schema.js";
|
|
6
|
-
import {
|
|
7
|
+
import { getFilenamePrefixAsNumericId } from "../validation/filename.js";
|
|
7
8
|
export const config = {
|
|
8
9
|
name: "Attribute",
|
|
9
|
-
id:
|
|
10
|
-
integrityValidator: (validators, data, filepath) => reduceIntegrityValidationResults(validateEntityIntegrity(validators.identity.attributes.exists,
|
|
10
|
+
id: getFilenamePrefixAsNumericId,
|
|
11
|
+
integrityValidator: (validators, data, filepath) => reduceIntegrityValidationResults(validateEntityIntegrity(validators.identity.attributes.exists, getFilenamePrefixAsNumericId(data, filepath), data.id, [{ k: "id" }]), getReferencialIntegrityErrorsForTranslatable(validators, data)),
|
|
11
12
|
schemaValidator: createSchemaValidator(import.meta.url),
|
|
13
|
+
fileNameValidator: validateEntityFileName,
|
|
12
14
|
};
|
package/lib/types/Blessing.js
CHANGED
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
* @main Blessing
|
|
3
3
|
*/
|
|
4
4
|
import { todo } from "../validation/builders/integrity.js";
|
|
5
|
+
import { validateEntityFileName } from "../validation/builders/naming.js";
|
|
5
6
|
import { createSchemaValidator } from "../validation/builders/schema.js";
|
|
6
|
-
import {
|
|
7
|
+
import { getFilenamePrefixAsNumericId } from "../validation/filename.js";
|
|
7
8
|
export const config = {
|
|
8
9
|
name: "Blessing",
|
|
9
|
-
id:
|
|
10
|
+
id: getFilenamePrefixAsNumericId,
|
|
10
11
|
integrityValidator: todo("Blessing"),
|
|
11
12
|
schemaValidator: createSchemaValidator(import.meta.url),
|
|
13
|
+
fileNameValidator: validateEntityFileName,
|
|
12
14
|
};
|
package/lib/types/Cantrip.js
CHANGED
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
* @main Cantrip
|
|
3
3
|
*/
|
|
4
4
|
import { todo } from "../validation/builders/integrity.js";
|
|
5
|
+
import { validateEntityFileName } from "../validation/builders/naming.js";
|
|
5
6
|
import { createSchemaValidator } from "../validation/builders/schema.js";
|
|
6
|
-
import {
|
|
7
|
+
import { getFilenamePrefixAsNumericId } from "../validation/filename.js";
|
|
7
8
|
export const config = {
|
|
8
9
|
name: "Cantrip",
|
|
9
|
-
id:
|
|
10
|
+
id: getFilenamePrefixAsNumericId,
|
|
10
11
|
integrityValidator: todo("Cantrip"),
|
|
11
12
|
schemaValidator: createSchemaValidator(import.meta.url),
|
|
13
|
+
fileNameValidator: validateEntityFileName,
|
|
12
14
|
};
|
package/lib/types/Ceremony.js
CHANGED
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
* @main Ceremony
|
|
3
3
|
*/
|
|
4
4
|
import { todo } from "../validation/builders/integrity.js";
|
|
5
|
+
import { validateEntityFileName } from "../validation/builders/naming.js";
|
|
5
6
|
import { createSchemaValidator } from "../validation/builders/schema.js";
|
|
6
|
-
import {
|
|
7
|
+
import { getFilenamePrefixAsNumericId } from "../validation/filename.js";
|
|
7
8
|
export const config = {
|
|
8
9
|
name: "Ceremony",
|
|
9
|
-
id:
|
|
10
|
+
id: getFilenamePrefixAsNumericId,
|
|
10
11
|
integrityValidator: todo("Ceremony"),
|
|
11
12
|
schemaValidator: createSchemaValidator(import.meta.url),
|
|
13
|
+
fileNameValidator: validateEntityFileName,
|
|
12
14
|
};
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
* @main CloseCombatTechnique
|
|
3
3
|
*/
|
|
4
4
|
import { todo } from "../validation/builders/integrity.js";
|
|
5
|
+
import { validateEntityFileName } from "../validation/builders/naming.js";
|
|
5
6
|
import { createSchemaValidator } from "../validation/builders/schema.js";
|
|
6
|
-
import {
|
|
7
|
+
import { getFilenamePrefixAsNumericId } from "../validation/filename.js";
|
|
7
8
|
export const config = {
|
|
8
9
|
name: "CloseCombatTechnique",
|
|
9
|
-
id:
|
|
10
|
+
id: getFilenamePrefixAsNumericId,
|
|
10
11
|
integrityValidator: todo("CloseCombatTechnique"),
|
|
11
12
|
schemaValidator: createSchemaValidator(import.meta.url),
|
|
13
|
+
fileNameValidator: validateEntityFileName,
|
|
12
14
|
};
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
* @main RangedCombatTechnique
|
|
3
3
|
*/
|
|
4
4
|
import { todo } from "../validation/builders/integrity.js";
|
|
5
|
+
import { validateEntityFileName } from "../validation/builders/naming.js";
|
|
5
6
|
import { createSchemaValidator } from "../validation/builders/schema.js";
|
|
6
|
-
import {
|
|
7
|
+
import { getFilenamePrefixAsNumericId } from "../validation/filename.js";
|
|
7
8
|
export const config = {
|
|
8
9
|
name: "RangedCombatTechnique",
|
|
9
|
-
id:
|
|
10
|
+
id: getFilenamePrefixAsNumericId,
|
|
10
11
|
integrityValidator: todo("RangedCombatTechnique"),
|
|
11
12
|
schemaValidator: createSchemaValidator(import.meta.url),
|
|
13
|
+
fileNameValidator: validateEntityFileName,
|
|
12
14
|
};
|
package/lib/types/Condition.js
CHANGED
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
* @main Condition
|
|
3
3
|
*/
|
|
4
4
|
import { todo } from "../validation/builders/integrity.js";
|
|
5
|
+
import { validateEntityFileName } from "../validation/builders/naming.js";
|
|
5
6
|
import { createSchemaValidator } from "../validation/builders/schema.js";
|
|
6
|
-
import {
|
|
7
|
+
import { getFilenamePrefixAsNumericId } from "../validation/filename.js";
|
|
7
8
|
export const config = {
|
|
8
9
|
name: "Condition",
|
|
9
|
-
id:
|
|
10
|
+
id: getFilenamePrefixAsNumericId,
|
|
10
11
|
integrityValidator: todo("Condition"),
|
|
11
12
|
schemaValidator: createSchemaValidator(import.meta.url),
|
|
13
|
+
fileNameValidator: validateEntityFileName,
|
|
12
14
|
};
|
package/lib/types/Continent.js
CHANGED
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
* @main Continent
|
|
3
3
|
*/
|
|
4
4
|
import { todo } from "../validation/builders/integrity.js";
|
|
5
|
+
import { validateEntityFileName } from "../validation/builders/naming.js";
|
|
5
6
|
import { createSchemaValidator } from "../validation/builders/schema.js";
|
|
6
|
-
import {
|
|
7
|
+
import { getFilenamePrefixAsNumericId } from "../validation/filename.js";
|
|
7
8
|
export const config = {
|
|
8
9
|
name: "Continent",
|
|
9
|
-
id:
|
|
10
|
+
id: getFilenamePrefixAsNumericId,
|
|
10
11
|
integrityValidator: todo("Continent"),
|
|
11
12
|
schemaValidator: createSchemaValidator(import.meta.url),
|
|
13
|
+
fileNameValidator: validateEntityFileName,
|
|
12
14
|
};
|
package/lib/types/Culture.d.ts
CHANGED
|
@@ -103,10 +103,7 @@ export type AreaKnowledge = {
|
|
|
103
103
|
* Some professions or profession variants are simply more common (Mostly), but
|
|
104
104
|
* sometimes only specific elements are used (Only).
|
|
105
105
|
*/
|
|
106
|
-
export
|
|
107
|
-
Mostly = "Mostly",
|
|
108
|
-
Only = "Only"
|
|
109
|
-
}
|
|
106
|
+
export type Weight = "Mostly" | "Only";
|
|
110
107
|
/**
|
|
111
108
|
* Some professions or profession variants are more common than others. There
|
|
112
109
|
* may be cultures where some professions or profession variants are not
|
|
@@ -131,10 +128,7 @@ export type Weighted<ProfessionOrVariant> = {
|
|
|
131
128
|
* that intersect with the constraints (include) or only the professions
|
|
132
129
|
* are kept that are different from the constraints (exclude).
|
|
133
130
|
*/
|
|
134
|
-
export
|
|
135
|
-
Intersection = "Intersection",
|
|
136
|
-
Difference = "Difference"
|
|
137
|
-
}
|
|
131
|
+
export type CommonProfessionConstraintsOperation = "Intersection" | "Difference";
|
|
138
132
|
/**
|
|
139
133
|
* A list of professions. The filter specifies how the list is applied to
|
|
140
134
|
* all mundane professions.
|
|
@@ -156,10 +150,7 @@ export type CommonProfessionConstraints<Constraint> = {
|
|
|
156
150
|
/**
|
|
157
151
|
* Some professions may be found in a culture, but are not that common.
|
|
158
152
|
*/
|
|
159
|
-
export
|
|
160
|
-
Rare = "Rare",
|
|
161
|
-
VeryRare = "VeryRare"
|
|
162
|
-
}
|
|
153
|
+
export type Rarity = "Rare" | "VeryRare";
|
|
163
154
|
export type ProfessionConstraint = {
|
|
164
155
|
/**
|
|
165
156
|
* The profession's identifier.
|
|
@@ -179,11 +170,7 @@ export type ProfessionConstraint = {
|
|
|
179
170
|
/**
|
|
180
171
|
* Some professions may be found in a culture, but are not that common.
|
|
181
172
|
*/
|
|
182
|
-
export
|
|
183
|
-
Profane = "Profane",
|
|
184
|
-
Fighter = "Fighter",
|
|
185
|
-
Religious = "Religious"
|
|
186
|
-
}
|
|
173
|
+
export type MundaneProfessionSubgroupConstraint = "Profane" | "Fighter" | "Religious";
|
|
187
174
|
export type MagicalTraditionConstraint = {
|
|
188
175
|
/**
|
|
189
176
|
* The magical tradition's identifier.
|
package/lib/types/Culture.js
CHANGED
|
@@ -2,49 +2,13 @@
|
|
|
2
2
|
* @main Culture
|
|
3
3
|
*/
|
|
4
4
|
import { todo } from "../validation/builders/integrity.js";
|
|
5
|
+
import { validateEntityFileName } from "../validation/builders/naming.js";
|
|
5
6
|
import { createSchemaValidator } from "../validation/builders/schema.js";
|
|
6
|
-
import {
|
|
7
|
-
/**
|
|
8
|
-
* The "weight" difference compared to other professions or profession variants.
|
|
9
|
-
* Some professions or profession variants are simply more common (Mostly), but
|
|
10
|
-
* sometimes only specific elements are used (Only).
|
|
11
|
-
*/
|
|
12
|
-
export var Weight;
|
|
13
|
-
(function (Weight) {
|
|
14
|
-
Weight["Mostly"] = "Mostly";
|
|
15
|
-
Weight["Only"] = "Only";
|
|
16
|
-
})(Weight = Weight || (Weight = {}));
|
|
17
|
-
/**
|
|
18
|
-
* This defines how the list of constraints should be offset against the
|
|
19
|
-
* list of all mundane professions: Either only the professions are kept
|
|
20
|
-
* that intersect with the constraints (include) or only the professions
|
|
21
|
-
* are kept that are different from the constraints (exclude).
|
|
22
|
-
*/
|
|
23
|
-
export var CommonProfessionConstraintsOperation;
|
|
24
|
-
(function (CommonProfessionConstraintsOperation) {
|
|
25
|
-
CommonProfessionConstraintsOperation["Intersection"] = "Intersection";
|
|
26
|
-
CommonProfessionConstraintsOperation["Difference"] = "Difference";
|
|
27
|
-
})(CommonProfessionConstraintsOperation = CommonProfessionConstraintsOperation || (CommonProfessionConstraintsOperation = {}));
|
|
28
|
-
/**
|
|
29
|
-
* Some professions may be found in a culture, but are not that common.
|
|
30
|
-
*/
|
|
31
|
-
export var Rarity;
|
|
32
|
-
(function (Rarity) {
|
|
33
|
-
Rarity["Rare"] = "Rare";
|
|
34
|
-
Rarity["VeryRare"] = "VeryRare";
|
|
35
|
-
})(Rarity = Rarity || (Rarity = {}));
|
|
36
|
-
/**
|
|
37
|
-
* Some professions may be found in a culture, but are not that common.
|
|
38
|
-
*/
|
|
39
|
-
export var MundaneProfessionSubgroupConstraint;
|
|
40
|
-
(function (MundaneProfessionSubgroupConstraint) {
|
|
41
|
-
MundaneProfessionSubgroupConstraint["Profane"] = "Profane";
|
|
42
|
-
MundaneProfessionSubgroupConstraint["Fighter"] = "Fighter";
|
|
43
|
-
MundaneProfessionSubgroupConstraint["Religious"] = "Religious";
|
|
44
|
-
})(MundaneProfessionSubgroupConstraint = MundaneProfessionSubgroupConstraint || (MundaneProfessionSubgroupConstraint = {}));
|
|
7
|
+
import { getFilenamePrefixAsNumericId } from "../validation/filename.js";
|
|
45
8
|
export const config = {
|
|
46
9
|
name: "Culture",
|
|
47
|
-
id:
|
|
10
|
+
id: getFilenamePrefixAsNumericId,
|
|
48
11
|
integrityValidator: todo("Culture"),
|
|
49
12
|
schemaValidator: createSchemaValidator(import.meta.url),
|
|
13
|
+
fileNameValidator: validateEntityFileName,
|
|
50
14
|
};
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
* @main DerivedCharacteristic
|
|
3
3
|
*/
|
|
4
4
|
import { todo } from "../validation/builders/integrity.js";
|
|
5
|
+
import { validateEntityFileName } from "../validation/builders/naming.js";
|
|
5
6
|
import { createSchemaValidator } from "../validation/builders/schema.js";
|
|
6
|
-
import {
|
|
7
|
+
import { getFilenamePrefixAsNumericId } from "../validation/filename.js";
|
|
7
8
|
export const config = {
|
|
8
9
|
name: "DerivedCharacteristic",
|
|
9
|
-
id:
|
|
10
|
+
id: getFilenamePrefixAsNumericId,
|
|
10
11
|
integrityValidator: todo("DerivedCharacteristic"),
|
|
11
12
|
schemaValidator: createSchemaValidator(import.meta.url),
|
|
13
|
+
fileNameValidator: validateEntityFileName,
|
|
12
14
|
};
|