optolith-database-schema 0.13.3 → 0.13.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [0.13.4](https://github.com/elyukai/optolith-database-schema/compare/v0.13.3...v0.13.4) (2023-12-01)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * make complexity optional for natural weapons ([13a3b53](https://github.com/elyukai/optolith-database-schema/commit/13a3b530f4cabf4c644c7ded8b020cef21df9013))
11
+ * musical instruments may have a complexity and combat use ([8e6dab0](https://github.com/elyukai/optolith-database-schema/commit/8e6dab0907af7d11f32631c00f8abc4178157492))
12
+
5
13
  ### [0.13.3](https://github.com/elyukai/optolith-database-schema/compare/v0.13.2...v0.13.3) (2023-11-01)
6
14
 
7
15
 
@@ -1,4 +1,4 @@
1
- import { JsonSchemaSpec } from "optolith-tsjsonschemamd/config";
1
+ import { JsonSchemaSpec } from "optolith-tsjsonschemamd/renderers/jsonSchema";
2
2
  export declare const sourceDir: string;
3
3
  export declare const libDir: string;
4
4
  export declare const jsonSchemaDir: string;
@@ -1,8 +1,9 @@
1
1
  import { dirname, join } from "node:path";
2
2
  import { fileURLToPath } from "node:url";
3
+ import { JsonSchemaSpec } from "optolith-tsjsonschemamd/renderers/jsonSchema";
3
4
  const root = join(dirname(fileURLToPath(import.meta.url)), "..", "..");
4
5
  export const sourceDir = join(root, "src", "types");
5
6
  export const libDir = join(root, "lib", "types");
6
7
  export const jsonSchemaDir = join(root, "schema");
7
8
  export const markdownDir = join(root, "docs", "reference");
8
- export const jsonSchemaSpec = "Draft_2019_09";
9
+ export const jsonSchemaSpec = JsonSchemaSpec.Draft_2019_09;
@@ -4,7 +4,7 @@
4
4
  import { TypeConfig } from "../../../typeConfig.js";
5
5
  import { LocaleMap } from "../../_LocaleMap.js";
6
6
  import { PublicationRefs } from "../../source/_PublicationRef.js";
7
- import { Cost, DefaultItemTranslation, Weight } from "./_Item.js";
7
+ import { CombatUse, Complexity, Cost, DefaultItemTranslation, Weight } from "./_Item.js";
8
8
  export type MusicalInstrument = {
9
9
  /**
10
10
  * The cost in silverthalers.
@@ -14,6 +14,15 @@ export type MusicalInstrument = {
14
14
  * The weight in kg.
15
15
  */
16
16
  weight: Weight;
17
+ /**
18
+ * The complexity of crafting the item.
19
+ */
20
+ complexity?: Complexity;
21
+ /**
22
+ * The item can also be used either as an improvised weapon or as an armor,
23
+ * although this is not the primary use case of the item.
24
+ */
25
+ combat_use?: CombatUse;
17
26
  src: PublicationRefs;
18
27
  /**
19
28
  * All translations for the entry, identified by IETF language tag (BCP47).
@@ -20,9 +20,9 @@ export type Weapon = {
20
20
  */
21
21
  weight: Weight;
22
22
  /**
23
- * The complexity of crafting the item.
23
+ * The complexity of crafting the item, if any.
24
24
  */
25
- complexity: Complexity;
25
+ complexity?: Complexity;
26
26
  /**
27
27
  * The structure points of the item. Use an array if the item consists of
28
28
  * multiple components that have individual structure points.
@@ -1,6 +1,6 @@
1
1
  import AjvModule from "ajv";
2
2
  import Ajv2019Module from "ajv/dist/2019.js";
3
3
  import Ajv2020Module from "ajv/dist/2020.js";
4
- import type { JsonSchemaSpec } from "optolith-tsjsonschemamd/config";
4
+ import { JsonSchemaSpec } from "optolith-tsjsonschemamd/renderers/jsonSchema";
5
5
  import "../helpers/array.js";
6
6
  export declare const getPreparedSchemaValidator: (jsonSchemaSpec: JsonSchemaSpec, validatorOptions: AjvModule.Options | undefined, jsonSchemaDir: string) => Promise<Ajv2019Module.default | Ajv2020Module.default>;
@@ -1,6 +1,7 @@
1
1
  import addFormatsModule from "ajv-formats";
2
2
  import Ajv2019Module from "ajv/dist/2019.js";
3
3
  import Ajv2020Module from "ajv/dist/2020.js";
4
+ import { JsonSchemaSpec } from "optolith-tsjsonschemamd/renderers/jsonSchema";
4
5
  import "../helpers/array.js";
5
6
  import { isHiddenFileName, readDirectoryRec, readJsonFile } from "../helpers/io.js";
6
7
  import { assertExhaustive } from "../helpers/typeSafety.js";
@@ -9,10 +10,10 @@ const Ajv2020 = Ajv2020Module.default;
9
10
  const addFormats = addFormatsModule.default;
10
11
  const createSchemaValidator = (jsonSchemaSpec, validatorOptions = {}) => {
11
12
  switch (jsonSchemaSpec) {
12
- case "Draft_07":
13
- case "Draft_2019_09":
13
+ case JsonSchemaSpec.Draft_07:
14
+ case JsonSchemaSpec.Draft_2019_09:
14
15
  return new Ajv2019(validatorOptions);
15
- case "Draft_2020_12":
16
+ case JsonSchemaSpec.Draft_2020_12:
16
17
  return new Ajv2020(validatorOptions);
17
18
  default:
18
19
  assertExhaustive(jsonSchemaSpec);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "optolith-database-schema",
3
- "version": "0.13.3",
3
+ "version": "0.13.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.9.4",
36
+ "optolith-tsjsonschemamd": "^0.10.1",
37
37
  "standard-version": "^9.5.0",
38
38
  "typescript": "^5.2.2"
39
39
  },
@@ -648,34 +648,22 @@
648
648
  ]
649
649
  },
650
650
  "FixedVariantSpecialAbility": {
651
- "type": "object",
652
- "properties": {
653
- "id": {
654
- "description": "The identifier of the combat technique to provide the rating for.",
655
- "$ref": "./_IdentifierGroup.schema.json#/$defs/SpecialAbilityIdentifier"
656
- },
657
- "level": {
658
- "description": "The level of the received special ability.",
659
- "type": "integer",
660
- "minimum": 1
651
+ "allOf": [
652
+ {
653
+ "$ref": "#/$defs/SpecialAbilityDefinition"
661
654
  },
662
- "options": {
663
- "description": "Received select options. Order is important. Typically, you only need the\nfirst array index, though.",
664
- "type": "array",
665
- "items": {
666
- "$ref": "./_IdentifierGroup.schema.json#/$defs/RequirableSelectOptionIdentifier"
655
+ {
656
+ "type": "object",
657
+ "properties": {
658
+ "active": {
659
+ "description": "if set to `false`, if the selection is granted by the basic package, it\nis removed.",
660
+ "const": false
661
+ }
667
662
  },
668
- "minItems": 1
669
- },
670
- "active": {
671
- "description": "if set to `false`, if the selection is granted by the basic package, it\nis removed.",
672
- "const": false
663
+ "required": []
673
664
  }
674
- },
675
- "required": [
676
- "id"
677
665
  ],
678
- "additionalProperties": false
666
+ "unresolvedProperties": false
679
667
  },
680
668
  "VariantSpecialAbilitySelection": {
681
669
  "type": "object",
@@ -240,28 +240,24 @@
240
240
  "additionalProperties": false
241
241
  },
242
242
  "WeightDice": {
243
- "type": "object",
244
- "properties": {
245
- "number": {
246
- "description": "Number of dice of the same type. Example: 2 in 2D6.",
247
- "type": "integer",
248
- "minimum": 1
249
- },
250
- "sides": {
251
- "description": "Number of sides on every die. Example: 6 in 2D6.",
252
- "$ref": "./_Dice.schema.json#/$defs/DieType"
243
+ "allOf": [
244
+ {
245
+ "$ref": "./_Dice.schema.json#/$defs/Dice"
253
246
  },
254
- "offset_strategy": {
255
- "description": "The strategy how to offset the randomly generated values against the\nbase value. Either they are all added or subtracted or even results are\nadded and odd results are subtracted.",
256
- "$ref": "#/$defs/WeightDiceOffsetStrategy"
247
+ {
248
+ "type": "object",
249
+ "properties": {
250
+ "offset_strategy": {
251
+ "description": "The strategy how to offset the randomly generated values against the\nbase value. Either they are all added or subtracted or even results are\nadded and odd results are subtracted.",
252
+ "$ref": "#/$defs/WeightDiceOffsetStrategy"
253
+ }
254
+ },
255
+ "required": [
256
+ "offset_strategy"
257
+ ]
257
258
  }
258
- },
259
- "required": [
260
- "number",
261
- "sides",
262
- "offset_strategy"
263
259
  ],
264
- "additionalProperties": false
260
+ "unresolvedProperties": false
265
261
  },
266
262
  "WeightDiceOffsetStrategy": {
267
263
  "description": "The strategy how to offset the randomly generated values against the\nbase value. Either they are all added or subtracted or even results are\nadded and odd results are subtracted.",
@@ -201,41 +201,39 @@
201
201
  },
202
202
  "CheckResultBasedDuration": {
203
203
  "description": "Defines the duration being based on a check result.",
204
- "type": "object",
205
- "properties": {
206
- "base": {
207
- "description": "The base value that is derived from the check result.",
208
- "$ref": "./_ActivatableSkillCheckResultBased.schema.json#/$defs/CheckResultValue"
209
- },
210
- "modifier": {
211
- "description": "If defined, it modifies the base value.",
212
- "$ref": "./_ActivatableSkillCheckResultBased.schema.json#/$defs/CheckResultBasedModifier"
213
- },
214
- "is_maximum": {
215
- "description": "If the duration is the maximum duration, so it may end earlier.",
216
- "const": true
217
- },
218
- "unit": {
219
- "description": "The duration unit.",
220
- "$ref": "#/$defs/DurationUnit"
204
+ "allOf": [
205
+ {
206
+ "$ref": "./_ActivatableSkillCheckResultBased.schema.json#/$defs/CheckResultBased"
221
207
  },
222
- "translations": {
223
- "description": "All translations for the entry, identified by IETF language tag (BCP47).",
208
+ {
224
209
  "type": "object",
225
- "patternProperties": {
226
- "^[a-z]{2}-[A-Z]{2}$": {
227
- "$ref": "#/$defs/CheckResultBasedDurationTranslation"
210
+ "properties": {
211
+ "is_maximum": {
212
+ "description": "If the duration is the maximum duration, so it may end earlier.",
213
+ "const": true
214
+ },
215
+ "unit": {
216
+ "description": "The duration unit.",
217
+ "$ref": "#/$defs/DurationUnit"
218
+ },
219
+ "translations": {
220
+ "description": "All translations for the entry, identified by IETF language tag (BCP47).",
221
+ "type": "object",
222
+ "patternProperties": {
223
+ "^[a-z]{2}-[A-Z]{2}$": {
224
+ "$ref": "#/$defs/CheckResultBasedDurationTranslation"
225
+ }
226
+ },
227
+ "minProperties": 1,
228
+ "additionalProperties": false
228
229
  }
229
230
  },
230
- "minProperties": 1,
231
- "additionalProperties": false
231
+ "required": [
232
+ "unit"
233
+ ]
232
234
  }
233
- },
234
- "required": [
235
- "base",
236
- "unit"
237
235
  ],
238
- "additionalProperties": false
236
+ "unresolvedProperties": false
239
237
  },
240
238
  "CheckResultBasedDurationTranslation": {
241
239
  "type": "object",
@@ -205,34 +205,32 @@
205
205
  },
206
206
  "CheckResultBasedRange": {
207
207
  "description": "Defines the range being based on a check result.",
208
- "type": "object",
209
- "properties": {
210
- "base": {
211
- "description": "The base value that is derived from the check result.",
212
- "$ref": "./_ActivatableSkillCheckResultBased.schema.json#/$defs/CheckResultValue"
213
- },
214
- "modifier": {
215
- "description": "If defined, it modifies the base value.",
216
- "$ref": "./_ActivatableSkillCheckResultBased.schema.json#/$defs/CheckResultBasedModifier"
217
- },
218
- "is_maximum": {
219
- "description": "If the range is the maximum range.",
220
- "const": true
221
- },
222
- "unit": {
223
- "description": "The duration unit.",
224
- "$ref": "#/$defs/RangeUnit"
208
+ "allOf": [
209
+ {
210
+ "$ref": "./_ActivatableSkillCheckResultBased.schema.json#/$defs/CheckResultBased"
225
211
  },
226
- "is_radius": {
227
- "description": "If `true`, the range is a radius.",
228
- "const": true
212
+ {
213
+ "type": "object",
214
+ "properties": {
215
+ "is_maximum": {
216
+ "description": "If the range is the maximum range.",
217
+ "const": true
218
+ },
219
+ "unit": {
220
+ "description": "The duration unit.",
221
+ "$ref": "#/$defs/RangeUnit"
222
+ },
223
+ "is_radius": {
224
+ "description": "If `true`, the range is a radius.",
225
+ "const": true
226
+ }
227
+ },
228
+ "required": [
229
+ "unit"
230
+ ]
229
231
  }
230
- },
231
- "required": [
232
- "base",
233
- "unit"
234
232
  ],
235
- "additionalProperties": false
233
+ "unresolvedProperties": false
236
234
  },
237
235
  "RangeTranslation": {
238
236
  "type": "object",
@@ -14,6 +14,14 @@
14
14
  "description": "The weight in kg.",
15
15
  "$ref": "./_Item.schema.json#/$defs/Weight"
16
16
  },
17
+ "complexity": {
18
+ "description": "The complexity of crafting the item.",
19
+ "$ref": "./_Item.schema.json#/$defs/Complexity"
20
+ },
21
+ "combat_use": {
22
+ "description": "The item can also be used either as an improvised weapon or as an armor,\nalthough this is not the primary use case of the item.",
23
+ "$ref": "./_Item.schema.json#/$defs/CombatUse"
24
+ },
17
25
  "src": {
18
26
  "$ref": "../../source/_PublicationRef.schema.json#/$defs/PublicationRefs"
19
27
  },
@@ -15,7 +15,7 @@
15
15
  "$ref": "./_Item.schema.json#/$defs/Weight"
16
16
  },
17
17
  "complexity": {
18
- "description": "The complexity of crafting the item.",
18
+ "description": "The complexity of crafting the item, if any.",
19
19
  "$ref": "./_Item.schema.json#/$defs/Complexity"
20
20
  },
21
21
  "structure_points": {
@@ -64,7 +64,6 @@
64
64
  "required": [
65
65
  "cost",
66
66
  "weight",
67
- "complexity",
68
67
  "uses",
69
68
  "src",
70
69
  "translations"