@imferno/node 3.0.2-beta.af1c617 → 3.0.2-beta.b4d4242
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 +86 -23
- package/codes.d.ts +485 -327
- package/codes.js +485 -327
- package/index.d.ts +177 -47
- package/index.mjs +5 -0
- package/package.json +27 -8
- package/types.d.ts +1671 -0
package/index.d.ts
CHANGED
|
@@ -1,102 +1,232 @@
|
|
|
1
|
-
/* auto-generated by NAPI-RS */
|
|
1
|
+
/* auto-generated by NAPI-RS (`napi build`) — edit src/lib.rs or dts-header.d.ts instead */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
|
|
4
|
+
import type {
|
|
5
|
+
ImfReport,
|
|
6
|
+
Imferno,
|
|
7
|
+
RuleInfo,
|
|
8
|
+
ValidateOptions,
|
|
9
|
+
ValidationReport,
|
|
10
|
+
ValidationResult,
|
|
11
|
+
} from "./types";
|
|
12
|
+
|
|
13
|
+
export * from "./types";
|
|
14
|
+
export { codes } from "./codes";
|
|
15
|
+
|
|
16
|
+
/** Options for validating a package on disk (`validatePath`, `buildReportFromPath` and their `…Async` variants). */
|
|
17
|
+
export interface PathValidateOptions extends ValidateOptions {
|
|
18
|
+
/**
|
|
19
|
+
* Skip every disk read: asset presence, size and hash checks and MXF
|
|
20
|
+
* header checks (implies `skipHashes`). Only the XML is validated. Default: `false`.
|
|
21
|
+
*/
|
|
22
|
+
skipDiskChecks?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Skip hashing the assets against their Packing List `<Hash>`; presence and
|
|
25
|
+
* size are still checked. Hashing reads every asset. Default: `false`.
|
|
26
|
+
*/
|
|
27
|
+
skipHashes?: boolean;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** Explicit S3 credentials for `s3://` URIs. Omit to use the default AWS credential chain. */
|
|
31
|
+
export interface S3Credentials {
|
|
32
|
+
accessKeyId: string;
|
|
33
|
+
secretAccessKey: string;
|
|
34
|
+
sessionToken?: string;
|
|
35
|
+
region?: string;
|
|
36
|
+
endpoint?: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
4
39
|
/**
|
|
5
|
-
*
|
|
40
|
+
* Options for `validateUri` / `buildReportFromUri` (and their `…Async` variants).
|
|
41
|
+
* For an `s3://` URI only the XML is read: the disk checks do not run, and the
|
|
42
|
+
* result carries an `IMFERNO:Package/DiskChecksNotRun` notice unless
|
|
43
|
+
* `skipDiskChecks` is set.
|
|
6
44
|
*/
|
|
7
|
-
export
|
|
45
|
+
export interface UriValidateOptions extends PathValidateOptions {
|
|
46
|
+
/** Ignored for filesystem URIs. */
|
|
47
|
+
credentials?: S3Credentials | null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** A SARIF 2.1.0 log (https://docs.oasis-open.org/sarif/sarif/v2.1.0/). */
|
|
51
|
+
export interface SarifLog {
|
|
52
|
+
$schema?: string;
|
|
53
|
+
version: "2.1.0";
|
|
54
|
+
runs: Array<Record<string, unknown>>;
|
|
55
|
+
}
|
|
8
56
|
|
|
9
57
|
/**
|
|
10
|
-
* Validate an IMF package from in-memory XML strings
|
|
58
|
+
* Validate an IMF package from in-memory XML strings, returning the legacy
|
|
59
|
+
* `ImfReport` summary. Prefer `validate` for new code.
|
|
60
|
+
*
|
|
61
|
+
* Disk checks are always skipped (there is no package on disk).
|
|
11
62
|
*
|
|
12
63
|
* @param files - A map of filename to XML content (e.g. `{ "ASSETMAP.xml": "..." }`)
|
|
13
|
-
* @param options - Optional validation options (`coreSpec`, `app2eSpec`, `rules`,
|
|
14
|
-
* @returns An `ImfReport`
|
|
64
|
+
* @param options - Optional validation options (`coreSpec`, `cplSpec`, `iabSpec`, `app2eSpec`, `rules`, `aggregateRepeats`)
|
|
65
|
+
* @returns An `ImfReport` with `package`, `cpls`, and `validation` fields.
|
|
66
|
+
* @throws If the package cannot be parsed or the options are invalid.
|
|
15
67
|
*/
|
|
16
|
-
export declare function buildReport(files: Record<string, string>, options?:
|
|
68
|
+
export declare function buildReport(files: Record<string, string>, options?: ValidateOptions | undefined | null): ImfReport
|
|
17
69
|
|
|
18
70
|
/**
|
|
19
|
-
* Validate an IMF package directory on disk
|
|
71
|
+
* Validate an IMF package directory on disk, returning the legacy
|
|
72
|
+
* `ImfReport` summary. Prefer `validatePath` for new code.
|
|
73
|
+
*
|
|
74
|
+
* Hashes the assets in parallel and blocks until done; see
|
|
75
|
+
* `buildReportFromPathAsync`.
|
|
20
76
|
*
|
|
21
77
|
* @param path - Path to the IMP directory
|
|
22
|
-
* @param options - Optional validation options (`coreSpec`, `app2eSpec`, `skipDiskChecks`, `rules`,
|
|
23
|
-
* @returns An `ImfReport`
|
|
78
|
+
* @param options - Optional validation options (`coreSpec`, `cplSpec`, `iabSpec`, `app2eSpec`, `skipDiskChecks`, `skipHashes`, `rules`, `aggregateRepeats`)
|
|
79
|
+
* @returns An `ImfReport` with `package`, `cpls`, and `validation` fields.
|
|
80
|
+
* @throws If the directory cannot be read, the package cannot be parsed, or the options are invalid.
|
|
24
81
|
*/
|
|
25
|
-
export declare function buildReportFromPath(path: string, options?:
|
|
82
|
+
export declare function buildReportFromPath(path: string, options?: PathValidateOptions | undefined | null): ImfReport
|
|
26
83
|
|
|
27
84
|
/**
|
|
28
|
-
*
|
|
85
|
+
* `buildReportFromPath` on the libuv thread pool: the event loop keeps
|
|
86
|
+
* running while the assets are hashed.
|
|
29
87
|
*
|
|
30
|
-
* @param
|
|
31
|
-
* @
|
|
88
|
+
* @param path - Path to the IMP directory
|
|
89
|
+
* @param options - Optional validation options, as for `buildReportFromPath`
|
|
90
|
+
* @returns A Promise of the `ImfReport`; rejects where `buildReportFromPath` throws.
|
|
32
91
|
*/
|
|
33
|
-
export declare function
|
|
92
|
+
export declare function buildReportFromPathAsync(path: string, options?: PathValidateOptions | undefined | null): Promise<ImfReport>
|
|
34
93
|
|
|
35
94
|
/**
|
|
36
|
-
*
|
|
95
|
+
* Build the legacy `ImfReport` summary from a URI. Accepts the same URI forms
|
|
96
|
+
* as `validateUri`; prefer `validateUri` for new code.
|
|
37
97
|
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
98
|
+
* @param uri - Path or URI to the IMP
|
|
99
|
+
* @param options - Optional validation options
|
|
100
|
+
* @returns An `ImfReport` with `package`, `cpls`, and `validation` fields.
|
|
101
|
+
* @throws If the URI cannot be read, the package cannot be parsed, or the options are invalid.
|
|
102
|
+
*/
|
|
103
|
+
export declare function buildReportFromUri(uri: string, options?: UriValidateOptions | undefined | null): ImfReport
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* `buildReportFromUri` on the libuv thread pool.
|
|
40
107
|
*
|
|
41
|
-
* @param
|
|
42
|
-
* @
|
|
108
|
+
* @param uri - Path or URI to the IMP
|
|
109
|
+
* @param options - Optional validation options, as for `buildReportFromUri`
|
|
110
|
+
* @returns A Promise of the `ImfReport`; rejects where `buildReportFromUri` throws.
|
|
43
111
|
*/
|
|
44
|
-
export declare function
|
|
112
|
+
export declare function buildReportFromUriAsync(uri: string, options?: UriValidateOptions | undefined | null): Promise<ImfReport>
|
|
45
113
|
|
|
46
114
|
/**
|
|
47
|
-
*
|
|
115
|
+
* Pretty-print a validation result as a human-readable string.
|
|
48
116
|
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
117
|
+
* @param report - The object returned by `validate*`, or (legacy) by `buildReport*`
|
|
118
|
+
* @returns A formatted plain-text report.
|
|
119
|
+
* @throws If `report` is neither a `ValidationResult` nor an `ImfReport`.
|
|
120
|
+
*/
|
|
121
|
+
export declare function formatReport(report: ValidationResult | ImfReport): string
|
|
122
|
+
|
|
123
|
+
/** Returns the imferno library version string. */
|
|
124
|
+
export declare function getVersion(): string
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Returns the engine's rule catalogue: one entry per rule, each with its
|
|
128
|
+
* table of editions (clause, strength, default severity, display code).
|
|
129
|
+
* Useful for building settings UIs; `id`, `name`, `SPEC:EDITION/Name` and
|
|
130
|
+
* the display codes are all usable as `rules` keys.
|
|
131
|
+
*/
|
|
132
|
+
export declare function listRules(): RuleInfo[]
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Parse an IMF package from in-memory XML strings, returning the full parsed
|
|
136
|
+
* package without validating it.
|
|
137
|
+
*
|
|
138
|
+
* @param files - A map of filename to XML content (e.g. `{ "ASSETMAP.xml": "..." }`)
|
|
139
|
+
* @returns The full parsed `Imferno` package.
|
|
140
|
+
* @throws If the package cannot be parsed.
|
|
141
|
+
*/
|
|
142
|
+
export declare function parsePackage(files: Record<string, string>): Imferno
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Parse an IMF package directory on disk, returning the full parsed package
|
|
146
|
+
* without validating it.
|
|
51
147
|
*
|
|
52
148
|
* @param path - Path to the IMP directory
|
|
53
|
-
* @returns The full parsed Imferno package
|
|
149
|
+
* @returns The full parsed `Imferno` package.
|
|
150
|
+
* @throws If the directory cannot be read or the package cannot be parsed.
|
|
54
151
|
*/
|
|
55
|
-
export declare function parsePackageFromPath(path: string):
|
|
152
|
+
export declare function parsePackageFromPath(path: string): Imferno
|
|
56
153
|
|
|
57
154
|
/**
|
|
58
|
-
*
|
|
155
|
+
* Convert a validation result to a SARIF 2.1.0 log.
|
|
156
|
+
*
|
|
157
|
+
* Rules are reported by rule id (`ST2067-3/SegmentDuration`); each finding
|
|
158
|
+
* points at the applied edition's clause in that edition's taxonomy
|
|
159
|
+
* (`ST2067-3:2016`).
|
|
59
160
|
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
161
|
+
* @param report - The object returned by `validate*` (or its `validation`)
|
|
162
|
+
* @returns A SARIF 2.1.0 log object.
|
|
163
|
+
* @throws If `report` is not a validation result or report.
|
|
164
|
+
*/
|
|
165
|
+
export declare function toSarif(report: ValidationResult | ValidationReport): SarifLog
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Parse and validate an IMF package from in-memory XML strings. This is the
|
|
169
|
+
* recommended entry point.
|
|
170
|
+
*
|
|
171
|
+
* Parse failures are reported as findings in `validation`, not thrown.
|
|
172
|
+
* Disk checks are always skipped (there is no package on disk).
|
|
62
173
|
*
|
|
63
174
|
* @param files - A map of filename to XML content
|
|
64
175
|
* @param options - Optional validation options
|
|
65
|
-
* @returns `{ package, validation }` — full
|
|
176
|
+
* @returns `{ package, validation }` — the full parsed package and all findings.
|
|
177
|
+
* @throws Only if the options are invalid (wrong type, unknown key).
|
|
66
178
|
*/
|
|
67
|
-
export declare function validate(files: Record<string, string>, options?:
|
|
179
|
+
export declare function validate(files: Record<string, string>, options?: ValidateOptions | undefined | null): ValidationResult
|
|
68
180
|
|
|
69
181
|
/**
|
|
70
182
|
* Parse and validate an IMF package directory on disk.
|
|
71
183
|
*
|
|
184
|
+
* Like the CLI, checks every asset's presence and size and hashes it against
|
|
185
|
+
* its Packing List `<Hash>` unless `skipHashes` (or `skipDiskChecks`) is set.
|
|
186
|
+
* Hashing reads every asset (several at a time) and blocks until done; use
|
|
187
|
+
* `validatePathAsync` to keep the event loop running.
|
|
188
|
+
*
|
|
72
189
|
* @param path - Path to the IMP directory
|
|
73
190
|
* @param options - Optional validation options
|
|
74
|
-
* @returns `{ package, validation }` — full
|
|
191
|
+
* @returns `{ package, validation }` — the full parsed package and all findings.
|
|
192
|
+
* @throws If the directory cannot be read or the options are invalid
|
|
193
|
+
* (wrong type, unknown key).
|
|
194
|
+
*/
|
|
195
|
+
export declare function validatePath(path: string, options?: PathValidateOptions | undefined | null): ValidationResult
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* `validatePath` on the libuv thread pool: the event loop keeps running
|
|
199
|
+
* while the assets are hashed. Same result as `validatePath`.
|
|
200
|
+
*
|
|
201
|
+
* @param path - Path to the IMP directory
|
|
202
|
+
* @param options - Optional validation options, as for `validatePath`
|
|
203
|
+
* @returns A Promise of `{ package, validation }`; rejects where `validatePath` throws.
|
|
75
204
|
*/
|
|
76
|
-
export declare function
|
|
205
|
+
export declare function validatePathAsync(path: string, options?: PathValidateOptions | undefined | null): Promise<ValidationResult>
|
|
77
206
|
|
|
78
207
|
/**
|
|
79
208
|
* Parse and validate an IMF package from a URI.
|
|
80
209
|
*
|
|
81
|
-
* Accepts `file://` URIs, bare filesystem paths, and (when
|
|
82
|
-
*
|
|
83
|
-
*
|
|
210
|
+
* Accepts `file://` URIs, bare filesystem paths, and (when built with the
|
|
211
|
+
* `aws-s3` feature, as the prebuilt npm binaries are) `s3://bucket/prefix/`.
|
|
212
|
+
* Local packages get the disk checks of `validatePath`. An `s3://` package
|
|
213
|
+
* has only its XML read: presence, size and hash checks are not run, and the
|
|
214
|
+
* result says so with an `IMFERNO:Package/DiskChecksNotRun` notice.
|
|
84
215
|
*
|
|
85
216
|
* @param uri - Path or URI to the IMP
|
|
86
|
-
* @param options - Optional validation options
|
|
87
|
-
* @returns `{ package, validation }` — full
|
|
217
|
+
* @param options - Optional validation options (plus `credentials` for S3)
|
|
218
|
+
* @returns `{ package, validation }` — the full parsed package and all findings.
|
|
219
|
+
* @throws If the URI cannot be read or the options are invalid.
|
|
88
220
|
*/
|
|
89
|
-
export declare function validateUri(uri: string, options?:
|
|
221
|
+
export declare function validateUri(uri: string, options?: UriValidateOptions | undefined | null): ValidationResult
|
|
90
222
|
|
|
91
223
|
/**
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
* code — `buildReportFromUri` is kept for parity with `buildReport` /
|
|
96
|
-
* `buildReportFromPath`.
|
|
224
|
+
* `validateUri` on the libuv thread pool: the event loop keeps running
|
|
225
|
+
* while the package is read and its assets are hashed. Same result as
|
|
226
|
+
* `validateUri`.
|
|
97
227
|
*
|
|
98
228
|
* @param uri - Path or URI to the IMP
|
|
99
|
-
* @param options - Optional validation options
|
|
100
|
-
* @returns
|
|
229
|
+
* @param options - Optional validation options (plus `credentials` for S3)
|
|
230
|
+
* @returns A Promise of `{ package, validation }`; rejects where `validateUri` throws.
|
|
101
231
|
*/
|
|
102
|
-
export declare function
|
|
232
|
+
export declare function validateUriAsync(uri: string, options?: UriValidateOptions | undefined | null): Promise<ValidationResult>
|
package/index.mjs
CHANGED
|
@@ -49,13 +49,18 @@ export const {
|
|
|
49
49
|
buildReport,
|
|
50
50
|
buildReportFromPath,
|
|
51
51
|
buildReportFromUri,
|
|
52
|
+
buildReportFromPathAsync,
|
|
53
|
+
buildReportFromUriAsync,
|
|
52
54
|
formatReport,
|
|
53
55
|
parsePackage,
|
|
54
56
|
parsePackageFromPath,
|
|
55
57
|
validate,
|
|
56
58
|
validatePath,
|
|
57
59
|
validateUri,
|
|
60
|
+
validatePathAsync,
|
|
61
|
+
validateUriAsync,
|
|
58
62
|
listRules,
|
|
63
|
+
toSarif,
|
|
59
64
|
} = nativeModule;
|
|
60
65
|
|
|
61
66
|
export { codes } from "./codes.mjs";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@imferno/node",
|
|
3
|
-
"version": "3.0.2-beta.
|
|
3
|
+
"version": "3.0.2-beta.b4d4242",
|
|
4
4
|
"description": "Native Node.js bindings for the imferno SMPTE ST 2067 IMF validator",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.mjs",
|
|
@@ -26,25 +26,31 @@
|
|
|
26
26
|
"aarch64-unknown-linux-gnu",
|
|
27
27
|
"x86_64-pc-windows-msvc",
|
|
28
28
|
"aarch64-pc-windows-msvc"
|
|
29
|
-
]
|
|
29
|
+
],
|
|
30
|
+
"dtsHeaderFile": "dts-header.d.ts"
|
|
30
31
|
},
|
|
31
32
|
"files": [
|
|
32
33
|
"index.js",
|
|
33
34
|
"index.mjs",
|
|
34
35
|
"index.d.ts",
|
|
36
|
+
"types.d.ts",
|
|
35
37
|
"codes.js",
|
|
36
38
|
"codes.mjs",
|
|
37
39
|
"codes.d.ts",
|
|
38
40
|
"README.md",
|
|
39
41
|
"LICENSE"
|
|
40
42
|
],
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build": "napi build --release",
|
|
45
|
+
"test": "vitest run"
|
|
46
|
+
},
|
|
41
47
|
"optionalDependencies": {
|
|
42
|
-
"@imferno/node-darwin-arm64": "3.0.2-beta.
|
|
43
|
-
"@imferno/node-darwin-x64": "3.0.2-beta.
|
|
44
|
-
"@imferno/node-linux-x64-gnu": "3.0.2-beta.
|
|
45
|
-
"@imferno/node-linux-arm64-gnu": "3.0.2-beta.
|
|
46
|
-
"@imferno/node-win32-x64-msvc": "3.0.2-beta.
|
|
47
|
-
"@imferno/node-win32-arm64-msvc": "3.0.2-beta.
|
|
48
|
+
"@imferno/node-darwin-arm64": "3.0.2-beta.b4d4242",
|
|
49
|
+
"@imferno/node-darwin-x64": "3.0.2-beta.b4d4242",
|
|
50
|
+
"@imferno/node-linux-x64-gnu": "3.0.2-beta.b4d4242",
|
|
51
|
+
"@imferno/node-linux-arm64-gnu": "3.0.2-beta.b4d4242",
|
|
52
|
+
"@imferno/node-win32-x64-msvc": "3.0.2-beta.b4d4242",
|
|
53
|
+
"@imferno/node-win32-arm64-msvc": "3.0.2-beta.b4d4242"
|
|
48
54
|
},
|
|
49
55
|
"publishConfig": {
|
|
50
56
|
"access": "public"
|
|
@@ -60,5 +66,18 @@
|
|
|
60
66
|
},
|
|
61
67
|
"engines": {
|
|
62
68
|
"node": ">=16.0.0"
|
|
69
|
+
},
|
|
70
|
+
"devDependencies": {
|
|
71
|
+
"@napi-rs/cli": "3.10.12",
|
|
72
|
+
"ajv": "^8.20.0",
|
|
73
|
+
"json-schema-to-typescript": "16.0.0",
|
|
74
|
+
"prettier": "3.9.10",
|
|
75
|
+
"ts-json-schema-generator": "2.9.0",
|
|
76
|
+
"typescript": "^5.9.3",
|
|
77
|
+
"vitest": "^4.0.18"
|
|
78
|
+
},
|
|
79
|
+
"overrides": {
|
|
80
|
+
"prettier": "3.9.10",
|
|
81
|
+
"@apidevtools/json-schema-ref-parser": "11.9.3"
|
|
63
82
|
}
|
|
64
83
|
}
|