optolith-database-schema 0.15.3 → 0.15.4

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.
@@ -1,6 +1,7 @@
1
1
  import type { CacheConfig } from "../cacheConfig.js";
2
2
  import type { SkillApplication, SkillUse } from "../types/_Activatable.js";
3
3
  import type { ActivatableIdentifier } from "../types/_IdentifierGroup.js";
4
+ import { ActivatableSelectOptionsCache } from "./activatableSelectOptions.js";
4
5
  export type NewApplication = {
5
6
  source: ActivatableIdentifier;
6
7
  data: SkillApplication;
@@ -14,4 +15,6 @@ export type NewApplicationsAndUsesCache = {
14
15
  newApplications: Record<number, NewApplication[]>;
15
16
  uses: Record<number, Use[]>;
16
17
  };
17
- export declare const config: CacheConfig<NewApplicationsAndUsesCache>;
18
+ export declare const config: CacheConfig<NewApplicationsAndUsesCache, [
19
+ generatedSelectOptions: ActivatableSelectOptionsCache
20
+ ]>;
@@ -1,5 +1,5 @@
1
1
  export const config = {
2
- builder(database) {
2
+ builder(database, generatedSelectOptions) {
3
3
  const cache = {
4
4
  newApplications: {},
5
5
  uses: {},
@@ -63,6 +63,64 @@ export const config = {
63
63
  addNewApplicationsAndUses(activatable, createId(numericId));
64
64
  });
65
65
  });
66
+ // prettier-ignore
67
+ const generatedEntries = [
68
+ [generatedSelectOptions.advancedCombatSpecialAbilities, id => ({ tag: "AdvancedCombatSpecialAbility", advanced_combat_special_ability: id })],
69
+ [generatedSelectOptions.advancedKarmaSpecialAbilities, id => ({ tag: "AdvancedKarmaSpecialAbility", advanced_karma_special_ability: id })],
70
+ [generatedSelectOptions.advancedMagicalSpecialAbilities, id => ({ tag: "AdvancedMagicalSpecialAbility", advanced_magical_special_ability: id })],
71
+ [generatedSelectOptions.advancedSkillSpecialAbilities, id => ({ tag: "AdvancedSkillSpecialAbility", advanced_skill_special_ability: id })],
72
+ [generatedSelectOptions.advantages, id => ({ tag: "Advantage", advantage: id })],
73
+ [generatedSelectOptions.ancestorGlyphs, id => ({ tag: "AncestorGlyph", ancestor_glyph: id })],
74
+ [generatedSelectOptions.arcaneOrbEnchantments, id => ({ tag: "ArcaneOrbEnchantment", arcane_orb_enchantment: id })],
75
+ [generatedSelectOptions.attireEnchantments, id => ({ tag: "AttireEnchantment", attire_enchantment: id })],
76
+ [generatedSelectOptions.blessedTraditions, id => ({ tag: "BlessedTradition", blessed_tradition: id })],
77
+ [generatedSelectOptions.bowlEnchantments, id => ({ tag: "BowlEnchantment", bowl_enchantment: id })],
78
+ [generatedSelectOptions.brawlingSpecialAbilities, id => ({ tag: "BrawlingSpecialAbility", brawling_special_ability: id })],
79
+ [generatedSelectOptions.cauldronEnchantments, id => ({ tag: "CauldronEnchantment", cauldron_enchantment: id })],
80
+ [generatedSelectOptions.ceremonialItemSpecialAbilities, id => ({ tag: "CeremonialItemSpecialAbility", ceremonial_item_special_ability: id })],
81
+ [generatedSelectOptions.chronicleEnchantments, id => ({ tag: "ChronicleEnchantment", chronicle_enchantment: id })],
82
+ [generatedSelectOptions.combatSpecialAbilities, id => ({ tag: "CombatSpecialAbility", combat_special_ability: id })],
83
+ [generatedSelectOptions.combatStyleSpecialAbilities, id => ({ tag: "CombatStyleSpecialAbility", combat_style_special_ability: id })],
84
+ [generatedSelectOptions.commandSpecialAbilities, id => ({ tag: "CommandSpecialAbility", command_special_ability: id })],
85
+ [generatedSelectOptions.daggerRituals, id => ({ tag: "DaggerRitual", dagger_ritual: id })],
86
+ [generatedSelectOptions.disadvantages, id => ({ tag: "Disadvantage", disadvantage: id })],
87
+ [generatedSelectOptions.familiarSpecialAbilities, id => ({ tag: "FamiliarSpecialAbility", familiar_special_ability: id })],
88
+ [generatedSelectOptions.fatePointSexSpecialAbilities, id => ({ tag: "FatePointSexSpecialAbility", fate_point_sex_special_ability: id })],
89
+ [generatedSelectOptions.fatePointSpecialAbilities, id => ({ tag: "FatePointSpecialAbility", fate_point_special_ability: id })],
90
+ [generatedSelectOptions.foolsHatEnchantments, id => ({ tag: "FoolsHatEnchantment", fools_hat_enchantment: id })],
91
+ [generatedSelectOptions.generalSpecialAbilities, id => ({ tag: "GeneralSpecialAbility", general_special_ability: id })],
92
+ [generatedSelectOptions.instrumentEnchantments, id => ({ tag: "InstrumentEnchantment", instrument_enchantment: id })],
93
+ [generatedSelectOptions.karmaSpecialAbilities, id => ({ tag: "KarmaSpecialAbility", karma_special_ability: id })],
94
+ [generatedSelectOptions.krallenkettenzauber, id => ({ tag: "Krallenkettenzauber", krallenkettenzauber: id })],
95
+ [generatedSelectOptions.liturgicalStyleSpecialAbilities, id => ({ tag: "LiturgicalStyleSpecialAbility", liturgical_style_special_ability: id })],
96
+ [generatedSelectOptions.lycantropicGifts, id => ({ tag: "LycantropicGift", lycantropic_gift: id })],
97
+ [generatedSelectOptions.magicalSpecialAbilities, id => ({ tag: "MagicalSpecialAbility", magical_special_ability: id })],
98
+ [generatedSelectOptions.magicalTraditions, id => ({ tag: "MagicalTradition", magical_tradition: id })],
99
+ [generatedSelectOptions.magicStyleSpecialAbilities, id => ({ tag: "MagicStyleSpecialAbility", magic_style_special_ability: id })],
100
+ [generatedSelectOptions.orbEnchantments, id => ({ tag: "OrbEnchantment", orb_enchantment: id })],
101
+ [generatedSelectOptions.pactGifts, id => ({ tag: "PactGift", pact_gift: id })],
102
+ [generatedSelectOptions.protectiveWardingCircleSpecialAbilities, id => ({ tag: "ProtectiveWardingCircleSpecialAbility", protective_warding_circle_special_ability: id })],
103
+ [generatedSelectOptions.ringEnchantments, id => ({ tag: "RingEnchantment", ring_enchantment: id })],
104
+ [generatedSelectOptions.sermons, id => ({ tag: "Sermon", sermon: id })],
105
+ [generatedSelectOptions.sexSpecialAbilities, id => ({ tag: "SexSpecialAbility", sex_special_ability: id })],
106
+ [generatedSelectOptions.sickleRituals, id => ({ tag: "SickleRitual", sickle_ritual: id })],
107
+ [generatedSelectOptions.sikaryanDrainSpecialAbilities, id => ({ tag: "SikaryanDrainSpecialAbility", sikaryan_drain_special_ability: id })],
108
+ [generatedSelectOptions.staffEnchantments, id => ({ tag: "StaffEnchantment", staff_enchantment: id })],
109
+ [generatedSelectOptions.skillStyleSpecialAbilities, id => ({ tag: "SkillStyleSpecialAbility", skill_style_special_ability: id })],
110
+ [generatedSelectOptions.spellSwordEnchantments, id => ({ tag: "SpellSwordEnchantment", spell_sword_enchantment: id })],
111
+ [generatedSelectOptions.toyEnchantments, id => ({ tag: "ToyEnchantment", toy_enchantment: id })],
112
+ [generatedSelectOptions.trinkhornzauber, id => ({ tag: "Trinkhornzauber", trinkhornzauber: id })],
113
+ [generatedSelectOptions.vampiricGifts, id => ({ tag: "VampiricGift", vampiric_gift: id })],
114
+ [generatedSelectOptions.visions, id => ({ tag: "Vision", vision: id })],
115
+ [generatedSelectOptions.wandEnchantments, id => ({ tag: "WandEnchantment", wand_enchantment: id })],
116
+ [generatedSelectOptions.weaponEnchantments, id => ({ tag: "WeaponEnchantment", weapon_enchantment: id })],
117
+ ];
118
+ generatedEntries.forEach(([ids, createId]) => Object.entries(ids).forEach(([stringId, selectOptions]) => {
119
+ const id = createId(Number.parseInt(stringId));
120
+ selectOptions.forEach(selectOption => {
121
+ addNewApplicationsAndUses(selectOption, id);
122
+ });
123
+ }));
66
124
  return cache;
67
125
  },
68
126
  };
