@imferno/node 3.0.2-beta.1b73397 → 3.0.2-beta.2427eb9
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 +49 -19
- package/codes.d.ts +10 -0
- package/codes.js +10 -0
- package/index.d.ts +122 -54
- package/package.json +27 -8
- package/types.d.ts +1337 -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,10 +56,10 @@ 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,
|
|
@@ -65,15 +67,16 @@ const report = buildReportFromPath("./my-imp", {
|
|
|
65
67
|
"ST2067-21:2023:7.1/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,7 +112,7 @@ 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(
|
|
115
|
+
| `formatReport(result)` | Pretty-print a `ValidationResult` (or legacy `ImfReport`) as text |
|
|
113
116
|
| `listRules()` | Get the full catalogue of validation rule codes |
|
|
114
117
|
| `getVersion()` | Get the library version |
|
|
115
118
|
|
|
@@ -119,8 +122,34 @@ console.log(getVersion()); // e.g. "2.0.0"
|
|
|
119
122
|
|--------|------|-------------|
|
|
120
123
|
| `coreSpec` | `"auto" \| "v2013" \| "v2016" \| "v2020"` | Core constraints spec version |
|
|
121
124
|
| `app2eSpec` | `"auto" \| "none" \| "v2014" \| "v2016" \| "v2020" \| "v2023" \| "v2026"` | Application spec version |
|
|
122
|
-
| `
|
|
123
|
-
| `
|
|
125
|
+
| `rules` | `Record<string, "off" \| "info" \| "warn" \| "error" \| "critical">` | ESLint-style per-rule severity overrides |
|
|
126
|
+
| `aggregateRepeats` | `boolean` | Collapse repeated identical findings into one issue with `additional_instances` |
|
|
127
|
+
| `skipDiskChecks` | `boolean` | Skip file manifest and MXF checks (path / URI functions only; in-memory input never touches disk) |
|
|
128
|
+
| `credentials` | `S3Credentials \| null` | Explicit S3 credentials (URI functions only) |
|
|
129
|
+
|
|
130
|
+
### TypeScript
|
|
131
|
+
|
|
132
|
+
The package ships precise declarations, generated from the Rust types (no
|
|
133
|
+
`any`). Every function is synchronous. All value types are exported from the
|
|
134
|
+
main entry:
|
|
135
|
+
|
|
136
|
+
```ts
|
|
137
|
+
import type {
|
|
138
|
+
ValidationResult, // validate*, { package, validation }
|
|
139
|
+
Imferno, // parsePackage*, the full parsed package
|
|
140
|
+
ImfReport, // buildReport* (legacy)
|
|
141
|
+
ValidationIssue, // severity, category, code, message, location, ...
|
|
142
|
+
ValidateOptions, // coreSpec, app2eSpec, rules, aggregateRepeats
|
|
143
|
+
PathValidateOptions,
|
|
144
|
+
UriValidateOptions,
|
|
145
|
+
RuleInfo, // listRules() entries
|
|
146
|
+
} from "@imferno/node";
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Field casing follows the serialised output: the validation report uses
|
|
150
|
+
snake_case (`is_compliant`, `cpl_id`), the parsed package uses camelCase at the
|
|
151
|
+
top level (`compositionPlaylists`) and the SMPTE element names inside CPLs
|
|
152
|
+
(`ContentTitle`, `SegmentList`).
|
|
124
153
|
|
|
125
154
|
### Return types
|
|
126
155
|
|
|
@@ -133,6 +162,7 @@ console.log(getVersion()); // e.g. "2.0.0"
|
|
|
133
162
|
"is_compliant": true,
|
|
134
163
|
"is_playable": true,
|
|
135
164
|
"profile": "SMPTE",
|
|
165
|
+
"timestamp": "2026-01-01T12:00:00.000000+00:00",
|
|
136
166
|
"critical": [],
|
|
137
167
|
"errors": [],
|
|
138
168
|
"warnings": [],
|
package/codes.d.ts
CHANGED
|
@@ -3,6 +3,11 @@ export declare const codes: {
|
|
|
3
3
|
readonly ST429_9_2014: {
|
|
4
4
|
readonly VolindexMissing: "ST429-9:2014:7/VolindexMissing";
|
|
5
5
|
readonly MalformedXml: "ST429-9:2014:7/MalformedXml";
|
|
6
|
+
readonly PathNotRelative: "ST429-9:2014:A.2/PathNotRelative";
|
|
7
|
+
readonly PathCharacters: "ST429-9:2014:A.2/PathCharacters";
|
|
8
|
+
readonly PathTooLong: "ST429-9:2014:A.2/PathTooLong";
|
|
9
|
+
readonly PathTooManySegments: "ST429-9:2014:A.2/PathTooManySegments";
|
|
10
|
+
readonly PathDuplicate: "ST429-9:2014:A.2/PathDuplicate";
|
|
6
11
|
};
|
|
7
12
|
readonly ST377_1_2011: {
|
|
8
13
|
readonly NotMxf: "ST377-1:2011:5/NotMxf";
|
|
@@ -12,6 +17,7 @@ export declare const codes: {
|
|
|
12
17
|
readonly NonHeaderFirstPartition: "ST377-1:2011:6.4/NonHeaderFirstPartition";
|
|
13
18
|
readonly HeaderPartitionOpen: "ST377-1:2011:8.3.3/HeaderPartitionOpen";
|
|
14
19
|
readonly MissingHeaderMetadata: "ST377-1:2011:8.3.3/MissingHeaderMetadata";
|
|
20
|
+
readonly StructuralComponentDurationMissing: "ST377-1:2011:B.8/StructuralComponentDurationMissing";
|
|
15
21
|
};
|
|
16
22
|
readonly ST2067_2_2020: {
|
|
17
23
|
readonly AssetMap: "ST2067-2:2020:7/AssetMap";
|
|
@@ -22,6 +28,7 @@ export declare const codes: {
|
|
|
22
28
|
readonly FileNotFound: "ST2067-2:2020:8.3/FileNotFound";
|
|
23
29
|
readonly ChecksumMismatch: "ST2067-2:2020:8.3/ChecksumMismatch";
|
|
24
30
|
readonly UnresolvedUuid: "ST2067-2:2020:7/UnresolvedUuid";
|
|
31
|
+
readonly TrackFileNotInPackage: "ST2067-2:2020:7.1/TrackFileNotInPackage";
|
|
25
32
|
readonly DuplicateUuid: "ST2067-2:2020:7/DuplicateUuid";
|
|
26
33
|
readonly IoError: "IMF:General/IoError";
|
|
27
34
|
readonly EssenceDescriptorList: "ST2067-2:2020:6.4.2/EssenceDescriptorList";
|
|
@@ -387,6 +394,8 @@ export declare const codes: {
|
|
|
387
394
|
readonly J2CLayout: "ST2067-21:2026:7.5.2/J2CLayout";
|
|
388
395
|
readonly J2KExtendedCapabilities: "ST2067-21:2026:7.5.1/J2KExtendedCapabilities";
|
|
389
396
|
readonly JPEG2000SubDescriptor: "ST2067-21:2026:7.5.1/JPEG2000SubDescriptor";
|
|
397
|
+
readonly HTIRVParameterBMax: "ST2067-21:2026:H/HT-IRV-ParameterB-Max";
|
|
398
|
+
readonly HTIRVParameterBRecommended: "ST2067-21:2026:H/HT-IRV-ParameterB-Recommended";
|
|
390
399
|
readonly J2K4KResolution: "ST2067-21:2026:7.2.5/J2K-4K-Resolution";
|
|
391
400
|
readonly J2K2KResolution: "ST2067-21:2026:7.2.5/J2K-2K-Resolution";
|
|
392
401
|
readonly J2KBCPResolution: "ST2067-21:2026:7.2.5/J2K-BCP-Resolution";
|
|
@@ -468,5 +477,6 @@ export declare const codes: {
|
|
|
468
477
|
readonly ReadDirError: "IMFERNO:Package/ReadDirError";
|
|
469
478
|
readonly DirEntryError: "IMFERNO:Package/DirEntryError";
|
|
470
479
|
readonly PathTraversal: "IMFERNO:Package/PathTraversal";
|
|
480
|
+
readonly ApplicationProfileNotValidated: "IMFERNO:Package/ApplicationProfileNotValidated";
|
|
471
481
|
}
|
|
472
482
|
};
|
package/codes.js
CHANGED
|
@@ -3,6 +3,11 @@ const codes = {
|
|
|
3
3
|
ST429_9_2014: {
|
|
4
4
|
VolindexMissing: "ST429-9:2014:7/VolindexMissing",
|
|
5
5
|
MalformedXml: "ST429-9:2014:7/MalformedXml",
|
|
6
|
+
PathNotRelative: "ST429-9:2014:A.2/PathNotRelative",
|
|
7
|
+
PathCharacters: "ST429-9:2014:A.2/PathCharacters",
|
|
8
|
+
PathTooLong: "ST429-9:2014:A.2/PathTooLong",
|
|
9
|
+
PathTooManySegments: "ST429-9:2014:A.2/PathTooManySegments",
|
|
10
|
+
PathDuplicate: "ST429-9:2014:A.2/PathDuplicate",
|
|
6
11
|
},
|
|
7
12
|
ST377_1_2011: {
|
|
8
13
|
NotMxf: "ST377-1:2011:5/NotMxf",
|
|
@@ -12,6 +17,7 @@ const codes = {
|
|
|
12
17
|
NonHeaderFirstPartition: "ST377-1:2011:6.4/NonHeaderFirstPartition",
|
|
13
18
|
HeaderPartitionOpen: "ST377-1:2011:8.3.3/HeaderPartitionOpen",
|
|
14
19
|
MissingHeaderMetadata: "ST377-1:2011:8.3.3/MissingHeaderMetadata",
|
|
20
|
+
StructuralComponentDurationMissing: "ST377-1:2011:B.8/StructuralComponentDurationMissing",
|
|
15
21
|
},
|
|
16
22
|
ST2067_2_2020: {
|
|
17
23
|
AssetMap: "ST2067-2:2020:7/AssetMap",
|
|
@@ -22,6 +28,7 @@ const codes = {
|
|
|
22
28
|
FileNotFound: "ST2067-2:2020:8.3/FileNotFound",
|
|
23
29
|
ChecksumMismatch: "ST2067-2:2020:8.3/ChecksumMismatch",
|
|
24
30
|
UnresolvedUuid: "ST2067-2:2020:7/UnresolvedUuid",
|
|
31
|
+
TrackFileNotInPackage: "ST2067-2:2020:7.1/TrackFileNotInPackage",
|
|
25
32
|
DuplicateUuid: "ST2067-2:2020:7/DuplicateUuid",
|
|
26
33
|
IoError: "IMF:General/IoError",
|
|
27
34
|
EssenceDescriptorList: "ST2067-2:2020:6.4.2/EssenceDescriptorList",
|
|
@@ -387,6 +394,8 @@ const codes = {
|
|
|
387
394
|
J2CLayout: "ST2067-21:2026:7.5.2/J2CLayout",
|
|
388
395
|
J2KExtendedCapabilities: "ST2067-21:2026:7.5.1/J2KExtendedCapabilities",
|
|
389
396
|
JPEG2000SubDescriptor: "ST2067-21:2026:7.5.1/JPEG2000SubDescriptor",
|
|
397
|
+
HTIRVParameterBMax: "ST2067-21:2026:H/HT-IRV-ParameterB-Max",
|
|
398
|
+
HTIRVParameterBRecommended: "ST2067-21:2026:H/HT-IRV-ParameterB-Recommended",
|
|
390
399
|
J2K4KResolution: "ST2067-21:2026:7.2.5/J2K-4K-Resolution",
|
|
391
400
|
J2K2KResolution: "ST2067-21:2026:7.2.5/J2K-2K-Resolution",
|
|
392
401
|
J2KBCPResolution: "ST2067-21:2026:7.2.5/J2K-BCP-Resolution",
|
|
@@ -468,6 +477,7 @@ const codes = {
|
|
|
468
477
|
ReadDirError: "IMFERNO:Package/ReadDirError",
|
|
469
478
|
DirEntryError: "IMFERNO:Package/DirEntryError",
|
|
470
479
|
PathTraversal: "IMFERNO:Package/PathTraversal",
|
|
480
|
+
ApplicationProfileNotValidated: "IMFERNO:Package/ApplicationProfileNotValidated",
|
|
471
481
|
}
|
|
472
482
|
};
|
|
473
483
|
module.exports = { codes };
|
package/index.d.ts
CHANGED
|
@@ -1,102 +1,170 @@
|
|
|
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
import type {
|
|
5
|
+
Category,
|
|
6
|
+
ImfReport,
|
|
7
|
+
Imferno,
|
|
8
|
+
ValidateOptions,
|
|
9
|
+
ValidationResult,
|
|
10
|
+
} from "./types";
|
|
11
|
+
|
|
12
|
+
export * from "./types";
|
|
13
|
+
export { codes } from "./codes";
|
|
14
|
+
|
|
15
|
+
/** Options for validating a package on disk (`validatePath`, `buildReportFromPath`). */
|
|
16
|
+
export interface PathValidateOptions extends ValidateOptions {
|
|
17
|
+
/** Skip file-manifest (size/presence) and MXF header checks. Default: `false`. */
|
|
18
|
+
skipDiskChecks?: boolean;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** Explicit S3 credentials for `s3://` URIs. Omit to use the default AWS credential chain. */
|
|
22
|
+
export interface S3Credentials {
|
|
23
|
+
accessKeyId: string;
|
|
24
|
+
secretAccessKey: string;
|
|
25
|
+
sessionToken?: string;
|
|
26
|
+
region?: string;
|
|
27
|
+
endpoint?: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** Options for `validateUri` / `buildReportFromUri`. */
|
|
31
|
+
export interface UriValidateOptions extends PathValidateOptions {
|
|
32
|
+
/** Ignored for filesystem URIs. */
|
|
33
|
+
credentials?: S3Credentials | null;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Which rule catalogue a code belongs to. */
|
|
37
|
+
export type RuleSpec =
|
|
38
|
+
| "core"
|
|
39
|
+
| "cpl"
|
|
40
|
+
| "app2e"
|
|
41
|
+
| "volindex"
|
|
42
|
+
| "mxf"
|
|
43
|
+
| "scm"
|
|
44
|
+
| "isxd"
|
|
45
|
+
| "iab"
|
|
46
|
+
| "imferno";
|
|
47
|
+
|
|
48
|
+
/** One entry of the `listRules()` catalogue. */
|
|
49
|
+
export interface RuleInfo {
|
|
50
|
+
/** Normalised rule code, usable as a `rules` key. */
|
|
51
|
+
code: string;
|
|
52
|
+
spec: RuleSpec;
|
|
53
|
+
description: string;
|
|
54
|
+
defaultSeverity: "info" | "warning" | "error" | "critical";
|
|
55
|
+
category: Extract<Category, string>;
|
|
56
|
+
/** Present when this edition's code set is identical to an earlier edition's (that edition's prefix). */
|
|
57
|
+
sameAsPreviousEdition?: string;
|
|
58
|
+
}
|
|
8
59
|
|
|
9
60
|
/**
|
|
10
|
-
* Validate an IMF package from in-memory XML strings
|
|
61
|
+
* Validate an IMF package from in-memory XML strings, returning the legacy
|
|
62
|
+
* `ImfReport` summary. Prefer `validate` for new code.
|
|
63
|
+
*
|
|
64
|
+
* Disk checks are always skipped (there is no package on disk).
|
|
11
65
|
*
|
|
12
66
|
* @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`
|
|
67
|
+
* @param options - Optional validation options (`coreSpec`, `app2eSpec`, `rules`, `aggregateRepeats`)
|
|
68
|
+
* @returns An `ImfReport` with `package`, `cpls`, and `validation` fields.
|
|
69
|
+
* @throws If the package cannot be parsed or the options are invalid.
|
|
15
70
|
*/
|
|
16
|
-
export declare function buildReport(files: Record<string, string>, options?:
|
|
71
|
+
export declare function buildReport(files: Record<string, string>, options?: ValidateOptions | undefined | null): ImfReport
|
|
17
72
|
|
|
18
73
|
/**
|
|
19
|
-
* Validate an IMF package directory on disk
|
|
74
|
+
* Validate an IMF package directory on disk, returning the legacy
|
|
75
|
+
* `ImfReport` summary. Prefer `validatePath` for new code.
|
|
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`, `app2eSpec`, `skipDiskChecks`, `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
|
+
* Build the legacy `ImfReport` summary from a URI. Accepts the same URI forms
|
|
86
|
+
* as `validateUri`; prefer `validateUri` for new code.
|
|
29
87
|
*
|
|
30
|
-
* @param
|
|
31
|
-
* @
|
|
88
|
+
* @param uri - Path or URI to the IMP
|
|
89
|
+
* @param options - Optional validation options
|
|
90
|
+
* @returns An `ImfReport` with `package`, `cpls`, and `validation` fields.
|
|
91
|
+
* @throws If the URI cannot be read, the package cannot be parsed, or the options are invalid.
|
|
32
92
|
*/
|
|
33
|
-
export declare function
|
|
93
|
+
export declare function buildReportFromUri(uri: string, options?: UriValidateOptions | undefined | null): ImfReport
|
|
34
94
|
|
|
35
95
|
/**
|
|
36
|
-
*
|
|
96
|
+
* Pretty-print a validation result as a human-readable string.
|
|
37
97
|
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
98
|
+
* @param report - The object returned by `validate*`, or (legacy) by `buildReport*`
|
|
99
|
+
* @returns A formatted plain-text report.
|
|
100
|
+
* @throws If `report` is neither a `ValidationResult` nor an `ImfReport`.
|
|
101
|
+
*/
|
|
102
|
+
export declare function formatReport(report: ValidationResult | ImfReport): string
|
|
103
|
+
|
|
104
|
+
/** Returns the imferno library version string. */
|
|
105
|
+
export declare function getVersion(): string
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Returns the engine's full catalogue of validation rule codes, one entry per
|
|
109
|
+
* per-spec enum variant. Useful for building settings UIs that render a
|
|
110
|
+
* configurable severity dropdown per rule. The shape is stable JSON, so
|
|
111
|
+
* downstream callers can store severity overrides keyed by `code`.
|
|
112
|
+
*/
|
|
113
|
+
export declare function listRules(): RuleInfo[]
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Parse an IMF package from in-memory XML strings, returning the full parsed
|
|
117
|
+
* package without validating it.
|
|
40
118
|
*
|
|
41
119
|
* @param files - A map of filename to XML content (e.g. `{ "ASSETMAP.xml": "..." }`)
|
|
42
|
-
* @returns The full parsed Imferno package
|
|
120
|
+
* @returns The full parsed `Imferno` package.
|
|
121
|
+
* @throws If the package cannot be parsed.
|
|
43
122
|
*/
|
|
44
|
-
export declare function parsePackage(files: Record<string, string>):
|
|
123
|
+
export declare function parsePackage(files: Record<string, string>): Imferno
|
|
45
124
|
|
|
46
125
|
/**
|
|
47
|
-
* Parse an IMF package directory on disk, returning the full parsed package
|
|
48
|
-
*
|
|
49
|
-
* Unlike `buildReportFromPath` which returns a validation summary, this returns the
|
|
50
|
-
* complete `Imferno` struct with all essence descriptors, locales, content versions, etc.
|
|
126
|
+
* Parse an IMF package directory on disk, returning the full parsed package
|
|
127
|
+
* without validating it.
|
|
51
128
|
*
|
|
52
129
|
* @param path - Path to the IMP directory
|
|
53
|
-
* @returns The full parsed Imferno package
|
|
130
|
+
* @returns The full parsed `Imferno` package.
|
|
131
|
+
* @throws If the directory cannot be read or the package cannot be parsed.
|
|
54
132
|
*/
|
|
55
|
-
export declare function parsePackageFromPath(path: string):
|
|
133
|
+
export declare function parsePackageFromPath(path: string): Imferno
|
|
56
134
|
|
|
57
135
|
/**
|
|
58
|
-
* Parse and validate an IMF package from in-memory XML strings.
|
|
136
|
+
* Parse and validate an IMF package from in-memory XML strings. This is the
|
|
137
|
+
* recommended entry point.
|
|
59
138
|
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
139
|
+
* Parse failures are reported as findings in `validation`, not thrown.
|
|
140
|
+
* Disk checks are always skipped (there is no package on disk).
|
|
62
141
|
*
|
|
63
142
|
* @param files - A map of filename to XML content
|
|
64
143
|
* @param options - Optional validation options
|
|
65
|
-
* @returns `{ package, validation }` — full
|
|
144
|
+
* @returns `{ package, validation }` — the full parsed package and all findings.
|
|
145
|
+
* @throws Only if the options are invalid.
|
|
66
146
|
*/
|
|
67
|
-
export declare function validate(files: Record<string, string>, options?:
|
|
147
|
+
export declare function validate(files: Record<string, string>, options?: ValidateOptions | undefined | null): ValidationResult
|
|
68
148
|
|
|
69
149
|
/**
|
|
70
150
|
* Parse and validate an IMF package directory on disk.
|
|
71
151
|
*
|
|
72
152
|
* @param path - Path to the IMP directory
|
|
73
153
|
* @param options - Optional validation options
|
|
74
|
-
* @returns `{ package, validation }` — full
|
|
154
|
+
* @returns `{ package, validation }` — the full parsed package and all findings.
|
|
155
|
+
* @throws If the directory cannot be read or the options are invalid.
|
|
75
156
|
*/
|
|
76
|
-
export declare function validatePath(path: string, options?:
|
|
157
|
+
export declare function validatePath(path: string, options?: PathValidateOptions | undefined | null): ValidationResult
|
|
77
158
|
|
|
78
159
|
/**
|
|
79
160
|
* Parse and validate an IMF package from a URI.
|
|
80
161
|
*
|
|
81
|
-
* Accepts `file://` URIs, bare filesystem paths, and (when
|
|
82
|
-
*
|
|
83
|
-
* on npm include `aws-s3` enabled.
|
|
84
|
-
*
|
|
85
|
-
* @param uri - Path or URI to the IMP
|
|
86
|
-
* @param options - Optional validation options
|
|
87
|
-
* @returns `{ package, validation }` — full Imferno struct + ValidationReport
|
|
88
|
-
*/
|
|
89
|
-
export declare function validateUri(uri: string, options?: any | undefined | null): any
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Build an ImfReport summary from a URI.
|
|
93
|
-
*
|
|
94
|
-
* Accepts the same URI forms as `validateUri`. Prefer `validateUri` for new
|
|
95
|
-
* code — `buildReportFromUri` is kept for parity with `buildReport` /
|
|
96
|
-
* `buildReportFromPath`.
|
|
162
|
+
* Accepts `file://` URIs, bare filesystem paths, and (when built with the
|
|
163
|
+
* `aws-s3` feature, as the prebuilt npm binaries are) `s3://bucket/prefix/`.
|
|
97
164
|
*
|
|
98
165
|
* @param uri - Path or URI to the IMP
|
|
99
|
-
* @param options - Optional validation options
|
|
100
|
-
* @returns
|
|
166
|
+
* @param options - Optional validation options (plus `credentials` for S3)
|
|
167
|
+
* @returns `{ package, validation }` — the full parsed package and all findings.
|
|
168
|
+
* @throws If the URI cannot be read or the options are invalid.
|
|
101
169
|
*/
|
|
102
|
-
export declare function
|
|
170
|
+
export declare function validateUri(uri: string, options?: UriValidateOptions | undefined | null): ValidationResult
|
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.2427eb9",
|
|
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.2427eb9",
|
|
49
|
+
"@imferno/node-darwin-x64": "3.0.2-beta.2427eb9",
|
|
50
|
+
"@imferno/node-linux-x64-gnu": "3.0.2-beta.2427eb9",
|
|
51
|
+
"@imferno/node-linux-arm64-gnu": "3.0.2-beta.2427eb9",
|
|
52
|
+
"@imferno/node-win32-x64-msvc": "3.0.2-beta.2427eb9",
|
|
53
|
+
"@imferno/node-win32-arm64-msvc": "3.0.2-beta.2427eb9"
|
|
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
|
}
|