@tracepass/dpp-schemas 1.32.0 → 1.33.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 (2) hide show
  1. package/README.md +13 -0
  2. package/package.json +10 -3
package/README.md CHANGED
@@ -355,6 +355,17 @@ matching types.
355
355
  npm install @tracepass/dpp-schemas
356
356
  ```
357
357
 
358
+ Every JSON file the package ships can be imported by its path: the manifest as the
359
+ package root, then `schema.json`, `templates/<category>.json`, `instruments.json`,
360
+ `standards.json`, `units.json`, `model-subset.json`, `model-versions.json` and
361
+ `guidance/<file>.json`.
362
+
363
+ ```js
364
+ import manifest from "@tracepass/dpp-schemas" with { type: "json" };
365
+ import battery from "@tracepass/dpp-schemas/templates/battery.json" with { type: "json" };
366
+ import units from "@tracepass/dpp-schemas/units.json" with { type: "json" };
367
+ ```
368
+
358
369
  ## Validating the specs themselves
359
370
 
360
371
  [`schema.json`](./schema.json) is a JSON Schema (Draft 2020-12) describing the template
@@ -392,6 +403,8 @@ runs it on every push:
392
403
  an instrument it is adopted under, and its planned date matches its source's precision.
393
404
  - **Data-model versions** (`scripts/check-model-versions.mjs`): every template's
394
405
  `modelVersion` matches its hash in `model-versions.json`. See below.
406
+ - **Exports** (`scripts/check-exports.mjs`): every JSON file the package ships resolves
407
+ through Node's own resolver, so nothing ships that a consumer cannot import.
395
408
 
396
409
  ## Data-model versions
397
410
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tracepass/dpp-schemas",
3
- "version": "1.32.0",
3
+ "version": "1.33.0",
4
4
  "description": "Machine-readable field specifications for EU Digital Product Passports (ESPR) — 13 product categories, 1016 fields, each traced to the article of EU law that mandates it. Pure JSON, no dependencies.",
5
5
  "keywords": [
6
6
  "digital-product-passport",
@@ -26,7 +26,12 @@
26
26
  ".": "./index.json",
27
27
  "./schema.json": "./schema.json",
28
28
  "./templates/*.json": "./templates/*.json",
29
- "./instruments.json": "./instruments.json"
29
+ "./instruments.json": "./instruments.json",
30
+ "./standards.json": "./standards.json",
31
+ "./units.json": "./units.json",
32
+ "./model-subset.json": "./model-subset.json",
33
+ "./model-versions.json": "./model-versions.json",
34
+ "./guidance/*.json": "./guidance/*.json"
30
35
  },
31
36
  "files": [
32
37
  "templates",
@@ -50,7 +55,7 @@
50
55
  "validate": "python3 -c \"import json,glob,sys;from jsonschema import Draft202012Validator as V;v=V(json.load(open('schema.json')));bad=0\nfor p in sorted(glob.glob('templates/*.json')):\n e=list(v.iter_errors(json.load(open(p))));bad+=bool(e);print(('FAIL' if e else 'ok '),p)\n [print(' ',str(x.absolute_path),x.message[:120]) for x in e[:3]]\nsys.exit(1 if bad else 0)\"",
51
56
  "build:index": "node scripts/build-index.mjs",
52
57
  "check:index": "node scripts/build-index.mjs --check",
53
- "check": "npm run validate && npm run check:index && npm run check:standards && npm run check:locales && npm run check:audit && npm run test:audit && npm run check:planned && npm run test:planned && npm run check:model && npm run test:model",
58
+ "check": "npm run validate && npm run check:index && npm run check:standards && npm run check:locales && npm run check:audit && npm run test:audit && npm run check:planned && npm run test:planned && npm run check:model && npm run test:model && npm run check:exports && npm run test:exports",
54
59
  "check:standards": "node scripts/check-standards.mjs",
55
60
  "check:locales": "node scripts/check-locales.mjs",
56
61
  "check:audit": "node audit/audit.mjs",
@@ -58,6 +63,8 @@
58
63
  "check:planned": "node scripts/check-planned-acts.mjs",
59
64
  "test:planned": "node --test scripts/check-planned-acts.test.mjs",
60
65
  "check:model": "node scripts/check-model-versions.mjs",
66
+ "check:exports": "node scripts/check-exports.mjs",
67
+ "test:exports": "node --test scripts/check-exports.test.mjs",
61
68
  "test:model": "node --test scripts/model-hash.test.mjs",
62
69
  "bump:model": "node scripts/bump-model.mjs"
63
70
  }