@@ -1,4 +1,4 @@
1
1
  import { ValidResults } from "./main.js";
2
- export type CacheConfig<T> = {
3
- builder: (data: ValidResults) => T;
2
+ export type CacheConfig<T, D extends unknown[] = []> = {
3
+ builder: (data: ValidResults, ...deps: D) => T;
4
4
  };
@@ -1,10 +1,13 @@
1
+ import * as ActivatableSelectOptions from "../cache/activatableSelectOptions.js";
1
2
  import * as AncestorBloodAdvantages from "../cache/ancestorBloodAdvantages.js";
2
3
  import * as NewApplicationsAndUses from "../cache/newApplicationsAndUses.js";
3
4
  export type CacheMap = {
5
+ activatableSelectOptions: ActivatableSelectOptions.ActivatableSelectOptionsCache;
4
6
  ancestorBloodAdvantages: AncestorBloodAdvantages.AncestorBloodAdvantagesCache;
5
7
  newApplicationsAndUses: NewApplicationsAndUses.NewApplicationsAndUsesCache;
6
8
  };
7
9
  export declare const cacheMap: {
10
+ activatableSelectOptions: import("../cacheConfig.js").CacheConfig<ActivatableSelectOptions.ActivatableSelectOptionsCache>;
8
11
  ancestorBloodAdvantages: import("../cacheConfig.js").CacheConfig<AncestorBloodAdvantages.AncestorBloodAdvantagesCache>;
9
- newApplicationsAndUses: import("../cacheConfig.js").CacheConfig<NewApplicationsAndUses.NewApplicationsAndUsesCache>;
12
+ newApplicationsAndUses: import("../cacheConfig.js").CacheConfig<NewApplicationsAndUses.NewApplicationsAndUsesCache, [generatedSelectOptions: ActivatableSelectOptions.ActivatableSelectOptionsCache]>;
10
13
  };
@@ -1,6 +1,8 @@
1
+ import * as ActivatableSelectOptions from "../cache/activatableSelectOptions.js";
1
2
  import * as AncestorBloodAdvantages from "../cache/ancestorBloodAdvantages.js";
2
3
  import * as NewApplicationsAndUses from "../cache/newApplicationsAndUses.js";
3
4
  export const cacheMap = {
5
+ activatableSelectOptions: ActivatableSelectOptions.config,
4
6
  ancestorBloodAdvantages: AncestorBloodAdvantages.config,
5
7
  newApplicationsAndUses: NewApplicationsAndUses.config,
6
8
  };
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Extracts `null` and `undefined` from a type.
3
+ */
4
+ export type Nullish<T = null | undefined> = T extends null | undefined ? T : never;
5
+ /**
6
+ * Checks if a value is `null` or `undefined`.
7
+ */
8
+ export declare const isNullish: <T>(value: T) => value is Exclude<T, NonNullable<T>>;
9
+ /**
10
+ * Checks if a value is not `null` or `undefined`.
11
+ */
12
+ export declare const isNotNullish: <T>(value: T) => value is NonNullable<T>;
13
+ /**
14
+ * Maps a value to another value if it is not `null` or `undefined`.
15
+ */
16
+ export declare const mapNullable: <T, U>(value: T, map: (value: NonNullable<T>) => U) => U | Nullish<T>;
17
+ /**
18
+ * Maps a value to another value if it is not `null` or `undefined`, otherwise
19
+ * returns a default value.
20
+ */
21
+ export declare const mapNullableDefault: <T, U>(value: T, map: (value: NonNullable<T>) => U, defaultValue: U) => U;
22
+ /**
23
+ * Returns an array, containing the value if it is not `null` or `undefined`.
24
+ *
25
+ * This can be useful in combination with the spread operator or
26
+ * `Array.prototype.flatMap`.
27
+ * @example
28
+ * nullableToArray(2) // [2]
29
+ * nullableToArray(undefined) // []
30
+ *
31
+ * [...nullableToArray(2)] // [2]
32
+ * [1, ...nullableToArray(2)] // [1, 2]
33
+ * [1, ...nullableToArray(undefined)] // [1]
34
+ */
35
+ export declare const nullableToArray: <T>(value: T) => NonNullable<T>[];
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Checks if a value is `null` or `undefined`.
3
+ */
4
+ export const isNullish = (value) => value === null || value === undefined;
5
+ /**
6
+ * Checks if a value is not `null` or `undefined`.
7
+ */
8
+ export const isNotNullish = (value) => !isNullish(value);
9
+ /**
10
+ * Maps a value to another value if it is not `null` or `undefined`.
11
+ */
12
+ export const mapNullable = (value, map) => isNotNullish(value) ? map(value) : value;
13
+ /**
14
+ * Maps a value to another value if it is not `null` or `undefined`, otherwise
15
+ * returns a default value.
16
+ */
17
+ export const mapNullableDefault = (value, map, defaultValue) => (isNotNullish(value) ? map(value) : defaultValue);
18
+ /**
19
+ * Returns an array, containing the value if it is not `null` or `undefined`.
20
+ *
21
+ * This can be useful in combination with the spread operator or
22
+ * `Array.prototype.flatMap`.
23
+ * @example
24
+ * nullableToArray(2) // [2]
25
+ * nullableToArray(undefined) // []
26
+ *
27
+ * [...nullableToArray(2)] // [2]
28
+ * [1, ...nullableToArray(2)] // [1, 2]
29
+ * [1, ...nullableToArray(undefined)] // [1]
30
+ */
31
+ export const nullableToArray = (value) => isNotNullish(value) ? [value] : [];
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,46 @@
1
+ import assert from "node:assert/strict";
2
+ import { describe, it } from "node:test";
3
+ import { isNotNullish, isNullish, mapNullable, mapNullableDefault, nullableToArray, } from "./nullable.js";
4
+ describe("isNullish", () => {
5
+ it("returns if a value is nullish", () => {
6
+ assert.equal(isNullish(null), true);
7
+ assert.equal(isNullish(undefined), true);
8
+ assert.equal(isNullish(false), false);
9
+ assert.equal(isNullish(0), false);
10
+ assert.equal(isNullish(""), false);
11
+ });
12
+ });
13
+ describe("isNotNullish", () => {
14
+ it("returns if a value is not nullish", () => {
15
+ assert.equal(isNotNullish(null), false);
16
+ assert.equal(isNotNullish(undefined), false);
17
+ assert.equal(isNotNullish(false), true);
18
+ assert.equal(isNotNullish(0), true);
19
+ assert.equal(isNotNullish(""), true);
20
+ });
21
+ });
22
+ describe("mapNullable", () => {
23
+ it("maps a value if it is not nullish", () => {
24
+ assert.equal(mapNullable(2, x => x * 2), 4);
25
+ });
26
+ it("returns the original value if it is nullish", () => {
27
+ assert.equal(mapNullable(undefined, x => x * 2), undefined);
28
+ });
29
+ });
30
+ describe("mapNullableDefault", () => {
31
+ it("maps a value if it is not nullish", () => {
32
+ assert.equal(mapNullableDefault(2, x => x * 2, 0), 4);
33
+ });
34
+ it("returns a default if the value is nullish", () => {
35
+ assert.equal(mapNullableDefault(undefined, x => x * 2, 0), 0);
36
+ });
37
+ });
38
+ describe("nullableToArray", () => {
39
+ it("wraps a non-nullish value into an array", () => {
40
+ assert.deepEqual(nullableToArray(2), [2]);
41
+ });
42
+ it("returns an empty array if the value is null or undefined", () => {
43
+ assert.deepEqual(nullableToArray(undefined), []);
44
+ assert.deepEqual(nullableToArray(null), []);
45
+ });
46
+ });
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Maps all own properties of an object to a new object. Returning `undefined`
3
+ * from the mapping function will omit the property from the result.
4
+ */
5
+ export declare const mapObject: <T extends object, U>(object: T, map: (value: T[keyof T], key: keyof T) => U | undefined) => { [key in keyof T]: Exclude<U, undefined>; };
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Maps all own properties of an object to a new object. Returning `undefined`
3
+ * from the mapping function will omit the property from the result.
4
+ */
5
+ export const mapObject = (object, map) => {
6
+ const result = {};
7
+ for (const key in object) {
8
+ if (Object.hasOwn(object, key)) {
9
+ const newValue = map(object[key], key);
10
+ if (newValue !== undefined) {
11
+ result[key] = newValue;
12
+ }
13
+ }
14
+ }
15
+ return result;
16
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,15 @@
1
+ import assert from "node:assert/strict";
2
+ import { describe, it } from "node:test";
3
+ import { mapObject } from "./object.js";
4
+ describe("mapObject", () => {
5
+ it("maps all own properties of an object to a new object", () => {
6
+ const object = { a: 1, b: 2, c: 3 };
7
+ const result = mapObject(object, (value, key) => value + key);
8
+ assert.deepEqual(result, { a: "1a", b: "2b", c: "3c" });
9
+ });
10
+ it("omits properties for which the mapping function returns undefined", () => {
11
+ const object = { a: 1, b: 2, c: 3 };
12
+ const result = mapObject(object, (value, key) => (key === "b" ? undefined : value + key));
13
+ assert.deepEqual(result, { a: "1a", c: "3c" });
14
+ });
15
+ });
@@ -1,6 +1,14 @@
1
1
  /**
2
2
  * This function is used to make sure that the `switch` is exhaustive. Place it
3
3
  * in the `default` case of the `switch`.
4
- * @param x The value that is used in the `switch`.
4
+ * @param _x - The value that is used in the `switch`.
5
+ * @example
6
+ * const aorb = (x: "a" | "b") => {
7
+ * switch (x) {
8
+ * case "a": return 1
9
+ * case "b": return 2
10
+ * default: return assertExhaustive(x)
11
+ * }
12
+ * }
5
13
  */
6
- export declare function assertExhaustive(x: never): never;
14
+ export declare function assertExhaustive(_x: never): never;
@@ -1,8 +1,16 @@
1
1
  /**
2
2
  * This function is used to make sure that the `switch` is exhaustive. Place it
3
3
  * in the `default` case of the `switch`.
4
- * @param x The value that is used in the `switch`.
4
+ * @param _x - The value that is used in the `switch`.
5
+ * @example
6
+ * const aorb = (x: "a" | "b") => {
7
+ * switch (x) {
8
+ * case "a": return 1
9
+ * case "b": return 2
10
+ * default: return assertExhaustive(x)
11
+ * }
12
+ * }
5
13
  */
6
- export function assertExhaustive(x) {
14
+ export function assertExhaustive(_x) {
7
15
  throw new Error("The switch is not exhaustive.");
8
16
  }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ import assert from "node:assert/strict";
2
+ import { describe, it } from "node:test";
3
+ import { assertExhaustive } from "./typeSafety.js";
4
+ describe("assertExhaustive", () => {
5
+ it("should throw an error with the message 'The switch is not exhaustive.'", () => {
6
+ assert.throws(
7
+ // @ts-expect-error The function should never receive a value.
8
+ () => assertExhaustive(""), err => err instanceof Error && err.message === "The switch is not exhaustive.");
9
+ });
10
+ });
package/lib/main.js CHANGED
@@ -4,23 +4,23 @@ import { cacheMap } from "./config/cache.js";
4
4
  import "./helpers/array.js";
5
5
  import { mapSecond } from "./helpers/pair.js";
6
6
  import { Result, error, isError, isOk, ok } from "./helpers/result.js";
7
- import { getRawValidationResults } from "./validation/raw.js";
7
+ import { getRawValidationResults, } from "./validation/raw.js";
8
8
  const rawResultMapToResult = (rawResultMap) => rawResultMap.reduce((result, [typeName, typeResults]) => typeResults.reduce((outerResult, [filePath, fileResult]) => {
9
9
  if (isOk(outerResult) && isOk(fileResult)) {
10
10
  return ok({
11
11
  ...outerResult.value,
12
- [typeName]: [...(outerResult.value[typeName] ?? []), fileResult.value]
12
+ [typeName]: [...(outerResult.value[typeName] ?? []), fileResult.value],
13
13
  });
14
14
  }
15
15
  else if (isOk(outerResult) && isError(fileResult)) {
16
16
  return error({
17
- [filePath]: fileResult.error
17
+ [filePath]: fileResult.error,
18
18
  });
19
19
  }
20
20
  else if (isError(outerResult) && isError(fileResult)) {
21
21
  return error({
22
22
  ...outerResult.error,
23
- [filePath]: fileResult.error
23
+ [filePath]: fileResult.error,
24
24
  });
25
25
  }
26
26
  else {
@@ -76,11 +76,17 @@ export const getRawResults = async (entityDirPaths, options = {}) => {
76
76
  */
77
77
  export const buildCache = async (cachePaths, validResults, options = {}) => {
78
78
  const { pretty = false } = options;
79
+ const activatableSelectOptionsCache = cacheMap.activatableSelectOptions.builder(validResults);
80
+ const ancestorBloodAdvantagesCache = cacheMap.ancestorBloodAdvantages.builder(validResults);
81
+ const newApplicationsAndUsesCache = cacheMap.newApplicationsAndUses.builder(validResults, activatableSelectOptionsCache);
82
+ const cacheData = {
83
+ activatableSelectOptions: activatableSelectOptionsCache,
84
+ ancestorBloodAdvantages: ancestorBloodAdvantagesCache,
85
+ newApplicationsAndUses: newApplicationsAndUsesCache,
86
+ };
79
87
  for (const [cacheName, cachePath] of Object.entries(cachePaths)) {
80
- const cacheConfig = cacheMap[cacheName];
81
- const cacheData = cacheConfig.builder(validResults);
82
88
  await mkdir(dirname(cachePath), { recursive: true });
83
- await writeFile(cachePath, JSON.stringify(cacheData, null, pretty ? 2 : undefined), "utf-8");
89
+ await writeFile(cachePath, JSON.stringify(cacheData[cacheName], null, pretty ? 2 : undefined), "utf-8");
84
90
  }
85
91
  };
86
92
  /**
@@ -91,7 +97,6 @@ export const buildCache = async (cachePaths, validResults, options = {}) => {
91
97
  export const getCache = async (cachePaths) => {
92
98
  const cache = {};
93
99
  for (const [cacheName, cachePath] of Object.entries(cachePaths)) {
94
- const cacheConfig = cacheMap[cacheName];
95
100
  const cacheData = JSON.parse(await readFile(cachePath, "utf-8"));
96
101
  cache[cacheName] = cacheData;
97
102
  }
@@ -1,7 +1,7 @@
1
- import { TargetCategoryIdentifier } from "./_Identifier.js";
2
- import { ActivatableIdentifier, CombatTechniqueIdentifier, SkillIdentifier } from "./_IdentifierGroup.js";
1
+ import { SkillIdentifier, TargetCategoryIdentifier } from "./_Identifier.js";
2
+ import { ActivatableIdentifier, CombatTechniqueIdentifier, SkillIdentifier as SkillIdentifierGroup } from "./_IdentifierGroup.js";
3
3
  import { LocaleMap } from "./_LocaleMap.js";
4
- import { CeremonyReference, CloseCombatTechniqueReference, ElementReference, LiturgicalChantReference, RangedCombatTechniqueReference, RitualReference, SkillGroupReference, SpellReference } from "./_SimpleReferences.js";
4
+ import { CeremonyReference, CloseCombatTechniqueReference, ElementReference, LiturgicalChantReference, RangedCombatTechniqueReference, RitualReference, SkillGroupReference, SkillReference, SpellReference } from "./_SimpleReferences.js";
5
5
  export type SelectOptionCategory = {
6
6
  tag: "Blessings";
7
7
  blessings: {};
@@ -156,7 +156,7 @@ export type SkillsSelectOptionCategory = {
156
156
  /**
157
157
  * Generate AP values for each entry.
158
158
  */
159
- ap_value?: AdventurePointsValue<SkillIdentifier>;
159
+ ap_value?: AdventurePointsValue<SkillIdentifierGroup>;
160
160
  };
161
161
  export type SkillsSelectOptionCategoryCategory = {
162
162
  tag: "Skills";
@@ -184,7 +184,7 @@ export type SkillSelectOptionCategoryCategory = {
184
184
  * Only include (`Intersection`) or exclude (`Difference`) specific
185
185
  * skills.
186
186
  */
187
- specific?: SpecificFromSkillSelectOptionCategoryCategory<SkillIdentifier>;
187
+ specific?: SpecificFromSkillSelectOptionCategoryCategory<SkillReference>;
188
188
  /**
189
189
  * Registers new applications, which get enabled once this entry is
190
190
  * activated with its respective select option. It specifies an
@@ -211,7 +211,7 @@ export type SkillSelectOptionCategoryCategory = {
211
211
  /**
212
212
  * Generate AP values for each entry.
213
213
  */
214
- ap_value?: AdventurePointsValue<CombatTechniqueIdentifier>;
214
+ ap_value?: AdventurePointsValue<SkillIdentifier>;
215
215
  };
216
216
  export type CombatTechniquesSelectOptionCategory = {
217
217
  /**
@@ -385,6 +385,15 @@ export type PactGiftIdentifier = {
385
385
  */
386
386
  pact_gift: number;
387
387
  };
388
+ export type VampiricGiftIdentifier = {
389
+ tag: "VampiricGift";
390
+ /**
391
+ * The vampiric gift’s identifier.
392
+ * @integer
393
+ * @minimum 1
394
+ */
395
+ vampiric_gift: number;
396
+ };
388
397
  export type SikaryanDrainSpecialAbilityIdentifier = {
389
398
  tag: "SikaryanDrainSpecialAbility";
390
399
  /**
@@ -1191,3 +1200,66 @@ export type StateIdentifier = {
1191
1200
  */
1192
1201
  state: number;
1193
1202
  };
1203
+ export type DiseaseIdentifier = {
1204
+ tag: "Disease";
1205
+ /**
1206
+ * The disease’s identifier.
1207
+ * @integer
1208
+ * @minimum 1
1209
+ */
1210
+ disease: number;
1211
+ };
1212
+ export type SexPracticeIdentifier = {
1213
+ tag: "SexPractice";
1214
+ /**
1215
+ * The sex practice’s identifier.
1216
+ * @integer
1217
+ * @minimum 1
1218
+ */
1219
+ sex_practice: number;
1220
+ };
1221
+ export type GenericIdentifier = {
1222
+ tag: "Generic";
1223
+ /**
1224
+ * The generic entry‘s identifier.
1225
+ * @integer
1226
+ * @minimum 1
1227
+ */
1228
+ generic: number;
1229
+ };
1230
+ export type TradeSecretIdentifier = {
1231
+ tag: "TradeSecret";
1232
+ /**
1233
+ * The trade secret‘s identifier.
1234
+ * @integer
1235
+ * @minimum 1
1236
+ */
1237
+ trade_secret: number;
1238
+ };
1239
+ export type AnimalShapeIdentifier = {
1240
+ tag: "AnimalShape";
1241
+ /**
1242
+ * The animal shape‘s identifier.
1243
+ * @integer
1244
+ * @minimum 1
1245
+ */
1246
+ animal_shape: number;
1247
+ };
1248
+ export type ArcaneBardTraditionIdentifier = {
1249
+ tag: "ArcaneBardTradition";
1250
+ /**
1251
+ * The arcane bard tradition‘s identifier.
1252
+ * @integer
1253
+ * @minimum 1
1254
+ */
1255
+ arcane_bard_tradition: number;
1256
+ };
1257
+ export type ArcaneDancerTraditionIdentifier = {
1258
+ tag: "ArcaneDancerTradition";
1259
+ /**
1260
+ * The arcane dancer tradition‘s identifier.
1261
+ * @integer
1262
+ * @minimum 1
1263
+ */
1264
+ arcane_dancer_tradition: number;
1265
+ };
@@ -1,5 +1,5 @@
1
1
  import * as Identifier from "./_Identifier.js";
2
- export type ActivatableIdentifier = Identifier.AdvantageIdentifier | Identifier.DisadvantageIdentifier | Identifier.GeneralSpecialAbilityIdentifier | Identifier.FatePointSpecialAbilityIdentifier | Identifier.CombatSpecialAbilityIdentifier | Identifier.MagicalSpecialAbilityIdentifier | Identifier.StaffEnchantmentIdentifier | Identifier.FamiliarSpecialAbilityIdentifier | Identifier.KarmaSpecialAbilityIdentifier | Identifier.ProtectiveWardingCircleSpecialAbilityIdentifier | Identifier.CombatStyleSpecialAbilityIdentifier | Identifier.AdvancedCombatSpecialAbilityIdentifier | Identifier.CommandSpecialAbilityIdentifier | Identifier.MagicStyleSpecialAbilityIdentifier | Identifier.AdvancedMagicalSpecialAbilityIdentifier | Identifier.SpellSwordEnchantmentIdentifier | Identifier.DaggerRitualIdentifier | Identifier.InstrumentEnchantmentIdentifier | Identifier.AttireEnchantmentIdentifier | Identifier.OrbEnchantmentIdentifier | Identifier.WandEnchantmentIdentifier | Identifier.BrawlingSpecialAbilityIdentifier | Identifier.AncestorGlyphIdentifier | Identifier.CeremonialItemSpecialAbilityIdentifier | Identifier.SermonIdentifier | Identifier.LiturgicalStyleSpecialAbilityIdentifier | Identifier.AdvancedKarmaSpecialAbilityIdentifier | Identifier.VisionIdentifier | Identifier.MagicalTraditionIdentifier | Identifier.BlessedTraditionIdentifier | Identifier.PactGiftIdentifier | Identifier.SikaryanDrainSpecialAbilityIdentifier | Identifier.LycantropicGiftIdentifier | Identifier.SkillStyleSpecialAbilityIdentifier | Identifier.AdvancedSkillSpecialAbilityIdentifier | Identifier.ArcaneOrbEnchantmentIdentifier | Identifier.CauldronEnchantmentIdentifier | Identifier.FoolsHatEnchantmentIdentifier | Identifier.ToyEnchantmentIdentifier | Identifier.BowlEnchantmentIdentifier | Identifier.FatePointSexSpecialAbilityIdentifier | Identifier.SexSpecialAbilityIdentifier | Identifier.WeaponEnchantmentIdentifier | Identifier.SickleRitualIdentifier | Identifier.RingEnchantmentIdentifier | Identifier.ChronicleEnchantmentIdentifier | Identifier.KrallenkettenzauberIdentifier | Identifier.TrinkhornzauberIdentifier;
2
+ export type ActivatableIdentifier = Identifier.AdvantageIdentifier | Identifier.DisadvantageIdentifier | Identifier.GeneralSpecialAbilityIdentifier | Identifier.FatePointSpecialAbilityIdentifier | Identifier.CombatSpecialAbilityIdentifier | Identifier.MagicalSpecialAbilityIdentifier | Identifier.StaffEnchantmentIdentifier | Identifier.FamiliarSpecialAbilityIdentifier | Identifier.KarmaSpecialAbilityIdentifier | Identifier.ProtectiveWardingCircleSpecialAbilityIdentifier | Identifier.CombatStyleSpecialAbilityIdentifier | Identifier.AdvancedCombatSpecialAbilityIdentifier | Identifier.CommandSpecialAbilityIdentifier | Identifier.MagicStyleSpecialAbilityIdentifier | Identifier.AdvancedMagicalSpecialAbilityIdentifier | Identifier.SpellSwordEnchantmentIdentifier | Identifier.DaggerRitualIdentifier | Identifier.InstrumentEnchantmentIdentifier | Identifier.AttireEnchantmentIdentifier | Identifier.OrbEnchantmentIdentifier | Identifier.WandEnchantmentIdentifier | Identifier.BrawlingSpecialAbilityIdentifier | Identifier.AncestorGlyphIdentifier | Identifier.CeremonialItemSpecialAbilityIdentifier | Identifier.SermonIdentifier | Identifier.LiturgicalStyleSpecialAbilityIdentifier | Identifier.AdvancedKarmaSpecialAbilityIdentifier | Identifier.VisionIdentifier | Identifier.MagicalTraditionIdentifier | Identifier.BlessedTraditionIdentifier | Identifier.PactGiftIdentifier | Identifier.SikaryanDrainSpecialAbilityIdentifier | Identifier.VampiricGiftIdentifier | Identifier.LycantropicGiftIdentifier | Identifier.SkillStyleSpecialAbilityIdentifier | Identifier.AdvancedSkillSpecialAbilityIdentifier | Identifier.ArcaneOrbEnchantmentIdentifier | Identifier.CauldronEnchantmentIdentifier | Identifier.FoolsHatEnchantmentIdentifier | Identifier.ToyEnchantmentIdentifier | Identifier.BowlEnchantmentIdentifier | Identifier.FatePointSexSpecialAbilityIdentifier | Identifier.SexSpecialAbilityIdentifier | Identifier.WeaponEnchantmentIdentifier | Identifier.SickleRitualIdentifier | Identifier.RingEnchantmentIdentifier | Identifier.ChronicleEnchantmentIdentifier | Identifier.KrallenkettenzauberIdentifier | Identifier.TrinkhornzauberIdentifier;
3
3
  export type SpecialAbilityIdentifier = Identifier.GeneralSpecialAbilityIdentifier | Identifier.FatePointSpecialAbilityIdentifier | Identifier.CombatSpecialAbilityIdentifier | Identifier.MagicalSpecialAbilityIdentifier | Identifier.StaffEnchantmentIdentifier | Identifier.FamiliarSpecialAbilityIdentifier | Identifier.KarmaSpecialAbilityIdentifier | Identifier.ProtectiveWardingCircleSpecialAbilityIdentifier | Identifier.CombatStyleSpecialAbilityIdentifier | Identifier.AdvancedCombatSpecialAbilityIdentifier | Identifier.CommandSpecialAbilityIdentifier | Identifier.MagicStyleSpecialAbilityIdentifier | Identifier.AdvancedMagicalSpecialAbilityIdentifier | Identifier.SpellSwordEnchantmentIdentifier | Identifier.DaggerRitualIdentifier | Identifier.InstrumentEnchantmentIdentifier | Identifier.AttireEnchantmentIdentifier | Identifier.OrbEnchantmentIdentifier | Identifier.WandEnchantmentIdentifier | Identifier.BrawlingSpecialAbilityIdentifier | Identifier.AncestorGlyphIdentifier | Identifier.CeremonialItemSpecialAbilityIdentifier | Identifier.SermonIdentifier | Identifier.LiturgicalStyleSpecialAbilityIdentifier | Identifier.AdvancedKarmaSpecialAbilityIdentifier | Identifier.VisionIdentifier | Identifier.MagicalTraditionIdentifier | Identifier.BlessedTraditionIdentifier | Identifier.PactGiftIdentifier | Identifier.SikaryanDrainSpecialAbilityIdentifier | Identifier.LycantropicGiftIdentifier | Identifier.SkillStyleSpecialAbilityIdentifier | Identifier.AdvancedSkillSpecialAbilityIdentifier | Identifier.ArcaneOrbEnchantmentIdentifier | Identifier.CauldronEnchantmentIdentifier | Identifier.FoolsHatEnchantmentIdentifier | Identifier.ToyEnchantmentIdentifier | Identifier.BowlEnchantmentIdentifier | Identifier.FatePointSexSpecialAbilityIdentifier | Identifier.SexSpecialAbilityIdentifier | Identifier.WeaponEnchantmentIdentifier | Identifier.SickleRitualIdentifier | Identifier.RingEnchantmentIdentifier | Identifier.ChronicleEnchantmentIdentifier | Identifier.KrallenkettenzauberIdentifier | Identifier.TrinkhornzauberIdentifier;
4
4
  export type CombatRelatedSpecialAbilityIdentifier = Identifier.CombatSpecialAbilityIdentifier | Identifier.CombatStyleSpecialAbilityIdentifier | Identifier.AdvancedCombatSpecialAbilityIdentifier | Identifier.CommandSpecialAbilityIdentifier;
5
5
  export type TraditionIdentifier = Identifier.MagicalTraditionIdentifier | Identifier.BlessedTraditionIdentifier;
@@ -13,7 +13,8 @@ export type SkillWithEnhancementsIdentifier = Identifier.SpellIdentifier | Ident
13
13
  export type SpellworkIdentifier = Identifier.SpellIdentifier | Identifier.RitualIdentifier;
14
14
  export type LiturgyIdentifier = Identifier.LiturgicalChantIdentifier | Identifier.CeremonyIdentifier;
15
15
  export type MagicalActionIdentifier = Identifier.CurseIdentifier | Identifier.ElvenMagicalSongIdentifier | Identifier.DominationRitualIdentifier | Identifier.MagicalMelodyIdentifier | Identifier.MagicalDanceIdentifier | Identifier.JesterTrickIdentifier | Identifier.AnimistPowerIdentifier | Identifier.GeodeRitualIdentifier | Identifier.ZibiljaRitualIdentifier;
16
- export type RequirableSelectOptionIdentifier = Identifier.GeneralIdentifier | Identifier.SkillIdentifier | Identifier.CloseCombatTechniqueIdentifier | Identifier.RangedCombatTechniqueIdentifier;
16
+ export type SelectOptionIdentifier = Identifier.GenericIdentifier | Identifier.BlessingIdentifier | Identifier.CantripIdentifier | Identifier.TradeSecretIdentifier | Identifier.ScriptIdentifier | Identifier.AnimalShapeIdentifier | Identifier.ArcaneBardTraditionIdentifier | Identifier.ArcaneDancerTraditionIdentifier | Identifier.SexPracticeIdentifier | Identifier.RaceIdentifier | Identifier.CultureIdentifier | Identifier.BlessedTraditionIdentifier | Identifier.ElementIdentifier | Identifier.PropertyIdentifier | Identifier.AspectIdentifier | Identifier.DiseaseIdentifier | Identifier.PoisonIdentifier | Identifier.LanguageIdentifier | Identifier.SkillIdentifier | Identifier.CloseCombatTechniqueIdentifier | Identifier.RangedCombatTechniqueIdentifier | Identifier.LiturgicalChantIdentifier | Identifier.CeremonyIdentifier | Identifier.SpellIdentifier | Identifier.RitualIdentifier | Identifier.TargetCategoryIdentifier;
17
+ export type RequirableSelectOptionIdentifier = Identifier.GeneralIdentifier | Identifier.SkillIdentifier | Identifier.CloseCombatTechniqueIdentifier | Identifier.RangedCombatTechniqueIdentifier | Identifier.PropertyIdentifier | Identifier.AspectIdentifier | Identifier.LanguageIdentifier | Identifier.AnimalShapeIdentifier | Identifier.LiturgicalChantIdentifier | Identifier.CeremonyIdentifier | Identifier.SpellIdentifier | Identifier.RitualIdentifier;
17
18
  export type CoreRuleDerivableContentIdentifier = Identifier.MagicalTraditionIdentifier | Identifier.FamiliarSpecialAbilityIdentifier | Identifier.MagicalSpecialAbilityIdentifier | Identifier.BlessedTraditionIdentifier;
18
19
  export type EquipmentIdentifier = Identifier.AmmunitionIdentifier | Identifier.AnimalIdentifier | Identifier.AnimalCareIdentifier | Identifier.ArmorIdentifier | Identifier.BandageOrRemedyIdentifier | Identifier.BookIdentifier | Identifier.CeremonialItemIdentifier | Identifier.ClothesIdentifier | Identifier.ContainerIdentifier | Identifier.ElixirIdentifier | Identifier.EquipmentOfBlessedOnesIdentifier | Identifier.GemOrPreciousStoneIdentifier | Identifier.IlluminationLightSourceIdentifier | Identifier.IlluminationRefillsOrSuppliesIdentifier | Identifier.JewelryIdentifier | Identifier.LiebesspielzeugIdentifier | Identifier.LuxuryGoodIdentifier | Identifier.MagicalArtifactIdentifier | Identifier.MusicalInstrumentIdentifier | Identifier.OrienteeringAidIdentifier | Identifier.PoisonIdentifier | Identifier.RopeOrChainIdentifier | Identifier.StationaryIdentifier | Identifier.ThievesToolIdentifier | Identifier.ToolOfTheTradeIdentifier | Identifier.TravelGearOrToolIdentifier | Identifier.VehicleIdentifier | Identifier.WeaponIdentifier | Identifier.WeaponAccessoryIdentifier;
19
20
  export type OneOrManyNumericIdentifiers = OneNumericIdentifier | ManyNumericIdentifiers;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "optolith-database-schema",
3
- "version": "0.15.3",
3
+ "version": "0.15.4",
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.8.10",
36
- "optolith-tsjsonschemamd": "^0.10.4",
36
+ "optolith-tsjsonschemamd": "^0.10.5",
37
37
  "standard-version": "^9.5.0",
38
38
  "typescript": "^5.2.2"
39
39
  },
@@ -832,7 +832,7 @@
832
832
  "description": "The list of specific entries.",
833
833
  "type": "array",
834
834
  "items": {
835
- "$ref": "./_IdentifierGroup.schema.json#/$defs/SkillIdentifier"
835
+ "$ref": "./_SimpleReferences.schema.json#/$defs/SkillReference"
836
836
  },
837
837
  "minItems": 1,
838
838
  "uniqueItems": true
@@ -903,7 +903,7 @@
903
903
  "type": "object",
904
904
  "properties": {
905
905
  "id": {
906
- "$ref": "./_IdentifierGroup.schema.json#/$defs/CombatTechniqueIdentifier"
906
+ "$ref": "./_Identifier.schema.json#/$defs/SkillIdentifier"
907
907
  },
908
908
  "ap_value": {
909
909
  "description": "The AP value for the specified entry.",