@imferno/wasm 0.1.3 → 1.0.0
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 +29 -41
- package/imferno_wasm.d.ts +9 -35
- package/imferno_wasm.js +68 -131
- package/imferno_wasm_bg.wasm +0 -0
- package/imferno_wasm_bg.wasm.d.ts +1 -5
- package/index.d.ts +32 -32
- package/index.js +3 -25
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
# imferno
|
|
1
|
+
# @imferno/wasm
|
|
2
2
|
|
|
3
3
|
SMPTE ST 2067 IMF parser and validator for JavaScript and TypeScript, powered by WebAssembly.
|
|
4
4
|
|
|
5
|
+
Part of the [`imferno`](https://github.com/jpwesselink/imferno) ecosystem. See also [`@imferno/schema`](https://www.npmjs.com/package/@imferno/schema) for JSON Schema validation of imferno output.
|
|
6
|
+
|
|
5
7
|
## Install
|
|
6
8
|
|
|
7
9
|
```bash
|
|
8
|
-
npm install imferno
|
|
10
|
+
npm install @imferno/wasm
|
|
9
11
|
```
|
|
10
12
|
|
|
11
13
|
The package ships a prebuilt `.wasm` binary — no build step required.
|
|
@@ -18,13 +20,9 @@ import {
|
|
|
18
20
|
parseCplTyped,
|
|
19
21
|
parsePklTyped,
|
|
20
22
|
parseVolindexTyped,
|
|
21
|
-
|
|
22
|
-
validateCplWithSpecSelection,
|
|
23
|
-
inspectPackage,
|
|
24
|
-
extractSourceAsset,
|
|
25
|
-
compareDelivery,
|
|
23
|
+
validate,
|
|
26
24
|
getVersion,
|
|
27
|
-
} from 'imferno
|
|
25
|
+
} from '@imferno/wasm';
|
|
28
26
|
|
|
29
27
|
// Parse individual XML files
|
|
30
28
|
const assetMap = await parseAssetmapTyped(assetmapXml);
|
|
@@ -33,49 +31,39 @@ const pkl = await parsePklTyped(pklXml);
|
|
|
33
31
|
const volindex = await parseVolindexTyped(volindexXml);
|
|
34
32
|
|
|
35
33
|
// Validate a full IMF package (pass all XML files as a map)
|
|
36
|
-
const
|
|
34
|
+
const result = await validate({
|
|
37
35
|
'ASSETMAP.xml': assetmapXml,
|
|
38
36
|
'PKL_abc.xml': pklXml,
|
|
39
37
|
'CPL_def.xml': cplXml,
|
|
40
38
|
});
|
|
41
|
-
console.log(report.errors);
|
|
42
|
-
console.log(report.warnings);
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
// Extract source asset from a CPL
|
|
57
|
-
const sourceAsset = await extractSourceAsset(cplXml);
|
|
58
|
-
|
|
59
|
-
// Compare against a delivery spec
|
|
60
|
-
const comparison = await compareDelivery(sourceAsset, deliverySpec);
|
|
39
|
+
console.log(result.report.errors);
|
|
40
|
+
console.log(result.report.warnings);
|
|
41
|
+
console.log(result.cpls);
|
|
42
|
+
console.log(result.unreferencedAssets);
|
|
43
|
+
|
|
44
|
+
// Validate with spec selection and custom rules
|
|
45
|
+
const result2 = await validate(
|
|
46
|
+
{
|
|
47
|
+
'ASSETMAP.xml': assetmapXml,
|
|
48
|
+
'PKL_abc.xml': pklXml,
|
|
49
|
+
'CPL_def.xml': cplXml,
|
|
50
|
+
},
|
|
51
|
+
{ coreSpec: 'v2020', app2eSpec: 'v2023' },
|
|
52
|
+
);
|
|
61
53
|
```
|
|
62
54
|
|
|
63
55
|
WASM initialization is handled automatically on first call.
|
|
64
56
|
|
|
65
57
|
## API
|
|
66
58
|
|
|
67
|
-
| Function |
|
|
68
|
-
|
|
69
|
-
| `
|
|
70
|
-
| `parseCplTyped(xml)` | CPL XML |
|
|
71
|
-
| `
|
|
72
|
-
| `
|
|
73
|
-
| `
|
|
74
|
-
| `
|
|
75
|
-
| `inspectPackage(files)` | `{ filename: xml }` map | package metadata |
|
|
76
|
-
| `extractSourceAsset(xml)` | CPL XML | `SourceAsset` |
|
|
77
|
-
| `compareDelivery(asset, spec)` | `SourceAsset` + `DeliveryRequest` | `DeliveryComparison` |
|
|
78
|
-
| `getVersion()` | — | version string |
|
|
59
|
+
| Function | Description |
|
|
60
|
+
|----------|-------------|
|
|
61
|
+
| `validate(files, options?)` | Validate a full IMF package, returns report + parsed data |
|
|
62
|
+
| `parseCplTyped(xml)` | Parse CPL XML |
|
|
63
|
+
| `parseAssetmapTyped(xml)` | Parse ASSETMAP.xml |
|
|
64
|
+
| `parsePklTyped(xml)` | Parse PKL XML |
|
|
65
|
+
| `parseVolindexTyped(xml)` | Parse VOLINDEX.xml |
|
|
66
|
+
| `getVersion()` | Get library version |
|
|
79
67
|
|
|
80
68
|
### Spec selection values
|
|
81
69
|
|
package/imferno_wasm.d.ts
CHANGED
|
@@ -471,16 +471,6 @@ export type TransferCharacteristic = "Linear" | "Bt709" | "Smpte240M" | "XvYcc70
|
|
|
471
471
|
export type VideoCodec = "Jpeg2000" | "Jpeg2000Imf2k" | "Jpeg2000Imf4k" | "Jpeg2000Broadcast" | "Jpeg2000Ht" | "Vc5" | "Mpeg2" | "H264" | "H265" | "ProRes" | "Av1" | { Unknown: string };
|
|
472
472
|
|
|
473
473
|
|
|
474
|
-
/**
|
|
475
|
-
* Compare a SourceAsset against a delivery spec
|
|
476
|
-
*/
|
|
477
|
-
export function compareDelivery(sourceAssetJson: any, deliverySpecJson: any): any;
|
|
478
|
-
|
|
479
|
-
/**
|
|
480
|
-
* Extract a SourceAsset from CPL XML
|
|
481
|
-
*/
|
|
482
|
-
export function extractSourceAsset(cplXml: string): any;
|
|
483
|
-
|
|
484
474
|
/**
|
|
485
475
|
* Get library version
|
|
486
476
|
*/
|
|
@@ -491,15 +481,6 @@ export function getVersion(): string;
|
|
|
491
481
|
*/
|
|
492
482
|
export function init(): void;
|
|
493
483
|
|
|
494
|
-
/**
|
|
495
|
-
* Inspect an IMF package and return structural metadata including unreferenced assets.
|
|
496
|
-
*
|
|
497
|
-
* Returns `{ cplCount, scmCount, declaredSidecars, unreferencedAssets }` where
|
|
498
|
-
* `unreferencedAssets` are assets in the AssetMap with no CPL Virtual Track reference
|
|
499
|
-
* and no SCM declaration — likely sidecar essences delivered without an SCM.
|
|
500
|
-
*/
|
|
501
|
-
export function inspectPackage(files: any): any;
|
|
502
|
-
|
|
503
484
|
/**
|
|
504
485
|
* Parse ASSETMAP.xml and return a typed AssetMap object
|
|
505
486
|
*/
|
|
@@ -521,40 +502,33 @@ export function parsePklTyped(xmlContent: string): any;
|
|
|
521
502
|
export function parseVolindexTyped(xmlContent: string): VolumeIndex;
|
|
522
503
|
|
|
523
504
|
/**
|
|
524
|
-
* Validate a
|
|
525
|
-
*
|
|
526
|
-
* `coreSpec`: "auto" | "v2013" | "v2016" | "v2020"
|
|
527
|
-
* `app2eSpec`: "auto" | "none" | "v2020" | "v2021" | "v2023"
|
|
528
|
-
*/
|
|
529
|
-
export function validateCplWithSpecSelection(cplXml: string, coreSpec?: string | null, app2eSpec?: string | null): any;
|
|
530
|
-
|
|
531
|
-
/**
|
|
532
|
-
* Validate a full IMF package from an in-memory map of filename → XML string.
|
|
505
|
+
* Validate a full IMF package and return both the validation report and parsed data.
|
|
533
506
|
*
|
|
534
507
|
* Pass all XML files from the package as a plain JS object where each key is
|
|
535
508
|
* the filename and each value is the file's text content. ASSETMAP.xml is
|
|
536
509
|
* required; VOLINDEX.xml, PKL files, and CPL files are resolved automatically
|
|
537
510
|
* from the AssetMap.
|
|
538
511
|
*
|
|
539
|
-
*
|
|
512
|
+
* Options (all optional):
|
|
513
|
+
* - `coreSpec`: `"auto"` | `"v2013"` | `"v2016"` | `"v2020"` — core constraints version
|
|
514
|
+
* - `app2eSpec`: `"auto"` | `"none"` | `"v2020"` | `"v2021"` | `"v2023"` — app profile version
|
|
515
|
+
* - `rules`: ESLint-style rules configuration object
|
|
516
|
+
*
|
|
517
|
+
* Returns `{ report, cpls, assetMap, packingLists, volumeIndex, unreferencedAssets, declaredSidecars }`
|
|
540
518
|
*/
|
|
541
|
-
export function
|
|
519
|
+
export function validate(files: any, options: any): any;
|
|
542
520
|
|
|
543
521
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
544
522
|
|
|
545
523
|
export interface InitOutput {
|
|
546
524
|
readonly memory: WebAssembly.Memory;
|
|
547
|
-
readonly compareDelivery: (a: any, b: any) => [number, number, number];
|
|
548
|
-
readonly extractSourceAsset: (a: number, b: number) => [number, number, number];
|
|
549
525
|
readonly getVersion: () => [number, number];
|
|
550
526
|
readonly init: () => void;
|
|
551
|
-
readonly inspectPackage: (a: any) => [number, number, number];
|
|
552
527
|
readonly parseAssetmapTyped: (a: number, b: number) => [number, number, number];
|
|
553
528
|
readonly parseCplTyped: (a: number, b: number) => [number, number, number];
|
|
554
529
|
readonly parsePklTyped: (a: number, b: number) => [number, number, number];
|
|
555
530
|
readonly parseVolindexTyped: (a: number, b: number) => [number, number, number];
|
|
556
|
-
readonly
|
|
557
|
-
readonly validatePackage: (a: any, b: any) => [number, number, number];
|
|
531
|
+
readonly validate: (a: any, b: any) => [number, number, number];
|
|
558
532
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
559
533
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
560
534
|
readonly __wbindgen_exn_store: (a: number) => void;
|
package/imferno_wasm.js
CHANGED
|
@@ -1,34 +1,5 @@
|
|
|
1
1
|
/* @ts-self-types="./imferno_wasm.d.ts" */
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* Compare a SourceAsset against a delivery spec
|
|
5
|
-
* @param {any} sourceAssetJson
|
|
6
|
-
* @param {any} deliverySpecJson
|
|
7
|
-
* @returns {any}
|
|
8
|
-
*/
|
|
9
|
-
export function compareDelivery(sourceAssetJson, deliverySpecJson) {
|
|
10
|
-
const ret = wasm.compareDelivery(sourceAssetJson, deliverySpecJson);
|
|
11
|
-
if (ret[2]) {
|
|
12
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
13
|
-
}
|
|
14
|
-
return takeFromExternrefTable0(ret[0]);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Extract a SourceAsset from CPL XML
|
|
19
|
-
* @param {string} cplXml
|
|
20
|
-
* @returns {any}
|
|
21
|
-
*/
|
|
22
|
-
export function extractSourceAsset(cplXml) {
|
|
23
|
-
const ptr0 = passStringToWasm0(cplXml, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
24
|
-
const len0 = WASM_VECTOR_LEN;
|
|
25
|
-
const ret = wasm.extractSourceAsset(ptr0, len0);
|
|
26
|
-
if (ret[2]) {
|
|
27
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
28
|
-
}
|
|
29
|
-
return takeFromExternrefTable0(ret[0]);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
3
|
/**
|
|
33
4
|
* Get library version
|
|
34
5
|
* @returns {string}
|
|
@@ -53,23 +24,6 @@ export function init() {
|
|
|
53
24
|
wasm.init();
|
|
54
25
|
}
|
|
55
26
|
|
|
56
|
-
/**
|
|
57
|
-
* Inspect an IMF package and return structural metadata including unreferenced assets.
|
|
58
|
-
*
|
|
59
|
-
* Returns `{ cplCount, scmCount, declaredSidecars, unreferencedAssets }` where
|
|
60
|
-
* `unreferencedAssets` are assets in the AssetMap with no CPL Virtual Track reference
|
|
61
|
-
* and no SCM declaration — likely sidecar essences delivered without an SCM.
|
|
62
|
-
* @param {any} files
|
|
63
|
-
* @returns {any}
|
|
64
|
-
*/
|
|
65
|
-
export function inspectPackage(files) {
|
|
66
|
-
const ret = wasm.inspectPackage(files);
|
|
67
|
-
if (ret[2]) {
|
|
68
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
69
|
-
}
|
|
70
|
-
return takeFromExternrefTable0(ret[0]);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
27
|
/**
|
|
74
28
|
* Parse ASSETMAP.xml and return a typed AssetMap object
|
|
75
29
|
* @param {string} xmlContent
|
|
@@ -131,44 +85,25 @@ export function parseVolindexTyped(xmlContent) {
|
|
|
131
85
|
}
|
|
132
86
|
|
|
133
87
|
/**
|
|
134
|
-
* Validate a
|
|
135
|
-
*
|
|
136
|
-
* `coreSpec`: "auto" | "v2013" | "v2016" | "v2020"
|
|
137
|
-
* `app2eSpec`: "auto" | "none" | "v2020" | "v2021" | "v2023"
|
|
138
|
-
* @param {string} cplXml
|
|
139
|
-
* @param {string | null} [coreSpec]
|
|
140
|
-
* @param {string | null} [app2eSpec]
|
|
141
|
-
* @returns {any}
|
|
142
|
-
*/
|
|
143
|
-
export function validateCplWithSpecSelection(cplXml, coreSpec, app2eSpec) {
|
|
144
|
-
const ptr0 = passStringToWasm0(cplXml, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
145
|
-
const len0 = WASM_VECTOR_LEN;
|
|
146
|
-
var ptr1 = isLikeNone(coreSpec) ? 0 : passStringToWasm0(coreSpec, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
147
|
-
var len1 = WASM_VECTOR_LEN;
|
|
148
|
-
var ptr2 = isLikeNone(app2eSpec) ? 0 : passStringToWasm0(app2eSpec, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
149
|
-
var len2 = WASM_VECTOR_LEN;
|
|
150
|
-
const ret = wasm.validateCplWithSpecSelection(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
151
|
-
if (ret[2]) {
|
|
152
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
153
|
-
}
|
|
154
|
-
return takeFromExternrefTable0(ret[0]);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* Validate a full IMF package from an in-memory map of filename → XML string.
|
|
88
|
+
* Validate a full IMF package and return both the validation report and parsed data.
|
|
159
89
|
*
|
|
160
90
|
* Pass all XML files from the package as a plain JS object where each key is
|
|
161
91
|
* the filename and each value is the file's text content. ASSETMAP.xml is
|
|
162
92
|
* required; VOLINDEX.xml, PKL files, and CPL files are resolved automatically
|
|
163
93
|
* from the AssetMap.
|
|
164
94
|
*
|
|
165
|
-
*
|
|
95
|
+
* Options (all optional):
|
|
96
|
+
* - `coreSpec`: `"auto"` | `"v2013"` | `"v2016"` | `"v2020"` — core constraints version
|
|
97
|
+
* - `app2eSpec`: `"auto"` | `"none"` | `"v2020"` | `"v2021"` | `"v2023"` — app profile version
|
|
98
|
+
* - `rules`: ESLint-style rules configuration object
|
|
99
|
+
*
|
|
100
|
+
* Returns `{ report, cpls, assetMap, packingLists, volumeIndex, unreferencedAssets, declaredSidecars }`
|
|
166
101
|
* @param {any} files
|
|
167
|
-
* @param {any}
|
|
102
|
+
* @param {any} options
|
|
168
103
|
* @returns {any}
|
|
169
104
|
*/
|
|
170
|
-
export function
|
|
171
|
-
const ret = wasm.
|
|
105
|
+
export function validate(files, options) {
|
|
106
|
+
const ret = wasm.validate(files, options);
|
|
172
107
|
if (ret[2]) {
|
|
173
108
|
throw takeFromExternrefTable0(ret[1]);
|
|
174
109
|
}
|
|
@@ -178,14 +113,10 @@ export function validatePackage(files, rules) {
|
|
|
178
113
|
function __wbg_get_imports() {
|
|
179
114
|
const import0 = {
|
|
180
115
|
__proto__: null,
|
|
181
|
-
|
|
116
|
+
__wbg_Error_83742b46f01ce22d: function(arg0, arg1) {
|
|
182
117
|
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
183
118
|
return ret;
|
|
184
119
|
},
|
|
185
|
-
__wbg_Number_e89e48a2fe1a6355: function(arg0) {
|
|
186
|
-
const ret = Number(arg0);
|
|
187
|
-
return ret;
|
|
188
|
-
},
|
|
189
120
|
__wbg_String_8564e559799eccda: function(arg0, arg1) {
|
|
190
121
|
const ret = String(arg1);
|
|
191
122
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
@@ -193,68 +124,68 @@ function __wbg_get_imports() {
|
|
|
193
124
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
194
125
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
195
126
|
},
|
|
196
|
-
|
|
127
|
+
__wbg___wbindgen_bigint_get_as_i64_447a76b5c6ef7bda: function(arg0, arg1) {
|
|
197
128
|
const v = arg1;
|
|
198
129
|
const ret = typeof(v) === 'bigint' ? v : undefined;
|
|
199
130
|
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
200
131
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
201
132
|
},
|
|
202
|
-
|
|
133
|
+
__wbg___wbindgen_boolean_get_c0f3f60bac5a78d1: function(arg0) {
|
|
203
134
|
const v = arg0;
|
|
204
135
|
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
205
136
|
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
206
137
|
},
|
|
207
|
-
|
|
138
|
+
__wbg___wbindgen_debug_string_5398f5bb970e0daa: function(arg0, arg1) {
|
|
208
139
|
const ret = debugString(arg1);
|
|
209
140
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
210
141
|
const len1 = WASM_VECTOR_LEN;
|
|
211
142
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
212
143
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
213
144
|
},
|
|
214
|
-
|
|
145
|
+
__wbg___wbindgen_in_41dbb8413020e076: function(arg0, arg1) {
|
|
215
146
|
const ret = arg0 in arg1;
|
|
216
147
|
return ret;
|
|
217
148
|
},
|
|
218
|
-
|
|
149
|
+
__wbg___wbindgen_is_bigint_e2141d4f045b7eda: function(arg0) {
|
|
219
150
|
const ret = typeof(arg0) === 'bigint';
|
|
220
151
|
return ret;
|
|
221
152
|
},
|
|
222
|
-
|
|
153
|
+
__wbg___wbindgen_is_function_3c846841762788c1: function(arg0) {
|
|
223
154
|
const ret = typeof(arg0) === 'function';
|
|
224
155
|
return ret;
|
|
225
156
|
},
|
|
226
|
-
|
|
157
|
+
__wbg___wbindgen_is_null_0b605fc6b167c56f: function(arg0) {
|
|
227
158
|
const ret = arg0 === null;
|
|
228
159
|
return ret;
|
|
229
160
|
},
|
|
230
|
-
|
|
161
|
+
__wbg___wbindgen_is_object_781bc9f159099513: function(arg0) {
|
|
231
162
|
const val = arg0;
|
|
232
163
|
const ret = typeof(val) === 'object' && val !== null;
|
|
233
164
|
return ret;
|
|
234
165
|
},
|
|
235
|
-
|
|
166
|
+
__wbg___wbindgen_is_string_7ef6b97b02428fae: function(arg0) {
|
|
236
167
|
const ret = typeof(arg0) === 'string';
|
|
237
168
|
return ret;
|
|
238
169
|
},
|
|
239
|
-
|
|
170
|
+
__wbg___wbindgen_is_undefined_52709e72fb9f179c: function(arg0) {
|
|
240
171
|
const ret = arg0 === undefined;
|
|
241
172
|
return ret;
|
|
242
173
|
},
|
|
243
|
-
|
|
174
|
+
__wbg___wbindgen_jsval_eq_ee31bfad3e536463: function(arg0, arg1) {
|
|
244
175
|
const ret = arg0 === arg1;
|
|
245
176
|
return ret;
|
|
246
177
|
},
|
|
247
|
-
|
|
178
|
+
__wbg___wbindgen_jsval_loose_eq_5bcc3bed3c69e72b: function(arg0, arg1) {
|
|
248
179
|
const ret = arg0 == arg1;
|
|
249
180
|
return ret;
|
|
250
181
|
},
|
|
251
|
-
|
|
182
|
+
__wbg___wbindgen_number_get_34bb9d9dcfa21373: function(arg0, arg1) {
|
|
252
183
|
const obj = arg1;
|
|
253
184
|
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
254
185
|
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
255
186
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
256
187
|
},
|
|
257
|
-
|
|
188
|
+
__wbg___wbindgen_string_get_395e606bd0ee4427: function(arg0, arg1) {
|
|
258
189
|
const obj = arg1;
|
|
259
190
|
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
260
191
|
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
@@ -262,52 +193,58 @@ function __wbg_get_imports() {
|
|
|
262
193
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
263
194
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
264
195
|
},
|
|
265
|
-
|
|
196
|
+
__wbg___wbindgen_throw_6ddd609b62940d55: function(arg0, arg1) {
|
|
266
197
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
267
198
|
},
|
|
268
|
-
|
|
199
|
+
__wbg_call_e133b57c9155d22c: function() { return handleError(function (arg0, arg1) {
|
|
269
200
|
const ret = arg0.call(arg1);
|
|
270
201
|
return ret;
|
|
271
202
|
}, arguments); },
|
|
272
|
-
|
|
203
|
+
__wbg_done_08ce71ee07e3bd17: function(arg0) {
|
|
273
204
|
const ret = arg0.done;
|
|
274
205
|
return ret;
|
|
275
206
|
},
|
|
276
|
-
|
|
207
|
+
__wbg_entries_e8a20ff8c9757101: function(arg0) {
|
|
277
208
|
const ret = Object.entries(arg0);
|
|
278
209
|
return ret;
|
|
279
210
|
},
|
|
280
|
-
|
|
211
|
+
__wbg_getTime_1dad7b5386ddd2d9: function(arg0) {
|
|
281
212
|
const ret = arg0.getTime();
|
|
282
213
|
return ret;
|
|
283
214
|
},
|
|
284
|
-
|
|
215
|
+
__wbg_get_326e41e095fb2575: function() { return handleError(function (arg0, arg1) {
|
|
285
216
|
const ret = Reflect.get(arg0, arg1);
|
|
286
217
|
return ret;
|
|
287
218
|
}, arguments); },
|
|
288
|
-
|
|
219
|
+
__wbg_get_a8ee5c45dabc1b3b: function(arg0, arg1) {
|
|
289
220
|
const ret = arg0[arg1 >>> 0];
|
|
290
221
|
return ret;
|
|
291
222
|
},
|
|
292
|
-
|
|
223
|
+
__wbg_get_unchecked_329cfe50afab7352: function(arg0, arg1) {
|
|
293
224
|
const ret = arg0[arg1 >>> 0];
|
|
294
225
|
return ret;
|
|
295
226
|
},
|
|
296
|
-
|
|
297
|
-
|
|
227
|
+
__wbg_instanceof_ArrayBuffer_101e2bf31071a9f6: function(arg0) {
|
|
228
|
+
let result;
|
|
229
|
+
try {
|
|
230
|
+
result = arg0 instanceof ArrayBuffer;
|
|
231
|
+
} catch (_) {
|
|
232
|
+
result = false;
|
|
233
|
+
}
|
|
234
|
+
const ret = result;
|
|
298
235
|
return ret;
|
|
299
236
|
},
|
|
300
|
-
|
|
237
|
+
__wbg_instanceof_Map_f194b366846aca0c: function(arg0) {
|
|
301
238
|
let result;
|
|
302
239
|
try {
|
|
303
|
-
result = arg0 instanceof
|
|
240
|
+
result = arg0 instanceof Map;
|
|
304
241
|
} catch (_) {
|
|
305
242
|
result = false;
|
|
306
243
|
}
|
|
307
244
|
const ret = result;
|
|
308
245
|
return ret;
|
|
309
246
|
},
|
|
310
|
-
|
|
247
|
+
__wbg_instanceof_Uint8Array_740438561a5b956d: function(arg0) {
|
|
311
248
|
let result;
|
|
312
249
|
try {
|
|
313
250
|
result = arg0 instanceof Uint8Array;
|
|
@@ -317,58 +254,58 @@ function __wbg_get_imports() {
|
|
|
317
254
|
const ret = result;
|
|
318
255
|
return ret;
|
|
319
256
|
},
|
|
320
|
-
|
|
257
|
+
__wbg_isArray_33b91feb269ff46e: function(arg0) {
|
|
321
258
|
const ret = Array.isArray(arg0);
|
|
322
259
|
return ret;
|
|
323
260
|
},
|
|
324
|
-
|
|
261
|
+
__wbg_isSafeInteger_ecd6a7f9c3e053cd: function(arg0) {
|
|
325
262
|
const ret = Number.isSafeInteger(arg0);
|
|
326
263
|
return ret;
|
|
327
264
|
},
|
|
328
|
-
|
|
265
|
+
__wbg_iterator_d8f549ec8fb061b1: function() {
|
|
329
266
|
const ret = Symbol.iterator;
|
|
330
267
|
return ret;
|
|
331
268
|
},
|
|
332
|
-
|
|
269
|
+
__wbg_length_b3416cf66a5452c8: function(arg0) {
|
|
333
270
|
const ret = arg0.length;
|
|
334
271
|
return ret;
|
|
335
272
|
},
|
|
336
|
-
|
|
273
|
+
__wbg_length_ea16607d7b61445b: function(arg0) {
|
|
337
274
|
const ret = arg0.length;
|
|
338
275
|
return ret;
|
|
339
276
|
},
|
|
340
|
-
|
|
277
|
+
__wbg_log_fa667cf88f249a9c: function(arg0, arg1) {
|
|
341
278
|
console.log(getStringFromWasm0(arg0, arg1));
|
|
342
279
|
},
|
|
343
|
-
|
|
344
|
-
const ret = new Uint8Array(arg0);
|
|
345
|
-
return ret;
|
|
346
|
-
},
|
|
347
|
-
__wbg_new_0_a719938e6f92ddf4: function() {
|
|
280
|
+
__wbg_new_0_1dcafdf5e786e876: function() {
|
|
348
281
|
const ret = new Date();
|
|
349
282
|
return ret;
|
|
350
283
|
},
|
|
351
|
-
|
|
284
|
+
__wbg_new_49d5571bd3f0c4d4: function() {
|
|
352
285
|
const ret = new Map();
|
|
353
286
|
return ret;
|
|
354
287
|
},
|
|
355
|
-
|
|
356
|
-
const ret = new
|
|
288
|
+
__wbg_new_5f486cdf45a04d78: function(arg0) {
|
|
289
|
+
const ret = new Uint8Array(arg0);
|
|
357
290
|
return ret;
|
|
358
291
|
},
|
|
359
|
-
|
|
360
|
-
const ret = new
|
|
292
|
+
__wbg_new_a70fbab9066b301f: function() {
|
|
293
|
+
const ret = new Array();
|
|
361
294
|
return ret;
|
|
362
295
|
},
|
|
363
|
-
|
|
364
|
-
const ret =
|
|
296
|
+
__wbg_new_ab79df5bd7c26067: function() {
|
|
297
|
+
const ret = new Object();
|
|
365
298
|
return ret;
|
|
366
299
|
},
|
|
367
|
-
|
|
300
|
+
__wbg_next_11b99ee6237339e3: function() { return handleError(function (arg0) {
|
|
368
301
|
const ret = arg0.next();
|
|
369
302
|
return ret;
|
|
370
303
|
}, arguments); },
|
|
371
|
-
|
|
304
|
+
__wbg_next_e01a967809d1aa68: function(arg0) {
|
|
305
|
+
const ret = arg0.next;
|
|
306
|
+
return ret;
|
|
307
|
+
},
|
|
308
|
+
__wbg_parse_d8e59ac01c35b18b: function(arg0, arg1) {
|
|
372
309
|
let deferred0_0;
|
|
373
310
|
let deferred0_1;
|
|
374
311
|
try {
|
|
@@ -380,20 +317,20 @@ function __wbg_get_imports() {
|
|
|
380
317
|
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
381
318
|
}
|
|
382
319
|
},
|
|
383
|
-
|
|
320
|
+
__wbg_prototypesetcall_d62e5099504357e6: function(arg0, arg1, arg2) {
|
|
384
321
|
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
385
322
|
},
|
|
386
|
-
|
|
323
|
+
__wbg_set_282384002438957f: function(arg0, arg1, arg2) {
|
|
387
324
|
arg0[arg1 >>> 0] = arg2;
|
|
388
325
|
},
|
|
389
326
|
__wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
|
|
390
327
|
arg0[arg1] = arg2;
|
|
391
328
|
},
|
|
392
|
-
|
|
329
|
+
__wbg_set_bf7251625df30a02: function(arg0, arg1, arg2) {
|
|
393
330
|
const ret = arg0.set(arg1, arg2);
|
|
394
331
|
return ret;
|
|
395
332
|
},
|
|
396
|
-
|
|
333
|
+
__wbg_value_21fc78aab0322612: function(arg0) {
|
|
397
334
|
const ret = arg0.value;
|
|
398
335
|
return ret;
|
|
399
336
|
},
|
package/imferno_wasm_bg.wasm
CHANGED
|
Binary file
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
-
export const compareDelivery: (a: any, b: any) => [number, number, number];
|
|
5
|
-
export const extractSourceAsset: (a: number, b: number) => [number, number, number];
|
|
6
4
|
export const getVersion: () => [number, number];
|
|
7
5
|
export const init: () => void;
|
|
8
|
-
export const inspectPackage: (a: any) => [number, number, number];
|
|
9
6
|
export const parseAssetmapTyped: (a: number, b: number) => [number, number, number];
|
|
10
7
|
export const parseCplTyped: (a: number, b: number) => [number, number, number];
|
|
11
8
|
export const parsePklTyped: (a: number, b: number) => [number, number, number];
|
|
12
9
|
export const parseVolindexTyped: (a: number, b: number) => [number, number, number];
|
|
13
|
-
export const
|
|
14
|
-
export const validatePackage: (a: any, b: any) => [number, number, number];
|
|
10
|
+
export const validate: (a: any, b: any) => [number, number, number];
|
|
15
11
|
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
16
12
|
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
17
13
|
export const __wbindgen_exn_store: (a: number) => void;
|
package/index.d.ts
CHANGED
|
@@ -16,44 +16,44 @@ export function parsePklTyped(xmlContent: string): Promise<any>;
|
|
|
16
16
|
/** Parse VOLINDEX.xml content */
|
|
17
17
|
export function parseVolindexTyped(xmlContent: string): Promise<any>;
|
|
18
18
|
|
|
19
|
-
/**
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
coreSpec?: string,
|
|
29
|
-
app2eSpec?: string,
|
|
30
|
-
): Promise<any>;
|
|
19
|
+
/** Options for the validate function */
|
|
20
|
+
export interface ValidateOptions {
|
|
21
|
+
/** Core constraints spec version: "auto" | "v2013" | "v2016" | "v2020" */
|
|
22
|
+
coreSpec?: "auto" | "v2013" | "v2016" | "v2020";
|
|
23
|
+
/** Application profile version: "auto" | "none" | "v2020" | "v2021" | "v2023" */
|
|
24
|
+
app2eSpec?: "auto" | "none" | "v2020" | "v2021" | "v2023";
|
|
25
|
+
/** ESLint-style rules configuration */
|
|
26
|
+
rules?: Record<string, string>;
|
|
27
|
+
}
|
|
31
28
|
|
|
32
|
-
/**
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
29
|
+
/** Result returned by the validate function */
|
|
30
|
+
export interface ValidateResult {
|
|
31
|
+
/** Validation report with issues, compliance status, and profile */
|
|
32
|
+
report: any;
|
|
33
|
+
/** Parsed Composition Playlists */
|
|
34
|
+
cpls: any[];
|
|
35
|
+
/** Parsed AssetMap (null if parsing failed) */
|
|
36
|
+
assetMap: any | null;
|
|
37
|
+
/** Parsed Packing Lists */
|
|
38
|
+
packingLists: any[];
|
|
39
|
+
/** Parsed Volume Index (null if parsing failed) */
|
|
40
|
+
volumeIndex: any | null;
|
|
41
|
+
/** Assets in the AssetMap with no CPL or SCM reference */
|
|
42
|
+
unreferencedAssets: { id: string; path: string }[];
|
|
43
|
+
/** Sidecar assets declared in SCMs */
|
|
44
|
+
declaredSidecars: { id: string; cplIds: string[] }[];
|
|
45
|
+
}
|
|
42
46
|
|
|
43
47
|
/**
|
|
44
|
-
*
|
|
48
|
+
* Validate a full IMF package and return both validation report and parsed data.
|
|
45
49
|
* @param files Object mapping filenames to XML string content
|
|
46
|
-
* @
|
|
50
|
+
* @param options Optional validation options (spec selection, rules)
|
|
51
|
+
* @returns Validation report + parsed package data
|
|
47
52
|
*/
|
|
48
|
-
export function
|
|
53
|
+
export function validate(
|
|
49
54
|
files: Record<string, string>,
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
/** Extract a SourceAsset from CPL XML */
|
|
53
|
-
export function extractSourceAsset(cplXml: string): Promise<any>;
|
|
54
|
-
|
|
55
|
-
/** Compare a SourceAsset against a delivery spec */
|
|
56
|
-
export function compareDelivery(sourceAssetJson: any, deliverySpecJson: any): Promise<any>;
|
|
55
|
+
options?: ValidateOptions,
|
|
56
|
+
): Promise<ValidateResult>;
|
|
57
57
|
|
|
58
58
|
/** Get the library version */
|
|
59
59
|
export function getVersion(): Promise<string>;
|
package/index.js
CHANGED
|
@@ -51,32 +51,10 @@ export async function parseVolindexTyped(xmlContent) {
|
|
|
51
51
|
return wasm.parseVolindexTyped(xmlContent);
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
// Validation
|
|
55
|
-
export async function
|
|
54
|
+
// Validation — the unified function
|
|
55
|
+
export async function validate(files, options) {
|
|
56
56
|
await ensureInit();
|
|
57
|
-
return wasm.
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export async function validatePackage(files, rules) {
|
|
61
|
-
await ensureInit();
|
|
62
|
-
return wasm.validatePackage(files, rules);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// Inspection
|
|
66
|
-
export async function inspectPackage(files) {
|
|
67
|
-
await ensureInit();
|
|
68
|
-
return wasm.inspectPackage(files);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// Source asset / delivery
|
|
72
|
-
export async function extractSourceAsset(cplXml) {
|
|
73
|
-
await ensureInit();
|
|
74
|
-
return wasm.extractSourceAsset(cplXml);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export async function compareDelivery(sourceAssetJson, deliverySpecJson) {
|
|
78
|
-
await ensureInit();
|
|
79
|
-
return wasm.compareDelivery(sourceAssetJson, deliverySpecJson);
|
|
57
|
+
return wasm.validate(files, options);
|
|
80
58
|
}
|
|
81
59
|
|
|
82
60
|
// Utility
|