@treasuryspatial/plugin-manifest 0.1.8 → 0.1.13

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.
@@ -1 +1 @@
1
- {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAGjD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,sBAAsB,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,gBAAgB,CAAC;IAC7D,0BAA0B,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,gBAAgB,CAAC;IACjE,gBAAgB,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,gBAAgB,CAAC;IACvD,oBAAoB,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,gBAAgB,CAAC;CAC5D,CAAC;AAiBF,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,eAAe,GAAG,iBAAiB,CAcnF;AAED,wBAAsB,8BAA8B,IAAI,OAAO,CAAC,iBAAiB,CAAC,CAGjF"}
1
+ {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAGjD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,sBAAsB,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,gBAAgB,CAAC;IAC7D,0BAA0B,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,gBAAgB,CAAC;IACjE,gBAAgB,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,gBAAgB,CAAC;IACvD,oBAAoB,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,gBAAgB,CAAC;CAC5D,CAAC;AA2BF,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,eAAe,GAAG,iBAAiB,CAcnF;AAED,wBAAsB,8BAA8B,IAAI,OAAO,CAAC,iBAAiB,CAAC,CAGjF"}
package/dist/validate.js CHANGED
@@ -1,9 +1,17 @@
1
- import Ajv from "ajv";
1
+ import Ajv2020 from "ajv/dist/2020.js";
2
2
  import { loadSchemas } from "./schemas";
3
3
  function formatErrors(errors) {
4
4
  if (!errors || errors.length === 0)
5
5
  return [];
6
- return errors.map((error) => `${error.instancePath || "<root>"} ${error.message ?? "is invalid"}`.trim());
6
+ return errors.map((error) => {
7
+ if (error.keyword === "additionalProperties" &&
8
+ error.params &&
9
+ typeof error.params === "object" &&
10
+ "additionalProperty" in error.params) {
11
+ return `${error.instancePath || "<root>"} must NOT have additional property '${String(error.params.additionalProperty)}'`;
12
+ }
13
+ return `${error.instancePath || "<root>"} ${error.message ?? "is invalid"}`.trim();
14
+ });
7
15
  }
8
16
  function buildValidator(ajv, schemaKey) {
9
17
  return (value) => {
@@ -15,7 +23,7 @@ function buildValidator(ajv, schemaKey) {
15
23
  };
16
24
  }
17
25
  export function createManifestValidator(schemas) {
18
- const ajv = new Ajv({ allErrors: true, strict: false });
26
+ const ajv = new Ajv2020({ allErrors: true, strict: false });
19
27
  ajv.addSchema(schemas.pluginManifest, "plugin-manifest");
20
28
  ajv.addSchema(schemas.definitionManifest, "definition-manifest");
21
29
  ajv.addSchema(schemas.uiSchema, "ui-schema");
package/package.json CHANGED
@@ -1,14 +1,18 @@
1
1
  {
2
2
  "name": "@treasuryspatial/plugin-manifest",
3
- "version": "0.1.8",
3
+ "version": "0.1.13",
4
4
  "type": "module",
5
- "license": "UNLICENSED",
5
+ "license": "MIT",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
8
8
  "exports": {
9
9
  ".": {
10
10
  "types": "./dist/index.d.ts",
11
11
  "default": "./dist/index.js"
12
+ },
13
+ "./server": {
14
+ "types": "./dist/server.d.ts",
15
+ "default": "./dist/server.js"
12
16
  }
13
17
  },
14
18
  "files": [
@@ -36,19 +36,14 @@
36
36
  },
37
37
  "ui": { "$ref": "#/$defs/uiSchema" },
38
38
  "defaults": {},
39
- "presets": {
39
+ "presentation": { "$ref": "#/$defs/toolPresentationDefinition" },
40
+ "execution": { "$ref": "#/$defs/toolExecutionDefinition" },
41
+ "metrics": { "$ref": "#/$defs/toolMetricsDefinition" },
42
+ "materials": { "$ref": "#/$defs/manifestMaterialCatalog" },
43
+ "baselines": { "$ref": "#/$defs/manifestBaselines" },
44
+ "compositions": {
40
45
  "type": "array",
41
- "items": {
42
- "type": "object",
43
- "additionalProperties": false,
44
- "required": ["id", "label"],
45
- "properties": {
46
- "id": { "$ref": "#/$defs/id" },
47
- "label": { "type": "string" },
48
- "patch": {},
49
- "params": {}
50
- }
51
- }
46
+ "items": { "$ref": "#/$defs/compositionDefinition" }
52
47
  },
53
48
  "capabilities": {
54
49
  "type": "object",
@@ -59,9 +54,17 @@
59
54
  "returnsRenderMeshes": { "type": "boolean" }
60
55
  }
61
56
  },
57
+ "mapInputs": {
58
+ "type": "array",
59
+ "items": { "$ref": "#/$defs/manifestMapInputDefinition" }
60
+ },
61
+ "surfaceContract": { "$ref": "#/$defs/surfaceContractDefinition" },
62
62
  "tagging": { "$ref": "#/$defs/tagging" },
63
63
  "extensions": {
64
64
  "type": "object",
65
+ "not": {
66
+ "required": ["render"]
67
+ },
65
68
  "additionalProperties": true
66
69
  }
67
70
  },
@@ -80,8 +83,468 @@
80
83
  { "type": "boolean" }
81
84
  ]
82
85
  },
83
- "uiSchema": {
84
- "type": "object"
86
+ "uiSchema": { "$ref": "https://base2.design/schema/ui.schema.json" },
87
+ "manifestRecordRef": {
88
+ "type": "object",
89
+ "additionalProperties": false,
90
+ "required": ["id"],
91
+ "properties": {
92
+ "id": { "$ref": "#/$defs/id" },
93
+ "version": { "$ref": "#/$defs/semver" }
94
+ }
95
+ },
96
+ "manifestMapInputPatch": {
97
+ "type": "object",
98
+ "additionalProperties": false,
99
+ "required": ["parameterPath", "source"],
100
+ "properties": {
101
+ "parameterPath": { "type": "string", "minLength": 1 },
102
+ "source": {
103
+ "type": "string",
104
+ "enum": ["points", "closed", "interpretation", "sourceKind", "geometryKind", "geojson", "label", "constant"]
105
+ },
106
+ "pointFormat": {
107
+ "type": "string",
108
+ "enum": ["xy", "xyz", "mm-object"]
109
+ },
110
+ "closeRing": { "type": "boolean" },
111
+ "constantValue": {}
112
+ }
113
+ },
114
+ "manifestMapInputDefinition": {
115
+ "type": "object",
116
+ "additionalProperties": false,
117
+ "required": ["slotId", "sourceKind", "geometryKind"],
118
+ "properties": {
119
+ "slotId": { "$ref": "#/$defs/id" },
120
+ "label": { "type": "string" },
121
+ "required": { "type": "boolean" },
122
+ "sourceKind": {
123
+ "type": "string",
124
+ "enum": ["building", "waterway", "road", "rail"]
125
+ },
126
+ "geometryKind": {
127
+ "type": "string",
128
+ "enum": ["polygon", "polyline"]
129
+ },
130
+ "closed": { "type": "boolean" },
131
+ "classes": {
132
+ "type": "array",
133
+ "items": { "type": "string", "minLength": 1 }
134
+ },
135
+ "interpretation": { "type": "string" },
136
+ "patches": {
137
+ "type": "array",
138
+ "items": { "$ref": "#/$defs/manifestMapInputPatch" }
139
+ }
140
+ }
141
+ },
142
+ "toolUnitId": {
143
+ "type": "string",
144
+ "enum": ["unknown", "mm", "cm", "m", "ft", "in"]
145
+ },
146
+ "toolUnitsDefinition": {
147
+ "type": "object",
148
+ "additionalProperties": false,
149
+ "properties": {
150
+ "output": { "$ref": "#/$defs/toolUnitId" },
151
+ "display": { "$ref": "#/$defs/toolUnitId" },
152
+ "canonicalScene": {
153
+ "type": "string",
154
+ "enum": ["m"]
155
+ }
156
+ }
157
+ },
158
+ "toolPresentationDefinition": {
159
+ "type": "object",
160
+ "additionalProperties": false,
161
+ "required": ["kind"],
162
+ "properties": {
163
+ "kind": {
164
+ "type": "string",
165
+ "enum": ["object3d", "plan2d"]
166
+ },
167
+ "defaultViewMode": {
168
+ "type": "string",
169
+ "enum": ["auto", "2d", "3d"]
170
+ },
171
+ "camera": {
172
+ "type": "object",
173
+ "additionalProperties": false,
174
+ "properties": {
175
+ "kind": {
176
+ "type": "string",
177
+ "enum": ["perspective", "orthographic"]
178
+ },
179
+ "framingMode": {
180
+ "type": "string",
181
+ "enum": ["inherit", "iso", "interior"]
182
+ },
183
+ "lock": { "type": "boolean" }
184
+ }
185
+ },
186
+ "normalization": {
187
+ "type": "object",
188
+ "additionalProperties": false,
189
+ "properties": {
190
+ "recenter": { "type": "boolean" },
191
+ "floorToZero": { "type": "boolean" },
192
+ "allowAutoScale": { "type": "boolean" },
193
+ "normalizePlan": {
194
+ "type": "object",
195
+ "additionalProperties": false,
196
+ "properties": {
197
+ "target": { "type": "number" },
198
+ "maxScale": { "type": "number" }
199
+ }
200
+ }
201
+ }
202
+ },
203
+ "ground": {
204
+ "type": "object",
205
+ "additionalProperties": false,
206
+ "properties": {
207
+ "mode": {
208
+ "type": "string",
209
+ "enum": ["auto", "always", "never"]
210
+ },
211
+ "snapToBounds": { "type": "boolean" }
212
+ }
213
+ },
214
+ "grid": {
215
+ "type": "object",
216
+ "additionalProperties": false,
217
+ "properties": {
218
+ "mode": {
219
+ "type": "string",
220
+ "enum": ["auto", "always", "never"]
221
+ }
222
+ }
223
+ },
224
+ "curves": {
225
+ "type": "object",
226
+ "additionalProperties": false,
227
+ "properties": {
228
+ "mode": {
229
+ "type": "string",
230
+ "enum": ["auto", "always", "never"]
231
+ }
232
+ }
233
+ },
234
+ "clipping": {
235
+ "type": "object",
236
+ "additionalProperties": false,
237
+ "properties": {
238
+ "nearSafety": { "type": "number" },
239
+ "farSafety": { "type": "number" },
240
+ "minimumFar": { "type": "number" }
241
+ }
242
+ },
243
+ "units": {
244
+ "$ref": "#/$defs/toolUnitsDefinition"
245
+ }
246
+ }
247
+ },
248
+ "toolMetricSourceDefinition": {
249
+ "type": "object",
250
+ "additionalProperties": false,
251
+ "required": ["kind", "path"],
252
+ "properties": {
253
+ "kind": {
254
+ "type": "string",
255
+ "enum": ["runtime", "viewer", "geometry", "render", "map"]
256
+ },
257
+ "path": { "type": "string", "minLength": 1 }
258
+ }
259
+ },
260
+ "toolExecutionDefinition": {
261
+ "type": "object",
262
+ "additionalProperties": false,
263
+ "properties": {
264
+ "timeoutMs": {
265
+ "type": "number",
266
+ "exclusiveMinimum": 0
267
+ }
268
+ }
269
+ },
270
+ "toolMetricDefinition": {
271
+ "type": "object",
272
+ "additionalProperties": false,
273
+ "required": ["id", "label", "source"],
274
+ "properties": {
275
+ "id": { "$ref": "#/$defs/id" },
276
+ "label": { "type": "string" },
277
+ "summary": { "type": "string" },
278
+ "source": { "$ref": "#/$defs/toolMetricSourceDefinition" },
279
+ "format": {
280
+ "type": "string",
281
+ "enum": ["text", "number", "count"]
282
+ },
283
+ "digits": { "type": "integer", "minimum": 0, "maximum": 6 },
284
+ "prefix": { "type": "string" },
285
+ "suffix": { "type": "string" },
286
+ "emptyLabel": { "type": "string" }
287
+ }
288
+ },
289
+ "toolMetricGroupDefinition": {
290
+ "type": "object",
291
+ "additionalProperties": false,
292
+ "required": ["id", "label", "metrics"],
293
+ "properties": {
294
+ "id": { "$ref": "#/$defs/id" },
295
+ "label": { "type": "string" },
296
+ "summary": { "type": "string" },
297
+ "metrics": {
298
+ "type": "array",
299
+ "items": { "$ref": "#/$defs/toolMetricDefinition" }
300
+ }
301
+ }
302
+ },
303
+ "toolMetricsDefinition": {
304
+ "type": "object",
305
+ "additionalProperties": false,
306
+ "required": ["groups"],
307
+ "properties": {
308
+ "title": { "type": "string" },
309
+ "summary": { "type": "string" },
310
+ "groups": {
311
+ "type": "array",
312
+ "items": { "$ref": "#/$defs/toolMetricGroupDefinition" }
313
+ }
314
+ }
315
+ },
316
+ "manifestBaselineDefaults": {
317
+ "type": "object",
318
+ "additionalProperties": false,
319
+ "properties": {
320
+ "lightingId": { "$ref": "#/$defs/id" },
321
+ "materialsId": { "$ref": "#/$defs/id" },
322
+ "hdrId": { "$ref": "#/$defs/id" }
323
+ }
324
+ },
325
+ "manifestBaselineAvailability": {
326
+ "type": "object",
327
+ "additionalProperties": false,
328
+ "properties": {
329
+ "lightingIds": {
330
+ "type": "array",
331
+ "items": { "$ref": "#/$defs/id" }
332
+ },
333
+ "materialsIds": {
334
+ "type": "array",
335
+ "items": { "$ref": "#/$defs/id" }
336
+ },
337
+ "hdrIds": {
338
+ "type": "array",
339
+ "items": { "$ref": "#/$defs/id" }
340
+ }
341
+ }
342
+ },
343
+ "lightingBaselineDefinition": {
344
+ "type": "object",
345
+ "additionalProperties": false,
346
+ "required": ["id", "label"],
347
+ "properties": {
348
+ "id": { "$ref": "#/$defs/id" },
349
+ "label": { "type": "string" },
350
+ "summary": { "type": "string" },
351
+ "renderer": { "type": "object" },
352
+ "lighting": { "type": "object" },
353
+ "postfx": { "type": "object" },
354
+ "sceneExtras": { "type": "object" }
355
+ }
356
+ },
357
+ "manifestMaterialBaselineDefinition": {
358
+ "type": "object",
359
+ "additionalProperties": false,
360
+ "properties": {
361
+ "color": { "type": "string", "minLength": 1 },
362
+ "finish": { "type": "string", "minLength": 1 }
363
+ }
364
+ },
365
+ "manifestMaterialPbrDefinition": {
366
+ "type": "object",
367
+ "additionalProperties": false,
368
+ "properties": {
369
+ "baseColor": { "type": "string", "minLength": 1 },
370
+ "roughness": { "type": "number" },
371
+ "metalness": { "type": "number" },
372
+ "emissive": { "type": "string", "minLength": 1 },
373
+ "emissiveIntensity": { "type": "number" },
374
+ "texture": {
375
+ "type": "object",
376
+ "additionalProperties": false,
377
+ "required": ["type"],
378
+ "properties": {
379
+ "type": { "type": "string", "minLength": 1 },
380
+ "scale": { "type": "number" }
381
+ }
382
+ },
383
+ "transparent": { "type": "boolean" },
384
+ "opacity": { "type": "number" },
385
+ "ior": { "type": "number" }
386
+ }
387
+ },
388
+ "manifestMaterialDefinition": {
389
+ "type": "object",
390
+ "additionalProperties": false,
391
+ "required": ["materialId", "label"],
392
+ "properties": {
393
+ "materialId": { "$ref": "#/$defs/id" },
394
+ "label": { "type": "string", "minLength": 1 },
395
+ "category": { "$ref": "#/$defs/id" },
396
+ "baseCatalogId": { "$ref": "#/$defs/id" },
397
+ "baseline": { "$ref": "#/$defs/manifestMaterialBaselineDefinition" },
398
+ "pbr": { "$ref": "#/$defs/manifestMaterialPbrDefinition" }
399
+ }
400
+ },
401
+ "manifestMaterialCatalog": {
402
+ "type": "object",
403
+ "additionalProperties": false,
404
+ "properties": {
405
+ "catalog": {
406
+ "type": "array",
407
+ "items": { "$ref": "#/$defs/manifestMaterialDefinition" }
408
+ }
409
+ }
410
+ },
411
+ "materialBaselineSlotReference": {
412
+ "type": "object",
413
+ "additionalProperties": false,
414
+ "required": ["catalogId"],
415
+ "properties": {
416
+ "catalogId": { "$ref": "#/$defs/id" },
417
+ "overrides": { "type": "object" }
418
+ }
419
+ },
420
+ "materialsBaselineDefinition": {
421
+ "type": "object",
422
+ "additionalProperties": false,
423
+ "required": ["id", "label"],
424
+ "properties": {
425
+ "id": { "$ref": "#/$defs/id" },
426
+ "label": { "type": "string" },
427
+ "summary": { "type": "string" },
428
+ "presetId": { "$ref": "#/$defs/id" },
429
+ "materials": {
430
+ "type": "object",
431
+ "additionalProperties": false,
432
+ "properties": {
433
+ "walls": { "$ref": "#/$defs/materialBaselineSlotReference" },
434
+ "floor": { "$ref": "#/$defs/materialBaselineSlotReference" },
435
+ "ceiling": { "$ref": "#/$defs/materialBaselineSlotReference" },
436
+ "surfaces": {
437
+ "type": "object",
438
+ "propertyNames": { "$ref": "#/$defs/id" },
439
+ "additionalProperties": { "$ref": "#/$defs/materialBaselineSlotReference" }
440
+ }
441
+ }
442
+ }
443
+ },
444
+ "anyOf": [
445
+ { "required": ["presetId"] },
446
+ { "required": ["materials"] }
447
+ ]
448
+ },
449
+ "hdrBaselineDefinition": {
450
+ "type": "object",
451
+ "additionalProperties": false,
452
+ "required": ["id", "label", "sky"],
453
+ "properties": {
454
+ "id": { "$ref": "#/$defs/id" },
455
+ "label": { "type": "string" },
456
+ "summary": { "type": "string" },
457
+ "sky": { "type": "object" }
458
+ }
459
+ },
460
+ "manifestBaselines": {
461
+ "type": "object",
462
+ "additionalProperties": false,
463
+ "properties": {
464
+ "defaults": { "$ref": "#/$defs/manifestBaselineDefaults" },
465
+ "available": { "$ref": "#/$defs/manifestBaselineAvailability" },
466
+ "lighting": {
467
+ "type": "array",
468
+ "items": { "$ref": "#/$defs/lightingBaselineDefinition" }
469
+ },
470
+ "materials": {
471
+ "type": "array",
472
+ "items": { "$ref": "#/$defs/materialsBaselineDefinition" }
473
+ },
474
+ "hdr": {
475
+ "type": "array",
476
+ "items": { "$ref": "#/$defs/hdrBaselineDefinition" }
477
+ }
478
+ }
479
+ },
480
+ "compositionDefinition": {
481
+ "type": "object",
482
+ "additionalProperties": false,
483
+ "required": ["id", "label"],
484
+ "properties": {
485
+ "id": { "$ref": "#/$defs/id" },
486
+ "label": { "type": "string" },
487
+ "summary": { "type": "string" },
488
+ "patch": {},
489
+ "params": {},
490
+ "lightingBaselineId": { "$ref": "#/$defs/id" },
491
+ "materialsBaselineId": { "$ref": "#/$defs/id" },
492
+ "hdrBaselineId": { "$ref": "#/$defs/id" }
493
+ }
494
+ },
495
+ "surfaceTypeDefinition": {
496
+ "type": "object",
497
+ "additionalProperties": false,
498
+ "required": ["id", "label"],
499
+ "properties": {
500
+ "id": { "$ref": "#/$defs/id" },
501
+ "label": { "type": "string" },
502
+ "summary": { "type": "string" },
503
+ "parentId": { "$ref": "#/$defs/id" }
504
+ }
505
+ },
506
+ "surfaceContractDefinition": {
507
+ "type": "object",
508
+ "additionalProperties": false,
509
+ "required": ["surfaces"],
510
+ "properties": {
511
+ "surfaces": {
512
+ "type": "array",
513
+ "items": { "$ref": "#/$defs/surfaceTypeDefinition" }
514
+ }
515
+ }
516
+ },
517
+ "surfaceMappingDefinition": {
518
+ "type": "object",
519
+ "additionalProperties": false,
520
+ "required": ["surfaceId"],
521
+ "properties": {
522
+ "surfaceId": { "$ref": "#/$defs/id" },
523
+ "surfaceIds": {
524
+ "type": "array",
525
+ "items": { "$ref": "#/$defs/id" }
526
+ },
527
+ "classes": {
528
+ "type": "array",
529
+ "items": { "type": "string", "minLength": 1 }
530
+ },
531
+ "subclasses": {
532
+ "type": "array",
533
+ "items": { "type": "string", "minLength": 1 }
534
+ },
535
+ "roles": {
536
+ "type": "array",
537
+ "items": { "type": "string", "minLength": 1 }
538
+ },
539
+ "layers": {
540
+ "type": "array",
541
+ "items": { "type": "string", "minLength": 1 }
542
+ },
543
+ "materials": {
544
+ "type": "array",
545
+ "items": { "type": "string", "minLength": 1 }
546
+ }
547
+ }
85
548
  },
86
549
  "tagging": {
87
550
  "type": "object",
@@ -97,7 +560,10 @@
97
560
  "idKey": { "type": "string", "minLength": 1 },
98
561
  "packetKey": { "type": "string", "minLength": 1 },
99
562
  "layerKey": { "type": "string", "minLength": 1 },
100
- "materialKey": { "type": "string", "minLength": 1 }
563
+ "colorKey": { "type": "string", "minLength": 1 },
564
+ "classKey": { "type": "string", "minLength": 1 },
565
+ "subclassKey": { "type": "string", "minLength": 1 },
566
+ "surfaceClassKey": { "type": "string", "minLength": 1 }
101
567
  }
102
568
  }
103
569
  }