@hyprune/schema 0.6.0 → 0.7.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.
@@ -0,0 +1,59 @@
1
+ {
2
+ "formatVersion": "0.9",
3
+ "id": "bench",
4
+ "version": "1.0.0",
5
+ "name": "Bench",
6
+ "category": "furniture",
7
+ "scene": "object.glb",
8
+ "license": "CC0-1.0",
9
+ "attribution": [
10
+ {
11
+ "path": ".",
12
+ "author": "Example Author",
13
+ "license": "CC0-1.0"
14
+ }
15
+ ],
16
+ "bounds": {
17
+ "min": [
18
+ -0.8,
19
+ 0,
20
+ -0.25
21
+ ],
22
+ "max": [
23
+ 0.8,
24
+ 0.85,
25
+ 0.25
26
+ ]
27
+ },
28
+ "traits": {
29
+ "collidable": {
30
+ "node": "proxy"
31
+ },
32
+ "movable": {},
33
+ "seat": {
34
+ "capacity": 2,
35
+ "anchors": [
36
+ {
37
+ "id": "left",
38
+ "position": [
39
+ -0.4,
40
+ 0,
41
+ 0.55
42
+ ],
43
+ "yaw": 0,
44
+ "height": 0.45
45
+ },
46
+ {
47
+ "id": "right",
48
+ "position": [
49
+ 0.4,
50
+ 0,
51
+ 0.55
52
+ ],
53
+ "yaw": 0,
54
+ "height": 0.45
55
+ }
56
+ ]
57
+ }
58
+ }
59
+ }
@@ -0,0 +1,148 @@
1
+ {
2
+ "formatVersion": "0.9",
3
+ "id": "street-lantern",
4
+ "version": "1.0.0",
5
+ "name": "Street lantern",
6
+ "description": "A post lantern with a softly bobbing flame and a bench seat at its foot.",
7
+ "category": "lighting",
8
+ "tags": [
9
+ "lamp",
10
+ "street"
11
+ ],
12
+ "scene": "object.glb",
13
+ "license": "CC-BY-4.0",
14
+ "attribution": [
15
+ {
16
+ "path": ".",
17
+ "author": "Example Author",
18
+ "license": "CC-BY-4.0",
19
+ "source": "https://example.com/street-lantern"
20
+ }
21
+ ],
22
+ "bounds": {
23
+ "min": [
24
+ -0.25,
25
+ 0,
26
+ -0.25
27
+ ],
28
+ "max": [
29
+ 0.25,
30
+ 2.4,
31
+ 0.25
32
+ ]
33
+ },
34
+ "thumbnail": "thumbnail.png",
35
+ "lighting": {
36
+ "mode": "probe"
37
+ },
38
+ "traits": {
39
+ "decorative": {
40
+ "animations": [
41
+ {
42
+ "node": "flame",
43
+ "type": "bob",
44
+ "axis": [
45
+ 0,
46
+ 1,
47
+ 0
48
+ ],
49
+ "amplitude": 0.01,
50
+ "period": 3
51
+ }
52
+ ]
53
+ },
54
+ "collidable": {
55
+ "node": "proxy"
56
+ },
57
+ "movable": {
58
+ "surfaces": [
59
+ "floor"
60
+ ],
61
+ "upright": true,
62
+ "scale": [
63
+ 0.75,
64
+ 1.5
65
+ ]
66
+ }
67
+ },
68
+ "slots": {
69
+ "states": [
70
+ {
71
+ "id": "status",
72
+ "materials": [
73
+ "lamp-glass"
74
+ ],
75
+ "palette": [
76
+ {
77
+ "id": "idle",
78
+ "colour": [
79
+ 0.3,
80
+ 0.5,
81
+ 1.0
82
+ ],
83
+ "emission": 1
84
+ },
85
+ {
86
+ "id": "busy",
87
+ "colour": [
88
+ 1.0,
89
+ 0.7,
90
+ 0.2
91
+ ],
92
+ "emission": 2
93
+ },
94
+ {
95
+ "id": "fault",
96
+ "colour": [
97
+ 1.0,
98
+ 0.2,
99
+ 0.2
100
+ ],
101
+ "emission": 3
102
+ }
103
+ ]
104
+ }
105
+ ],
106
+ "labels": [
107
+ {
108
+ "id": "title",
109
+ "pose": {
110
+ "position": [
111
+ 0,
112
+ 1.9,
113
+ 0.26
114
+ ],
115
+ "rotation": [
116
+ 0,
117
+ 0,
118
+ 0,
119
+ 1
120
+ ]
121
+ },
122
+ "size": [
123
+ 0.6,
124
+ 0.15
125
+ ],
126
+ "maxChars": 24
127
+ }
128
+ ],
129
+ "effects": [
130
+ {
131
+ "id": "vent",
132
+ "pose": {
133
+ "position": [
134
+ 0,
135
+ 2.3,
136
+ 0
137
+ ],
138
+ "rotation": [
139
+ 0,
140
+ 0,
141
+ 0,
142
+ 1
143
+ ]
144
+ }
145
+ }
146
+ ]
147
+ }
148
+ }
@@ -1,12 +1,16 @@
1
1
  // Type declarations for lib/validate.mjs.
