@imferno/node 3.0.2-beta.cf01939 → 3.0.2-beta.d52fdb0
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 +56 -23
- package/codes.d.ts +243 -331
- package/codes.js +243 -331
- package/index.d.ts +119 -54
- package/index.mjs +1 -0
- package/package.json +27 -8
- package/types.d.ts +1503 -0
package/README.md
CHANGED
|
@@ -22,15 +22,17 @@ Prebuilt binaries are provided for:
|
|
|
22
22
|
|
|
23
23
|
### Validate a package on disk
|
|
24
24
|
|
|
25
|
-
```
|
|
26
|
-
import {
|
|
25
|
+
```ts
|
|
26
|
+
import { validatePath } from "@imferno/node";
|
|
27
27
|
|
|
28
|
-
const
|
|
28
|
+
const { package: pkg, validation } = validatePath("./my-imp");
|
|
29
29
|
|
|
30
|
-
console.log("Compliant:",
|
|
31
|
-
console.log("Errors:",
|
|
32
|
-
|
|
33
|
-
console.log(
|
|
30
|
+
console.log("Compliant:", validation.is_compliant);
|
|
31
|
+
console.log("Errors:", validation.errors.length);
|
|
32
|
+
for (const issue of validation.errors) {
|
|
33
|
+
console.log(issue.severity, issue.code, issue.message, issue.location.file);
|
|
34
|
+
}
|
|
35
|
+
console.log("CPLs:", Object.keys(pkg.compositionPlaylists).length);
|
|
34
36
|
```
|
|
35
37
|
|
|
36
38
|
### Validate from a URI (filesystem or S3)
|
|
@@ -54,26 +56,27 @@ const report = buildReportFromUri("s3://my-bucket/path/to/imp/", {
|
|
|
54
56
|
|
|
55
57
|
### Validate with options
|
|
56
58
|
|
|
57
|
-
```
|
|
58
|
-
import {
|
|
59
|
+
```ts
|
|
60
|
+
import { validatePath, type PathValidateOptions } from "@imferno/node";
|
|
59
61
|
|
|
60
|
-
const
|
|
62
|
+
const options: PathValidateOptions = {
|
|
61
63
|
coreSpec: "v2020",
|
|
62
64
|
app2eSpec: "v2023",
|
|
63
65
|
skipDiskChecks: true,
|
|
64
66
|
rules: {
|
|
65
|
-
"ST2067-21:2023
|
|
67
|
+
"ST2067-21:2023/AppIdMismatch": "error",
|
|
66
68
|
"IMFERNO:Package/UnreferencedAsset": "off",
|
|
67
69
|
},
|
|
68
|
-
}
|
|
70
|
+
};
|
|
71
|
+
const result = validatePath("./my-imp", options);
|
|
69
72
|
```
|
|
70
73
|
|
|
71
74
|
### Validate from in-memory strings
|
|
72
75
|
|
|
73
76
|
```js
|
|
74
|
-
import {
|
|
77
|
+
import { validate } from "@imferno/node";
|
|
75
78
|
|
|
76
|
-
const
|
|
79
|
+
const result = validate({
|
|
77
80
|
"ASSETMAP.xml": assetmapXml,
|
|
78
81
|
"PKL_abc.xml": pklXml,
|
|
79
82
|
"CPL_def.xml": cplXml,
|
|
@@ -83,10 +86,10 @@ const report = buildReport({
|
|
|
83
86
|
### Pretty-print a report
|
|
84
87
|
|
|
85
88
|
```js
|
|
86
|
-
import {
|
|
89
|
+
import { validatePath, formatReport } from "@imferno/node";
|
|
87
90
|
|
|
88
|
-
const
|
|
89
|
-
console.log(formatReport(
|
|
91
|
+
const result = validatePath("./my-imp");
|
|
92
|
+
console.log(formatReport(result)); // same text as `imferno validate`
|
|
90
93
|
```
|
|
91
94
|
|
|
92
95
|
### Get the library version
|
|
@@ -109,18 +112,47 @@ console.log(getVersion()); // e.g. "2.0.0"
|
|
|
109
112
|
| `buildReport(files, options?)` | Legacy: validate from strings (returns `ImfReport`) |
|
|
110
113
|
| `buildReportFromPath(path, options?)` | Legacy: validate from disk (returns `ImfReport`) |
|
|
111
114
|
| `buildReportFromUri(uri, options?)` | Legacy: validate via URI (returns `ImfReport`) |
|
|
112
|
-
| `formatReport(
|
|
113
|
-
| `listRules()` | Get the
|
|
115
|
+
| `formatReport(result)` | Pretty-print a `ValidationResult` (or legacy `ImfReport`) as text |
|
|
116
|
+
| `listRules()` | Get the rule catalogue (one entry per rule, with its per-edition table) |
|
|
117
|
+
| `toSarif(result)` | Convert a validation result to a SARIF 2.1.0 log |
|
|
114
118
|
| `getVersion()` | Get the library version |
|
|
115
119
|
|
|
116
120
|
### Options
|
|
117
121
|
|
|
118
122
|
| Option | Type | Description |
|
|
119
123
|
|--------|------|-------------|
|
|
120
|
-
| `coreSpec` | `"auto" \| "v2013" \| "v2016" \| "v2020"` | Core constraints
|
|
121
|
-
| `
|
|
122
|
-
| `
|
|
123
|
-
| `
|
|
124
|
+
| `coreSpec` | `"auto" \| "v2013" \| "v2016" \| "v2020"` | Core constraints (ST 2067-2) edition; a pin also pins the editions it cites (ST 2067-3, ST 2067-201, ST 377-1/-4) |
|
|
125
|
+
| `cplSpec` | `"auto" \| "v2013" \| "v2016" \| "v2020"` | Composition Playlist (ST 2067-3) edition; wins over the one `coreSpec` implies |
|
|
126
|
+
| `iabSpec` | `"auto" \| "v2019" \| "v2021" \| "v2026"` | IAB plug-in (ST 2067-201) edition; wins over the one `coreSpec` implies |
|
|
127
|
+
| `app2eSpec` | `"auto" \| "none" \| "v2014" \| "v2016" \| "v2020" \| "v2023" \| "v2026"` | Application spec version |
|
|
128
|
+
| `rules` | `Record<string, "off" \| "info" \| "warn" \| "error" \| "critical">` | ESLint-style per-rule severity overrides |
|
|
129
|
+
| `aggregateRepeats` | `boolean` | Collapse repeated identical findings into one issue with `additional_instances` |
|
|
130
|
+
| `skipDiskChecks` | `boolean` | Skip file manifest and MXF checks (path / URI functions only; in-memory input never touches disk) |
|
|
131
|
+
| `credentials` | `S3Credentials \| null` | Explicit S3 credentials (URI functions only) |
|
|
132
|
+
|
|
133
|
+
### TypeScript
|
|
134
|
+
|
|
135
|
+
The package ships precise declarations, generated from the Rust types (no
|
|
136
|
+
`any`). Every function is synchronous. All value types are exported from the
|
|
137
|
+
main entry:
|
|
138
|
+
|
|
139
|
+
```ts
|
|
140
|
+
import type {
|
|
141
|
+
ValidationResult, // validate*, { package, validation }
|
|
142
|
+
Imferno, // parsePackage*, the full parsed package
|
|
143
|
+
ImfReport, // buildReport* (legacy)
|
|
144
|
+
ValidationIssue, // severity, category, code, message, location, ...
|
|
145
|
+
ValidateOptions, // coreSpec, app2eSpec, rules, aggregateRepeats
|
|
146
|
+
PathValidateOptions,
|
|
147
|
+
UriValidateOptions,
|
|
148
|
+
RuleInfo, // listRules() entries
|
|
149
|
+
} from "@imferno/node";
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Field casing follows the serialised output: the validation report uses
|
|
153
|
+
snake_case (`is_compliant`, `cpl_id`), the parsed package uses camelCase at the
|
|
154
|
+
top level (`compositionPlaylists`) and the SMPTE element names inside CPLs
|
|
155
|
+
(`ContentTitle`, `SegmentList`).
|
|
124
156
|
|
|
125
157
|
### Return types
|
|
126
158
|
|
|
@@ -133,6 +165,7 @@ console.log(getVersion()); // e.g. "2.0.0"
|
|
|
133
165
|
"is_compliant": true,
|
|
134
166
|
"is_playable": true,
|
|
135
167
|
"profile": "SMPTE",
|
|
168
|
+
"timestamp": "2026-01-01T12:00:00.000000+00:00",
|
|
136
169
|
"critical": [],
|
|
137
170
|
"errors": [],
|
|
138
171
|
"warnings": [],
|