5etools-utils 0.9.26 → 0.9.28

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/lib/TestJson.js CHANGED
@@ -6,6 +6,7 @@ import {Worker} from "worker_threads";
6
6
  import Ajv2020 from "ajv/dist/2020.js";
7
7
  import addFormats from "ajv-formats";
8
8
  import * as jsonSourceMap from "json-source-map";
9
+ import NP from "number-precision";
9
10
 
10
11
  import * as Uf from "./UtilFs.js";
11
12
  import Um from "./UtilMisc.js";
@@ -69,6 +70,23 @@ class JsonTester {
69
70
  );
70
71
  // endregion
71
72
 
73
+ // region Patch AJV `"multipleOf"`
74
+ // See: https://github.com/ajv-validator/ajv/issues/652#issuecomment-944202626
75
+ this._ajv.removeKeyword("multipleOf");
76
+
77
+ this._ajv.addKeyword({
78
+ keyword: "multipleOf",
79
+ type: "number",
80
+ compile (schema) {
81
+ return (data) => Number.isInteger(NP.divide(data, schema));
82
+ },
83
+ errors: false,
84
+ metaSchema: {
85
+ type: "number",
86
+ },
87
+ });
88
+ // endregion
89
+
72
90
  this._isSchemaLoaded = false;
73
91
  }
74
92
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "5etools-utils",
3
- "version": "0.9.26",
3
+ "version": "0.9.28",
4
4
  "description": "Shared utilities for the 5etools ecosystem.",
5
5
  "type": "module",
6
6
  "main": "lib/Api.js",
@@ -35,11 +35,12 @@
35
35
  },
36
36
  "homepage": "https://github.com/TheGiddyLimit/5etools-utils#readme",
37
37
  "dependencies": {
38
- "ajv": "^8.11.2",
38
+ "ajv": "^8.12.0",
39
39
  "ajv-formats": "^2.1.1",
40
40
  "commander": "^9.4.1",
41
41
  "hasha": "^5.2.2",
42
- "json-source-map": "^0.6.1"
42
+ "json-source-map": "^0.6.1",
43
+ "number-precision": "^1.6.0"
43
44
  },
