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
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
* @main SexSpecialAbility
|
|
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: "SexSpecialAbility",
|
|
9
|
-
id:
|
|
10
|
+
id: getFilenamePrefixAsNumericId,
|
|
10
11
|
integrityValidator: todo("SexSpecialAbility"),
|
|
11
12
|
schemaValidator: createSchemaValidator(import.meta.url),
|
|
13
|
+
fileNameValidator: validateEntityFileName,
|
|
12
14
|
};
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
* @main SikaryanDrainSpecialAbility
|
|
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: "SikaryanDrainSpecialAbility",
|
|
9
|
-
id:
|
|
10
|
+
id: getFilenamePrefixAsNumericId,
|
|
10
11
|
integrityValidator: todo("SikaryanDrainSpecialAbility"),
|
|
11
12
|
schemaValidator: createSchemaValidator(import.meta.url),
|
|
13
|
+
fileNameValidator: validateEntityFileName,
|
|
12
14
|
};
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
* @main SkillStyleSpecialAbility
|
|
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: "SkillStyleSpecialAbility",
|
|
9
|
-
id:
|
|
10
|
+
id: getFilenamePrefixAsNumericId,
|
|
10
11
|
integrityValidator: todo("SkillStyleSpecialAbility"),
|
|
11
12
|
schemaValidator: createSchemaValidator(import.meta.url),
|
|
13
|
+
fileNameValidator: validateEntityFileName,
|
|
12
14
|
};
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
* @main VampiricGift
|
|
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: "VampiricGift",
|
|
9
|
-
id:
|
|
10
|
+
id: getFilenamePrefixAsNumericId,
|
|
10
11
|
integrityValidator: todo("VampiricGift"),
|
|
11
12
|
schemaValidator: createSchemaValidator(import.meta.url),
|
|
13
|
+
fileNameValidator: validateEntityFileName,
|
|
12
14
|
};
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
* @main Vision
|
|
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: "Vision",
|
|
9
|
-
id:
|
|
10
|
+
id: getFilenamePrefixAsNumericId,
|
|
10
11
|
integrityValidator: todo("Vision"),
|
|
11
12
|
schemaValidator: createSchemaValidator(import.meta.url),
|
|
13
|
+
fileNameValidator: validateEntityFileName,
|
|
12
14
|
};
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
* @main Language
|
|
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: "Language",
|
|
9
|
-
id:
|
|
10
|
+
id: getFilenamePrefixAsNumericId,
|
|
10
11
|
integrityValidator: todo("Language"),
|
|
11
12
|
schemaValidator: createSchemaValidator(import.meta.url),
|
|
13
|
+
fileNameValidator: validateEntityFileName,
|
|
12
14
|
};
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
* @main Script
|
|
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: "Script",
|
|
9
|
-
id:
|
|
10
|
+
id: getFilenamePrefixAsNumericId,
|
|
10
11
|
integrityValidator: todo("Script"),
|
|
11
12
|
schemaValidator: createSchemaValidator(import.meta.url),
|
|
13
|
+
fileNameValidator: validateEntityFileName,
|
|
12
14
|
};
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
* @main TradeSecret
|
|
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: "TradeSecret",
|
|
9
|
-
id:
|
|
10
|
+
id: getFilenamePrefixAsNumericId,
|
|
10
11
|
integrityValidator: todo("TradeSecret"),
|
|
11
12
|
schemaValidator: createSchemaValidator(import.meta.url),
|
|
13
|
+
fileNameValidator: validateEntityFileName,
|
|
12
14
|
};
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
* @main ArcaneOrbEnchantment
|
|
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: "ArcaneOrbEnchantment",
|
|
9
|
-
id:
|
|
10
|
+
id: getFilenamePrefixAsNumericId,
|
|
10
11
|
integrityValidator: todo("ArcaneOrbEnchantment"),
|
|
11
12
|
schemaValidator: createSchemaValidator(import.meta.url),
|
|
13
|
+
fileNameValidator: validateEntityFileName,
|
|
12
14
|
};
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
* @main AttireEnchantment
|
|
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: "AttireEnchantment",
|
|
9
|
-
id:
|
|
10
|
+
id: getFilenamePrefixAsNumericId,
|
|
10
11
|
integrityValidator: todo("AttireEnchantment"),
|
|
11
12
|
schemaValidator: createSchemaValidator(import.meta.url),
|
|
13
|
+
fileNameValidator: validateEntityFileName,
|
|
12
14
|
};
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
* @main BowlEnchantment
|
|
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: "BowlEnchantment",
|
|
9
|
-
id:
|
|
10
|
+
id: getFilenamePrefixAsNumericId,
|
|
10
11
|
integrityValidator: todo("BowlEnchantment"),
|
|
11
12
|
schemaValidator: createSchemaValidator(import.meta.url),
|
|
13
|
+
fileNameValidator: validateEntityFileName,
|
|
12
14
|
};
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
* @main CauldronEnchantment
|
|
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: "CauldronEnchantment",
|
|
9
|
-
id:
|
|
10
|
+
id: getFilenamePrefixAsNumericId,
|
|
10
11
|
integrityValidator: todo("CauldronEnchantment"),
|
|
11
12
|
schemaValidator: createSchemaValidator(import.meta.url),
|
|
13
|
+
fileNameValidator: validateEntityFileName,
|
|
12
14
|
};
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
* @main ChronicleEnchantment
|
|
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: "ChronicleEnchantment",
|
|
9
|
-
id:
|
|
10
|
+
id: getFilenamePrefixAsNumericId,
|
|
10
11
|
integrityValidator: todo("ChronicleEnchantment"),
|
|
11
12
|
schemaValidator: createSchemaValidator(import.meta.url),
|
|
13
|
+
fileNameValidator: validateEntityFileName,
|
|
12
14
|
};
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
* @main DaggerRitual
|
|
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: "DaggerRitual",
|
|
9
|
-
id:
|
|
10
|
+
id: getFilenamePrefixAsNumericId,
|
|
10
11
|
integrityValidator: todo("DaggerRitual"),
|
|
11
12
|
schemaValidator: createSchemaValidator(import.meta.url),
|
|
13
|
+
fileNameValidator: validateEntityFileName,
|
|
12
14
|
};
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
* @main FoolsHatEnchantment
|
|
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: "FoolsHatEnchantment",
|
|
9
|
-
id:
|
|
10
|
+
id: getFilenamePrefixAsNumericId,
|
|
10
11
|
integrityValidator: todo("FoolsHatEnchantment"),
|
|
11
12
|
schemaValidator: createSchemaValidator(import.meta.url),
|
|
13
|
+
fileNameValidator: validateEntityFileName,
|
|
12
14
|
};
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
* @main InstrumentEnchantment
|
|
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: "InstrumentEnchantment",
|
|
9
|
-
id:
|
|
10
|
+
id: getFilenamePrefixAsNumericId,
|
|
10
11
|
integrityValidator: todo("InstrumentEnchantment"),
|
|
11
12
|
schemaValidator: createSchemaValidator(import.meta.url),
|
|
13
|
+
fileNameValidator: validateEntityFileName,
|
|
12
14
|
};
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
* @main Krallenkettenzauber
|
|
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: "Krallenkettenzauber",
|
|
9
|
-
id:
|
|
10
|
+
id: getFilenamePrefixAsNumericId,
|
|
10
11
|
integrityValidator: todo("Krallenkettenzauber"),
|
|
11
12
|
schemaValidator: createSchemaValidator(import.meta.url),
|
|
13
|
+
fileNameValidator: validateEntityFileName,
|
|
12
14
|
};
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
* @main OrbEnchantment
|
|
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: "OrbEnchantment",
|
|
9
|
-
id:
|
|
10
|
+
id: getFilenamePrefixAsNumericId,
|
|
10
11
|
integrityValidator: todo("OrbEnchantment"),
|
|
11
12
|
schemaValidator: createSchemaValidator(import.meta.url),
|
|
13
|
+
fileNameValidator: validateEntityFileName,
|
|
12
14
|
};
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
* @main RingEnchantment
|
|
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: "RingEnchantment",
|
|
9
|
-
id:
|
|
10
|
+
id: getFilenamePrefixAsNumericId,
|
|
10
11
|
integrityValidator: todo("RingEnchantment"),
|
|
11
12
|
schemaValidator: createSchemaValidator(import.meta.url),
|
|
13
|
+
fileNameValidator: validateEntityFileName,
|
|
12
14
|
};
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
* @main SickleRitual
|
|
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: "SickleRitual",
|
|
9
|
-
id:
|
|
10
|
+
id: getFilenamePrefixAsNumericId,
|
|
10
11
|
integrityValidator: todo("SickleRitual"),
|
|
11
12
|
schemaValidator: createSchemaValidator(import.meta.url),
|
|
13
|
+
fileNameValidator: validateEntityFileName,
|
|
12
14
|
};
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
* @main SpellSwordEnchantment
|
|
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: "SpellSwordEnchantment",
|
|
9
|
-
id:
|
|
10
|
+
id: getFilenamePrefixAsNumericId,
|
|
10
11
|
integrityValidator: todo("SpellSwordEnchantment"),
|
|
11
12
|
schemaValidator: createSchemaValidator(import.meta.url),
|
|
13
|
+
fileNameValidator: validateEntityFileName,
|
|
12
14
|
};
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
* @main StaffEnchantment
|
|
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: "StaffEnchantment",
|
|
9
|
-
id:
|
|
10
|
+
id: getFilenamePrefixAsNumericId,
|
|
10
11
|
integrityValidator: todo("StaffEnchantment"),
|
|
11
12
|
schemaValidator: createSchemaValidator(import.meta.url),
|
|
13
|
+
fileNameValidator: validateEntityFileName,
|
|
12
14
|
};
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
* @main ToyEnchantment
|
|
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: "ToyEnchantment",
|
|
9
|
-
id:
|
|
10
|
+
id: getFilenamePrefixAsNumericId,
|
|
10
11
|
integrityValidator: todo("ToyEnchantment"),
|
|
11
12
|
schemaValidator: createSchemaValidator(import.meta.url),
|
|
13
|
+
fileNameValidator: validateEntityFileName,
|
|
12
14
|
};
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
* @main Trinkhornzauber
|
|
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: "Trinkhornzauber",
|
|
9
|
-
id:
|
|
10
|
+
id: getFilenamePrefixAsNumericId,
|
|
10
11
|
integrityValidator: todo("Trinkhornzauber"),
|
|
11
12
|
schemaValidator: createSchemaValidator(import.meta.url),
|
|
13
|
+
fileNameValidator: validateEntityFileName,
|
|
12
14
|
};
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
* @main WandEnchantment
|
|
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: "WandEnchantment",
|
|
9
|
-
id:
|
|
10
|
+
id: getFilenamePrefixAsNumericId,
|
|
10
11
|
integrityValidator: todo("WandEnchantment"),
|
|
11
12
|
schemaValidator: createSchemaValidator(import.meta.url),
|
|
13
|
+
fileNameValidator: validateEntityFileName,
|
|
12
14
|
};
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
* @main WeaponEnchantment
|
|
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: "WeaponEnchantment",
|
|
9
|
-
id:
|
|
10
|
+
id: getFilenamePrefixAsNumericId,
|
|
10
11
|
integrityValidator: todo("WeaponEnchantment"),
|
|
11
12
|
schemaValidator: createSchemaValidator(import.meta.url),
|
|
13
|
+
fileNameValidator: validateEntityFileName,
|
|
12
14
|
};
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
* @main AnimalShape
|
|
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: "AnimalShape",
|
|
9
|
-
id:
|
|
10
|
+
id: getFilenamePrefixAsNumericId,
|
|
10
11
|
integrityValidator: todo("AnimalShape"),
|
|
11
12
|
schemaValidator: createSchemaValidator(import.meta.url),
|
|
13
|
+
fileNameValidator: validateEntityFileName,
|
|
12
14
|
};
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
* @main AnimalShapePath
|
|
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: "AnimalShapePath",
|
|
9
|
-
id:
|
|
10
|
+
id: getFilenamePrefixAsNumericId,
|
|
10
11
|
integrityValidator: todo("AnimalShapePath"),
|
|
11
12
|
schemaValidator: createSchemaValidator(import.meta.url),
|
|
13
|
+
fileNameValidator: validateEntityFileName,
|
|
12
14
|
};
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
* @main AnimalShapeSize
|
|
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: "AnimalShapeSize",
|
|
9
|
-
id:
|
|
10
|
+
id: getFilenamePrefixAsNumericId,
|
|
10
11
|
integrityValidator: todo("AnimalShapeSize"),
|
|
11
12
|
schemaValidator: createSchemaValidator(import.meta.url),
|
|
13
|
+
fileNameValidator: validateEntityFileName,
|
|
12
14
|
};
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
* @main Brew
|
|
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: "Brew",
|
|
9
|
-
id:
|
|
10
|
+
id: getFilenamePrefixAsNumericId,
|
|
10
11
|
integrityValidator: todo("Brew"),
|
|
11
12
|
schemaValidator: createSchemaValidator(import.meta.url),
|
|
13
|
+
fileNameValidator: validateEntityFileName,
|
|
12
14
|
};
|
|
@@ -10,4 +10,6 @@ export type FileNameError = {
|
|
|
10
10
|
};
|
|
11
11
|
export type FileNameValidationResult = Result<void, FileNameError[]>;
|
|
12
12
|
export type FileNameValidator = (filePath: string) => FileNameValidationResult;
|
|
13
|
-
export declare const
|
|
13
|
+
export declare const createFileNameValidator: (pattern: RegExp) => FileNameValidator;
|
|
14
|
+
export declare const validateEntityFileName: FileNameValidator;
|
|
15
|
+
export declare const validateLanguageFileName: FileNameValidator;
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { basename } from "node:path";
|
|
2
2
|
import { error, ok } from "../../helpers/result.js";
|
|
3
|
-
const
|
|
4
|
-
const
|
|
3
|
+
const ENTITY_FILENAME_PATTERN = /^(?:0|[1-9][0-9]*)_(?:[A-Z][a-zA-Z]*|[1-9][0-9]*)(?:-(?:[a-zA-Z]+|[1-9][0-9]*))*\.yml$/;
|
|
4
|
+
const LANGUAGE_FILENAME_PATTERN = /^[a-z]{2}-[A-Z]{2}\.yml$/;
|
|
5
|
+
const fileNameError = (pattern, fileName) => ({
|
|
5
6
|
keyword: "filename",
|
|
6
7
|
instancePath: "",
|
|
7
|
-
message: `the file name "${fileName}" does not match the pattern ${
|
|
8
|
+
message: `the file name "${fileName}" does not match the pattern ${pattern.source}`
|
|
8
9
|
});
|
|
9
|
-
export const
|
|
10
|
+
export const createFileNameValidator = (pattern) => (filePath) => {
|
|
10
11
|
const fileName = basename(filePath);
|
|
11
|
-
return
|
|
12
|
+
return pattern.test(fileName)
|
|
12
13
|
? ok(undefined)
|
|
13
|
-
: error([fileNameError(fileName)]);
|
|
14
|
+
: error([fileNameError(pattern, fileName)]);
|
|
14
15
|
};
|
|
16
|
+
export const validateEntityFileName = createFileNameValidator(ENTITY_FILENAME_PATTERN);
|
|
17
|
+
export const validateLanguageFileName = createFileNameValidator(LANGUAGE_FILENAME_PATTERN);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Returns the numeric prefix of a filename, that is, the part before the first
|
|
3
3
|
* underscore.
|
|
4
4
|
*/
|
|
5
|
-
export declare const
|
|
5
|
+
export declare const getFilenamePrefixAsNumericId: (_data: {}, filepath: string) => number;
|
|
6
6
|
/**
|
|
7
7
|
* Returns the filename without the extension.
|
|
8
8
|
*/
|
|
@@ -3,7 +3,7 @@ import { basename, extname } from "node:path";
|
|
|
3
3
|
* Returns the numeric prefix of a filename, that is, the part before the first
|
|
4
4
|
* underscore.
|
|
5
5
|
*/
|
|
6
|
-
export const
|
|
6
|
+
export const getFilenamePrefixAsNumericId = (_data, filepath) => Number.parseInt(/^(\d+?)_/.exec(basename(filepath))?.[1] ?? "", 10);
|
|
7
7
|
/**
|
|
8
8
|
* Returns the filename without the extension.
|
|
9
9
|
*/
|
package/lib/validation/raw.d.ts
CHANGED
|
@@ -5,4 +5,4 @@ import { EntityDirectoryPaths, TypeValidationError, ValidationOptions } from "..
|
|
|
5
5
|
export type TypeIdPair<K extends keyof TypeMap> = [id: TypeId<K>, data: TypeMap[K]];
|
|
6
6
|
export type TypeValidationResult<K extends keyof TypeMap> = Result<TypeIdPair<K>, TypeValidationError[]>;
|
|
7
7
|
export type TypeValidationResultsByType = [keyof TypeMap, [filePath: string, result: TypeValidationResult<keyof TypeMap>][]][];
|
|
8
|
-
export declare const getRawValidationResults: (
|
|
8
|
+
export declare const getRawValidationResults: (entityDirPaths: EntityDirectoryPaths, options?: ValidationOptions) => Promise<TypeValidationResultsByType>;
|
package/lib/validation/raw.js
CHANGED
|
@@ -7,7 +7,6 @@ import { collator } from "../helpers/i18n.js";
|
|
|
7
7
|
import { isHiddenFileName, readYamlFile } from "../helpers/io.js";
|
|
8
8
|
import { mapSecond, mapSecondAsync, mapToSecondAsync } from "../helpers/pair.js";
|
|
9
9
|
import { Result, isOk } from "../helpers/result.js";
|
|
10
|
-
import { validateFileName } from "./builders/naming.js";
|
|
11
10
|
import { getPreparedSchemaValidator } from "./schema.js";
|
|
12
11
|
const getFiles = async (path) => (await readdir(path))
|
|
13
12
|
.sort(collator.compare)
|
|
@@ -31,13 +30,13 @@ const validateStructuralIntegrityOfFiles = (validator, typeConfig, validateFileN
|
|
|
31
30
|
return Result.map(Result.combine(schemaValidationResult, fileNameValidationResult, (data, _) => data, (schemaErrors, fileNameErrors) => [...schemaErrors, ...fileNameErrors]), data => [typeConfig.id(data, path), data]);
|
|
32
31
|
}));
|
|
33
32
|
const validateSemanticAndReferencialIntegrityOfFiles = (validators, typeConfig, results) => results.map(mapSecond((res, path) => Result.reduce(res, ([id, data]) => Result.map(typeConfig.integrityValidator(validators, data, path), () => [id, data]), errors => Result.error(errors))));
|
|
34
|
-
export const getRawValidationResults = async (
|
|
33
|
+
export const getRawValidationResults = async (entityDirPaths, options = {}) => {
|
|
35
34
|
const { checkIntegrity = false } = options;
|
|
36
35
|
const validator = await getPreparedSchemaValidator(jsonSchemaSpec, {}, jsonSchemaDir);
|
|
37
|
-
const entityDirectoryPathEntries = Object.entries(
|
|
36
|
+
const entityDirectoryPathEntries = Object.entries(entityDirPaths);
|
|
38
37
|
const structuralIntegrityResults = await Promise.all(entityDirectoryPathEntries.map(mapSecondAsync(async (path, typeName) => {
|
|
39
38
|
const files = await getFiles(path);
|
|
40
|
-
return validateStructuralIntegrityOfFiles(validator, configMap[typeName],
|
|
39
|
+
return validateStructuralIntegrityOfFiles(validator, configMap[typeName], configMap[typeName].fileNameValidator, files);
|
|
41
40
|
})));
|
|
42
41
|
if (checkIntegrity) {
|
|
43
42
|
const identityIntegrityValidators = Object.fromEntries(structuralIntegrityResults.map(mapSecond(results => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "optolith-database-schema",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "Definitions and utilities for the flat-file database of Optolith, a character creation tool for the Pen and Paper RPG “The Dark Eye 5”, and its external integrations into other software.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"tde",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@types/node": "^20.2.3",
|
|
36
|
-
"optolith-tsjsonschemamd": "^0.9.
|
|
36
|
+
"optolith-tsjsonschemamd": "^0.9.4",
|
|
37
37
|
"standard-version": "^9.5.0",
|
|
38
38
|
"typescript": "^5.0.4"
|
|
39
39
|
},
|