@imferno/node 3.0.2-beta.2427eb9 → 3.0.2-beta.2609f57
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 +37 -5
- package/codes.d.ts +429 -463
- package/codes.js +429 -463
- package/index.d.ts +96 -34
- package/index.mjs +5 -0
- package/package.json +7 -7
- package/types.d.ts +255 -19
package/README.md
CHANGED
|
@@ -35,6 +35,26 @@ for (const issue of validation.errors) {
|
|
|
35
35
|
console.log("CPLs:", Object.keys(pkg.compositionPlaylists).length);
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
+
`validatePath` hashes every asset (several at a time, like the CLI) and
|
|
39
|
+
blocks until done. To keep the event loop running, use the async variant:
|
|
40
|
+
same arguments, same result, on the libuv thread pool.
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
import { validatePathAsync } from "@imferno/node";
|
|
44
|
+
|
|
45
|
+
const { validation } = await validatePathAsync("./my-imp");
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
`validateUriAsync`, `buildReportFromPathAsync` and `buildReportFromUriAsync`
|
|
49
|
+
work the same way.
|
|
50
|
+
|
|
51
|
+
Each running `…Async` call holds one libuv worker thread for its whole run
|
|
52
|
+
(the hashing itself runs on imferno's own threads). The pool has 4 workers
|
|
53
|
+
by default and is shared with `fs`, `dns.lookup`, `crypto` and `zlib`, so
|
|
54
|
+
more than a few concurrent validations queue each other and that I/O. To
|
|
55
|
+
run more at once, raise the pool size before Node starts it, e.g.
|
|
56
|
+
`UV_THREADPOOL_SIZE=16 node app.js` (max 1024).
|
|
57
|
+
|
|
38
58
|
### Validate from a URI (filesystem or S3)
|
|
39
59
|
|
|
40
60
|
```js
|
|
@@ -46,6 +66,8 @@ const result2 = validateUri("file:///abs/path/to/my-imp");
|
|
|
46
66
|
|
|
47
67
|
// S3 — prebuilt npm binaries include S3 support; uses the default AWS
|
|
48
68
|
// credential chain (env vars, profile, or EC2/ECS/EKS IMDS)
|
|
69
|
+
// Only the XML is read from S3: presence, size and hash checks do not run,
|
|
70
|
+
// and the result says so (IMFERNO:Package/DiskChecksNotRun).
|
|
49
71
|
const result3 = validateUri("s3://my-bucket/path/to/imp/");
|
|
50
72
|
|
|
51
73
|
// Same options object as validatePath
|
|
@@ -64,7 +86,7 @@ const options: PathValidateOptions = {
|
|
|
64
86
|
app2eSpec: "v2023",
|
|
65
87
|
skipDiskChecks: true,
|
|
66
88
|
rules: {
|
|
67
|
-
"ST2067-21:2023
|
|
89
|
+
"ST2067-21:2023/AppIdMismatch": "error",
|
|
68
90
|
"IMFERNO:Package/UnreferencedAsset": "off",
|
|
69
91
|
},
|
|
70
92
|
};
|
|
@@ -113,24 +135,34 @@ console.log(getVersion()); // e.g. "2.0.0"
|
|
|
113
135
|
| `buildReportFromPath(path, options?)` | Legacy: validate from disk (returns `ImfReport`) |
|
|
114
136
|
| `buildReportFromUri(uri, options?)` | Legacy: validate via URI (returns `ImfReport`) |
|
|
115
137
|
| `formatReport(result)` | Pretty-print a `ValidationResult` (or legacy `ImfReport`) as text |
|
|
116
|
-
| `listRules()` | Get the
|
|
138
|
+
| `listRules()` | Get the rule catalogue (one entry per rule, with its per-edition table) |
|
|
139
|
+
| `toSarif(result)` | Convert a validation result to a SARIF 2.1.0 log |
|
|
117
140
|
| `getVersion()` | Get the library version |
|
|
118
141
|
|
|
119
142
|
### Options
|
|
120
143
|
|
|
121
144
|
| Option | Type | Description |
|
|
122
145
|
|--------|------|-------------|
|
|
123
|
-
| `coreSpec` | `"auto" \| "v2013" \| "v2016" \| "v2020"` | Core constraints
|
|
146
|
+
| `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) |
|
|
147
|
+
| `cplSpec` | `"auto" \| "v2013" \| "v2016" \| "v2020"` | Composition Playlist (ST 2067-3) edition; wins over the one `coreSpec` implies |
|
|
148
|
+
| `iabSpec` | `"auto" \| "v2019" \| "v2021" \| "v2026"` | IAB plug-in (ST 2067-201) edition; wins over the one `coreSpec` implies |
|
|
124
149
|
| `app2eSpec` | `"auto" \| "none" \| "v2014" \| "v2016" \| "v2020" \| "v2023" \| "v2026"` | Application spec version |
|
|
125
150
|
| `rules` | `Record<string, "off" \| "info" \| "warn" \| "error" \| "critical">` | ESLint-style per-rule severity overrides |
|
|
126
151
|
| `aggregateRepeats` | `boolean` | Collapse repeated identical findings into one issue with `additional_instances` |
|
|
127
|
-
| `skipDiskChecks` | `boolean` | Skip
|
|
152
|
+
| `skipDiskChecks` | `boolean` | Skip every disk read: asset existence, size and hash checks and MXF checks (path / URI functions only; in-memory input never touches disk) |
|
|
153
|
+
| `skipHashes` | `boolean` | Skip hashing the assets; existence and size are still checked (path / URI functions only). Hashes are verified by default, like the CLI |
|
|
128
154
|
| `credentials` | `S3Credentials \| null` | Explicit S3 credentials (URI functions only) |
|
|
129
155
|
|
|
156
|
+
An option the function does not accept, or a value of the wrong type, throws.
|
|
157
|
+
`null` and `undefined` mean not set for every option in the table, also one
|
|
158
|
+
the function does not take; an unknown key throws even as `null`, so a typo
|
|
159
|
+
like `{ skipHash: null }` is caught.
|
|
160
|
+
|
|
130
161
|
### TypeScript
|
|
131
162
|
|
|
132
163
|
The package ships precise declarations, generated from the Rust types (no
|
|
133
|
-
`any`). Every function is synchronous
|
|
164
|
+
`any`). Every function is synchronous, except the `…Async` variants, which
|
|
165
|
+
return a Promise. All value types are exported from the
|
|
134
166
|
main entry:
|
|
135
167
|
|
|
136
168
|
```ts
|