@jxsuite/schema 0.28.0 → 0.28.3

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/class-schema.json CHANGED
@@ -1,220 +1,123 @@
1
1
  {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://jxsuite.com/schema/class/v1",
4
- "title": "Jx Class Definition",
5
- "description": "Schema for Jx .class.json files. A class definition describes a schema-defined class with fields, constructor, methods, and type parameters. Optionally points to a JS module via $implementation for hybrid execution.",
6
- "type": "object",
7
- "required": [
8
- "$prototype",
9
- "title"
10
- ],
11
- "properties": {
12
- "$schema": {
13
- "type": "string"
14
- },
15
- "$id": {
16
- "type": "string"
17
- },
18
- "$prototype": {
19
- "description": "Must be \"Class\" for class definition files.",
20
- "type": "string",
21
- "const": "Class"
22
- },
23
- "title": {
24
- "description": "PascalCase class name, used as the export name.",
25
- "type": "string",
26
- "examples": [
27
- "MarkdownFile",
28
- "DataSource",
29
- "Calculator"
30
- ]
31
- },
32
- "description": {
33
- "type": "string"
34
- },
35
- "extends": {
36
- "description": "Base class — string name or $ref to another .class.json.",
37
- "oneOf": [
38
- {
2
+ "$defs": {
3
+ "ClassConstructorDef": {
4
+ "description": "Class constructor definition.",
5
+ "properties": {
6
+ "$prototype": {
7
+ "const": "Function",
39
8
  "type": "string"
40
9
  },
41
- {
42
- "type": "object",
43
- "required": [
44
- "$ref"
45
- ],
46
- "properties": {
47
- "$ref": {
10
+ "body": {
11
+ "oneOf": [
12
+ {
48
13
  "type": "string"
14
+ },
15
+ {
16
+ "items": {
17
+ "type": "string"
18
+ },
19
+ "type": "array"
49
20
  }
50
- },
51
- "additionalProperties": false
52
- }
53
- ]
54
- },
55
- "$implementation": {
56
- "description": "Relative path to a JS module containing the actual class implementation.",
57
- "type": "string",
58
- "examples": [
59
- "./md.js",
60
- "./lib/calculator.js"
61
- ]
62
- },
63
- "format": {
64
- "$ref": "#/$defs/FormatDef"
65
- },
66
- "$studio": {
67
- "$ref": "#/$defs/StudioHints"
68
- },
69
- "$defs": {
70
- "description": "Class members: parameters, returnTypes, fields, constructor, methods.",
71
- "type": "object",
72
- "properties": {
73
- "parameters": {
74
- "description": "Reusable typed parameter schemas, keyed by name.",
75
- "type": "object",
76
- "additionalProperties": {
77
- "$ref": "#/$defs/ClassParameterDef"
78
- }
79
- },
80
- "returnTypes": {
81
- "description": "Output type schemas, keyed by name.",
82
- "type": "object",
83
- "additionalProperties": {
84
- "type": "object"
85
- }
86
- },
87
- "fields": {
88
- "description": "Class fields with role, access, scope, and type information.",
89
- "type": "object",
90
- "additionalProperties": {
91
- "$ref": "#/$defs/ClassFieldDef"
92
- }
93
- },
94
- "constructor": {
95
- "$ref": "#/$defs/ClassConstructorDef"
21
+ ]
96
22
  },
97
- "methods": {
98
- "description": "Class methods and accessors.",
99
- "type": "object",
100
- "additionalProperties": {
101
- "$ref": "#/$defs/ClassMethodDef"
102
- }
103
- }
104
- }
105
- }
106
- },
107
- "additionalProperties": false,
108
- "$defs": {
109
- "ClassParameterDef": {
110
- "description": "A typed parameter definition for a class.",
111
- "type": "object",
112
- "required": [
113
- "identifier"
114
- ],
115
- "properties": {
116
- "identifier": {
23
+ "description": {
117
24
  "type": "string"
118
25
  },
119
- "type": {},
120
- "format": {
121
- "description": "When \"json-schema\", this parameter's value is itself a JSON Schema.",
122
- "type": "string"
26
+ "parameters": {
27
+ "items": {
28
+ "oneOf": [
29
+ {
30
+ "additionalProperties": false,
31
+ "properties": {
32
+ "$ref": {
33
+ "type": "string"
34
+ }
35
+ },
36
+ "required": [
37
+ "$ref"
38
+ ],
39
+ "type": "object"
40
+ },
41
+ {
42
+ "$ref": "#/$defs/ClassParameterDef"
43
+ }
44
+ ]
45
+ },
46
+ "type": "array"
123
47
  },
124
- "description": {
48
+ "role": {
49
+ "const": "constructor",
125
50
  "type": "string"
126
51
  },
127
- "default": {},
128
- "examples": {
129
- "type": "array"
52
+ "superCall": {
53
+ "properties": {
54
+ "arguments": {
55
+ "items": {
56
+ "type": "string"
57
+ },
58
+ "type": "array"
59
+ }
60
+ },
61
+ "type": "object"
130
62
  }
131
- }
63
+ },
64
+ "type": "object"
132
65
  },
133
66
  "ClassFieldDef": {
134
67
  "description": "A class field definition with access control and scope.",
135
- "type": "object",
136
68
  "properties": {
137
- "role": {
138
- "type": "string",
139
- "const": "field"
69
+ "$prototype": {
70
+ "description": "Data source prototype for this field (e.g., \"Request\").",
71
+ "type": "string"
140
72
  },
141
73
  "access": {
142
- "type": "string",
143
74
  "enum": [
144
75
  "public",
145
76
  "private",
146
77
  "protected"
147
- ]
78
+ ],
79
+ "type": "string"
148
80
  },
149
- "scope": {
150
- "type": "string",
151
- "enum": [
152
- "instance",
153
- "static"
154
- ]
81
+ "default": {},
82
+ "description": {
83
+ "type": "string"
84
+ },
85
+ "examples": {
86
+ "type": "array"
155
87
  },
156
88
  "identifier": {
157
89
  "type": "string"
158
90
  },
159
- "type": {},
160
- "$prototype": {
161
- "description": "Data source prototype for this field (e.g., \"Request\").",
91
+ "initializer": {},
92
+ "role": {
93
+ "const": "field",
162
94
  "type": "string"
163
95
  },
164
- "initializer": {},
165
- "default": {},
166
- "description": {
96
+ "scope": {
97
+ "enum": [
98
+ "instance",
99
+ "static"
100
+ ],
167
101
  "type": "string"
168
102
  },
169
- "examples": {
170
- "type": "array"
171
- }
172
- }
103
+ "type": {}
104
+ },
105
+ "type": "object"
173
106
  },
174
- "ClassConstructorDef": {
175
- "description": "Class constructor definition.",
176
- "type": "object",
107
+ "ClassMethodDef": {
108
+ "description": "A class method or accessor definition. Capability roles (parse, serialize, discover, load) mark static methods that hosts (compiler, server, studio) invoke for format dispatch.",
177
109
  "properties": {
178
- "role": {
179
- "type": "string",
180
- "const": "constructor"
181
- },
182
110
  "$prototype": {
183
- "type": "string",
184
- "const": "Function"
185
- },
186
- "parameters": {
187
- "type": "array",
188
- "items": {
189
- "oneOf": [
190
- {
191
- "type": "object",
192
- "required": [
193
- "$ref"
194
- ],
195
- "properties": {
196
- "$ref": {
197
- "type": "string"
198
- }
199
- },
200
- "additionalProperties": false
201
- },
202
- {
203
- "$ref": "#/$defs/ClassParameterDef"
204
- }
205
- ]
206
- }
111
+ "const": "Function",
112
+ "type": "string"
207
113
  },
208
- "superCall": {
209
- "type": "object",
210
- "properties": {
211
- "arguments": {
212
- "type": "array",
213
- "items": {
214
- "type": "string"
215
- }
216
- }
217
- }
114
+ "access": {
115
+ "enum": [
116
+ "public",
117
+ "private",
118
+ "protected"
119
+ ],
120
+ "type": "string"
218
121
  },
219
122
  "body": {
220
123
  "oneOf": [
@@ -222,196 +125,167 @@
222
125
  "type": "string"
223
126
  },
224
127
  {
225
- "type": "array",
226
128
  "items": {
227
129
  "type": "string"
228
- }
130
+ },
131
+ "type": "array"
229
132
  }
230
133
  ]
231
134
  },
232
135
  "description": {
233
136
  "type": "string"
234
- }
235
- }
236
- },
237
- "ClassMethodDef": {
238
- "description": "A class method or accessor definition. Capability roles (parse, serialize, discover, load) mark static methods that hosts (compiler, server, studio) invoke for format dispatch.",
239
- "type": "object",
240
- "properties": {
241
- "role": {
242
- "type": "string",
243
- "enum": [
244
- "method",
245
- "accessor",
246
- "parse",
247
- "serialize",
248
- "discover",
249
- "load"
250
- ]
251
- },
252
- "$prototype": {
253
- "type": "string",
254
- "const": "Function"
255
- },
256
- "access": {
257
- "type": "string",
258
- "enum": [
259
- "public",
260
- "private",
261
- "protected"
262
- ]
263
137
  },
264
- "scope": {
265
- "type": "string",
266
- "enum": [
267
- "instance",
268
- "static"
269
- ]
138
+ "getter": {
139
+ "properties": {
140
+ "body": {
141
+ "type": "string"
142
+ }
143
+ },
144
+ "type": "object"
270
145
  },
271
146
  "identifier": {
272
147
  "type": "string"
273
148
  },
274
- "timing": {
275
- "description": "Execution environments allowed to call this capability directly. Hosts outside the list round-trip through the dev server.",
276
- "type": "array",
277
- "items": {
278
- "type": "string",
279
- "enum": [
280
- "compiler",
281
- "server",
282
- "client"
283
- ]
284
- }
285
- },
286
149
  "parameters": {
287
- "type": "array",
288
150
  "items": {
289
151
  "oneOf": [
290
152
  {
291
- "type": "object",
292
- "required": [
293
- "$ref"
294
- ],
153
+ "additionalProperties": false,
295
154
  "properties": {
296
155
  "$ref": {
297
156
  "type": "string"
298
157
  }
299
158
  },
300
- "additionalProperties": false
159
+ "required": [
160
+ "$ref"
161
+ ],
162
+ "type": "object"
301
163
  },
302
164
  {
303
165
  "$ref": "#/$defs/ClassParameterDef"
304
166
  }
305
167
  ]
306
- }
168
+ },
169
+ "type": "array"
307
170
  },
308
171
  "returnType": {},
309
- "body": {
310
- "oneOf": [
311
- {
312
- "type": "string"
313
- },
314
- {
315
- "type": "array",
316
- "items": {
317
- "type": "string"
318
- }
319
- }
320
- ]
172
+ "role": {
173
+ "enum": [
174
+ "method",
175
+ "accessor",
176
+ "parse",
177
+ "serialize",
178
+ "discover",
179
+ "load"
180
+ ],
181
+ "type": "string"
321
182
  },
322
- "getter": {
323
- "type": "object",
324
- "properties": {
325
- "body": {
326
- "type": "string"
327
- }
328
- }
183
+ "scope": {
184
+ "enum": [
185
+ "instance",
186
+ "static"
187
+ ],
188
+ "type": "string"
329
189
  },
330
190
  "setter": {
331
- "type": "object",
332
191
  "properties": {
333
- "parameters": {
334
- "type": "array"
335
- },
336
192
  "body": {
337
193
  "type": "string"
194
+ },
195
+ "parameters": {
196
+ "type": "array"
338
197
  }
339
- }
198
+ },
199
+ "type": "object"
340
200
  },
341
- "description": {
342
- "type": "string"
201
+ "timing": {
202
+ "description": "Execution environments allowed to call this capability directly. Hosts outside the list round-trip through the dev server.",
203
+ "items": {
204
+ "enum": [
205
+ "compiler",
206
+ "server",
207
+ "client"
208
+ ],
209
+ "type": "string"
210
+ },
211
+ "type": "array"
343
212
  }
344
- }
213
+ },
214
+ "type": "object"
345
215
  },
346
- "FormatDef": {
347
- "description": "Format participation marker. A class carrying this block is auto-discovered from the project imports map and used for file-extension dispatch by the compiler, server, and studio.",
348
- "type": "object",
349
- "required": [
350
- "extensions"
351
- ],
216
+ "ClassParameterDef": {
217
+ "description": "A typed parameter definition for a class.",
352
218
  "properties": {
353
- "extensions": {
354
- "description": "File extensions this format claims, with leading dot (e.g. [\".md\"]).",
355
- "type": "array",
356
- "items": {
357
- "type": "string",
358
- "pattern": "^\\."
359
- },
360
- "minItems": 1
219
+ "default": {},
220
+ "description": {
221
+ "type": "string"
361
222
  },
362
- "mediaType": {
363
- "description": "MIME type for the format (icons, labels, HTTP).",
223
+ "examples": {
224
+ "type": "array"
225
+ },
226
+ "format": {
227
+ "description": "When \"json-schema\", this parameter's value is itself a JSON Schema.",
364
228
  "type": "string"
365
229
  },
230
+ "identifier": {
231
+ "type": "string"
232
+ },
233
+ "type": {}
234
+ },
235
+ "required": [
236
+ "identifier"
237
+ ],
238
+ "type": "object"
239
+ },
240
+ "FormatDef": {
241
+ "description": "Format participation marker. A class carrying this block is auto-discovered from the project imports map and used for file-extension dispatch by the compiler, server, and studio.",
242
+ "properties": {
366
243
  "documentKinds": {
367
244
  "description": "\"page\"/\"component\" allow the extension in pages/components discovery; \"content\" allows it as a content-type source.",
368
- "type": "array",
369
245
  "items": {
370
- "type": "string",
371
246
  "enum": [
372
247
  "page",
373
248
  "component",
374
249
  "content"
375
- ]
376
- }
250
+ ],
251
+ "type": "string"
252
+ },
253
+ "type": "array"
377
254
  },
378
255
  "exportTarget": {
379
256
  "description": "When true, site builds emit a serialized sidecar per page in this format.",
380
257
  "type": "boolean"
381
258
  },
259
+ "extensions": {
260
+ "description": "File extensions this format claims, with leading dot (e.g. [\".md\"]).",
261
+ "items": {
262
+ "pattern": "^\\.",
263
+ "type": "string"
264
+ },
265
+ "minItems": 1,
266
+ "type": "array"
267
+ },
268
+ "mediaType": {
269
+ "description": "MIME type for the format (icons, labels, HTTP).",
270
+ "type": "string"
271
+ },
382
272
  "remote": {
383
273
  "description": "When true, the load capability accepts http(s) URLs as sources.",
384
274
  "type": "boolean"
385
275
  }
386
- }
276
+ },
277
+ "required": [
278
+ "extensions"
279
+ ],
280
+ "type": "object"
387
281
  },
388
282
  "StudioHints": {
389
283
  "description": "Studio control-surface hints for a format class: editor modes, document-mode rules, templates, and the element/nesting constraints that gate structural editing.",
390
- "type": "object",
391
284
  "properties": {
392
- "icon": {
393
- "type": "string"
394
- },
395
- "modes": {
396
- "description": "Editor modes the studio offers for documents of this format.",
397
- "type": "array",
398
- "items": {
399
- "type": "string"
400
- }
401
- },
402
285
  "documentMode": {
403
- "type": "object",
404
286
  "properties": {
405
- "default": {
406
- "type": "string",
407
- "enum": [
408
- "content",
409
- "component"
410
- ]
411
- },
412
287
  "componentWhen": {
413
288
  "description": "Treat the document as a component when this top-level/frontmatter key matches the regex.",
414
- "type": "object",
415
289
  "properties": {
416
290
  "frontmatterKey": {
417
291
  "type": "string"
@@ -419,69 +293,195 @@
419
293
  "matches": {
420
294
  "type": "string"
421
295
  }
422
- }
296
+ },
297
+ "type": "object"
298
+ },
299
+ "default": {
300
+ "enum": [
301
+ "content",
302
+ "component"
303
+ ],
304
+ "type": "string"
423
305
  }
424
- }
425
- },
426
- "newFileTemplate": {
427
- "description": "Initial source text for newly created files of this format.",
428
- "type": "string"
306
+ },
307
+ "type": "object"
429
308
  },
430
309
  "elements": {
431
310
  "description": "Element allowlist and nesting constraints for structural editing.",
432
- "type": "object",
433
311
  "properties": {
434
312
  "block": {
435
- "type": "array",
436
313
  "items": {
437
314
  "type": "string"
438
- }
315
+ },
316
+ "type": "array"
439
317
  },
440
318
  "inline": {
441
- "type": "array",
442
- "items": {
443
- "type": "string"
444
- }
445
- },
446
- "void": {
447
- "type": "array",
448
- "items": {
449
- "type": "string"
450
- }
451
- },
452
- "textOnly": {
453
- "type": "array",
454
319
  "items": {
455
320
  "type": "string"
456
- }
321
+ },
322
+ "type": "array"
457
323
  },
458
324
  "nesting": {
459
- "description": "Per-parent child rules keyed by tag (or \"_root\"): { block, inline, directive } booleans or { only: [tags] }.",
460
- "type": "object",
461
325
  "additionalProperties": {
462
- "type": "object",
463
326
  "properties": {
464
327
  "block": {
465
328
  "type": "boolean"
466
329
  },
467
- "inline": {
330
+ "directive": {
468
331
  "type": "boolean"
469
332
  },
470
- "directive": {
333
+ "inline": {
471
334
  "type": "boolean"
472
335
  },
473
336
  "only": {
474
- "type": "array",
475
337
  "items": {
476
338
  "type": "string"
477
- }
339
+ },
340
+ "type": "array"
478
341
  }
479
- }
480
- }
342
+ },
343
+ "type": "object"
344
+ },
345
+ "description": "Per-parent child rules keyed by tag (or \"_root\"): { block, inline, directive } booleans or { only: [tags] }.",
346
+ "type": "object"
347
+ },
348
+ "textOnly": {
349
+ "items": {
350
+ "type": "string"
351
+ },
352
+ "type": "array"
353
+ },
354
+ "void": {
355
+ "items": {
356
+ "type": "string"
357
+ },
358
+ "type": "array"
359
+ }
360
+ },
361
+ "type": "object"
362
+ },
363
+ "icon": {
364
+ "type": "string"
365
+ },
366
+ "modes": {
367
+ "description": "Editor modes the studio offers for documents of this format.",
368
+ "items": {
369
+ "type": "string"
370
+ },
371
+ "type": "array"
372
+ },
373
+ "newFileTemplate": {
374
+ "description": "Initial source text for newly created files of this format.",
375
+ "type": "string"
376
+ }
377
+ },
378
+ "type": "object"
379
+ }
380
+ },
381
+ "$id": "https://jxsuite.com/schema/class/v1",
382
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
383
+ "additionalProperties": false,
384
+ "description": "Schema for Jx .class.json files. A class definition describes a schema-defined class with fields, constructor, methods, and type parameters. Optionally points to a JS module via $implementation for hybrid execution.",
385
+ "properties": {
386
+ "$defs": {
387
+ "description": "Class members: parameters, returnTypes, fields, constructor, methods.",
388
+ "properties": {
389
+ "constructor": {
390
+ "$ref": "#/$defs/ClassConstructorDef"
391
+ },
392
+ "fields": {
393
+ "additionalProperties": {
394
+ "$ref": "#/$defs/ClassFieldDef"
395
+ },
396
+ "description": "Class fields with role, access, scope, and type information.",
397
+ "type": "object"
398
+ },
399
+ "methods": {
400
+ "additionalProperties": {
401
+ "$ref": "#/$defs/ClassMethodDef"
402
+ },
403
+ "description": "Class methods and accessors.",
404
+ "type": "object"
405
+ },
406
+ "parameters": {
407
+ "additionalProperties": {
408
+ "$ref": "#/$defs/ClassParameterDef"
409
+ },
410
+ "description": "Reusable typed parameter schemas, keyed by name.",
411
+ "type": "object"
412
+ },
413
+ "returnTypes": {
414
+ "additionalProperties": {
415
+ "type": "object"
416
+ },
417
+ "description": "Output type schemas, keyed by name.",
418
+ "type": "object"
419
+ }
420
+ },
421
+ "type": "object"
422
+ },
423
+ "$id": {
424
+ "type": "string"
425
+ },
426
+ "$implementation": {
427
+ "description": "Relative path to a JS module containing the actual class implementation.",
428
+ "examples": [
429
+ "./md.js",
430
+ "./lib/calculator.js"
431
+ ],
432
+ "type": "string"
433
+ },
434
+ "$prototype": {
435
+ "const": "Class",
436
+ "description": "Must be \"Class\" for class definition files.",
437
+ "type": "string"
438
+ },
439
+ "$schema": {
440
+ "type": "string"
441
+ },
442
+ "$studio": {
443
+ "$ref": "#/$defs/StudioHints"
444
+ },
445
+ "description": {
446
+ "type": "string"
447
+ },
448
+ "extends": {
449
+ "description": "Base class — string name or $ref to another .class.json.",
450
+ "oneOf": [
451
+ {
452
+ "type": "string"
453
+ },
454
+ {
455
+ "additionalProperties": false,
456
+ "properties": {
457
+ "$ref": {
458
+ "type": "string"
481
459
  }
482
- }
460
+ },
461
+ "required": [
462
+ "$ref"
463
+ ],
464
+ "type": "object"
483
465
  }
484
- }
466
+ ]
467
+ },
468
+ "format": {
469
+ "$ref": "#/$defs/FormatDef"
470
+ },
471
+ "title": {
472
+ "description": "PascalCase class name, used as the export name.",
473
+ "examples": [
474
+ "MarkdownFile",
475
+ "DataSource",
476
+ "Calculator"
477
+ ],
478
+ "type": "string"
485
479
  }
486
- }
480
+ },
481
+ "required": [
482
+ "$prototype",
483
+ "title"
484
+ ],
485
+ "title": "Jx Class Definition",
486
+ "type": "object"
487
487
  }