optolith-database-schema 0.21.1 → 0.21.2

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 CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
4
4
 
5
+ ## [0.21.2](https://github.com/elyukai/optolith-database-schema/compare/v0.21.1...v0.21.2) (2025-11-30)
6
+
7
+
8
+ ### Features
9
+
10
+ * allow three fraction digits for item weight ([9d2dc02](https://github.com/elyukai/optolith-database-schema/commit/9d2dc029c2a07ec3180b4d340ff5ea8afe67fcba))
11
+
5
12
  ## [0.21.1](https://github.com/elyukai/optolith-database-schema/compare/v0.21.0...v0.21.1) (2025-11-27)
6
13
 
7
14
 
@@ -1,4 +1,4 @@
1
- import { Boolean, Entity, MemberDecl, NestedEntityMap, ObjectType, String, TranslationObject, Type } from "tsondb/schema/def";
1
+ import { Boolean, Entity, type MemberDecl, NestedEntityMap, type ObjectType, String, TranslationObject, type Type } from "tsondb/schema/def";
2
2
  export declare const Locale: Entity<"Locale", {
3
3
  name: MemberDecl<String, true>;
4
4
  region: MemberDecl<String, true>;
@@ -1278,7 +1278,7 @@ export declare const Locale: Entity<"Locale", {
1278
1278
  "removed in {0}. printing": null;
1279
1279
  }>, false>;
1280
1280
  }, undefined>;
1281
- export declare const NestedTranslationMap: <Name extends string, T extends Record<string, MemberDecl<Type, boolean>>, R extends boolean>(MemberDeclCreator: <T_1 extends Type>(options: {
1281
+ export declare const NestedTranslationMap: <Name extends string, T extends Record<string, MemberDecl>, R extends boolean>(MemberDeclCreator: <T_1 extends Type>(options: {
1282
1282
  comment?: string;
1283
1283
  isDeprecated?: boolean;
1284
1284
  type: T_1;
@@ -35,7 +35,7 @@ export const Profession = Entity(import.meta.url, {
35
35
  }
36
36
  return {
37
37
  ...displayName,
38
- name: `${displayName.name} (+${otherProfessionVersions.length} version${otherProfessionVersions.length > 1 ? "s" : ""})`,
38
+ name: `${displayName.name} (+${otherProfessionVersions.length.toString()} version${otherProfessionVersions.length > 1 ? "s" : ""})`,
39
39
  };
40
40
  },
41
41
  });
@@ -133,17 +133,15 @@ export const ProfessionVersion = Entity(import.meta.url, {
133
133
  pathInLocaleMap: "name.default",
134
134
  },
135
135
  displayNameCustomizer: ({ instance, instanceId, locales }) => {
136
- if (typeof instance.translations === "object" && instance.translations !== null) {
137
- const translations = Object.entries(instance.translations);
138
- for (const locale of locales) {
139
- const translation = translations.find(([key]) => key === locale);
140
- if (translation) {
141
- const [, value] = translation;
142
- return {
143
- name: value.name.default + (value.specification ? ` (${value.specification.default})` : ""),
144
- localeId: locale,
145
- };
146
- }
136
+ const translations = Object.entries(instance.translations);
137
+ for (const locale of locales) {
138
+ const translation = translations.find(([key]) => key === locale);
139
+ if (translation) {
140
+ const [, value] = translation;
141
+ return {
142
+ name: value.name.default + (value.specification ? ` (${value.specification.default})` : ""),
143
+ localeId: locale,
144
+ };
147
145
  }
148
146
  }
149
147
  return {
@@ -28,9 +28,9 @@ export const SkillModificationLevel = Entity(import.meta.url, {
28
28
  }),
29
29
  displayName: null,
30
30
  displayNameCustomizer: ({ instance, locales }) => ({
31
- name: `${instance.fast.casting_time} Act. / ${instance.slow.casting_time.value} ${instance.slow.casting_time.unit.kind} (fast/slow) — ${instance.fast.range === instance.slow.range
32
- ? instance.fast.range
33
- : instance.fast.range + "/" + instance.slow.range + " (fast/slow)"} m — ${instance.fast.cost}/${instance.slow.cost} (fast/slow) AE or KP`,
31
+ name: `${instance.fast.casting_time.toString()} Act. / ${instance.slow.casting_time.value.toString()} ${instance.slow.casting_time.unit.kind} (fast/slow) — ${instance.fast.range === instance.slow.range
32
+ ? instance.fast.range.toString()
33
+ : `${instance.fast.range.toString()}/${instance.slow.range.toString()} (fast/slow)`} m — ${instance.fast.cost.toString()}/${instance.slow.cost.toString()} (fast/slow) AE or KP`,
34
34
  localeId: locales[0],
35
35
  }),
36
36
  });
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * General type specifications used by multiple activatable entries.
3
3
  */
4
- import { Array, Boolean, ChildEntities, Entity, Enum, EnumCase, IncludeIdentifier, Integer, Object, String, Type, TypeAlias, TypeArgument } from "tsondb/schema/def";
4
+ import { Array, Boolean, ChildEntities, Entity, Enum, EnumCase, IncludeIdentifier, Integer, Object, String, type Type, TypeAlias, TypeArgument } from "tsondb/schema/def";
5
5
  import { MathOperation } from "./_MathExpression.js";
6
6
  export declare const name: import("tsondb/schema/def").MemberDecl<String, true>;
7
7
  export declare const name_in_library: import("tsondb/schema/def").MemberDecl<String, false>;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * General type specifications used by multiple activatable entries.
3
3
  */
4
- import { Array, Boolean, ChildEntities, Entity, Enum, EnumCase, GenEnum, GenIncludeIdentifier, GenTypeAlias, IncludeIdentifier, Integer, Object, Optional, Param, Required, String, TypeAlias, TypeArgument, } from "tsondb/schema/def";
4
+ import { Array, Boolean, ChildEntities, Entity, Enum, EnumCase, GenEnum, GenIncludeIdentifier, GenTypeAlias, getAnyEnumCaseValue, IncludeIdentifier, Integer, Object, Optional, Param, Required, String, TypeAlias, TypeArgument, } from "tsondb/schema/def";
5
5
  import { NestedTranslationMap } from "./Locale.js";
6
6
  import { SelectOptionCategory } from "./_ActivatableSelectOptionCategory.js";
7
7
  import { DurationUnitValue } from "./_ActivatableSkillDuration.js";
@@ -115,7 +115,9 @@ export const GeneralSelectOption = Entity(import.meta.url, {
115
115
  parentReferenceKey: "parent",
116
116
  displayName: {},
117
117
  displayNameCustomizer: ({ instance, instanceDisplayName, instanceDisplayNameLocaleId, getDisplayNameForInstanceId, }) => ({
118
- name: `${getDisplayNameForInstanceId(instance.parent[instance.parent.kind])?.name} ${instanceDisplayName}`,
118
+ name: `${instanceDisplayName.length > 0
119
+ ? instanceDisplayName
120
+ : (getDisplayNameForInstanceId(getAnyEnumCaseValue(instance.parent))?.name ?? "")} — ${instanceDisplayName}`,
119
121
  localeId: instanceDisplayNameLocaleId,
120
122
  }),
121
123
  });
@@ -356,8 +358,9 @@ export const NewSkillApplication = Entity(import.meta.url, {
356
358
  parentReferenceKey: "parent",
357
359
  displayName: {},
358
360
  displayNameCustomizer: ({ instance, instanceDisplayName, instanceDisplayNameLocaleId, getDisplayNameForInstanceId, }) => ({
359
- name: `${instanceDisplayName ||
360
- getDisplayNameForInstanceId(instance.parent[instance.parent.kind])}`,
361
+ name: instanceDisplayName.length > 0
362
+ ? instanceDisplayName
363
+ : (getDisplayNameForInstanceId(getAnyEnumCaseValue(instance.parent))?.name ?? ""),
361
364
  localeId: instanceDisplayNameLocaleId,
362
365
  }),
363
366
  });
@@ -392,8 +395,9 @@ export const SkillUse = Entity(import.meta.url, {
392
395
  parentReferenceKey: "parent",
393
396
  displayName: {},
394
397
  displayNameCustomizer: ({ instance, instanceDisplayName, instanceDisplayNameLocaleId, getDisplayNameForInstanceId, }) => ({
395
- name: `${instanceDisplayName ||
396
- getDisplayNameForInstanceId(instance.parent[instance.parent.kind])}`,
398
+ name: instanceDisplayName.length > 0
399
+ ? instanceDisplayName
400
+ : (getDisplayNameForInstanceId(getAnyEnumCaseValue(instance.parent))?.name ?? ""),
397
401
  localeId: instanceDisplayNameLocaleId,
398
402
  }),
399
403
  });
@@ -782,17 +786,6 @@ const ArcaneEnergyCostDisjunctionOption = TypeAlias(import.meta.url, {
782
786
  }, { minProperties: 1 })),
783
787
  }),
784
788
  });
785
- const NoArcaneEnergyCost = TypeAlias(import.meta.url, {
786
- name: "NoArcaneEnergyCost",
787
- type: () => Object({
788
- translations: NestedTranslationMap(Optional, "NoArcaneEnergyCost", Object({
789
- note: Optional({
790
- comment: "A note, appended to the generated string in parenthesis.",
791
- type: IncludeIdentifier(ResponsiveTextOptional),
792
- }),
793
- }, { minProperties: 1 })),
794
- }),
795
- });
796
789
  const Volume = Enum(import.meta.url, {
797
790
  name: "Volume",
798
791
  comment: "The volume points the enchantment needs.",
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @title Enhancements
3
3
  */
4
- import { ChildEntities, Entity, IncludeIdentifier, Integer, Object, Optional, Required, String, TypeAlias, } from "tsondb/schema/def";
4
+ import { ChildEntities, Entity, getAnyEnumCaseValue, IncludeIdentifier, Integer, Object, Optional, Required, String, TypeAlias, } from "tsondb/schema/def";
5
5
  import { SkillWithEnhancementsIdentifier } from "./_IdentifierGroup.js";
6
6
  import { EnhancementPrerequisites } from "./_Prerequisite.js";
7
7
  import { NestedTranslationMap } from "./Locale.js";
@@ -63,7 +63,7 @@ export const Enhancement = Entity(import.meta.url, {
63
63
  parentReferenceKey: "parent",
64
64
  displayName: {},
65
65
  displayNameCustomizer: ({ instance, instanceDisplayName, instanceDisplayNameLocaleId, getDisplayNameForInstanceId, }) => ({
66
- name: `${getDisplayNameForInstanceId(instance.parent[instance.parent.kind])?.name} — ${instanceDisplayName}`,
66
+ name: `${getDisplayNameForInstanceId(getAnyEnumCaseValue(instance.parent))?.name ?? ""} — ${instanceDisplayName}`,
67
67
  localeId: instanceDisplayNameLocaleId,
68
68
  }),
69
69
  });
@@ -4,7 +4,7 @@ type BinaryMathOperation = {
4
4
  [K in BinaryMathOperationName]: EnumCase<Array<IncludeIdentifier<[Value: TypeParameter], MathOperation>>>;
5
5
  };
6
6
  export type MathOperation = Enum<"MathOperation", {
7
- Value: EnumCase<TypeArgument<TypeParameter>>;
7
+ Value: EnumCase<TypeArgument>;
8
8
  } & BinaryMathOperation, [
9
9
  Value: TypeParameter
10
10
  ]>;
@@ -122,7 +122,7 @@ const CostRange = TypeAlias(import.meta.url, {
122
122
  export const Weight = TypeAlias(import.meta.url, {
123
123
  name: "Weight",
124
124
  comment: "The weight in kg.",
125
- type: () => Float({ minimum: { value: 0, isExclusive: true } }),
125
+ type: () => Float({ minimum: { value: 0, isExclusive: true }, fractionDigits: 3 }),
126
126
  });
127
127
  export const Complexity = Enum(import.meta.url, {
128
128
  name: "Complexity",
@@ -1,4 +1,4 @@
1
- import { Enum, EnumCase, IncludeIdentifier, Object, ReferenceIdentifier, String, TypeAlias } from "tsondb/schema/def";
1
+ import { Enum, EnumCase, IncludeIdentifier, Object, type ReferenceIdentifier, String, TypeAlias } from "tsondb/schema/def";
2
2
  export declare const MusicTraditionReference: (traditionIdentifier: ReferenceIdentifier) => TypeAlias<string, Object<{
3
3
  id: import("tsondb/schema/def").MemberDecl<ReferenceIdentifier, true>;
4
4
  translations: import("tsondb/schema/def").MemberDecl<import("tsondb/schema/def").NestedEntityMapType<`${string}Translation`, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "optolith-database-schema",
3
- "version": "0.21.1",
3
+ "version": "0.21.2",
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",
@@ -28,9 +28,12 @@
28
28
  },
29
29
  "scripts": {
30
30
  "build": "tsc",
31
- "generate": "tsondb generate",
32
31
  "watch": "tsc -w",
32
+ "generate": "tsondb generate",
33
33
  "test": "node ./lib/test.js",
34
+ "lint": "eslint",
35
+ "format": "prettier \"src/{types/**/*.{ts,tsx},*.{ts,tsx}}\" --write",
36
+ "format:check": "prettier \"src/{types/**/*.{ts,tsx},*.{ts,tsx}}\" --check",
34
37
  "release": "commit-and-tag-version",
35
38
  "release:sign": "commit-and-tag-version --sign --signoff"
36
39
  },
@@ -38,13 +41,18 @@
38
41
  "license": "MPL-2.0",
39
42
  "dependencies": {
40
43
  "@optolith/helpers": "^0.2.2",
41
- "tsondb": "^0.12.5",
44
+ "tsondb": "^0.12.7",
42
45
  "yaml": "^2.8.1"
43
46
  },
44
47
  "devDependencies": {
48
+ "@eslint/js": "^9.39.1",
45
49
  "@types/node": "^24.10.1",
46
50
  "commit-and-tag-version": "^12.6.0",
47
- "typescript": "^5.9.3"
51
+ "eslint": "^9.39.1",
52
+ "globals": "^16.5.0",
53
+ "prettier": "^3.7.3",
54
+ "typescript": "^5.9.3",
55
+ "typescript-eslint": "^8.48.0"
48
56
  },
49
57
  "repository": "github:elyukai/optolith-database-schema",
50
58
  "bugs": {