@hyprune/schema 0.10.0 → 0.11.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.
Files changed (40) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +23 -0
  3. package/bin/validate.mjs +11 -5
  4. package/examples/registry/entry.json +106 -0
  5. package/examples/registry/index.json +137 -0
  6. package/examples/registry/invalid/registry-entry--bad-spdx.json +106 -0
  7. package/examples/registry/invalid/registry-entry--build-metadata.json +106 -0
  8. package/examples/registry/invalid/registry-entry--control-characters.json +106 -0
  9. package/examples/registry/invalid/registry-entry--duplicate-version.json +136 -0
  10. package/examples/registry/invalid/registry-entry--five-thumbnails.json +130 -0
  11. package/examples/registry/invalid/registry-entry--library-over-limit.json +22 -0
  12. package/examples/registry/invalid/registry-entry--name-too-long.json +106 -0
  13. package/examples/registry/invalid/registry-entry--tag-mismatch.json +106 -0
  14. package/examples/registry/invalid/registry-entry--uppercase-hash.json +106 -0
  15. package/examples/registry/invalid/registry-entry--versions-oldest-first.json +106 -0
  16. package/examples/registry/invalid/registry-index--duplicate-id.json +159 -0
  17. package/examples/registry/invalid/registry-index--entry-schema-pointer.json +138 -0
  18. package/examples/registry/invalid/registry-index--http-url.json +137 -0
  19. package/examples/registry/invalid/registry-index--newer-index-version.json +137 -0
  20. package/examples/registry/invalid/registry-index--zero-serial.json +137 -0
  21. package/examples/registry/invalid/release-record--archive-name.json +42 -0
  22. package/examples/registry/invalid/release-record--library-requires.json +42 -0
  23. package/examples/registry/invalid/release-record--short-commit.json +42 -0
  24. package/examples/registry/invalid/release-record--tag-mismatch.json +42 -0
  25. package/examples/registry/invalid/release-record--thumbnail-name.json +42 -0
  26. package/examples/registry/invalid/sources--archive-without-hash.json +50 -0
  27. package/examples/registry/invalid/sources--duplicate-id.json +59 -0
  28. package/examples/registry/invalid/sources--github-without-repo.json +50 -0
  29. package/examples/registry/invalid/sources--index-with-repo.json +52 -0
  30. package/examples/registry/invalid/sources--label-too-long.json +51 -0
  31. package/examples/registry/invalid/sources--reserved-id.json +51 -0
  32. package/examples/registry/invalid/sources--too-many.json +277 -0
  33. package/examples/registry/release-record.json +42 -0
  34. package/examples/registry/sources.json +51 -0
  35. package/lib/validate.d.mts +24 -0
  36. package/lib/validate.mjs +137 -0
  37. package/package.json +2 -1
  38. package/registry/v0.1/index.schema.json +309 -0
  39. package/registry/v0.1/release-record.schema.json +181 -0
  40. package/registry/v0.1/sources.schema.json +129 -0
@@ -0,0 +1,129 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://hyprune.com/schema/registry/v0.1/sources.schema.json",
4
+ "title": "Hyprune sources configuration 0.1 (RFC-0015): sources.json and the read-only files of HYPRUNE_SOURCES_FILES",
5
+ "type": "object",
6
+ "properties": {
7
+ "$schema": {
8
+ "$ref": "index.schema.json#/$defs/https"
9
+ },
10
+ "version": {
11
+ "const": 1
12
+ },
13
+ "builtin": {
14
+ "description": "Switches for the built-in sources; they can be disabled, never removed or relabelled.",
15
+ "type": "object",
16
+ "properties": {
17
+ "official": {
18
+ "$ref": "#/$defs/switch"
19
+ },
20
+ "community": {
21
+ "$ref": "#/$defs/switch"
22
+ }
23
+ },
24
+ "additionalProperties": false
25
+ },
26
+ "custom": {
27
+ "type": "array",
28
+ "maxItems": 32,
29
+ "items": {
30
+ "$ref": "#/$defs/source"
31
+ }
32
+ }
33
+ },
34
+ "required": [
35
+ "version"
36
+ ],
37
+ "additionalProperties": false,
38
+ "$defs": {
39
+ "switch": {
40
+ "type": "object",
41
+ "properties": {
42
+ "enabled": {
43
+ "type": "boolean"
44
+ }
45
+ },
46
+ "required": [
47
+ "enabled"
48
+ ],
49
+ "additionalProperties": false
50
+ },
51
+ "source": {
52
+ "description": "A custom source: an index URL, a GitHub repository (owner/repo, or owner/repo/name for one package of a multi-package repository) or a package URL (an archive with its sha256, or a release record).",
53
+ "type": "object",
54
+ "properties": {
55
+ "id": {
56
+ "type": "string",
57
+ "minLength": 1,
58
+ "maxLength": 48,
59
+ "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
60
+ },
61
+ "label": {
62
+ "type": "string",
63
+ "minLength": 1,
64
+ "maxLength": 48,
65
+ "pattern": "^[^\\u0000-\\u001f\\u007f-\\u009f]+$"
66
+ },
67
+ "kind": {
68
+ "enum": [
69
+ "index",
70
+ "github",
71
+ "url"
72
+ ]
73
+ },
74
+ "url": {
75
+ "$ref": "index.schema.json#/$defs/https"
76
+ },
77
+ "repo": {
78
+ "type": "string",
79
+ "maxLength": 200,
80
+ "pattern": "^[A-Za-z0-9](?:[A-Za-z0-9-]{0,38})/[A-Za-z0-9._-]{1,100}(/[a-z0-9]+(-[a-z0-9]+)*)?$"
81
+ },
82
+ "sha256": {
83
+ "$ref": "index.schema.json#/$defs/sha256"
84
+ },
85
+ "enabled": {
86
+ "type": "boolean"
87
+ },
88
+ "added": {
89
+ "type": "string",
90
+ "pattern": "^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$"
91
+ }
92
+ },
93
+ "required": [
94
+ "id",
95
+ "label",
96
+ "kind",
97
+ "enabled"
98
+ ],
99
+ "additionalProperties": false,
100
+ "allOf": [
101
+ {
102
+ "if": {
103
+ "properties": {
104
+ "kind": {
105
+ "const": "github"
106
+ }
107
+ }
108
+ },
109
+ "then": {
110
+ "properties": {
111
+ "repo": true
112
+ },
113
+ "required": [
114
+ "repo"
115
+ ]
116
+ },
117
+ "else": {
118
+ "properties": {
119
+ "url": true
120
+ },
121
+ "required": [
122
+ "url"
123
+ ]
124
+ }
125
+ }
126
+ ]
127
+ }
128
+ }
129
+ }