@imferno/node 3.0.2-feat-fuzzing.270a50e → 3.0.2-feat-rule-model-per-edition.ab840ae
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 +52 -21
- package/codes.d.ts +247 -458
- package/codes.js +247 -458
- package/index.d.ts +119 -54
- package/index.mjs +1 -0
- package/package.json +27 -8
- package/types.d.ts +1477 -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,8 +112,9 @@ 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
|
|
@@ -119,8 +123,34 @@ console.log(getVersion()); // e.g. "2.0.0"
|
|
|
119
123
|
|--------|------|-------------|
|
|
120
124
|
| `coreSpec` | `"auto" \| "v2013" \| "v2016" \| "v2020"` | Core constraints spec version |
|
|
121
125
|
| `app2eSpec` | `"auto" \| "none" \| "v2014" \| "v2016" \| "v2020" \| "v2023" \| "v2026"` | Application spec version |
|
|
122
|
-
| `
|
|
123
|
-
| `
|
|
126
|
+
| `rules` | `Record<string, "off" \| "info" \| "warn" \| "error" \| "critical">` | ESLint-style per-rule severity overrides |
|
|
127
|
+
| `aggregateRepeats` | `boolean` | Collapse repeated identical findings into one issue with `additional_instances` |
|
|
128
|
+
| `skipDiskChecks` | `boolean` | Skip file manifest and MXF checks (path / URI functions only; in-memory input never touches disk) |
|
|
129
|
+
| `credentials` | `S3Credentials \| null` | Explicit S3 credentials (URI functions only) |
|
|
130
|
+
|
|
131
|
+
### TypeScript
|
|
132
|
+
|
|
133
|
+
The package ships precise declarations, generated from the Rust types (no
|
|
134
|
+
`any`). Every function is synchronous. All value types are exported from the
|
|
135
|
+
main entry:
|
|
136
|
+
|
|
137
|
+
```ts
|
|
138
|
+
import type {
|
|
139
|
+
ValidationResult, // validate*, { package, validation }
|
|
140
|
+
Imferno, // parsePackage*, the full parsed package
|
|
141
|
+
ImfReport, // buildReport* (legacy)
|
|
142
|
+
ValidationIssue, // severity, category, code, message, location, ...
|
|
143
|
+
ValidateOptions, // coreSpec, app2eSpec, rules, aggregateRepeats
|
|
144
|
+
PathValidateOptions,
|
|
145
|
+
UriValidateOptions,
|
|
146
|
+
RuleInfo, // listRules() entries
|
|
147
|
+
} from "@imferno/node";
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Field casing follows the serialised output: the validation report uses
|
|
151
|
+
snake_case (`is_compliant`, `cpl_id`), the parsed package uses camelCase at the
|
|
152
|
+
top level (`compositionPlaylists`) and the SMPTE element names inside CPLs
|
|
153
|
+
(`ContentTitle`, `SegmentList`).
|
|
124
154
|
|
|
125
155
|
### Return types
|
|
126
156
|
|
|
@@ -133,6 +163,7 @@ console.log(getVersion()); // e.g. "2.0.0"
|
|
|
133
163
|
"is_compliant": true,
|
|
134
164
|
"is_playable": true,
|
|
135
165
|
"profile": "SMPTE",
|
|
166
|
+
"timestamp": "2026-01-01T12:00:00.000000+00:00",
|
|
136
167
|
"critical": [],
|
|
137
168
|
"errors": [],
|
|
138
169
|
"warnings": [],
|