@imferno/schema 0.1.2

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/README.md ADDED
@@ -0,0 +1,52 @@
1
+ # @imferno/schema
2
+
3
+ JSON Schema definitions for SMPTE ST 2067 (IMF) types. Use these schemas to validate the JSON output from [`imferno`](https://www.npmjs.com/package/imferno) or [`@imferno/wasm`](https://www.npmjs.com/package/@imferno/wasm).
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install @imferno/schema
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```js
14
+ import Ajv from "ajv";
15
+ import { imfReport } from "@imferno/schema";
16
+
17
+ const ajv = new Ajv();
18
+ const validate = ajv.compile(imfReport);
19
+
20
+ const data = JSON.parse(imfernoOutput);
21
+ if (validate(data)) {
22
+ console.log("Valid IMF report");
23
+ } else {
24
+ console.error(validate.errors);
25
+ }
26
+ ```
27
+
28
+ ## Available Schemas
29
+
30
+ | Export | Description |
31
+ |--------|-------------|
32
+ | `imfReport` | Full IMF package report (source assets + validation + delivery comparison) |
33
+ | `validationReport` | Validation issues and diagnostics |
34
+ | `compositionPlaylist` | SMPTE ST 2067-3 Composition Playlist |
35
+ | `assetMap` | SMPTE ST 2067-2 Asset Map |
36
+ | `packingList` | SMPTE ST 2067-2 Packing List |
37
+ | `volumeIndex` | SMPTE ST 429-9 Volume Index |
38
+ | `sourceAsset` | Extracted source asset metadata (tracks, formats, durations) |
39
+ | `deliveryRequest` | Delivery specification request |
40
+ | `deliveryComparison` | Delivery comparison result |
41
+ | `rulesConfig` | ESLint-style rules configuration for validation |
42
+
43
+ All schemas are also available via the `schemas` named export:
44
+
45
+ ```js
46
+ import { schemas } from "@imferno/schema";
47
+ // schemas.imfReport, schemas.assetMap, etc.
48
+ ```
49
+
50
+ ## License
51
+
52
+ MIT
package/index.d.ts ADDED
@@ -0,0 +1,26 @@
1
+ /** A JSON Schema object (Draft 7). */
2
+ type JsonSchema = Record<string, unknown>;
3
+
4
+ export declare const imfReport: JsonSchema;
5
+ export declare const validationReport: JsonSchema;
6
+ export declare const compositionPlaylist: JsonSchema;
7
+ export declare const assetMap: JsonSchema;
8
+ export declare const packingList: JsonSchema;
9
+ export declare const volumeIndex: JsonSchema;
10
+ export declare const sourceAsset: JsonSchema;
11
+ export declare const deliveryRequest: JsonSchema;
12
+ export declare const deliveryComparison: JsonSchema;
13
+ export declare const rulesConfig: JsonSchema;
14
+
15
+ export declare const schemas: {
16
+ imfReport: JsonSchema;
17
+ validationReport: JsonSchema;
18
+ compositionPlaylist: JsonSchema;
19
+ assetMap: JsonSchema;
20
+ packingList: JsonSchema;
21
+ volumeIndex: JsonSchema;
22
+ sourceAsset: JsonSchema;
23
+ deliveryRequest: JsonSchema;
24
+ deliveryComparison: JsonSchema;
25
+ rulesConfig: JsonSchema;
26
+ };
package/index.js ADDED
@@ -0,0 +1,34 @@
1
+ import { readFileSync } from "node:fs";
2
+ import { fileURLToPath } from "node:url";
3
+ import { dirname, join } from "node:path";
4
+
5
+ const __dirname = dirname(fileURLToPath(import.meta.url));
6
+ const schemasDir = join(__dirname, "schemas");
7
+
8
+ function loadSchema(name) {
9
+ return JSON.parse(readFileSync(join(schemasDir, `${name}.json`), "utf-8"));
10
+ }
11
+
12
+ export const imfReport = loadSchema("imf-report");
13
+ export const validationReport = loadSchema("validation-report");
14
+ export const compositionPlaylist = loadSchema("composition-playlist");
15
+ export const assetMap = loadSchema("asset-map");
16
+ export const packingList = loadSchema("packing-list");
17
+ export const volumeIndex = loadSchema("volume-index");
18
+ export const sourceAsset = loadSchema("source-asset");
19
+ export const deliveryRequest = loadSchema("delivery-request");
20
+ export const deliveryComparison = loadSchema("delivery-comparison");
21
+ export const rulesConfig = loadSchema("rules-config");
22
+
23
+ export const schemas = {
24
+ imfReport,
25
+ validationReport,
26
+ compositionPlaylist,
27
+ assetMap,
28
+ packingList,
29
+ volumeIndex,
30
+ sourceAsset,
31
+ deliveryRequest,
32
+ deliveryComparison,
33
+ rulesConfig,
34
+ };
package/package.json ADDED
@@ -0,0 +1,40 @@
1
+ {
2
+ "name": "@imferno/schema",
3
+ "version": "0.1.2",
4
+ "description": "JSON Schema definitions for SMPTE ST 2067 IMF types — validates imferno export output",
5
+ "main": "index.js",
6
+ "types": "index.d.ts",
7
+ "type": "module",
8
+ "files": [
9
+ "schemas/",
10
+ "index.js",
11
+ "index.d.ts"
12
+ ],
13
+ "keywords": [
14
+ "imf",
15
+ "imferno",
16
+ "smpte",
17
+ "st2067",
18
+ "json-schema",
19
+ "validation",
20
+ "typescript",
21
+ "schema"
22
+ ],
23
+ "author": {
24
+ "name": "JP Wesselink",
25
+ "email": "jp@wesselink.dev"
26
+ },
27
+ "license": "MIT",
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "https://github.com/jpwesselink/imferno.git",
31
+ "directory": "crates/imferno-core/npm/schema"
32
+ },
33
+ "bugs": {
34
+ "url": "https://github.com/jpwesselink/imferno/issues"
35
+ },
36
+ "homepage": "https://github.com/jpwesselink/imferno",
37
+ "publishConfig": {
38
+ "access": "public"
39
+ }
40
+ }
@@ -0,0 +1,136 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "title": "AssetMap",
4
+ "description": "ASSETMAP.xml — maps UUIDs to physical file paths (ST 429-9 §6).",
5
+ "type": "object",
6
+ "required": [
7
+ "asset_list",
8
+ "id",
9
+ "issue_date",
10
+ "volume_count"
11
+ ],
12
+ "properties": {
13
+ "annotation_text": {
14
+ "type": [
15
+ "string",
16
+ "null"
17
+ ]
18
+ },
19
+ "asset_list": {
20
+ "$ref": "#/definitions/AssetList"
21
+ },
22
+ "creator": {
23
+ "type": [
24
+ "string",
25
+ "null"
26
+ ]
27
+ },
28
+ "id": {
29
+ "description": "Unique identifier for this AssetMap (ST 429-9 §6.2).",
30
+ "allOf": [
31
+ {
32
+ "$ref": "#/definitions/ImfUuid"
33
+ }
34
+ ]
35
+ },
36
+ "issue_date": {
37
+ "description": "ISO 8601 issue date (e.g. `\"2016-10-06T08:35:02-00:00\"`).",
38
+ "type": "string"
39
+ },
40
+ "issuer": {
41
+ "type": [
42
+ "string",
43
+ "null"
44
+ ]
45
+ },
46
+ "volume_count": {
47
+ "type": "integer",
48
+ "format": "uint32",
49
+ "minimum": 0.0
50
+ }
51
+ },
52
+ "definitions": {
53
+ "Asset": {
54
+ "description": "A single asset entry in ASSETMAP.xml.",
55
+ "type": "object",
56
+ "required": [
57
+ "chunk_list",
58
+ "id"
59
+ ],
60
+ "properties": {
61
+ "chunk_list": {
62
+ "$ref": "#/definitions/ChunkList"
63
+ },
64
+ "id": {
65
+ "description": "UUID identifying this asset.",
66
+ "allOf": [
67
+ {
68
+ "$ref": "#/definitions/ImfUuid"
69
+ }
70
+ ]
71
+ },
72
+ "packing_list": {
73
+ "description": "Present and `true` when this entry refers to the Packing List file.",
74
+ "type": [
75
+ "boolean",
76
+ "null"
77
+ ]
78
+ }
79
+ }
80
+ },
81
+ "AssetList": {
82
+ "description": "The `<AssetList>` element in ASSETMAP.xml.",
83
+ "type": "object",
84
+ "required": [
85
+ "assets"
86
+ ],
87
+ "properties": {
88
+ "assets": {
89
+ "type": "array",
90
+ "items": {
91
+ "$ref": "#/definitions/Asset"
92
+ }
93
+ }
94
+ }
95
+ },
96
+ "Chunk": {
97
+ "description": "A single file path entry in a ChunkList.",
98
+ "type": "object",
99
+ "required": [
100
+ "path",
101
+ "volume_index"
102
+ ],
103
+ "properties": {
104
+ "path": {
105
+ "description": "File path relative to the IMP root directory.",
106
+ "type": "string"
107
+ },
108
+ "volume_index": {
109
+ "type": "integer",
110
+ "format": "uint32",
111
+ "minimum": 0.0
112
+ }
113
+ }
114
+ },
115
+ "ChunkList": {
116
+ "description": "A list of file chunks for a single asset.",
117
+ "type": "object",
118
+ "required": [
119
+ "chunks"
120
+ ],
121
+ "properties": {
122
+ "chunks": {
123
+ "type": "array",
124
+ "items": {
125
+ "$ref": "#/definitions/Chunk"
126
+ }
127
+ }
128
+ }
129
+ },
130
+ "ImfUuid": {
131
+ "description": "A SMPTE IMF UUID, serialised as a bare UUID string (e.g. \"0eb3d1b9-b77b-4d3f-bbe5-7c69b15dca85\")",
132
+ "type": "string",
133
+ "format": "uuid"
134
+ }
135
+ }
136
+ }