44
45
  "devDependencies": {
45
46
  "eslint": "^8.11.0",
@@ -0,0 +1,73 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "sources.json",
4
+ "version": "1.0.0",
5
+ "type": "object",
6
+ "description": "Keys are source identifiers.",
7
+ "patternProperties": {
8
+ "^[-a-zA-Z0-9]+$": {
9
+ "type": "object",
10
+ "description": "Keys are spell names.",
11
+ "patternProperties": {
12
+ "^[-a-zA-Z0-9 '()/;]+$": {
13
+ "type": "object",
14
+ "properties": {
15
+ "class": {
16
+ "type": "array",
17
+ "items": {
18
+ "type": "object",
19
+ "properties": {
20
+ "name": {
21
+ "type": "string"
22
+ },
23
+ "source": {
24
+ "type": "string"
25
+ },
26
+ "definedInSource": {
27
+ "type": "string"
28
+ }
29
+ },
30
+ "required": [
31
+ "name",
32
+ "source"
33
+ ],
34
+ "additionalProperties": false
35
+ },
36
+ "minItems": 1
37
+ },
38
+ "classVariant": {
39
+ "type": "array",
40
+ "items": {
41
+ "type": "object",
42
+ "properties": {
43
+ "name": {
44
+ "type": "string"
45
+ },
46
+ "source": {
47
+ "type": "string"
48
+ },
49
+ "definedInSource": {
50
+ "type": "string"
51
+ }
52
+ },
53
+ "required": [
54
+ "name",
55
+ "source",
56
+ "definedInSource"
57
+ ],
58
+ "additionalProperties": false
59
+ },
60
+ "minItems": 1
61
+ }
62
+ },
63
+ "additionalProperties": false,
64
+ "minProperties": 1
65
+ }
66
+ },
67
+ "additionalProperties": false,
68
+ "minProperties": 1
69
+ }
70
+ },
71
+ "additionalProperties": false,
72
+ "minProperties": 1
73
+ }
@@ -0,0 +1,73 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "sources.json",
4
+ "version": "1.0.0",
5
+ "type": "object",
6
+ "description": "Keys are source identifiers.",
7
+ "patternProperties": {
8
+ "^[-a-zA-Z0-9]+$": {
9
+ "type": "object",
10
+ "description": "Keys are spell names.",
11
+ "patternProperties": {
12
+ "^[-a-zA-Z0-9 '()/;]+$": {
13
+ "type": "object",
14
+ "properties": {
15
+ "class": {
16
+ "type": "array",
17
+ "items": {
18
+ "type": "object",
19
+ "properties": {
20
+ "name": {
21
+ "type": "string"
22
+ },
23
+ "source": {
24
+ "type": "string"
25
+ },
26
+ "definedInSource": {
27
+ "type": "string"
28
+ }
29
+ },
30
+ "required": [
31
+ "name",
32
+ "source"
33
+ ],
34
+ "additionalProperties": false
35
+ },
36
+ "minItems": 1
37
+ },
38
+ "classVariant": {
39
+ "type": "array",
40
+ "items": {
41
+ "type": "object",
42
+ "properties": {
43
+ "name": {
44
+ "type": "string"
45
+ },
46
+ "source": {
47
+ "type": "string"
48
+ },
49
+ "definedInSource": {
50
+ "type": "string"
51
+ }
52
+ },
53
+ "required": [
54
+ "name",
55
+ "source",
56
+ "definedInSource"
57
+ ],
58
+ "additionalProperties": false
59
+ },
60
+ "minItems": 1
61
+ }
62
+ },
63
+ "additionalProperties": false,
64
+ "minProperties": 1
65
+ }
66
+ },
67
+ "additionalProperties": false,
68
+ "minProperties": 1
69
+ }
70
+ },
71
+ "additionalProperties": false,
72
+ "minProperties": 1
73
+ }
@@ -0,0 +1,73 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "sources.json",
4
+ "version": "1.0.0",
5
+ "type": "object",
6
+ "description": "Keys are source identifiers.",
7
+ "patternProperties": {
8
+ "^[-a-zA-Z0-9]+$": {
9
+ "type": "object",
10
+ "description": "Keys are spell names.",
11
+ "patternProperties": {
12
+ "^[-a-zA-Z0-9 '()/;]+$": {
13
+ "type": "object",
14
+ "properties": {
15
+ "class": {
16
+ "type": "array",
17
+ "items": {
18
+ "type": "object",
19
+ "properties": {
20
+ "name": {
21
+ "type": "string"
22
+ },
23
+ "source": {
24
+ "type": "string"
25
+ },
26
+ "definedInSource": {
27
+ "type": "string"
28
+ }
29
+ },
30
+ "required": [
31
+ "name",
32
+ "source"
33
+ ],
34
+ "additionalProperties": false
35
+ },
36
+ "minItems": 1
37
+ },
38
+ "classVariant": {
39
+ "type": "array",
40
+ "items": {
41
+ "type": "object",
42
+ "properties": {
43
+ "name": {
44
+ "type": "string"
45
+ },
46
+ "source": {
47
+ "type": "string"
48
+ },
49
+ "definedInSource": {
50
+ "type": "string"
51
+ }
52
+ },
53
+ "required": [
54
+ "name",
55
+ "source",
56
+ "definedInSource"
57
+ ],
58
+ "additionalProperties": false
59
+ },
60
+ "minItems": 1
61
+ }
62
+ },
63
+ "additionalProperties": false,
64
+ "minProperties": 1
65
+ }
66
+ },
67
+ "additionalProperties": false,
68
+ "minProperties": 1
69
+ }
70
+ },
71
+ "additionalProperties": false,
72
+ "minProperties": 1
73
+ }
@@ -0,0 +1,73 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "sources.json",
4
+ "version": "1.0.0",
5
+ "type": "object",
6
+ "description": "Keys are source identifiers.",
7
+ "patternProperties": {
8
+ "^[-a-zA-Z0-9]+$": {
9
+ "type": "object",
10
+ "description": "Keys are spell names.",
11
+ "patternProperties": {
12
+ "^[-a-zA-Z0-9 '()/;]+$": {
13
+ "type": "object",
14
+ "properties": {
15
+ "class": {
16
+ "type": "array",
17
+ "items": {
18
+ "type": "object",
19
+ "properties": {
20
+ "name": {
21
+ "type": "string"
22
+ },
23
+ "source": {
24
+ "type": "string"
25
+ },
26
+ "definedInSource": {
27
+ "type": "string"
28
+ }
29
+ },
30
+ "required": [
31
+ "name",
32
+ "source"
33
+ ],
34
+ "additionalProperties": false
35
+ },
36
+ "minItems": 1
37
+ },
38
+ "classVariant": {
39
+ "type": "array",
40
+ "items": {
41
+ "type": "object",
42
+ "properties": {
43
+ "name": {
44
+ "type": "string"
45
+ },
46
+ "source": {
47
+ "type": "string"
48
+ },
49
+ "definedInSource": {
50
+ "type": "string"
51
+ }
52
+ },
53
+ "required": [
54
+ "name",
55
+ "source",
56
+ "definedInSource"
57
+ ],
58
+ "additionalProperties": false
59
+ },
60
+ "minItems": 1
61
+ }
62
+ },
63
+ "additionalProperties": false,
64
+ "minProperties": 1
65
+ }
66
+ },
67
+ "additionalProperties": false,
68
+ "minProperties": 1
69
+ }
70
+ },
71
+ "additionalProperties": false,
72
+ "minProperties": 1
73
+ }
@@ -0,0 +1,73 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "sources.json",
4
+ "version": "1.0.0",
5
+ "type": "object",
6
+ "description": "Keys are source identifiers.",
7
+ "patternProperties": {
8
+ "^[-a-zA-Z0-9]+$": {
9
+ "type": "object",
10
+ "description": "Keys are spell names.",
11
+ "patternProperties": {
12
+ "^[-a-zA-Z0-9 '()/;]+$": {
13
+ "type": "object",
14
+ "properties": {
15
+ "class": {
16
+ "type": "array",
17
+ "items": {
18
+ "type": "object",
19
+ "properties": {
20
+ "name": {
21
+ "type": "string"
22
+ },
23
+ "source": {
24
+ "type": "string"
25
+ },
26
+ "definedInSource": {
27
+ "type": "string"
28
+ }
29
+ },
30
+ "required": [
31
+ "name",
32
+ "source"
33
+ ],
34
+ "additionalProperties": false
35
+ },
36
+ "minItems": 1
37
+ },
38
+ "classVariant": {
39
+ "type": "array",
40
+ "items": {
41
+ "type": "object",
42
+ "properties": {
43
+ "name": {
44
+ "type": "string"
45
+ },
46
+ "source": {
47
+ "type": "string"
48
+ },
49
+ "definedInSource": {
50
+ "type": "string"
51
+ }
52
+ },
53
+ "required": [
54
+ "name",
55
+ "source",
56
+ "definedInSource"
57
+ ],
58
+ "additionalProperties": false
59
+ },
60
+ "minItems": 1
61
+ }
62
+ },
63
+ "additionalProperties": false,
64
+ "minProperties": 1
65
+ }
66
+ },
67
+ "additionalProperties": false,
68
+ "minProperties": 1
69
+ }
70
+ },
71
+ "additionalProperties": false,
72
+ "minProperties": 1
73
+ }
@@ -0,0 +1,73 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "sources.json",
4
+ "version": "1.0.0",
5
+ "type": "object",
6
+ "description": "Keys are source identifiers.",
7
+ "patternProperties": {
8
+ "^[-a-zA-Z0-9]+$": {
9
+ "type": "object",
10
+ "description": "Keys are spell names.",
11
+ "patternProperties": {
12
+ "^[-a-zA-Z0-9 '()/;]+$": {
13
+ "type": "object",
14
+ "properties": {
15
+ "class": {
16
+ "type": "array",
17
+ "items": {
18
+ "type": "object",
19
+ "properties": {
20
+ "name": {
21
+ "type": "string"
22
+ },
23
+ "source": {
24
+ "type": "string"
25
+ },
26
+ "definedInSource": {
27
+ "type": "string"
28
+ }
29
+ },
30
+ "required": [
31
+ "name",
32
+ "source"
33
+ ],
34
+ "additionalProperties": false
35
+ },
36
+ "minItems": 1
37
+ },
38
+ "classVariant": {
39
+ "type": "array",
40
+ "items": {
41
+ "type": "object",
42
+ "properties": {
43
+ "name": {
44
+ "type": "string"
45
+ },
46
+ "source": {
47
+ "type": "string"
48
+ },
49
+ "definedInSource": {
50
+ "type": "string"
51
+ }
52
+ },
53
+ "required": [
54
+ "name",
55
+ "source",
56
+ "definedInSource"
57
+ ],
58
+ "additionalProperties": false
59
+ },
60
+ "minItems": 1
61
+ }
62
+ },
63
+ "additionalProperties": false,
64
+ "minProperties": 1
65
+ }
66
+ },
67
+ "additionalProperties": false,
68
+ "minProperties": 1
69
+ }
70
+ },
71
+ "additionalProperties": false,
72
+ "minProperties": 1
73
+ }