optolith-database-schema 0.19.1 → 0.20.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 CHANGED
@@ -2,6 +2,26 @@
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.20.0](https://github.com/elyukai/optolith-database-schema/compare/v0.19.1...v0.20.0) (2025-11-02)
6
+
7
+
8
+ ### ⚠ BREAKING CHANGES
9
+
10
+ * align book type/category with official sources
11
+ * use book cost variant with single single costs as well to enable label usage
12
+
13
+ ### Features
14
+
15
+ * add book category ([b3a88fa](https://github.com/elyukai/optolith-database-schema/commit/b3a88fa9ea417930c4c5249869f4153404570393))
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * align book type/category with official sources ([b89bda8](https://github.com/elyukai/optolith-database-schema/commit/b89bda8e670d1a46d6a5ea2f094401e458ce62f7))
21
+ * general select option display name customizer ([47b308b](https://github.com/elyukai/optolith-database-schema/commit/47b308b4b93deabb83aaec11b4036b9a70350a83))
22
+ * make definite book cost variant translations optional if label is not used ([79c4daa](https://github.com/elyukai/optolith-database-schema/commit/79c4daa3d50aa3468f0c72ef6a5736779c421039))
23
+ * use book cost variant with single single costs as well to enable label usage ([e3f9138](https://github.com/elyukai/optolith-database-schema/commit/e3f91381fe6d93525366e15c3d4073cda90821b8))
24
+
5
25
  ## [0.19.1](https://github.com/elyukai/optolith-database-schema/compare/v0.19.0...v0.19.1) (2025-10-27)
6
26
 
7
27
 
@@ -119,7 +119,7 @@ export const GeneralSelectOption = Entity(import.meta.url, {
119
119
  parentReferenceKey: "parent",
120
120
  displayName: {},
121
121
  displayNameCustomizer: ({ instance, instanceDisplayName, instanceDisplayNameLocaleId, getDisplayNameForInstanceId, }) => ({
122
- name: `${getDisplayNameForInstanceId(instance.parent[instance.parent.kind])} — ${instanceDisplayName}`,
122
+ name: `${getDisplayNameForInstanceId(instance.parent[instance.parent.kind])?.name} — ${instanceDisplayName}`,
123
123
  localeId: instanceDisplayNameLocaleId,
124
124
  }),
125
125
  });
@@ -1,22 +1,48 @@
1
1
  import { Array, Entity, Enum, EnumCase, IncludeIdentifier, Object, String, TypeAlias } from "tsondb/schema/def";
2
2
  export declare const Book: Entity<"Book", {
3
+ types: import("tsondb/schema/def").MemberDecl<Array<IncludeIdentifier<[], Enum<"BookType", {
4
+ Mundane: EnumCase<IncludeIdentifier<[], Enum<"MundaneBookType", {
5
+ RomanceNovel: EnumCase<null>;
6
+ Poetry: EnumCase<null>;
7
+ PoliticalPamphlet: EnumCase<null>;
8
+ CrimeStory: EnumCase<null>;
9
+ FairyTale: EnumCase<null>;
10
+ Novel: EnumCase<null>;
11
+ ProfessionalPublication: EnumCase<import("tsondb/schema/def").ReferenceIdentifierType>;
12
+ }, []>>>;
13
+ Magical: EnumCase<null>;
14
+ Religious: EnumCase<null>;
15
+ }, []>>>, true>;
3
16
  cost: import("tsondb/schema/def").MemberDecl<IncludeIdentifier<[], Enum<"BookCost", {
4
- Single: EnumCase<IncludeIdentifier<[], Enum<"Cost", {
5
- Free: EnumCase<null>;
6
- Various: EnumCase<null>;
7
- Invaluable: EnumCase<null>;
8
- Fixed: EnumCase<IncludeIdentifier<[], TypeAlias<"FixedCost", Object<{
9
- value: import("tsondb/schema/def").MemberDecl<import("tsondb/schema/def").FloatType, true>;
10
- translations: import("tsondb/schema/def").MemberDecl<import("tsondb/schema/def").NestedEntityMapType<"FixedCostTranslation", {
11
- wrap_in_text: import("tsondb/schema/def").MemberDecl<String, true>;
17
+ Single: EnumCase<IncludeIdentifier<[], Enum<"BookCostVariant", {
18
+ Definite: EnumCase<IncludeIdentifier<[], TypeAlias<"DefiniteBookCostVariant", Object<{
19
+ cost: import("tsondb/schema/def").MemberDecl<IncludeIdentifier<[], Enum<"Cost", {
20
+ Free: EnumCase<null>;
21
+ Various: EnumCase<null>;
22
+ Invaluable: EnumCase<null>;
23
+ Fixed: EnumCase<IncludeIdentifier<[], TypeAlias<"FixedCost", Object<{
24
+ value: import("tsondb/schema/def").MemberDecl<import("tsondb/schema/def").FloatType, true>;
25
+ translations: import("tsondb/schema/def").MemberDecl<import("tsondb/schema/def").NestedEntityMapType<"FixedCostTranslation", {
26
+ wrap_in_text: import("tsondb/schema/def").MemberDecl<String, true>;
27
+ }>, false>;
28
+ }>, []>>>;
29
+ Range: EnumCase<IncludeIdentifier<[], TypeAlias<"CostRange", Object<{
30
+ from: import("tsondb/schema/def").MemberDecl<import("tsondb/schema/def").FloatType, true>;
31
+ to: import("tsondb/schema/def").MemberDecl<import("tsondb/schema/def").FloatType, true>;
32
+ translations: import("tsondb/schema/def").MemberDecl<import("tsondb/schema/def").NestedEntityMapType<"CostRangeTranslation", {
33
+ wrap_in_text: import("tsondb/schema/def").MemberDecl<String, true>;
34
+ }>, false>;
35
+ }>, []>>>;
36
+ }, []>>, true>;
37
+ translations: import("tsondb/schema/def").MemberDecl<import("tsondb/schema/def").NestedEntityMapType<"DefiniteBookCostVariantTranslation", {
38
+ label: import("tsondb/schema/def").MemberDecl<String, false>;
12
39
  }>, false>;
13
40
  }>, []>>>;
14
- Range: EnumCase<IncludeIdentifier<[], TypeAlias<"CostRange", Object<{
15
- from: import("tsondb/schema/def").MemberDecl<import("tsondb/schema/def").FloatType, true>;
16
- to: import("tsondb/schema/def").MemberDecl<import("tsondb/schema/def").FloatType, true>;
17
- translations: import("tsondb/schema/def").MemberDecl<import("tsondb/schema/def").NestedEntityMapType<"CostRangeTranslation", {
18
- wrap_in_text: import("tsondb/schema/def").MemberDecl<String, true>;
19
- }>, false>;
41
+ Indefinite: EnumCase<IncludeIdentifier<[], TypeAlias<"IndefiniteBookCostVariant", Object<{
42
+ translations: import("tsondb/schema/def").MemberDecl<import("tsondb/schema/def").NestedEntityMapType<"IndefiniteBookCostVariantTranslation", {
43
+ label: import("tsondb/schema/def").MemberDecl<String, false>;
44
+ description: import("tsondb/schema/def").MemberDecl<String, true>;
45
+ }>, true>;
20
46
  }>, []>>>;
21
47
  }, []>>>;
22
48
  Multiple: EnumCase<Array<IncludeIdentifier<[], Enum<"BookCostVariant", {
@@ -41,7 +67,7 @@ export declare const Book: Entity<"Book", {
41
67
  }, []>>, true>;
42
68
  translations: import("tsondb/schema/def").MemberDecl<import("tsondb/schema/def").NestedEntityMapType<"DefiniteBookCostVariantTranslation", {
43
69
  label: import("tsondb/schema/def").MemberDecl<String, false>;
44
- }>, true>;
70
+ }>, false>;
45
71
  }>, []>>>;
46
72
  Indefinite: EnumCase<IncludeIdentifier<[], TypeAlias<"IndefiniteBookCostVariant", Object<{
47
73
  translations: import("tsondb/schema/def").MemberDecl<import("tsondb/schema/def").NestedEntityMapType<"IndefiniteBookCostVariantTranslation", {
@@ -1,4 +1,5 @@
1
1
  import { Array, Entity, Enum, EnumCase, IncludeIdentifier, Object, Optional, Required, String, TypeAlias, } from "tsondb/schema/def";
2
+ import { SkillIdentifier } from "../../_Identifier.js";
2
3
  import { NestedTranslationMap } from "../../Locale.js";
3
4
  import { Errata } from "../../source/_Erratum.js";
4
5
  import { src } from "../../source/_PublicationRef.js";
@@ -7,6 +8,10 @@ export const Book = Entity(import.meta.url, {
7
8
  name: "Book",
8
9
  namePlural: "Books",
9
10
  type: () => Object({
11
+ types: Required({
12
+ comment: "The type of book.",
13
+ type: Array(IncludeIdentifier(BookType), { minItems: 1, uniqueItems: true }),
14
+ }),
10
15
  cost: Required({
11
16
  comment: "The cost in silverthalers.",
12
17
  type: IncludeIdentifier(BookCost),
@@ -56,13 +61,65 @@ export const Book = Entity(import.meta.url, {
56
61
  }),
57
62
  displayName: {},
58
63
  });
64
+ const BookType = Enum(import.meta.url, {
65
+ name: "BookType",
66
+ comment: "The type of book.",
67
+ values: () => ({
68
+ Mundane: EnumCase({
69
+ comment: "A mundane book without special rules.",
70
+ type: IncludeIdentifier(MundaneBookType),
71
+ }),
72
+ Magical: EnumCase({
73
+ comment: "A magical book.",
74
+ type: null,
75
+ }),
76
+ Religious: EnumCase({
77
+ comment: "A religious book.",
78
+ type: null,
79
+ }),
80
+ }),
81
+ });
82
+ const MundaneBookType = Enum(import.meta.url, {
83
+ name: "MundaneBookType",
84
+ comment: "The type of mundane book, i.e. the type of writing it contains.",
85
+ values: () => ({
86
+ RomanceNovel: EnumCase({
87
+ comment: "A romance novel.",
88
+ type: null,
89
+ }),
90
+ Poetry: EnumCase({
91
+ comment: "A piece of poetry.",
92
+ type: null,
93
+ }),
94
+ PoliticalPamphlet: EnumCase({
95
+ comment: "A political pamphlet.",
96
+ type: null,
97
+ }),
98
+ CrimeStory: EnumCase({
99
+ comment: "A crime story.",
100
+ type: null,
101
+ }),
102
+ FairyTale: EnumCase({
103
+ comment: "A fairy tale.",
104
+ type: null,
105
+ }),
106
+ Novel: EnumCase({
107
+ comment: "A novel.",
108
+ type: null,
109
+ }),
110
+ ProfessionalPublication: EnumCase({
111
+ comment: "A professional publication about a specific topic, represented by a (knowledge) skill.",
112
+ type: SkillIdentifier(),
113
+ }),
114
+ }),
115
+ });
59
116
  const BookCost = Enum(import.meta.url, {
60
117
  name: "BookCost",
61
118
  comment: "The cost of the book, which may be a single value or multiple values that are defined by specific editions or other defining factors of the book.",
62
119
  values: () => ({
63
120
  Single: EnumCase({
64
121
  comment: "The book only has a single cost description.",
65
- type: IncludeIdentifier(Cost),
122
+ type: IncludeIdentifier(BookCostVariant),
66
123
  }),
67
124
  Multiple: EnumCase({
68
125
  comment: "The book’s cost varies by edition or other factors.",
@@ -92,12 +149,12 @@ const DefiniteBookCostVariant = TypeAlias(import.meta.url, {
92
149
  comment: "The cost in silverthalers.",
93
150
  type: IncludeIdentifier(Cost),
94
151
  }),
95
- translations: NestedTranslationMap(Required, "DefiniteBookCostVariant", Object({
152
+ translations: NestedTranslationMap(Optional, "DefiniteBookCostVariant", Object({
96
153
  label: Optional({
97
154
  comment: "The label for the cost variant, e.g. “Original script”.",
98
155
  type: String({ minLength: 1, isMarkdown: true }),
99
156
  }),
100
- })),
157
+ }, { minProperties: 1 })),
101
158
  }),
102
159
  });
103
160
  const IndefiniteBookCostVariant = TypeAlias(import.meta.url, {
@@ -110,7 +167,7 @@ const IndefiniteBookCostVariant = TypeAlias(import.meta.url, {
110
167
  type: String({ minLength: 1, isMarkdown: true }),
111
168
  }),
112
169
  description: Required({
113
- comment: "The description of the cost variant, e.g. “Original script”.",
170
+ comment: "The description of the cost variant, e.g. “less”.",
114
171
  type: String({ minLength: 1, isMarkdown: true }),
115
172
  }),
116
173
  })),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "optolith-database-schema",
3
- "version": "0.19.1",
3
+ "version": "0.20.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",