2
2
 
3
3
  /** Schema kinds `validate` accepts; `scene` checks a scene.gltf against its world format. */
4
- export type ContractKind = 'world' | 'extension' | 'screen-type' | 'ipc' | 'scene';
4
+ export type ContractKind = 'world' | 'extension' | 'screen-type' | 'ipc' | 'scene' | 'object' | 'library' | 'library-releases';
5
5
 
6
6
  export interface ValidationResult {
7
7
  valid: boolean;
8
8
  /** JSON-pointer-prefixed messages; empty when valid. */
9
9
  errors: string[];
10
+ /** Kinds object, library and library-releases: advisory messages (never make a document invalid). */
11
+ warnings?: string[];
12
+ /** Kind object with a glTF: triangles drawn by the scene. */
13
+ triangles?: number;
10
14
  }
11
15
 
12
16
  export interface ValidateOptions {
@@ -18,6 +22,18 @@ export interface ValidateOptions {
18
22
  * names, nesting) instead of the world's scene.gltf.
19
23
  */
20
24
  asset?: string;
25
+ /** Kind object: the parsed scene glTF (or a GLB's JSON chunk) for node, material, variant, clip, budget and bounds checks. */
26
+ gltf?: unknown;
27
+ /** Kind object: the directory name, which must equal the object id. */
28
+ directory?: string;
29
+ /** Kind object: every file of the object directory (attribution coverage and limits); kind library: every file of the library. */
30
+ files?: ReadonlyArray<{ path: string; size: number }>;
31
+ /** Kind object: the thumbnail PNG's size. */
32
+ thumbnail?: { width: number; height: number; bytes: number };
33
+ /** Kind object: values that need decoded geometry or images. */
34
+ measured?: { bounds?: { min: number[]; max: number[] }; maxTextureSize?: number; gpuBytes?: number };
35
+ /** Kind library: each listed object's parsed object.json, keyed by directory name. */
36
+ objects?: Record<string, { id?: string; formatVersion?: string }>;
21
37
  }
22
38
 
23
39
  /**
@@ -25,7 +41,8 @@ export interface ValidateOptions {
25
41
  * @param kind contract kind
26
42
  * @param value parsed document (world.json, extension.json, an IPC frame, scene.gltf)
27
43
  * @param method IPC only: the outstanding request's method, to validate a response's result
28
- * @param version world format or IPC version, e.g. '0.7' or '0.19' (default '0.1')
44
+ * @param version world format or IPC version, e.g. '0.7' or '0.19' (default '0.1'); for objects and
45
+ * libraries the object format (default: the document's formatVersion)
29
46
  * @throws on an unknown kind, version or method (usage errors, not validation failures)
30
47
  */
31
48
  export function validate(kind: ContractKind, value: unknown, method?: string, version?: string, options?: ValidateOptions): ValidationResult;
@@ -39,5 +56,9 @@ export const worldFormats: readonly string[];
39
56
  export const ipcProtocols: readonly string[];
40
57
  /** Every contract version directory, oldest first. */
41
58
  export const contractVersions: readonly string[];
59
+ /** Object manifest formats with a published schema (RFC-0011; world format numbering from 0.9). */
60
+ export const objectFormats: readonly string[];
61
+ /** RFC-0011 directory, asset and library limits the object and library checks apply. */
62
+ export const objectLimits: Readonly<Record<string, number>>;
42
63
  /** glTF extensions a scene may list in extensionsRequired for a world format. */
43
64
  export function sceneExtensions(version: string): string[];